@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,37 +25,37 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | break; |
41 | 41 | |
42 | - case version_compare( $give_version, '1.7', '<' ) : |
|
42 | + case version_compare($give_version, '1.7', '<') : |
|
43 | 43 | give_v17_upgrades(); |
44 | 44 | $did_upgrade = true; |
45 | 45 | break; |
46 | 46 | |
47 | - case version_compare( $give_version, '1.8', '<' ) : |
|
47 | + case version_compare($give_version, '1.8', '<') : |
|
48 | 48 | give_v18_upgrades(); |
49 | 49 | $did_upgrade = true; |
50 | 50 | } |
51 | 51 | |
52 | - if ( $did_upgrade ) { |
|
53 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
52 | + if ($did_upgrade) { |
|
53 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
58 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
57 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
58 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Display Upgrade Notices |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function give_show_upgrade_notices() { |
67 | 67 | // Don't show notices on the upgrades page. |
68 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
68 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | - $give_version = get_option( 'give_version' ); |
|
72 | + $give_version = get_option('give_version'); |
|
73 | 73 | |
74 | - if ( ! $give_version ) { |
|
74 | + if ( ! $give_version) { |
|
75 | 75 | // 1.0 is the first version to use this option so we must add it. |
76 | 76 | $give_version = '1.0'; |
77 | 77 | } |
78 | 78 | |
79 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
79 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
80 | 80 | |
81 | 81 | /* |
82 | 82 | * NOTICE: |
@@ -87,31 +87,31 @@ discard block |
||
87 | 87 | */ |
88 | 88 | |
89 | 89 | // v1.3.2 Upgrades |
90 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
90 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
91 | 91 | printf( |
92 | 92 | /* translators: %s: upgrade URL */ |
93 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
94 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
93 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
94 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
98 | 98 | // v1.3.4 Upgrades //ensure the user has gone through 1.3.4. |
99 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
99 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
100 | 100 | printf( |
101 | 101 | /* translators: %s: upgrade URL */ |
102 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
103 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
102 | + '<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
103 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 | |
107 | 107 | // Check if we have a stalled upgrade. |
108 | 108 | $resume_upgrade = give_maybe_resume_upgrade(); |
109 | - if ( ! empty( $resume_upgrade ) ) { |
|
110 | - $resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ); |
|
109 | + if ( ! empty($resume_upgrade)) { |
|
110 | + $resume_url = add_query_arg($resume_upgrade, admin_url('index.php')); |
|
111 | 111 | echo Give_Notices::notice_html( |
112 | 112 | sprintf( |
113 | - __( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ), |
|
114 | - esc_url( $resume_url ) |
|
113 | + __('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'), |
|
114 | + esc_url($resume_url) |
|
115 | 115 | ) |
116 | 116 | ); |
117 | 117 | |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // v1.8 form metadata upgrades. |
122 | - if ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) { |
|
122 | + if (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) { |
|
123 | 123 | echo Give_Notices::notice_html( |
124 | 124 | sprintf( |
125 | - esc_html__( 'Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give' ), |
|
126 | - '<a class="give-upgrade-link" href="' . esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) . '">', |
|
125 | + esc_html__('Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give'), |
|
126 | + '<a class="give-upgrade-link" href="'.esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')).'">', |
|
127 | 127 | '</a>' |
128 | 128 | ) |
129 | 129 | ); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $upgrade_links.on( 'click', function(e){ |
139 | 139 | e.preventDefault(); |
140 | 140 | |
141 | - if( ! window.confirm( '<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>' ) ) { |
|
141 | + if( ! window.confirm( '<?php _e('Please make sure to create a database backup before initiating the upgrade.', 'give'); ?>' ) ) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | <?php |
152 | 152 | } |
153 | 153 | |
154 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
154 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Triggers all upgrade functions |
@@ -163,29 +163,29 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_trigger_upgrades() { |
165 | 165 | |
166 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
167 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
166 | + if ( ! current_user_can('manage_give_settings')) { |
|
167 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
168 | 168 | 'response' => 403, |
169 | - ) ); |
|
169 | + )); |
|
170 | 170 | } |
171 | 171 | |
172 | - $give_version = get_option( 'give_version' ); |
|
172 | + $give_version = get_option('give_version'); |
|
173 | 173 | |
174 | - if ( ! $give_version ) { |
|
174 | + if ( ! $give_version) { |
|
175 | 175 | // 1.0 is the first version to use this option so we must add it. |
176 | 176 | $give_version = '1.0'; |
177 | - add_option( 'give_version', $give_version ); |
|
177 | + add_option('give_version', $give_version); |
|
178 | 178 | } |
179 | 179 | |
180 | - update_option( 'give_version', GIVE_VERSION ); |
|
181 | - delete_option( 'give_doing_upgrade' ); |
|
180 | + update_option('give_version', GIVE_VERSION); |
|
181 | + delete_option('give_doing_upgrade'); |
|
182 | 182 | |
183 | - if ( DOING_AJAX ) { |
|
184 | - die( 'complete' ); |
|
183 | + if (DOING_AJAX) { |
|
184 | + die('complete'); |
|
185 | 185 | } // End if(). |
186 | 186 | } |
187 | 187 | |
188 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
188 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
189 | 189 | |
190 | 190 | /** |
191 | 191 | * Check if the upgrade routine has been run for a specific action |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return bool If the action has been added to the completed actions array |
198 | 198 | */ |
199 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
199 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
200 | 200 | |
201 | - if ( empty( $upgrade_action ) ) { |
|
201 | + if (empty($upgrade_action)) { |
|
202 | 202 | return false; |
203 | 203 | } |
204 | 204 | |
205 | 205 | $completed_upgrades = give_get_completed_upgrades(); |
206 | 206 | |
207 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
207 | + return in_array($upgrade_action, $completed_upgrades); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
217 | 217 | */ |
218 | 218 | function give_maybe_resume_upgrade() { |
219 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
220 | - if ( empty( $doing_upgrade ) ) { |
|
219 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
220 | + if (empty($doing_upgrade)) { |
|
221 | 221 | return false; |
222 | 222 | } |
223 | 223 | |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return bool If the function was successfully added |
235 | 235 | */ |
236 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
236 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
237 | 237 | |
238 | - if ( empty( $upgrade_action ) ) { |
|
238 | + if (empty($upgrade_action)) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | $completed_upgrades[] = $upgrade_action; |
244 | 244 | |
245 | 245 | // Remove any blanks, and only show uniques. |
246 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
246 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
247 | 247 | |
248 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
248 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | */ |
257 | 257 | function give_get_completed_upgrades() { |
258 | 258 | |
259 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
259 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
260 | 260 | |
261 | - if ( false === $completed_upgrades ) { |
|
261 | + if (false === $completed_upgrades) { |
|
262 | 262 | $completed_upgrades = array(); |
263 | 263 | } |
264 | 264 | |
@@ -275,31 +275,31 @@ discard block |
||
275 | 275 | */ |
276 | 276 | function give_v132_upgrade_give_payment_customer_id() { |
277 | 277 | global $wpdb; |
278 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
279 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
278 | + if ( ! current_user_can('manage_give_settings')) { |
|
279 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
280 | 280 | 'response' => 403, |
281 | - ) ); |
|
281 | + )); |
|
282 | 282 | } |
283 | 283 | |
284 | - ignore_user_abort( true ); |
|
284 | + ignore_user_abort(true); |
|
285 | 285 | |
286 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
287 | - @set_time_limit( 0 ); |
|
286 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
287 | + @set_time_limit(0); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // UPDATE DB METAKEYS. |
291 | 291 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
292 | - $query = $wpdb->query( $sql ); |
|
292 | + $query = $wpdb->query($sql); |
|
293 | 293 | |
294 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
295 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
296 | - delete_option( 'give_doing_upgrade' ); |
|
297 | - wp_redirect( admin_url() ); |
|
294 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
295 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
296 | + delete_option('give_doing_upgrade'); |
|
297 | + wp_redirect(admin_url()); |
|
298 | 298 | exit; |
299 | 299 | |
300 | 300 | } |
301 | 301 | |
302 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
302 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
303 | 303 | |
304 | 304 | /** |
305 | 305 | * Upgrades the Offline Status |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | |
313 | 313 | global $wpdb; |
314 | 314 | |
315 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
316 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
315 | + if ( ! current_user_can('manage_give_settings')) { |
|
316 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
317 | 317 | 'response' => 403, |
318 | - ) ); |
|
318 | + )); |
|
319 | 319 | } |
320 | 320 | |
321 | - ignore_user_abort( true ); |
|
321 | + ignore_user_abort(true); |
|
322 | 322 | |
323 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
324 | - @set_time_limit( 0 ); |
|
323 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
324 | + @set_time_limit(0); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | // Get abandoned offline payments. |
@@ -331,31 +331,31 @@ discard block |
||
331 | 331 | $where .= "AND ( p.post_status = 'abandoned' )"; |
332 | 332 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
333 | 333 | |
334 | - $sql = $select . $join . $where; |
|
335 | - $found_payments = $wpdb->get_col( $sql ); |
|
334 | + $sql = $select.$join.$where; |
|
335 | + $found_payments = $wpdb->get_col($sql); |
|
336 | 336 | |
337 | - foreach ( $found_payments as $payment ) { |
|
337 | + foreach ($found_payments as $payment) { |
|
338 | 338 | |
339 | 339 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
340 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
340 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
341 | 341 | |
342 | 342 | // 1450124863 = 12/10/2015 20:42:25. |
343 | - if ( $modified_time >= 1450124863 ) { |
|
343 | + if ($modified_time >= 1450124863) { |
|
344 | 344 | |
345 | - give_update_payment_status( $payment, 'pending' ); |
|
345 | + give_update_payment_status($payment, 'pending'); |
|
346 | 346 | |
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
350 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
351 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
352 | - delete_option( 'give_doing_upgrade' ); |
|
353 | - wp_redirect( admin_url() ); |
|
350 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
351 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
352 | + delete_option('give_doing_upgrade'); |
|
353 | + wp_redirect(admin_url()); |
|
354 | 354 | exit; |
355 | 355 | |
356 | 356 | } |
357 | 357 | |
358 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
358 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
359 | 359 | |
360 | 360 | /** |
361 | 361 | * Cleanup User Roles |
@@ -366,17 +366,17 @@ discard block |
||
366 | 366 | */ |
367 | 367 | function give_v152_cleanup_users() { |
368 | 368 | |
369 | - $give_version = get_option( 'give_version' ); |
|
369 | + $give_version = get_option('give_version'); |
|
370 | 370 | |
371 | - if ( ! $give_version ) { |
|
371 | + if ( ! $give_version) { |
|
372 | 372 | // 1.0 is the first version to use this option so we must add it. |
373 | 373 | $give_version = '1.0'; |
374 | 374 | } |
375 | 375 | |
376 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
376 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
377 | 377 | |
378 | 378 | // v1.5.2 Upgrades |
379 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
379 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
380 | 380 | |
381 | 381 | // Delete all caps with "ss". |
382 | 382 | // Also delete all unused "campaign" roles. |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | ); |
424 | 424 | |
425 | 425 | global $wp_roles; |
426 | - foreach ( $delete_caps as $cap ) { |
|
427 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
428 | - $wp_roles->remove_cap( $role, $cap ); |
|
426 | + foreach ($delete_caps as $cap) { |
|
427 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
428 | + $wp_roles->remove_cap($role, $cap); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
@@ -435,15 +435,15 @@ discard block |
||
435 | 435 | $roles->add_caps(); |
436 | 436 | |
437 | 437 | // The Update Ran. |
438 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
439 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
440 | - delete_option( 'give_doing_upgrade' ); |
|
438 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
439 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
440 | + delete_option('give_doing_upgrade'); |
|
441 | 441 | |
442 | 442 | }// End if(). |
443 | 443 | |
444 | 444 | } |
445 | 445 | |
446 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
446 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
447 | 447 | |
448 | 448 | /** |
449 | 449 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -483,53 +483,53 @@ discard block |
||
483 | 483 | |
484 | 484 | // Get addons license key. |
485 | 485 | $addons = array(); |
486 | - foreach ( $give_options as $key => $value ) { |
|
487 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
488 | - $addons[ $key ] = $value; |
|
486 | + foreach ($give_options as $key => $value) { |
|
487 | + if (false !== strpos($key, '_license_key')) { |
|
488 | + $addons[$key] = $value; |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | 492 | // Bailout: We do not have any addon license data to upgrade. |
493 | - if ( empty( $addons ) ) { |
|
493 | + if (empty($addons)) { |
|
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | |
497 | - foreach ( $addons as $key => $addon_license ) { |
|
497 | + foreach ($addons as $key => $addon_license) { |
|
498 | 498 | |
499 | 499 | // Get addon shortname. |
500 | - $shortname = str_replace( '_license_key', '', $key ); |
|
500 | + $shortname = str_replace('_license_key', '', $key); |
|
501 | 501 | |
502 | 502 | // Addon license option name. |
503 | - $addon_license_option_name = $shortname . '_license_active'; |
|
503 | + $addon_license_option_name = $shortname.'_license_active'; |
|
504 | 504 | |
505 | 505 | // bailout if license is empty. |
506 | - if ( empty( $addon_license ) ) { |
|
507 | - delete_option( $addon_license_option_name ); |
|
506 | + if (empty($addon_license)) { |
|
507 | + delete_option($addon_license_option_name); |
|
508 | 508 | continue; |
509 | 509 | } |
510 | 510 | |
511 | 511 | // Get addon name. |
512 | 512 | $addon_name = array(); |
513 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
514 | - foreach ( $addon_name_parts as $name_part ) { |
|
513 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
514 | + foreach ($addon_name_parts as $name_part) { |
|
515 | 515 | |
516 | 516 | // Fix addon name |
517 | - switch ( $name_part ) { |
|
517 | + switch ($name_part) { |
|
518 | 518 | case 'authorizenet' : |
519 | 519 | $name_part = 'authorize.net'; |
520 | 520 | break; |
521 | 521 | } |
522 | 522 | |
523 | - $addon_name[] = ucfirst( $name_part ); |
|
523 | + $addon_name[] = ucfirst($name_part); |
|
524 | 524 | } |
525 | 525 | |
526 | - $addon_name = implode( ' ', $addon_name ); |
|
526 | + $addon_name = implode(' ', $addon_name); |
|
527 | 527 | |
528 | 528 | // Data to send to the API |
529 | 529 | $api_params = array( |
530 | 530 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
531 | 531 | 'license' => $addon_license, |
532 | - 'item_name' => urlencode( $addon_name ), |
|
532 | + 'item_name' => urlencode($addon_name), |
|
533 | 533 | 'url' => home_url(), |
534 | 534 | ); |
535 | 535 | |
@@ -544,17 +544,17 @@ discard block |
||
544 | 544 | ); |
545 | 545 | |
546 | 546 | // Make sure there are no errors. |
547 | - if ( is_wp_error( $response ) ) { |
|
548 | - delete_option( $addon_license_option_name ); |
|
547 | + if (is_wp_error($response)) { |
|
548 | + delete_option($addon_license_option_name); |
|
549 | 549 | continue; |
550 | 550 | } |
551 | 551 | |
552 | 552 | // Tell WordPress to look for updates. |
553 | - set_site_transient( 'update_plugins', null ); |
|
553 | + set_site_transient('update_plugins', null); |
|
554 | 554 | |
555 | 555 | // Decode license data. |
556 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
557 | - update_option( $addon_license_option_name, $license_data ); |
|
556 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
557 | + update_option($addon_license_option_name, $license_data); |
|
558 | 558 | }// End foreach(). |
559 | 559 | } |
560 | 560 | |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | ); |
585 | 585 | |
586 | 586 | global $wp_roles; |
587 | - foreach ( $delete_caps as $cap ) { |
|
588 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
589 | - $wp_roles->remove_cap( $role, $cap ); |
|
587 | + foreach ($delete_caps as $cap) { |
|
588 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
589 | + $wp_roles->remove_cap($role, $cap); |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | function give_v18_upgrades_core_setting() { |
621 | 621 | // Core settings which changes from checkbox to radio. |
622 | 622 | $core_setting_names = array_merge( |
623 | - array_keys( give_v18_renamed_core_settings() ), |
|
623 | + array_keys(give_v18_renamed_core_settings()), |
|
624 | 624 | array( |
625 | 625 | 'uninstall_on_delete', |
626 | 626 | 'scripts_footer', |
@@ -632,48 +632,48 @@ discard block |
||
632 | 632 | ); |
633 | 633 | |
634 | 634 | // Bailout: If not any setting define. |
635 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
635 | + if ($give_settings = get_option('give_settings')) { |
|
636 | 636 | |
637 | 637 | $setting_changed = false; |
638 | 638 | |
639 | 639 | // Loop: check each setting field. |
640 | - foreach ( $core_setting_names as $setting_name ) { |
|
640 | + foreach ($core_setting_names as $setting_name) { |
|
641 | 641 | // New setting name. |
642 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
642 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
643 | 643 | |
644 | 644 | // Continue: If setting already set. |
645 | 645 | if ( |
646 | - array_key_exists( $new_setting_name, $give_settings ) |
|
647 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
646 | + array_key_exists($new_setting_name, $give_settings) |
|
647 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
648 | 648 | ) { |
649 | 649 | continue; |
650 | 650 | } |
651 | 651 | |
652 | 652 | // Set checkbox value to radio value. |
653 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
653 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
654 | 654 | |
655 | 655 | // @see https://github.com/WordImpress/Give/issues/1063 |
656 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
656 | + if (false !== strpos($setting_name, 'disable_')) { |
|
657 | 657 | |
658 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
659 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
658 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
659 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
660 | 660 | |
661 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
661 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Tell bot to update core setting to db. |
665 | - if ( ! $setting_changed ) { |
|
665 | + if ( ! $setting_changed) { |
|
666 | 666 | $setting_changed = true; |
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | 670 | // Update setting only if they changed. |
671 | - if ( $setting_changed ) { |
|
672 | - update_option( 'give_settings', $give_settings ); |
|
671 | + if ($setting_changed) { |
|
672 | + update_option('give_settings', $give_settings); |
|
673 | 673 | } |
674 | 674 | }// End if(). |
675 | 675 | |
676 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
676 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | /** |
@@ -683,22 +683,22 @@ discard block |
||
683 | 683 | * @return void |
684 | 684 | */ |
685 | 685 | function give_v18_upgrades_form_metadata() { |
686 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
687 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
686 | + if ( ! current_user_can('manage_give_settings')) { |
|
687 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
688 | 688 | 'response' => 403, |
689 | - ) ); |
|
689 | + )); |
|
690 | 690 | } |
691 | 691 | |
692 | - ignore_user_abort( true ); |
|
692 | + ignore_user_abort(true); |
|
693 | 693 | |
694 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
695 | - @set_time_limit( 0 ); |
|
694 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
695 | + @set_time_limit(0); |
|
696 | 696 | } |
697 | 697 | |
698 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
698 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
699 | 699 | |
700 | 700 | // form query |
701 | - $forms = new WP_Query( array( |
|
701 | + $forms = new WP_Query(array( |
|
702 | 702 | 'paged' => $step, |
703 | 703 | 'status' => 'any', |
704 | 704 | 'order' => 'ASC', |
@@ -707,39 +707,39 @@ discard block |
||
707 | 707 | ) |
708 | 708 | ); |
709 | 709 | |
710 | - if ( $forms->have_posts() ) { |
|
711 | - while ( $forms->have_posts() ) { |
|
710 | + if ($forms->have_posts()) { |
|
711 | + while ($forms->have_posts()) { |
|
712 | 712 | $forms->the_post(); |
713 | 713 | |
714 | 714 | // Form content. |
715 | 715 | // Note in version 1.8 display content setting split into display content and content placement setting. |
716 | 716 | // You can delete _give_content_option in future |
717 | - $show_content = get_post_meta( get_the_ID(), '_give_content_option', true ); |
|
718 | - if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
719 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
720 | - update_post_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
717 | + $show_content = get_post_meta(get_the_ID(), '_give_content_option', true); |
|
718 | + if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) { |
|
719 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
720 | + update_post_meta(get_the_ID(), '_give_display_content', $field_value); |
|
721 | 721 | |
722 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
723 | - update_post_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
722 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
723 | + update_post_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | // "Disable" Guest Donation. Checkbox |
727 | 727 | // See: https://github.com/WordImpress/Give/issues/1470 |
728 | - $guest_donation = get_post_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
729 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
730 | - update_post_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
728 | + $guest_donation = get_post_meta(get_the_ID(), '_give_logged_in_only', true); |
|
729 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
730 | + update_post_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
731 | 731 | |
732 | 732 | // Offline Donations |
733 | 733 | // See: https://github.com/WordImpress/Give/issues/1579 |
734 | - $offline_donation = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
735 | - if ( 'no' === $offline_donation ) { |
|
734 | + $offline_donation = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
735 | + if ('no' === $offline_donation) { |
|
736 | 736 | $offline_donation_newval = 'global'; |
737 | - } elseif ( 'yes' === $offline_donation ) { |
|
737 | + } elseif ('yes' === $offline_donation) { |
|
738 | 738 | $offline_donation_newval = 'enabled'; |
739 | 739 | } else { |
740 | 740 | $offline_donation_newval = 'disabled'; |
741 | 741 | } |
742 | - update_post_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
742 | + update_post_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
743 | 743 | |
744 | 744 | // Convert yes/no setting field to enabled/disabled. |
745 | 745 | $form_radio_settings = array( |
@@ -759,15 +759,15 @@ discard block |
||
759 | 759 | '_give_offline_donation_enable_billing_fields_single', |
760 | 760 | ); |
761 | 761 | |
762 | - foreach ( $form_radio_settings as $meta_key ) { |
|
762 | + foreach ($form_radio_settings as $meta_key) { |
|
763 | 763 | // Get value. |
764 | - $field_value = get_post_meta( get_the_ID(), $meta_key, true ); |
|
764 | + $field_value = get_post_meta(get_the_ID(), $meta_key, true); |
|
765 | 765 | |
766 | 766 | // Convert meta value only if it is in yes/no/none. |
767 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
767 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
768 | 768 | |
769 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
770 | - update_post_meta( get_the_ID(), $meta_key, $field_value ); |
|
769 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
770 | + update_post_meta(get_the_ID(), $meta_key, $field_value); |
|
771 | 771 | } |
772 | 772 | } |
773 | 773 | }// End while(). |
@@ -775,27 +775,27 @@ discard block |
||
775 | 775 | wp_reset_postdata(); |
776 | 776 | |
777 | 777 | // Forms found so upgrade them |
778 | - $step ++; |
|
779 | - $redirect = add_query_arg( array( |
|
778 | + $step++; |
|
779 | + $redirect = add_query_arg(array( |
|
780 | 780 | 'page' => 'give-upgrades', |
781 | 781 | 'give-upgrade' => 'give_v18_upgrades_form_metadata', |
782 | 782 | 'step' => $step, |
783 | - ), admin_url( 'index.php' ) ); |
|
784 | - wp_redirect( $redirect ); |
|
783 | + ), admin_url('index.php')); |
|
784 | + wp_redirect($redirect); |
|
785 | 785 | exit(); |
786 | 786 | |
787 | 787 | } else { |
788 | 788 | // No more forms found, finish up. |
789 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
790 | - delete_option( 'give_doing_upgrade' ); |
|
791 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
789 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
790 | + delete_option('give_doing_upgrade'); |
|
791 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
792 | 792 | |
793 | - wp_redirect( admin_url() ); |
|
793 | + wp_redirect(admin_url()); |
|
794 | 794 | exit; |
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
798 | -add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' ); |
|
798 | +add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata'); |
|
799 | 799 | |
800 | 800 | /** |
801 | 801 | * Get list of core setting renamed in version 1.8. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_form' ); |
|
30 | + parent::__construct('give_form'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | $create_form_link = sprintf( |
41 | 41 | /* translators: %s: create new form URL */ |
42 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
43 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
42 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
43 | + admin_url('post-new.php?post_type=give_forms') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | return array( |
@@ -50,68 +50,68 @@ discard block |
||
50 | 50 | 'post_type' => 'give_forms', |
51 | 51 | ), |
52 | 52 | 'name' => 'id', |
53 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
54 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
53 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
54 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
55 | 55 | 'required' => array( |
56 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
57 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
56 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
57 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
58 | 58 | ), |
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'container', |
62 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
62 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_title', |
67 | - 'label' => esc_attr__( 'Show Title', 'give' ), |
|
68 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Title', 'give'), |
|
68 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_goal', |
77 | - 'label' => esc_attr__( 'Show Goal', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Goal', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_content', |
87 | 87 | 'minWidth' => 240, |
88 | - 'label' => esc_attr__( 'Display Content', 'give' ), |
|
89 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
88 | + 'label' => esc_attr__('Display Content', 'give'), |
|
89 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
90 | 90 | 'options' => array( |
91 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
92 | - 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
93 | - 'below' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
91 | + 'none' => esc_html__('No Content', 'give'), |
|
92 | + 'above' => esc_html__('Display content ABOVE the fields', 'give'), |
|
93 | + 'below' => esc_html__('Display content BELOW the fields', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'type' => 'listbox', |
98 | 98 | 'name' => 'display_style', |
99 | 99 | 'classes' => 'give-display-style', |
100 | - 'label' => esc_attr__( 'Display Options', 'give' ), |
|
101 | - 'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ), |
|
100 | + 'label' => esc_attr__('Display Options', 'give'), |
|
101 | + 'tooltip' => esc_attr__('How would you like to display donation information?', 'give'), |
|
102 | 102 | 'options' => array( |
103 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
104 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
105 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
106 | - 'button' => esc_html__( 'Button', 'give' ), |
|
103 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
104 | + 'modal' => esc_html__('Modal', 'give'), |
|
105 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
106 | + 'button' => esc_html__('Button', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | 110 | 'type' => 'textbox', |
111 | 111 | 'classes' => 'give-hidden give-continue-button-title', |
112 | 112 | 'name' => 'continue_button_title', |
113 | - 'label' => esc_attr__( 'Button Text', 'give' ), |
|
114 | - 'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
113 | + 'label' => esc_attr__('Button Text', 'give'), |
|
114 | + 'tooltip' => esc_attr__('The button label for displaying the additional payment fields.', 'give'), |
|
115 | 115 | ), |
116 | 116 | ); |
117 | 117 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'logs'; |
46 | - $this->label = esc_html__( 'Logs', 'give' ); |
|
46 | + $this->label = esc_html__('Logs', 'give'); |
|
47 | 47 | |
48 | 48 | $this->default_tab = 'sales'; |
49 | 49 | |
50 | 50 | parent::__construct(); |
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
55 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public function add_settings_page( $pages ) { |
|
69 | - $pages[ $this->id ] = $this->label; |
|
68 | + public function add_settings_page($pages) { |
|
69 | + $pages[$this->id] = $this->label; |
|
70 | 70 | |
71 | 71 | return $pages; |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $GLOBALS['give_hide_save_button'] = true; |
83 | 83 | |
84 | 84 | // Get settings. |
85 | - $settings = apply_filters( 'give_settings_logs', array( |
|
85 | + $settings = apply_filters('give_settings_logs', array( |
|
86 | 86 | array( |
87 | 87 | 'id' => 'give_tools_logs', |
88 | 88 | 'type' => 'title', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ), |
91 | 91 | array( |
92 | 92 | 'id' => 'api', |
93 | - 'name' => esc_html__( 'Log', 'give' ), |
|
93 | + 'name' => esc_html__('Log', 'give'), |
|
94 | 94 | 'type' => 'logs', |
95 | 95 | |
96 | 96 | ), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'type' => 'sectionend', |
100 | 100 | 'table_html' => false, |
101 | 101 | ), |
102 | - ) ); |
|
102 | + )); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Filter the settings. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param array $settings |
110 | 110 | */ |
111 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
111 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
112 | 112 | |
113 | 113 | // Output. |
114 | 114 | return $settings; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_sections() { |
124 | 124 | $sections = array( |
125 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
126 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
127 | - 'api_requests' => esc_html__( 'API Requests', 'give' ), |
|
125 | + 'sales' => esc_html__('Donations', 'give'), |
|
126 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
127 | + 'api_requests' => esc_html__('API Requests', 'give'), |
|
128 | 128 | ); |
129 | 129 | |
130 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
130 | + $sections = apply_filters('give_log_views', $sections); |
|
131 | 131 | |
132 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
132 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function output() { |
142 | 142 | $settings = $this->get_settings(); |
143 | 143 | |
144 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
144 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_API' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_API')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_API. |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'api'; |
46 | - $this->label = esc_html__( 'API', 'give' ); |
|
46 | + $this->label = esc_html__('API', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param array $pages Lst of pages. |
57 | 57 | * @return array |
58 | 58 | */ |
59 | - public function add_settings_page( $pages ) { |
|
60 | - $pages[ $this->id ] = $this->label; |
|
59 | + public function add_settings_page($pages) { |
|
60 | + $pages[$this->id] = $this->label; |
|
61 | 61 | |
62 | 62 | return $pages; |
63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $GLOBALS['give_hide_save_button'] = true; |
74 | 74 | |
75 | 75 | // Get settings. |
76 | - $settings = apply_filters( 'give_settings_api', array( |
|
76 | + $settings = apply_filters('give_settings_api', array( |
|
77 | 77 | array( |
78 | 78 | 'id' => 'give_tools_api', |
79 | 79 | 'type' => 'title', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ), |
82 | 82 | array( |
83 | 83 | 'id' => 'api', |
84 | - 'name' => esc_html__( 'API', 'give' ), |
|
84 | + 'name' => esc_html__('API', 'give'), |
|
85 | 85 | 'type' => 'api', |
86 | 86 | ), |
87 | 87 | array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @since 1.8 |
98 | 98 | * @param array $settings |
99 | 99 | */ |
100 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
100 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
101 | 101 | |
102 | 102 | // Output. |
103 | 103 | return $settings; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function output() { |
113 | 113 | $settings = $this->get_settings(); |
114 | 114 | |
115 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
115 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Data' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Data')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Data. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'data'; |
46 | - $this->label = esc_html__( 'Data', 'give' ); |
|
46 | + $this->label = esc_html__('Data', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $GLOBALS['give_hide_save_button'] = true; |
80 | 80 | |
81 | 81 | // Get settings. |
82 | - $settings = apply_filters( 'give_settings_data', array( |
|
82 | + $settings = apply_filters('give_settings_data', array( |
|
83 | 83 | array( |
84 | 84 | 'id' => 'give_tools_tools', |
85 | 85 | 'type' => 'title', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ), |
88 | 88 | array( |
89 | 89 | 'id' => 'api', |
90 | - 'name' => esc_html__( 'Tools', 'give' ), |
|
90 | + 'name' => esc_html__('Tools', 'give'), |
|
91 | 91 | 'type' => 'data', |
92 | 92 | ), |
93 | 93 | array( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 1.8 |
104 | 104 | * @param array $settings |
105 | 105 | */ |
106 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
106 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
107 | 107 | |
108 | 108 | // Output. |
109 | 109 | return $settings; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function output() { |
119 | 119 | $settings = $this->get_settings(); |
120 | 120 | |
121 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
121 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 |
@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | 28 | // If payment_key query arg exists, return receipt instead of donation history. |
29 | - if ( isset( $_GET['payment_key'] ) ) { |
|
29 | + if (isset($_GET['payment_key'])) { |
|
30 | 30 | ob_start(); |
31 | - echo give_receipt_shortcode( array() ); |
|
32 | - echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">« ' . esc_html__( 'Return to All Donations', 'give' ) . '</a>'; |
|
31 | + echo give_receipt_shortcode(array()); |
|
32 | + echo '<a href="'.esc_url(give_get_history_page_uri()).'">« '.esc_html__('Return to All Donations', 'give').'</a>'; |
|
33 | 33 | |
34 | 34 | return ob_get_clean(); |
35 | 35 | } |
36 | 36 | |
37 | - $email_access = give_get_option( 'email_access' ); |
|
37 | + $email_access = give_get_option('email_access'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Determine access |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | */ |
45 | 45 | if ( |
46 | 46 | is_user_logged_in() || false !== Give()->session->get_session_expiration() |
47 | - || ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) |
|
47 | + || (give_is_setting_enabled($email_access) && Give()->email_access->token_exists) |
|
48 | 48 | ) { |
49 | 49 | ob_start(); |
50 | - give_get_template_part( 'history', 'donations' ); |
|
50 | + give_get_template_part('history', 'donations'); |
|
51 | 51 | |
52 | 52 | return ob_get_clean(); |
53 | 53 | |
54 | - } elseif ( give_is_setting_enabled( $email_access ) ) { |
|
54 | + } elseif (give_is_setting_enabled($email_access)) { |
|
55 | 55 | //Is Email-based access enabled? |
56 | 56 | ob_start(); |
57 | - give_get_template_part( 'email', 'login-form' ); |
|
57 | + give_get_template_part('email', 'login-form'); |
|
58 | 58 | |
59 | 59 | return ob_get_clean(); |
60 | 60 | } else { |
61 | 61 | |
62 | - echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) ); |
|
63 | - echo do_shortcode( '[give_login]' ); |
|
62 | + echo apply_filters('give_donation_history_nonuser_message', give_output_error(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false)); |
|
63 | + echo do_shortcode('[give_login]'); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
68 | +add_shortcode('donation_history', 'give_donation_history'); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Donation Form Shortcode |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string |
80 | 80 | */ |
81 | -function give_form_shortcode( $atts ) { |
|
82 | - $atts = shortcode_atts( array( |
|
81 | +function give_form_shortcode($atts) { |
|
82 | + $atts = shortcode_atts(array( |
|
83 | 83 | 'id' => '', |
84 | 84 | 'show_title' => true, |
85 | 85 | 'show_goal' => true, |
@@ -87,21 +87,21 @@ discard block |
||
87 | 87 | 'float_labels' => '', |
88 | 88 | 'display_style' => '', |
89 | 89 | 'continue_button_title' => '', |
90 | - ), $atts, 'give_form' ); |
|
90 | + ), $atts, 'give_form'); |
|
91 | 91 | |
92 | 92 | // Convert string to bool. |
93 | - $atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN ); |
|
94 | - $atts['show_goal'] = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN ); |
|
93 | + $atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN); |
|
94 | + $atts['show_goal'] = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN); |
|
95 | 95 | |
96 | 96 | //get the Give Form |
97 | 97 | ob_start(); |
98 | - give_get_donation_form( $atts ); |
|
98 | + give_get_donation_form($atts); |
|
99 | 99 | $final_output = ob_get_clean(); |
100 | 100 | |
101 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
101 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
102 | 102 | } |
103 | 103 | |
104 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
104 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Donation Form Goal Shortcode. |
@@ -114,37 +114,37 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string |
116 | 116 | */ |
117 | -function give_goal_shortcode( $atts ) { |
|
118 | - $atts = shortcode_atts( array( |
|
117 | +function give_goal_shortcode($atts) { |
|
118 | + $atts = shortcode_atts(array( |
|
119 | 119 | 'id' => '', |
120 | 120 | 'show_text' => true, |
121 | 121 | 'show_bar' => true, |
122 | - ), $atts, 'give_goal' ); |
|
122 | + ), $atts, 'give_goal'); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | //get the Give Form. |
126 | 126 | ob_start(); |
127 | 127 | |
128 | 128 | //Sanity check 1: ensure there is an ID Provided. |
129 | - if ( empty( $atts['id'] ) ) { |
|
130 | - give_output_error( esc_html__( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
129 | + if (empty($atts['id'])) { |
|
130 | + give_output_error(esc_html__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | //Sanity check 2: Check the form even has Goals enabled. |
134 | - if ( ! give_is_setting_enabled( get_post_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
134 | + if ( ! give_is_setting_enabled(get_post_meta($atts['id'], '_give_goal_option', true))) { |
|
135 | 135 | |
136 | - give_output_error( esc_html__( 'The form does not have Goals enabled.', 'give' ), true ); |
|
136 | + give_output_error(esc_html__('The form does not have Goals enabled.', 'give'), true); |
|
137 | 137 | } else { |
138 | 138 | //Passed all sanity checks: output Goal. |
139 | - give_show_goal_progress( $atts['id'], $atts ); |
|
139 | + give_show_goal_progress($atts['id'], $atts); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $final_output = ob_get_clean(); |
143 | 143 | |
144 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
144 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
145 | 145 | } |
146 | 146 | |
147 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
147 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
148 | 148 | |
149 | 149 | |
150 | 150 | /** |
@@ -161,22 +161,22 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return string |
163 | 163 | */ |
164 | -function give_login_form_shortcode( $atts ) { |
|
165 | - $atts = shortcode_atts( array( |
|
164 | +function give_login_form_shortcode($atts) { |
|
165 | + $atts = shortcode_atts(array( |
|
166 | 166 | // Add backward compatibility for redirect attribute. |
167 | 167 | 'redirect' => '', |
168 | 168 | |
169 | 169 | 'login-redirect' => '', |
170 | 170 | 'logout-redirect' => '', |
171 | - ), $atts, 'give_login' ); |
|
171 | + ), $atts, 'give_login'); |
|
172 | 172 | |
173 | 173 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
174 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
174 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
175 | 175 | |
176 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
176 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
177 | 177 | } |
178 | 178 | |
179 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
179 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Register Shortcode. |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @return string |
193 | 193 | */ |
194 | -function give_register_form_shortcode( $atts ) { |
|
195 | - $atts = shortcode_atts( array( |
|
194 | +function give_register_form_shortcode($atts) { |
|
195 | + $atts = shortcode_atts(array( |
|
196 | 196 | 'redirect' => '', |
197 | - ), $atts, 'give_register' ); |
|
197 | + ), $atts, 'give_register'); |
|
198 | 198 | |
199 | - return give_register_form( $atts['redirect'] ); |
|
199 | + return give_register_form($atts['redirect']); |
|
200 | 200 | } |
201 | 201 | |
202 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
202 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Receipt Shortcode. |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return string |
214 | 214 | */ |
215 | -function give_receipt_shortcode( $atts ) { |
|
215 | +function give_receipt_shortcode($atts) { |
|
216 | 216 | |
217 | 217 | global $give_receipt_args, $payment; |
218 | 218 | |
219 | - $give_receipt_args = shortcode_atts( array( |
|
220 | - 'error' => esc_html__( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
219 | + $give_receipt_args = shortcode_atts(array( |
|
220 | + 'error' => esc_html__('You are missing the payment key to view this donation receipt.', 'give'), |
|
221 | 221 | 'price' => true, |
222 | 222 | 'donor' => true, |
223 | 223 | 'date' => true, |
@@ -226,50 +226,50 @@ discard block |
||
226 | 226 | 'payment_id' => true, |
227 | 227 | 'payment_status' => false, |
228 | 228 | 'status_notice' => true, |
229 | - ), $atts, 'give_receipt' ); |
|
229 | + ), $atts, 'give_receipt'); |
|
230 | 230 | |
231 | 231 | //set $session var |
232 | 232 | $session = give_get_purchase_session(); |
233 | 233 | |
234 | 234 | //set payment key var |
235 | - if ( isset( $_GET['payment_key'] ) ) { |
|
236 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
237 | - } elseif ( $session ) { |
|
235 | + if (isset($_GET['payment_key'])) { |
|
236 | + $payment_key = urldecode($_GET['payment_key']); |
|
237 | + } elseif ($session) { |
|
238 | 238 | $payment_key = $session['purchase_key']; |
239 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
239 | + } elseif ($give_receipt_args['payment_key']) { |
|
240 | 240 | $payment_key = $give_receipt_args['payment_key']; |
241 | 241 | } |
242 | 242 | |
243 | - $email_access = give_get_option( 'email_access' ); |
|
243 | + $email_access = give_get_option('email_access'); |
|
244 | 244 | |
245 | 245 | // No payment_key found & Email Access is Turned on: |
246 | - if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
246 | + if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
247 | 247 | |
248 | 248 | ob_start(); |
249 | 249 | |
250 | - give_get_template_part( 'email-login-form' ); |
|
250 | + give_get_template_part('email-login-form'); |
|
251 | 251 | |
252 | 252 | return ob_get_clean(); |
253 | 253 | |
254 | - } elseif ( ! isset( $payment_key ) ) { |
|
254 | + } elseif ( ! isset($payment_key)) { |
|
255 | 255 | |
256 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
256 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
261 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
260 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
261 | + $user_can_view = give_can_view_receipt($payment_key); |
|
262 | 262 | |
263 | 263 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
264 | - if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
264 | + if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
265 | 265 | |
266 | 266 | ob_start(); |
267 | 267 | |
268 | - give_get_template_part( 'email-login-form' ); |
|
268 | + give_get_template_part('email-login-form'); |
|
269 | 269 | |
270 | 270 | return ob_get_clean(); |
271 | 271 | |
272 | - } elseif ( ! $user_can_view ) { |
|
272 | + } elseif ( ! $user_can_view) { |
|
273 | 273 | |
274 | 274 | global $give_login_redirect; |
275 | 275 | |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | |
278 | 278 | ob_start(); |
279 | 279 | |
280 | - give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
280 | + give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation receipt.', 'give'))); |
|
281 | 281 | |
282 | - give_get_template_part( 'shortcode', 'login' ); |
|
282 | + give_get_template_part('shortcode', 'login'); |
|
283 | 283 | |
284 | 284 | $login_form = ob_get_clean(); |
285 | 285 | |
@@ -294,20 +294,20 @@ discard block |
||
294 | 294 | * or if user is logged in and the user can view sensitive shop data. |
295 | 295 | * |
296 | 296 | */ |
297 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
298 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
297 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
298 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | ob_start(); |
302 | 302 | |
303 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
303 | + give_get_template_part('shortcode', 'receipt'); |
|
304 | 304 | |
305 | 305 | $display = ob_get_clean(); |
306 | 306 | |
307 | 307 | return $display; |
308 | 308 | } |
309 | 309 | |
310 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
310 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
311 | 311 | |
312 | 312 | /** |
313 | 313 | * Profile Editor Shortcode. |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return string Output generated from the profile editor |
328 | 328 | */ |
329 | -function give_profile_editor_shortcode( $atts ) { |
|
329 | +function give_profile_editor_shortcode($atts) { |
|
330 | 330 | |
331 | 331 | ob_start(); |
332 | 332 | |
333 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
333 | + give_get_template_part('shortcode', 'profile-editor'); |
|
334 | 334 | |
335 | 335 | $display = ob_get_clean(); |
336 | 336 | |
337 | 337 | return $display; |
338 | 338 | } |
339 | 339 | |
340 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
340 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Process Profile Updater Form. |
@@ -350,30 +350,30 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return bool |
352 | 352 | */ |
353 | -function give_process_profile_editor_updates( $data ) { |
|
353 | +function give_process_profile_editor_updates($data) { |
|
354 | 354 | // Profile field change request |
355 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
355 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
356 | 356 | return false; |
357 | 357 | } |
358 | 358 | |
359 | 359 | // Nonce security |
360 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
360 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
364 | 364 | $user_id = get_current_user_id(); |
365 | - $old_user_data = get_userdata( $user_id ); |
|
366 | - |
|
367 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
368 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
369 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
370 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
371 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
372 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
373 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
374 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
375 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
376 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
365 | + $old_user_data = get_userdata($user_id); |
|
366 | + |
|
367 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
368 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
369 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
370 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
371 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
372 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
373 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
374 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
375 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
376 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
377 | 377 | |
378 | 378 | $userdata = array( |
379 | 379 | 'ID' => $user_id, |
@@ -401,46 +401,46 @@ discard block |
||
401 | 401 | * @param int $user_id The ID of the user. |
402 | 402 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
403 | 403 | */ |
404 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
404 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
405 | 405 | |
406 | 406 | // New password |
407 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
408 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
409 | - give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
407 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
408 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
409 | + give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give')); |
|
410 | 410 | } else { |
411 | 411 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | - if ( empty( $email ) ) { |
|
415 | + if (empty($email)) { |
|
416 | 416 | // Make sure email should not be empty. |
417 | - give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) ); |
|
417 | + give_set_error('email_empty', esc_html__('The email you entered is empty.', 'give')); |
|
418 | 418 | |
419 | - } else if ( ! is_email( $email ) ) { |
|
419 | + } else if ( ! is_email($email)) { |
|
420 | 420 | // Make sure email should be valid. |
421 | - give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
421 | + give_set_error('email_not_valid', esc_html__('The email you entered is not valid. Please use another', 'give')); |
|
422 | 422 | |
423 | - } else if ( $email != $old_user_data->user_email ) { |
|
423 | + } else if ($email != $old_user_data->user_email) { |
|
424 | 424 | // Make sure the new email doesn't belong to another user |
425 | - if ( email_exists( $email ) ) { |
|
426 | - give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
425 | + if (email_exists($email)) { |
|
426 | + give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give')); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | 430 | // Check for errors |
431 | 431 | $errors = give_get_errors(); |
432 | 432 | |
433 | - if ( $errors ) { |
|
433 | + if ($errors) { |
|
434 | 434 | // Send back to the profile editor if there are errors |
435 | - wp_redirect( $data['give_redirect'] ); |
|
435 | + wp_redirect($data['give_redirect']); |
|
436 | 436 | give_die(); |
437 | 437 | } |
438 | 438 | |
439 | 439 | // Update the user |
440 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
441 | - $updated = wp_update_user( $userdata ); |
|
440 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
441 | + $updated = wp_update_user($userdata); |
|
442 | 442 | |
443 | - if ( $updated ) { |
|
443 | + if ($updated) { |
|
444 | 444 | |
445 | 445 | /** |
446 | 446 | * Fires after updating user profile. |
@@ -450,12 +450,12 @@ discard block |
||
450 | 450 | * @param int $user_id The ID of the user. |
451 | 451 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
452 | 452 | */ |
453 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
454 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
453 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
454 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
455 | 455 | give_die(); |
456 | 456 | } |
457 | 457 | |
458 | 458 | return false; |
459 | 459 | } |
460 | 460 | |
461 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
461 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
39 | - 'currency_sign' => give_currency_filter( '' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | + 'currency_sign' => give_currency_filter(''), |
|
40 | 40 | 'currency_pos' => give_get_currency_position(), |
41 | 41 | 'thousands_separator' => give_get_price_thousand_separator(), |
42 | 42 | 'decimal_separator' => give_get_price_decimal_separator(), |
43 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
44 | - 'bad_minimum' => __( 'The minimum donation amount for this form is', 'give' ), |
|
45 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
46 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
43 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
44 | + 'bad_minimum' => __('The minimum donation amount for this form is', 'give'), |
|
45 | + 'general_loading' => __('Loading...', 'give'), |
|
46 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
47 | 47 | 'number_decimals' => give_get_price_decimals(), |
48 | 48 | 'give_version' => GIVE_VERSION, |
49 | 49 | 'magnific_options' => apply_filters( |
@@ -57,81 +57,81 @@ discard block |
||
57 | 57 | 'give_form_translation_js', |
58 | 58 | array( |
59 | 59 | // Field name Validation message. |
60 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
61 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
62 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
63 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
64 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
65 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
66 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
60 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
61 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
62 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
63 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
64 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
65 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
66 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
67 | 67 | ) |
68 | 68 | ), |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
71 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
72 | 72 | 'ajaxurl' => give_get_ajax_url(), |
73 | - 'loading' => __( 'Loading', 'give' ), |
|
73 | + 'loading' => __('Loading', 'give'), |
|
74 | 74 | // General loading message. |
75 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
75 | + 'select_option' => __('Please select an option', 'give'), |
|
76 | 76 | // Variable pricing error with multi-donation option enabled. |
77 | - 'default_gateway' => give_get_default_gateway( null ), |
|
78 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
77 | + 'default_gateway' => give_get_default_gateway(null), |
|
78 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
79 | 79 | 'number_decimals' => give_get_price_decimals(), |
80 | - ) ); |
|
80 | + )); |
|
81 | 81 | |
82 | 82 | // DEBUG is On. |
83 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
83 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
84 | 84 | |
85 | - if ( give_is_cc_verify_enabled() ) { |
|
86 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
87 | - wp_enqueue_script( 'give-cc-validator' ); |
|
85 | + if (give_is_cc_verify_enabled()) { |
|
86 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
87 | + wp_enqueue_script('give-cc-validator'); |
|
88 | 88 | } |
89 | 89 | |
90 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
91 | - wp_enqueue_script( 'give-float-labels' ); |
|
90 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
91 | + wp_enqueue_script('give-float-labels'); |
|
92 | 92 | |
93 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-blockui' ); |
|
93 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-blockui'); |
|
95 | 95 | |
96 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
97 | - wp_enqueue_script( 'give-qtip' ); |
|
96 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
97 | + wp_enqueue_script('give-qtip'); |
|
98 | 98 | |
99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
100 | - wp_enqueue_script( 'give-accounting' ); |
|
99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
100 | + wp_enqueue_script('give-accounting'); |
|
101 | 101 | |
102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
103 | - wp_enqueue_script( 'give-magnific' ); |
|
102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
103 | + wp_enqueue_script('give-magnific'); |
|
104 | 104 | |
105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
105 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
106 | + wp_enqueue_script('give-checkout-global'); |
|
107 | 107 | |
108 | 108 | // General scripts. |
109 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
110 | - wp_enqueue_script( 'give-scripts' ); |
|
109 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
110 | + wp_enqueue_script('give-scripts'); |
|
111 | 111 | |
112 | 112 | // Load AJAX scripts, if enabled. |
113 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
114 | - wp_enqueue_script( 'give-ajax' ); |
|
113 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
114 | + wp_enqueue_script('give-ajax'); |
|
115 | 115 | |
116 | 116 | // Localize / Pass AJAX vars from PHP, |
117 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
118 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
117 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
118 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
119 | 119 | |
120 | 120 | } else { |
121 | 121 | |
122 | 122 | // DEBUG is OFF (one JS file to rule them all!). |
123 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
124 | - wp_enqueue_script( 'give' ); |
|
123 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
124 | + wp_enqueue_script('give'); |
|
125 | 125 | |
126 | 126 | // Localize / Pass AJAX vars from PHP. |
127 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
128 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
127 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
128 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
129 | 129 | |
130 | 130 | } |
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
134 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Register styles. |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | */ |
145 | 145 | function give_register_styles() { |
146 | 146 | |
147 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
147 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
151 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
152 | - wp_enqueue_style( 'give-styles' ); |
|
151 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
152 | + wp_enqueue_style('give-styles'); |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
156 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | /** |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | function give_get_stylesheet_uri() { |
167 | 167 | |
168 | 168 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
169 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
169 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
170 | 170 | |
171 | 171 | // LTR or RTL files. |
172 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
172 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
173 | 173 | |
174 | - $file = 'give' . $direction . $suffix . '.css'; |
|
174 | + $file = 'give'.$direction.$suffix.'.css'; |
|
175 | 175 | $templates_dir = give_get_theme_template_dir_name(); |
176 | 176 | |
177 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
178 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
179 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
180 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
181 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
177 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
178 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
179 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
180 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
181 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
182 | 182 | |
183 | 183 | $uri = false; |
184 | 184 | |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
189 | 189 | * This allows users to copy just give.css to their theme. |
190 | 190 | */ |
191 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
192 | - if ( ! empty( $nonmin ) ) { |
|
193 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
191 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
192 | + if ( ! empty($nonmin)) { |
|
193 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
194 | 194 | } else { |
195 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
195 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
196 | 196 | } |
197 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
198 | - if ( ! empty( $nonmin ) ) { |
|
199 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
197 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
198 | + if ( ! empty($nonmin)) { |
|
199 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
200 | 200 | } else { |
201 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
201 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
202 | 202 | } |
203 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
204 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
203 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
204 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
205 | 205 | } |
206 | 206 | |
207 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
207 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,76 +221,76 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | -function give_load_admin_scripts( $hook ) { |
|
224 | +function give_load_admin_scripts($hook) { |
|
225 | 225 | |
226 | 226 | global $post, $post_type; |
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // Directories of assets. |
231 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
232 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
233 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
231 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
232 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
233 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
234 | 234 | |
235 | 235 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
236 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
236 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
237 | 237 | |
238 | 238 | // LTR or RTL files. |
239 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
239 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
240 | 240 | |
241 | 241 | // Global Admin. |
242 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
243 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
242 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
243 | + wp_enqueue_style('give-admin-bar-notification'); |
|
244 | 244 | |
245 | 245 | // Give Admin Only. |
246 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
246 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | |
250 | 250 | // CSS. |
251 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
252 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
253 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
254 | - wp_enqueue_style( 'give-admin' ); |
|
255 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
256 | - wp_enqueue_style( 'jquery-chosen' ); |
|
257 | - wp_enqueue_style( 'thickbox' ); |
|
258 | - wp_enqueue_style( 'wp-color-picker' ); |
|
251 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
252 | + wp_enqueue_style('jquery-ui-css'); |
|
253 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
254 | + wp_enqueue_style('give-admin'); |
|
255 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
256 | + wp_enqueue_style('jquery-chosen'); |
|
257 | + wp_enqueue_style('thickbox'); |
|
258 | + wp_enqueue_style('wp-color-picker'); |
|
259 | 259 | |
260 | 260 | |
261 | 261 | // JS. |
262 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
263 | - wp_enqueue_script( 'jquery-chosen' ); |
|
262 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
263 | + wp_enqueue_script('jquery-chosen'); |
|
264 | 264 | |
265 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
266 | - wp_enqueue_script( 'give-accounting' ); |
|
265 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
266 | + wp_enqueue_script('give-accounting'); |
|
267 | 267 | |
268 | - wp_enqueue_script( 'wp-color-picker' ); |
|
269 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
270 | - wp_enqueue_script( 'thickbox' ); |
|
268 | + wp_enqueue_script('wp-color-picker'); |
|
269 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
270 | + wp_enqueue_script('thickbox'); |
|
271 | 271 | |
272 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker' ), GIVE_VERSION, false ); |
|
273 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
272 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker'), GIVE_VERSION, false); |
|
273 | + wp_enqueue_script('give-admin-scripts'); |
|
274 | 274 | |
275 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
276 | - wp_enqueue_script( 'jquery-flot' ); |
|
275 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
276 | + wp_enqueue_script('jquery-flot'); |
|
277 | 277 | |
278 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
279 | - wp_enqueue_script( 'give-qtip' ); |
|
278 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
279 | + wp_enqueue_script('give-qtip'); |
|
280 | 280 | |
281 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
282 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
281 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
282 | + wp_enqueue_script('give-repeatable-fields'); |
|
283 | 283 | |
284 | 284 | // Forms CPT Script. |
285 | - if ( $post_type === 'give_forms' ) { |
|
286 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
287 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
285 | + if ($post_type === 'give_forms') { |
|
286 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
287 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Settings Scripts. |
291 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
292 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
293 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
291 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
292 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
293 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | // Price Separators. |
@@ -298,59 +298,59 @@ discard block |
||
298 | 298 | $decimal_separator = give_get_price_decimal_separator(); |
299 | 299 | |
300 | 300 | // Localize strings & variables for JS. |
301 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
302 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
301 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
302 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
303 | 303 | 'give_version' => GIVE_VERSION, |
304 | 304 | 'thousands_separator' => $thousand_separator, |
305 | 305 | 'decimal_separator' => $decimal_separator, |
306 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
307 | - 'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'give' ), |
|
308 | - 'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'give' ), |
|
309 | - 'revoke_api_key' => __( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
310 | - 'regenerate_api_key' => __( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
311 | - 'resend_receipt' => __( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
312 | - 'logo' => __( 'Logo', 'give' ), |
|
313 | - 'use_this_image' => __( 'Use this image', 'give' ), |
|
314 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
315 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
316 | - 'currency_sign' => give_currency_filter( '' ), |
|
317 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
318 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
319 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
320 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
321 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
322 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
306 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
307 | + 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), |
|
308 | + 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), |
|
309 | + 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), |
|
310 | + 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), |
|
311 | + 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), |
|
312 | + 'logo' => __('Logo', 'give'), |
|
313 | + 'use_this_image' => __('Use this image', 'give'), |
|
314 | + 'one_option' => __('Choose a form', 'give'), |
|
315 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
316 | + 'currency_sign' => give_currency_filter(''), |
|
317 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
318 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
319 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
320 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
321 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
322 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
323 | 323 | /* translators : %s: Donation form options metabox */ |
324 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
325 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
326 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
324 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
325 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
326 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
327 | 327 | 'bulk_action' => array( |
328 | 328 | 'delete' => array( |
329 | - 'zero_payment_selected' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
330 | - 'delete_payment' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
331 | - 'delete_payments' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
329 | + 'zero_payment_selected' => __('You must choose at least one or more payments to delete.', 'give'), |
|
330 | + 'delete_payment' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
331 | + 'delete_payments' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
332 | 332 | ), |
333 | 333 | 'resend_receipt' => array( |
334 | - 'zero_recipient_selected' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
335 | - 'resend_receipt' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
336 | - 'resend_receipts' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
334 | + 'zero_recipient_selected' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
335 | + 'resend_receipt' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
336 | + 'resend_receipts' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
337 | 337 | ), |
338 | 338 | ), |
339 | 339 | 'metabox_fields' => array( |
340 | 340 | 'media' => array( |
341 | - 'button_title' => esc_html__( 'Choose Attachment', 'give' ), |
|
341 | + 'button_title' => esc_html__('Choose Attachment', 'give'), |
|
342 | 342 | ) |
343 | 343 | ) |
344 | - ) ); |
|
344 | + )); |
|
345 | 345 | |
346 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
346 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
347 | 347 | // call for new media manager. |
348 | 348 | wp_enqueue_media(); |
349 | 349 | } |
350 | 350 | |
351 | 351 | } |
352 | 352 | |
353 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
353 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
354 | 354 | |
355 | 355 | /** |
356 | 356 | * Admin Give Icon |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | ?> |
366 | 366 | <style type="text/css" media="screen"> |
367 | 367 | |
368 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
368 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
369 | 369 | @font-face { |
370 | 370 | font-family: 'give-icomoon'; |
371 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
372 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
373 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
374 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
371 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
372 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
373 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
374 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
375 | 375 | font-weight: normal; |
376 | 376 | font-style: normal; |
377 | 377 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | <?php |
391 | 391 | } |
392 | 392 | |
393 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
393 | +add_action('admin_head', 'give_admin_icon'); |
|
394 | 394 | |
395 | 395 | /** |
396 | 396 | * Admin js code |
@@ -420,4 +420,4 @@ discard block |
||
420 | 420 | <?php |
421 | 421 | } |
422 | 422 | |
423 | -add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' ); |
|
423 | +add_action('admin_head', 'give_admin_hide_notice_shortly_js'); |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $customer_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $currency_code = $payment->currency; |
46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: donation number */ |
55 | - esc_html__( 'Donation %s', 'give' ), |
|
55 | + esc_html__('Donation %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param int $payment_id Payment id. |
70 | 70 | */ |
71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
71 | + do_action('give_view_order_details_before', $payment_id); |
|
72 | 72 | ?> |
73 | 73 | <form id="give-edit-order-form" method="post"> |
74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param int $payment_id Payment id. |
81 | 81 | */ |
82 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
82 | + do_action('give_view_order_details_form_top', $payment_id); |
|
83 | 83 | ?> |
84 | 84 | <div id="poststuff"> |
85 | 85 | <div id="give-dashboard-widgets-wrap"> |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param int $payment_id Payment id. |
97 | 97 | */ |
98 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
98 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
99 | 99 | ?> |
100 | 100 | |
101 | 101 | <div id="give-order-update" class="postbox give-order-data"> |
102 | 102 | |
103 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
103 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
104 | 104 | |
105 | 105 | <div class="inside"> |
106 | 106 | <div class="give-admin-box"> |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param int $payment_id Payment id. |
115 | 115 | */ |
116 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
116 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
117 | 117 | ?> |
118 | 118 | |
119 | 119 | <div class="give-admin-box-inside"> |
120 | 120 | <p> |
121 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
121 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
122 | 122 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
123 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
124 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
123 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
124 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
125 | 125 | <?php endforeach; ?> |
126 | 126 | </select> |
127 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
127 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
128 | 128 | </p> |
129 | 129 | </div> |
130 | 130 | |
131 | 131 | <div class="give-admin-box-inside"> |
132 | 132 | <p> |
133 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
134 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
133 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
134 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | |
138 | 138 | <div class="give-admin-box-inside"> |
139 | 139 | <p> |
140 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
141 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
142 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
140 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
141 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
142 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
143 | 143 | </p> |
144 | 144 | </div> |
145 | 145 | |
@@ -153,18 +153,18 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param int $payment_id Payment id. |
155 | 155 | */ |
156 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
156 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
157 | 157 | |
158 | 158 | // @TODO: Fees |
159 | - $fees = give_get_payment_fees( $payment_id ); |
|
160 | - if ( ! empty( $fees ) ) : ?> |
|
159 | + $fees = give_get_payment_fees($payment_id); |
|
160 | + if ( ! empty($fees)) : ?> |
|
161 | 161 | <div class="give-order-fees give-admin-box-inside"> |
162 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
162 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
163 | 163 | <ul class="give-payment-fees"> |
164 | - <?php foreach ( $fees as $fee ) : ?> |
|
164 | + <?php foreach ($fees as $fee) : ?> |
|
165 | 165 | <li> |
166 | 166 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
167 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
167 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
168 | 168 | </li> |
169 | 169 | <?php endforeach; ?> |
170 | 170 | </ul> |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | |
174 | 174 | <div class="give-order-payment give-admin-box-inside"> |
175 | 175 | <p> |
176 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
177 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
178 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
176 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
177 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
178 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
179 | 179 | </p> |
180 | 180 | </div> |
181 | 181 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @param int $payment_id Payment id. |
189 | 189 | */ |
190 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
190 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
191 | 191 | ?> |
192 | 192 | |
193 | 193 | </div> |
@@ -205,17 +205,17 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @param int $payment_id Payment id. |
207 | 207 | */ |
208 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
208 | + do_action('give_view_order_details_update_before', $payment_id); |
|
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <div id="major-publishing-actions"> |
212 | 212 | <div id="publishing-action"> |
213 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
214 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
215 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
213 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
214 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
215 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
216 | 216 | 'give-action' => 'email_links', |
217 | 217 | 'purchase_id' => $payment_id, |
218 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
218 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
219 | 219 | <?php endif; ?> |
220 | 220 | </div> |
221 | 221 | <div class="clear"></div> |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @param int $payment_id Payment id. |
231 | 231 | */ |
232 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
232 | + do_action('give_view_order_details_update_after', $payment_id); |
|
233 | 233 | ?> |
234 | 234 | |
235 | 235 | </div> |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | <div id="give-order-details" class="postbox give-order-data"> |
242 | 242 | |
243 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
243 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
244 | 244 | |
245 | 245 | <div class="inside"> |
246 | 246 | <div class="give-admin-box"> |
@@ -253,44 +253,44 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param int $payment_id Payment id. |
255 | 255 | */ |
256 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
256 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
257 | 257 | |
258 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
259 | - if ( $gateway ) : ?> |
|
258 | + $gateway = give_get_payment_gateway($payment_id); |
|
259 | + if ($gateway) : ?> |
|
260 | 260 | <div class="give-order-gateway give-admin-box-inside"> |
261 | 261 | <p> |
262 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
263 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
262 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
263 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
264 | 264 | </p> |
265 | 265 | </div> |
266 | 266 | <?php endif; ?> |
267 | 267 | |
268 | 268 | <div class="give-order-payment-key give-admin-box-inside"> |
269 | 269 | <p> |
270 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
271 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
270 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
271 | + <?php echo give_get_payment_key($payment_id); ?> |
|
272 | 272 | </p> |
273 | 273 | </div> |
274 | 274 | |
275 | 275 | <div class="give-order-ip give-admin-box-inside"> |
276 | 276 | <p> |
277 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
278 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
277 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
278 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
279 | 279 | </p> |
280 | 280 | </div> |
281 | 281 | |
282 | - <?php if ( $transaction_id ) : ?> |
|
282 | + <?php if ($transaction_id) : ?> |
|
283 | 283 | <div class="give-order-tx-id give-admin-box-inside"> |
284 | 284 | <p> |
285 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
286 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
285 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
286 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
287 | 287 | </p> |
288 | 288 | </div> |
289 | 289 | <?php endif; ?> |
290 | 290 | |
291 | 291 | <div class="give-admin-box-inside"> |
292 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
293 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
292 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
293 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
294 | 294 | </p> |
295 | 295 | </div> |
296 | 296 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param int $payment_id Payment id. |
304 | 304 | */ |
305 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
305 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
306 | 306 | ?> |
307 | 307 | |
308 | 308 | </div> |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @param int $payment_id Payment id. |
324 | 324 | */ |
325 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
325 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
326 | 326 | ?> |
327 | 327 | |
328 | 328 | </div> |
@@ -342,55 +342,55 @@ discard block |
||
342 | 342 | * |
343 | 343 | * @param int $payment_id Payment id. |
344 | 344 | */ |
345 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
345 | + do_action('give_view_order_details_main_before', $payment_id); |
|
346 | 346 | ?> |
347 | 347 | |
348 | 348 | <?php $column_count = 'columns-3'; ?> |
349 | 349 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
350 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
350 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
351 | 351 | |
352 | 352 | <div class="inside"> |
353 | 353 | |
354 | 354 | <div class="column-container"> |
355 | 355 | <div class="column"> |
356 | 356 | <p> |
357 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
357 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
358 | 358 | <?php |
359 | - if ( $payment_meta['form_id'] ) : |
|
359 | + if ($payment_meta['form_id']) : |
|
360 | 360 | printf( |
361 | 361 | '<a href="%1$s" target="_blank">#%2$s</a>', |
362 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
362 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
363 | 363 | $payment_meta['form_id'] |
364 | 364 | ); |
365 | 365 | endif; |
366 | 366 | ?> |
367 | 367 | </p> |
368 | 368 | <p> |
369 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
370 | - <?php give_get_form_dropdown( array( |
|
369 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
370 | + <?php give_get_form_dropdown(array( |
|
371 | 371 | 'id' => $payment_meta['form_id'], |
372 | 372 | 'selected' => $payment_meta['form_id'], |
373 | 373 | 'chosen' => true, |
374 | - ), true ); ?> |
|
374 | + ), true); ?> |
|
375 | 375 | </p> |
376 | 376 | </div> |
377 | 377 | <div class="column"> |
378 | 378 | <p> |
379 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
380 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
379 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
380 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
381 | 381 | </p> |
382 | 382 | <p> |
383 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
383 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
384 | 384 | <span class="give-donation-level"> |
385 | 385 | <?php |
386 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
387 | - if ( empty( $var_prices ) ) { |
|
388 | - esc_html_e( 'n/a', 'give' ); |
|
386 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
387 | + if (empty($var_prices)) { |
|
388 | + esc_html_e('n/a', 'give'); |
|
389 | 389 | } else { |
390 | 390 | $prices_atts = ''; |
391 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
392 | - foreach ( $variable_prices as $variable_price ) { |
|
393 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
391 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
392 | + foreach ($variable_prices as $variable_price) { |
|
393 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | // Variable price dropdown options. |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | 'chosen' => true, |
401 | 401 | 'show_option_all' => '', |
402 | 402 | 'show_option_none' => '', |
403 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
403 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
404 | 404 | 'selected' => $payment_meta['price_id'], |
405 | 405 | ); |
406 | 406 | // Render variable prices select tag html. |
407 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
407 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
408 | 408 | } |
409 | 409 | ?> |
410 | 410 | </span> |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | </div> |
413 | 413 | <div class="column"> |
414 | 414 | <p> |
415 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
416 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?> |
|
415 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
416 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?> |
|
417 | 417 | </p> |
418 | 418 | <p> |
419 | 419 | <?php |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * |
427 | 427 | * @param int $payment_id Payment id. |
428 | 428 | */ |
429 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
429 | + do_action('give_donation_details_thead_before', $payment_id); |
|
430 | 430 | |
431 | 431 | |
432 | 432 | /** |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @param int $payment_id Payment id. |
440 | 440 | */ |
441 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
441 | + do_action('give_donation_details_thead_after', $payment_id); |
|
442 | 442 | |
443 | 443 | /** |
444 | 444 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @param int $payment_id Payment id. |
451 | 451 | */ |
452 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
452 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
453 | 453 | |
454 | 454 | /** |
455 | 455 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @param int $payment_id Payment id. |
462 | 462 | */ |
463 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
463 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
464 | 464 | ?> |
465 | 465 | </p> |
466 | 466 | </div> |
@@ -480,57 +480,57 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param int $payment_id Payment id. |
482 | 482 | */ |
483 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
483 | + do_action('give_view_order_details_files_after', $payment_id); |
|
484 | 484 | ?> |
485 | 485 | |
486 | 486 | <div id="give-donor-details" class="postbox"> |
487 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
487 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
488 | 488 | |
489 | 489 | <div class="inside"> |
490 | 490 | |
491 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
491 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
492 | 492 | |
493 | 493 | <div class="column-container customer-info"> |
494 | 494 | <div class="column"> |
495 | 495 | <p> |
496 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
496 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
497 | 497 | <?php |
498 | - if ( ! empty( $customer->id ) ) { |
|
498 | + if ( ! empty($customer->id)) { |
|
499 | 499 | printf( |
500 | 500 | '<a href="%1$s" target="_blank">#%2$s</a>', |
501 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ), |
|
501 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id), |
|
502 | 502 | $customer->id |
503 | 503 | ); |
504 | 504 | } |
505 | 505 | ?> |
506 | 506 | </p> |
507 | 507 | <p> |
508 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
509 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
508 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
509 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
510 | 510 | </p> |
511 | 511 | </div> |
512 | 512 | <div class="column"> |
513 | 513 | <p> |
514 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
514 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
515 | 515 | <?php echo $customer->name; ?> |
516 | 516 | </p> |
517 | 517 | <p> |
518 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
518 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
519 | 519 | <?php echo $customer->email; ?> |
520 | 520 | </p> |
521 | 521 | </div> |
522 | 522 | <div class="column"> |
523 | 523 | <p> |
524 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
524 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
525 | 525 | <?php |
526 | - echo Give()->html->donor_dropdown( array( |
|
526 | + echo Give()->html->donor_dropdown(array( |
|
527 | 527 | 'selected' => $customer->id, |
528 | 528 | 'name' => 'customer-id', |
529 | - ) ); |
|
529 | + )); |
|
530 | 530 | ?> |
531 | 531 | </p> |
532 | 532 | <p> |
533 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
533 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
534 | 534 | </p> |
535 | 535 | </div> |
536 | 536 | </div> |
@@ -538,13 +538,13 @@ discard block |
||
538 | 538 | <div class="column-container new-customer" style="display: none"> |
539 | 539 | <div class="column"> |
540 | 540 | <p> |
541 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
541 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
542 | 542 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
543 | 543 | </p> |
544 | 544 | </div> |
545 | 545 | <div class="column"> |
546 | 546 | <p> |
547 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
547 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
548 | 548 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
549 | 549 | </p> |
550 | 550 | </div> |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | <p> |
553 | 553 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
554 | 554 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
555 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
555 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
556 | 556 | <br> |
557 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
557 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
558 | 558 | </p> |
559 | 559 | </div> |
560 | 560 | </div> |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param array $payment_meta Payment meta. |
571 | 571 | * @param array $user_info User information. |
572 | 572 | */ |
573 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
573 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
574 | 574 | |
575 | 575 | /** |
576 | 576 | * Fires in order details page, in the donor-details metabox. |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * |
580 | 580 | * @param int $payment_id Payment id. |
581 | 581 | */ |
582 | - do_action( 'give_payment_view_details', $payment_id ); |
|
582 | + do_action('give_payment_view_details', $payment_id); |
|
583 | 583 | ?> |
584 | 584 | |
585 | 585 | </div> |
@@ -595,11 +595,11 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @param int $payment_id Payment id. |
597 | 597 | */ |
598 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
598 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
599 | 599 | ?> |
600 | 600 | |
601 | 601 | <div id="give-billing-details" class="postbox"> |
602 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
602 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
603 | 603 | |
604 | 604 | <div class="inside"> |
605 | 605 | |
@@ -609,57 +609,57 @@ discard block |
||
609 | 609 | <div class="data column-container"> |
610 | 610 | <div class="column"> |
611 | 611 | <div class="give-wrap-address-line1"> |
612 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
613 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
612 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
613 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
614 | 614 | </div> |
615 | 615 | <div class="give-wrap-address-line2"> |
616 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
617 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
616 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
617 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
618 | 618 | </div> |
619 | 619 | </div> |
620 | 620 | <div class="column"> |
621 | 621 | <div class="give-wrap-address-city"> |
622 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
623 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
622 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
623 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
624 | 624 | </div> |
625 | 625 | <div class="give-wrap-address-zip"> |
626 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
627 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
626 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
627 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
628 | 628 | |
629 | 629 | </div> |
630 | 630 | </div> |
631 | 631 | <div class="column"> |
632 | 632 | <div id="give-order-address-country-wrap"> |
633 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
633 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
634 | 634 | <?php |
635 | - echo Give()->html->select( array( |
|
635 | + echo Give()->html->select(array( |
|
636 | 636 | 'options' => give_get_country_list(), |
637 | 637 | 'name' => 'give-payment-address[0][country]', |
638 | 638 | 'selected' => $address['country'], |
639 | 639 | 'show_option_all' => false, |
640 | 640 | 'show_option_none' => false, |
641 | 641 | 'chosen' => true, |
642 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
643 | - ) ); |
|
642 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
643 | + )); |
|
644 | 644 | ?> |
645 | 645 | </div> |
646 | 646 | <div id="give-order-address-state-wrap"> |
647 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
647 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
648 | 648 | <?php |
649 | - $states = give_get_states( $address['country'] ); |
|
650 | - if ( ! empty( $states ) ) { |
|
651 | - echo Give()->html->select( array( |
|
649 | + $states = give_get_states($address['country']); |
|
650 | + if ( ! empty($states)) { |
|
651 | + echo Give()->html->select(array( |
|
652 | 652 | 'options' => $states, |
653 | 653 | 'name' => 'give-payment-address[0][state]', |
654 | 654 | 'selected' => $address['state'], |
655 | 655 | 'show_option_all' => false, |
656 | 656 | 'show_option_none' => false, |
657 | 657 | 'chosen' => true, |
658 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
659 | - ) ); |
|
658 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
659 | + )); |
|
660 | 660 | } else { |
661 | 661 | ?> |
662 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
662 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
663 | 663 | <?php |
664 | 664 | } ?> |
665 | 665 | </div> |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @param int $payment_id Payment id. |
681 | 681 | */ |
682 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
682 | + do_action('give_payment_billing_details', $payment_id); |
|
683 | 683 | ?> |
684 | 684 | |
685 | 685 | </div> |
@@ -695,32 +695,32 @@ discard block |
||
695 | 695 | * |
696 | 696 | * @param int $payment_id Payment id. |
697 | 697 | */ |
698 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
698 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
699 | 699 | ?> |
700 | 700 | |
701 | 701 | <div id="give-payment-notes" class="postbox"> |
702 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
702 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
703 | 703 | |
704 | 704 | <div class="inside"> |
705 | 705 | <div id="give-payment-notes-inner"> |
706 | 706 | <?php |
707 | - $notes = give_get_payment_notes( $payment_id ); |
|
708 | - if ( ! empty( $notes ) ) { |
|
707 | + $notes = give_get_payment_notes($payment_id); |
|
708 | + if ( ! empty($notes)) { |
|
709 | 709 | $no_notes_display = ' style="display:none;"'; |
710 | - foreach ( $notes as $note ) : |
|
710 | + foreach ($notes as $note) : |
|
711 | 711 | |
712 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
712 | + echo give_get_payment_note_html($note, $payment_id); |
|
713 | 713 | |
714 | 714 | endforeach; |
715 | 715 | } else { |
716 | 716 | $no_notes_display = ''; |
717 | 717 | } |
718 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
718 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
719 | 719 | </div> |
720 | 720 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
721 | 721 | |
722 | 722 | <div class="give-clearfix"> |
723 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
723 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
724 | 724 | </div> |
725 | 725 | |
726 | 726 | </div> |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @param int $payment_id Payment id. |
738 | 738 | */ |
739 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
739 | + do_action('give_view_order_details_main_after', $payment_id); |
|
740 | 740 | ?> |
741 | 741 | |
742 | 742 | </div> |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @param int $payment_id Payment id. |
760 | 760 | */ |
761 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
761 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
762 | 762 | |
763 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
763 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
764 | 764 | ?> |
765 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
765 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
766 | 766 | <input type="hidden" name="give_action" value="update_payment_details"/> |
767 | 767 | </form> |
768 | 768 | <?php |
@@ -773,6 +773,6 @@ discard block |
||
773 | 773 | * |
774 | 774 | * @param int $payment_id Payment id. |
775 | 775 | */ |
776 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
776 | + do_action('give_view_order_details_after', $payment_id); |
|
777 | 777 | ?> |
778 | 778 | </div><!-- /.wrap --> |
@@ -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,13 +100,13 @@ 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 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'donors' => esc_html__('Donors', 'give'), |
|
106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
107 | 107 | ); |
108 | 108 | |
109 | - $views = apply_filters( 'give_report_views', $views ); |
|
109 | + $views = apply_filters('give_report_views', $views); |
|
110 | 110 | |
111 | 111 | return $views; |
112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * @since 1.0 |
122 | 122 | * @return string $view Report View |
123 | 123 | */ |
124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
124 | +function give_get_reporting_view($default = 'earnings') { |
|
125 | 125 | |
126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
127 | 127 | $view = $default; |
128 | 128 | } else { |
129 | 129 | $view = $_GET['view']; |
130 | 130 | } |
131 | 131 | |
132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
132 | + return apply_filters('give_get_reporting_view', $view); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $current_view = 'earnings'; |
143 | 143 | $views = give_reports_default_views(); |
144 | 144 | |
145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
146 | 146 | $current_view = $_GET['tab']; |
147 | 147 | } |
148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( "give_reports_view_{$current_view}" ); |
|
154 | + do_action("give_reports_view_{$current_view}"); |
|
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function give_report_views() { |
166 | 166 | $views = give_reports_default_views(); |
167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
168 | 168 | /** |
169 | 169 | * Fires before the report page actions form. |
170 | 170 | * |
171 | 171 | * @since 1.0 |
172 | 172 | */ |
173 | - do_action( 'give_report_view_actions_before' ); |
|
173 | + do_action('give_report_view_actions_before'); |
|
174 | 174 | ?> |
175 | 175 | <form id="give-reports-filter" method="get"> |
176 | 176 | <select id="give-reports-view" name="view"> |
177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
180 | 180 | <?php endforeach; ?> |
181 | 181 | </select> |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_report_view_actions' ); |
|
191 | + do_action('give_report_view_actions'); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
197 | 197 | </form> |
198 | 198 | <?php |
199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @since 1.0 |
203 | 203 | */ |
204 | - do_action( 'give_report_view_actions_after' ); |
|
204 | + do_action('give_report_view_actions_after'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,18 +214,18 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function give_reports_forms_table() { |
216 | 216 | |
217 | - if ( isset( $_GET['form-id'] ) ) { |
|
217 | + if (isset($_GET['form-id'])) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
222 | 222 | |
223 | 223 | $give_table = new Give_Form_Reports_Table(); |
224 | 224 | $give_table->prepare_items(); |
225 | 225 | $give_table->display(); |
226 | 226 | } |
227 | 227 | |
228 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
228 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Renders the detailed report for a specific give form |
@@ -234,20 +234,20 @@ discard block |
||
234 | 234 | * @return void |
235 | 235 | */ |
236 | 236 | function give_reports_form_details() { |
237 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
237 | + if ( ! isset($_GET['form-id'])) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | <div class="tablenav top reports-forms-details-wrap"> |
242 | 242 | <div class="actions bulkactions"> |
243 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
243 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
244 | 244 | </div> |
245 | 245 | </div> |
246 | 246 | <?php |
247 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
247 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
248 | 248 | } |
249 | 249 | |
250 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
250 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Renders the Reports Donors Table |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @return void |
259 | 259 | */ |
260 | 260 | function give_reports_donors_table() { |
261 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
261 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
262 | 262 | |
263 | 263 | $give_table = new Give_Donor_Reports_Table(); |
264 | 264 | $give_table->prepare_items(); |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @since 1.0 |
272 | 272 | */ |
273 | - do_action( 'give_logs_donors_table_top' ); |
|
273 | + do_action('give_logs_donors_table_top'); |
|
274 | 274 | ?> |
275 | 275 | <form id="give-donors-filter" method="get"> |
276 | 276 | <?php |
277 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
277 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
278 | 278 | $give_table->display(); |
279 | 279 | ?> |
280 | 280 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @since 1.0 |
289 | 289 | */ |
290 | - do_action( 'give_logs_donors_table_bottom' ); |
|
290 | + do_action('give_logs_donors_table_bottom'); |
|
291 | 291 | ?> |
292 | 292 | </div> |
293 | 293 | <?php |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
296 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | /** |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | * @return void |
306 | 306 | */ |
307 | 307 | function give_reports_gateways_table() { |
308 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
308 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
309 | 309 | |
310 | 310 | $give_table = new Give_Gateawy_Reports_Table(); |
311 | 311 | $give_table->prepare_items(); |
312 | 312 | $give_table->display(); |
313 | 313 | } |
314 | 314 | |
315 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
315 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
316 | 316 | |
317 | 317 | |
318 | 318 | /** |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | function give_reports_earnings() { |
325 | 325 | ?> |
326 | 326 | <div class="tablenav top reports-table-nav"> |
327 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
327 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
328 | 328 | </div> |
329 | 329 | <?php |
330 | 330 | give_reports_graph(); |
331 | 331 | } |
332 | 332 | |
333 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
333 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
334 | 334 | |
335 | 335 | |
336 | 336 | /** |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @since 1.0 |
353 | 353 | */ |
354 | - do_action( 'give_reports_tab_export_content_top' ); |
|
354 | + do_action('give_reports_tab_export_content_top'); |
|
355 | 355 | ?> |
356 | 356 | |
357 | 357 | <table class="widefat export-options-table give-table"> |
358 | 358 | <thead> |
359 | 359 | <tr> |
360 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
361 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
360 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
361 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
362 | 362 | </tr> |
363 | 363 | </thead> |
364 | 364 | <tbody> |
@@ -370,42 +370,42 @@ discard block |
||
370 | 370 | * |
371 | 371 | * @since 1.0 |
372 | 372 | */ |
373 | - do_action( 'give_reports_tab_export_table_top' ); |
|
373 | + do_action('give_reports_tab_export_table_top'); |
|
374 | 374 | ?> |
375 | 375 | <tr class="give-export-pdf-sales-earnings"> |
376 | 376 | <td scope="row" class="row-title"> |
377 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
377 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
378 | 378 | </h3> |
379 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
379 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
380 | 380 | </td> |
381 | 381 | <td> |
382 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
382 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
383 | 383 | </td> |
384 | 384 | </tr> |
385 | 385 | <tr class="alternate give-export-sales-earnings"> |
386 | 386 | <td scope="row" class="row-title"> |
387 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
388 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
387 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
388 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
389 | 389 | </td> |
390 | 390 | <td> |
391 | 391 | <form method="post"> |
392 | 392 | <?php |
393 | 393 | printf( |
394 | 394 | /* translators: 1: start date dropdown 2: end date dropdown */ |
395 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
396 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
397 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
395 | + esc_html__('%1$s to %2$s', 'give'), |
|
396 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
397 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
398 | 398 | ); |
399 | 399 | ?> |
400 | 400 | <input type="hidden" name="give-action" value="earnings_export"/> |
401 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
401 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
402 | 402 | </form> |
403 | 403 | </td> |
404 | 404 | </tr> |
405 | 405 | <tr class="give-export-payment-history"> |
406 | 406 | <td scope="row" class="row-title"> |
407 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
408 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
407 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
408 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
409 | 409 | </td> |
410 | 410 | <td> |
411 | 411 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -413,27 +413,27 @@ discard block |
||
413 | 413 | $args = array( |
414 | 414 | 'id' => 'give-payment-export-start', |
415 | 415 | 'name' => 'start', |
416 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
416 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
417 | 417 | ); |
418 | - echo Give()->html->date_field( $args ); ?> |
|
418 | + echo Give()->html->date_field($args); ?> |
|
419 | 419 | <?php |
420 | 420 | $args = array( |
421 | 421 | 'id' => 'give-payment-export-end', |
422 | 422 | 'name' => 'end', |
423 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
423 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
424 | 424 | ); |
425 | - echo Give()->html->date_field( $args ); ?> |
|
425 | + echo Give()->html->date_field($args); ?> |
|
426 | 426 | <select name="status"> |
427 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
427 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
428 | 428 | <?php |
429 | 429 | $statuses = give_get_payment_statuses(); |
430 | - foreach ( $statuses as $status => $label ) { |
|
431 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
430 | + foreach ($statuses as $status => $label) { |
|
431 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
432 | 432 | } |
433 | 433 | ?> |
434 | 434 | </select> |
435 | 435 | <?php |
436 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
436 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
437 | 437 | echo Give()->html->category_dropdown( |
438 | 438 | 'give_forms_categories[]', |
439 | 439 | 0, |
@@ -443,12 +443,12 @@ discard block |
||
443 | 443 | 'multiple' => true, |
444 | 444 | 'selected' => array(), |
445 | 445 | 'show_option_all' => false, |
446 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
446 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
447 | 447 | ) |
448 | 448 | ); |
449 | 449 | } |
450 | 450 | |
451 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
451 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
452 | 452 | echo Give()->html->tags_dropdown( |
453 | 453 | 'give_forms_tags[]', |
454 | 454 | 0, |
@@ -458,16 +458,16 @@ discard block |
||
458 | 458 | 'multiple' => true, |
459 | 459 | 'selected' => array(), |
460 | 460 | 'show_option_all' => false, |
461 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
461 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
462 | 462 | ) |
463 | 463 | ); |
464 | 464 | } |
465 | 465 | |
466 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
466 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
467 | 467 | ?> |
468 | 468 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
469 | 469 | <span> |
470 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
470 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
471 | 471 | <span class="spinner"></span> |
472 | 472 | </span> |
473 | 473 | </form> |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | </tr> |
476 | 476 | <tr class="alternate give-export-donors"> |
477 | 477 | <td scope="row" class="row-title"> |
478 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
479 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
478 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
479 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
480 | 480 | </td> |
481 | 481 | <td> |
482 | 482 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -487,46 +487,46 @@ discard block |
||
487 | 487 | 'id' => 'give_customer_export_form', |
488 | 488 | 'chosen' => true, |
489 | 489 | ); |
490 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
490 | + echo Give()->html->forms_dropdown($args); ?> |
|
491 | 491 | |
492 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
492 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
493 | 493 | |
494 | 494 | <div id="export-donor-options-wrap" class="give-clearfix"> |
495 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
495 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
496 | 496 | <ul id="give-export-option-ul"> |
497 | 497 | <li> |
498 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
498 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
499 | 499 | </label> |
500 | 500 | </li> |
501 | 501 | <li> |
502 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
502 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
503 | 503 | </label> |
504 | 504 | </li> |
505 | 505 | <li> |
506 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
506 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
507 | 507 | </label> |
508 | 508 | </li> |
509 | 509 | <li> |
510 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
510 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
511 | 511 | </label> |
512 | 512 | </li> |
513 | 513 | <li> |
514 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
514 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
515 | 515 | </label> |
516 | 516 | </li> |
517 | 517 | <li> |
518 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
518 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
519 | 519 | </label> |
520 | 520 | </li> |
521 | 521 | <li> |
522 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
522 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
523 | 523 | </label> |
524 | 524 | </li> |
525 | 525 | </ul> |
526 | 526 | </div> |
527 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
527 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
528 | 528 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
529 | - <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
|
529 | + <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/> |
|
530 | 530 | </form> |
531 | 531 | </td> |
532 | 532 | </tr> |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @since 1.0 |
540 | 540 | */ |
541 | - do_action( 'give_reports_tab_export_table_bottom' ); |
|
541 | + do_action('give_reports_tab_export_table_bottom'); |
|
542 | 542 | ?> |
543 | 543 | </tbody> |
544 | 544 | </table> |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @since 1.0 |
551 | 551 | */ |
552 | - do_action( 'give_reports_tab_export_content_bottom' ); |
|
552 | + do_action('give_reports_tab_export_content_bottom'); |
|
553 | 553 | ?> |
554 | 554 | |
555 | 555 | </div> |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | <?php |
561 | 561 | } |
562 | 562 | |
563 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
563 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
564 | 564 | |
565 | 565 | /** |
566 | 566 | * Renders the Reports page |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | */ |
571 | 571 | function give_reports_tab_logs() { |
572 | 572 | |
573 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
573 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
574 | 574 | |
575 | 575 | // Get current section. |
576 | 576 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @since 1.0 |
582 | 582 | */ |
583 | - do_action( "give_logs_view_{$current_section}" ); |
|
583 | + do_action("give_logs_view_{$current_section}"); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | /** |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | */ |
592 | 592 | function give_estimated_monthly_stats() { |
593 | 593 | |
594 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
594 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
595 | 595 | |
596 | - if ( false === $estimated ) { |
|
596 | + if (false === $estimated) { |
|
597 | 597 | |
598 | 598 | $estimated = array( |
599 | 599 | 'earnings' => 0, |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | |
603 | 603 | $stats = new Give_Payment_Stats; |
604 | 604 | |
605 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
606 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
605 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
606 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
607 | 607 | |
608 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
609 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
610 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
611 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
608 | + $current_day = date('d', current_time('timestamp')); |
|
609 | + $current_month = date('n', current_time('timestamp')); |
|
610 | + $current_year = date('Y', current_time('timestamp')); |
|
611 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
612 | 612 | |
613 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
614 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
613 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
614 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
615 | 615 | |
616 | 616 | // Cache for one day |
617 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
617 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
618 | 618 | } |
619 | 619 | |
620 | - return maybe_unserialize( $estimated ); |
|
620 | + return maybe_unserialize($estimated); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |