@@ -397,7 +397,7 @@ |
||
397 | 397 | * |
398 | 398 | * @since 1.8.11 |
399 | 399 | * |
400 | - * @return void |
|
400 | + * @return false|null |
|
401 | 401 | */ |
402 | 402 | function give_create_pages() { |
403 | 403 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @global $wpdb |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_install( $network_wide = false ) { |
|
31 | +function give_install($network_wide = false) { |
|
32 | 32 | |
33 | 33 | global $wpdb; |
34 | 34 | |
35 | - if ( is_multisite() && $network_wide ) { |
|
35 | + if (is_multisite() && $network_wide) { |
|
36 | 36 | |
37 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
37 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
38 | 38 | |
39 | - switch_to_blog( $blog_id ); |
|
39 | + switch_to_blog($blog_id); |
|
40 | 40 | give_run_install(); |
41 | 41 | restore_current_blog(); |
42 | 42 | |
@@ -63,31 +63,31 @@ discard block |
||
63 | 63 | give_setup_post_types(); |
64 | 64 | |
65 | 65 | // Add Upgraded From Option. |
66 | - $current_version = get_option( 'give_version' ); |
|
67 | - if ( $current_version ) { |
|
68 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
66 | + $current_version = get_option('give_version'); |
|
67 | + if ($current_version) { |
|
68 | + update_option('give_version_upgraded_from', $current_version); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Setup some default options. |
72 | 72 | $options = array(); |
73 | 73 | |
74 | 74 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
75 | - if ( empty( $current_version ) ) { |
|
76 | - $options = array_merge( $options, give_get_default_settings() ); |
|
75 | + if (empty($current_version)) { |
|
76 | + $options = array_merge($options, give_get_default_settings()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Populate the default values. |
80 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
80 | + update_option('give_settings', array_merge($give_options, $options)); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Run plugin upgrades. |
84 | 84 | * |
85 | 85 | * @since 1.8 |
86 | 86 | */ |
87 | - do_action( 'give_upgrades' ); |
|
87 | + do_action('give_upgrades'); |
|
88 | 88 | |
89 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
90 | - update_option( 'give_version', GIVE_VERSION ); |
|
89 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
90 | + update_option('give_version', GIVE_VERSION); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Create Give roles. |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Set api version, end point and refresh permalink. |
99 | 99 | $api = new Give_API(); |
100 | 100 | $api->add_endpoint(); |
101 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
101 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
102 | 102 | |
103 | 103 | flush_rewrite_rules(); |
104 | 104 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $give_sessions->use_php_sessions(); |
114 | 114 | |
115 | 115 | // Add a temporary option to note that Give pages have been created. |
116 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
116 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
117 | 117 | |
118 | - if ( ! $current_version ) { |
|
118 | + if ( ! $current_version) { |
|
119 | 119 | |
120 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
120 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
121 | 121 | |
122 | 122 | // When new upgrade routines are added, mark them as complete on fresh install. |
123 | 123 | $upgrade_routines = array( |
@@ -150,18 +150,18 @@ discard block |
||
150 | 150 | 'v213_delete_donation_meta' |
151 | 151 | ); |
152 | 152 | |
153 | - foreach ( $upgrade_routines as $upgrade ) { |
|
154 | - give_set_upgrade_complete( $upgrade ); |
|
153 | + foreach ($upgrade_routines as $upgrade) { |
|
154 | + give_set_upgrade_complete($upgrade); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Bail if activating from network, or bulk. |
159 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
159 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Add the transient to redirect. |
164 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
164 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * @param int $site_id The Site ID. |
180 | 180 | * @param array $meta Blog Meta. |
181 | 181 | */ |
182 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
182 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
183 | 183 | |
184 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
184 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
185 | 185 | |
186 | - switch_to_blog( $blog_id ); |
|
186 | + switch_to_blog($blog_id); |
|
187 | 187 | give_install(); |
188 | 188 | restore_current_blog(); |
189 | 189 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | } |
193 | 193 | |
194 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
194 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
195 | 195 | |
196 | 196 | |
197 | 197 | /** |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array The tables to drop. |
206 | 206 | */ |
207 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
207 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
208 | 208 | |
209 | - switch_to_blog( $blog_id ); |
|
209 | + switch_to_blog($blog_id); |
|
210 | 210 | $donors_db = new Give_DB_Donors(); |
211 | 211 | $donor_meta_db = new Give_DB_Donor_Meta(); |
212 | 212 | |
213 | - if ( $donors_db->installed() ) { |
|
213 | + if ($donors_db->installed()) { |
|
214 | 214 | $tables[] = $donors_db->table_name; |
215 | 215 | $tables[] = $donor_meta_db->table_name; |
216 | 216 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
223 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * Post-installation |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | */ |
233 | 233 | function give_after_install() { |
234 | 234 | |
235 | - if ( ! is_admin() ) { |
|
235 | + if ( ! is_admin()) { |
|
236 | 236 | return; |
237 | 237 | } |
238 | 238 | |
239 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
240 | - $give_table_check = get_option( '_give_table_check', false ); |
|
239 | + $give_options = Give_Cache::get('_give_installed', true); |
|
240 | + $give_table_check = get_option('_give_table_check', false); |
|
241 | 241 | |
242 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
242 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
243 | 243 | |
244 | - if ( ! @Give()->donor_meta->installed() ) { |
|
244 | + if ( ! @Give()->donor_meta->installed()) { |
|
245 | 245 | |
246 | 246 | // Create the donor meta database. |
247 | 247 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | } |
251 | 251 | |
252 | - if ( ! @Give()->donors->installed() ) { |
|
252 | + if ( ! @Give()->donors->installed()) { |
|
253 | 253 | // Create the donor database. |
254 | 254 | // (this ensures it creates it on multisite instances where it is network activated). |
255 | 255 | @Give()->donors->create_table(); |
@@ -261,22 +261,22 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @param array $give_options Give plugin options. |
263 | 263 | */ |
264 | - do_action( 'give_after_install', $give_options ); |
|
264 | + do_action('give_after_install', $give_options); |
|
265 | 265 | } |
266 | 266 | |
267 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
267 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | |
271 | 271 | // Delete the transient |
272 | - if ( false !== $give_options ) { |
|
273 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
272 | + if (false !== $give_options) { |
|
273 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
277 | 277 | } |
278 | 278 | |
279 | -add_action( 'admin_init', 'give_after_install' ); |
|
279 | +add_action('admin_init', 'give_after_install'); |
|
280 | 280 | |
281 | 281 | |
282 | 282 | /** |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | |
292 | 292 | global $wp_roles; |
293 | 293 | |
294 | - if ( ! is_object( $wp_roles ) ) { |
|
294 | + if ( ! is_object($wp_roles)) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 | |
298 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
298 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
299 | 299 | |
300 | 300 | // Create Give plugin roles |
301 | 301 | $roles = new Give_Roles(); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | } |
308 | 308 | |
309 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
309 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Default core setting values. |
@@ -347,14 +347,14 @@ discard block |
||
347 | 347 | 'uninstall_on_delete' => 'disabled', |
348 | 348 | 'the_content_filter' => 'enabled', |
349 | 349 | 'scripts_footer' => 'disabled', |
350 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
350 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
351 | 351 | 'agreement_text' => give_get_default_agreement_text(), |
352 | 352 | |
353 | 353 | // Paypal IPN verification. |
354 | 354 | 'paypal_verification' => 'enabled', |
355 | 355 | |
356 | 356 | // Default is manual gateway. |
357 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
357 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
358 | 358 | 'default_gateway' => 'manual', |
359 | 359 | |
360 | 360 | // Offline gateway setup. |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | function give_get_default_agreement_text() { |
384 | 384 | |
385 | - $org_name = get_bloginfo( 'name' ); |
|
385 | + $org_name = get_bloginfo('name'); |
|
386 | 386 | |
387 | 387 | $agreement = sprintf( |
388 | 388 | '<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the %1$s.</p> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $org_name |
397 | 397 | ); |
398 | 398 | |
399 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
399 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | |
@@ -410,19 +410,19 @@ discard block |
||
410 | 410 | function give_create_pages() { |
411 | 411 | |
412 | 412 | // Bailout if pages already created. |
413 | - if ( get_option( 'give_install_pages_created' ) ) { |
|
413 | + if (get_option('give_install_pages_created')) { |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $options = array(); |
418 | 418 | |
419 | 419 | // Checks if the Success Page option exists AND that the page exists. |
420 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
420 | + if ( ! get_post(give_get_option('success_page'))) { |
|
421 | 421 | |
422 | 422 | // Donation Confirmation (Success) Page |
423 | 423 | $success = wp_insert_post( |
424 | 424 | array( |
425 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
425 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
426 | 426 | 'post_content' => '[give_receipt]', |
427 | 427 | 'post_status' => 'publish', |
428 | 428 | 'post_author' => 1, |
@@ -436,13 +436,13 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | // Checks if the Failure Page option exists AND that the page exists. |
439 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
439 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
440 | 440 | |
441 | 441 | // Failed Donation Page |
442 | 442 | $failed = wp_insert_post( |
443 | 443 | array( |
444 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
445 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
444 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
445 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
446 | 446 | 'post_status' => 'publish', |
447 | 447 | 'post_author' => 1, |
448 | 448 | 'post_type' => 'page', |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | } |
455 | 455 | |
456 | 456 | // Checks if the History Page option exists AND that the page exists. |
457 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
457 | + if ( ! get_post(give_get_option('history_page'))) { |
|
458 | 458 | // Donation History Page |
459 | 459 | $history = wp_insert_post( |
460 | 460 | array( |
461 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
461 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
462 | 462 | 'post_content' => '[donation_history]', |
463 | 463 | 'post_status' => 'publish', |
464 | 464 | 'post_author' => 1, |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | $options['history_page'] = $history; |
471 | 471 | } |
472 | 472 | |
473 | - if ( ! empty( $options ) ) { |
|
474 | - update_option( 'give_settings', array_merge( give_get_settings(), $options ) ); |
|
473 | + if ( ! empty($options)) { |
|
474 | + update_option('give_settings', array_merge(give_get_settings(), $options)); |
|
475 | 475 | } |
476 | 476 | |
477 | - add_option( 'give_install_pages_created', 1, '', 'no' ); |
|
477 | + add_option('give_install_pages_created', 1, '', 'no'); |
|
478 | 478 | } |
479 | 479 | |
480 | -add_action( 'admin_init', 'give_create_pages', - 1 ); |
|
480 | +add_action('admin_init', 'give_create_pages', - 1); |
@@ -207,7 +207,7 @@ |
||
207 | 207 | * metadata entries with the specified value. |
208 | 208 | * Otherwise, update all entries. |
209 | 209 | * |
210 | - * @return mixed |
|
210 | + * @return null|boolean |
|
211 | 211 | */ |
212 | 212 | function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
213 | 213 | // Bailout. |
@@ -9,74 +9,74 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @return void |
11 | 11 | */ |
12 | -function _give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value ) { |
|
12 | +function _give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value) { |
|
13 | 13 | // Bailout |
14 | - if ( empty( $meta_value ) ) { |
|
14 | + if (empty($meta_value)) { |
|
15 | 15 | return; |
16 | - } elseif ( ! is_array( $meta_value ) ) { |
|
16 | + } elseif ( ! is_array($meta_value)) { |
|
17 | 17 | $meta_value = array(); |
18 | 18 | } |
19 | 19 | |
20 | - remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10 ); |
|
20 | + remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10); |
|
21 | 21 | |
22 | 22 | // Date payment meta. |
23 | - if ( ! empty( $meta_value['date'] ) ) { |
|
24 | - give_update_meta( $object_id, '_give_payment_date', $meta_value['date'] ); |
|
23 | + if ( ! empty($meta_value['date'])) { |
|
24 | + give_update_meta($object_id, '_give_payment_date', $meta_value['date']); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Currency payment meta. |
28 | - if ( ! empty( $meta_value['currency'] ) ) { |
|
29 | - give_update_meta( $object_id, '_give_payment_currency', $meta_value['currency'] ); |
|
28 | + if ( ! empty($meta_value['currency'])) { |
|
29 | + give_update_meta($object_id, '_give_payment_currency', $meta_value['currency']); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | // User information. |
33 | - if ( ! empty( $meta_value['user_info'] ) ) { |
|
33 | + if ( ! empty($meta_value['user_info'])) { |
|
34 | 34 | // Donor first name. |
35 | - if ( ! empty( $meta_value['user_info']['first_name'] ) ) { |
|
36 | - give_update_meta( $object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name'] ); |
|
35 | + if ( ! empty($meta_value['user_info']['first_name'])) { |
|
36 | + give_update_meta($object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name']); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Donor last name. |
40 | - if ( ! empty( $meta_value['user_info']['last_name'] ) ) { |
|
41 | - give_update_meta( $object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name'] ); |
|
40 | + if ( ! empty($meta_value['user_info']['last_name'])) { |
|
41 | + give_update_meta($object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Donor address payment meta. |
45 | - if ( ! empty( $meta_value['user_info']['address'] ) ) { |
|
45 | + if ( ! empty($meta_value['user_info']['address'])) { |
|
46 | 46 | |
47 | 47 | // Address1. |
48 | - if ( ! empty( $meta_value['user_info']['address']['line1'] ) ) { |
|
49 | - give_update_meta( $object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1'] ); |
|
48 | + if ( ! empty($meta_value['user_info']['address']['line1'])) { |
|
49 | + give_update_meta($object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1']); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Address2. |
53 | - if ( ! empty( $meta_value['user_info']['address']['line2'] ) ) { |
|
54 | - give_update_meta( $object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2'] ); |
|
53 | + if ( ! empty($meta_value['user_info']['address']['line2'])) { |
|
54 | + give_update_meta($object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2']); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // City. |
58 | - if ( ! empty( $meta_value['user_info']['address']['city'] ) ) { |
|
59 | - give_update_meta( $object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city'] ); |
|
58 | + if ( ! empty($meta_value['user_info']['address']['city'])) { |
|
59 | + give_update_meta($object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city']); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Zip. |
63 | - if ( ! empty( $meta_value['user_info']['address']['zip'] ) ) { |
|
64 | - give_update_meta( $object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip'] ); |
|
63 | + if ( ! empty($meta_value['user_info']['address']['zip'])) { |
|
64 | + give_update_meta($object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // State. |
68 | - if ( ! empty( $meta_value['user_info']['address']['state'] ) ) { |
|
69 | - give_update_meta( $object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state'] ); |
|
68 | + if ( ! empty($meta_value['user_info']['address']['state'])) { |
|
69 | + give_update_meta($object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state']); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Country. |
73 | - if ( ! empty( $meta_value['user_info']['address']['country'] ) ) { |
|
74 | - give_update_meta( $object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country'] ); |
|
73 | + if ( ! empty($meta_value['user_info']['address']['country'])) { |
|
74 | + give_update_meta($object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country']); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | }// End if(). |
78 | 78 | |
79 | - add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
79 | + add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -89,103 +89,99 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return array |
91 | 91 | */ |
92 | -function _give_20_bc_give_payment_meta_value( $object_id, $meta_value ) { |
|
92 | +function _give_20_bc_give_payment_meta_value($object_id, $meta_value) { |
|
93 | 93 | $cache_key = "_give_payment_meta_{$object_id}"; |
94 | - $cache = Give_Cache::get_db_query( $cache_key ); |
|
94 | + $cache = Give_Cache::get_db_query($cache_key); |
|
95 | 95 | |
96 | - if ( ! is_null( $cache ) ) { |
|
96 | + if ( ! is_null($cache)) { |
|
97 | 97 | return $cache; |
98 | 98 | } |
99 | 99 | |
100 | 100 | // Set default value to array. |
101 | - if ( ! is_array( $meta_value ) ) { |
|
101 | + if ( ! is_array($meta_value)) { |
|
102 | 102 | $meta_value = array(); |
103 | 103 | } |
104 | 104 | |
105 | 105 | // Donation key. |
106 | - $meta_value['key'] = give_get_meta( $object_id, '_give_payment_purchase_key', true ); |
|
106 | + $meta_value['key'] = give_get_meta($object_id, '_give_payment_purchase_key', true); |
|
107 | 107 | |
108 | 108 | // Donation form. |
109 | - $meta_value['form_title'] = give_get_meta( $object_id, '_give_payment_form_title', true ); |
|
109 | + $meta_value['form_title'] = give_get_meta($object_id, '_give_payment_form_title', true); |
|
110 | 110 | |
111 | 111 | // Donor email. |
112 | - $meta_value['email'] = give_get_meta( $object_id, '_give_payment_donor_email', true ); |
|
113 | - $meta_value['email'] = ! empty( $meta_value['email'] ) ? |
|
114 | - $meta_value['email'] : |
|
115 | - Give()->donors->get_column( 'email', give_get_payment_donor_id( $object_id ) ); |
|
112 | + $meta_value['email'] = give_get_meta($object_id, '_give_payment_donor_email', true); |
|
113 | + $meta_value['email'] = ! empty($meta_value['email']) ? |
|
114 | + $meta_value['email'] : Give()->donors->get_column('email', give_get_payment_donor_id($object_id)); |
|
116 | 115 | |
117 | 116 | // Form id. |
118 | - $meta_value['form_id'] = give_get_meta( $object_id, '_give_payment_form_id', true ); |
|
117 | + $meta_value['form_id'] = give_get_meta($object_id, '_give_payment_form_id', true); |
|
119 | 118 | |
120 | 119 | // Price id. |
121 | - $meta_value['price_id'] = give_get_meta( $object_id, '_give_payment_price_id', true ); |
|
120 | + $meta_value['price_id'] = give_get_meta($object_id, '_give_payment_price_id', true); |
|
122 | 121 | |
123 | 122 | // Date. |
124 | - $meta_value['date'] = give_get_meta( $object_id, '_give_payment_date', true ); |
|
125 | - $meta_value['date'] = ! empty( $meta_value['date'] ) ? |
|
126 | - $meta_value['date'] : |
|
127 | - get_post_field( 'post_date', $object_id ); |
|
123 | + $meta_value['date'] = give_get_meta($object_id, '_give_payment_date', true); |
|
124 | + $meta_value['date'] = ! empty($meta_value['date']) ? |
|
125 | + $meta_value['date'] : get_post_field('post_date', $object_id); |
|
128 | 126 | |
129 | 127 | // Currency. |
130 | - $meta_value['currency'] = give_get_meta( $object_id, '_give_payment_currency', true ); |
|
128 | + $meta_value['currency'] = give_get_meta($object_id, '_give_payment_currency', true); |
|
131 | 129 | |
132 | 130 | // Decode donor data. |
133 | - $donor_names = give_get_donor_name_by( give_get_meta( $object_id, '_give_payment_donor_id', true ), 'donor' ); |
|
134 | - $donor_names = explode( ' ', $donor_names, 2 ); |
|
131 | + $donor_names = give_get_donor_name_by(give_get_meta($object_id, '_give_payment_donor_id', true), 'donor'); |
|
132 | + $donor_names = explode(' ', $donor_names, 2); |
|
135 | 133 | |
136 | 134 | // Donor first name. |
137 | - $donor_data['first_name'] = give_get_meta( $object_id, '_give_donor_billing_first_name', true ); |
|
138 | - $donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ? |
|
139 | - $donor_data['first_name'] : |
|
140 | - $donor_names[0]; |
|
135 | + $donor_data['first_name'] = give_get_meta($object_id, '_give_donor_billing_first_name', true); |
|
136 | + $donor_data['first_name'] = ! empty($donor_data['first_name']) ? |
|
137 | + $donor_data['first_name'] : $donor_names[0]; |
|
141 | 138 | |
142 | 139 | // Donor last name. |
143 | - $donor_data['last_name'] = give_get_meta( $object_id, '_give_donor_billing_last_name', true ); |
|
144 | - $donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ? |
|
145 | - $donor_data['last_name'] : |
|
146 | - ( isset( $donor_names[1] ) ? $donor_names[1] : '' ); |
|
140 | + $donor_data['last_name'] = give_get_meta($object_id, '_give_donor_billing_last_name', true); |
|
141 | + $donor_data['last_name'] = ! empty($donor_data['last_name']) ? |
|
142 | + $donor_data['last_name'] : (isset($donor_names[1]) ? $donor_names[1] : ''); |
|
147 | 143 | |
148 | 144 | // Donor email. |
149 | 145 | $donor_data['email'] = $meta_value['email']; |
150 | 146 | |
151 | 147 | // User ID. |
152 | - $donor_data['id'] = give_get_payment_user_id( $object_id ); |
|
148 | + $donor_data['id'] = give_get_payment_user_id($object_id); |
|
153 | 149 | |
154 | 150 | $donor_data['address'] = false; |
155 | 151 | |
156 | 152 | // Address1. |
157 | - if ( $address1 = give_get_meta( $object_id, '_give_donor_billing_address1', true ) ) { |
|
153 | + if ($address1 = give_get_meta($object_id, '_give_donor_billing_address1', true)) { |
|
158 | 154 | $donor_data['address']['line1'] = $address1; |
159 | 155 | } |
160 | 156 | |
161 | 157 | // Address2. |
162 | - if ( $address2 = give_get_meta( $object_id, '_give_donor_billing_address2', true ) ) { |
|
158 | + if ($address2 = give_get_meta($object_id, '_give_donor_billing_address2', true)) { |
|
163 | 159 | $donor_data['address']['line2'] = $address2; |
164 | 160 | } |
165 | 161 | |
166 | 162 | // City. |
167 | - if ( $city = give_get_meta( $object_id, '_give_donor_billing_city', true ) ) { |
|
163 | + if ($city = give_get_meta($object_id, '_give_donor_billing_city', true)) { |
|
168 | 164 | $donor_data['address']['city'] = $city; |
169 | 165 | } |
170 | 166 | |
171 | 167 | // Zip. |
172 | - if ( $zip = give_get_meta( $object_id, '_give_donor_billing_zip', true ) ) { |
|
168 | + if ($zip = give_get_meta($object_id, '_give_donor_billing_zip', true)) { |
|
173 | 169 | $donor_data['address']['zip'] = $zip; |
174 | 170 | } |
175 | 171 | |
176 | 172 | // State. |
177 | - if ( $state = give_get_meta( $object_id, '_give_donor_billing_state', true ) ) { |
|
173 | + if ($state = give_get_meta($object_id, '_give_donor_billing_state', true)) { |
|
178 | 174 | $donor_data['address']['state'] = $state; |
179 | 175 | } |
180 | 176 | |
181 | 177 | // Country. |
182 | - if ( $country = give_get_meta( $object_id, '_give_donor_billing_country', true ) ) { |
|
178 | + if ($country = give_get_meta($object_id, '_give_donor_billing_country', true)) { |
|
183 | 179 | $donor_data['address']['country'] = $country; |
184 | 180 | } |
185 | 181 | |
186 | - $meta_value['user_info'] = maybe_unserialize( $donor_data ); |
|
182 | + $meta_value['user_info'] = maybe_unserialize($donor_data); |
|
187 | 183 | |
188 | - Give_Cache::set_db_query( $cache_key, $meta_value ); |
|
184 | + Give_Cache::set_db_query($cache_key, $meta_value); |
|
189 | 185 | |
190 | 186 | return $meta_value; |
191 | 187 | } |
@@ -209,37 +205,37 @@ discard block |
||
209 | 205 | * |
210 | 206 | * @return mixed |
211 | 207 | */ |
212 | -function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
|
208 | +function _give_20_bc_saving_old_payment_meta($check, $object_id, $meta_key, $meta_value, $prev_value) { |
|
213 | 209 | // Bailout. |
214 | 210 | if ( |
215 | - 'give_payment' !== get_post_type( $object_id ) || |
|
216 | - ! in_array( $meta_key, array( |
|
211 | + 'give_payment' !== get_post_type($object_id) || |
|
212 | + ! in_array($meta_key, array( |
|
217 | 213 | '_give_payment_meta', |
218 | 214 | '_give_payment_user_email', |
219 | 215 | '_give_payment_customer_id', |
220 | 216 | 'give_payment_user_ip', |
221 | - ) ) |
|
217 | + )) |
|
222 | 218 | ) { |
223 | 219 | return $check; |
224 | 220 | } |
225 | 221 | |
226 | - if ( '_give_payment_meta' === $meta_key ) { |
|
227 | - _give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value ); |
|
228 | - } elseif ( '_give_payment_user_email' === $meta_key ) { |
|
229 | - give_update_meta( $object_id, '_give_payment_donor_email', $meta_value ); |
|
222 | + if ('_give_payment_meta' === $meta_key) { |
|
223 | + _give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value); |
|
224 | + } elseif ('_give_payment_user_email' === $meta_key) { |
|
225 | + give_update_meta($object_id, '_give_payment_donor_email', $meta_value); |
|
230 | 226 | $check = true; |
231 | - } elseif ( '_give_payment_customer_id' === $meta_key ) { |
|
232 | - give_update_meta( $object_id, '_give_payment_donor_id', $meta_value ); |
|
227 | + } elseif ('_give_payment_customer_id' === $meta_key) { |
|
228 | + give_update_meta($object_id, '_give_payment_donor_id', $meta_value); |
|
233 | 229 | $check = true; |
234 | - } elseif ( 'give_payment_user_ip' === $meta_key ) { |
|
235 | - give_update_meta( $object_id, '_give_payment_donor_ip', $meta_value ); |
|
230 | + } elseif ('give_payment_user_ip' === $meta_key) { |
|
231 | + give_update_meta($object_id, '_give_payment_donor_ip', $meta_value); |
|
236 | 232 | $check = true; |
237 | 233 | } |
238 | 234 | |
239 | 235 | return $check; |
240 | 236 | } |
241 | 237 | |
242 | -add_filter( 'update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5 ); |
|
238 | +add_filter('update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5); |
|
243 | 239 | |
244 | 240 | |
245 | 241 | /** |
@@ -254,7 +250,7 @@ discard block |
||
254 | 250 | * |
255 | 251 | * @return mixed |
256 | 252 | */ |
257 | -function _give_20_bc_get_old_payment_meta( $check, $object_id, $meta_key, $single ) { |
|
253 | +function _give_20_bc_get_old_payment_meta($check, $object_id, $meta_key, $single) { |
|
258 | 254 | global $wpdb; |
259 | 255 | |
260 | 256 | // Deprecated meta keys. |
@@ -265,32 +261,31 @@ discard block |
||
265 | 261 | ); |
266 | 262 | |
267 | 263 | // Add _give_payment_meta to backward compatibility |
268 | - if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
264 | + if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
269 | 265 | $old_meta_keys[] = '_give_payment_meta'; |
270 | 266 | } |
271 | 267 | |
272 | 268 | // Bailout. |
273 | 269 | if ( |
274 | - 'give_payment' !== get_post_type( $object_id ) || |
|
275 | - ! in_array( $meta_key, $old_meta_keys ) |
|
270 | + 'give_payment' !== get_post_type($object_id) || |
|
271 | + ! in_array($meta_key, $old_meta_keys) |
|
276 | 272 | ) { |
277 | 273 | return $check; |
278 | 274 | } |
279 | 275 | |
280 | 276 | $cache_key = "{$meta_key}_{$object_id}"; |
281 | - $check = Give_Cache::get_db_query( $cache_key ); |
|
277 | + $check = Give_Cache::get_db_query($cache_key); |
|
282 | 278 | |
283 | - if ( is_null( $check ) ) { |
|
284 | - switch ( $meta_key ) { |
|
279 | + if (is_null($check)) { |
|
280 | + switch ($meta_key) { |
|
285 | 281 | |
286 | 282 | // Handle old meta keys. |
287 | 283 | case '_give_payment_meta': |
288 | - remove_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta' ); |
|
284 | + remove_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta'); |
|
289 | 285 | |
290 | 286 | // if ( $meta_value = give_get_meta( $object_id, '_give_payment_meta' ) ) { |
291 | - $meta_value = ! empty( $meta_value ) ? |
|
292 | - current( $meta_value ) : |
|
293 | - (array) maybe_unserialize( |
|
287 | + $meta_value = ! empty($meta_value) ? |
|
288 | + current($meta_value) : (array) maybe_unserialize( |
|
294 | 289 | $wpdb->get_var( |
295 | 290 | $wpdb->prepare( |
296 | 291 | " |
@@ -304,44 +299,44 @@ discard block |
||
304 | 299 | ) |
305 | 300 | ) |
306 | 301 | ); |
307 | - $check = _give_20_bc_give_payment_meta_value( $object_id, $meta_value ); |
|
302 | + $check = _give_20_bc_give_payment_meta_value($object_id, $meta_value); |
|
308 | 303 | // } |
309 | 304 | |
310 | - add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 ); |
|
305 | + add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5); |
|
311 | 306 | |
312 | 307 | break; |
313 | 308 | |
314 | 309 | case '_give_payment_customer_id': |
315 | - if ( $donor_id = give_get_meta( $object_id, '_give_payment_donor_id', $single ) ) { |
|
310 | + if ($donor_id = give_get_meta($object_id, '_give_payment_donor_id', $single)) { |
|
316 | 311 | $check = $donor_id; |
317 | 312 | } |
318 | 313 | break; |
319 | 314 | |
320 | 315 | case '_give_payment_user_email': |
321 | - if ( $donor_email = give_get_meta( $object_id, '_give_payment_donor_email', $single ) ) { |
|
316 | + if ($donor_email = give_get_meta($object_id, '_give_payment_donor_email', $single)) { |
|
322 | 317 | $check = $donor_email; |
323 | 318 | } |
324 | 319 | break; |
325 | 320 | |
326 | 321 | case '_give_payment_user_ip': |
327 | - if ( $donor_ip = give_get_meta( $object_id, '_give_payment_donor_ip', $single ) ) { |
|
322 | + if ($donor_ip = give_get_meta($object_id, '_give_payment_donor_ip', $single)) { |
|
328 | 323 | $check = $donor_ip; |
329 | 324 | } |
330 | 325 | break; |
331 | 326 | }// End switch(). |
332 | 327 | |
333 | - Give_Cache::set_db_query( $cache_key, $check ); |
|
328 | + Give_Cache::set_db_query($cache_key, $check); |
|
334 | 329 | } |
335 | 330 | |
336 | 331 | // Put result in an array on zero index. |
337 | - if ( ! is_null( $check ) ) { |
|
338 | - $check = array( $check ); |
|
332 | + if ( ! is_null($check)) { |
|
333 | + $check = array($check); |
|
339 | 334 | } |
340 | 335 | |
341 | 336 | return $check; |
342 | 337 | } |
343 | 338 | |
344 | -add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 ); |
|
339 | +add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5); |
|
345 | 340 | |
346 | 341 | |
347 | 342 | /** |
@@ -356,9 +351,9 @@ discard block |
||
356 | 351 | * |
357 | 352 | * @return mixed |
358 | 353 | */ |
359 | -function _give_20_bc_get_new_payment_meta( $check, $object_id, $meta_key, $single ) { |
|
354 | +function _give_20_bc_get_new_payment_meta($check, $object_id, $meta_key, $single) { |
|
360 | 355 | // Bailout: do not apply backward compatibility if upgrade done. |
361 | - if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
356 | + if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
362 | 357 | return $check; |
363 | 358 | } |
364 | 359 | |
@@ -380,26 +375,26 @@ discard block |
||
380 | 375 | ); |
381 | 376 | |
382 | 377 | // metadata_exists fx will cause of firing get_post_metadata filter again so remove it to prevent infinite loop. |
383 | - remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta' ); |
|
378 | + remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta'); |
|
384 | 379 | |
385 | 380 | // Bailout. |
386 | 381 | if ( |
387 | - 'give_payment' !== get_post_type( $object_id ) || |
|
388 | - ! in_array( $meta_key, $new_meta_keys ) || |
|
389 | - metadata_exists( 'post', $object_id, $meta_key ) |
|
382 | + 'give_payment' !== get_post_type($object_id) || |
|
383 | + ! in_array($meta_key, $new_meta_keys) || |
|
384 | + metadata_exists('post', $object_id, $meta_key) |
|
390 | 385 | ) { |
391 | - add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
386 | + add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
392 | 387 | |
393 | 388 | return $check; |
394 | 389 | } |
395 | 390 | |
396 | - add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
391 | + add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
397 | 392 | |
398 | 393 | $cache_key = "{$meta_key}_{$object_id}"; |
399 | - $check = Give_Cache::get_db_query( $cache_key ); |
|
394 | + $check = Give_Cache::get_db_query($cache_key); |
|
400 | 395 | |
401 | - if ( is_null( $check ) ) { |
|
402 | - switch ( $meta_key ) { |
|
396 | + if (is_null($check)) { |
|
397 | + switch ($meta_key) { |
|
403 | 398 | |
404 | 399 | // Handle new meta keys. |
405 | 400 | case '_give_payment_donor_id': |
@@ -442,9 +437,9 @@ discard block |
||
442 | 437 | case '_give_donor_billing_country': |
443 | 438 | case '_give_payment_date': |
444 | 439 | case '_give_payment_currency': |
445 | - $donation_meta = Give_Cache::get_db_query( "_give_payment_meta_{$object_id}" ); |
|
440 | + $donation_meta = Give_Cache::get_db_query("_give_payment_meta_{$object_id}"); |
|
446 | 441 | |
447 | - if ( is_null( $donation_meta ) ) { |
|
442 | + if (is_null($donation_meta)) { |
|
448 | 443 | $donation_meta = $wpdb->get_var( |
449 | 444 | $wpdb->prepare( |
450 | 445 | "SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id=%d AND meta_key=%s", |
@@ -452,51 +447,51 @@ discard block |
||
452 | 447 | '_give_payment_meta' |
453 | 448 | ) |
454 | 449 | ); |
455 | - $donation_meta = maybe_unserialize( $donation_meta ); |
|
456 | - $donation_meta = ! is_array( $donation_meta ) ? array() : $donation_meta; |
|
457 | - Give_Cache::set_db_query( "_give_payment_meta_{$object_id}", $donation_meta ); |
|
450 | + $donation_meta = maybe_unserialize($donation_meta); |
|
451 | + $donation_meta = ! is_array($donation_meta) ? array() : $donation_meta; |
|
452 | + Give_Cache::set_db_query("_give_payment_meta_{$object_id}", $donation_meta); |
|
458 | 453 | } |
459 | 454 | |
460 | 455 | // Get results. |
461 | - if ( empty( $donation_meta ) ) { |
|
456 | + if (empty($donation_meta)) { |
|
462 | 457 | $check = ''; |
463 | - } elseif ( in_array( $meta_key, array( '_give_payment_date', '_give_payment_currency' ) ) ) { |
|
464 | - $payment_meta_key = str_replace( '_give_payment_', '', $meta_key ); |
|
458 | + } elseif (in_array($meta_key, array('_give_payment_date', '_give_payment_currency'))) { |
|
459 | + $payment_meta_key = str_replace('_give_payment_', '', $meta_key); |
|
465 | 460 | |
466 | - if ( isset( $donation_meta[ $payment_meta_key ] ) ) { |
|
467 | - $check = $donation_meta[ $payment_meta_key ]; |
|
461 | + if (isset($donation_meta[$payment_meta_key])) { |
|
462 | + $check = $donation_meta[$payment_meta_key]; |
|
468 | 463 | } |
469 | 464 | } else { |
470 | - $payment_meta_key = str_replace( '_give_donor_billing_', '', $meta_key ); |
|
465 | + $payment_meta_key = str_replace('_give_donor_billing_', '', $meta_key); |
|
471 | 466 | |
472 | - switch ( $payment_meta_key ) { |
|
467 | + switch ($payment_meta_key) { |
|
473 | 468 | case 'address1': |
474 | - if ( isset( $donation_meta['user_info']['address']['line1'] ) ) { |
|
469 | + if (isset($donation_meta['user_info']['address']['line1'])) { |
|
475 | 470 | $check = $donation_meta['user_info']['address']['line1']; |
476 | 471 | } |
477 | 472 | break; |
478 | 473 | |
479 | 474 | case 'address2': |
480 | - if ( isset( $donation_meta['user_info']['address']['line2'] ) ) { |
|
475 | + if (isset($donation_meta['user_info']['address']['line2'])) { |
|
481 | 476 | $check = $donation_meta['user_info']['address']['line2']; |
482 | 477 | } |
483 | 478 | break; |
484 | 479 | |
485 | 480 | case 'first_name': |
486 | - if ( isset( $donation_meta['user_info']['first_name'] ) ) { |
|
481 | + if (isset($donation_meta['user_info']['first_name'])) { |
|
487 | 482 | $check = $donation_meta['user_info']['first_name']; |
488 | 483 | } |
489 | 484 | break; |
490 | 485 | |
491 | 486 | case 'last_name': |
492 | - if ( isset( $donation_meta['user_info']['last_name'] ) ) { |
|
487 | + if (isset($donation_meta['user_info']['last_name'])) { |
|
493 | 488 | $check = $donation_meta['user_info']['last_name']; |
494 | 489 | } |
495 | 490 | break; |
496 | 491 | |
497 | 492 | default: |
498 | - if ( isset( $donation_meta['user_info']['address'][ $payment_meta_key ] ) ) { |
|
499 | - $check = $donation_meta['user_info']['address'][ $payment_meta_key ]; |
|
493 | + if (isset($donation_meta['user_info']['address'][$payment_meta_key])) { |
|
494 | + $check = $donation_meta['user_info']['address'][$payment_meta_key]; |
|
500 | 495 | } |
501 | 496 | } |
502 | 497 | } |
@@ -505,19 +500,19 @@ discard block |
||
505 | 500 | }// End switch(). |
506 | 501 | |
507 | 502 | // Set cache. |
508 | - Give_Cache::set_db_query( $cache_key, $check ); |
|
503 | + Give_Cache::set_db_query($cache_key, $check); |
|
509 | 504 | } |
510 | 505 | |
511 | 506 | // Put result in an array on zero index. |
512 | - if ( ! $single ) { |
|
513 | - $check = array( $check ); |
|
507 | + if ( ! $single) { |
|
508 | + $check = array($check); |
|
514 | 509 | } |
515 | 510 | |
516 | 511 | |
517 | 512 | return $check; |
518 | 513 | } |
519 | 514 | |
520 | -add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
515 | +add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
521 | 516 | |
522 | 517 | |
523 | 518 | /** |
@@ -529,9 +524,9 @@ discard block |
||
529 | 524 | * |
530 | 525 | * @return void |
531 | 526 | */ |
532 | -function _give_20_bc_support_deprecated_meta_key_query( $query ) { |
|
527 | +function _give_20_bc_support_deprecated_meta_key_query($query) { |
|
533 | 528 | // Bailout. |
534 | - if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
529 | + if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
535 | 530 | return; |
536 | 531 | } |
537 | 532 | |
@@ -541,21 +536,21 @@ discard block |
||
541 | 536 | // '_give_payment_user_ip' => '_give_payment_donor_ip', |
542 | 537 | ); |
543 | 538 | |
544 | - $deprecated_meta_keys = array_flip( $new_meta_keys ); |
|
539 | + $deprecated_meta_keys = array_flip($new_meta_keys); |
|
545 | 540 | |
546 | 541 | // Set meta keys. |
547 | 542 | $meta_keys = array(); |
548 | 543 | |
549 | 544 | |
550 | 545 | // Bailout. |
551 | - if ( ! empty( $query->query_vars['meta_key'] ) ) { |
|
552 | - if ( in_array( $query->query_vars['meta_key'], $new_meta_keys ) ) { |
|
546 | + if ( ! empty($query->query_vars['meta_key'])) { |
|
547 | + if (in_array($query->query_vars['meta_key'], $new_meta_keys)) { |
|
553 | 548 | $meta_keys = $deprecated_meta_keys; |
554 | - } elseif ( in_array( $query->query_vars['meta_key'], $deprecated_meta_keys ) ) { |
|
549 | + } elseif (in_array($query->query_vars['meta_key'], $deprecated_meta_keys)) { |
|
555 | 550 | $meta_keys = $new_meta_keys; |
556 | 551 | } |
557 | 552 | |
558 | - if ( ! empty( $meta_keys ) ) { |
|
553 | + if ( ! empty($meta_keys)) { |
|
559 | 554 | // Set meta_query |
560 | 555 | $query->set( |
561 | 556 | 'meta_query', |
@@ -566,35 +561,35 @@ discard block |
||
566 | 561 | 'value' => $query->query_vars['meta_value'], |
567 | 562 | ), |
568 | 563 | array( |
569 | - 'key' => $meta_keys[ $query->query_vars['meta_key'] ], |
|
564 | + 'key' => $meta_keys[$query->query_vars['meta_key']], |
|
570 | 565 | 'value' => $query->query_vars['meta_value'], |
571 | 566 | ), |
572 | 567 | ) |
573 | 568 | ); |
574 | 569 | |
575 | 570 | // Unset single meta query. |
576 | - unset( $query->query_vars['meta_key'] ); |
|
577 | - unset( $query->query_vars['meta_value'] ); |
|
571 | + unset($query->query_vars['meta_key']); |
|
572 | + unset($query->query_vars['meta_value']); |
|
578 | 573 | } |
579 | 574 | } elseif ( |
580 | - ! empty( $query->query_vars['meta_query'] ) && |
|
581 | - ( 1 === count( $query->query_vars['meta_query'] ) ) |
|
575 | + ! empty($query->query_vars['meta_query']) && |
|
576 | + (1 === count($query->query_vars['meta_query'])) |
|
582 | 577 | ) { |
583 | - $meta_query = current( $query->query_vars['meta_query'] ); |
|
578 | + $meta_query = current($query->query_vars['meta_query']); |
|
584 | 579 | |
585 | - if ( empty( $meta_query[0]['key'] ) ) { |
|
580 | + if (empty($meta_query[0]['key'])) { |
|
586 | 581 | return; |
587 | 582 | } |
588 | 583 | |
589 | - if ( in_array( $meta_query[0]['key'], $new_meta_keys ) ) { |
|
584 | + if (in_array($meta_query[0]['key'], $new_meta_keys)) { |
|
590 | 585 | $meta_keys = $deprecated_meta_keys; |
591 | - } elseif ( in_array( $meta_query[0]['key'], $deprecated_meta_keys ) ) { |
|
586 | + } elseif (in_array($meta_query[0]['key'], $deprecated_meta_keys)) { |
|
592 | 587 | $meta_keys = $new_meta_keys; |
593 | 588 | } else { |
594 | 589 | return; |
595 | 590 | } |
596 | 591 | |
597 | - if ( ! empty( $meta_keys ) ) { |
|
592 | + if ( ! empty($meta_keys)) { |
|
598 | 593 | // Set meta_query |
599 | 594 | $query->set( |
600 | 595 | 'meta_query', |
@@ -605,7 +600,7 @@ discard block |
||
605 | 600 | 'value' => $query->query_vars['meta_query'][0]['value'], |
606 | 601 | ), |
607 | 602 | array( |
608 | - 'key' => $meta_keys[ $query->query_vars['meta_query'][0]['key'] ], |
|
603 | + 'key' => $meta_keys[$query->query_vars['meta_query'][0]['key']], |
|
609 | 604 | 'value' => $query->query_vars['meta_query'][0]['value'], |
610 | 605 | ), |
611 | 606 | ) |
@@ -614,7 +609,7 @@ discard block |
||
614 | 609 | } |
615 | 610 | } |
616 | 611 | |
617 | -add_action( 'pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query' ); |
|
612 | +add_action('pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query'); |
|
618 | 613 | |
619 | 614 | |
620 | 615 | /** |
@@ -627,49 +622,49 @@ discard block |
||
627 | 622 | * @param Give_Payment $payment |
628 | 623 | * @param string $key |
629 | 624 | */ |
630 | -function _give_20_bc_payment_save( $payment, $key ) { |
|
625 | +function _give_20_bc_payment_save($payment, $key) { |
|
631 | 626 | // Bailout. |
632 | - if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
627 | + if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
633 | 628 | return; |
634 | 629 | } |
635 | 630 | |
636 | - switch ( $key ) { |
|
631 | + switch ($key) { |
|
637 | 632 | case 'user_info': |
638 | - if ( empty( $payment->user_info ) ) { |
|
633 | + if (empty($payment->user_info)) { |
|
639 | 634 | // Bailout. |
640 | 635 | break; |
641 | - } elseif ( is_string( $payment->user_info ) ) { |
|
636 | + } elseif (is_string($payment->user_info)) { |
|
642 | 637 | // Check if value serialize. |
643 | - $payment->user_info = maybe_unserialize( $payment->user_info ); |
|
638 | + $payment->user_info = maybe_unserialize($payment->user_info); |
|
644 | 639 | } |
645 | 640 | |
646 | 641 | |
647 | 642 | // Save first name. |
648 | - if ( isset( $payment->user_info['first_name'] ) ) { |
|
649 | - $payment->update_meta( '_give_donor_billing_first_name', $payment->user_info['first_name'] ); |
|
643 | + if (isset($payment->user_info['first_name'])) { |
|
644 | + $payment->update_meta('_give_donor_billing_first_name', $payment->user_info['first_name']); |
|
650 | 645 | } |
651 | 646 | |
652 | 647 | |
653 | 648 | // Save last name. |
654 | - if ( isset( $payment->user_info['last_name'] ) ) { |
|
655 | - $payment->update_meta( '_give_donor_billing_last_name', $payment->user_info['last_name'] ); |
|
649 | + if (isset($payment->user_info['last_name'])) { |
|
650 | + $payment->update_meta('_give_donor_billing_last_name', $payment->user_info['last_name']); |
|
656 | 651 | } |
657 | 652 | |
658 | 653 | |
659 | 654 | // Save address. |
660 | - if ( ! empty( $payment->user_info['address'] ) ) { |
|
661 | - foreach ( $payment->user_info['address'] as $address_name => $address ) { |
|
662 | - switch ( $address_name ) { |
|
655 | + if ( ! empty($payment->user_info['address'])) { |
|
656 | + foreach ($payment->user_info['address'] as $address_name => $address) { |
|
657 | + switch ($address_name) { |
|
663 | 658 | case 'line1': |
664 | - $payment->update_meta( '_give_donor_billing_address1', $address ); |
|
659 | + $payment->update_meta('_give_donor_billing_address1', $address); |
|
665 | 660 | break; |
666 | 661 | |
667 | 662 | case 'line2': |
668 | - $payment->update_meta( '_give_donor_billing_address2', $address ); |
|
663 | + $payment->update_meta('_give_donor_billing_address2', $address); |
|
669 | 664 | break; |
670 | 665 | |
671 | 666 | default: |
672 | - $payment->update_meta( "_give_donor_billing_{$address_name}", $address ); |
|
667 | + $payment->update_meta("_give_donor_billing_{$address_name}", $address); |
|
673 | 668 | } |
674 | 669 | } |
675 | 670 | } |
@@ -678,7 +673,7 @@ discard block |
||
678 | 673 | } |
679 | 674 | } |
680 | 675 | |
681 | -add_action( 'give_payment_save', '_give_20_bc_payment_save', 10, 2 ); |
|
676 | +add_action('give_payment_save', '_give_20_bc_payment_save', 10, 2); |
|
682 | 677 | |
683 | 678 | |
684 | 679 | /** |
@@ -691,16 +686,16 @@ discard block |
||
691 | 686 | * |
692 | 687 | * @return mixed |
693 | 688 | */ |
694 | -function __give_20_bc_flush_cache( $check, $object_id ) { |
|
689 | +function __give_20_bc_flush_cache($check, $object_id) { |
|
695 | 690 | if ( |
696 | - ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) && |
|
697 | - 'give_payment' === get_post_type( $object_id ) |
|
691 | + ! give_has_upgrade_completed('v20_move_metadata_into_new_table') && |
|
692 | + 'give_payment' === get_post_type($object_id) |
|
698 | 693 | ) { |
699 | - Give_Cache::delete_group( $object_id, 'give-donations' ); |
|
694 | + Give_Cache::delete_group($object_id, 'give-donations'); |
|
700 | 695 | } |
701 | 696 | |
702 | 697 | return $check; |
703 | 698 | } |
704 | 699 | |
705 | -add_action( 'update_post_metadata', '__give_20_bc_flush_cache', 9999, 2 ); |
|
706 | -add_action( 'add_post_metadata', '__give_20_bc_flush_cache', 9999, 2 ); |
|
700 | +add_action('update_post_metadata', '__give_20_bc_flush_cache', 9999, 2); |
|
701 | +add_action('add_post_metadata', '__give_20_bc_flush_cache', 9999, 2); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @since 1.0 |
108 | 108 | * @access public |
109 | 109 | * |
110 | - * @param $query_var |
|
110 | + * @param string $query_var |
|
111 | 111 | * @param $value |
112 | 112 | */ |
113 | 113 | public function __set( $query_var, $value ) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @since 1.0 |
125 | 125 | * @access public |
126 | 126 | * |
127 | - * @param $query_var |
|
127 | + * @param string $query_var |
|
128 | 128 | */ |
129 | 129 | public function __unset( $query_var ) { |
130 | 130 | unset( $this->args[ $query_var ] ); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @param string $order |
469 | 469 | * @param WP_Query $query |
470 | 470 | * |
471 | - * @return mixed |
|
471 | + * @return string |
|
472 | 472 | */ |
473 | 473 | public function custom_orderby( $order, $query ) { |
474 | 474 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
68 | 68 | */ |
69 | - public function __construct( $args = array() ) { |
|
69 | + public function __construct($args = array()) { |
|
70 | 70 | $defaults = array( |
71 | 71 | 'output' => 'payments', |
72 | - 'post_type' => array( 'give_payment' ), |
|
72 | + 'post_type' => array('give_payment'), |
|
73 | 73 | 'start_date' => false, |
74 | 74 | 'end_date' => false, |
75 | 75 | 'number' => 20, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'count' => false, |
97 | 97 | ); |
98 | 98 | |
99 | - $this->args = $this->_args = wp_parse_args( $args, $defaults ); |
|
99 | + $this->args = $this->_args = wp_parse_args($args, $defaults); |
|
100 | 100 | |
101 | 101 | $this->init(); |
102 | 102 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | * @param $query_var |
111 | 111 | * @param $value |
112 | 112 | */ |
113 | - public function __set( $query_var, $value ) { |
|
114 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
115 | - $this->args[ $query_var ][] = $value; |
|
113 | + public function __set($query_var, $value) { |
|
114 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
115 | + $this->args[$query_var][] = $value; |
|
116 | 116 | } else { |
117 | - $this->args[ $query_var ] = $value; |
|
117 | + $this->args[$query_var] = $value; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param $query_var |
128 | 128 | */ |
129 | - public function __unset( $query_var ) { |
|
130 | - unset( $this->args[ $query_var ] ); |
|
129 | + public function __unset($query_var) { |
|
130 | + unset($this->args[$query_var]); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->give_forms(); |
168 | 168 | $this->gateway_filter(); |
169 | 169 | |
170 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
170 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Fires after setup filters. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param Give_Payments_Query $this Payments query object. |
178 | 178 | */ |
179 | - do_action( 'give_pre_get_payments', $this ); |
|
179 | + do_action('give_pre_get_payments', $this); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @access private |
187 | 187 | */ |
188 | 188 | private function unset_filters() { |
189 | - remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) ); |
|
189 | + remove_filter('posts_orderby', array($this, 'custom_orderby')); |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Fires after retrieving payments. |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @param Give_Payments_Query $this Payments query object. |
197 | 197 | */ |
198 | - do_action( 'give_post_get_payments', $this ); |
|
198 | + do_action('give_post_get_payments', $this); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | public function get_payments() { |
215 | 215 | global $post; |
216 | 216 | |
217 | - $cache_key = Give_Cache::get_key( 'give_payment_query', $this->args, false ); |
|
218 | - $this->payments = Give_Cache::get_db_query( $cache_key ); |
|
217 | + $cache_key = Give_Cache::get_key('give_payment_query', $this->args, false); |
|
218 | + $this->payments = Give_Cache::get_db_query($cache_key); |
|
219 | 219 | |
220 | 220 | // Return cached result. |
221 | - if ( ! is_null( $this->payments ) ) { |
|
221 | + if ( ! is_null($this->payments)) { |
|
222 | 222 | return $this->payments; |
223 | 223 | } |
224 | 224 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // Modify the query/query arguments before we retrieve payments. |
227 | 227 | $this->set_filters(); |
228 | 228 | |
229 | - $query = new WP_Query( $this->args ); |
|
229 | + $query = new WP_Query($this->args); |
|
230 | 230 | $this->payments = array(); |
231 | 231 | |
232 | 232 | $custom_output = array( |
@@ -234,32 +234,32 @@ discard block |
||
234 | 234 | 'give_payments', |
235 | 235 | ); |
236 | 236 | |
237 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
237 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
238 | 238 | return $query->posts; |
239 | 239 | } |
240 | 240 | |
241 | - if ( $query->have_posts() ) { |
|
241 | + if ($query->have_posts()) { |
|
242 | 242 | $previous_post = $post; |
243 | 243 | |
244 | - while ( $query->have_posts() ) { |
|
244 | + while ($query->have_posts()) { |
|
245 | 245 | $query->the_post(); |
246 | 246 | |
247 | 247 | $payment_id = get_post()->ID; |
248 | - $payment = new Give_Payment( $payment_id ); |
|
248 | + $payment = new Give_Payment($payment_id); |
|
249 | 249 | |
250 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
250 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | wp_reset_postdata(); |
254 | 254 | |
255 | 255 | // Prevent nest loop from producing unexpected results. |
256 | - if( $previous_post instanceof WP_Post ) { |
|
256 | + if ($previous_post instanceof WP_Post) { |
|
257 | 257 | $post = $previous_post; |
258 | - setup_postdata( $post ); |
|
258 | + setup_postdata($post); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | - Give_Cache::set_db_query( $cache_key, $this->payments ); |
|
262 | + Give_Cache::set_db_query($cache_key, $this->payments); |
|
263 | 263 | |
264 | 264 | // Remove query filters after we retrieve payments. |
265 | 265 | $this->unset_filters(); |
@@ -278,31 +278,31 @@ discard block |
||
278 | 278 | public function get_payment_by_group() { |
279 | 279 | global $wpdb; |
280 | 280 | |
281 | - $allowed_groups = array( 'post_status' ); |
|
281 | + $allowed_groups = array('post_status'); |
|
282 | 282 | $result = array(); |
283 | 283 | |
284 | 284 | |
285 | - if ( in_array( $this->args['group_by'], $allowed_groups ) ) { |
|
285 | + if (in_array($this->args['group_by'], $allowed_groups)) { |
|
286 | 286 | // Set only count in result. |
287 | - if ( $this->args['count'] ) { |
|
287 | + if ($this->args['count']) { |
|
288 | 288 | |
289 | 289 | $this->set_filters(); |
290 | 290 | |
291 | - $new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N ); |
|
291 | + $new_results = $wpdb->get_results($this->get_sql(), ARRAY_N); |
|
292 | 292 | |
293 | 293 | $this->unset_filters(); |
294 | 294 | |
295 | - foreach ( $new_results as $results ) { |
|
296 | - $result[ $results[0] ] = $results[1]; |
|
295 | + foreach ($new_results as $results) { |
|
296 | + $result[$results[0]] = $results[1]; |
|
297 | 297 | } |
298 | 298 | |
299 | - switch ( $this->args['group_by'] ) { |
|
299 | + switch ($this->args['group_by']) { |
|
300 | 300 | case 'post_status': |
301 | 301 | |
302 | 302 | /* @var Give_Payment $donation */ |
303 | - foreach ( give_get_payment_status_keys() as $status ) { |
|
304 | - if ( ! isset( $result[ $status ] ) ) { |
|
305 | - $result[ $status ] = 0; |
|
303 | + foreach (give_get_payment_status_keys() as $status) { |
|
304 | + if ( ! isset($result[$status])) { |
|
305 | + $result[$status] = 0; |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | $donations = $this->get_payments(); |
313 | 313 | |
314 | 314 | /* @var $donation Give_Payment */ |
315 | - foreach ( $donations as $donation ) { |
|
316 | - $result[ $donation->{$this->args['group_by']} ][] = $donation; |
|
315 | + foreach ($donations as $donation) { |
|
316 | + $result[$donation->{$this->args['group_by']}][] = $donation; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @since 1.8.17 |
326 | 326 | */ |
327 | - return apply_filters( 'give_get_payment_by_group', $result, $this ); |
|
327 | + return apply_filters('give_get_payment_by_group', $result, $this); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -336,29 +336,29 @@ discard block |
||
336 | 336 | * @return void |
337 | 337 | */ |
338 | 338 | public function date_filter_pre() { |
339 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
339 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
340 | 340 | return; |
341 | 341 | } |
342 | 342 | |
343 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
344 | - $is_start_date = property_exists( __CLASS__, 'start_date' ); |
|
345 | - $is_end_date = property_exists( __CLASS__, 'end_date' ); |
|
343 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
344 | + $is_start_date = property_exists(__CLASS__, 'start_date'); |
|
345 | + $is_end_date = property_exists(__CLASS__, 'end_date'); |
|
346 | 346 | |
347 | - if ( $is_start_date || $is_end_date ) { |
|
347 | + if ($is_start_date || $is_end_date) { |
|
348 | 348 | $date_query = array(); |
349 | 349 | |
350 | - if ( $is_start_date && ! is_wp_error( $this->start_date ) ) { |
|
351 | - $date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date ); |
|
350 | + if ($is_start_date && ! is_wp_error($this->start_date)) { |
|
351 | + $date_query['after'] = date('Y-m-d H:i:s', $this->start_date); |
|
352 | 352 | } |
353 | 353 | |
354 | - if ( $is_end_date && ! is_wp_error( $this->end_date ) ) { |
|
355 | - $date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date ); |
|
354 | + if ($is_end_date && ! is_wp_error($this->end_date)) { |
|
355 | + $date_query['before'] = date('Y-m-d H:i:s', $this->end_date); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | // Include Start Date and End Date while querying. |
359 | 359 | $date_query['inclusive'] = true; |
360 | 360 | |
361 | - $this->__set( 'date_query', $date_query ); |
|
361 | + $this->__set('date_query', $date_query); |
|
362 | 362 | |
363 | 363 | } |
364 | 364 | } |
@@ -372,12 +372,12 @@ discard block |
||
372 | 372 | * @return void |
373 | 373 | */ |
374 | 374 | public function status() { |
375 | - if ( ! isset( $this->args['status'] ) ) { |
|
375 | + if ( ! isset($this->args['status'])) { |
|
376 | 376 | return; |
377 | 377 | } |
378 | 378 | |
379 | - $this->__set( 'post_status', $this->args['status'] ); |
|
380 | - $this->__unset( 'status' ); |
|
379 | + $this->__set('post_status', $this->args['status']); |
|
380 | + $this->__unset('status'); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -389,12 +389,12 @@ discard block |
||
389 | 389 | * @return void |
390 | 390 | */ |
391 | 391 | public function page() { |
392 | - if ( ! isset( $this->args['page'] ) ) { |
|
392 | + if ( ! isset($this->args['page'])) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | |
396 | - $this->__set( 'paged', $this->args['page'] ); |
|
397 | - $this->__unset( 'page' ); |
|
396 | + $this->__set('paged', $this->args['page']); |
|
397 | + $this->__unset('page'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
@@ -407,17 +407,17 @@ discard block |
||
407 | 407 | */ |
408 | 408 | public function per_page() { |
409 | 409 | |
410 | - if ( ! isset( $this->args['number'] ) ) { |
|
410 | + if ( ! isset($this->args['number'])) { |
|
411 | 411 | return; |
412 | 412 | } |
413 | 413 | |
414 | - if ( $this->args['number'] == - 1 ) { |
|
415 | - $this->__set( 'nopaging', true ); |
|
414 | + if ($this->args['number'] == - 1) { |
|
415 | + $this->__set('nopaging', true); |
|
416 | 416 | } else { |
417 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
417 | + $this->__set('posts_per_page', $this->args['number']); |
|
418 | 418 | } |
419 | 419 | |
420 | - $this->__unset( 'number' ); |
|
420 | + $this->__unset('number'); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | * @return void |
430 | 430 | */ |
431 | 431 | public function month() { |
432 | - if ( ! isset( $this->args['month'] ) ) { |
|
432 | + if ( ! isset($this->args['month'])) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
437 | - $this->__unset( 'month' ); |
|
436 | + $this->__set('monthnum', $this->args['month']); |
|
437 | + $this->__unset('month'); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -446,23 +446,23 @@ discard block |
||
446 | 446 | * @return void |
447 | 447 | */ |
448 | 448 | public function orderby() { |
449 | - switch ( $this->args['orderby'] ) { |
|
449 | + switch ($this->args['orderby']) { |
|
450 | 450 | case 'amount': |
451 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
452 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
451 | + $this->__set('orderby', 'meta_value_num'); |
|
452 | + $this->__set('meta_key', '_give_payment_total'); |
|
453 | 453 | break; |
454 | 454 | |
455 | 455 | case 'status': |
456 | - $this->__set( 'orderby', 'post_status' ); |
|
456 | + $this->__set('orderby', 'post_status'); |
|
457 | 457 | break; |
458 | 458 | |
459 | 459 | case 'donation_form': |
460 | - $this->__set( 'orderby', 'meta_value' ); |
|
461 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
460 | + $this->__set('orderby', 'meta_value'); |
|
461 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
462 | 462 | break; |
463 | 463 | |
464 | 464 | default: |
465 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
465 | + $this->__set('orderby', $this->args['orderby']); |
|
466 | 466 | break; |
467 | 467 | } |
468 | 468 | } |
@@ -479,19 +479,19 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return mixed |
481 | 481 | */ |
482 | - public function custom_orderby( $order, $query ) { |
|
482 | + public function custom_orderby($order, $query) { |
|
483 | 483 | |
484 | - if ( ! empty( $query->query['post_type'] ) ) { |
|
485 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
484 | + if ( ! empty($query->query['post_type'])) { |
|
485 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
486 | 486 | |
487 | - if ( ! in_array( 'give_payment', $post_types ) || ! isset( $query->query['orderby'] ) || is_array( $query->query['orderby'] ) ) { |
|
487 | + if ( ! in_array('give_payment', $post_types) || ! isset($query->query['orderby']) || is_array($query->query['orderby'])) { |
|
488 | 488 | return $order; |
489 | 489 | } |
490 | 490 | |
491 | 491 | global $wpdb; |
492 | - switch ( $query->query['orderby'] ) { |
|
492 | + switch ($query->query['orderby']) { |
|
493 | 493 | case 'post_status': |
494 | - $order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] ); |
|
494 | + $order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']); |
|
495 | 495 | break; |
496 | 496 | } |
497 | 497 | } |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function user() { |
511 | - if ( is_null( $this->args['user'] ) ) { |
|
511 | + if (is_null($this->args['user'])) { |
|
512 | 512 | return; |
513 | 513 | } |
514 | 514 | |
515 | - if ( is_numeric( $this->args['user'] ) ) { |
|
515 | + if (is_numeric($this->args['user'])) { |
|
516 | 516 | $user_key = '_give_payment_donor_id'; |
517 | 517 | } else { |
518 | 518 | $user_key = '_give_payment_donor_email'; |
@@ -534,16 +534,16 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function donor() { |
537 | - if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) { |
|
537 | + if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) { |
|
538 | 538 | return; |
539 | 539 | } |
540 | 540 | |
541 | 541 | $donor_meta_type = Give()->donor_meta->meta_type; |
542 | 542 | |
543 | - $this->__set( 'meta_query', array( |
|
543 | + $this->__set('meta_query', array( |
|
544 | 544 | 'key' => "_give_payment_{$donor_meta_type}_id", |
545 | 545 | 'value' => (int) $this->args['donor'], |
546 | - ) ); |
|
546 | + )); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -556,33 +556,33 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public function search() { |
558 | 558 | |
559 | - if ( ! isset( $this->args['s'] ) ) { |
|
559 | + if ( ! isset($this->args['s'])) { |
|
560 | 560 | return; |
561 | 561 | } |
562 | 562 | |
563 | - $search = trim( $this->args['s'] ); |
|
563 | + $search = trim($this->args['s']); |
|
564 | 564 | |
565 | - if ( empty( $search ) ) { |
|
565 | + if (empty($search)) { |
|
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
569 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
570 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
569 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
570 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
571 | 571 | |
572 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
572 | + if ( ! empty($this->args['search_in_notes'])) { |
|
573 | 573 | |
574 | - $notes = give_get_payment_notes( 0, $search ); |
|
574 | + $notes = give_get_payment_notes(0, $search); |
|
575 | 575 | |
576 | - if ( ! empty( $notes ) ) { |
|
576 | + if ( ! empty($notes)) { |
|
577 | 577 | |
578 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
578 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
579 | 579 | |
580 | - $this->__set( 'post__in', $payment_ids ); |
|
580 | + $this->__set('post__in', $payment_ids); |
|
581 | 581 | } |
582 | 582 | |
583 | - $this->__unset( 's' ); |
|
583 | + $this->__unset('s'); |
|
584 | 584 | |
585 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
585 | + } elseif ($is_email || strlen($search) == 32) { |
|
586 | 586 | |
587 | 587 | $key = $is_email ? '_give_payment_donor_email' : '_give_payment_purchase_key'; |
588 | 588 | $search_meta = array( |
@@ -591,40 +591,40 @@ discard block |
||
591 | 591 | 'compare' => 'LIKE', |
592 | 592 | ); |
593 | 593 | |
594 | - $this->__set( 'meta_query', $search_meta ); |
|
595 | - $this->__unset( 's' ); |
|
594 | + $this->__set('meta_query', $search_meta); |
|
595 | + $this->__unset('s'); |
|
596 | 596 | |
597 | - } elseif ( $is_user ) { |
|
597 | + } elseif ($is_user) { |
|
598 | 598 | |
599 | 599 | $search_meta = array( |
600 | 600 | 'key' => '_give_payment_donor_id', |
601 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
601 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
602 | 602 | ); |
603 | 603 | |
604 | - $this->__set( 'meta_query', $search_meta ); |
|
604 | + $this->__set('meta_query', $search_meta); |
|
605 | 605 | |
606 | - $this->__unset( 's' ); |
|
606 | + $this->__unset('s'); |
|
607 | 607 | |
608 | - } elseif ( is_numeric( $search ) ) { |
|
608 | + } elseif (is_numeric($search)) { |
|
609 | 609 | |
610 | - $post = get_post( $search ); |
|
610 | + $post = get_post($search); |
|
611 | 611 | |
612 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
612 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
613 | 613 | |
614 | 614 | $arr = array(); |
615 | 615 | $arr[] = $search; |
616 | - $this->__set( 'post__in', $arr ); |
|
617 | - $this->__unset( 's' ); |
|
616 | + $this->__set('post__in', $arr); |
|
617 | + $this->__unset('s'); |
|
618 | 618 | } |
619 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
619 | + } elseif ('#' == substr($search, 0, 1)) { |
|
620 | 620 | |
621 | - $search = str_replace( '#:', '', $search ); |
|
622 | - $search = str_replace( '#', '', $search ); |
|
623 | - $this->__set( 'give_forms', $search ); |
|
624 | - $this->__unset( 's' ); |
|
621 | + $search = str_replace('#:', '', $search); |
|
622 | + $search = str_replace('#', '', $search); |
|
623 | + $this->__set('give_forms', $search); |
|
624 | + $this->__unset('s'); |
|
625 | 625 | |
626 | 626 | } else { |
627 | - $this->__set( 's', $search ); |
|
627 | + $this->__set('s', $search); |
|
628 | 628 | |
629 | 629 | } |
630 | 630 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @return void |
640 | 640 | */ |
641 | 641 | public function mode() { |
642 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
643 | - $this->__unset( 'mode' ); |
|
642 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
643 | + $this->__unset('mode'); |
|
644 | 644 | |
645 | 645 | return; |
646 | 646 | } |
@@ -662,10 +662,10 @@ discard block |
||
662 | 662 | * @return void |
663 | 663 | */ |
664 | 664 | public function children() { |
665 | - if ( empty( $this->args['children'] ) ) { |
|
666 | - $this->__set( 'post_parent', 0 ); |
|
665 | + if (empty($this->args['children'])) { |
|
666 | + $this->__set('post_parent', 0); |
|
667 | 667 | } |
668 | - $this->__unset( 'children' ); |
|
668 | + $this->__unset('children'); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | /** |
@@ -678,13 +678,13 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public function give_forms() { |
680 | 680 | |
681 | - if ( empty( $this->args['give_forms'] ) ) { |
|
681 | + if (empty($this->args['give_forms'])) { |
|
682 | 682 | return; |
683 | 683 | } |
684 | 684 | |
685 | 685 | $compare = '='; |
686 | 686 | |
687 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
687 | + if (is_array($this->args['give_forms'])) { |
|
688 | 688 | $compare = 'IN'; |
689 | 689 | } |
690 | 690 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ) |
698 | 698 | ); |
699 | 699 | |
700 | - $this->__unset( 'give_forms' ); |
|
700 | + $this->__unset('give_forms'); |
|
701 | 701 | |
702 | 702 | } |
703 | 703 | |
@@ -711,13 +711,13 @@ discard block |
||
711 | 711 | */ |
712 | 712 | public function gateway_filter() { |
713 | 713 | |
714 | - if ( empty( $this->args['gateway'] ) ) { |
|
714 | + if (empty($this->args['gateway'])) { |
|
715 | 715 | return; |
716 | 716 | } |
717 | 717 | |
718 | 718 | $compare = '='; |
719 | 719 | |
720 | - if ( is_array( $this->args['gateway'] ) ) { |
|
720 | + if (is_array($this->args['gateway'])) { |
|
721 | 721 | $compare = 'IN'; |
722 | 722 | } |
723 | 723 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | ) |
732 | 732 | ); |
733 | 733 | |
734 | - $this->__unset( 'gateway' ); |
|
734 | + $this->__unset('gateway'); |
|
735 | 735 | |
736 | 736 | } |
737 | 737 | |
@@ -751,9 +751,9 @@ discard block |
||
751 | 751 | global $wpdb; |
752 | 752 | |
753 | 753 | $where = "WHERE {$wpdb->posts}.post_type = 'give_payment'"; |
754 | - $where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')"; |
|
754 | + $where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')"; |
|
755 | 755 | |
756 | - if( is_numeric( $this->args['post_parent'] ) ) { |
|
756 | + if (is_numeric($this->args['post_parent'])) { |
|
757 | 757 | $where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}"; |
758 | 758 | } |
759 | 759 | |
@@ -762,42 +762,42 @@ discard block |
||
762 | 762 | $group_by = ''; |
763 | 763 | |
764 | 764 | // Set group by. |
765 | - if ( ! empty( $this->args['group_by'] ) ) { |
|
765 | + if ( ! empty($this->args['group_by'])) { |
|
766 | 766 | $group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}"; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // Set offset. |
770 | 770 | if ( |
771 | - empty( $this->args['nopaging'] ) && |
|
772 | - empty( $this->args['offset'] ) && |
|
773 | - ( ! empty( $this->args['page'] ) && 0 < $this->args['page'] ) |
|
771 | + empty($this->args['nopaging']) && |
|
772 | + empty($this->args['offset']) && |
|
773 | + ( ! empty($this->args['page']) && 0 < $this->args['page']) |
|
774 | 774 | ) { |
775 | - $this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 ); |
|
775 | + $this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | // Set fields. |
779 | 779 | $fields = "{$wpdb->posts}.*"; |
780 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
781 | - if ( is_string( $this->args['fields'] ) ) { |
|
780 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
781 | + if (is_string($this->args['fields'])) { |
|
782 | 782 | $fields = "{$wpdb->posts}.{$this->args['fields']}"; |
783 | - } elseif ( is_array( $this->args['fields'] ) ) { |
|
784 | - $fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] ); |
|
783 | + } elseif (is_array($this->args['fields'])) { |
|
784 | + $fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | 788 | // Set count. |
789 | - if ( ! empty( $this->args['count'] ) ) { |
|
789 | + if ( ! empty($this->args['count'])) { |
|
790 | 790 | $fields = "COUNT({$wpdb->posts}.ID)"; |
791 | 791 | |
792 | - if ( ! empty( $this->args['group_by'] ) ) { |
|
792 | + if ( ! empty($this->args['group_by'])) { |
|
793 | 793 | $fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}"; |
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | 797 | // Date query. |
798 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
799 | - $date_query_obj = new WP_Date_Query( $this->args['date_query'] ); |
|
800 | - $where .= str_replace( |
|
798 | + if ( ! empty($this->args['date_query'])) { |
|
799 | + $date_query_obj = new WP_Date_Query($this->args['date_query']); |
|
800 | + $where .= str_replace( |
|
801 | 801 | array( |
802 | 802 | "\n", |
803 | 803 | '( (', |
@@ -813,22 +813,22 @@ discard block |
||
813 | 813 | } |
814 | 814 | |
815 | 815 | // Meta query. |
816 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
817 | - $meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] ); |
|
818 | - $where = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}"; |
|
819 | - $where = Give()->payment_meta->__rename_meta_table_name( $where, 'posts_where' ); |
|
816 | + if ( ! empty($this->args['meta_query'])) { |
|
817 | + $meta_query_obj = new WP_Meta_Query($this->args['meta_query']); |
|
818 | + $where = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}"; |
|
819 | + $where = Give()->payment_meta->__rename_meta_table_name($where, 'posts_where'); |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | // Set sql query. |
823 | 823 | $sql = $wpdb->prepare( |
824 | 824 | "SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;", |
825 | - absint( $this->args['offset'] ), |
|
826 | - ( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 99999999999 ) |
|
825 | + absint($this->args['offset']), |
|
826 | + (empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 99999999999) |
|
827 | 827 | ); |
828 | 828 | |
829 | 829 | // $where, $orderby and order already prepared query they can generate notice if you re prepare them in above. |
830 | 830 | // WordPress consider LIKE condition as placeholder if start with s,f, or d. |
831 | - $sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql ); |
|
831 | + $sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql); |
|
832 | 832 | |
833 | 833 | return $sql; |
834 | 834 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | - 'ajax' => false,// Does this table support ajax?. |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | + 'ajax' => false, // Does this table support ajax?. |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
74 | 74 | case 'error' : |
75 | - return esc_html( $item['log_title'] ); |
|
75 | + return esc_html($item['log_title']); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,35 +88,35 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { |
|
91 | + public function column_message($item) { |
|
92 | 92 | ?> |
93 | 93 | <?php |
94 | - echo Give()->tooltips->render_link( array( |
|
95 | - 'label' => __( 'View Log Message', 'give' ), |
|
94 | + echo Give()->tooltips->render_link(array( |
|
95 | + 'label' => __('View Log Message', 'give'), |
|
96 | 96 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
97 | 97 | 'link' => "#TB_inline?width=640&inlineId=log-message-{$item['ID']}", |
98 | 98 | 'attributes' => array( |
99 | 99 | 'class' => 'thickbox give-error-log-details-link button button-small', |
100 | 100 | ), |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | ?> |
103 | 103 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
104 | 104 | <?php |
105 | 105 | |
106 | - $serialized = strpos( $item['log_content'], '{"' ); |
|
106 | + $serialized = strpos($item['log_content'], '{"'); |
|
107 | 107 | |
108 | 108 | // Check to see if the log message contains serialized information |
109 | - if ( $serialized !== false ) { |
|
110 | - $length = strlen( $item['log_content'] ) - $serialized; |
|
111 | - $intro = substr( $item['log_content'], 0, - $length ); |
|
112 | - $data = substr( $item['log_content'], $serialized, strlen( $item['log_content'] ) - 1 ); |
|
109 | + if ($serialized !== false) { |
|
110 | + $length = strlen($item['log_content']) - $serialized; |
|
111 | + $intro = substr($item['log_content'], 0, - $length); |
|
112 | + $data = substr($item['log_content'], $serialized, strlen($item['log_content']) - 1); |
|
113 | 113 | |
114 | - echo wpautop( $intro ); |
|
115 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
116 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
114 | + echo wpautop($intro); |
|
115 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
116 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
117 | 117 | } else { |
118 | 118 | // No serialized data found |
119 | - echo wpautop( $item['log_content'] ); |
|
119 | + echo wpautop($item['log_content']); |
|
120 | 120 | } |
121 | 121 | ?> |
122 | 122 | </div> |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function get_columns() { |
134 | 134 | $columns = array( |
135 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
136 | - 'error' => esc_html__( 'Error', 'give' ), |
|
137 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
138 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
139 | - 'date' => esc_html__( 'Date', 'give' ), |
|
140 | - 'message' => esc_html__( 'Details', 'give' ), |
|
135 | + 'ID' => esc_html__('Log ID', 'give'), |
|
136 | + 'error' => esc_html__('Error', 'give'), |
|
137 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
138 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
139 | + 'date' => esc_html__('Date', 'give'), |
|
140 | + 'message' => esc_html__('Details', 'give'), |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | return $columns; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Current page number |
152 | 152 | */ |
153 | 153 | public function get_paged() { |
154 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
154 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - public function bulk_actions( $which = '' ) { |
|
164 | + public function bulk_actions($which = '') { |
|
165 | 165 | give_log_views(); |
166 | 166 | } |
167 | 167 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | public function get_logs() { |
177 | 177 | // Prevent the queries from getting cached. |
178 | 178 | // Without this there are occasional memory issues for some installs. |
179 | - wp_suspend_cache_addition( true ); |
|
179 | + wp_suspend_cache_addition(true); |
|
180 | 180 | |
181 | 181 | $logs_data = array(); |
182 | 182 | $paged = $this->get_paged(); |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | 'posts_per_page' => $this->per_page, |
187 | 187 | ); |
188 | 188 | |
189 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
189 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
190 | 190 | |
191 | - if ( $logs ) { |
|
192 | - foreach ( $logs as $log ) { |
|
191 | + if ($logs) { |
|
192 | + foreach ($logs as $log) { |
|
193 | 193 | |
194 | 194 | $logs_data[] = array( |
195 | 195 | 'ID' => $log->ID, |
196 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
196 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
197 | 197 | 'payment_id' => $log->log_parent, |
198 | 198 | 'error' => 'error', |
199 | - 'gateway' => give_get_payment_gateway( $log->log_parent ), |
|
199 | + 'gateway' => give_get_payment_gateway($log->log_parent), |
|
200 | 200 | 'date' => $log->log_date, |
201 | 201 | 'log_content' => $log->log_content, |
202 | 202 | 'log_title' => $log->log_title, |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param string $which |
222 | 222 | */ |
223 | - protected function display_tablenav( $which ) { |
|
224 | - if ( 'top' === $which ) { |
|
225 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
223 | + protected function display_tablenav($which) { |
|
224 | + if ('top' === $which) { |
|
225 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
226 | 226 | } |
227 | 227 | ?> |
228 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
228 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
229 | 229 | |
230 | 230 | <div class="alignleft actions bulkactions"> |
231 | - <?php $this->bulk_actions( $which ); ?> |
|
231 | + <?php $this->bulk_actions($which); ?> |
|
232 | 232 | </div> |
233 | 233 | <?php |
234 | - $this->extra_tablenav( $which ); |
|
235 | - $this->pagination( $which ); |
|
234 | + $this->extra_tablenav($which); |
|
235 | + $this->pagination($which); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | <br class="clear"/> |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | $columns = $this->get_columns(); |
259 | 259 | $hidden = array(); // No hidden columns |
260 | 260 | $sortable = $this->get_sortable_columns(); |
261 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
261 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
262 | 262 | $this->items = $this->get_logs(); |
263 | - $total_items = Give()->logs->get_log_count( 0, 'gateway_error' ); |
|
263 | + $total_items = Give()->logs->get_log_count(0, 'gateway_error'); |
|
264 | 264 | |
265 | - $this->set_pagination_args( array( |
|
265 | + $this->set_pagination_args(array( |
|
266 | 266 | 'total_items' => $total_items, |
267 | 267 | 'per_page' => $this->per_page, |
268 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
268 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | } |
@@ -19,28 +19,28 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return array |
21 | 21 | */ |
22 | -function give_email_notification_row_actions_callback( $row_actions, $email ) { |
|
23 | - if( Give_Email_Notification_Util::is_email_preview( $email ) ) { |
|
22 | +function give_email_notification_row_actions_callback($row_actions, $email) { |
|
23 | + if (Give_Email_Notification_Util::is_email_preview($email)) { |
|
24 | 24 | $preview_link = sprintf( |
25 | 25 | '<a href="%1$s" target="_blank">%2$s</a>', |
26 | 26 | wp_nonce_url( |
27 | 27 | add_query_arg( |
28 | - array( 'give_action' => 'preview_email', 'email_type' => $email->config['id'] ), |
|
28 | + array('give_action' => 'preview_email', 'email_type' => $email->config['id']), |
|
29 | 29 | home_url() |
30 | 30 | ), 'give-preview-email' |
31 | 31 | ), |
32 | - __( 'Preview', 'give' ) |
|
32 | + __('Preview', 'give') |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | $send_preview_email_link = sprintf( |
36 | 36 | '<a href="%1$s">%2$s</a>', |
37 | 37 | wp_nonce_url( |
38 | - add_query_arg( array( |
|
38 | + add_query_arg(array( |
|
39 | 39 | 'give_action' => 'send_preview_email', |
40 | 40 | 'email_type' => $email->config['id'], |
41 | 41 | 'give-message' => 'sent-test-email', |
42 | - ) ), 'give-send-preview-email' ), |
|
43 | - __( 'Send test email', 'give' ) |
|
42 | + )), 'give-send-preview-email' ), |
|
43 | + __('Send test email', 'give') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | $row_actions['email_preview'] = $preview_link; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | return $row_actions; |
51 | 51 | } |
52 | -add_filter( 'give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2 ); |
|
52 | +add_filter('give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * This help to decode all email template tags. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string |
63 | 63 | */ |
64 | -function give_decode_email_tags( $message, $email_obj ) { |
|
65 | - if ( ! empty( $email_obj->tag_args ) ) { |
|
66 | - $message = give_do_email_tags( $message, $email_obj->tag_args ); |
|
64 | +function give_decode_email_tags($message, $email_obj) { |
|
65 | + if ( ! empty($email_obj->tag_args)) { |
|
66 | + $message = give_do_email_tags($message, $email_obj->tag_args); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $message; |
70 | 70 | } |
71 | 71 | |
72 | -add_filter( 'give_email_message', 'give_decode_email_tags', 10, 2 ); |
|
73 | 72 | \ No newline at end of file |
73 | +add_filter('give_email_message', 'give_decode_email_tags', 10, 2); |
|
74 | 74 | \ No newline at end of file |
@@ -175,10 +175,10 @@ |
||
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | 177 | $message = sprintf( |
178 | - __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | - get_bloginfo( 'url' ), |
|
180 | - get_bloginfo( 'admin_email' ) |
|
181 | - ) . "\n\n"; |
|
178 | + __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | + get_bloginfo( 'url' ), |
|
180 | + get_bloginfo( 'admin_email' ) |
|
181 | + ) . "\n\n"; |
|
182 | 182 | $message .= '{email_access_link}' . "\n\n"; |
183 | 183 | $message .= "\n\n"; |
184 | 184 | $message .= __( 'Sincerely,', 'give' ) . "\n"; |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if access directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Email_Access_Email' ) ) : |
|
18 | +if ( ! class_exists('Give_Email_Access_Email')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Email_Access_Email |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'email-access', |
36 | - 'label' => __( 'Email access', 'give' ), |
|
37 | - 'description' => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ), |
|
38 | - 'notification_status' => give_get_option( 'email_access', 'disabled' ), |
|
36 | + 'label' => __('Email access', 'give'), |
|
37 | + 'description' => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'), |
|
38 | + 'notification_status' => give_get_option('email_access', 'disabled'), |
|
39 | 39 | 'form_metabox_setting' => false, |
40 | 40 | 'notification_status_editable' => false, |
41 | 41 | 'email_tag_context' => 'donor', |
42 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
43 | - 'default_email_subject' => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ), |
|
42 | + 'recipient_group_name' => __('Donor', 'give'), |
|
43 | + 'default_email_subject' => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')), |
|
44 | 44 | 'default_email_message' => $this->get_default_email_message(), |
45 | - 'default_email_header' => __( 'Confirm Email', 'give' ), |
|
45 | + 'default_email_header' => __('Confirm Email', 'give'), |
|
46 | 46 | 'notices' => array( |
47 | 47 | 'non-notification-status-editable' => sprintf( |
48 | 48 | '%1$s <a href="%2$s">%3$s »</a>', |
49 | - __( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ), |
|
50 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control') ), |
|
51 | - __( 'Edit Setting', 'give' ) |
|
49 | + __('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'), |
|
50 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control')), |
|
51 | + __('Edit Setting', 'give') |
|
52 | 52 | ) |
53 | 53 | ), |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | |
56 | - add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 ); |
|
57 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
58 | - add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 ); |
|
56 | + add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2); |
|
57 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
58 | + add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - public function get_email_subject( $form_id = null ) { |
|
71 | + public function get_email_subject($form_id = null) { |
|
72 | 72 | $subject = wp_strip_all_tags( |
73 | 73 | Give_Email_Notification_Util::get_value( |
74 | 74 | $this, |
75 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
75 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
76 | 76 | $form_id, |
77 | 77 | $this->config['default_email_subject'] |
78 | 78 | ) |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @since 1.0 |
86 | 86 | */ |
87 | - $subject = apply_filters( 'give_email_access_token_subject', $subject ); |
|
87 | + $subject = apply_filters('give_email_access_token_subject', $subject); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Filters the donation notification subject. |
91 | 91 | * |
92 | 92 | * @since 2.0 |
93 | 93 | */ |
94 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
94 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
95 | 95 | |
96 | 96 | return $subject; |
97 | 97 | } |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function get_email_message( $form_id = null ) { |
|
110 | + public function get_email_message($form_id = null) { |
|
111 | 111 | $message = Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_message'] |
116 | 116 | ); |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @since 1.0 |
123 | 123 | */ |
124 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
124 | + $message = apply_filters('give_email_access_token_message', $message); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter the email message |
128 | 128 | * |
129 | 129 | * @since 2.0 |
130 | 130 | */ |
131 | - $message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id ); |
|
131 | + $message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id); |
|
132 | 132 | |
133 | 133 | return $message; |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param int $form_id |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public function get_email_attachments( $form_id = null ) { |
|
146 | + public function get_email_attachments($form_id = null) { |
|
147 | 147 | /** |
148 | 148 | * Filters the donation notification email attachments. |
149 | 149 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array() ); |
|
154 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array()); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Filters the donation notification email attachments. |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 2.0 |
161 | 161 | */ |
162 | - $attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id ); |
|
162 | + $attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id); |
|
163 | 163 | |
164 | 164 | return $attachments; |
165 | 165 | } |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | 177 | $message = sprintf( |
178 | - __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | - get_bloginfo( 'url' ), |
|
180 | - get_bloginfo( 'admin_email' ) |
|
181 | - ) . "\n\n"; |
|
182 | - $message .= '{email_access_link}' . "\n\n"; |
|
178 | + __('Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give'), |
|
179 | + get_bloginfo('url'), |
|
180 | + get_bloginfo('admin_email') |
|
181 | + )."\n\n"; |
|
182 | + $message .= '{email_access_link}'."\n\n"; |
|
183 | 183 | $message .= "\n\n"; |
184 | - $message .= __( 'Sincerely,', 'give' ) . "\n"; |
|
185 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
184 | + $message .= __('Sincerely,', 'give')."\n"; |
|
185 | + $message .= get_bloginfo('name')."\n"; |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filter the new donation email message |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @param string $message |
193 | 193 | */ |
194 | - return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this ); |
|
194 | + return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @since 1.0 |
209 | 209 | */ |
210 | - $from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() ); |
|
210 | + $from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name()); |
|
211 | 211 | |
212 | 212 | /** |
213 | 213 | * Filters the from email. |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @since 1.0 |
217 | 217 | */ |
218 | - $from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() ); |
|
218 | + $from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address()); |
|
219 | 219 | |
220 | - Give()->emails->__set( 'from_name', $from_name ); |
|
221 | - Give()->emails->__set( 'from_email', $from_email ); |
|
222 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', $this->get_email_header() ) ); |
|
220 | + Give()->emails->__set('from_name', $from_name); |
|
221 | + Give()->emails->__set('from_email', $from_email); |
|
222 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', $this->get_email_header())); |
|
223 | 223 | /** |
224 | 224 | * Filters the donation notification email headers. |
225 | 225 | * |
226 | 226 | * @since 1.0 |
227 | 227 | */ |
228 | - $headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() ); |
|
228 | + $headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers()); |
|
229 | 229 | |
230 | - Give()->emails->__set( 'headers', $headers ); |
|
230 | + Give()->emails->__set('headers', $headers); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return bool |
243 | 243 | */ |
244 | - public function setup_email_notification( $donor_id, $email ) { |
|
245 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
244 | + public function setup_email_notification($donor_id, $email) { |
|
245 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
246 | 246 | $this->recipient_email = $email; |
247 | 247 | |
248 | 248 | // Set email data. |
@@ -267,17 +267,17 @@ discard block |
||
267 | 267 | * @param $update_options |
268 | 268 | * @param $option_name |
269 | 269 | */ |
270 | - public function set_notification_status( $update_options, $option_name ) { |
|
270 | + public function set_notification_status($update_options, $option_name) { |
|
271 | 271 | // Get updated settings. |
272 | 272 | $update_options = give_get_settings(); |
273 | 273 | |
274 | 274 | if ( |
275 | - ! empty( $update_options['email_access'] ) |
|
276 | - && ! empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
277 | - && $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ] |
|
275 | + ! empty($update_options['email_access']) |
|
276 | + && ! empty($update_options["{$this->config['id']}_notification"]) |
|
277 | + && $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"] |
|
278 | 278 | ) { |
279 | - $update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access']; |
|
280 | - update_option( $option_name, $update_options ); |
|
279 | + $update_options["{$this->config['id']}_notification"] = $update_options['email_access']; |
|
280 | + update_option($option_name, $update_options); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | * @param Give_Email_Access_Email $email |
293 | 293 | * @return string |
294 | 294 | */ |
295 | - public function email_preview_header( $email_preview_header, $email ) { |
|
296 | - if( $this->config['id'] === $email->config['id'] ) { |
|
295 | + public function email_preview_header($email_preview_header, $email) { |
|
296 | + if ($this->config['id'] === $email->config['id']) { |
|
297 | 297 | $email_preview_header = ''; |
298 | 298 | } |
299 | 299 |
@@ -16,12 +16,12 @@ |
||
16 | 16 | * @since 2.0 |
17 | 17 | */ |
18 | 18 | function give_set_notification_status_handler() { |
19 | - $notification_id = isset( $_POST['notification_id'] ) ? give_clean( $_POST['notification_id'] ) : ''; |
|
20 | - if ( ! empty( $notification_id ) && give_update_option( "{$notification_id}_notification", give_clean( $_POST['status'] ) ) ) { |
|
19 | + $notification_id = isset($_POST['notification_id']) ? give_clean($_POST['notification_id']) : ''; |
|
20 | + if ( ! empty($notification_id) && give_update_option("{$notification_id}_notification", give_clean($_POST['status']))) { |
|
21 | 21 | wp_send_json_success(); |
22 | 22 | } |
23 | 23 | |
24 | 24 | wp_send_json_error(); |
25 | 25 | } |
26 | 26 | |
27 | -add_action( 'wp_ajax_give_set_notification_status', 'give_set_notification_status_handler' ); |
|
27 | +add_action('wp_ajax_give_set_notification_status', 'give_set_notification_status_handler'); |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return string |
13 | 13 | */ |
14 | -function _give_bc_offline_donation_instruction_notification_status( $notification_status, $email, $form_id ) { |
|
14 | +function _give_bc_offline_donation_instruction_notification_status($notification_status, $email, $form_id) { |
|
15 | 15 | // Bailout. |
16 | - if ( ! $form_id ) { |
|
16 | + if ( ! $form_id) { |
|
17 | 17 | return $notification_status; |
18 | 18 | } |
19 | 19 | |
20 | - if ( ! get_post_meta( $form_id, '_give_offline-donation-instruction_notification', true ) ) { |
|
21 | - $old_value = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
22 | - $notification_status = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) ) |
|
20 | + if ( ! get_post_meta($form_id, '_give_offline-donation-instruction_notification', true)) { |
|
21 | + $old_value = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
22 | + $notification_status = give_is_setting_enabled($old_value, array('enabled', 'global')) |
|
23 | 23 | ? $old_value |
24 | 24 | : 'global'; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $notification_status; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3 ); |
|
31 | +add_filter('give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -43,22 +43,22 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return mixed |
45 | 45 | */ |
46 | -function _give_bc_offline_donation_instruction_email_setting_values( $option_value, $option_name, $email, $form_id ) { |
|
46 | +function _give_bc_offline_donation_instruction_email_setting_values($option_value, $option_name, $email, $form_id) { |
|
47 | 47 | // Bailout. |
48 | - if ( empty( $form_id ) || 'offline-donation-instruction' !== $email->config['id'] ) { |
|
48 | + if (empty($form_id) || 'offline-donation-instruction' !== $email->config['id']) { |
|
49 | 49 | return $option_value; |
50 | 50 | } |
51 | 51 | |
52 | - switch ( $option_name ) { |
|
52 | + switch ($option_name) { |
|
53 | 53 | case '_give_offline-donation-instruction_email_message': |
54 | - if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) { |
|
55 | - $option_value = get_post_meta( $form_id, '_give_offline_donation_email', true ); |
|
54 | + if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) { |
|
55 | + $option_value = get_post_meta($form_id, '_give_offline_donation_email', true); |
|
56 | 56 | } |
57 | 57 | break; |
58 | 58 | |
59 | 59 | case '_give_offline-donation-instruction_email_subject': |
60 | - if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) { |
|
61 | - $option_value = get_post_meta( $form_id, '_give_offline_donation_subject', true ); |
|
60 | + if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) { |
|
61 | + $option_value = get_post_meta($form_id, '_give_offline_donation_subject', true); |
|
62 | 62 | } |
63 | 63 | break; |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return $option_value; |
67 | 67 | } |
68 | 68 | |
69 | -add_filter( 'give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4 ); |
|
69 | +add_filter('give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | /** |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string |
82 | 82 | */ |
83 | -function _give_bc_offline_instruction_status_setting_value( $field_value, $field, $form_id ) { |
|
84 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
85 | - $old_value = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
86 | - $field_value = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) ) |
|
83 | +function _give_bc_offline_instruction_status_setting_value($field_value, $field, $form_id) { |
|
84 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
85 | + $old_value = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
86 | + $field_value = give_is_setting_enabled($old_value, array('enabled', 'global')) |
|
87 | 87 | ? $old_value |
88 | 88 | : 'global'; |
89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | return $field_value; |
92 | 92 | } |
93 | 93 | |
94 | -add_filter( '_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3 ); |
|
94 | +add_filter('_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | /** |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string |
107 | 107 | */ |
108 | -function _offline_donation_instruction_email_subject_setting_value( $field_value, $field, $form_id ) { |
|
109 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
110 | - $field_value = get_post_meta( $form_id, '_give_offline_donation_subject', true ); |
|
108 | +function _offline_donation_instruction_email_subject_setting_value($field_value, $field, $form_id) { |
|
109 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
110 | + $field_value = get_post_meta($form_id, '_give_offline_donation_subject', true); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $field_value; |
114 | 114 | } |
115 | 115 | |
116 | -add_filter( '_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3 ); |
|
116 | +add_filter('_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | /** |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return string |
129 | 129 | */ |
130 | -function _give_bc_offline_donation_instruction_email_message_setting_value( $field_value, $field, $form_id ) { |
|
131 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
132 | - $field_value = get_post_meta( $form_id, '_give_offline_donation_email', true ); |
|
130 | +function _give_bc_offline_donation_instruction_email_message_setting_value($field_value, $field, $form_id) { |
|
131 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
132 | + $field_value = get_post_meta($form_id, '_give_offline_donation_email', true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $field_value; |
136 | 136 | } |
137 | 137 | |
138 | -add_filter( '_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3 ); |
|
139 | 138 | \ No newline at end of file |
139 | +add_filter('_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3); |
|
140 | 140 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - $views = apply_filters( 'give_report_views', $views ); |
|
108 | + $views = apply_filters('give_report_views', $views); |
|
109 | 109 | |
110 | 110 | return $views; |
111 | 111 | } |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @since 1.0 |
121 | 121 | * @return string $view Report View |
122 | 122 | */ |
123 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
123 | +function give_get_reporting_view($default = 'earnings') { |
|
124 | 124 | |
125 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
125 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
126 | 126 | $view = $default; |
127 | 127 | } else { |
128 | 128 | $view = $_GET['view']; |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
131 | + return apply_filters('give_get_reporting_view', $view); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | */ |
140 | 140 | function give_reports_tab_reports() { |
141 | 141 | |
142 | - if( ! current_user_can( 'view_give_reports' ) ) { |
|
143 | - wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
142 | + if ( ! current_user_can('view_give_reports')) { |
|
143 | + wp_die(__('You do not have permission to access this report', 'give'), __('Error', 'give'), array('response' => 403)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $current_view = 'earnings'; |
147 | 147 | $views = give_reports_default_views(); |
148 | 148 | |
149 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
149 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
150 | 150 | $current_view = $_GET['tab']; |
151 | 151 | } |
152 | 152 | |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @since 1.0 |
157 | 157 | */ |
158 | - do_action( "give_reports_view_{$current_view}" ); |
|
158 | + do_action("give_reports_view_{$current_view}"); |
|
159 | 159 | } |
160 | 160 | |
161 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
161 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Renders the Reports Page Views Drop Downs |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | */ |
169 | 169 | function give_report_views() { |
170 | 170 | $views = give_reports_default_views(); |
171 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
171 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
172 | 172 | /** |
173 | 173 | * Fires before the report page actions form. |
174 | 174 | * |
175 | 175 | * @since 1.0 |
176 | 176 | */ |
177 | - do_action( 'give_report_view_actions_before' ); |
|
177 | + do_action('give_report_view_actions_before'); |
|
178 | 178 | ?> |
179 | 179 | <form id="give-reports-filter" method="get"> |
180 | 180 | <select id="give-reports-view" name="view"> |
181 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
182 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
183 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
181 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
182 | + <?php foreach ($views as $view_id => $label) : ?> |
|
183 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
184 | 184 | <?php endforeach; ?> |
185 | 185 | </select> |
186 | 186 | |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @since 1.0 |
194 | 194 | */ |
195 | - do_action( 'give_report_view_actions' ); |
|
195 | + do_action('give_report_view_actions'); |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | <input type="hidden" name="post_type" value="give_forms"/> |
199 | 199 | <input type="hidden" name="page" value="give-reports"/> |
200 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
200 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
201 | 201 | </form> |
202 | 202 | <?php |
203 | 203 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - do_action( 'give_report_view_actions_after' ); |
|
208 | + do_action('give_report_view_actions_after'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function give_reports_forms_table() { |
220 | 220 | |
221 | - if ( isset( $_GET['form-id'] ) ) { |
|
221 | + if (isset($_GET['form-id'])) { |
|
222 | 222 | return; |
223 | 223 | } |
224 | 224 | |
225 | - include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-form-reports-table.php'; |
|
225 | + include GIVE_PLUGIN_DIR.'includes/admin/reports/class-form-reports-table.php'; |
|
226 | 226 | |
227 | 227 | $give_table = new Give_Form_Reports_Table(); |
228 | 228 | $give_table->prepare_items(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | <?php |
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
237 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Renders the detailed report for a specific give form. |
@@ -243,20 +243,20 @@ discard block |
||
243 | 243 | * @return void |
244 | 244 | */ |
245 | 245 | function give_reports_form_details() { |
246 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
246 | + if ( ! isset($_GET['form-id'])) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | ?> |
250 | 250 | <div class="tablenav top reports-forms-details-wrap"> |
251 | 251 | <div class="actions bulkactions"> |
252 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
252 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
253 | 253 | </div> |
254 | 254 | </div> |
255 | 255 | <?php |
256 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
256 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
257 | 257 | } |
258 | 258 | |
259 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
259 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Renders the Gateways Table |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | * @return void |
268 | 268 | */ |
269 | 269 | function give_reports_gateways_table() { |
270 | - include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-gateways-reports-table.php'; |
|
270 | + include GIVE_PLUGIN_DIR.'includes/admin/reports/class-gateways-reports-table.php'; |
|
271 | 271 | |
272 | 272 | $give_table = new Give_Gateway_Reports_Table(); |
273 | 273 | $give_table->prepare_items(); |
274 | 274 | $give_table->display(); |
275 | 275 | } |
276 | 276 | |
277 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
277 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
278 | 278 | |
279 | 279 | /** |
280 | 280 | * Renders the Reports Earnings Graphs |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | function give_reports_earnings() { |
286 | 286 | ?> |
287 | 287 | <div class="tablenav top reports-table-nav"> |
288 | - <h2 class="reports-earnings-title screen-reader-text"><?php _e( 'Income Report', 'give' ); ?></h2> |
|
288 | + <h2 class="reports-earnings-title screen-reader-text"><?php _e('Income Report', 'give'); ?></h2> |
|
289 | 289 | </div> |
290 | 290 | <?php |
291 | 291 | give_reports_graph(); |
292 | 292 | } |
293 | 293 | |
294 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
294 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
295 | 295 | |
296 | 296 | |
297 | 297 | /** |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | */ |
303 | 303 | function give_estimated_monthly_stats() { |
304 | 304 | |
305 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
305 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
306 | 306 | |
307 | - if ( false === $estimated ) { |
|
307 | + if (false === $estimated) { |
|
308 | 308 | |
309 | 309 | $estimated = array( |
310 | 310 | 'earnings' => 0, |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | |
314 | 314 | $stats = new Give_Payment_Stats; |
315 | 315 | |
316 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
317 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
316 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
317 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
318 | 318 | |
319 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
320 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
321 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
322 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
319 | + $current_day = date('d', current_time('timestamp')); |
|
320 | + $current_month = date('n', current_time('timestamp')); |
|
321 | + $current_year = date('Y', current_time('timestamp')); |
|
322 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
323 | 323 | |
324 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
325 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
324 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
325 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
326 | 326 | |
327 | 327 | // Cache for one day |
328 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
328 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
329 | 329 | } |
330 | 330 | |
331 | - return maybe_unserialize( $estimated ); |
|
331 | + return maybe_unserialize($estimated); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | function give_reports_set_form_method() { |
342 | 342 | return 'get'; |
343 | 343 | } |
344 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
345 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
344 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
345 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
346 | 346 | |
347 | 347 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |