@@ -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,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | * |
99 | 99 | * @since 1.8 |
100 | 100 | * |
101 | - * @return bool |
|
101 | + * @return false|null |
|
102 | 102 | */ |
103 | 103 | function give_redirect_to_clean_url_admin_pages() { |
104 | 104 | // Give admin pages. |
@@ -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,19 +20,19 @@ discard block |
||
20 | 20 | * @since 1.8 |
21 | 21 | */ |
22 | 22 | function give_load_wp_editor() { |
23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
23 | + if ( ! isset($_POST['wp_editor'])) { |
|
24 | 24 | die(); |
25 | 25 | } |
26 | 26 | |
27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
29 | 29 | |
30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
31 | 31 | |
32 | 32 | die(); |
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Get current page. |
55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
56 | 56 | |
57 | 57 | // Bailout. |
58 | 58 | if ( |
59 | - empty( $current_page ) |
|
60 | - || empty( $_GET['_wp_http_referer'] ) |
|
61 | - || ! in_array( $current_page, $give_pages ) |
|
59 | + empty($current_page) |
|
60 | + || empty($_GET['_wp_http_referer']) |
|
61 | + || ! in_array($current_page, $give_pages) |
|
62 | 62 | ) { |
63 | 63 | return false; |
64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @since 1.8 |
70 | 70 | */ |
71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
72 | 72 | |
73 | - if ( $redirect ) { |
|
73 | + if ($redirect) { |
|
74 | 74 | // Redirect. |
75 | 75 | wp_redirect( |
76 | 76 | remove_query_arg( |
77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
77 | + array('_wp_http_referer', '_wpnonce'), |
|
78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function give_hide_outdated_php_notice() { |
98 | 98 | |
99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
100 | 100 | give_die(); |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Transient key name. |
104 | 104 | $transient_key = "_give_hide_outdated_php_notices_shortly"; |
105 | 105 | |
106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
106 | + if (Give_Cache::get($transient_key, true)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Hide notice for 24 hours. |
111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
112 | 112 | |
113 | 113 | give_die(); |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Register admin notices. |
@@ -123,27 +123,27 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function _give_register_admin_notices() { |
125 | 125 | // Bailout. |
126 | - if ( ! is_admin() ) { |
|
126 | + if ( ! is_admin()) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Bulk action notices. |
131 | 131 | if ( |
132 | - isset( $_GET['action'] ) && |
|
133 | - ! empty( $_GET['action'] ) |
|
132 | + isset($_GET['action']) && |
|
133 | + ! empty($_GET['action']) |
|
134 | 134 | ) { |
135 | 135 | |
136 | 136 | // Add payment bulk notice. |
137 | 137 | if ( |
138 | - current_user_can( 'edit_give_payments' ) && |
|
139 | - isset( $_GET['payment'] ) && |
|
140 | - ! empty( $_GET['payment'] ) |
|
138 | + current_user_can('edit_give_payments') && |
|
139 | + isset($_GET['payment']) && |
|
140 | + ! empty($_GET['payment']) |
|
141 | 141 | ) { |
142 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
142 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
143 | 143 | |
144 | - switch ( $_GET['action'] ) { |
|
144 | + switch ($_GET['action']) { |
|
145 | 145 | case 'delete': |
146 | - Give()->notices->register_notice( array( |
|
146 | + Give()->notices->register_notice(array( |
|
147 | 147 | 'id' => 'bulk_action_delete', |
148 | 148 | 'type' => 'updated', |
149 | 149 | 'description' => sprintf( |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | ), |
156 | 156 | $payment_count ), |
157 | 157 | 'show' => true, |
158 | - ) ); |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | break; |
161 | 161 | |
162 | 162 | case 'resend-receipt': |
163 | - Give()->notices->register_notice( array( |
|
163 | + Give()->notices->register_notice(array( |
|
164 | 164 | 'id' => 'bulk_action_resend_receipt', |
165 | 165 | 'type' => 'updated', |
166 | 166 | 'description' => sprintf( |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $payment_count |
174 | 174 | ), |
175 | 175 | 'show' => true, |
176 | - ) ); |
|
176 | + )); |
|
177 | 177 | break; |
178 | 178 | |
179 | 179 | case 'set-status-publish' : |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | case 'set-status-cancelled' : |
186 | 186 | case 'set-status-abandoned' : |
187 | 187 | case 'set-status-preapproval' : |
188 | - Give()->notices->register_notice( array( |
|
188 | + Give()->notices->register_notice(array( |
|
189 | 189 | 'id' => 'bulk_action_status_change', |
190 | 190 | 'type' => 'updated', |
191 | 191 | 'description' => _n( |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'give' |
196 | 196 | ), |
197 | 197 | 'show' => true, |
198 | - ) ); |
|
198 | + )); |
|
199 | 199 | break; |
200 | 200 | } |
201 | 201 | |
@@ -203,244 +203,244 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | // Add give message notices. |
206 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
206 | + if ( ! empty($_GET['give-message'])) { |
|
207 | 207 | // Donation reports errors. |
208 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
209 | - switch ( $_GET['give-message'] ) { |
|
208 | + if (current_user_can('view_give_reports')) { |
|
209 | + switch ($_GET['give-message']) { |
|
210 | 210 | case 'donation_deleted' : |
211 | - Give()->notices->register_notice( array( |
|
211 | + Give()->notices->register_notice(array( |
|
212 | 212 | 'id' => 'give-donation-deleted', |
213 | 213 | 'type' => 'updated', |
214 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
214 | + 'description' => __('The donation has been deleted.', 'give'), |
|
215 | 215 | 'show' => true, |
216 | - ) ); |
|
216 | + )); |
|
217 | 217 | break; |
218 | 218 | case 'email_sent' : |
219 | - Give()->notices->register_notice( array( |
|
219 | + Give()->notices->register_notice(array( |
|
220 | 220 | 'id' => 'give-payment-sent', |
221 | 221 | 'type' => 'updated', |
222 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
222 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
223 | 223 | 'show' => true, |
224 | - ) ); |
|
224 | + )); |
|
225 | 225 | break; |
226 | 226 | case 'refreshed-reports' : |
227 | - Give()->notices->register_notice( array( |
|
227 | + Give()->notices->register_notice(array( |
|
228 | 228 | 'id' => 'give-refreshed-reports', |
229 | 229 | 'type' => 'updated', |
230 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
230 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
231 | 231 | 'show' => true, |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | break; |
234 | 234 | case 'donation-note-deleted' : |
235 | - Give()->notices->register_notice( array( |
|
235 | + Give()->notices->register_notice(array( |
|
236 | 236 | 'id' => 'give-donation-note-deleted', |
237 | 237 | 'type' => 'updated', |
238 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
238 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
239 | 239 | 'show' => true, |
240 | - ) ); |
|
240 | + )); |
|
241 | 241 | break; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | 245 | // Give settings notices and errors. |
246 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
247 | - switch ( $_GET['give-message'] ) { |
|
246 | + if (current_user_can('manage_give_settings')) { |
|
247 | + switch ($_GET['give-message']) { |
|
248 | 248 | case 'settings-imported' : |
249 | - Give()->notices->register_notice( array( |
|
249 | + Give()->notices->register_notice(array( |
|
250 | 250 | 'id' => 'give-settings-imported', |
251 | 251 | 'type' => 'updated', |
252 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
252 | + 'description' => __('The settings have been imported.', 'give'), |
|
253 | 253 | 'show' => true, |
254 | - ) ); |
|
254 | + )); |
|
255 | 255 | break; |
256 | 256 | case 'api-key-generated' : |
257 | - Give()->notices->register_notice( array( |
|
257 | + Give()->notices->register_notice(array( |
|
258 | 258 | 'id' => 'give-api-key-generated', |
259 | 259 | 'type' => 'updated', |
260 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
260 | + 'description' => __('API keys have been generated.', 'give'), |
|
261 | 261 | 'show' => true, |
262 | - ) ); |
|
262 | + )); |
|
263 | 263 | break; |
264 | 264 | case 'api-key-exists' : |
265 | - Give()->notices->register_notice( array( |
|
265 | + Give()->notices->register_notice(array( |
|
266 | 266 | 'id' => 'give-api-key-exists', |
267 | 267 | 'type' => 'updated', |
268 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
268 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
269 | 269 | 'show' => true, |
270 | - ) ); |
|
270 | + )); |
|
271 | 271 | break; |
272 | 272 | case 'api-key-regenerated' : |
273 | - Give()->notices->register_notice( array( |
|
273 | + Give()->notices->register_notice(array( |
|
274 | 274 | 'id' => 'give-api-key-regenerated', |
275 | 275 | 'type' => 'updated', |
276 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
276 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
277 | 277 | 'show' => true, |
278 | - ) ); |
|
278 | + )); |
|
279 | 279 | break; |
280 | 280 | case 'api-key-revoked' : |
281 | - Give()->notices->register_notice( array( |
|
281 | + Give()->notices->register_notice(array( |
|
282 | 282 | 'id' => 'give-api-key-revoked', |
283 | 283 | 'type' => 'updated', |
284 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
284 | + 'description' => __('API keys have been revoked.', 'give'), |
|
285 | 285 | 'show' => true, |
286 | - ) ); |
|
286 | + )); |
|
287 | 287 | break; |
288 | 288 | case 'sent-test-email' : |
289 | - Give()->notices->register_notice( array( |
|
289 | + Give()->notices->register_notice(array( |
|
290 | 290 | 'id' => 'give-sent-test-email', |
291 | 291 | 'type' => 'updated', |
292 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
292 | + 'description' => __('The test email has been sent.', 'give'), |
|
293 | 293 | 'show' => true, |
294 | - ) ); |
|
294 | + )); |
|
295 | 295 | break; |
296 | 296 | case 'matched-success-failure-page': |
297 | - Give()->notices->register_notice( array( |
|
297 | + Give()->notices->register_notice(array( |
|
298 | 298 | 'id' => 'give-matched-success-failure-page', |
299 | 299 | 'type' => 'updated', |
300 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
300 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
301 | 301 | 'show' => true, |
302 | - ) ); |
|
302 | + )); |
|
303 | 303 | break; |
304 | 304 | } |
305 | 305 | } |
306 | 306 | // Payments errors. |
307 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
308 | - switch ( $_GET['give-message'] ) { |
|
307 | + if (current_user_can('edit_give_payments')) { |
|
308 | + switch ($_GET['give-message']) { |
|
309 | 309 | case 'note-added' : |
310 | - Give()->notices->register_notice( array( |
|
310 | + Give()->notices->register_notice(array( |
|
311 | 311 | 'id' => 'give-note-added', |
312 | 312 | 'type' => 'updated', |
313 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
313 | + 'description' => __('The donation note has been added.', 'give'), |
|
314 | 314 | 'show' => true, |
315 | - ) ); |
|
315 | + )); |
|
316 | 316 | break; |
317 | 317 | case 'payment-updated' : |
318 | - Give()->notices->register_notice( array( |
|
318 | + Give()->notices->register_notice(array( |
|
319 | 319 | 'id' => 'give-payment-updated', |
320 | 320 | 'type' => 'updated', |
321 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
321 | + 'description' => __('The donation has been updated.', 'give'), |
|
322 | 322 | 'show' => true, |
323 | - ) ); |
|
323 | + )); |
|
324 | 324 | break; |
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | // Donor Notices. |
329 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
330 | - switch ( $_GET['give-message'] ) { |
|
329 | + if (current_user_can('edit_give_payments')) { |
|
330 | + switch ($_GET['give-message']) { |
|
331 | 331 | case 'donor-deleted' : |
332 | - Give()->notices->register_notice( array( |
|
332 | + Give()->notices->register_notice(array( |
|
333 | 333 | 'id' => 'give-donor-deleted', |
334 | 334 | 'type' => 'updated', |
335 | - 'description' => __( 'The selected donor(s) has been deleted.', 'give' ), |
|
335 | + 'description' => __('The selected donor(s) has been deleted.', 'give'), |
|
336 | 336 | 'show' => true, |
337 | - ) ); |
|
337 | + )); |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case 'donor-donations-deleted' : |
341 | - Give()->notices->register_notice( array( |
|
341 | + Give()->notices->register_notice(array( |
|
342 | 342 | 'id' => 'give-donor-donations-deleted', |
343 | 343 | 'type' => 'updated', |
344 | - 'description' => __( 'The selected donor(s) and its associated donations has been deleted.', 'give' ), |
|
344 | + 'description' => __('The selected donor(s) and its associated donations has been deleted.', 'give'), |
|
345 | 345 | 'show' => true, |
346 | - ) ); |
|
346 | + )); |
|
347 | 347 | break; |
348 | 348 | |
349 | 349 | case 'confirm-delete-donor' : |
350 | - Give()->notices->register_notice( array( |
|
350 | + Give()->notices->register_notice(array( |
|
351 | 351 | 'id' => 'give-confirm-delete-donor', |
352 | 352 | 'type' => 'updated', |
353 | - 'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ), |
|
353 | + 'description' => __('You must confirm to delete the selected donor(s).', 'give'), |
|
354 | 354 | 'show' => true, |
355 | - ) ); |
|
355 | + )); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'invalid-donor-id' : |
359 | - Give()->notices->register_notice( array( |
|
359 | + Give()->notices->register_notice(array( |
|
360 | 360 | 'id' => 'give-invalid-donor-id', |
361 | 361 | 'type' => 'updated', |
362 | - 'description' => __( 'Invalid Donor ID.', 'give' ), |
|
362 | + 'description' => __('Invalid Donor ID.', 'give'), |
|
363 | 363 | 'show' => true, |
364 | - ) ); |
|
364 | + )); |
|
365 | 365 | break; |
366 | 366 | |
367 | 367 | case 'donor-delete-failed' : |
368 | - Give()->notices->register_notice( array( |
|
368 | + Give()->notices->register_notice(array( |
|
369 | 369 | 'id' => 'give-donor-delete-failed', |
370 | 370 | 'type' => 'error', |
371 | - 'description' => __( 'Unable to delete selected donor(s).', 'give' ), |
|
371 | + 'description' => __('Unable to delete selected donor(s).', 'give'), |
|
372 | 372 | 'show' => true, |
373 | - ) ); |
|
373 | + )); |
|
374 | 374 | break; |
375 | 375 | |
376 | 376 | case 'email-added' : |
377 | - Give()->notices->register_notice( array( |
|
377 | + Give()->notices->register_notice(array( |
|
378 | 378 | 'id' => 'give-donor-email-added', |
379 | 379 | 'type' => 'updated', |
380 | - 'description' => __( 'Donor email added.', 'give' ), |
|
380 | + 'description' => __('Donor email added.', 'give'), |
|
381 | 381 | 'show' => true, |
382 | - ) ); |
|
382 | + )); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | case 'email-removed' : |
386 | - Give()->notices->register_notice( array( |
|
386 | + Give()->notices->register_notice(array( |
|
387 | 387 | 'id' => 'give-donor-email-removed', |
388 | 388 | 'type' => 'updated', |
389 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
389 | + 'description' => __('Donor email removed.', 'give'), |
|
390 | 390 | 'show' => true, |
391 | - ) ); |
|
391 | + )); |
|
392 | 392 | break; |
393 | 393 | |
394 | 394 | case 'email-remove-failed' : |
395 | - Give()->notices->register_notice( array( |
|
395 | + Give()->notices->register_notice(array( |
|
396 | 396 | 'id' => 'give-donor-email-remove-failed', |
397 | 397 | 'type' => 'updated', |
398 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
398 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
399 | 399 | 'show' => true, |
400 | - ) ); |
|
400 | + )); |
|
401 | 401 | break; |
402 | 402 | |
403 | 403 | case 'primary-email-updated' : |
404 | - Give()->notices->register_notice( array( |
|
404 | + Give()->notices->register_notice(array( |
|
405 | 405 | 'id' => 'give-donor-primary-email-updated', |
406 | 406 | 'type' => 'updated', |
407 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
407 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
408 | 408 | 'show' => true, |
409 | - ) ); |
|
409 | + )); |
|
410 | 410 | break; |
411 | 411 | |
412 | 412 | case 'primary-email-failed' : |
413 | - Give()->notices->register_notice( array( |
|
413 | + Give()->notices->register_notice(array( |
|
414 | 414 | 'id' => 'give-donor-primary-email-failed', |
415 | 415 | 'type' => 'updated', |
416 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
416 | + 'description' => __('Failed to set primary email.', 'give'), |
|
417 | 417 | 'show' => true, |
418 | - ) ); |
|
418 | + )); |
|
419 | 419 | break; |
420 | 420 | |
421 | 421 | case 'reconnect-user' : |
422 | - Give()->notices->register_notice( array( |
|
422 | + Give()->notices->register_notice(array( |
|
423 | 423 | 'id' => 'give-donor-reconnect-user', |
424 | 424 | 'type' => 'updated', |
425 | - 'description' => __( 'User has been successfully connected with Donor.', 'give' ), |
|
425 | + 'description' => __('User has been successfully connected with Donor.', 'give'), |
|
426 | 426 | 'show' => true, |
427 | - ) ); |
|
427 | + )); |
|
428 | 428 | break; |
429 | 429 | |
430 | 430 | case 'profile-updated' : |
431 | - Give()->notices->register_notice( array( |
|
431 | + Give()->notices->register_notice(array( |
|
432 | 432 | 'id' => 'give-donor-profile-updated', |
433 | 433 | 'type' => 'updated', |
434 | - 'description' => __( 'Donor information updated successfully.', 'give' ), |
|
434 | + 'description' => __('Donor information updated successfully.', 'give'), |
|
435 | 435 | 'show' => true, |
436 | - ) ); |
|
436 | + )); |
|
437 | 437 | break; |
438 | 438 | } |
439 | 439 | } |
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
443 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
443 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
444 | 444 | |
445 | 445 | |
446 | 446 | /** |
@@ -450,31 +450,30 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @return bool |
452 | 452 | */ |
453 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
454 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
455 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
456 | - give_is_test_mode(); |
|
453 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
454 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
455 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
457 | 456 | |
458 | 457 | if ( |
459 | - ! current_user_can( 'view_give_reports' ) || |
|
458 | + ! current_user_can('view_give_reports') || |
|
460 | 459 | ! $is_test_mode |
461 | 460 | ) { |
462 | 461 | return false; |
463 | 462 | } |
464 | 463 | |
465 | 464 | // Add the main site admin menu item. |
466 | - $wp_admin_bar->add_menu( array( |
|
465 | + $wp_admin_bar->add_menu(array( |
|
467 | 466 | 'id' => 'give-test-notice', |
468 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
467 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
469 | 468 | 'parent' => 'top-secondary', |
470 | - 'title' => __( 'Give Test Mode Active', 'give' ), |
|
471 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
472 | - ) ); |
|
469 | + 'title' => __('Give Test Mode Active', 'give'), |
|
470 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
471 | + )); |
|
473 | 472 | |
474 | 473 | return true; |
475 | 474 | } |
476 | 475 | |
477 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
476 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
478 | 477 | |
479 | 478 | /** |
480 | 479 | * Add Link to Import page in from donation archive and donation single page |
@@ -483,12 +482,12 @@ discard block |
||
483 | 482 | */ |
484 | 483 | function give_import_page_link_callback() { |
485 | 484 | ?> |
486 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
487 | - class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a> |
|
485 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
486 | + class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a> |
|
488 | 487 | |
489 | 488 | <?php |
490 | 489 | // Check if view donation single page only. |
491 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
490 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
492 | 491 | ?> |
493 | 492 | <style type="text/css"> |
494 | 493 | .wrap #transaction-details-heading { |
@@ -499,7 +498,7 @@ discard block |
||
499 | 498 | } |
500 | 499 | } |
501 | 500 | |
502 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
501 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
503 | 502 | |
504 | 503 | /** |
505 | 504 | * Load donation import ajax callback |
@@ -511,9 +510,9 @@ discard block |
||
511 | 510 | */ |
512 | 511 | function give_donation_import_callback() { |
513 | 512 | $import_setting = array(); |
514 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
513 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
515 | 514 | |
516 | - parse_str( $fields ); |
|
515 | + parse_str($fields); |
|
517 | 516 | |
518 | 517 | $import_setting['create_user'] = $create_user; |
519 | 518 | $import_setting['mode'] = $mode; |
@@ -522,57 +521,57 @@ discard block |
||
522 | 521 | $import_setting['delete_csv'] = $delete_csv; |
523 | 522 | |
524 | 523 | // Parent key id. |
525 | - $main_key = maybe_unserialize( $main_key ); |
|
526 | - |
|
527 | - $current = absint( $_REQUEST['current'] ); |
|
528 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
529 | - $start = absint( $_REQUEST['start'] ); |
|
530 | - $end = absint( $_REQUEST['end'] ); |
|
531 | - $next = absint( $_REQUEST['next'] ); |
|
532 | - $total = absint( $_REQUEST['total'] ); |
|
533 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
534 | - if ( empty( $delimiter ) ) { |
|
524 | + $main_key = maybe_unserialize($main_key); |
|
525 | + |
|
526 | + $current = absint($_REQUEST['current']); |
|
527 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
528 | + $start = absint($_REQUEST['start']); |
|
529 | + $end = absint($_REQUEST['end']); |
|
530 | + $next = absint($_REQUEST['next']); |
|
531 | + $total = absint($_REQUEST['total']); |
|
532 | + $per_page = absint($_REQUEST['per_page']); |
|
533 | + if (empty($delimiter)) { |
|
535 | 534 | $delimiter = ','; |
536 | 535 | } |
537 | 536 | |
538 | 537 | // Processing done here. |
539 | - $raw_data = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter ); |
|
540 | - $raw_key = maybe_unserialize( $mapto ); |
|
538 | + $raw_data = give_get_donation_data_from_csv($csv, $start, $end, $delimiter); |
|
539 | + $raw_key = maybe_unserialize($mapto); |
|
541 | 540 | |
542 | 541 | // Prevent normal emails. |
543 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
544 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
545 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
546 | - |
|
547 | - $current_key = $start; |
|
548 | - foreach ( $raw_data as $row_data ) { |
|
549 | - $import_setting['donation_key'] = $current_key; |
|
550 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
542 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
543 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
544 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
545 | + |
|
546 | + $current_key = $start; |
|
547 | + foreach ($raw_data as $row_data) { |
|
548 | + $import_setting['donation_key'] = $current_key; |
|
549 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
551 | 550 | $current_key++; |
552 | 551 | } |
553 | 552 | |
554 | 553 | // Check if function exists or not. |
555 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
556 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
554 | + if (function_exists('give_payment_save_page_data')) { |
|
555 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
557 | 556 | } |
558 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
559 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
557 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
558 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
560 | 559 | |
561 | - if ( $next == false ) { |
|
560 | + if ($next == false) { |
|
562 | 561 | $json_data = array( |
563 | 562 | 'success' => true, |
564 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
563 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
565 | 564 | ); |
566 | 565 | } else { |
567 | 566 | $index_start = $start; |
568 | 567 | $index_end = $end; |
569 | 568 | $last = false; |
570 | 569 | $next = true; |
571 | - if ( $next ) { |
|
570 | + if ($next) { |
|
572 | 571 | $index_start = $index_start + $per_page; |
573 | - $index_end = $per_page + ( $index_start - 1 ); |
|
572 | + $index_end = $per_page + ($index_start - 1); |
|
574 | 573 | } |
575 | - if ( $index_end >= $total ) { |
|
574 | + if ($index_end >= $total) { |
|
576 | 575 | $index_end = $total; |
577 | 576 | $last = true; |
578 | 577 | } |
@@ -586,27 +585,27 @@ discard block |
||
586 | 585 | ); |
587 | 586 | } |
588 | 587 | |
589 | - $url = give_import_page_url( array( |
|
588 | + $url = give_import_page_url(array( |
|
590 | 589 | 'step' => '4', |
591 | 590 | 'importer-type' => 'import_donations', |
592 | 591 | 'csv' => $csv, |
593 | 592 | 'total' => $total, |
594 | 593 | 'delete_csv' => $import_setting['delete_csv'], |
595 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
596 | - ) ); |
|
594 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
595 | + )); |
|
597 | 596 | $json_data['url'] = $url; |
598 | 597 | |
599 | - $current ++; |
|
598 | + $current++; |
|
600 | 599 | $json_data['current'] = $current; |
601 | 600 | |
602 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
601 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
603 | 602 | $json_data['percentage'] = $percentage; |
604 | 603 | |
605 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
606 | - wp_die( json_encode( $json_data ) ); |
|
604 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
605 | + wp_die(json_encode($json_data)); |
|
607 | 606 | } |
608 | 607 | |
609 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
608 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
610 | 609 | |
611 | 610 | /** |
612 | 611 | * Load core settings import ajax callback |
@@ -618,8 +617,8 @@ discard block |
||
618 | 617 | */ |
619 | 618 | |
620 | 619 | function give_core_settings_import_callback() { |
621 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
622 | - parse_str( $fields, $fields ); |
|
620 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
621 | + parse_str($fields, $fields); |
|
623 | 622 | |
624 | 623 | $json_data['success'] = false; |
625 | 624 | |
@@ -634,22 +633,22 @@ discard block |
||
634 | 633 | * |
635 | 634 | * @return array $fields |
636 | 635 | */ |
637 | - $fields = (array) apply_filters( 'give_import_core_settings_fields', $fields ); |
|
636 | + $fields = (array) apply_filters('give_import_core_settings_fields', $fields); |
|
638 | 637 | |
639 | - $file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false ); |
|
638 | + $file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false); |
|
640 | 639 | |
641 | - if ( ! empty( $file_name ) ) { |
|
642 | - $type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' ); |
|
640 | + if ( ! empty($file_name)) { |
|
641 | + $type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge'); |
|
643 | 642 | |
644 | 643 | // Get the json data from the file and then alter it in array format |
645 | - $json_string = give_get_core_settings_json( $file_name ); |
|
646 | - $json_to_array = json_decode( $json_string, true ); |
|
644 | + $json_string = give_get_core_settings_json($file_name); |
|
645 | + $json_to_array = json_decode($json_string, true); |
|
647 | 646 | |
648 | 647 | // get the current settign from the options table. |
649 | - $host_give_options = get_option( 'give_settings', array() ); |
|
648 | + $host_give_options = get_option('give_settings', array()); |
|
650 | 649 | |
651 | 650 | // Save old settins for backup. |
652 | - update_option( 'give_settings_old', $host_give_options ); |
|
651 | + update_option('give_settings_old', $host_give_options); |
|
653 | 652 | |
654 | 653 | /** |
655 | 654 | * Filter to Modify Core Settings that are being going to get import in options table as give settings. |
@@ -665,9 +664,9 @@ discard block |
||
665 | 664 | * |
666 | 665 | * @return array $json_to_array Setting that are being going to get imported |
667 | 666 | */ |
668 | - $json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields ); |
|
667 | + $json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields); |
|
669 | 668 | |
670 | - update_option( 'give_settings', $json_to_array ); |
|
669 | + update_option('give_settings', $json_to_array); |
|
671 | 670 | |
672 | 671 | $json_data['success'] = true; |
673 | 672 | } |
@@ -683,16 +682,16 @@ discard block |
||
683 | 682 | * |
684 | 683 | * @return array $url |
685 | 684 | */ |
686 | - $json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array( |
|
687 | - 'step' => ( empty( $json_data['success'] ) ? '1' : '3' ), |
|
685 | + $json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array( |
|
686 | + 'step' => (empty($json_data['success']) ? '1' : '3'), |
|
688 | 687 | 'importer-type' => 'import_core_setting', |
689 | - 'success' => ( empty( $json_data['success'] ) ? '0' : '1' ), |
|
690 | - ) ) ); |
|
688 | + 'success' => (empty($json_data['success']) ? '0' : '1'), |
|
689 | + ))); |
|
691 | 690 | |
692 | - wp_send_json( $json_data ); |
|
691 | + wp_send_json($json_data); |
|
693 | 692 | } |
694 | 693 | |
695 | -add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' ); |
|
694 | +add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback'); |
|
696 | 695 | |
697 | 696 | /** |
698 | 697 | * Initializes blank slate content if a list table is empty. |
@@ -704,7 +703,7 @@ discard block |
||
704 | 703 | $blank_slate->init(); |
705 | 704 | } |
706 | 705 | |
707 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
706 | +add_action('current_screen', 'give_blank_slate'); |
|
708 | 707 | |
709 | 708 | /** |
710 | 709 | * Get Array of WP User Roles. |
@@ -717,8 +716,8 @@ discard block |
||
717 | 716 | $user_roles = array(); |
718 | 717 | |
719 | 718 | // Loop through User Roles. |
720 | - foreach ( get_editable_roles() as $role_name => $role_info ): |
|
721 | - $user_roles[ $role_name ] = $role_info['name']; |
|
719 | + foreach (get_editable_roles() as $role_name => $role_info): |
|
720 | + $user_roles[$role_name] = $role_info['name']; |
|
722 | 721 | endforeach; |
723 | 722 | |
724 | 723 | return $user_roles; |
@@ -463,7 +463,7 @@ |
||
463 | 463 | * @since 1.7 |
464 | 464 | * @access public |
465 | 465 | * |
466 | - * @return bool |
|
466 | + * @return false|null |
|
467 | 467 | */ |
468 | 468 | public function delete_cache() { |
469 | 469 | global $wpdb; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __setup_hooks() { |
45 | 45 | // Create the log post type |
46 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
46 | + add_action('init', array($this, 'register_post_type'), 1); |
|
47 | 47 | |
48 | 48 | // Create types taxonomy and default types |
49 | - add_action( 'init', array( $this, 'register_taxonomy' ), 1 ); |
|
49 | + add_action('init', array($this, 'register_taxonomy'), 1); |
|
50 | 50 | |
51 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) ); |
|
52 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) ); |
|
53 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) ); |
|
54 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) ); |
|
51 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
52 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
53 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
54 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /* Logs post type */ |
69 | 69 | $log_args = array( |
70 | 70 | 'labels' => array( |
71 | - 'name' => esc_html__( 'Logs', 'give' ), |
|
71 | + 'name' => esc_html__('Logs', 'give'), |
|
72 | 72 | ), |
73 | 73 | 'public' => false, |
74 | 74 | 'exclude_from_search' => true, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | 'query_var' => false, |
78 | 78 | 'rewrite' => false, |
79 | 79 | 'capability_type' => 'post', |
80 | - 'supports' => array( 'title', 'editor' ), |
|
80 | + 'supports' => array('title', 'editor'), |
|
81 | 81 | 'can_export' => true, |
82 | 82 | ); |
83 | 83 | |
84 | - register_post_type( 'give_log', $log_args ); |
|
84 | + register_post_type('give_log', $log_args); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | public function register_taxonomy() { |
98 | - register_taxonomy( 'give_log_type', 'give_log', array( |
|
98 | + register_taxonomy('give_log_type', 'give_log', array( |
|
99 | 99 | 'public' => false, |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'api_request', |
118 | 118 | ); |
119 | 119 | |
120 | - return apply_filters( 'give_log_types', $terms ); |
|
120 | + return apply_filters('give_log_types', $terms); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool Whether log type is valid. |
134 | 134 | */ |
135 | - public function valid_type( $type ) { |
|
136 | - return in_array( $type, $this->log_types() ); |
|
135 | + public function valid_type($type) { |
|
136 | + return in_array($type, $this->log_types()); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return int Log ID. |
154 | 154 | */ |
155 | - public function add( $title = '', $message = '', $parent = 0, $type = null ) { |
|
155 | + public function add($title = '', $message = '', $parent = 0, $type = null) { |
|
156 | 156 | $log_data = array( |
157 | 157 | 'post_title' => $title, |
158 | 158 | 'post_content' => $message, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'log_type' => $type, |
161 | 161 | ); |
162 | 162 | |
163 | - return $this->insert_log( $log_data ); |
|
163 | + return $this->insert_log($log_data); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return array An array of the connected logs. |
179 | 179 | */ |
180 | - public function get_logs( $object_id = 0, $type = null, $paged = null ) { |
|
181 | - return $this->get_connected_logs( array( |
|
180 | + public function get_logs($object_id = 0, $type = null, $paged = null) { |
|
181 | + return $this->get_connected_logs(array( |
|
182 | 182 | 'post_parent' => $object_id, |
183 | 183 | 'paged' => $paged, |
184 | 184 | 'log_type' => $type, |
185 | - ) ); |
|
185 | + )); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return int The ID of the newly created log item. |
198 | 198 | */ |
199 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
199 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
200 | 200 | $defaults = array( |
201 | 201 | 'post_type' => 'give_log', |
202 | 202 | 'post_status' => 'publish', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'log_type' => false, |
206 | 206 | ); |
207 | 207 | |
208 | - $args = wp_parse_args( $log_data, $defaults ); |
|
208 | + $args = wp_parse_args($log_data, $defaults); |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Fires before inserting log entry. |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @param array $log_data Log entry data. |
216 | 216 | * @param array $log_meta Log entry meta. |
217 | 217 | */ |
218 | - do_action( 'give_pre_insert_log', $log_data, $log_meta ); |
|
218 | + do_action('give_pre_insert_log', $log_data, $log_meta); |
|
219 | 219 | |
220 | 220 | // Store the log entry |
221 | - $log_id = wp_insert_post( $args ); |
|
221 | + $log_id = wp_insert_post($args); |
|
222 | 222 | |
223 | 223 | // Set the log type, if any |
224 | - if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) { |
|
225 | - wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false ); |
|
224 | + if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) { |
|
225 | + wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Set log meta, if any |
229 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
230 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
231 | - give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
229 | + if ($log_id && ! empty($log_meta)) { |
|
230 | + foreach ((array) $log_meta as $key => $meta) { |
|
231 | + give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $log_data Log entry data. |
242 | 242 | * @param array $log_meta Log entry meta. |
243 | 243 | */ |
244 | - do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta ); |
|
244 | + do_action('give_post_insert_log', $log_id, $log_data, $log_meta); |
|
245 | 245 | |
246 | 246 | return $log_id; |
247 | 247 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return bool|null True if successful, false otherwise. |
259 | 259 | */ |
260 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
260 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Fires before updating log entry. |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param array $log_data Log entry data. |
268 | 268 | * @param array $log_meta Log entry meta. |
269 | 269 | */ |
270 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
270 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
271 | 271 | |
272 | 272 | $defaults = array( |
273 | 273 | 'post_type' => 'give_log', |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | 'post_parent' => 0, |
276 | 276 | ); |
277 | 277 | |
278 | - $args = wp_parse_args( $log_data, $defaults ); |
|
278 | + $args = wp_parse_args($log_data, $defaults); |
|
279 | 279 | |
280 | 280 | // Store the log entry |
281 | - $log_id = wp_update_post( $args ); |
|
281 | + $log_id = wp_update_post($args); |
|
282 | 282 | |
283 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
284 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
285 | - if ( ! empty( $meta ) ) { |
|
286 | - give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
283 | + if ($log_id && ! empty($log_meta)) { |
|
284 | + foreach ((array) $log_meta as $key => $meta) { |
|
285 | + if ( ! empty($meta)) { |
|
286 | + give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param array $log_data Log entry data. |
298 | 298 | * @param array $log_meta Log entry meta. |
299 | 299 | */ |
300 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
300 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return array|false Array if logs were found, false otherwise. |
314 | 314 | */ |
315 | - public function get_connected_logs( $args = array() ) { |
|
315 | + public function get_connected_logs($args = array()) { |
|
316 | 316 | |
317 | 317 | $defaults = array( |
318 | 318 | 'post_type' => 'give_log', |
319 | 319 | 'posts_per_page' => 20, |
320 | 320 | 'post_status' => 'publish', |
321 | - 'paged' => get_query_var( 'paged' ), |
|
321 | + 'paged' => get_query_var('paged'), |
|
322 | 322 | 'log_type' => false, |
323 | 323 | 'date_query' => null |
324 | 324 | ); |
325 | 325 | |
326 | - $query_args = wp_parse_args( $args, $defaults ); |
|
326 | + $query_args = wp_parse_args($args, $defaults); |
|
327 | 327 | |
328 | - if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) { |
|
328 | + if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) { |
|
329 | 329 | $query_args['tax_query'] = array( |
330 | 330 | array( |
331 | 331 | 'taxonomy' => 'give_log_type', |
@@ -336,28 +336,28 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | // Retrieve logs based on specific timeframe |
339 | - if ( !empty ( $query_args['date_query'] ) && is_array( $query_args['date_query'] ) ) { |
|
340 | - if ( ! empty( $query_args['date_query']['start_date'] ) ) { |
|
341 | - $query_args['date_query']['after'] = array( |
|
342 | - 'year' => date( 'Y', strtotime( $query_args['date_query']['start_date'] ) ), |
|
343 | - 'month' => date( 'm', strtotime( $query_args['date_query']['start_date'] ) ), |
|
344 | - 'day' => date( 'd', strtotime( $query_args['date_query']['start_date'] ) ) |
|
339 | + if ( ! empty ($query_args['date_query']) && is_array($query_args['date_query'])) { |
|
340 | + if ( ! empty($query_args['date_query']['start_date'])) { |
|
341 | + $query_args['date_query']['after'] = array( |
|
342 | + 'year' => date('Y', strtotime($query_args['date_query']['start_date'])), |
|
343 | + 'month' => date('m', strtotime($query_args['date_query']['start_date'])), |
|
344 | + 'day' => date('d', strtotime($query_args['date_query']['start_date'])) |
|
345 | 345 | ); |
346 | 346 | } |
347 | 347 | |
348 | - if ( ! empty( $query_args['date_query']['end_date'] ) ) { |
|
349 | - $query_args['date_query']['before'] = array( |
|
350 | - 'year' => date( 'Y', strtotime( $query_args['date_query']['end_date'] ) ), |
|
351 | - 'month' => date( 'm', strtotime( $query_args['date_query']['end_date'] ) ), |
|
352 | - 'day' => date( 'd', strtotime( $query_args['date_query']['end_date'] ) ) |
|
348 | + if ( ! empty($query_args['date_query']['end_date'])) { |
|
349 | + $query_args['date_query']['before'] = array( |
|
350 | + 'year' => date('Y', strtotime($query_args['date_query']['end_date'])), |
|
351 | + 'month' => date('m', strtotime($query_args['date_query']['end_date'])), |
|
352 | + 'day' => date('d', strtotime($query_args['date_query']['end_date'])) |
|
353 | 353 | ); |
354 | 354 | } |
355 | 355 | $query_args['date_query']['inclusive'] = true; |
356 | 356 | } |
357 | 357 | |
358 | - $logs = get_posts( $query_args ); |
|
358 | + $logs = get_posts($query_args); |
|
359 | 359 | |
360 | - if ( $logs ) { |
|
360 | + if ($logs) { |
|
361 | 361 | return $logs; |
362 | 362 | } |
363 | 363 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return int Log count. |
382 | 382 | */ |
383 | - public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) { |
|
383 | + public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) { |
|
384 | 384 | |
385 | 385 | $query_args = array( |
386 | 386 | 'post_type' => 'give_log', |
387 | - 'posts_per_page' => - 1, |
|
387 | + 'posts_per_page' => -1, |
|
388 | 388 | 'post_status' => 'publish', |
389 | 389 | 'fields' => 'ids', |
390 | 390 | ); |
391 | 391 | |
392 | - if ( $object_id ) { |
|
392 | + if ($object_id) { |
|
393 | 393 | $query_args['post_parent'] = $object_id; |
394 | 394 | } |
395 | 395 | |
396 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
396 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
397 | 397 | $query_args['tax_query'] = array( |
398 | 398 | array( |
399 | 399 | 'taxonomy' => 'give_log_type', |
@@ -403,24 +403,24 @@ discard block |
||
403 | 403 | ); |
404 | 404 | } |
405 | 405 | |
406 | - if ( ! empty( $meta_query ) ) { |
|
406 | + if ( ! empty($meta_query)) { |
|
407 | 407 | $query_args['meta_query'] = $meta_query; |
408 | 408 | } |
409 | 409 | |
410 | - if ( ! empty( $date_query ) ) { |
|
410 | + if ( ! empty($date_query)) { |
|
411 | 411 | $query_args['date_query'] = $date_query; |
412 | 412 | } |
413 | 413 | |
414 | 414 | // Get cache key for current query. |
415 | - $cache_key = Give_Cache::get_key( 'get_log_count', $query_args ); |
|
415 | + $cache_key = Give_Cache::get_key('get_log_count', $query_args); |
|
416 | 416 | |
417 | 417 | // check if cache already exist or not. |
418 | - if ( ! ( $logs_count = Give_Cache::get( $cache_key ) ) ) { |
|
419 | - $logs = new WP_Query( $query_args ); |
|
418 | + if ( ! ($logs_count = Give_Cache::get($cache_key))) { |
|
419 | + $logs = new WP_Query($query_args); |
|
420 | 420 | $logs_count = (int) $logs->post_count; |
421 | 421 | |
422 | 422 | // Cache results. |
423 | - Give_Cache::set( $cache_key, $logs_count ); |
|
423 | + Give_Cache::set($cache_key, $logs_count); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | return $logs_count; |
@@ -440,16 +440,16 @@ discard block |
||
440 | 440 | * |
441 | 441 | * @return void |
442 | 442 | */ |
443 | - public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) { |
|
443 | + public function delete_logs($object_id = 0, $type = null, $meta_query = null) { |
|
444 | 444 | $query_args = array( |
445 | 445 | 'post_parent' => $object_id, |
446 | 446 | 'post_type' => 'give_log', |
447 | - 'posts_per_page' => - 1, |
|
447 | + 'posts_per_page' => -1, |
|
448 | 448 | 'post_status' => 'publish', |
449 | 449 | 'fields' => 'ids', |
450 | 450 | ); |
451 | 451 | |
452 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
452 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
453 | 453 | $query_args['tax_query'] = array( |
454 | 454 | array( |
455 | 455 | 'taxonomy' => 'give_log_type', |
@@ -459,15 +459,15 @@ discard block |
||
459 | 459 | ); |
460 | 460 | } |
461 | 461 | |
462 | - if ( ! empty( $meta_query ) ) { |
|
462 | + if ( ! empty($meta_query)) { |
|
463 | 463 | $query_args['meta_query'] = $meta_query; |
464 | 464 | } |
465 | 465 | |
466 | - $logs = get_posts( $query_args ); |
|
466 | + $logs = get_posts($query_args); |
|
467 | 467 | |
468 | - if ( $logs ) { |
|
469 | - foreach ( $logs as $log ) { |
|
470 | - wp_delete_post( $log, true ); |
|
468 | + if ($logs) { |
|
469 | + foreach ($logs as $log) { |
|
470 | + wp_delete_post($log, true); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param int $post_id |
482 | 482 | */ |
483 | - public function background_process_delete_cache( $post_id ) { |
|
483 | + public function background_process_delete_cache($post_id) { |
|
484 | 484 | // Delete log cache immediately |
485 | - wp_schedule_single_event( time() - 5, 'give_delete_log_cache' ); |
|
485 | + wp_schedule_single_event(time() - 5, 'give_delete_log_cache'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | ); |
511 | 511 | |
512 | 512 | // Bailout. |
513 | - if ( empty( $cache_option_names ) ) { |
|
513 | + if (empty($cache_option_names)) { |
|
514 | 514 | return false; |
515 | 515 | } |
516 | 516 | |
517 | - Give_Cache::delete( $cache_option_names ); |
|
517 | + Give_Cache::delete($cache_option_names); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @return int ID of the new log entry. |
538 | 538 | */ |
539 | -function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) { |
|
539 | +function give_record_log($title = '', $message = '', $parent = 0, $type = null) { |
|
540 | 540 | /* @var Give_Logging $give_logs */ |
541 | 541 | global $give_logs; |
542 | - $log = $give_logs->add( $title, $message, $parent, $type ); |
|
542 | + $log = $give_logs->add($title, $message, $parent, $type); |
|
543 | 543 | |
544 | 544 | return $log; |
545 | 545 | } |
@@ -530,7 +530,7 @@ |
||
530 | 530 | * |
531 | 531 | * @param int $payment_id |
532 | 532 | * |
533 | - * @return int payment_id |
|
533 | + * @return string payment_id |
|
534 | 534 | */ |
535 | 535 | function give_email_tag_payment_id( $payment_id ) { |
536 | 536 | $payment = new Give_Payment( $payment_id ); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param string $description Email tag description text |
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | */ |
58 | - public function add( $tag, $description, $func ) { |
|
59 | - if ( is_callable( $func ) ) { |
|
60 | - $this->tags[ $tag ] = array( |
|
58 | + public function add($tag, $description, $func) { |
|
59 | + if (is_callable($func)) { |
|
60 | + $this->tags[$tag] = array( |
|
61 | 61 | 'tag' => $tag, |
62 | 62 | 'description' => $description, |
63 | 63 | 'func' => $func, |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param string $tag Email tag to remove hook from |
74 | 74 | */ |
75 | - public function remove( $tag ) { |
|
76 | - unset( $this->tags[ $tag ] ); |
|
75 | + public function remove($tag) { |
|
76 | + unset($this->tags[$tag]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public function email_tag_exists( $tag ) { |
|
89 | - return array_key_exists( $tag, $this->tags ); |
|
88 | + public function email_tag_exists($tag) { |
|
89 | + return array_key_exists($tag, $this->tags); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Content with email tags filtered out. |
112 | 112 | */ |
113 | - public function do_tags( $content, $payment_id ) { |
|
113 | + public function do_tags($content, $payment_id) { |
|
114 | 114 | |
115 | 115 | // Check if there is at least one tag added. |
116 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
116 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
117 | 117 | return $content; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->payment_id = $payment_id; |
121 | 121 | |
122 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
122 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
123 | 123 | |
124 | 124 | $this->payment_id = null; |
125 | 125 | |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function do_tag( $m ) { |
|
138 | + public function do_tag($m) { |
|
139 | 139 | |
140 | 140 | // Get tag |
141 | 141 | $tag = $m[1]; |
142 | 142 | |
143 | 143 | // Return tag if tag not set |
144 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
144 | + if ( ! $this->email_tag_exists($tag)) { |
|
145 | 145 | return $m[0]; |
146 | 146 | } |
147 | 147 | |
148 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); |
|
148 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | * @param string $description Description of the email tag added |
160 | 160 | * @param callable $func Hook to run when email tag is found |
161 | 161 | */ |
162 | -function give_add_email_tag( $tag, $description, $func ) { |
|
163 | - Give()->email_tags->add( $tag, $description, $func ); |
|
162 | +function give_add_email_tag($tag, $description, $func) { |
|
163 | + Give()->email_tags->add($tag, $description, $func); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param string $tag Email tag to remove hook from |
172 | 172 | */ |
173 | -function give_remove_email_tag( $tag ) { |
|
174 | - Give()->email_tags->remove( $tag ); |
|
173 | +function give_remove_email_tag($tag) { |
|
174 | + Give()->email_tags->remove($tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return bool |
185 | 185 | */ |
186 | -function give_email_tag_exists( $tag ) { |
|
187 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
186 | +function give_email_tag_exists($tag) { |
|
187 | + return Give()->email_tags->email_tag_exists($tag); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $email_tags = give_get_email_tags(); |
212 | 212 | |
213 | 213 | ob_start(); |
214 | - if ( count( $email_tags ) > 0 ) : ?> |
|
214 | + if (count($email_tags) > 0) : ?> |
|
215 | 215 | <div class="give-email-tags-wrap"> |
216 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
216 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
217 | 217 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
218 | 218 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
219 | 219 | </span> |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string Content with email tags filtered out. |
237 | 237 | */ |
238 | -function give_do_email_tags( $content, $payment_id ) { |
|
238 | +function give_do_email_tags($content, $payment_id) { |
|
239 | 239 | |
240 | 240 | // Replace all tags |
241 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
241 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
242 | 242 | |
243 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
243 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
244 | 244 | |
245 | 245 | // Return content |
246 | 246 | return $content; |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @since 1.0 |
261 | 261 | */ |
262 | - do_action( 'give_add_email_tags' ); |
|
262 | + do_action('give_add_email_tags'); |
|
263 | 263 | } |
264 | 264 | |
265 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
265 | +add_action('init', 'give_load_email_tags', - 999); |
|
266 | 266 | |
267 | 267 | |
268 | 268 | /** |
@@ -276,97 +276,97 @@ discard block |
||
276 | 276 | $email_tags = array( |
277 | 277 | array( |
278 | 278 | 'tag' => 'donation', |
279 | - 'description' => __( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
279 | + 'description' => __('The donation form name, and the donation level (if applicable).', 'give'), |
|
280 | 280 | 'function' => 'give_email_tag_donation', |
281 | 281 | ), |
282 | 282 | array( |
283 | 283 | 'tag' => 'form_title', |
284 | - 'description' => __( 'The donation form name.', 'give' ), |
|
284 | + 'description' => __('The donation form name.', 'give'), |
|
285 | 285 | 'function' => 'give_email_tag_form_title', |
286 | 286 | ), |
287 | 287 | array( |
288 | 288 | 'tag' => 'amount', |
289 | - 'description' => __( 'The total donation amount with currency sign.', 'give' ), |
|
289 | + 'description' => __('The total donation amount with currency sign.', 'give'), |
|
290 | 290 | 'function' => 'give_email_tag_amount', |
291 | 291 | ), |
292 | 292 | array( |
293 | 293 | 'tag' => 'price', |
294 | - 'description' => __( 'The total donation amount with currency sign.', 'give' ), |
|
294 | + 'description' => __('The total donation amount with currency sign.', 'give'), |
|
295 | 295 | 'function' => 'give_email_tag_price', |
296 | 296 | ), |
297 | 297 | array( |
298 | 298 | 'tag' => 'name', |
299 | - 'description' => __( 'The donor\'s first name.', 'give' ), |
|
299 | + 'description' => __('The donor\'s first name.', 'give'), |
|
300 | 300 | 'function' => 'give_email_tag_first_name', |
301 | 301 | ), |
302 | 302 | array( |
303 | 303 | 'tag' => 'fullname', |
304 | - 'description' => __( 'The donor\'s full name, first and last.', 'give' ), |
|
304 | + 'description' => __('The donor\'s full name, first and last.', 'give'), |
|
305 | 305 | 'function' => 'give_email_tag_fullname', |
306 | 306 | ), |
307 | 307 | array( |
308 | 308 | 'tag' => 'username', |
309 | - 'description' => __( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
309 | + 'description' => __('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
310 | 310 | 'function' => 'give_email_tag_username', |
311 | 311 | ), |
312 | 312 | array( |
313 | 313 | 'tag' => 'user_email', |
314 | - 'description' => __( 'The donor\'s email address.', 'give' ), |
|
314 | + 'description' => __('The donor\'s email address.', 'give'), |
|
315 | 315 | 'function' => 'give_email_tag_user_email', |
316 | 316 | ), |
317 | 317 | array( |
318 | 318 | 'tag' => 'billing_address', |
319 | - 'description' => __( 'The donor\'s billing address.', 'give' ), |
|
319 | + 'description' => __('The donor\'s billing address.', 'give'), |
|
320 | 320 | 'function' => 'give_email_tag_billing_address', |
321 | 321 | ), |
322 | 322 | array( |
323 | 323 | 'tag' => 'date', |
324 | - 'description' => __( 'The date of the donation.', 'give' ), |
|
324 | + 'description' => __('The date of the donation.', 'give'), |
|
325 | 325 | 'function' => 'give_email_tag_date', |
326 | 326 | ), |
327 | 327 | array( |
328 | 328 | 'tag' => 'payment_id', |
329 | - 'description' => __( 'The unique ID number for this donation.', 'give' ), |
|
329 | + 'description' => __('The unique ID number for this donation.', 'give'), |
|
330 | 330 | 'function' => 'give_email_tag_payment_id', |
331 | 331 | ), |
332 | 332 | array( |
333 | 333 | 'tag' => 'receipt_id', |
334 | - 'description' => __( 'The unique ID number for this donation receipt.', 'give' ), |
|
334 | + 'description' => __('The unique ID number for this donation receipt.', 'give'), |
|
335 | 335 | 'function' => 'give_email_tag_receipt_id', |
336 | 336 | ), |
337 | 337 | array( |
338 | 338 | 'tag' => 'payment_method', |
339 | - 'description' => __( 'The method of payment used for this donation.', 'give' ), |
|
339 | + 'description' => __('The method of payment used for this donation.', 'give'), |
|
340 | 340 | 'function' => 'give_email_tag_payment_method', |
341 | 341 | ), |
342 | 342 | array( |
343 | 343 | 'tag' => 'sitename', |
344 | - 'description' => __( 'The name of your site.', 'give' ), |
|
344 | + 'description' => __('The name of your site.', 'give'), |
|
345 | 345 | 'function' => 'give_email_tag_sitename', |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'tag' => 'receipt_link', |
349 | - 'description' => __( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
349 | + 'description' => __('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
350 | 350 | 'function' => 'give_email_tag_receipt_link', |
351 | 351 | ), |
352 | 352 | array( |
353 | 353 | 'tag' => 'receipt_link_url', |
354 | - 'description' => __( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
354 | + 'description' => __('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
355 | 355 | 'function' => 'give_email_tag_receipt_link_url', |
356 | 356 | ), |
357 | 357 | ); |
358 | 358 | |
359 | 359 | // Apply give_email_tags filter |
360 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
360 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
361 | 361 | |
362 | 362 | // Add email tags |
363 | - foreach ( $email_tags as $email_tag ) { |
|
364 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
363 | + foreach ($email_tags as $email_tag) { |
|
364 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | } |
368 | 368 | |
369 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
369 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
370 | 370 | |
371 | 371 | |
372 | 372 | /** |
@@ -378,15 +378,15 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @return string name |
380 | 380 | */ |
381 | -function give_email_tag_first_name( $payment_id ) { |
|
382 | - $payment = new Give_Payment( $payment_id ); |
|
381 | +function give_email_tag_first_name($payment_id) { |
|
382 | + $payment = new Give_Payment($payment_id); |
|
383 | 383 | $user_info = $payment->user_info; |
384 | 384 | |
385 | - if ( empty( $user_info ) ) { |
|
385 | + if (empty($user_info)) { |
|
386 | 386 | return ''; |
387 | 387 | } |
388 | 388 | |
389 | - $email_name = give_get_email_names( $user_info ); |
|
389 | + $email_name = give_get_email_names($user_info); |
|
390 | 390 | |
391 | 391 | return $email_name['name']; |
392 | 392 | } |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return string fullname |
402 | 402 | */ |
403 | -function give_email_tag_fullname( $payment_id ) { |
|
404 | - $payment = new Give_Payment( $payment_id ); |
|
403 | +function give_email_tag_fullname($payment_id) { |
|
404 | + $payment = new Give_Payment($payment_id); |
|
405 | 405 | $user_info = $payment->user_info; |
406 | 406 | |
407 | - if ( empty( $user_info ) ) { |
|
407 | + if (empty($user_info)) { |
|
408 | 408 | return ''; |
409 | 409 | } |
410 | 410 | |
411 | - $email_name = give_get_email_names( $user_info ); |
|
411 | + $email_name = give_get_email_names($user_info); |
|
412 | 412 | |
413 | 413 | return $email_name['fullname']; |
414 | 414 | } |
@@ -422,15 +422,15 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @return string username. |
424 | 424 | */ |
425 | -function give_email_tag_username( $payment_id ) { |
|
426 | - $payment = new Give_Payment( $payment_id ); |
|
425 | +function give_email_tag_username($payment_id) { |
|
426 | + $payment = new Give_Payment($payment_id); |
|
427 | 427 | $user_info = $payment->user_info; |
428 | 428 | |
429 | - if ( empty( $user_info ) ) { |
|
429 | + if (empty($user_info)) { |
|
430 | 430 | return ''; |
431 | 431 | } |
432 | 432 | |
433 | - $email_name = give_get_email_names( $user_info ); |
|
433 | + $email_name = give_get_email_names($user_info); |
|
434 | 434 | |
435 | 435 | return $email_name['username']; |
436 | 436 | } |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @return string user_email |
446 | 446 | */ |
447 | -function give_email_tag_user_email( $payment_id ) { |
|
448 | - $payment = new Give_Payment( $payment_id ); |
|
447 | +function give_email_tag_user_email($payment_id) { |
|
448 | + $payment = new Give_Payment($payment_id); |
|
449 | 449 | |
450 | 450 | return $payment->email; |
451 | 451 | } |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return string billing_address |
461 | 461 | */ |
462 | -function give_email_tag_billing_address( $payment_id ) { |
|
463 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
464 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
462 | +function give_email_tag_billing_address($payment_id) { |
|
463 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
464 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
465 | 465 | 'line1' => '', |
466 | 466 | 'line2' => '', |
467 | 467 | 'city' => '', |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | ); |
472 | 472 | |
473 | 473 | $return = $user_address['line1']; |
474 | - if ( ! empty( $user_address['line2'] ) ) { |
|
475 | - $return .= ', ' . $user_address['line2']; |
|
474 | + if ( ! empty($user_address['line2'])) { |
|
475 | + $return .= ', '.$user_address['line2']; |
|
476 | 476 | } |
477 | - if ( ! empty( $user_address['city'] ) ) { |
|
478 | - $return .= "\n" . $user_address['city']; |
|
477 | + if ( ! empty($user_address['city'])) { |
|
478 | + $return .= "\n".$user_address['city']; |
|
479 | 479 | } |
480 | - if ( ! empty( $user_address['state'] ) ) { |
|
481 | - $return .= ', ' . $user_address['state']; |
|
480 | + if ( ! empty($user_address['state'])) { |
|
481 | + $return .= ', '.$user_address['state']; |
|
482 | 482 | } |
483 | - if ( ! empty( $user_address['zip'] ) ) { |
|
484 | - $return .= ' ' . $user_address['zip']; |
|
483 | + if ( ! empty($user_address['zip'])) { |
|
484 | + $return .= ' '.$user_address['zip']; |
|
485 | 485 | } |
486 | - if ( ! empty( $user_address['country'] ) ) { |
|
487 | - $return .= "\n" . give_get_country_name_by_key( $user_address['country'] ); |
|
486 | + if ( ! empty($user_address['country'])) { |
|
487 | + $return .= "\n".give_get_country_name_by_key($user_address['country']); |
|
488 | 488 | } |
489 | 489 | |
490 | - if ( empty( $return ) ) { |
|
491 | - $return = __( 'None provided', 'give' ); |
|
490 | + if (empty($return)) { |
|
491 | + $return = __('None provided', 'give'); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | return apply_filters('give_email_tag_billing_address', $return, $payment_id); |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @return string date |
506 | 506 | */ |
507 | -function give_email_tag_date( $payment_id ) { |
|
508 | - $payment = new Give_Payment( $payment_id ); |
|
507 | +function give_email_tag_date($payment_id) { |
|
508 | + $payment = new Give_Payment($payment_id); |
|
509 | 509 | |
510 | - return date_i18n( give_date_format(), strtotime( $payment->date ) ); |
|
510 | + return date_i18n(give_date_format(), strtotime($payment->date)); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -519,11 +519,11 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return string amount |
521 | 521 | */ |
522 | -function give_email_tag_amount( $payment_id ) { |
|
523 | - $payment = new Give_Payment( $payment_id ); |
|
524 | - $give_amount = give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), array( 'currency_code' => $payment->currency ) ); |
|
522 | +function give_email_tag_amount($payment_id) { |
|
523 | + $payment = new Give_Payment($payment_id); |
|
524 | + $give_amount = give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), array('currency_code' => $payment->currency)); |
|
525 | 525 | |
526 | - return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
526 | + return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @return string price |
537 | 537 | */ |
538 | -function give_email_tag_price( $payment_id ) { |
|
539 | - return give_email_tag_amount( $payment_id ); |
|
538 | +function give_email_tag_price($payment_id) { |
|
539 | + return give_email_tag_amount($payment_id); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | /** |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @return int payment_id |
550 | 550 | */ |
551 | -function give_email_tag_payment_id( $payment_id ) { |
|
552 | - $payment = new Give_Payment( $payment_id ); |
|
551 | +function give_email_tag_payment_id($payment_id) { |
|
552 | + $payment = new Give_Payment($payment_id); |
|
553 | 553 | |
554 | 554 | return $payment->number; |
555 | 555 | } |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * |
564 | 564 | * @return string receipt_id |
565 | 565 | */ |
566 | -function give_email_tag_receipt_id( $payment_id ) { |
|
567 | - $payment = new Give_Payment( $payment_id ); |
|
566 | +function give_email_tag_receipt_id($payment_id) { |
|
567 | + $payment = new Give_Payment($payment_id); |
|
568 | 568 | |
569 | 569 | return $payment->key; |
570 | 570 | } |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return string $form_title |
580 | 580 | */ |
581 | -function give_email_tag_donation( $payment_id ) { |
|
582 | - $payment = new Give_Payment( $payment_id ); |
|
581 | +function give_email_tag_donation($payment_id) { |
|
582 | + $payment = new Give_Payment($payment_id); |
|
583 | 583 | $payment_meta = $payment->payment_meta; |
584 | - $level_title = give_has_variable_prices( $payment->form_id ); |
|
584 | + $level_title = give_has_variable_prices($payment->form_id); |
|
585 | 585 | $separator = $level_title ? '-' : ''; |
586 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) ); |
|
586 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, false, $separator)); |
|
587 | 587 | |
588 | - return ! empty( $form_title ) ? $form_title : ''; |
|
588 | + return ! empty($form_title) ? $form_title : ''; |
|
589 | 589 | |
590 | 590 | } |
591 | 591 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return string $form_title |
600 | 600 | */ |
601 | -function give_email_tag_form_title( $payment_id ) { |
|
602 | - $payment = new Give_Payment( $payment_id ); |
|
601 | +function give_email_tag_form_title($payment_id) { |
|
602 | + $payment = new Give_Payment($payment_id); |
|
603 | 603 | $payment_meta = $payment->payment_meta; |
604 | 604 | |
605 | - return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : ''; |
|
605 | + return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : ''; |
|
606 | 606 | |
607 | 607 | } |
608 | 608 | |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @return string gateway |
617 | 617 | */ |
618 | -function give_email_tag_payment_method( $payment_id ) { |
|
619 | - $payment = new Give_Payment( $payment_id ); |
|
618 | +function give_email_tag_payment_method($payment_id) { |
|
619 | + $payment = new Give_Payment($payment_id); |
|
620 | 620 | |
621 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
621 | + return give_get_gateway_checkout_label($payment->gateway); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | /** |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | * |
631 | 631 | * @return string sitename |
632 | 632 | */ |
633 | -function give_email_tag_sitename( $payment_id ) { |
|
634 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
633 | +function give_email_tag_sitename($payment_id) { |
|
634 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
@@ -643,18 +643,18 @@ discard block |
||
643 | 643 | * |
644 | 644 | * @return string receipt_link |
645 | 645 | */ |
646 | -function give_email_tag_receipt_link( $payment_id ) { |
|
646 | +function give_email_tag_receipt_link($payment_id) { |
|
647 | 647 | |
648 | - $receipt_url = esc_url( add_query_arg( array( |
|
649 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
650 | - ), give_get_history_page_uri() ) ); |
|
648 | + $receipt_url = esc_url(add_query_arg(array( |
|
649 | + 'payment_key' => give_get_payment_key($payment_id), |
|
650 | + ), give_get_history_page_uri())); |
|
651 | 651 | $formatted = sprintf( |
652 | 652 | '<a href="%1$s">%2$s</a>', |
653 | 653 | $receipt_url, |
654 | - __( 'View it in your browser »', 'give' ) |
|
654 | + __('View it in your browser »', 'give') |
|
655 | 655 | ); |
656 | 656 | |
657 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
657 | + if (give_get_option('email_template') !== 'none') { |
|
658 | 658 | return $formatted; |
659 | 659 | } else { |
660 | 660 | return $receipt_url; |
@@ -673,11 +673,11 @@ discard block |
||
673 | 673 | * |
674 | 674 | * @return string receipt_url |
675 | 675 | */ |
676 | -function give_email_tag_receipt_link_url( $payment_id ) { |
|
676 | +function give_email_tag_receipt_link_url($payment_id) { |
|
677 | 677 | |
678 | - $receipt_url = esc_url( add_query_arg( array( |
|
679 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
680 | - ), give_get_history_page_uri() ) ); |
|
678 | + $receipt_url = esc_url(add_query_arg(array( |
|
679 | + 'payment_key' => give_get_payment_key($payment_id), |
|
680 | + ), give_get_history_page_uri())); |
|
681 | 681 | |
682 | 682 | return $receipt_url; |
683 | 683 |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | - array( |
|
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | - 'id' => 'email_settings_docs_link', |
|
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
87 | - 'type' => 'give_docs_link', |
|
88 | - ), |
|
82 | + array( |
|
83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | + 'id' => 'email_settings_docs_link', |
|
85 | + 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | + 'title' => __( 'Email Settings', 'give' ), |
|
87 | + 'type' => 'give_docs_link', |
|
88 | + ), |
|
89 | 89 | array( |
90 | 90 | 'id' => 'give_title_email_settings_1', |
91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | - array( |
|
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | - 'type' => 'give_docs_link', |
|
127 | - ), |
|
121 | + array( |
|
122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
124 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | + 'type' => 'give_docs_link', |
|
127 | + ), |
|
128 | 128 | array( |
129 | 129 | 'id' => 'give_title_email_settings_2', |
130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'type' => 'textarea', |
176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
177 | 177 | ), |
178 | - array( |
|
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | - 'id' => 'donation_notification_settings_docs_link', |
|
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | - 'type' => 'give_docs_link', |
|
184 | - ), |
|
178 | + array( |
|
179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | + 'id' => 'donation_notification_settings_docs_link', |
|
181 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | + 'type' => 'give_docs_link', |
|
184 | + ), |
|
185 | 185 | array( |
186 | 186 | 'id' => 'give_title_email_settings_3', |
187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'email-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'email_template', |
57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
58 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
57 | + 'name' => esc_html__('Email Template', 'give'), |
|
58 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => give_get_email_templates() |
61 | 61 | ), |
62 | 62 | array( |
63 | 63 | 'id' => 'email_logo', |
64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
64 | + 'name' => esc_html__('Logo', 'give'), |
|
65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
66 | 66 | 'type' => 'file' |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'id' => 'from_name', |
70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
72 | - 'default' => get_bloginfo( 'name' ), |
|
70 | + 'name' => esc_html__('From Name', 'give'), |
|
71 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
72 | + 'default' => get_bloginfo('name'), |
|
73 | 73 | 'type' => 'text' |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'id' => 'from_email', |
77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
78 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
77 | + 'name' => esc_html__('From Email', 'give'), |
|
78 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
79 | + 'default' => get_bloginfo('admin_email'), |
|
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | 82 | array( |
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
84 | 84 | 'id' => 'email_settings_docs_link', |
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
85 | + 'url' => esc_url('http://docs.givewp.com/settings-emails'), |
|
86 | + 'title' => __('Email Settings', 'give'), |
|
87 | 87 | 'type' => 'give_docs_link', |
88 | 88 | ), |
89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'id' => 'donation_subject', |
105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
108 | 108 | 'type' => 'text' |
109 | 109 | ), |
110 | 110 | array( |
111 | 111 | 'id' => 'donation_receipt', |
112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
113 | 113 | 'desc' => sprintf( |
114 | 114 | /* translators: %s: emails tags list */ |
115 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give' ), |
|
115 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give'), |
|
116 | 116 | '<br/>'.give_get_emails_tags_list() |
117 | 117 | ), |
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-receipt'), |
|
125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => 'admin_notices', |
144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Enable/Disable all admin notifications from Give completely.', 'give' ), |
|
144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
145 | + 'desc' => esc_html__('Enable/Disable all admin notifications from Give completely.', 'give'), |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ) |
152 | 152 | ), |
153 | 153 | array( |
154 | 154 | 'id' => 'donation_notification_subject', |
155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
156 | - 'desc' => esc_html__( 'Enter the subject line for the admin donation notification email.', 'give' ), |
|
155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
156 | + 'desc' => esc_html__('Enter the subject line for the admin donation notification email.', 'give'), |
|
157 | 157 | 'type' => 'text', |
158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
159 | 159 | ), |
160 | 160 | array( |
161 | 161 | 'id' => 'donation_notification', |
162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
163 | 163 | 'desc' => sprintf( |
164 | 164 | /* translators: %s: emails tags list */ |
165 | - __( 'Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give' ), |
|
165 | + __('Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give'), |
|
166 | 166 | '<br/>'.give_get_emails_tags_list() |
167 | 167 | ), |
168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ), |
171 | 171 | array( |
172 | 172 | 'id' => 'admin_notice_emails', |
173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
175 | 175 | 'type' => 'textarea', |
176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
176 | + 'default' => get_bloginfo('admin_email') |
|
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
181 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
183 | 183 | 'type' => 'give_docs_link', |
184 | 184 | ), |
185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Filter the emails settings. |
195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
196 | 196 | */ |
197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.8 |
203 | 203 | * @param array $settings |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
206 | 206 | |
207 | 207 | // Output. |
208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_sections() { |
218 | 218 | $sections = array( |
219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
222 | 222 | ); |
223 | 223 | |
224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_profile_editor' ); |
|
26 | + parent::__construct('give_profile_editor'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |