@@ -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 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | ); |
52 | 52 | |
53 | 53 | // Get current page. |
54 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
54 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
55 | 55 | |
56 | 56 | // Bailout. |
57 | 57 | if ( |
58 | - empty( $current_page ) |
|
59 | - || empty( $_GET['_wp_http_referer'] ) |
|
60 | - || ! in_array( $current_page, $give_pages ) |
|
58 | + empty($current_page) |
|
59 | + || empty($_GET['_wp_http_referer']) |
|
60 | + || ! in_array($current_page, $give_pages) |
|
61 | 61 | ) { |
62 | 62 | return false; |
63 | 63 | } |
@@ -67,21 +67,21 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.8 |
69 | 69 | */ |
70 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
70 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
71 | 71 | |
72 | - if ( $redirect ) { |
|
72 | + if ($redirect) { |
|
73 | 73 | // Redirect. |
74 | 74 | wp_redirect( |
75 | 75 | remove_query_arg( |
76 | - array( '_wp_http_referer', '_wpnonce' ), |
|
77 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
76 | + array('_wp_http_referer', '_wpnonce'), |
|
77 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
78 | 78 | ) |
79 | 79 | ); |
80 | 80 | exit; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
84 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
85 | 85 | |
86 | 86 | |
87 | 87 | /** |
@@ -95,25 +95,25 @@ discard block |
||
95 | 95 | */ |
96 | 96 | function give_hide_outdated_php_notice() { |
97 | 97 | |
98 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
98 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
99 | 99 | give_die(); |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Transient key name. |
103 | 103 | $transient_key = "_give_hide_outdated_php_notices_shortly"; |
104 | 104 | |
105 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
105 | + if (Give_Cache::get($transient_key, true)) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
109 | 109 | // Hide notice for 24 hours. |
110 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
110 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
111 | 111 | |
112 | 112 | give_die(); |
113 | 113 | |
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
116 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Register admin notices. |
@@ -122,43 +122,43 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function _give_register_admin_notices() { |
124 | 124 | // Bailout. |
125 | - if( ! is_admin() ) { |
|
125 | + if ( ! is_admin()) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Add PHP version update notice |
130 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
130 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
131 | 131 | |
132 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
133 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
134 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
135 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
136 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
137 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
138 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
132 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
133 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
134 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
135 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
136 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
137 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
138 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
139 | 139 | |
140 | - Give()->notices->register_notice( array( |
|
140 | + Give()->notices->register_notice(array( |
|
141 | 141 | 'id' => 'give-invalid-php-version', |
142 | 142 | 'type' => 'error', |
143 | 143 | 'description' => $notice_desc, |
144 | 144 | 'dismissible_type' => 'user', |
145 | 145 | 'dismiss_interval' => 'shortly', |
146 | - ) ); |
|
146 | + )); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Add payment bulk notice. |
150 | 150 | if ( |
151 | - current_user_can( 'edit_give_payments' ) |
|
152 | - && isset( $_GET['action'] ) |
|
153 | - && ! empty( $_GET['action'] ) |
|
154 | - && isset( $_GET['payment'] ) |
|
155 | - && ! empty( $_GET['payment'] ) |
|
151 | + current_user_can('edit_give_payments') |
|
152 | + && isset($_GET['action']) |
|
153 | + && ! empty($_GET['action']) |
|
154 | + && isset($_GET['payment']) |
|
155 | + && ! empty($_GET['payment']) |
|
156 | 156 | ) { |
157 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
157 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
158 | 158 | |
159 | - switch ( $_GET['action'] ) { |
|
159 | + switch ($_GET['action']) { |
|
160 | 160 | case 'delete': |
161 | - Give()->notices->register_notice( array( |
|
161 | + Give()->notices->register_notice(array( |
|
162 | 162 | 'id' => 'bulk_action_delete', |
163 | 163 | 'type' => 'updated', |
164 | 164 | 'description' => sprintf( |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | ), |
171 | 171 | $payment_count ), |
172 | 172 | 'show' => true, |
173 | - ) ); |
|
173 | + )); |
|
174 | 174 | |
175 | 175 | break; |
176 | 176 | |
177 | 177 | case 'resend-receipt': |
178 | - Give()->notices->register_notice( array( |
|
178 | + Give()->notices->register_notice(array( |
|
179 | 179 | 'id' => 'bulk_action_resend_receipt', |
180 | 180 | 'type' => 'updated', |
181 | 181 | 'description' => sprintf( |
@@ -188,196 +188,196 @@ discard block |
||
188 | 188 | $payment_count |
189 | 189 | ), |
190 | 190 | 'show' => true, |
191 | - ) ); |
|
191 | + )); |
|
192 | 192 | break; |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Add give message notices. |
197 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
197 | + if ( ! empty($_GET['give-message'])) { |
|
198 | 198 | // Donation reports errors. |
199 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
200 | - switch ( $_GET['give-message'] ) { |
|
199 | + if (current_user_can('view_give_reports')) { |
|
200 | + switch ($_GET['give-message']) { |
|
201 | 201 | case 'donation_deleted' : |
202 | - Give()->notices->register_notice( array( |
|
202 | + Give()->notices->register_notice(array( |
|
203 | 203 | 'id' => 'give-donation-deleted', |
204 | 204 | 'type' => 'updated', |
205 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
205 | + 'description' => __('The donation has been deleted.', 'give'), |
|
206 | 206 | 'show' => true, |
207 | - ) ); |
|
207 | + )); |
|
208 | 208 | break; |
209 | 209 | case 'email_sent' : |
210 | - Give()->notices->register_notice( array( |
|
210 | + Give()->notices->register_notice(array( |
|
211 | 211 | 'id' => 'give-payment-sent', |
212 | 212 | 'type' => 'updated', |
213 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
213 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
214 | 214 | 'show' => true, |
215 | - ) ); |
|
215 | + )); |
|
216 | 216 | break; |
217 | 217 | case 'refreshed-reports' : |
218 | - Give()->notices->register_notice( array( |
|
218 | + Give()->notices->register_notice(array( |
|
219 | 219 | 'id' => 'give-refreshed-reports', |
220 | 220 | 'type' => 'updated', |
221 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
221 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
222 | 222 | 'show' => true, |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | break; |
225 | 225 | case 'donation-note-deleted' : |
226 | - Give()->notices->register_notice( array( |
|
226 | + Give()->notices->register_notice(array( |
|
227 | 227 | 'id' => 'give-donation-note-deleted', |
228 | 228 | 'type' => 'updated', |
229 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
229 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
230 | 230 | 'show' => true, |
231 | - ) ); |
|
231 | + )); |
|
232 | 232 | break; |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Give settings notices and errors. |
237 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
238 | - switch ( $_GET['give-message'] ) { |
|
237 | + if (current_user_can('manage_give_settings')) { |
|
238 | + switch ($_GET['give-message']) { |
|
239 | 239 | case 'settings-imported' : |
240 | - Give()->notices->register_notice( array( |
|
240 | + Give()->notices->register_notice(array( |
|
241 | 241 | 'id' => 'give-settings-imported', |
242 | 242 | 'type' => 'updated', |
243 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
243 | + 'description' => __('The settings have been imported.', 'give'), |
|
244 | 244 | 'show' => true, |
245 | - ) ); |
|
245 | + )); |
|
246 | 246 | break; |
247 | 247 | case 'api-key-generated' : |
248 | - Give()->notices->register_notice( array( |
|
248 | + Give()->notices->register_notice(array( |
|
249 | 249 | 'id' => 'give-api-key-generated', |
250 | 250 | 'type' => 'updated', |
251 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
251 | + 'description' => __('API keys have been generated.', 'give'), |
|
252 | 252 | 'show' => true, |
253 | - ) ); |
|
253 | + )); |
|
254 | 254 | break; |
255 | 255 | case 'api-key-exists' : |
256 | - Give()->notices->register_notice( array( |
|
256 | + Give()->notices->register_notice(array( |
|
257 | 257 | 'id' => 'give-api-key-exists', |
258 | 258 | 'type' => 'updated', |
259 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
259 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
260 | 260 | 'show' => true, |
261 | - ) ); |
|
261 | + )); |
|
262 | 262 | break; |
263 | 263 | case 'api-key-regenerated' : |
264 | - Give()->notices->register_notice( array( |
|
264 | + Give()->notices->register_notice(array( |
|
265 | 265 | 'id' => 'give-api-key-regenerated', |
266 | 266 | 'type' => 'updated', |
267 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
267 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
268 | 268 | 'show' => true, |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | break; |
271 | 271 | case 'api-key-revoked' : |
272 | - Give()->notices->register_notice( array( |
|
272 | + Give()->notices->register_notice(array( |
|
273 | 273 | 'id' => 'give-api-key-revoked', |
274 | 274 | 'type' => 'updated', |
275 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
275 | + 'description' => __('API keys have been revoked.', 'give'), |
|
276 | 276 | 'show' => true, |
277 | - ) ); |
|
277 | + )); |
|
278 | 278 | break; |
279 | 279 | case 'sent-test-email' : |
280 | - Give()->notices->register_notice( array( |
|
280 | + Give()->notices->register_notice(array( |
|
281 | 281 | 'id' => 'give-sent-test-email', |
282 | 282 | 'type' => 'updated', |
283 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
283 | + 'description' => __('The test email has been sent.', 'give'), |
|
284 | 284 | 'show' => true, |
285 | - ) ); |
|
285 | + )); |
|
286 | 286 | break; |
287 | 287 | case 'matched-success-failure-page': |
288 | - Give()->notices->register_notice( array( |
|
288 | + Give()->notices->register_notice(array( |
|
289 | 289 | 'id' => 'give-matched-success-failure-page', |
290 | 290 | 'type' => 'updated', |
291 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
291 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
292 | 292 | 'show' => true, |
293 | - ) ); |
|
293 | + )); |
|
294 | 294 | break; |
295 | 295 | } |
296 | 296 | } |
297 | 297 | // Payments errors. |
298 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
299 | - switch ( $_GET['give-message'] ) { |
|
298 | + if (current_user_can('edit_give_payments')) { |
|
299 | + switch ($_GET['give-message']) { |
|
300 | 300 | case 'note-added' : |
301 | - Give()->notices->register_notice( array( |
|
301 | + Give()->notices->register_notice(array( |
|
302 | 302 | 'id' => 'give-note-added', |
303 | 303 | 'type' => 'updated', |
304 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
304 | + 'description' => __('The donation note has been added.', 'give'), |
|
305 | 305 | 'show' => true, |
306 | - ) ); |
|
306 | + )); |
|
307 | 307 | break; |
308 | 308 | case 'payment-updated' : |
309 | - Give()->notices->register_notice( array( |
|
309 | + Give()->notices->register_notice(array( |
|
310 | 310 | 'id' => 'give-payment-updated', |
311 | 311 | 'type' => 'updated', |
312 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
312 | + 'description' => __('The donation has been updated.', 'give'), |
|
313 | 313 | 'show' => true, |
314 | - ) ); |
|
314 | + )); |
|
315 | 315 | break; |
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
319 | 319 | // Donor Notices. |
320 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
321 | - switch ( $_GET['give-message'] ) { |
|
320 | + if (current_user_can('edit_give_payments')) { |
|
321 | + switch ($_GET['give-message']) { |
|
322 | 322 | case 'donor-deleted' : |
323 | - Give()->notices->register_notice( array( |
|
323 | + Give()->notices->register_notice(array( |
|
324 | 324 | 'id' => 'give-donor-deleted', |
325 | 325 | 'type' => 'updated', |
326 | - 'description' => __( 'The donor has been deleted.', 'give' ), |
|
326 | + 'description' => __('The donor has been deleted.', 'give'), |
|
327 | 327 | 'show' => true, |
328 | - ) ); |
|
328 | + )); |
|
329 | 329 | break; |
330 | 330 | |
331 | 331 | case 'email-added' : |
332 | - Give()->notices->register_notice( array( |
|
332 | + Give()->notices->register_notice(array( |
|
333 | 333 | 'id' => 'give-donor-email-added', |
334 | 334 | 'type' => 'updated', |
335 | - 'description' => __( 'Donor email added.', 'give' ), |
|
335 | + 'description' => __('Donor email added.', 'give'), |
|
336 | 336 | 'show' => true, |
337 | - ) ); |
|
337 | + )); |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case 'email-removed' : |
341 | - Give()->notices->register_notice( array( |
|
341 | + Give()->notices->register_notice(array( |
|
342 | 342 | 'id' => 'give-donor-email-removed', |
343 | 343 | 'type' => 'updated', |
344 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
344 | + 'description' => __('Donor email removed.', 'give'), |
|
345 | 345 | 'show' => true, |
346 | - ) ); |
|
346 | + )); |
|
347 | 347 | break; |
348 | 348 | |
349 | 349 | case 'email-remove-failed' : |
350 | - Give()->notices->register_notice( array( |
|
350 | + Give()->notices->register_notice(array( |
|
351 | 351 | 'id' => 'give-donor-email-remove-failed', |
352 | 352 | 'type' => 'updated', |
353 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
353 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
354 | 354 | 'show' => true, |
355 | - ) ); |
|
355 | + )); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'primary-email-updated' : |
359 | - Give()->notices->register_notice( array( |
|
359 | + Give()->notices->register_notice(array( |
|
360 | 360 | 'id' => 'give-donor-primary-email-updated', |
361 | 361 | 'type' => 'updated', |
362 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
362 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
363 | 363 | 'show' => true, |
364 | - ) ); |
|
364 | + )); |
|
365 | 365 | break; |
366 | 366 | |
367 | 367 | case 'primary-email-failed' : |
368 | - Give()->notices->register_notice( array( |
|
368 | + Give()->notices->register_notice(array( |
|
369 | 369 | 'id' => 'give-donor-primary-email-failed', |
370 | 370 | 'type' => 'updated', |
371 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
371 | + 'description' => __('Failed to set primary email.', 'give'), |
|
372 | 372 | 'show' => true, |
373 | - ) ); |
|
373 | + )); |
|
374 | 374 | break; |
375 | 375 | } |
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
380 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
381 | 381 | |
382 | 382 | |
383 | 383 | /** |
@@ -387,27 +387,26 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
391 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
392 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
393 | - give_is_test_mode(); |
|
390 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
391 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
392 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
394 | 393 | |
395 | 394 | if ( |
396 | - ! current_user_can( 'view_give_reports' ) || |
|
395 | + ! current_user_can('view_give_reports') || |
|
397 | 396 | ! $is_test_mode |
398 | 397 | ) { |
399 | 398 | return false; |
400 | 399 | } |
401 | 400 | |
402 | 401 | // Add the main siteadmin menu item. |
403 | - $wp_admin_bar->add_menu( array( |
|
402 | + $wp_admin_bar->add_menu(array( |
|
404 | 403 | 'id' => 'give-test-notice', |
405 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
404 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
406 | 405 | 'parent' => 'top-secondary', |
407 | - 'title' => esc_html__( 'Give Test Mode Active', 'give' ), |
|
408 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
409 | - ) ); |
|
406 | + 'title' => esc_html__('Give Test Mode Active', 'give'), |
|
407 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
408 | + )); |
|
410 | 409 | |
411 | 410 | return true; |
412 | 411 | } |
413 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
414 | 412 | \ No newline at end of file |
413 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
415 | 414 | \ No newline at end of file |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | |
45 | 45 | // Custom CMB2 Settings Fields |
46 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
47 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
48 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
49 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
46 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
47 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
48 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
49 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
50 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
51 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
52 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
53 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 1.0 |
61 | 61 | */ |
62 | 62 | public function init() { |
63 | - register_setting( $this->key, $this->key ); |
|
63 | + register_setting($this->key, $this->key); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function give_update_cmb_meta_box_url( $url ) { |
|
77 | + public function give_update_cmb_meta_box_url($url) { |
|
78 | 78 | // Path to Give's CMB |
79 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
79 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function give_get_settings_tabs() { |
90 | 90 | |
91 | - $settings = $this->give_settings( null ); |
|
91 | + $settings = $this->give_settings(null); |
|
92 | 92 | |
93 | 93 | $tabs = array(); |
94 | - $tabs['general'] = __( 'General', 'give' ); |
|
95 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
96 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
97 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
94 | + $tabs['general'] = __('General', 'give'); |
|
95 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
96 | + $tabs['display'] = __('Display Options', 'give'); |
|
97 | + $tabs['emails'] = __('Emails', 'give'); |
|
98 | 98 | |
99 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
100 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
99 | + if ( ! empty($settings['addons']['fields'])) { |
|
100 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
104 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
103 | + if ( ! empty($settings['licenses']['fields'])) { |
|
104 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
108 | - $tabs['api'] = __( 'API', 'give' ); |
|
109 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
107 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
108 | + $tabs['api'] = __('API', 'give'); |
|
109 | + $tabs['system_info'] = __('System Info', 'give'); |
|
110 | 110 | |
111 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
111 | + return apply_filters('give_settings_tabs', $tabs); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function admin_page_display() { |
121 | 121 | |
122 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
122 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
123 | 123 | |
124 | 124 | ?> |
125 | 125 | |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | <h2 class="nav-tab-wrapper"> |
131 | 131 | <?php |
132 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
132 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
133 | 133 | |
134 | - $tab_url = esc_url( add_query_arg( array( |
|
134 | + $tab_url = esc_url(add_query_arg(array( |
|
135 | 135 | 'settings-updated' => false, |
136 | 136 | 'tab' => $tab_id, |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
140 | 140 | |
141 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
141 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | ?> |
145 | 145 | </h2> |
146 | 146 | |
147 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
147 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
148 | 148 | |
149 | 149 | </div><!-- .wrap --> |
150 | 150 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
169 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
170 | 170 | |
171 | 171 | // only modify the give settings form |
172 | - if ( 'give_settings' == $object_id ) { |
|
172 | + if ('give_settings' == $object_id) { |
|
173 | 173 | |
174 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
174 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - public function give_settings( $active_tab ) { |
|
191 | + public function give_settings($active_tab) { |
|
192 | 192 | |
193 | 193 | $give_settings = array( |
194 | 194 | /** |
@@ -196,99 +196,99 @@ discard block |
||
196 | 196 | */ |
197 | 197 | 'general' => array( |
198 | 198 | 'id' => 'general_settings', |
199 | - 'give_title' => __( 'General Settings', 'give' ), |
|
200 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
201 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
199 | + 'give_title' => __('General Settings', 'give'), |
|
200 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
201 | + 'fields' => apply_filters('give_settings_general', array( |
|
202 | 202 | array( |
203 | - 'name' => __( 'General Settings', 'give' ), |
|
203 | + 'name' => __('General Settings', 'give'), |
|
204 | 204 | 'desc' => '', |
205 | 205 | 'type' => 'give_title', |
206 | 206 | 'id' => 'give_title_general_settings_1', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Success Page', 'give' ), |
|
209 | + 'name' => __('Success Page', 'give'), |
|
210 | 210 | /* translators: %s: [give_receipt] */ |
211 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
211 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
212 | 212 | 'id' => 'success_page', |
213 | 213 | 'type' => 'select', |
214 | - 'options' => give_cmb2_get_post_options( array( |
|
214 | + 'options' => give_cmb2_get_post_options(array( |
|
215 | 215 | 'post_type' => 'page', |
216 | - 'numberposts' => - 1, |
|
217 | - ) ), |
|
216 | + 'numberposts' => -1, |
|
217 | + )), |
|
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
221 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
220 | + 'name' => __('Failed Donation Page', 'give'), |
|
221 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
222 | 222 | 'id' => 'failure_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1, |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1, |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Donation History Page', 'give' ), |
|
230 | + 'name' => __('Donation History Page', 'give'), |
|
231 | 231 | /* translators: %s: [donation_history] */ |
232 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
232 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
233 | 233 | 'id' => 'history_page', |
234 | 234 | 'type' => 'select', |
235 | - 'options' => give_cmb2_get_post_options( array( |
|
235 | + 'options' => give_cmb2_get_post_options(array( |
|
236 | 236 | 'post_type' => 'page', |
237 | - 'numberposts' => - 1, |
|
238 | - ) ), |
|
237 | + 'numberposts' => -1, |
|
238 | + )), |
|
239 | 239 | ), |
240 | 240 | array( |
241 | - 'name' => __( 'Base Country', 'give' ), |
|
242 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
241 | + 'name' => __('Base Country', 'give'), |
|
242 | + 'desc' => __('The country your site operates from.', 'give'), |
|
243 | 243 | 'id' => 'base_country', |
244 | 244 | 'type' => 'select', |
245 | 245 | 'options' => give_get_country_list(), |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => __( 'Currency Settings', 'give' ), |
|
248 | + 'name' => __('Currency Settings', 'give'), |
|
249 | 249 | 'desc' => '', |
250 | 250 | 'type' => 'give_title', |
251 | 251 | 'id' => 'give_title_general_settings_2', |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => __( 'Currency', 'give' ), |
|
255 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
254 | + 'name' => __('Currency', 'give'), |
|
255 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
256 | 256 | 'id' => 'currency', |
257 | 257 | 'type' => 'select', |
258 | 258 | 'options' => give_get_currencies(), |
259 | 259 | 'default' => 'USD', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Currency Position', 'give' ), |
|
263 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
262 | + 'name' => __('Currency Position', 'give'), |
|
263 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
264 | 264 | 'id' => 'currency_position', |
265 | 265 | 'type' => 'select', |
266 | 266 | 'options' => array( |
267 | 267 | /* translators: %s: currency symbol */ |
268 | - 'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
268 | + 'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'after' => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'after' => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | ), |
272 | 272 | 'default' => 'before', |
273 | 273 | ), |
274 | 274 | array( |
275 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
276 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
275 | + 'name' => __('Thousands Separator', 'give'), |
|
276 | + 'desc' => __('The symbol (usually , or .) to separate thousands.', 'give'), |
|
277 | 277 | 'id' => 'thousands_separator', |
278 | 278 | 'type' => 'text_small', |
279 | 279 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
280 | 280 | 'default' => ',', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
284 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
283 | + 'name' => __('Decimal Separator', 'give'), |
|
284 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
285 | 285 | 'id' => 'decimal_separator', |
286 | 286 | 'type' => 'text_small', |
287 | 287 | 'default' => '.', |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
291 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
290 | + 'name' => __('Number of Decimals', 'give'), |
|
291 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
292 | 292 | 'id' => 'number_decimals', |
293 | 293 | 'type' => 'text_small', |
294 | 294 | 'default' => 2, |
@@ -302,83 +302,83 @@ discard block |
||
302 | 302 | */ |
303 | 303 | 'gateways' => array( |
304 | 304 | 'id' => 'payment_gateways', |
305 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
306 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
307 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
305 | + 'give_title' => __('Payment Gateways', 'give'), |
|
306 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
307 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
308 | 308 | array( |
309 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
309 | + 'name' => __('Gateways Settings', 'give'), |
|
310 | 310 | 'desc' => '', |
311 | 311 | 'id' => 'give_title_gateway_settings_1', |
312 | 312 | 'type' => 'give_title', |
313 | 313 | ), |
314 | 314 | array( |
315 | - 'name' => __( 'Test Mode', 'give' ), |
|
316 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
315 | + 'name' => __('Test Mode', 'give'), |
|
316 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
317 | 317 | 'id' => 'test_mode', |
318 | 318 | 'type' => 'checkbox', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
322 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
321 | + 'name' => __('Enabled Gateways', 'give'), |
|
322 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
323 | 323 | 'id' => 'gateways', |
324 | 324 | 'type' => 'enabled_gateways', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Default Gateway', 'give' ), |
|
328 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
327 | + 'name' => __('Default Gateway', 'give'), |
|
328 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
329 | 329 | 'id' => 'default_gateway', |
330 | 330 | 'type' => 'default_gateway', |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
333 | + 'name' => __('PayPal Standard', 'give'), |
|
334 | 334 | 'desc' => '', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_2', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'PayPal Email', 'give' ), |
|
340 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
339 | + 'name' => __('PayPal Email', 'give'), |
|
340 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
341 | 341 | 'id' => 'paypal_email', |
342 | 342 | 'type' => 'text_email', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
346 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
345 | + 'name' => __('PayPal Page Style', 'give'), |
|
346 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
347 | 347 | 'id' => 'paypal_page_style', |
348 | 348 | 'type' => 'text', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
352 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
351 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
352 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
353 | 353 | 'id' => 'paypal_button_type', |
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'donation' => __( 'Donation', 'give' ), |
|
357 | - 'standard' => __( 'Standard Transaction', 'give' ), |
|
356 | + 'donation' => __('Donation', 'give'), |
|
357 | + 'standard' => __('Standard Transaction', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
363 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
362 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
363 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
364 | 364 | 'id' => 'disable_paypal_verification', |
365 | 365 | 'type' => 'checkbox', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Offline Donations', 'give' ), |
|
368 | + 'name' => __('Offline Donations', 'give'), |
|
369 | 369 | 'desc' => '', |
370 | 370 | 'type' => 'give_title', |
371 | 371 | 'id' => 'give_title_gateway_settings_3', |
372 | 372 | ), |
373 | 373 | array( |
374 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
375 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
374 | + 'name' => __('Collect Billing Details', 'give'), |
|
375 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
376 | 376 | 'id' => 'give_offline_donation_enable_billing_fields', |
377 | 377 | 'type' => 'checkbox', |
378 | 378 | ), |
379 | 379 | array( |
380 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
381 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
380 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
381 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
382 | 382 | 'id' => 'global_offline_donation_content', |
383 | 383 | 'default' => give_get_default_offline_donation_content(), |
384 | 384 | 'type' => 'wysiwyg', |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
391 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
390 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
391 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
392 | 392 | 'id' => 'offline_donation_subject', |
393 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
393 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
394 | 394 | 'type' => 'text', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
398 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
397 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
398 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
399 | 399 | 'id' => 'global_offline_donation_email', |
400 | 400 | 'default' => give_get_default_offline_donation_email_content(), |
401 | 401 | 'type' => 'wysiwyg', |
@@ -409,104 +409,104 @@ discard block |
||
409 | 409 | /** Display Settings */ |
410 | 410 | 'display' => array( |
411 | 411 | 'id' => 'display_settings', |
412 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
413 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
414 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
412 | + 'give_title' => __('Display Settings', 'give'), |
|
413 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
414 | + 'fields' => apply_filters('give_settings_display', array( |
|
415 | 415 | array( |
416 | - 'name' => __( 'Display Settings', 'give' ), |
|
416 | + 'name' => __('Display Settings', 'give'), |
|
417 | 417 | 'desc' => '', |
418 | 418 | 'id' => 'give_title_display_settings_1', |
419 | 419 | 'type' => 'give_title', |
420 | 420 | ), |
421 | 421 | array( |
422 | - 'name' => __( 'Disable CSS', 'give' ), |
|
423 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
422 | + 'name' => __('Disable CSS', 'give'), |
|
423 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
424 | 424 | 'id' => 'disable_css', |
425 | 425 | 'type' => 'checkbox', |
426 | 426 | ), |
427 | 427 | array( |
428 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
428 | + 'name' => __('Enable Floating Labels', 'give'), |
|
429 | 429 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
430 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
430 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
431 | 431 | 'a' => array( |
432 | 432 | 'href' => array(), |
433 | 433 | 'target' => array(), |
434 | 434 | ), |
435 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
435 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
436 | 436 | 'id' => 'floatlabels', |
437 | 437 | 'type' => 'checkbox', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
440 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
441 | 441 | /* translators: %s: about page URL */ |
442 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
442 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
443 | 443 | 'a' => array( |
444 | 444 | 'href' => array(), |
445 | 445 | 'target' => array(), |
446 | 446 | ), |
447 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox', |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => __( 'Post Types', 'give' ), |
|
452 | + 'name' => __('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title', |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => __('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox', |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => __('Disable Form Archives', 'give'), |
|
465 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox', |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
471 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
470 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
471 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox', |
474 | 474 | ), |
475 | 475 | array( |
476 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
477 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
476 | + 'name' => __('Featured Image Size', 'give'), |
|
477 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
478 | 478 | 'id' => 'featured_image_size', |
479 | 479 | 'type' => 'select', |
480 | 480 | 'default' => 'large', |
481 | 481 | 'options' => give_get_featured_image_sizes(), |
482 | 482 | ), |
483 | 483 | array( |
484 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
485 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
484 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
485 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
486 | 486 | 'id' => 'disable_form_featured_img', |
487 | 487 | 'type' => 'checkbox', |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
491 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
490 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
491 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_sidebar', |
493 | 493 | 'type' => 'checkbox', |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => __( 'Taxonomies', 'give' ), |
|
496 | + 'name' => __('Taxonomies', 'give'), |
|
497 | 497 | 'desc' => '', |
498 | 498 | 'id' => 'give_title_display_settings_3', |
499 | 499 | 'type' => 'give_title', |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
503 | - 'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
502 | + 'name' => __('Enable Form Categories', 'give'), |
|
503 | + 'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
504 | 504 | 'id' => 'categories', |
505 | 505 | 'type' => 'checkbox', |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
509 | - 'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
508 | + 'name' => __('Enable Form Tags', 'give'), |
|
509 | + 'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
510 | 510 | 'id' => 'tags', |
511 | 511 | 'type' => 'checkbox', |
512 | 512 | ), |
@@ -519,101 +519,101 @@ discard block |
||
519 | 519 | */ |
520 | 520 | 'emails' => array( |
521 | 521 | 'id' => 'email_settings', |
522 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
523 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
524 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
522 | + 'give_title' => __('Email Settings', 'give'), |
|
523 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
524 | + 'fields' => apply_filters('give_settings_emails', array( |
|
525 | 525 | array( |
526 | - 'name' => __( 'Email Settings', 'give' ), |
|
526 | + 'name' => __('Email Settings', 'give'), |
|
527 | 527 | 'desc' => '', |
528 | 528 | 'id' => 'give_title_email_settings_1', |
529 | 529 | 'type' => 'give_title', |
530 | 530 | ), |
531 | 531 | array( |
532 | 532 | 'id' => 'email_template', |
533 | - 'name' => __( 'Email Template', 'give' ), |
|
534 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
533 | + 'name' => __('Email Template', 'give'), |
|
534 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
535 | 535 | 'type' => 'select', |
536 | 536 | 'options' => give_get_email_templates(), |
537 | 537 | ), |
538 | 538 | array( |
539 | 539 | 'id' => 'email_logo', |
540 | - 'name' => __( 'Logo', 'give' ), |
|
541 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
540 | + 'name' => __('Logo', 'give'), |
|
541 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
542 | 542 | 'type' => 'file', |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'from_name', |
546 | - 'name' => __( 'From Name', 'give' ), |
|
547 | - 'desc' => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
548 | - 'default' => get_bloginfo( 'name' ), |
|
546 | + 'name' => __('From Name', 'give'), |
|
547 | + 'desc' => __('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
548 | + 'default' => get_bloginfo('name'), |
|
549 | 549 | 'type' => 'text', |
550 | 550 | ), |
551 | 551 | array( |
552 | 552 | 'id' => 'from_email', |
553 | - 'name' => __( 'From Email', 'give' ), |
|
554 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
555 | - 'default' => get_bloginfo( 'admin_email' ), |
|
553 | + 'name' => __('From Email', 'give'), |
|
554 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
555 | + 'default' => get_bloginfo('admin_email'), |
|
556 | 556 | 'type' => 'text', |
557 | 557 | ), |
558 | 558 | array( |
559 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
559 | + 'name' => __('Donation Receipt', 'give'), |
|
560 | 560 | 'desc' => '', |
561 | 561 | 'id' => 'give_title_email_settings_2', |
562 | 562 | 'type' => 'give_title', |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | 'id' => 'donation_subject', |
566 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
567 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
568 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
566 | + 'name' => __('Donation Email Subject', 'give'), |
|
567 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
568 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
569 | 569 | 'type' => 'text', |
570 | 570 | ), |
571 | 571 | array( |
572 | 572 | 'id' => 'donation_receipt', |
573 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
573 | + 'name' => __('Donation Receipt', 'give'), |
|
574 | 574 | 'desc' => sprintf( |
575 | 575 | /* translators: %s: emails tags list */ |
576 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
577 | - '<br/>' . give_get_emails_tags_list() |
|
576 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
577 | + '<br/>'.give_get_emails_tags_list() |
|
578 | 578 | ), |
579 | 579 | 'type' => 'wysiwyg', |
580 | 580 | 'default' => give_get_default_donation_receipt_email(), |
581 | 581 | ), |
582 | 582 | array( |
583 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
583 | + 'name' => __('New Donation Notification', 'give'), |
|
584 | 584 | 'desc' => '', |
585 | 585 | 'id' => 'give_title_email_settings_3', |
586 | 586 | 'type' => 'give_title', |
587 | 587 | ), |
588 | 588 | array( |
589 | 589 | 'id' => 'donation_notification_subject', |
590 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
591 | - 'desc' => __( 'Enter the subject line for the donation notification email.', 'give' ), |
|
590 | + 'name' => __('Donation Notification Subject', 'give'), |
|
591 | + 'desc' => __('Enter the subject line for the donation notification email.', 'give'), |
|
592 | 592 | 'type' => 'text', |
593 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
593 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'id' => 'donation_notification', |
597 | - 'name' => __( 'Donation Notification', 'give' ), |
|
597 | + 'name' => __('Donation Notification', 'give'), |
|
598 | 598 | 'desc' => sprintf( |
599 | 599 | /* translators: %s: emails tags list */ |
600 | - __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
601 | - '<br/>' . give_get_emails_tags_list() |
|
600 | + __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
601 | + '<br/>'.give_get_emails_tags_list() |
|
602 | 602 | ), |
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email(), |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
609 | - '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' ), |
|
608 | + 'name' => __('Donation Notification Emails', 'give'), |
|
609 | + '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'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ), |
|
611 | + 'default' => get_bloginfo('admin_email'), |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox', |
618 | 618 | ), |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ), |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => __('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ), |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => __('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => __( 'Access Control', 'give' ), |
|
645 | + 'name' => __('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title', |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
652 | + 'name' => __('Session Lifetime', 'give'), |
|
653 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => __( '24 Hours', 'give' ), |
|
657 | - '172800' => __( '48 Hours', 'give' ), |
|
658 | - '259200' => __( '72 Hours', 'give' ), |
|
659 | - '604800' => __( '1 Week', 'give' ), |
|
656 | + '86400' => __('24 Hours', 'give'), |
|
657 | + '172800' => __('48 Hours', 'give'), |
|
658 | + '259200' => __('72 Hours', 'give'), |
|
659 | + '604800' => __('1 Week', 'give'), |
|
660 | 660 | ), |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => __( 'Email Access', 'give' ), |
|
664 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => __('Email Access', 'give'), |
|
664 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text', |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text', |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => __( 'Data Control', 'give' ), |
|
684 | + 'name' => __('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title', |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
690 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox', |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => __( 'Filter Control', 'give' ), |
|
696 | + 'name' => __('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title', |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox', |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => __( 'Script Loading', 'give' ), |
|
710 | + 'name' => __('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title', |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox', |
720 | 720 | ), |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => __( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
727 | + 'give_title' => __('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => __( 'API', 'give' ), |
|
733 | + 'name' => __('API', 'give'), |
|
734 | 734 | 'type' => 'api', |
735 | 735 | ), |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => __( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => __('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system-info-textarea', |
747 | - 'name' => __( 'System Info', 'give' ), |
|
748 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => __('System Info', 'give'), |
|
748 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info', |
750 | 750 | ), |
751 | 751 | ) |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | ), |
754 | 754 | ); |
755 | 755 | |
756 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
756 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
757 | 757 | |
758 | 758 | // Return all settings array if no active tab |
759 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
759 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
760 | 760 | return $give_settings; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Add other tabs and settings fields as needed |
764 | - return $give_settings[ $active_tab ]; |
|
764 | + return $give_settings[$active_tab]; |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | */ |
771 | 771 | public function settings_notices() { |
772 | 772 | |
773 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
773 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
774 | 774 | return; |
775 | 775 | } |
776 | 776 | |
777 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
777 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | * @return mixed Field value or exception is thrown. |
790 | 790 | * @throws Exception Throws an exception if the field is invalid. |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | 798 | |
799 | - throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) ); |
|
799 | + throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return mixed Option value |
817 | 817 | */ |
818 | -function give_get_option( $key = '', $default = false ) { |
|
818 | +function give_get_option($key = '', $default = false) { |
|
819 | 819 | $give_options = give_get_settings(); |
820 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
821 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
820 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
821 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
822 | 822 | |
823 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
823 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -838,33 +838,33 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @return boolean True if updated, false if not. |
840 | 840 | */ |
841 | -function give_update_option( $key = '', $value = false ) { |
|
841 | +function give_update_option($key = '', $value = false) { |
|
842 | 842 | |
843 | 843 | // If no key, exit |
844 | - if ( empty( $key ) ) { |
|
844 | + if (empty($key)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
848 | - if ( empty( $value ) ) { |
|
849 | - $remove_option = give_delete_option( $key ); |
|
848 | + if (empty($value)) { |
|
849 | + $remove_option = give_delete_option($key); |
|
850 | 850 | |
851 | 851 | return $remove_option; |
852 | 852 | } |
853 | 853 | |
854 | 854 | // First let's grab the current settings |
855 | - $options = get_option( 'give_settings' ); |
|
855 | + $options = get_option('give_settings'); |
|
856 | 856 | |
857 | 857 | // Let's let devs alter that value coming in |
858 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
858 | + $value = apply_filters('give_update_option', $value, $key); |
|
859 | 859 | |
860 | 860 | // Next let's try to update the value |
861 | - $options[ $key ] = $value; |
|
862 | - $did_update = update_option( 'give_settings', $options ); |
|
861 | + $options[$key] = $value; |
|
862 | + $did_update = update_option('give_settings', $options); |
|
863 | 863 | |
864 | 864 | // If it updated, let's update the global variable |
865 | - if ( $did_update ) { |
|
865 | + if ($did_update) { |
|
866 | 866 | global $give_options; |
867 | - $give_options[ $key ] = $value; |
|
867 | + $give_options[$key] = $value; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $did_update; |
@@ -883,25 +883,25 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
898 | - unset( $options[ $key ] ); |
|
897 | + if (isset($options[$key])) { |
|
898 | + unset($options[$key]); |
|
899 | 899 | } |
900 | 900 | |
901 | - $did_update = update_option( 'give_settings', $options ); |
|
901 | + $did_update = update_option('give_settings', $options); |
|
902 | 902 | |
903 | 903 | // If it updated, let's update the global variable |
904 | - if ( $did_update ) { |
|
904 | + if ($did_update) { |
|
905 | 905 | global $give_options; |
906 | 906 | $give_options = $options; |
907 | 907 | } |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | */ |
921 | 921 | function give_get_settings() { |
922 | 922 | |
923 | - $settings = get_option( 'give_settings' ); |
|
923 | + $settings = get_option('give_settings'); |
|
924 | 924 | |
925 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
925 | + return (array) apply_filters('give_get_settings', $settings); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -940,25 +940,25 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return array |
942 | 942 | */ |
943 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
944 | - if ( is_int( $position ) ) { |
|
945 | - array_splice( $array, $position, 0, $insert ); |
|
943 | +function give_settings_array_insert($array, $position, $insert) { |
|
944 | + if (is_int($position)) { |
|
945 | + array_splice($array, $position, 0, $insert); |
|
946 | 946 | } else { |
947 | 947 | |
948 | - foreach ( $array as $index => $subarray ) { |
|
949 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
948 | + foreach ($array as $index => $subarray) { |
|
949 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
950 | 950 | $pos = $index; |
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | - if ( ! isset( $pos ) ) { |
|
954 | + if ( ! isset($pos)) { |
|
955 | 955 | return $array; |
956 | 956 | } |
957 | 957 | |
958 | 958 | $array = array_merge( |
959 | - array_slice( $array, 0, $pos ), |
|
959 | + array_slice($array, 0, $pos), |
|
960 | 960 | $insert, |
961 | - array_slice( $array, $pos ) |
|
961 | + array_slice($array, $pos) |
|
962 | 962 | ); |
963 | 963 | } |
964 | 964 | |
@@ -978,23 +978,23 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
981 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
982 | 982 | |
983 | 983 | $id = $field_arr['id']; |
984 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
984 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
985 | 985 | |
986 | 986 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
987 | 987 | |
988 | - foreach ( $gateways as $key => $option ) : |
|
988 | + foreach ($gateways as $key => $option) : |
|
989 | 989 | |
990 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
990 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
991 | 991 | $enabled = '1'; |
992 | 992 | } else { |
993 | 993 | $enabled = null; |
994 | 994 | } |
995 | 995 | |
996 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
997 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
996 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
997 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
998 | 998 | |
999 | 999 | endforeach; |
1000 | 1000 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
1016 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1016 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1017 | 1017 | $id = $field_arr['id']; |
1018 | 1018 | $gateways = give_get_enabled_payment_gateways(); |
1019 | - $saved_value = give_get_default_gateway( null ); |
|
1019 | + $saved_value = give_get_default_gateway(null); |
|
1020 | 1020 | |
1021 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1021 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1022 | 1022 | |
1023 | - foreach ( $gateways as $key => $option ) : |
|
1024 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1025 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1023 | + foreach ($gateways as $key => $option) : |
|
1024 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1025 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1026 | 1026 | endforeach; |
1027 | 1027 | |
1028 | 1028 | echo '</select>'; |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return void |
1042 | 1042 | */ |
1043 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1043 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1044 | 1044 | |
1045 | 1045 | $id = $field_type_object->field->args['id']; |
1046 | 1046 | $title = $field_type_object->field->args['name']; |
1047 | 1047 | $field_description = $field_type_object->field->args['desc']; |
1048 | 1048 | |
1049 | - echo '<hr>' . $field_description; |
|
1049 | + echo '<hr>'.$field_description; |
|
1050 | 1050 | |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return void |
1063 | 1063 | */ |
1064 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1064 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1065 | 1065 | |
1066 | 1066 | $id = $field_type_object->field->args['id']; |
1067 | 1067 | $title = $field_type_object->field->args['name']; |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1081 | 1081 | * @return array An array of options that matches the CMB2 options array |
1082 | 1082 | */ |
1083 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1083 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1084 | 1084 | |
1085 | - $post_options = array( '' => '' ); // Blank option |
|
1085 | + $post_options = array('' => ''); // Blank option |
|
1086 | 1086 | |
1087 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1087 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1088 | 1088 | return $post_options; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - $args = wp_parse_args( $query_args, array( |
|
1091 | + $args = wp_parse_args($query_args, array( |
|
1092 | 1092 | 'post_type' => 'page', |
1093 | 1093 | 'numberposts' => 10, |
1094 | - ) ); |
|
1094 | + )); |
|
1095 | 1095 | |
1096 | - $posts = get_posts( $args ); |
|
1096 | + $posts = get_posts($args); |
|
1097 | 1097 | |
1098 | - if ( $posts ) { |
|
1099 | - foreach ( $posts as $post ) { |
|
1098 | + if ($posts) { |
|
1099 | + foreach ($posts as $post) { |
|
1100 | 1100 | |
1101 | - $post_options[ $post->ID ] = $post->post_title; |
|
1101 | + $post_options[$post->ID] = $post->post_title; |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | } |
@@ -1123,33 +1123,33 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $sizes = array(); |
1125 | 1125 | $get_sizes = get_intermediate_image_sizes(); |
1126 | - $core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1126 | + $core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // This will help us to filter special characters from a string |
1130 | - $filter_slug_items = array( '_', '-' ); |
|
1130 | + $filter_slug_items = array('_', '-'); |
|
1131 | 1131 | |
1132 | - foreach ( $get_sizes as $_size ) { |
|
1132 | + foreach ($get_sizes as $_size) { |
|
1133 | 1133 | |
1134 | 1134 | // Converting image size slug to title case |
1135 | - $sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items ); |
|
1135 | + $sizes[$_size] = give_slug_to_title($_size, $filter_slug_items); |
|
1136 | 1136 | |
1137 | - if ( in_array( $_size, $core_image_sizes ) ) { |
|
1138 | - $sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1139 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1140 | - $sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}"; |
|
1137 | + if (in_array($_size, $core_image_sizes)) { |
|
1138 | + $sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1139 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1140 | + $sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}"; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Based on the above image height check, label the respective resolution as responsive |
1144 | - if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) { |
|
1145 | - $sizes[ $_size ] .= ' - responsive'; |
|
1144 | + if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) { |
|
1145 | + $sizes[$_size] .= ' - responsive'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $sizes[ $_size ] .= ')'; |
|
1148 | + $sizes[$_size] .= ')'; |
|
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1152 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return text $string |
1167 | 1167 | */ |
1168 | -function give_slug_to_title( $string, $filters = array() ){ |
|
1168 | +function give_slug_to_title($string, $filters = array()) { |
|
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1170 | + foreach ($filters as $filter_item) { |
|
1171 | + $string = str_replace($filter_item, ' ', $string); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Return updated string after converting it to title case |
1175 | - return ucwords( $string ); |
|
1175 | + return ucwords($string); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1188,18 +1188,18 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1191 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1192 | 1192 | /* @var CMB2_Types $field_type_object */ |
1193 | 1193 | |
1194 | 1194 | $id = $field_type_object->field->args['id']; |
1195 | 1195 | $field_description = $field_type_object->field->args['desc']; |
1196 | 1196 | $license = $field_type_object->field->args['options']['license']; |
1197 | 1197 | $license_key = $escaped_value; |
1198 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1199 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1198 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1199 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1200 | 1200 | $shortname = $field_type_object->field->args['options']['shortname']; |
1201 | 1201 | $field_classes = 'regular-text give-license-field'; |
1202 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1202 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1203 | 1203 | $custom_html = ''; |
1204 | 1204 | $messages = array(); |
1205 | 1205 | $class = ''; |
@@ -1211,145 +1211,145 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1213 | 1213 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1214 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1214 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1215 | 1215 | $is_license_key = false; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Check if current license is part of subscription or not. |
1219 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1219 | + $subscriptions = get_option('give_subscriptions'); |
|
1220 | 1220 | |
1221 | - if ( $is_license_key && $subscriptions ) { |
|
1222 | - foreach ( $subscriptions as $subscription ) { |
|
1223 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1221 | + if ($is_license_key && $subscriptions) { |
|
1222 | + foreach ($subscriptions as $subscription) { |
|
1223 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1224 | 1224 | $is_in_subscription = $subscription['id']; |
1225 | 1225 | break; |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $is_license_key ) { |
|
1231 | - if ( $is_in_subscription ) { |
|
1232 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1233 | - $subscription_status = __( 'renew', 'give' ); |
|
1230 | + if ($is_license_key) { |
|
1231 | + if ($is_in_subscription) { |
|
1232 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1233 | + $subscription_status = __('renew', 'give'); |
|
1234 | 1234 | |
1235 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1236 | - $subscription_status = __( 'expire', 'give' ); |
|
1235 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1236 | + $subscription_status = __('expire', 'give'); |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1240 | - $messages[] = sprintf( |
|
1241 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1242 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1243 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1244 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1239 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1240 | + $messages[] = sprintf( |
|
1241 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1242 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1243 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1244 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1245 | 1245 | ); |
1246 | 1246 | $license_status = 'license-expired'; |
1247 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1247 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1248 | 1248 | $messages[] = sprintf( |
1249 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ), |
|
1250 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1251 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1249 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'), |
|
1250 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1251 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1252 | 1252 | $subscription_status, |
1253 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1253 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1254 | 1254 | ); |
1255 | 1255 | $license_status = 'license-expires-soon'; |
1256 | 1256 | } else { |
1257 | 1257 | $messages[] = sprintf( |
1258 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ), |
|
1259 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1260 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1258 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'), |
|
1259 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1260 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1261 | 1261 | $subscription_status, |
1262 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1262 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1263 | 1263 | ); |
1264 | 1264 | $license_status = 'license-expiration-date'; |
1265 | 1265 | } |
1266 | - } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1266 | + } elseif (empty($license->success) && property_exists($license, 'error')) { |
|
1267 | 1267 | |
1268 | 1268 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1269 | - switch ( $license->error ) { |
|
1269 | + switch ($license->error) { |
|
1270 | 1270 | case 'expired' : |
1271 | 1271 | $class = $license->error; |
1272 | 1272 | $messages[] = sprintf( |
1273 | - __( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1274 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1275 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1273 | + __('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1274 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1275 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1276 | 1276 | ); |
1277 | - $license_status = 'license-' . $class; |
|
1277 | + $license_status = 'license-'.$class; |
|
1278 | 1278 | break; |
1279 | 1279 | |
1280 | 1280 | case 'missing' : |
1281 | 1281 | $class = $license->error; |
1282 | 1282 | $messages[] = sprintf( |
1283 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1284 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1283 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1284 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1285 | 1285 | ); |
1286 | - $license_status = 'license-' . $class; |
|
1286 | + $license_status = 'license-'.$class; |
|
1287 | 1287 | break; |
1288 | 1288 | |
1289 | 1289 | case 'invalid' : |
1290 | 1290 | $class = $license->error; |
1291 | 1291 | $messages[] = sprintf( |
1292 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1292 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1293 | 1293 | $addon_name, |
1294 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1294 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1295 | 1295 | ); |
1296 | - $license_status = 'license-' . $class; |
|
1296 | + $license_status = 'license-'.$class; |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | 1299 | case 'site_inactive' : |
1300 | 1300 | $class = $license->error; |
1301 | 1301 | $messages[] = sprintf( |
1302 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1302 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1303 | 1303 | $addon_name, |
1304 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1304 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1305 | 1305 | ); |
1306 | - $license_status = 'license-' . $class; |
|
1306 | + $license_status = 'license-'.$class; |
|
1307 | 1307 | break; |
1308 | 1308 | |
1309 | 1309 | case 'item_name_mismatch' : |
1310 | 1310 | $class = $license->error; |
1311 | - $messages[] = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name ); |
|
1312 | - $license_status = 'license-' . $class; |
|
1311 | + $messages[] = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name); |
|
1312 | + $license_status = 'license-'.$class; |
|
1313 | 1313 | break; |
1314 | 1314 | |
1315 | 1315 | case 'no_activations_left': |
1316 | 1316 | $class = $license->error; |
1317 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1318 | - $license_status = 'license-' . $class; |
|
1317 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1318 | + $license_status = 'license-'.$class; |
|
1319 | 1319 | break; |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - } elseif ( empty( $license->success ) ){ |
|
1322 | + } elseif (empty($license->success)) { |
|
1323 | 1323 | $class = 'invalid'; |
1324 | 1324 | $messages[] = sprintf( |
1325 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1325 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1326 | 1326 | $addon_name, |
1327 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1327 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1328 | 1328 | ); |
1329 | - $license_status = 'license-' . $class; |
|
1329 | + $license_status = 'license-'.$class; |
|
1330 | 1330 | |
1331 | - }else { |
|
1332 | - switch ( $license->license ) { |
|
1331 | + } else { |
|
1332 | + switch ($license->license) { |
|
1333 | 1333 | case 'valid' : |
1334 | 1334 | default: |
1335 | 1335 | $class = 'valid'; |
1336 | - $now = current_time( 'timestamp' ); |
|
1337 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1336 | + $now = current_time('timestamp'); |
|
1337 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1338 | 1338 | |
1339 | - if ( 'lifetime' === $license->expires ) { |
|
1340 | - $messages[] = __( 'License key never expires.', 'give' ); |
|
1339 | + if ('lifetime' === $license->expires) { |
|
1340 | + $messages[] = __('License key never expires.', 'give'); |
|
1341 | 1341 | $license_status = 'license-lifetime-notice'; |
1342 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1342 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1343 | 1343 | $messages[] = sprintf( |
1344 | - __( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1345 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1346 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1344 | + __('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1345 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1346 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1347 | 1347 | ); |
1348 | 1348 | $license_status = 'license-expires-soon'; |
1349 | 1349 | } else { |
1350 | 1350 | $messages[] = sprintf( |
1351 | - __( 'Your license key expires on %s.', 'give' ), |
|
1352 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1351 | + __('Your license key expires on %s.', 'give'), |
|
1352 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1353 | 1353 | ); |
1354 | 1354 | $license_status = 'license-expiration-date'; |
1355 | 1355 | } |
@@ -1357,15 +1357,15 @@ discard block |
||
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | } else { |
1360 | - $messages[] = sprintf( |
|
1361 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1360 | + $messages[] = sprintf( |
|
1361 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1362 | 1362 | $addon_name |
1363 | 1363 | ); |
1364 | 1364 | $license_status = 'inactive'; |
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | // Add class for input field if license is active. |
1368 | - if ( $is_valid_license ) { |
|
1368 | + if ($is_valid_license) { |
|
1369 | 1369 | $field_classes .= ' give-license-active'; |
1370 | 1370 | } |
1371 | 1371 | |
@@ -1373,33 +1373,33 @@ discard block |
||
1373 | 1373 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1374 | 1374 | |
1375 | 1375 | // If license is active so show deactivate button. |
1376 | - if ( $is_valid_license ) { |
|
1376 | + if ($is_valid_license) { |
|
1377 | 1377 | // Get input field html. |
1378 | 1378 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1379 | 1379 | |
1380 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1380 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1381 | 1381 | |
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Field description. |
1385 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1385 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1386 | 1386 | |
1387 | 1387 | // If no messages found then inform user that to get updated in future register yourself. |
1388 | - if ( empty( $messages ) ) { |
|
1389 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1388 | + if (empty($messages)) { |
|
1389 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give')); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | - foreach ( $messages as $message ) { |
|
1393 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1394 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1392 | + foreach ($messages as $message) { |
|
1393 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1394 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1395 | 1395 | $custom_html .= '</div>'; |
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | // Field html. |
1399 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1399 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1400 | 1400 | |
1401 | 1401 | // Nonce. |
1402 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1402 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1403 | 1403 | |
1404 | 1404 | // Print field html. |
1405 | 1405 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | */ |
1415 | 1415 | function give_api_callback() { |
1416 | 1416 | |
1417 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1417 | + if ( ! current_user_can('manage_give_settings')) { |
|
1418 | 1418 | return; |
1419 | 1419 | } |
1420 | 1420 | |
@@ -1423,9 +1423,9 @@ discard block |
||
1423 | 1423 | * |
1424 | 1424 | * @since 1.0 |
1425 | 1425 | */ |
1426 | - do_action( 'give_tools_api_keys_before' ); |
|
1426 | + do_action('give_tools_api_keys_before'); |
|
1427 | 1427 | |
1428 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1428 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1429 | 1429 | |
1430 | 1430 | $api_keys_table = new Give_API_Keys_Table(); |
1431 | 1431 | $api_keys_table->prepare_items(); |
@@ -1434,9 +1434,9 @@ discard block |
||
1434 | 1434 | <span class="cmb2-metabox-description api-description"> |
1435 | 1435 | <?php echo sprintf( |
1436 | 1436 | /* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */ |
1437 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1438 | - esc_url( 'http://docs.givewp.com/api' ), |
|
1439 | - esc_url( 'http://docs.givewp.com/addon-zapier' ) |
|
1437 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1438 | + esc_url('http://docs.givewp.com/api'), |
|
1439 | + esc_url('http://docs.givewp.com/addon-zapier') |
|
1440 | 1440 | ); ?> |
1441 | 1441 | </span> |
1442 | 1442 | <?php |
@@ -1446,10 +1446,10 @@ discard block |
||
1446 | 1446 | * |
1447 | 1447 | * @since 1.0 |
1448 | 1448 | */ |
1449 | - do_action( 'give_tools_api_keys_after' ); |
|
1449 | + do_action('give_tools_api_keys_after'); |
|
1450 | 1450 | } |
1451 | 1451 | |
1452 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1452 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1453 | 1453 | |
1454 | 1454 | /** |
1455 | 1455 | * Hook Callback |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | * |
1463 | 1463 | * @return void |
1464 | 1464 | */ |
1465 | -function give_hook_callback( $args ) { |
|
1465 | +function give_hook_callback($args) { |
|
1466 | 1466 | |
1467 | 1467 | $id = $args['id']; |
1468 | 1468 | |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | * |
1472 | 1472 | * @since 1.0 |
1473 | 1473 | */ |
1474 | - do_action( "give_{$id}" ); |
|
1474 | + do_action("give_{$id}"); |
|
1475 | 1475 | |
1476 | 1476 | } |
1477 | 1477 | |
@@ -1486,19 +1486,19 @@ discard block |
||
1486 | 1486 | * |
1487 | 1487 | * @return bool |
1488 | 1488 | */ |
1489 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1490 | - if ( ! is_null( $compare_with ) ) { |
|
1489 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1490 | + if ( ! is_null($compare_with)) { |
|
1491 | 1491 | |
1492 | - if ( is_array( $compare_with ) ) { |
|
1492 | + if (is_array($compare_with)) { |
|
1493 | 1493 | // Output. |
1494 | - return in_array( $value, $compare_with ); |
|
1494 | + return in_array($value, $compare_with); |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | // Output. |
1498 | - return ( $value === $compare_with ); |
|
1498 | + return ($value === $compare_with); |
|
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1502 | 1502 | // Output. |
1503 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1503 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1504 | 1504 | } |
@@ -1328,7 +1328,7 @@ |
||
1328 | 1328 | ); |
1329 | 1329 | $license_status = 'license-' . $class; |
1330 | 1330 | |
1331 | - }else { |
|
1331 | + } else { |
|
1332 | 1332 | switch ( $license->license ) { |
1333 | 1333 | case 'valid' : |
1334 | 1334 | default: |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,52 +25,52 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | // Retrieve existing payment meta. |
43 | 43 | $meta = $payment->get_meta(); |
44 | 44 | $user_info = $payment->user_info; |
45 | 45 | |
46 | 46 | $status = $data['give-payment-status']; |
47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
49 | 49 | |
50 | 50 | // Restrict to our high and low. |
51 | - if ( $hour > 23 ) { |
|
51 | + if ($hour > 23) { |
|
52 | 52 | $hour = 23; |
53 | - } elseif ( $hour < 0 ) { |
|
53 | + } elseif ($hour < 0) { |
|
54 | 54 | $hour = 00; |
55 | 55 | } |
56 | 56 | |
57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
58 | 58 | |
59 | 59 | // Restrict to our high and low. |
60 | - if ( $minute > 59 ) { |
|
60 | + if ($minute > 59) { |
|
61 | 61 | $minute = 59; |
62 | - } elseif ( $minute < 0 ) { |
|
62 | + } elseif ($minute < 0) { |
|
63 | 63 | $minute = 00; |
64 | 64 | } |
65 | 65 | |
66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
67 | 67 | |
68 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
69 | - $new_total = give_sanitize_amount( $data['give-payment-total'] ); |
|
70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
68 | + $curr_total = give_sanitize_amount($payment->total); |
|
69 | + $new_total = give_sanitize_amount($data['give-payment-total']); |
|
70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
71 | 71 | |
72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Fires before updating edited donation. |
@@ -80,98 +80,98 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id The ID of the payment. |
82 | 82 | */ |
83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
83 | + do_action('give_update_edited_donation', $payment_id); |
|
84 | 84 | |
85 | 85 | $payment->date = $date; |
86 | 86 | $updated = $payment->save(); |
87 | 87 | |
88 | - if ( 0 === $updated ) { |
|
89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
88 | + if (0 === $updated) { |
|
89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $donor_changed = false; |
93 | 93 | |
94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
95 | 95 | |
96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
98 | 98 | |
99 | - if ( empty( $email ) || empty( $names ) ) { |
|
100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
99 | + if (empty($email) || empty($names)) { |
|
100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
101 | 101 | } |
102 | 102 | |
103 | - $donor = new Give_Donor( $email ); |
|
104 | - if ( empty( $donor->id ) ) { |
|
105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
106 | - $user_id = email_exists( $email ); |
|
107 | - if ( false !== $user_id ) { |
|
103 | + $donor = new Give_Donor($email); |
|
104 | + if (empty($donor->id)) { |
|
105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
106 | + $user_id = email_exists($email); |
|
107 | + if (false !== $user_id) { |
|
108 | 108 | $donor_data['user_id'] = $user_id; |
109 | 109 | } |
110 | 110 | |
111 | - if ( ! $donor->create( $donor_data ) ) { |
|
111 | + if ( ! $donor->create($donor_data)) { |
|
112 | 112 | // Failed to crete the new donor, assume the previous donor. |
113 | 113 | $donor_changed = false; |
114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
114 | + $donor = new Give_Donor($curr_donor_id); |
|
115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | $new_donor_id = $donor->id; |
120 | 120 | |
121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
122 | 122 | |
123 | 123 | $donor_changed = true; |
124 | 124 | |
125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
126 | 126 | |
127 | - $donor = new Give_Donor( $new_donor_id ); |
|
127 | + $donor = new Give_Donor($new_donor_id); |
|
128 | 128 | $email = $donor->email; |
129 | 129 | $names = $donor->name; |
130 | 130 | |
131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
132 | 132 | |
133 | 133 | $donor_changed = true; |
134 | 134 | |
135 | 135 | } else { |
136 | 136 | |
137 | - $donor = new Give_Donor( $curr_donor_id ); |
|
137 | + $donor = new Give_Donor($curr_donor_id); |
|
138 | 138 | $email = $donor->email; |
139 | 139 | $names = $donor->name; |
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Setup first and last name from input values. |
144 | - $names = explode( ' ', $names ); |
|
145 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
144 | + $names = explode(' ', $names); |
|
145 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
146 | 146 | $last_name = ''; |
147 | - if ( ! empty( $names[1] ) ) { |
|
148 | - unset( $names[0] ); |
|
149 | - $last_name = implode( ' ', $names ); |
|
147 | + if ( ! empty($names[1])) { |
|
148 | + unset($names[0]); |
|
149 | + $last_name = implode(' ', $names); |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( $donor_changed ) { |
|
152 | + if ($donor_changed) { |
|
153 | 153 | |
154 | 154 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
155 | - $previous_donor->remove_payment( $payment_id, false ); |
|
156 | - $donor->attach_payment( $payment_id, false ); |
|
155 | + $previous_donor->remove_payment($payment_id, false); |
|
156 | + $donor->attach_payment($payment_id, false); |
|
157 | 157 | |
158 | - if ( 'publish' == $status ) { |
|
158 | + if ('publish' == $status) { |
|
159 | 159 | |
160 | 160 | // Reduce previous user donation count and amount. |
161 | 161 | $previous_donor->decrease_donation_count(); |
162 | - $previous_donor->decrease_value( $curr_total ); |
|
162 | + $previous_donor->decrease_value($curr_total); |
|
163 | 163 | |
164 | 164 | // If donation was completed adjust stats of new donors. |
165 | 165 | $donor->increase_purchase_count(); |
166 | - $donor->increase_value( $new_total ); |
|
166 | + $donor->increase_value($new_total); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | $payment->customer_id = $donor->id; |
170 | 170 | } else { |
171 | 171 | |
172 | - if ( 'publish' === $status ) { |
|
172 | + if ('publish' === $status) { |
|
173 | 173 | // Update user donation stat. |
174 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
174 | + $donor->update_donation_value($curr_total, $new_total); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $payment->total = $new_total; |
185 | 185 | |
186 | 186 | // Check for payment notes. |
187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
187 | + if ( ! empty($data['give-payment-note'])) { |
|
188 | 188 | |
189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
190 | - give_insert_payment_note( $payment_id, $note ); |
|
189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
190 | + give_insert_payment_note($payment_id, $note); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $payment->status = $status; |
196 | 196 | |
197 | 197 | // Adjust total store earnings if the payment total has been changed. |
198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
199 | 199 | |
200 | - if ( $new_total > $curr_total ) { |
|
200 | + if ($new_total > $curr_total) { |
|
201 | 201 | // Increase if our new total is higher. |
202 | 202 | $difference = $new_total - $curr_total; |
203 | - give_increase_total_earnings( $difference ); |
|
203 | + give_increase_total_earnings($difference); |
|
204 | 204 | |
205 | - } elseif ( $curr_total > $new_total ) { |
|
205 | + } elseif ($curr_total > $new_total) { |
|
206 | 206 | // Decrease if our new total is lower. |
207 | 207 | $difference = $curr_total - $new_total; |
208 | - give_decrease_total_earnings( $difference ); |
|
208 | + give_decrease_total_earnings($difference); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | $payment->save(); |
214 | 214 | |
215 | 215 | // Get new give form ID. |
216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
218 | 218 | |
219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
221 | 221 | // Check if user want to transfer current payment to new give form id. |
222 | - if ( $new_form_id != $current_form_id ) { |
|
222 | + if ($new_form_id != $current_form_id) { |
|
223 | 223 | |
224 | 224 | // Get new give form title. |
225 | - $new_form_title = get_the_title( $new_form_id ); |
|
225 | + $new_form_title = get_the_title($new_form_id); |
|
226 | 226 | |
227 | 227 | // Update new give form data in payment data. |
228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,56 +230,56 @@ discard block |
||
230 | 230 | $payment_meta['form_id'] = $new_form_id; |
231 | 231 | |
232 | 232 | // Update price id post meta data for set donation form. |
233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
234 | 234 | $payment_meta['price_id'] = ''; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Update payment give form meta data. |
238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
241 | 241 | |
242 | 242 | // Update price id payment metadata. |
243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // If donation was completed, adjust stats of forms. |
248 | - if ( 'publish' == $status ) { |
|
248 | + if ('publish' == $status) { |
|
249 | 249 | |
250 | 250 | // Decrease sale of old give form. For other payment status. |
251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
252 | 252 | $current_form->decrease_sales(); |
253 | - $current_form->decrease_earnings( $curr_total ); |
|
253 | + $current_form->decrease_earnings($curr_total); |
|
254 | 254 | |
255 | 255 | // Increase sale of new give form. |
256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
257 | 257 | $new_form->increase_sales(); |
258 | - $new_form->increase_earnings( $new_total ); |
|
258 | + $new_form->increase_earnings($new_total); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Re setup payment to update new meta value in object. |
262 | - $payment->update_payment_setup( $payment->ID ); |
|
262 | + $payment->update_payment_setup($payment->ID); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | // Update price id if current form is variable form. |
266 | - if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
266 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
267 | 267 | |
268 | 268 | // Get payment meta data. |
269 | 269 | $payment_meta = $payment->get_meta(); |
270 | 270 | |
271 | 271 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
272 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
272 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
273 | 273 | |
274 | 274 | // Update payment meta data. |
275 | 275 | $payment_meta['price_id'] = $data['give-variable-price']; |
276 | 276 | |
277 | 277 | // Update payment give form meta data. |
278 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
279 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
278 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
279 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
280 | 280 | |
281 | 281 | // Re setup payment to update new meta value in object. |
282 | - $payment->update_payment_setup( $payment->ID ); |
|
282 | + $payment->update_payment_setup($payment->ID); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @param int $payment_id The ID of the payment. |
292 | 292 | */ |
293 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
293 | + do_action('give_updated_edited_donation', $payment_id); |
|
294 | 294 | |
295 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
295 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
296 | 296 | exit; |
297 | 297 | } |
298 | 298 | |
299 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
299 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Trigger a Donation Deletion. |
@@ -307,48 +307,48 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @return void |
309 | 309 | */ |
310 | -function give_trigger_donation_delete( $data ) { |
|
311 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
310 | +function give_trigger_donation_delete($data) { |
|
311 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
312 | 312 | |
313 | - $payment_id = absint( $data['purchase_id'] ); |
|
313 | + $payment_id = absint($data['purchase_id']); |
|
314 | 314 | |
315 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
316 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
315 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
316 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
317 | 317 | } |
318 | 318 | |
319 | - give_delete_donation( $payment_id ); |
|
320 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
319 | + give_delete_donation($payment_id); |
|
320 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
321 | 321 | give_die(); |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
325 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * AJAX Store Donation Note |
329 | 329 | */ |
330 | 330 | function give_ajax_store_payment_note() { |
331 | 331 | |
332 | - $payment_id = absint( $_POST['payment_id'] ); |
|
333 | - $note = wp_kses( $_POST['note'], array() ); |
|
332 | + $payment_id = absint($_POST['payment_id']); |
|
333 | + $note = wp_kses($_POST['note'], array()); |
|
334 | 334 | |
335 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
336 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
335 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
336 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
337 | 337 | } |
338 | 338 | |
339 | - if ( empty( $payment_id ) ) { |
|
340 | - die( '-1' ); |
|
339 | + if (empty($payment_id)) { |
|
340 | + die('-1'); |
|
341 | 341 | } |
342 | 342 | |
343 | - if ( empty( $note ) ) { |
|
344 | - die( '-1' ); |
|
343 | + if (empty($note)) { |
|
344 | + die('-1'); |
|
345 | 345 | } |
346 | 346 | |
347 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
348 | - die( give_get_payment_note_html( $note_id ) ); |
|
347 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
348 | + die(give_get_payment_note_html($note_id)); |
|
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
351 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Triggers a donation note deletion without ajax |
@@ -359,24 +359,24 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return void |
361 | 361 | */ |
362 | -function give_trigger_payment_note_deletion( $data ) { |
|
362 | +function give_trigger_payment_note_deletion($data) { |
|
363 | 363 | |
364 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
364 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
369 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
368 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
369 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
370 | 370 | } |
371 | 371 | |
372 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
372 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
373 | 373 | |
374 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
374 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
375 | 375 | |
376 | - wp_redirect( $edit_order_url ); |
|
376 | + wp_redirect($edit_order_url); |
|
377 | 377 | } |
378 | 378 | |
379 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
379 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Delete a payment note deletion with ajax |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | */ |
388 | 388 | function give_ajax_delete_payment_note() { |
389 | 389 | |
390 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
391 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
390 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
391 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
392 | 392 | } |
393 | 393 | |
394 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
395 | - die( '1' ); |
|
394 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
395 | + die('1'); |
|
396 | 396 | } else { |
397 | - die( '-1' ); |
|
397 | + die('-1'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | } |
401 | 401 | |
402 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
402 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -514,16 +514,16 @@ |
||
514 | 514 | <p> |
515 | 515 | <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
516 | 516 | <?php |
517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | - |
|
520 | - // Check whether the donor name and WP_User name is same or not. |
|
521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | - }else{ |
|
524 | - echo $donor_name; |
|
525 | - } |
|
526 | - ?> |
|
517 | + $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | + |
|
520 | + // Check whether the donor name and WP_User name is same or not. |
|
521 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | + echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | + }else{ |
|
524 | + echo $donor_name; |
|
525 | + } |
|
526 | + ?> |
|
527 | 527 | </p> |
528 | 528 | <p> |
529 | 529 | <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $donor_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $currency_code = $payment->currency; |
46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: donation number */ |
55 | - esc_html__( 'Donation %s', 'give' ), |
|
55 | + esc_html__('Donation %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param int $payment_id Payment id. |
70 | 70 | */ |
71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
71 | + do_action('give_view_order_details_before', $payment_id); |
|
72 | 72 | ?> |
73 | 73 | <form id="give-edit-order-form" method="post"> |
74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param int $payment_id Payment id. |
81 | 81 | */ |
82 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
82 | + do_action('give_view_order_details_form_top', $payment_id); |
|
83 | 83 | ?> |
84 | 84 | <div id="poststuff"> |
85 | 85 | <div id="give-dashboard-widgets-wrap"> |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param int $payment_id Payment id. |
97 | 97 | */ |
98 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
98 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
99 | 99 | ?> |
100 | 100 | |
101 | 101 | <div id="give-order-update" class="postbox give-order-data"> |
102 | 102 | |
103 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
103 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
104 | 104 | |
105 | 105 | <div class="inside"> |
106 | 106 | <div class="give-admin-box"> |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param int $payment_id Payment id. |
115 | 115 | */ |
116 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
116 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
117 | 117 | ?> |
118 | 118 | |
119 | 119 | <div class="give-admin-box-inside"> |
120 | 120 | <p> |
121 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
121 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
122 | 122 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
123 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
124 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
123 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
124 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
125 | 125 | <?php endforeach; ?> |
126 | 126 | </select> |
127 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
127 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
128 | 128 | </p> |
129 | 129 | </div> |
130 | 130 | |
131 | 131 | <div class="give-admin-box-inside"> |
132 | 132 | <p> |
133 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
134 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
133 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
134 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | |
138 | 138 | <div class="give-admin-box-inside"> |
139 | 139 | <p> |
140 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
141 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
142 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
140 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
141 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
142 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
143 | 143 | </p> |
144 | 144 | </div> |
145 | 145 | |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param int $payment_id Payment id. |
155 | 155 | */ |
156 | - do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
156 | + do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
157 | 157 | |
158 | 158 | <div class="give-order-payment give-admin-box-inside"> |
159 | 159 | <p> |
160 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
161 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
162 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
160 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
161 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
162 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
163 | 163 | </p> |
164 | 164 | </div> |
165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @param int $payment_id Payment id. |
173 | 173 | */ |
174 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
174 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
175 | 175 | ?> |
176 | 176 | |
177 | 177 | </div> |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @param int $payment_id Payment id. |
191 | 191 | */ |
192 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
192 | + do_action('give_view_order_details_update_before', $payment_id); |
|
193 | 193 | ?> |
194 | 194 | |
195 | 195 | <div id="major-publishing-actions"> |
196 | 196 | <div id="publishing-action"> |
197 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
198 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
199 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
197 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
198 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
199 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
200 | 200 | 'give-action' => 'email_links', |
201 | 201 | 'purchase_id' => $payment_id, |
202 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
202 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
203 | 203 | <?php endif; ?> |
204 | 204 | </div> |
205 | 205 | <div class="clear"></div> |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @param int $payment_id Payment id. |
215 | 215 | */ |
216 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
216 | + do_action('give_view_order_details_update_after', $payment_id); |
|
217 | 217 | ?> |
218 | 218 | |
219 | 219 | </div> |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | <div id="give-order-details" class="postbox give-order-data"> |
226 | 226 | |
227 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
227 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
228 | 228 | |
229 | 229 | <div class="inside"> |
230 | 230 | <div class="give-admin-box"> |
@@ -237,44 +237,44 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param int $payment_id Payment id. |
239 | 239 | */ |
240 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
240 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
241 | 241 | |
242 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
243 | - if ( $gateway ) : ?> |
|
242 | + $gateway = give_get_payment_gateway($payment_id); |
|
243 | + if ($gateway) : ?> |
|
244 | 244 | <div class="give-order-gateway give-admin-box-inside"> |
245 | 245 | <p> |
246 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
247 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
246 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
247 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
248 | 248 | </p> |
249 | 249 | </div> |
250 | 250 | <?php endif; ?> |
251 | 251 | |
252 | 252 | <div class="give-order-payment-key give-admin-box-inside"> |
253 | 253 | <p> |
254 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
255 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
254 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
255 | + <?php echo give_get_payment_key($payment_id); ?> |
|
256 | 256 | </p> |
257 | 257 | </div> |
258 | 258 | |
259 | 259 | <div class="give-order-ip give-admin-box-inside"> |
260 | 260 | <p> |
261 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
262 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
261 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
262 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
263 | 263 | </p> |
264 | 264 | </div> |
265 | 265 | |
266 | - <?php if ( $transaction_id ) : ?> |
|
266 | + <?php if ($transaction_id) : ?> |
|
267 | 267 | <div class="give-order-tx-id give-admin-box-inside"> |
268 | 268 | <p> |
269 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
270 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
269 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
270 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
271 | 271 | </p> |
272 | 272 | </div> |
273 | 273 | <?php endif; ?> |
274 | 274 | |
275 | 275 | <div class="give-admin-box-inside"> |
276 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
277 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
276 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
277 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
278 | 278 | </p> |
279 | 279 | </div> |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @param int $payment_id Payment id. |
288 | 288 | */ |
289 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
289 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
290 | 290 | ?> |
291 | 291 | |
292 | 292 | </div> |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @param int $payment_id Payment id. |
308 | 308 | */ |
309 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
309 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
310 | 310 | ?> |
311 | 311 | |
312 | 312 | </div> |
@@ -326,56 +326,56 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @param int $payment_id Payment id. |
328 | 328 | */ |
329 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
329 | + do_action('give_view_order_details_main_before', $payment_id); |
|
330 | 330 | ?> |
331 | 331 | |
332 | 332 | <?php $column_count = 'columns-3'; ?> |
333 | 333 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
334 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
334 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
335 | 335 | |
336 | 336 | <div class="inside"> |
337 | 337 | |
338 | 338 | <div class="column-container"> |
339 | 339 | <div class="column"> |
340 | 340 | <p> |
341 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
341 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
342 | 342 | <?php |
343 | - if ( $payment_meta['form_id'] ) : |
|
343 | + if ($payment_meta['form_id']) : |
|
344 | 344 | printf( |
345 | 345 | '<a href="%1$s" target="_blank">#%2$s</a>', |
346 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
346 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
347 | 347 | $payment_meta['form_id'] |
348 | 348 | ); |
349 | 349 | endif; |
350 | 350 | ?> |
351 | 351 | </p> |
352 | 352 | <p> |
353 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
354 | - <?php echo Give()->html->forms_dropdown( array( |
|
353 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
354 | + <?php echo Give()->html->forms_dropdown(array( |
|
355 | 355 | 'selected' => $payment_meta['form_id'], |
356 | 356 | 'name' => 'give-payment-form-select', |
357 | 357 | 'id' => 'give-payment-form-select', |
358 | 358 | 'chosen' => true, |
359 | - ) ); ?> |
|
359 | + )); ?> |
|
360 | 360 | </p> |
361 | 361 | </div> |
362 | 362 | <div class="column"> |
363 | 363 | <p> |
364 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
365 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
364 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
365 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
366 | 366 | </p> |
367 | 367 | <p> |
368 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
368 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
369 | 369 | <span class="give-donation-level"> |
370 | 370 | <?php |
371 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
372 | - if ( empty( $var_prices ) ) { |
|
373 | - esc_html_e( 'n/a', 'give' ); |
|
371 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
372 | + if (empty($var_prices)) { |
|
373 | + esc_html_e('n/a', 'give'); |
|
374 | 374 | } else { |
375 | 375 | $prices_atts = ''; |
376 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
377 | - foreach ( $variable_prices as $variable_price ) { |
|
378 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
376 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
377 | + foreach ($variable_prices as $variable_price) { |
|
378 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | // Variable price dropdown options. |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | 'chosen' => true, |
386 | 386 | 'show_option_all' => '', |
387 | 387 | 'show_option_none' => '', |
388 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
388 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
389 | 389 | 'selected' => $payment_meta['price_id'], |
390 | 390 | ); |
391 | 391 | // Render variable prices select tag html. |
392 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
392 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
393 | 393 | } |
394 | 394 | ?> |
395 | 395 | </span> |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | </div> |
398 | 398 | <div class="column"> |
399 | 399 | <p> |
400 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
401 | - <?php echo give_currency_filter( give_format_amount( $payment->total ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
400 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
401 | + <?php echo give_currency_filter(give_format_amount($payment->total), give_get_payment_currency_code($payment->ID)); ?> |
|
402 | 402 | </p> |
403 | 403 | <p> |
404 | 404 | <?php |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * |
412 | 412 | * @param int $payment_id Payment id. |
413 | 413 | */ |
414 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
414 | + do_action('give_donation_details_thead_before', $payment_id); |
|
415 | 415 | |
416 | 416 | |
417 | 417 | /** |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @param int $payment_id Payment id. |
425 | 425 | */ |
426 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
426 | + do_action('give_donation_details_thead_after', $payment_id); |
|
427 | 427 | |
428 | 428 | /** |
429 | 429 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @param int $payment_id Payment id. |
436 | 436 | */ |
437 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
437 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
438 | 438 | |
439 | 439 | /** |
440 | 440 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @param int $payment_id Payment id. |
447 | 447 | */ |
448 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
448 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
449 | 449 | ?> |
450 | 450 | </p> |
451 | 451 | </div> |
@@ -465,67 +465,67 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @param int $payment_id Payment id. |
467 | 467 | */ |
468 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
468 | + do_action('give_view_order_details_files_after', $payment_id); |
|
469 | 469 | ?> |
470 | 470 | |
471 | 471 | <div id="give-donor-details" class="postbox"> |
472 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
472 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
473 | 473 | |
474 | 474 | <div class="inside"> |
475 | 475 | |
476 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
476 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
477 | 477 | |
478 | 478 | <div class="column-container donor-info"> |
479 | 479 | <div class="column"> |
480 | 480 | <p> |
481 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
481 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
482 | 482 | <?php |
483 | - if ( ! empty( $donor->id ) ) { |
|
483 | + if ( ! empty($donor->id)) { |
|
484 | 484 | printf( |
485 | 485 | '<a href="%1$s" target="_blank">#%2$s</a>', |
486 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
486 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
487 | 487 | $donor->id |
488 | 488 | ); |
489 | 489 | } |
490 | 490 | ?> |
491 | 491 | </p> |
492 | 492 | <p> |
493 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
494 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
493 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
494 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
495 | 495 | </p> |
496 | 496 | </div> |
497 | 497 | <div class="column"> |
498 | 498 | <p> |
499 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
499 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
500 | 500 | <?php |
501 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
502 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
501 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
502 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
503 | 503 | |
504 | 504 | // Check whether the donor name and WP_User name is same or not. |
505 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
506 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
507 | - }else{ |
|
505 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
506 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
507 | + } else { |
|
508 | 508 | echo $donor_name; |
509 | 509 | } |
510 | 510 | ?> |
511 | 511 | </p> |
512 | 512 | <p> |
513 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
513 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
514 | 514 | <?php echo $donor->email; ?> |
515 | 515 | </p> |
516 | 516 | </div> |
517 | 517 | <div class="column"> |
518 | 518 | <p> |
519 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
519 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
520 | 520 | <?php |
521 | - echo Give()->html->donor_dropdown( array( |
|
521 | + echo Give()->html->donor_dropdown(array( |
|
522 | 522 | 'selected' => $donor->id, |
523 | 523 | 'name' => 'donor-id', |
524 | - ) ); |
|
524 | + )); |
|
525 | 525 | ?> |
526 | 526 | </p> |
527 | 527 | <p> |
528 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
528 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
529 | 529 | </p> |
530 | 530 | </div> |
531 | 531 | </div> |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | <div class="column-container new-donor" style="display: none"> |
534 | 534 | <div class="column"> |
535 | 535 | <p> |
536 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
536 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
537 | 537 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
538 | 538 | </p> |
539 | 539 | </div> |
540 | 540 | <div class="column"> |
541 | 541 | <p> |
542 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
542 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
543 | 543 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
544 | 544 | </p> |
545 | 545 | </div> |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | <p> |
548 | 548 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
549 | 549 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
550 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
550 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
551 | 551 | <br> |
552 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
552 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
553 | 553 | </p> |
554 | 554 | </div> |
555 | 555 | </div> |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @param array $payment_meta Payment meta. |
566 | 566 | * @param array $user_info User information. |
567 | 567 | */ |
568 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
568 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
569 | 569 | |
570 | 570 | /** |
571 | 571 | * Fires on the donation details page, in the donor-details metabox. |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @param int $payment_id Payment id. |
576 | 576 | */ |
577 | - do_action( 'give_payment_view_details', $payment_id ); |
|
577 | + do_action('give_payment_view_details', $payment_id); |
|
578 | 578 | ?> |
579 | 579 | |
580 | 580 | </div> |
@@ -590,11 +590,11 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @param int $payment_id Payment id. |
592 | 592 | */ |
593 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
593 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
594 | 594 | ?> |
595 | 595 | |
596 | 596 | <div id="give-billing-details" class="postbox"> |
597 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
597 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
598 | 598 | |
599 | 599 | <div class="inside"> |
600 | 600 | |
@@ -604,59 +604,59 @@ discard block |
||
604 | 604 | <div class="data column-container"> |
605 | 605 | <div class="column"> |
606 | 606 | <div class="give-wrap-address-line1"> |
607 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
608 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
607 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
608 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
609 | 609 | </div> |
610 | 610 | <div class="give-wrap-address-line2"> |
611 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
612 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
611 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
612 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
613 | 613 | </div> |
614 | 614 | </div> |
615 | 615 | <div class="column"> |
616 | 616 | <div class="give-wrap-address-city"> |
617 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
618 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
617 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
618 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
619 | 619 | </div> |
620 | 620 | <div class="give-wrap-address-zip"> |
621 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
622 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
621 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
622 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
623 | 623 | |
624 | 624 | </div> |
625 | 625 | </div> |
626 | 626 | <div class="column"> |
627 | 627 | <div id="give-order-address-country-wrap"> |
628 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
628 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
629 | 629 | <?php |
630 | - echo Give()->html->select( array( |
|
630 | + echo Give()->html->select(array( |
|
631 | 631 | 'options' => give_get_country_list(), |
632 | 632 | 'name' => 'give-payment-address[0][country]', |
633 | 633 | 'selected' => $address['country'], |
634 | 634 | 'show_option_all' => false, |
635 | 635 | 'show_option_none' => false, |
636 | 636 | 'chosen' => true, |
637 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
638 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
639 | - ) ); |
|
637 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
638 | + 'data' => array('search-type' => 'no_ajax'), |
|
639 | + )); |
|
640 | 640 | ?> |
641 | 641 | </div> |
642 | 642 | <div id="give-order-address-state-wrap"> |
643 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
643 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
644 | 644 | <?php |
645 | - $states = give_get_states( $address['country'] ); |
|
646 | - if ( ! empty( $states ) ) { |
|
647 | - echo Give()->html->select( array( |
|
645 | + $states = give_get_states($address['country']); |
|
646 | + if ( ! empty($states)) { |
|
647 | + echo Give()->html->select(array( |
|
648 | 648 | 'options' => $states, |
649 | 649 | 'name' => 'give-payment-address[0][state]', |
650 | 650 | 'selected' => $address['state'], |
651 | 651 | 'show_option_all' => false, |
652 | 652 | 'show_option_none' => false, |
653 | 653 | 'chosen' => true, |
654 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
655 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
656 | - ) ); |
|
654 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
655 | + 'data' => array('search-type' => 'no_ajax'), |
|
656 | + )); |
|
657 | 657 | } else { |
658 | 658 | ?> |
659 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
659 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
660 | 660 | <?php |
661 | 661 | } ?> |
662 | 662 | </div> |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @param int $payment_id Payment id. |
678 | 678 | */ |
679 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
679 | + do_action('give_payment_billing_details', $payment_id); |
|
680 | 680 | ?> |
681 | 681 | |
682 | 682 | </div> |
@@ -692,32 +692,32 @@ discard block |
||
692 | 692 | * |
693 | 693 | * @param int $payment_id Payment id. |
694 | 694 | */ |
695 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
695 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
696 | 696 | ?> |
697 | 697 | |
698 | 698 | <div id="give-payment-notes" class="postbox"> |
699 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
699 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
700 | 700 | |
701 | 701 | <div class="inside"> |
702 | 702 | <div id="give-payment-notes-inner"> |
703 | 703 | <?php |
704 | - $notes = give_get_payment_notes( $payment_id ); |
|
705 | - if ( ! empty( $notes ) ) { |
|
704 | + $notes = give_get_payment_notes($payment_id); |
|
705 | + if ( ! empty($notes)) { |
|
706 | 706 | $no_notes_display = ' style="display:none;"'; |
707 | - foreach ( $notes as $note ) : |
|
707 | + foreach ($notes as $note) : |
|
708 | 708 | |
709 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
709 | + echo give_get_payment_note_html($note, $payment_id); |
|
710 | 710 | |
711 | 711 | endforeach; |
712 | 712 | } else { |
713 | 713 | $no_notes_display = ''; |
714 | 714 | } |
715 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
715 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
716 | 716 | </div> |
717 | 717 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
718 | 718 | |
719 | 719 | <div class="give-clearfix"> |
720 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
720 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
721 | 721 | </div> |
722 | 722 | |
723 | 723 | </div> |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * |
734 | 734 | * @param int $payment_id Payment id. |
735 | 735 | */ |
736 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
736 | + do_action('give_view_order_details_main_after', $payment_id); |
|
737 | 737 | ?> |
738 | 738 | |
739 | 739 | </div> |
@@ -755,11 +755,11 @@ discard block |
||
755 | 755 | * |
756 | 756 | * @param int $payment_id Payment id. |
757 | 757 | */ |
758 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
758 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
759 | 759 | |
760 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
760 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
761 | 761 | ?> |
762 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
762 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
763 | 763 | <input type="hidden" name="give_action" value="update_payment_details"/> |
764 | 764 | </form> |
765 | 765 | <?php |
@@ -770,6 +770,6 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @param int $payment_id Payment id. |
772 | 772 | */ |
773 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
773 | + do_action('give_view_order_details_after', $payment_id); |
|
774 | 774 | ?> |
775 | 775 | </div><!-- /.wrap --> |
@@ -520,7 +520,7 @@ |
||
520 | 520 | // Check whether the donor name and WP_User name is same or not. |
521 | 521 | if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
522 | 522 | echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
523 | - }else{ |
|
523 | + } else{ |
|
524 | 524 | echo $donor_name; |
525 | 525 | } |
526 | 526 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | 27 | |
28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
28 | + $give_payment = get_post_type_object('give_payment'); |
|
29 | 29 | |
30 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
32 | 32 | } else { |
33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
34 | 34 | $payments_table = new Give_Payment_History_Table(); |
35 | 35 | $payments_table->prepare_items(); |
36 | 36 | ?> |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_payments_page_top' ); |
|
47 | + do_action('give_payments_page_top'); |
|
48 | 48 | ?> |
49 | 49 | |
50 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
50 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
51 | 51 | <input type="hidden" name="post_type" value="give_forms" /> |
52 | 52 | <input type="hidden" name="page" value="give-payment-history" /> |
53 | 53 | <?php $payments_table->views() ?> |
54 | 54 | <?php $payments_table->advanced_filters(); ?> |
55 | 55 | </form> |
56 | 56 | |
57 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
57 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
58 | 58 | <input type="hidden" name="post_type" value="give_forms" /> |
59 | 59 | <input type="hidden" name="page" value="give-payment-history" /> |
60 | 60 | <?php $payments_table->display() ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @since 1.7 |
68 | 68 | */ |
69 | - do_action( 'give_payments_page_bottom' ); |
|
69 | + do_action('give_payments_page_bottom'); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | </div> |
@@ -83,29 +83,29 @@ discard block |
||
83 | 83 | * @param $title |
84 | 84 | * @return string |
85 | 85 | */ |
86 | -function give_view_order_details_title( $admin_title, $title ) { |
|
86 | +function give_view_order_details_title($admin_title, $title) { |
|
87 | 87 | |
88 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
88 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
89 | 89 | return $admin_title; |
90 | 90 | } |
91 | 91 | |
92 | - if( ! isset( $_GET['give-action'] ) ) { |
|
92 | + if ( ! isset($_GET['give-action'])) { |
|
93 | 93 | return $admin_title; |
94 | 94 | } |
95 | 95 | |
96 | - switch( $_GET['give-action'] ) : |
|
96 | + switch ($_GET['give-action']) : |
|
97 | 97 | |
98 | 98 | case 'view-payment-details' : |
99 | 99 | $title = sprintf( |
100 | 100 | /* translators: %s: admin title */ |
101 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
101 | + esc_html__('View Donation Details - %s', 'give'), |
|
102 | 102 | $admin_title |
103 | 103 | ); |
104 | 104 | break; |
105 | 105 | case 'edit-payment' : |
106 | 106 | $title = sprintf( |
107 | 107 | /* translators: %s: admin title */ |
108 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
108 | + esc_html__('Edit Donation - %s', 'give'), |
|
109 | 109 | $admin_title |
110 | 110 | ); |
111 | 111 | break; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | return $title; |
118 | 118 | } |
119 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
119 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | * @param $context |
129 | 129 | * @return string |
130 | 130 | */ |
131 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
131 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
132 | 132 | |
133 | - $post = get_post( $post_id ); |
|
133 | + $post = get_post($post_id); |
|
134 | 134 | |
135 | - if( ! $post ) { |
|
135 | + if ( ! $post) { |
|
136 | 136 | return $url; |
137 | 137 | } |
138 | 138 | |
139 | - if( 'give_payment' != $post->post_type ) { |
|
139 | + if ('give_payment' != $post->post_type) { |
|
140 | 140 | return $url; |
141 | 141 | } |
142 | 142 | |
143 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
143 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
144 | 144 | |
145 | 145 | return $url; |
146 | 146 | } |
147 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
147 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | public function __construct() { |
127 | 127 | |
128 | 128 | // Set parent defaults. |
129 | - parent::__construct( array( |
|
130 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
131 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
132 | - 'ajax' => false, // Does this table support ajax? |
|
133 | - ) ); |
|
129 | + parent::__construct(array( |
|
130 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
131 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
132 | + 'ajax' => false, // Does this table support ajax? |
|
133 | + )); |
|
134 | 134 | |
135 | 135 | $this->get_payment_counts(); |
136 | 136 | $this->process_bulk_action(); |
137 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
137 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,31 +143,31 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function advanced_filters() { |
146 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
147 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
148 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
149 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
150 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
146 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
147 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
148 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
149 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
150 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
151 | 151 | ?> |
152 | 152 | <div id="give-payment-filters"> |
153 | 153 | <span id="give-payment-date-filters"> |
154 | 154 | <label for="start-date" |
155 | - class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
155 | + class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
156 | 156 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
157 | 157 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
158 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
158 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
159 | 159 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
160 | 160 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
161 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>" /> |
|
161 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>" /> |
|
162 | 162 | </span> |
163 | - <?php if ( ! empty( $status ) ) : ?> |
|
164 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
163 | + <?php if ( ! empty($status)) : ?> |
|
164 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
165 | 165 | <?php endif; ?> |
166 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor )|| ! empty( $search ) ) : ?> |
|
167 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
168 | - class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
166 | + <?php if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search)) : ?> |
|
167 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
168 | + class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
169 | 169 | <?php endif; ?> |
170 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
170 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
171 | 171 | </div> |
172 | 172 | |
173 | 173 | <?php |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return void |
186 | 186 | */ |
187 | - public function search_box( $text, $input_id ) { |
|
188 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
187 | + public function search_box($text, $input_id) { |
|
188 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | - $input_id = $input_id . '-search-input'; |
|
192 | + $input_id = $input_id.'-search-input'; |
|
193 | 193 | |
194 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
195 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
194 | + if ( ! empty($_REQUEST['orderby'])) { |
|
195 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
196 | 196 | } |
197 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
198 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
197 | + if ( ! empty($_REQUEST['order'])) { |
|
198 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | <p class="search-box" role="search"> |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @since 1.7 |
209 | 209 | */ |
210 | - do_action( 'give_payment_history_search' ); |
|
210 | + do_action('give_payment_history_search'); |
|
211 | 211 | ?> |
212 | 212 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
213 | 213 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
214 | - <?php submit_button( $text, 'button', false, false, array( |
|
214 | + <?php submit_button($text, 'button', false, false, array( |
|
215 | 215 | 'ID' => 'search-submit', |
216 | - ) ); ?><br /> |
|
216 | + )); ?><br /> |
|
217 | 217 | </p> |
218 | 218 | <?php |
219 | 219 | } |
@@ -227,57 +227,57 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_views() { |
229 | 229 | |
230 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
231 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
232 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
233 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
234 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
235 | - $processing_count = ' <span class="count">(' . $this->processing_count . ')</span>'; |
|
236 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
237 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
238 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
239 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
230 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
231 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
232 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
233 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
234 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
235 | + $processing_count = ' <span class="count">('.$this->processing_count.')</span>'; |
|
236 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
237 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
238 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
239 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
240 | 240 | |
241 | 241 | $views = array( |
242 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
242 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
243 | 243 | 'status', |
244 | 244 | 'paged', |
245 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
246 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
245 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
246 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
247 | 247 | 'status' => 'publish', |
248 | 248 | 'paged' => false, |
249 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
250 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
249 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
250 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
251 | 251 | 'status' => 'pending', |
252 | 252 | 'paged' => false, |
253 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
254 | - 'processing' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
253 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
254 | + 'processing' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
255 | 255 | 'status' => 'processing', |
256 | 256 | 'paged' => false, |
257 | - ) ) ), $current === 'processing' ? ' class="current"' : '', esc_html__( 'Processing', 'give' ) . $processing_count ), |
|
258 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
257 | + ))), $current === 'processing' ? ' class="current"' : '', esc_html__('Processing', 'give').$processing_count), |
|
258 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
259 | 259 | 'status' => 'refunded', |
260 | 260 | 'paged' => false, |
261 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
262 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
261 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
262 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
263 | 263 | 'status' => 'revoked', |
264 | 264 | 'paged' => false, |
265 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
266 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
265 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
266 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
267 | 267 | 'status' => 'failed', |
268 | 268 | 'paged' => false, |
269 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
270 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
269 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
270 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
271 | 271 | 'status' => 'cancelled', |
272 | 272 | 'paged' => false, |
273 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
274 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
273 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
274 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
275 | 275 | 'status' => 'abandoned', |
276 | 276 | 'paged' => false, |
277 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
277 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
278 | 278 | ); |
279 | 279 | |
280 | - return apply_filters( 'give_payments_table_views', $views ); |
|
280 | + return apply_filters('give_payments_table_views', $views); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,15 +290,15 @@ discard block |
||
290 | 290 | public function get_columns() { |
291 | 291 | $columns = array( |
292 | 292 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
293 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
294 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
295 | - 'status' => esc_html__( 'Status', 'give' ), |
|
296 | - 'date' => esc_html__( 'Date', 'give' ), |
|
297 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
298 | - 'details' => esc_html__( 'Details', 'give' ), |
|
293 | + 'donation' => esc_html__('Donation', 'give'), |
|
294 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
295 | + 'status' => esc_html__('Status', 'give'), |
|
296 | + 'date' => esc_html__('Date', 'give'), |
|
297 | + 'amount' => esc_html__('Amount', 'give'), |
|
298 | + 'details' => esc_html__('Details', 'give'), |
|
299 | 299 | ); |
300 | 300 | |
301 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
301 | + return apply_filters('give_payments_table_columns', $columns); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -310,14 +310,14 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function get_sortable_columns() { |
312 | 312 | $columns = array( |
313 | - 'donation' => array( 'ID', true ), |
|
314 | - 'donation_form' => array( 'donation_form', false ), |
|
315 | - 'status' => array( 'status', false ), |
|
316 | - 'amount' => array( 'amount', false ), |
|
317 | - 'date' => array( 'date', false ), |
|
313 | + 'donation' => array('ID', true), |
|
314 | + 'donation_form' => array('donation_form', false), |
|
315 | + 'status' => array('status', false), |
|
316 | + 'amount' => array('amount', false), |
|
317 | + 'date' => array('date', false), |
|
318 | 318 | ); |
319 | 319 | |
320 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
320 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -343,55 +343,55 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return string Column Name |
345 | 345 | */ |
346 | - public function column_default( $payment, $column_name ) { |
|
346 | + public function column_default($payment, $column_name) { |
|
347 | 347 | |
348 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
349 | - $row_actions = $this->get_row_actions( $payment ); |
|
348 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
349 | + $row_actions = $this->get_row_actions($payment); |
|
350 | 350 | |
351 | - switch ( $column_name ) { |
|
351 | + switch ($column_name) { |
|
352 | 352 | case 'donation' : |
353 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
354 | - $value .= $this->get_donor_email( $payment ); |
|
355 | - $value .= $this->row_actions( $row_actions ); |
|
353 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
354 | + $value .= $this->get_donor_email($payment); |
|
355 | + $value .= $this->row_actions($row_actions); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'amount' : |
359 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
360 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
361 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
359 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
360 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
361 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | case 'donation_form' : |
365 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
366 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
367 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
365 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
366 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
367 | + $level = give_get_payment_form_title($payment->meta, true); |
|
368 | 368 | |
369 | - if ( ! empty( $level ) ) { |
|
369 | + if ( ! empty($level)) { |
|
370 | 370 | $value .= $level; |
371 | 371 | } |
372 | 372 | |
373 | 373 | break; |
374 | 374 | |
375 | 375 | case 'date' : |
376 | - $date = strtotime( $payment->date ); |
|
377 | - $value = date_i18n( give_date_format(), $date ); |
|
376 | + $date = strtotime($payment->date); |
|
377 | + $value = date_i18n(give_date_format(), $date); |
|
378 | 378 | break; |
379 | 379 | |
380 | 380 | case 'status' : |
381 | - $value = $this->get_payment_status( $payment ); |
|
381 | + $value = $this->get_payment_status($payment); |
|
382 | 382 | break; |
383 | 383 | |
384 | 384 | case 'details' : |
385 | - $value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
385 | + $value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
386 | 386 | break; |
387 | 387 | |
388 | 388 | default: |
389 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
389 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
390 | 390 | break; |
391 | 391 | |
392 | 392 | }// End switch(). |
393 | 393 | |
394 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
394 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -404,17 +404,17 @@ discard block |
||
404 | 404 | * |
405 | 405 | * @return string Data shown in the Email column |
406 | 406 | */ |
407 | - public function get_donor_email( $payment ) { |
|
407 | + public function get_donor_email($payment) { |
|
408 | 408 | |
409 | - $email = give_get_payment_user_email( $payment->ID ); |
|
409 | + $email = give_get_payment_user_email($payment->ID); |
|
410 | 410 | |
411 | - if ( empty( $email ) ) { |
|
412 | - $email = esc_html__( '(unknown)', 'give' ); |
|
411 | + if (empty($email)) { |
|
412 | + $email = esc_html__('(unknown)', 'give'); |
|
413 | 413 | } |
414 | 414 | |
415 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
415 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
416 | 416 | |
417 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
417 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -426,32 +426,32 @@ discard block |
||
426 | 426 | * |
427 | 427 | * @return array $actions |
428 | 428 | */ |
429 | - function get_row_actions( $payment ) { |
|
429 | + function get_row_actions($payment) { |
|
430 | 430 | |
431 | 431 | $actions = array(); |
432 | - $email = give_get_payment_user_email( $payment->ID ); |
|
432 | + $email = give_get_payment_user_email($payment->ID); |
|
433 | 433 | |
434 | 434 | // Add search term string back to base URL. |
435 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
436 | - if ( ! empty( $search_terms ) ) { |
|
437 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
435 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
436 | + if ( ! empty($search_terms)) { |
|
437 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
438 | 438 | } |
439 | 439 | |
440 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
440 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
441 | 441 | |
442 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
442 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
443 | 443 | 'give-action' => 'email_links', |
444 | 444 | 'purchase_id' => $payment->ID, |
445 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
445 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
446 | 446 | |
447 | 447 | } |
448 | 448 | |
449 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
449 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
450 | 450 | 'give-action' => 'delete_payment', |
451 | 451 | 'purchase_id' => $payment->ID, |
452 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
452 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
453 | 453 | |
454 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
454 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @return string Data shown in the Email column |
467 | 467 | */ |
468 | - function get_payment_status( $payment ) { |
|
469 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
470 | - if ( $payment->mode == 'test' ) { |
|
471 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
468 | + function get_payment_status($payment) { |
|
469 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
470 | + if ($payment->mode == 'test') { |
|
471 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | return $value; |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | * |
485 | 485 | * @return string Displays a checkbox. |
486 | 486 | */ |
487 | - public function column_cb( $payment ) { |
|
488 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
487 | + public function column_cb($payment) { |
|
488 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | * |
499 | 499 | * @return string Displays a checkbox. |
500 | 500 | */ |
501 | - public function get_payment_id( $payment ) { |
|
502 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
501 | + public function get_payment_id($payment) { |
|
502 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -512,32 +512,32 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @return string Data shown in the User column |
514 | 514 | */ |
515 | - public function get_donor( $payment ) { |
|
515 | + public function get_donor($payment) { |
|
516 | 516 | |
517 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
518 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
519 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
517 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
518 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
519 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
520 | 520 | |
521 | 521 | $value = ''; |
522 | - if ( ! empty( $donor_id ) ) { |
|
522 | + if ( ! empty($donor_id)) { |
|
523 | 523 | |
524 | 524 | // Check whether the donor name and WP_User name is same or not. |
525 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
526 | - $value .= $donor_billing_name . ' ('; |
|
525 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
526 | + $value .= $donor_billing_name.' ('; |
|
527 | 527 | } |
528 | 528 | |
529 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
529 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
530 | 530 | |
531 | 531 | // Check whether the donor name and WP_User name is same or not. |
532 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
532 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
533 | 533 | $value .= ')'; |
534 | 534 | } |
535 | 535 | } else { |
536 | - $email = give_get_payment_user_email( $payment->ID ); |
|
537 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
536 | + $email = give_get_payment_user_email($payment->ID); |
|
537 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
538 | 538 | } |
539 | 539 | |
540 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
540 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -549,20 +549,20 @@ discard block |
||
549 | 549 | */ |
550 | 550 | public function get_bulk_actions() { |
551 | 551 | $actions = array( |
552 | - 'delete' => __( 'Delete', 'give' ), |
|
553 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
554 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
555 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
556 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
557 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
558 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
559 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
560 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
561 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
562 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
552 | + 'delete' => __('Delete', 'give'), |
|
553 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
554 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
555 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
556 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
557 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
558 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
559 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
560 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
561 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
562 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
563 | 563 | ); |
564 | 564 | |
565 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
565 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -573,63 +573,63 @@ discard block |
||
573 | 573 | * @return void |
574 | 574 | */ |
575 | 575 | public function process_bulk_action() { |
576 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
576 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
577 | 577 | $action = $this->current_action(); |
578 | 578 | |
579 | - if ( ! is_array( $ids ) ) { |
|
580 | - $ids = array( $ids ); |
|
579 | + if ( ! is_array($ids)) { |
|
580 | + $ids = array($ids); |
|
581 | 581 | } |
582 | 582 | |
583 | - if ( empty( $action ) ) { |
|
583 | + if (empty($action)) { |
|
584 | 584 | return; |
585 | 585 | } |
586 | 586 | |
587 | - foreach ( $ids as $id ) { |
|
587 | + foreach ($ids as $id) { |
|
588 | 588 | |
589 | 589 | // Detect when a bulk action is being triggered. |
590 | - switch ( $this->current_action() ) { |
|
590 | + switch ($this->current_action()) { |
|
591 | 591 | |
592 | 592 | case'delete': |
593 | - give_delete_donation( $id ); |
|
593 | + give_delete_donation($id); |
|
594 | 594 | break; |
595 | 595 | |
596 | 596 | case 'set-status-publish': |
597 | - give_update_payment_status( $id, 'publish' ); |
|
597 | + give_update_payment_status($id, 'publish'); |
|
598 | 598 | break; |
599 | 599 | |
600 | 600 | case 'set-status-pending': |
601 | - give_update_payment_status( $id, 'pending' ); |
|
601 | + give_update_payment_status($id, 'pending'); |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'set-status-processing': |
605 | - give_update_payment_status( $id, 'processing' ); |
|
605 | + give_update_payment_status($id, 'processing'); |
|
606 | 606 | break; |
607 | 607 | |
608 | 608 | case 'set-status-refunded': |
609 | - give_update_payment_status( $id, 'refunded' ); |
|
609 | + give_update_payment_status($id, 'refunded'); |
|
610 | 610 | break; |
611 | 611 | case 'set-status-revoked': |
612 | - give_update_payment_status( $id, 'revoked' ); |
|
612 | + give_update_payment_status($id, 'revoked'); |
|
613 | 613 | break; |
614 | 614 | |
615 | 615 | case 'set-status-failed': |
616 | - give_update_payment_status( $id, 'failed' ); |
|
616 | + give_update_payment_status($id, 'failed'); |
|
617 | 617 | break; |
618 | 618 | |
619 | 619 | case 'set-status-cancelled': |
620 | - give_update_payment_status( $id, 'cancelled' ); |
|
620 | + give_update_payment_status($id, 'cancelled'); |
|
621 | 621 | break; |
622 | 622 | |
623 | 623 | case 'set-status-abandoned': |
624 | - give_update_payment_status( $id, 'abandoned' ); |
|
624 | + give_update_payment_status($id, 'abandoned'); |
|
625 | 625 | break; |
626 | 626 | |
627 | 627 | case 'set-status-preapproval': |
628 | - give_update_payment_status( $id, 'preapproval' ); |
|
628 | + give_update_payment_status($id, 'preapproval'); |
|
629 | 629 | break; |
630 | 630 | |
631 | 631 | case 'resend-receipt': |
632 | - give_email_donation_receipt( $id, false ); |
|
632 | + give_email_donation_receipt($id, false); |
|
633 | 633 | break; |
634 | 634 | }// End switch(). |
635 | 635 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | * @param int $id The ID of the payment. |
642 | 642 | * @param string $current_action The action that is being triggered. |
643 | 643 | */ |
644 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
644 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
645 | 645 | }// End foreach(). |
646 | 646 | |
647 | 647 | } |
@@ -657,29 +657,29 @@ discard block |
||
657 | 657 | |
658 | 658 | $args = array(); |
659 | 659 | |
660 | - if ( isset( $_GET['user'] ) ) { |
|
661 | - $args['user'] = urldecode( $_GET['user'] ); |
|
662 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
663 | - $args['donor'] = absint( $_GET['donor'] ); |
|
664 | - } elseif ( isset( $_GET['s'] ) ) { |
|
665 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
666 | - if ( $is_user ) { |
|
667 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
668 | - unset( $args['s'] ); |
|
660 | + if (isset($_GET['user'])) { |
|
661 | + $args['user'] = urldecode($_GET['user']); |
|
662 | + } elseif (isset($_GET['donor'])) { |
|
663 | + $args['donor'] = absint($_GET['donor']); |
|
664 | + } elseif (isset($_GET['s'])) { |
|
665 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
666 | + if ($is_user) { |
|
667 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
668 | + unset($args['s']); |
|
669 | 669 | } else { |
670 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
670 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
675 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
674 | + if ( ! empty($_GET['start-date'])) { |
|
675 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
676 | 676 | } |
677 | 677 | |
678 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
679 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
678 | + if ( ! empty($_GET['end-date'])) { |
|
679 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
680 | 680 | } |
681 | 681 | |
682 | - $payment_count = give_count_payments( $args ); |
|
682 | + $payment_count = give_count_payments($args); |
|
683 | 683 | $this->complete_count = $payment_count->publish; |
684 | 684 | $this->pending_count = $payment_count->pending; |
685 | 685 | $this->processing_count = $payment_count->processing; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $this->cancelled_count = $payment_count->cancelled; |
690 | 690 | $this->abandoned_count = $payment_count->abandoned; |
691 | 691 | |
692 | - foreach ( $payment_count as $count ) { |
|
692 | + foreach ($payment_count as $count) { |
|
693 | 693 | $this->total_count += $count; |
694 | 694 | } |
695 | 695 | } |
@@ -704,27 +704,27 @@ discard block |
||
704 | 704 | public function payments_data() { |
705 | 705 | |
706 | 706 | $per_page = $this->per_page; |
707 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
708 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
709 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
710 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
711 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
712 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
713 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
714 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
715 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
716 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
717 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
718 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
719 | - |
|
720 | - if ( ! empty( $search ) ) { |
|
707 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
708 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
709 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
710 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
711 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
712 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
713 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
714 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
715 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
716 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
717 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
718 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
719 | + |
|
720 | + if ( ! empty($search)) { |
|
721 | 721 | $status = 'any'; // Force all payment statuses when searching. |
722 | 722 | } |
723 | 723 | |
724 | 724 | $args = array( |
725 | 725 | 'output' => 'payments', |
726 | 726 | 'number' => $per_page, |
727 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
727 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
728 | 728 | 'orderby' => $orderby, |
729 | 729 | 'order' => $order, |
730 | 730 | 'user' => $user, |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | 'end_date' => $end_date, |
740 | 740 | ); |
741 | 741 | |
742 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
742 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
743 | 743 | $args['search_in_notes'] = true; |
744 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
744 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
745 | 745 | } |
746 | 746 | |
747 | - $p_query = new Give_Payments_Query( $args ); |
|
747 | + $p_query = new Give_Payments_Query($args); |
|
748 | 748 | |
749 | 749 | return $p_query->get_payments(); |
750 | 750 | |
@@ -764,17 +764,17 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function prepare_items() { |
766 | 766 | |
767 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
767 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
768 | 768 | |
769 | 769 | $columns = $this->get_columns(); |
770 | 770 | $hidden = array(); // No hidden columns. |
771 | 771 | $sortable = $this->get_sortable_columns(); |
772 | 772 | $data = $this->payments_data(); |
773 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
773 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
774 | 774 | |
775 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
775 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
776 | 776 | |
777 | - switch ( $status ) { |
|
777 | + switch ($status) { |
|
778 | 778 | case 'publish': |
779 | 779 | $total_items = $this->complete_count; |
780 | 780 | break; |
@@ -804,20 +804,20 @@ discard block |
||
804 | 804 | break; |
805 | 805 | default: |
806 | 806 | // Retrieve the count of the non-default-Give status. |
807 | - $count = wp_count_posts( 'give_payment' ); |
|
808 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
807 | + $count = wp_count_posts('give_payment'); |
|
808 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
809 | 809 | break; |
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->items = $data; |
813 | 813 | |
814 | - $this->set_pagination_args( array( |
|
814 | + $this->set_pagination_args(array( |
|
815 | 815 | 'total_items' => $total_items, |
816 | 816 | // We have to calculate the total number of items. |
817 | 817 | 'per_page' => $this->per_page, |
818 | 818 | // We have to determine how many items to show on a page. |
819 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
819 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
820 | 820 | // We have to calculate the total number of pages. |
821 | - ) ); |
|
821 | + )); |
|
822 | 822 | } |
823 | 823 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Allows plugins to use their own update API. |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | * @param string $_plugin_file Path to the plugin file. |
30 | 30 | * @param array $_api_data Optional data to send with API calls. |
31 | 31 | */ |
32 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
32 | + public function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
33 | 33 | |
34 | 34 | global $edd_plugin_data; |
35 | 35 | |
36 | - $this->api_url = trailingslashit( $_api_url ); |
|
36 | + $this->api_url = trailingslashit($_api_url); |
|
37 | 37 | $this->api_data = $_api_data; |
38 | - $this->name = plugin_basename( $_plugin_file ); |
|
39 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
38 | + $this->name = plugin_basename($_plugin_file); |
|
39 | + $this->slug = basename($_plugin_file, '.php'); |
|
40 | 40 | $this->version = $_api_data['version']; |
41 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
42 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
43 | - $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
41 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
42 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
43 | + $this->cache_key = md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
44 | 44 | |
45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
45 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
46 | 46 | |
47 | 47 | // Set up hooks. |
48 | 48 | $this->init(); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function init() { |
60 | 60 | |
61 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
62 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
65 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
61 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
62 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
63 | + remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10); |
|
64 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
65 | + add_action('admin_init', array($this, 'show_changelog')); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -79,41 +79,41 @@ discard block |
||
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | 80 | * @return array Modified update array with custom plugin data. |
81 | 81 | */ |
82 | - public function check_update( $_transient_data ) { |
|
82 | + public function check_update($_transient_data) { |
|
83 | 83 | |
84 | 84 | global $pagenow; |
85 | 85 | |
86 | - if ( ! is_object( $_transient_data ) ) { |
|
86 | + if ( ! is_object($_transient_data)) { |
|
87 | 87 | $_transient_data = new stdClass; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
90 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
91 | 91 | return $_transient_data; |
92 | 92 | } |
93 | 93 | |
94 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
94 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
95 | 95 | return $_transient_data; |
96 | 96 | } |
97 | 97 | |
98 | 98 | $version_info = $this->get_cached_version_info(); |
99 | 99 | |
100 | - if ( false === $version_info ) { |
|
101 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
100 | + if (false === $version_info) { |
|
101 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
102 | 102 | |
103 | - $this->set_version_info_cache( $version_info ); |
|
103 | + $this->set_version_info_cache($version_info); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
107 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
108 | 108 | |
109 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
109 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
110 | 110 | |
111 | - $_transient_data->response[ $this->name ] = $version_info; |
|
111 | + $_transient_data->response[$this->name] = $version_info; |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - $_transient_data->last_checked = current_time( 'timestamp' ); |
|
116 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
115 | + $_transient_data->last_checked = current_time('timestamp'); |
|
116 | + $_transient_data->checked[$this->name] = $this->version; |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -126,97 +126,97 @@ discard block |
||
126 | 126 | * @param string $file |
127 | 127 | * @param array $plugin |
128 | 128 | */ |
129 | - public function show_update_notification( $file, $plugin ) { |
|
129 | + public function show_update_notification($file, $plugin) { |
|
130 | 130 | |
131 | - if ( is_network_admin() ) { |
|
131 | + if (is_network_admin()) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
135 | + if ( ! current_user_can('update_plugins')) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | - if( ! is_multisite() ) { |
|
139 | + if ( ! is_multisite()) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | - if ( $this->name != $file ) { |
|
143 | + if ($this->name != $file) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Remove our filter on the site transient |
148 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
148 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
149 | 149 | |
150 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
150 | + $update_cache = get_site_transient('update_plugins'); |
|
151 | 151 | |
152 | - $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
|
152 | + $update_cache = is_object($update_cache) ? $update_cache : new stdClass(); |
|
153 | 153 | |
154 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
154 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
155 | 155 | |
156 | 156 | $version_info = $this->get_cached_version_info(); |
157 | 157 | |
158 | - if ( false === $version_info ) { |
|
159 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
158 | + if (false === $version_info) { |
|
159 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
160 | 160 | |
161 | - $this->set_version_info_cache( $version_info ); |
|
161 | + $this->set_version_info_cache($version_info); |
|
162 | 162 | } |
163 | 163 | |
164 | - if ( ! is_object( $version_info ) ) { |
|
164 | + if ( ! is_object($version_info)) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
168 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
169 | 169 | |
170 | - $update_cache->response[ $this->name ] = $version_info; |
|
170 | + $update_cache->response[$this->name] = $version_info; |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | - $update_cache->last_checked = current_time( 'timestamp' ); |
|
175 | - $update_cache->checked[ $this->name ] = $this->version; |
|
174 | + $update_cache->last_checked = current_time('timestamp'); |
|
175 | + $update_cache->checked[$this->name] = $this->version; |
|
176 | 176 | |
177 | - set_site_transient( 'update_plugins', $update_cache ); |
|
177 | + set_site_transient('update_plugins', $update_cache); |
|
178 | 178 | |
179 | 179 | } else { |
180 | 180 | |
181 | - $version_info = $update_cache->response[ $this->name ]; |
|
181 | + $version_info = $update_cache->response[$this->name]; |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
185 | 185 | // Restore our filter |
186 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
186 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
187 | 187 | |
188 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
188 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
189 | 189 | |
190 | 190 | // build a plugin list row, with update notification |
191 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
191 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
192 | 192 | # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
193 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
193 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
194 | 194 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
195 | 195 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
196 | 196 | |
197 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
197 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
198 | 198 | |
199 | - if ( empty( $version_info->download_link ) ) { |
|
199 | + if (empty($version_info->download_link)) { |
|
200 | 200 | printf( |
201 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ), |
|
202 | - esc_html( $version_info->name ), |
|
203 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
204 | - esc_html( $version_info->new_version ), |
|
201 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'), |
|
202 | + esc_html($version_info->name), |
|
203 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
204 | + esc_html($version_info->new_version), |
|
205 | 205 | '</a>' |
206 | 206 | ); |
207 | 207 | } else { |
208 | 208 | printf( |
209 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ), |
|
210 | - esc_html( $version_info->name ), |
|
211 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
212 | - esc_html( $version_info->new_version ), |
|
209 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'), |
|
210 | + esc_html($version_info->name), |
|
211 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
212 | + esc_html($version_info->new_version), |
|
213 | 213 | '</a>', |
214 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
214 | + '<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">', |
|
215 | 215 | '</a>' |
216 | 216 | ); |
217 | 217 | } |
218 | 218 | |
219 | - do_action( "in_plugin_update_message-{$file}", $plugin, $version_info ); |
|
219 | + do_action("in_plugin_update_message-{$file}", $plugin, $version_info); |
|
220 | 220 | |
221 | 221 | echo '</div></td></tr>'; |
222 | 222 | } |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * @param object $_args |
233 | 233 | * @return object $_data |
234 | 234 | */ |
235 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
235 | + public function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
236 | 236 | |
237 | - if ( $_action != 'plugin_information' ) { |
|
237 | + if ($_action != 'plugin_information') { |
|
238 | 238 | |
239 | 239 | return $_data; |
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
243 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
244 | 244 | |
245 | 245 | return $_data; |
246 | 246 | |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | ) |
256 | 256 | ); |
257 | 257 | |
258 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
258 | + $cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
259 | 259 | |
260 | 260 | // Get the transient where we store the api request for this plugin for 24 hours |
261 | - $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
|
261 | + $edd_api_request_transient = $this->get_cached_version_info($cache_key); |
|
262 | 262 | |
263 | 263 | //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
264 | - if ( empty( $edd_api_request_transient ) ) { |
|
264 | + if (empty($edd_api_request_transient)) { |
|
265 | 265 | |
266 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
266 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
267 | 267 | |
268 | 268 | // Expires in 3 hours |
269 | - $this->set_version_info_cache( $api_response, $cache_key ); |
|
269 | + $this->set_version_info_cache($api_response, $cache_key); |
|
270 | 270 | |
271 | - if ( false !== $api_response ) { |
|
271 | + if (false !== $api_response) { |
|
272 | 272 | $_data = $api_response; |
273 | 273 | } |
274 | 274 | |
@@ -277,20 +277,20 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
280 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
280 | + if (isset($_data->sections) && ! is_array($_data->sections)) { |
|
281 | 281 | $new_sections = array(); |
282 | - foreach ( $_data->sections as $key => $value ) { |
|
283 | - $new_sections[ $key ] = $value; |
|
282 | + foreach ($_data->sections as $key => $value) { |
|
283 | + $new_sections[$key] = $value; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $_data->sections = $new_sections; |
287 | 287 | } |
288 | 288 | |
289 | 289 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
290 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
290 | + if (isset($_data->banners) && ! is_array($_data->banners)) { |
|
291 | 291 | $new_banners = array(); |
292 | - foreach ( $_data->banners as $key => $value ) { |
|
293 | - $new_banners[ $key ] = $value; |
|
292 | + foreach ($_data->banners as $key => $value) { |
|
293 | + $new_banners[$key] = $value; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $_data->banners = $new_banners; |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @param string $url |
307 | 307 | * @return object $array |
308 | 308 | */ |
309 | - public function http_request_args( $args, $url ) { |
|
309 | + public function http_request_args($args, $url) { |
|
310 | 310 | // If it is an https request and we are performing a package download, disable ssl verification |
311 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
311 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
312 | 312 | $args['sslverify'] = false; |
313 | 313 | } |
314 | 314 | return $args; |
@@ -325,50 +325,50 @@ discard block |
||
325 | 325 | * @param array $_data Parameters for the API action. |
326 | 326 | * @return false|object |
327 | 327 | */ |
328 | - private function api_request( $_action, $_data ) { |
|
328 | + private function api_request($_action, $_data) { |
|
329 | 329 | |
330 | 330 | global $wp_version; |
331 | 331 | |
332 | - $data = array_merge( $this->api_data, $_data ); |
|
332 | + $data = array_merge($this->api_data, $_data); |
|
333 | 333 | |
334 | - if ( $data['slug'] != $this->slug ) { |
|
334 | + if ($data['slug'] != $this->slug) { |
|
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
338 | - if( $this->api_url == trailingslashit (home_url() ) ) { |
|
338 | + if ($this->api_url == trailingslashit(home_url())) { |
|
339 | 339 | return false; // Don't allow a plugin to ping itself |
340 | 340 | } |
341 | 341 | |
342 | 342 | $api_params = array( |
343 | 343 | 'edd_action' => 'get_version', |
344 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
345 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
346 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
347 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
344 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
345 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
346 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
347 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
348 | 348 | 'slug' => $data['slug'], |
349 | 349 | 'author' => $data['author'], |
350 | 350 | 'url' => home_url(), |
351 | - 'beta' => ! empty( $data['beta'] ), |
|
351 | + 'beta' => ! empty($data['beta']), |
|
352 | 352 | ); |
353 | 353 | |
354 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
354 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
355 | 355 | |
356 | - if ( ! is_wp_error( $request ) ) { |
|
357 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
356 | + if ( ! is_wp_error($request)) { |
|
357 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( $request && isset( $request->sections ) ) { |
|
361 | - $request->sections = maybe_unserialize( $request->sections ); |
|
360 | + if ($request && isset($request->sections)) { |
|
361 | + $request->sections = maybe_unserialize($request->sections); |
|
362 | 362 | } else { |
363 | 363 | $request = false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( $request && isset( $request->banners ) ) { |
|
367 | - $request->banners = maybe_unserialize( $request->banners ); |
|
366 | + if ($request && isset($request->banners)) { |
|
367 | + $request->banners = maybe_unserialize($request->banners); |
|
368 | 368 | } |
369 | 369 | |
370 | - if( ! empty( $request->sections ) ) { |
|
371 | - foreach( $request->sections as $key => $section ) { |
|
370 | + if ( ! empty($request->sections)) { |
|
371 | + foreach ($request->sections as $key => $section) { |
|
372 | 372 | $request->$key = (array) $section; |
373 | 373 | } |
374 | 374 | } |
@@ -380,97 +380,97 @@ discard block |
||
380 | 380 | |
381 | 381 | global $edd_plugin_data; |
382 | 382 | |
383 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
383 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
387 | + if (empty($_REQUEST['plugin'])) { |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 | |
391 | - if( empty( $_REQUEST['slug'] ) ) { |
|
391 | + if (empty($_REQUEST['slug'])) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | |
395 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
396 | - wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
395 | + if ( ! current_user_can('update_plugins')) { |
|
396 | + wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403)); |
|
397 | 397 | } |
398 | 398 | |
399 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
400 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
401 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
402 | - $version_info = $this->get_cached_version_info( $cache_key ); |
|
399 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
400 | + $beta = ! empty($data['beta']) ? true : false; |
|
401 | + $cache_key = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info'); |
|
402 | + $version_info = $this->get_cached_version_info($cache_key); |
|
403 | 403 | |
404 | - if( false === $version_info ) { |
|
404 | + if (false === $version_info) { |
|
405 | 405 | |
406 | 406 | $api_params = array( |
407 | 407 | 'edd_action' => 'get_version', |
408 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
409 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
408 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
409 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
410 | 410 | 'slug' => $_REQUEST['slug'], |
411 | 411 | 'author' => $data['author'], |
412 | 412 | 'url' => home_url(), |
413 | - 'beta' => ! empty( $data['beta'] ) |
|
413 | + 'beta' => ! empty($data['beta']) |
|
414 | 414 | ); |
415 | 415 | |
416 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
416 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
417 | 417 | |
418 | - if ( ! is_wp_error( $request ) ) { |
|
419 | - $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
|
418 | + if ( ! is_wp_error($request)) { |
|
419 | + $version_info = json_decode(wp_remote_retrieve_body($request)); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
423 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
424 | - $version_info->sections = maybe_unserialize( $version_info->sections ); |
|
423 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
424 | + $version_info->sections = maybe_unserialize($version_info->sections); |
|
425 | 425 | } else { |
426 | 426 | $version_info = false; |
427 | 427 | } |
428 | 428 | |
429 | - if( ! empty( $version_info ) ) { |
|
430 | - foreach( $version_info->sections as $key => $section ) { |
|
429 | + if ( ! empty($version_info)) { |
|
430 | + foreach ($version_info->sections as $key => $section) { |
|
431 | 431 | $version_info->$key = (array) $section; |
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | - $this->set_version_info_cache( $version_info, $cache_key ); |
|
435 | + $this->set_version_info_cache($version_info, $cache_key); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | |
439 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
440 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
439 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
440 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | exit; |
444 | 444 | } |
445 | 445 | |
446 | - public function get_cached_version_info( $cache_key = '' ) { |
|
446 | + public function get_cached_version_info($cache_key = '') { |
|
447 | 447 | |
448 | - if( empty( $cache_key ) ) { |
|
448 | + if (empty($cache_key)) { |
|
449 | 449 | $cache_key = $this->cache_key; |
450 | 450 | } |
451 | 451 | |
452 | - $cache = get_option( $cache_key ); |
|
452 | + $cache = get_option($cache_key); |
|
453 | 453 | |
454 | - if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) { |
|
454 | + if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) { |
|
455 | 455 | return false; // Cache is expired |
456 | 456 | } |
457 | 457 | |
458 | - return json_decode( $cache['value'] ); |
|
458 | + return json_decode($cache['value']); |
|
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | - public function set_version_info_cache( $value = '', $cache_key = '' ) { |
|
462 | + public function set_version_info_cache($value = '', $cache_key = '') { |
|
463 | 463 | |
464 | - if( empty( $cache_key ) ) { |
|
464 | + if (empty($cache_key)) { |
|
465 | 465 | $cache_key = $this->cache_key; |
466 | 466 | } |
467 | 467 | |
468 | 468 | $data = array( |
469 | - 'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ), |
|
470 | - 'value' => json_encode( $value ) |
|
469 | + 'timeout' => strtotime('+3 hours', current_time('timestamp')), |
|
470 | + 'value' => json_encode($value) |
|
471 | 471 | ); |
472 | 472 | |
473 | - update_option( $cache_key, $data ); |
|
473 | + update_option($cache_key, $data); |
|
474 | 474 | |
475 | 475 | } |
476 | 476 |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | // Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => __( 'Name', 'give' ), |
|
36 | - 'form_category' => __( 'Categories', 'give' ), |
|
37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
38 | - 'price' => __( 'Amount', 'give' ), |
|
39 | - 'goal' => __( 'Goal', 'give' ), |
|
40 | - 'donations' => __( 'Donations', 'give' ), |
|
41 | - 'earnings' => __( 'Income', 'give' ), |
|
42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
43 | - 'date' => __( 'Date', 'give' ), |
|
35 | + 'title' => __('Name', 'give'), |
|
36 | + 'form_category' => __('Categories', 'give'), |
|
37 | + 'form_tag' => __('Tags', 'give'), |
|
38 | + 'price' => __('Amount', 'give'), |
|
39 | + 'goal' => __('Goal', 'give'), |
|
40 | + 'donations' => __('Donations', 'give'), |
|
41 | + 'earnings' => __('Income', 'give'), |
|
42 | + 'shortcode' => __('Shortcode', 'give'), |
|
43 | + 'date' => __('Date', 'give'), |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | // Does the user want categories / tags? |
47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,59 +66,59 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | |
72 | - switch ( $column_name ) { |
|
72 | + switch ($column_name) { |
|
73 | 73 | case 'form_category': |
74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
75 | 75 | break; |
76 | 76 | case 'form_tag': |
77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
78 | 78 | break; |
79 | 79 | case 'price': |
80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
81 | - echo give_price_range( $post_id ); |
|
80 | + if (give_has_variable_prices($post_id)) { |
|
81 | + echo give_price_range($post_id); |
|
82 | 82 | } else { |
83 | - echo give_price( $post_id, false ); |
|
84 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
83 | + echo give_price($post_id, false); |
|
84 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
85 | 85 | } |
86 | 86 | break; |
87 | 87 | case 'goal': |
88 | - if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
89 | - echo give_goal( $post_id, false ); |
|
88 | + if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) { |
|
89 | + echo give_goal($post_id, false); |
|
90 | 90 | } else { |
91 | - esc_html_e( 'No Goal Set', 'give' ); |
|
91 | + esc_html_e('No Goal Set', 'give'); |
|
92 | 92 | } |
93 | 93 | |
94 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
94 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
95 | 95 | break; |
96 | 96 | case 'donations': |
97 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
98 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">'; |
|
99 | - echo give_get_form_sales_stats( $post_id ); |
|
97 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
98 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">'; |
|
99 | + echo give_get_form_sales_stats($post_id); |
|
100 | 100 | echo '</a>'; |
101 | 101 | } else { |
102 | 102 | echo '-'; |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | case 'earnings': |
106 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
107 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">'; |
|
108 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
106 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
107 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">'; |
|
108 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
109 | 109 | echo '</a>'; |
110 | 110 | } else { |
111 | 111 | echo '-'; |
112 | 112 | } |
113 | 113 | break; |
114 | 114 | case 'shortcode': |
115 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
115 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
116 | 116 | break; |
117 | 117 | }// End switch(). |
118 | 118 | }// End if(). |
119 | 119 | } |
120 | 120 | |
121 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
121 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Registers the sortable columns in the list table |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return array $columns Array of sortable columns |
131 | 131 | */ |
132 | -function give_sortable_form_columns( $columns ) { |
|
132 | +function give_sortable_form_columns($columns) { |
|
133 | 133 | $columns['price'] = 'amount'; |
134 | 134 | $columns['sales'] = 'sales'; |
135 | 135 | $columns['earnings'] = 'earnings'; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return $columns; |
140 | 140 | } |
141 | 141 | |
142 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
142 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Sorts Columns in the Forms List Table |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return array $vars Array of all the sort variables. |
152 | 152 | */ |
153 | -function give_sort_forms( $vars ) { |
|
153 | +function give_sort_forms($vars) { |
|
154 | 154 | // Check if we're viewing the "give_forms" post type. |
155 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
155 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
156 | 156 | return $vars; |
157 | 157 | } |
158 | 158 | |
159 | - switch ( $vars['orderby'] ) { |
|
159 | + switch ($vars['orderby']) { |
|
160 | 160 | // Check if 'orderby' is set to "sales". |
161 | 161 | case 'sales': |
162 | 162 | $vars = array_merge( |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | // Check if "orderby" is set to "price/amount". |
183 | 183 | case 'amount': |
184 | - $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
184 | + $multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
185 | 185 | |
186 | 186 | $vars['orderby'] = 'meta_value_num'; |
187 | 187 | $vars['meta_query'] = array( |
@@ -233,17 +233,17 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return array Array of all sort variables. |
235 | 235 | */ |
236 | -function give_filter_forms( $vars ) { |
|
237 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
236 | +function give_filter_forms($vars) { |
|
237 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
238 | 238 | |
239 | 239 | // If an author ID was passed, use it |
240 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
240 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
241 | 241 | |
242 | 242 | $author_id = $_REQUEST['author']; |
243 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
244 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
243 | + if ((int) $author_id !== get_current_user_id()) { |
|
244 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array( |
|
245 | 245 | 'response' => 403, |
246 | - ) ); |
|
246 | + )); |
|
247 | 247 | } |
248 | 248 | $vars = array_merge( |
249 | 249 | $vars, |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @return void |
268 | 268 | */ |
269 | 269 | function give_forms_load() { |
270 | - add_filter( 'request', 'give_sort_forms' ); |
|
271 | - add_filter( 'request', 'give_filter_forms' ); |
|
270 | + add_filter('request', 'give_sort_forms'); |
|
271 | + add_filter('request', 'give_filter_forms'); |
|
272 | 272 | } |
273 | 273 | |
274 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
274 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Remove Forms Month Filter |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | * @global $typenow The post type we are viewing. |
286 | 286 | * @return array Empty array disables the dropdown. |
287 | 287 | */ |
288 | -function give_remove_month_filter( $dates ) { |
|
288 | +function give_remove_month_filter($dates) { |
|
289 | 289 | global $typenow; |
290 | 290 | |
291 | - if ( $typenow == 'give_forms' ) { |
|
291 | + if ($typenow == 'give_forms') { |
|
292 | 292 | $dates = array(); |
293 | 293 | } |
294 | 294 | |
295 | 295 | return $dates; |
296 | 296 | } |
297 | 297 | |
298 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
298 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Updates price when saving post |
@@ -306,23 +306,23 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return int|null |
308 | 308 | */ |
309 | -function give_price_save_quick_edit( $post_id ) { |
|
310 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
309 | +function give_price_save_quick_edit($post_id) { |
|
310 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
311 | 311 | return; |
312 | 312 | } |
313 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
313 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
314 | 314 | return $post_id; |
315 | 315 | } |
316 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
316 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
317 | 317 | return $post_id; |
318 | 318 | } |
319 | 319 | |
320 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
321 | - give_update_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
320 | + if (isset($_REQUEST['_give_regprice'])) { |
|
321 | + give_update_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
325 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Process bulk edit actions via AJAX |
@@ -332,18 +332,18 @@ discard block |
||
332 | 332 | */ |
333 | 333 | function give_save_bulk_edit() { |
334 | 334 | |
335 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
335 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
336 | 336 | |
337 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
338 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
339 | - foreach ( $post_ids as $post_id ) { |
|
337 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
338 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
339 | + foreach ($post_ids as $post_id) { |
|
340 | 340 | |
341 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
341 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
342 | 342 | continue; |
343 | 343 | } |
344 | 344 | |
345 | - if ( ! empty( $price ) ) { |
|
346 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
345 | + if ( ! empty($price)) { |
|
346 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | } |
@@ -351,4 +351,4 @@ discard block |
||
351 | 351 | die(); |
352 | 352 | } |
353 | 353 | |
354 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
354 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | */ |
84 | 84 | function get_settings() { |
85 | 85 | $post_id = give_get_admin_post_id(); |
86 | - $price = give_get_form_price( $post_id ); |
|
87 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
88 | - $goal = give_get_form_goal( $post_id ); |
|
86 | + $price = give_get_form_price($post_id); |
|
87 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
88 | + $goal = give_get_form_goal($post_id); |
|
89 | 89 | |
90 | 90 | // No empty prices - min. 1.00 for new forms |
91 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
92 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
91 | + if (empty($price) && is_null($post_id)) { |
|
92 | + $price = esc_attr(give_format_decimal('1.00')); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Min. $1.00 for new forms |
96 | - if ( empty( $custom_amount_minimum ) ) { |
|
97 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
96 | + if (empty($custom_amount_minimum)) { |
|
97 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // Start with an underscore to hide fields from custom fields list |
@@ -104,215 +104,215 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Repeatable Field Groups |
106 | 106 | */ |
107 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
107 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
108 | 108 | 'id' => 'form_field_options', |
109 | - 'title' => __( 'Donation Options', 'give' ), |
|
109 | + 'title' => __('Donation Options', 'give'), |
|
110 | 110 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
111 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
111 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
112 | 112 | // Donation Option |
113 | 113 | array( |
114 | - 'name' => __( 'Donation Option', 'give' ), |
|
115 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
116 | - 'id' => $prefix . 'price_option', |
|
114 | + 'name' => __('Donation Option', 'give'), |
|
115 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
116 | + 'id' => $prefix.'price_option', |
|
117 | 117 | 'type' => 'radio_inline', |
118 | 118 | 'default' => 'set', |
119 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
120 | - 'set' => __( 'Set Donation', 'give' ), |
|
121 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
122 | - ) ), |
|
119 | + 'options' => apply_filters('give_forms_price_options', array( |
|
120 | + 'set' => __('Set Donation', 'give'), |
|
121 | + 'multi' => __('Multi-level Donation', 'give'), |
|
122 | + )), |
|
123 | 123 | ), |
124 | 124 | array( |
125 | - 'name' => __( 'Set Donation', 'give' ), |
|
126 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
127 | - 'id' => $prefix . 'set_price', |
|
125 | + 'name' => __('Set Donation', 'give'), |
|
126 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
127 | + 'id' => $prefix.'set_price', |
|
128 | 128 | 'type' => 'text_small', |
129 | 129 | 'data_type' => 'price', |
130 | 130 | 'attributes' => array( |
131 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
132 | - 'value' => give_format_decimal( $price ), |
|
131 | + 'placeholder' => give_format_decimal('1.00'), |
|
132 | + 'value' => give_format_decimal($price), |
|
133 | 133 | 'class' => 'give-money-field', |
134 | 134 | ), |
135 | 135 | ), |
136 | 136 | // Display Style |
137 | 137 | array( |
138 | - 'name' => __( 'Display Style', 'give' ), |
|
139 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
140 | - 'id' => $prefix . 'display_style', |
|
138 | + 'name' => __('Display Style', 'give'), |
|
139 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
140 | + 'id' => $prefix.'display_style', |
|
141 | 141 | 'type' => 'radio_inline', |
142 | 142 | 'default' => 'buttons', |
143 | 143 | 'options' => array( |
144 | - 'buttons' => __( 'Buttons', 'give' ), |
|
145 | - 'radios' => __( 'Radios', 'give' ), |
|
146 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
144 | + 'buttons' => __('Buttons', 'give'), |
|
145 | + 'radios' => __('Radios', 'give'), |
|
146 | + 'dropdown' => __('Dropdown', 'give'), |
|
147 | 147 | ), |
148 | 148 | ), |
149 | 149 | // Custom Amount |
150 | 150 | array( |
151 | - 'name' => __( 'Custom Amount', 'give' ), |
|
152 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
153 | - 'id' => $prefix . 'custom_amount', |
|
151 | + 'name' => __('Custom Amount', 'give'), |
|
152 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
153 | + 'id' => $prefix.'custom_amount', |
|
154 | 154 | 'type' => 'radio_inline', |
155 | 155 | 'default' => 'disabled', |
156 | 156 | 'options' => array( |
157 | - 'enabled' => __( 'Enabled', 'give' ), |
|
158 | - 'disabled' => __( 'Disabled', 'give' ), |
|
157 | + 'enabled' => __('Enabled', 'give'), |
|
158 | + 'disabled' => __('Disabled', 'give'), |
|
159 | 159 | ), |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Minimum Amount', 'give' ), |
|
163 | - 'description' => __( 'Enter the minimum custom donation amount.', 'give' ), |
|
164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
162 | + 'name' => __('Minimum Amount', 'give'), |
|
163 | + 'description' => __('Enter the minimum custom donation amount.', 'give'), |
|
164 | + 'id' => $prefix.'custom_amount_minimum', |
|
165 | 165 | 'type' => 'text_small', |
166 | 166 | 'data_type' => 'price', |
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_decimal('1.00'), |
|
169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
170 | 170 | 'class' => 'give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text_medium', |
178 | 178 | 'attributes' => array( |
179 | 179 | 'rows' => 3, |
180 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
180 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
181 | 181 | ), |
182 | 182 | ), |
183 | 183 | // Donation Levels: Repeatable CMB2 Group |
184 | 184 | array( |
185 | - 'id' => $prefix . 'donation_levels', |
|
185 | + 'id' => $prefix.'donation_levels', |
|
186 | 186 | 'type' => 'group', |
187 | 187 | 'options' => array( |
188 | - 'add_button' => __( 'Add Level', 'give' ), |
|
189 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
188 | + 'add_button' => __('Add Level', 'give'), |
|
189 | + 'header_title' => __('Donation Level', 'give'), |
|
190 | 190 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
191 | 191 | ), |
192 | 192 | // Fields array works the same, except id's only need to be unique for this group. |
193 | 193 | // Prefix is not needed. |
194 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
194 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
195 | 195 | array( |
196 | - 'name' => __( 'ID', 'give' ), |
|
197 | - 'id' => $prefix . 'id', |
|
196 | + 'name' => __('ID', 'give'), |
|
197 | + 'id' => $prefix.'id', |
|
198 | 198 | 'type' => 'levels_id', |
199 | 199 | ), |
200 | 200 | array( |
201 | - 'name' => __( 'Amount', 'give' ), |
|
202 | - 'id' => $prefix . 'amount', |
|
201 | + 'name' => __('Amount', 'give'), |
|
202 | + 'id' => $prefix.'amount', |
|
203 | 203 | 'type' => 'text_small', |
204 | 204 | 'data_type' => 'price', |
205 | 205 | 'attributes' => array( |
206 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
206 | + 'placeholder' => give_format_decimal('1.00'), |
|
207 | 207 | 'class' => 'give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | array( |
211 | - 'name' => __( 'Text', 'give' ), |
|
212 | - 'id' => $prefix . 'text', |
|
211 | + 'name' => __('Text', 'give'), |
|
212 | + 'id' => $prefix.'text', |
|
213 | 213 | 'type' => 'text', |
214 | 214 | 'attributes' => array( |
215 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
215 | + 'placeholder' => __('Donation Level', 'give'), |
|
216 | 216 | 'class' => 'give-multilevel-text-field', |
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Default', 'give' ), |
|
221 | - 'id' => $prefix . 'default', |
|
220 | + 'name' => __('Default', 'give'), |
|
221 | + 'id' => $prefix.'default', |
|
222 | 222 | 'type' => 'give_default_radio_inline', |
223 | 223 | ), |
224 | - ) ), |
|
224 | + )), |
|
225 | 225 | ), |
226 | 226 | array( |
227 | 227 | 'name' => 'donation_options_docs', |
228 | 228 | 'type' => 'docs_link', |
229 | 229 | 'url' => 'http://docs.givewp.com/form-donation-options', |
230 | - 'title' => __( 'Donation Options', 'give' ), |
|
230 | + 'title' => __('Donation Options', 'give'), |
|
231 | 231 | ), |
232 | 232 | ), |
233 | 233 | $post_id |
234 | 234 | ), |
235 | - ) ), |
|
235 | + )), |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Display Options |
239 | 239 | */ |
240 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
240 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
241 | 241 | 'id' => 'form_display_options', |
242 | - 'title' => __( 'Form Display', 'give' ), |
|
242 | + 'title' => __('Form Display', 'give'), |
|
243 | 243 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
244 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
245 | 245 | array( |
246 | - 'name' => __( 'Display Options', 'give' ), |
|
247 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
248 | - 'id' => $prefix . 'payment_display', |
|
246 | + 'name' => __('Display Options', 'give'), |
|
247 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
248 | + 'id' => $prefix.'payment_display', |
|
249 | 249 | 'type' => 'radio_inline', |
250 | 250 | 'options' => array( |
251 | - 'onpage' => __( 'All Fields', 'give' ), |
|
252 | - 'modal' => __( 'Modal', 'give' ), |
|
253 | - 'reveal' => __( 'Reveal', 'give' ), |
|
254 | - 'button' => __( 'Button', 'give' ), |
|
251 | + 'onpage' => __('All Fields', 'give'), |
|
252 | + 'modal' => __('Modal', 'give'), |
|
253 | + 'reveal' => __('Reveal', 'give'), |
|
254 | + 'button' => __('Button', 'give'), |
|
255 | 255 | ), |
256 | 256 | 'default' => 'onpage', |
257 | 257 | ), |
258 | 258 | array( |
259 | - 'id' => $prefix . 'reveal_label', |
|
260 | - 'name' => __( 'Continue Button', 'give' ), |
|
261 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
259 | + 'id' => $prefix.'reveal_label', |
|
260 | + 'name' => __('Continue Button', 'give'), |
|
261 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
262 | 262 | 'type' => 'text_small', |
263 | 263 | 'attributes' => array( |
264 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
264 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
265 | 265 | ), |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Guest Donations', 'give' ), |
|
284 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
285 | - 'id' => $prefix . 'logged_in_only', |
|
283 | + 'name' => __('Guest Donations', 'give'), |
|
284 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
285 | + 'id' => $prefix.'logged_in_only', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'default' => 'enabled', |
288 | 288 | 'options' => array( |
289 | - 'enabled' => __( 'Enabled', 'give' ), |
|
290 | - 'disabled' => __( 'Disabled', 'give' ), |
|
289 | + 'enabled' => __('Enabled', 'give'), |
|
290 | + 'disabled' => __('Disabled', 'give'), |
|
291 | 291 | ), |
292 | 292 | ), |
293 | 293 | array( |
294 | - 'name' => __( 'Registration', 'give' ), |
|
295 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
296 | - 'id' => $prefix . 'show_register_form', |
|
294 | + 'name' => __('Registration', 'give'), |
|
295 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
296 | + 'id' => $prefix.'show_register_form', |
|
297 | 297 | 'type' => 'radio', |
298 | 298 | 'options' => array( |
299 | - 'none' => __( 'None', 'give' ), |
|
300 | - 'registration' => __( 'Registration', 'give' ), |
|
301 | - 'login' => __( 'Login', 'give' ), |
|
302 | - 'both' => __( 'Registration + Login', 'give' ), |
|
299 | + 'none' => __('None', 'give'), |
|
300 | + 'registration' => __('Registration', 'give'), |
|
301 | + 'login' => __('Login', 'give'), |
|
302 | + 'both' => __('Registration + Login', 'give'), |
|
303 | 303 | ), |
304 | 304 | 'default' => 'none', |
305 | 305 | ), |
306 | 306 | array( |
307 | - 'name' => __( 'Floating Labels', 'give' ), |
|
307 | + 'name' => __('Floating Labels', 'give'), |
|
308 | 308 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
309 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
310 | - 'id' => $prefix . 'form_floating_labels', |
|
309 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
310 | + 'id' => $prefix.'form_floating_labels', |
|
311 | 311 | 'type' => 'radio_inline', |
312 | 312 | 'options' => array( |
313 | - 'global' => __( 'Global Option', 'give' ), |
|
314 | - 'enabled' => __( 'Enabled', 'give' ), |
|
315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
313 | + 'global' => __('Global Option', 'give'), |
|
314 | + 'enabled' => __('Enabled', 'give'), |
|
315 | + 'disabled' => __('Disabled', 'give'), |
|
316 | 316 | ), |
317 | 317 | 'default' => 'global', |
318 | 318 | ), |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'name' => 'form_display_docs', |
321 | 321 | 'type' => 'docs_link', |
322 | 322 | 'url' => 'http://docs.givewp.com/form-display-options', |
323 | - 'title' => __( 'Form Display', 'give' ), |
|
323 | + 'title' => __('Form Display', 'give'), |
|
324 | 324 | ), |
325 | 325 | ), |
326 | 326 | $post_id |
@@ -331,172 +331,172 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Donation Goals |
333 | 333 | */ |
334 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
334 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
335 | 335 | 'id' => 'donation_goal_options', |
336 | - 'title' => __( 'Donation Goal', 'give' ), |
|
336 | + 'title' => __('Donation Goal', 'give'), |
|
337 | 337 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
339 | 339 | // Goals |
340 | 340 | array( |
341 | - 'name' => __( 'Donation Goal', 'give' ), |
|
342 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
343 | - 'id' => $prefix . 'goal_option', |
|
341 | + 'name' => __('Donation Goal', 'give'), |
|
342 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
343 | + 'id' => $prefix.'goal_option', |
|
344 | 344 | 'type' => 'radio_inline', |
345 | 345 | 'default' => 'disabled', |
346 | 346 | 'options' => array( |
347 | - 'enabled' => __( 'Enabled', 'give' ), |
|
348 | - 'disabled' => __( 'Disabled', 'give' ), |
|
347 | + 'enabled' => __('Enabled', 'give'), |
|
348 | + 'disabled' => __('Disabled', 'give'), |
|
349 | 349 | ), |
350 | 350 | ), |
351 | 351 | array( |
352 | - 'name' => __( 'Goal Amount', 'give' ), |
|
353 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
354 | - 'id' => $prefix . 'set_goal', |
|
352 | + 'name' => __('Goal Amount', 'give'), |
|
353 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
354 | + 'id' => $prefix.'set_goal', |
|
355 | 355 | 'type' => 'text_small', |
356 | 356 | 'data_type' => 'price', |
357 | 357 | 'attributes' => array( |
358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
359 | - 'value' => give_format_decimal( $goal ), |
|
358 | + 'placeholder' => give_format_decimal('0.00'), |
|
359 | + 'value' => give_format_decimal($goal), |
|
360 | 360 | 'class' => 'give-money-field', |
361 | 361 | ), |
362 | 362 | ), |
363 | 363 | |
364 | 364 | array( |
365 | - 'name' => __( 'Goal Format', 'give' ), |
|
366 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
367 | - 'id' => $prefix . 'goal_format', |
|
365 | + 'name' => __('Goal Format', 'give'), |
|
366 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
367 | + 'id' => $prefix.'goal_format', |
|
368 | 368 | 'type' => 'radio_inline', |
369 | 369 | 'default' => 'amount', |
370 | 370 | 'options' => array( |
371 | - 'amount' => __( 'Amount', 'give' ), |
|
372 | - 'percentage' => __( 'Percentage', 'give' ), |
|
371 | + 'amount' => __('Amount', 'give'), |
|
372 | + 'percentage' => __('Percentage', 'give'), |
|
373 | 373 | ), |
374 | 374 | ), |
375 | 375 | array( |
376 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
377 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
378 | - 'id' => $prefix . 'goal_color', |
|
376 | + 'name' => __('Progress Bar Color', 'give'), |
|
377 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
378 | + 'id' => $prefix.'goal_color', |
|
379 | 379 | 'type' => 'colorpicker', |
380 | 380 | 'default' => '#2bc253', |
381 | 381 | ), |
382 | 382 | |
383 | 383 | array( |
384 | - 'name' => __( 'Close Form', 'give' ), |
|
385 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
384 | + 'name' => __('Close Form', 'give'), |
|
385 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
387 | 387 | 'type' => 'radio_inline', |
388 | 388 | 'default' => 'disabled', |
389 | 389 | 'options' => array( |
390 | - 'enabled' => __( 'Enabled', 'give' ), |
|
391 | - 'disabled' => __( 'Disabled', 'give' ), |
|
390 | + 'enabled' => __('Enabled', 'give'), |
|
391 | + 'disabled' => __('Disabled', 'give'), |
|
392 | 392 | ), |
393 | 393 | ), |
394 | 394 | array( |
395 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
396 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
395 | + 'name' => __('Goal Achieved Message', 'give'), |
|
396 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
398 | 398 | 'type' => 'wysiwyg', |
399 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
399 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
400 | 400 | ), |
401 | 401 | array( |
402 | 402 | 'name' => 'donation_goal_docs', |
403 | 403 | 'type' => 'docs_link', |
404 | 404 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
405 | - 'title' => __( 'Donation Goal', 'give' ), |
|
405 | + 'title' => __('Donation Goal', 'give'), |
|
406 | 406 | ), |
407 | 407 | ), |
408 | 408 | $post_id |
409 | 409 | ), |
410 | - ) ), |
|
410 | + )), |
|
411 | 411 | |
412 | 412 | /** |
413 | 413 | * Content Field |
414 | 414 | */ |
415 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
415 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
416 | 416 | 'id' => 'form_content_options', |
417 | - 'title' => __( 'Form Content', 'give' ), |
|
417 | + 'title' => __('Form Content', 'give'), |
|
418 | 418 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
419 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
419 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
420 | 420 | |
421 | 421 | // Donation content. |
422 | 422 | array( |
423 | - 'name' => __( 'Display Content', 'give' ), |
|
424 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
425 | - 'id' => $prefix . 'display_content', |
|
423 | + 'name' => __('Display Content', 'give'), |
|
424 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
425 | + 'id' => $prefix.'display_content', |
|
426 | 426 | 'type' => 'radio_inline', |
427 | 427 | 'options' => array( |
428 | - 'enabled' => __( 'Enabled', 'give' ), |
|
429 | - 'disabled' => __( 'Disabled', 'give' ), |
|
428 | + 'enabled' => __('Enabled', 'give'), |
|
429 | + 'disabled' => __('Disabled', 'give'), |
|
430 | 430 | ), |
431 | 431 | 'default' => 'disabled', |
432 | 432 | ), |
433 | 433 | |
434 | 434 | // Content placement. |
435 | 435 | array( |
436 | - 'name' => __( 'Content Placement', 'give' ), |
|
437 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
438 | - 'id' => $prefix . 'content_placement', |
|
436 | + 'name' => __('Content Placement', 'give'), |
|
437 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
438 | + 'id' => $prefix.'content_placement', |
|
439 | 439 | 'type' => 'radio_inline', |
440 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
441 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
442 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
440 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
441 | + 'give_pre_form' => __('Above fields', 'give'), |
|
442 | + 'give_post_form' => __('Below fields', 'give'), |
|
443 | 443 | ) |
444 | 444 | ), |
445 | 445 | 'default' => 'give_pre_form', |
446 | 446 | ), |
447 | 447 | array( |
448 | - 'name' => __( 'Content', 'give' ), |
|
449 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
450 | - 'id' => $prefix . 'form_content', |
|
448 | + 'name' => __('Content', 'give'), |
|
449 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
450 | + 'id' => $prefix.'form_content', |
|
451 | 451 | 'type' => 'wysiwyg', |
452 | 452 | ), |
453 | 453 | array( |
454 | 454 | 'name' => 'form_content_docs', |
455 | 455 | 'type' => 'docs_link', |
456 | 456 | 'url' => 'http://docs.givewp.com/form-content', |
457 | - 'title' => __( 'Form Content', 'give' ), |
|
457 | + 'title' => __('Form Content', 'give'), |
|
458 | 458 | ), |
459 | 459 | ), |
460 | 460 | $post_id |
461 | 461 | ), |
462 | - ) ), |
|
462 | + )), |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Terms & Conditions |
466 | 466 | */ |
467 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
467 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
468 | 468 | 'id' => 'form_terms_options', |
469 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
469 | + 'title' => __('Terms & Conditions', 'give'), |
|
470 | 470 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
472 | 472 | // Donation Option |
473 | 473 | array( |
474 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
475 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
476 | - 'id' => $prefix . 'terms_option', |
|
474 | + 'name' => __('Terms and Conditions', 'give'), |
|
475 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
476 | + 'id' => $prefix.'terms_option', |
|
477 | 477 | 'type' => 'radio_inline', |
478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
479 | - 'global' => __( 'Global Option', 'give' ), |
|
480 | - 'enabled' => __( 'Customize', 'give' ), |
|
481 | - 'disabled' => __( 'Disable', 'give' ), |
|
478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
479 | + 'global' => __('Global Option', 'give'), |
|
480 | + 'enabled' => __('Customize', 'give'), |
|
481 | + 'disabled' => __('Disable', 'give'), |
|
482 | 482 | ) |
483 | 483 | ), |
484 | 484 | 'default' => 'global', |
485 | 485 | ), |
486 | 486 | array( |
487 | - 'id' => $prefix . 'agree_label', |
|
488 | - 'name' => __( 'Agreement Label', 'give' ), |
|
489 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
487 | + 'id' => $prefix.'agree_label', |
|
488 | + 'name' => __('Agreement Label', 'give'), |
|
489 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
490 | 490 | 'type' => 'text', |
491 | 491 | 'size' => 'regular', |
492 | 492 | 'attributes' => array( |
493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
494 | 494 | ), |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'id' => $prefix . 'agree_text', |
|
498 | - 'name' => __( 'Agreement Text', 'give' ), |
|
499 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
497 | + 'id' => $prefix.'agree_text', |
|
498 | + 'name' => __('Agreement Text', 'give'), |
|
499 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
500 | 500 | 'default' => give_get_option('agreement_text'), |
501 | 501 | 'type' => 'wysiwyg', |
502 | 502 | ), |
@@ -504,19 +504,19 @@ discard block |
||
504 | 504 | 'name' => 'terms_docs', |
505 | 505 | 'type' => 'docs_link', |
506 | 506 | 'url' => 'http://docs.givewp.com/form-terms', |
507 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
507 | + 'title' => __('Terms and Conditions', 'give'), |
|
508 | 508 | ), |
509 | 509 | ), |
510 | 510 | $post_id |
511 | 511 | ), |
512 | - ) ), |
|
512 | + )), |
|
513 | 513 | ); |
514 | 514 | |
515 | 515 | |
516 | 516 | /** |
517 | 517 | * Filter the metabox tabbed panel settings. |
518 | 518 | */ |
519 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
519 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
520 | 520 | |
521 | 521 | // Output. |
522 | 522 | return $settings; |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | add_meta_box( |
533 | 533 | $this->get_metabox_ID(), |
534 | 534 | $this->get_metabox_label(), |
535 | - array( $this, 'output' ), |
|
536 | - array( 'give_forms' ), |
|
535 | + array($this, 'output'), |
|
536 | + array('give_forms'), |
|
537 | 537 | 'normal', |
538 | 538 | 'high' |
539 | 539 | ); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | function enqueue_script() { |
550 | 550 | global $post; |
551 | 551 | |
552 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
552 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
553 | 553 | |
554 | 554 | } |
555 | 555 | } |
@@ -584,32 +584,32 @@ discard block |
||
584 | 584 | public function get_tabs() { |
585 | 585 | $tabs = array(); |
586 | 586 | |
587 | - if ( ! empty( $this->settings ) ) { |
|
588 | - foreach ( $this->settings as $setting ) { |
|
589 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
587 | + if ( ! empty($this->settings)) { |
|
588 | + foreach ($this->settings as $setting) { |
|
589 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
590 | 590 | continue; |
591 | 591 | } |
592 | 592 | $tab = array( |
593 | 593 | 'id' => $setting['id'], |
594 | 594 | 'label' => $setting['title'], |
595 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
595 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
596 | 596 | ); |
597 | 597 | |
598 | - if ( $this->has_sub_tab( $setting ) ) { |
|
599 | - if ( empty( $setting['sub-fields'] ) ) { |
|
598 | + if ($this->has_sub_tab($setting)) { |
|
599 | + if (empty($setting['sub-fields'])) { |
|
600 | 600 | $tab = array(); |
601 | 601 | } else { |
602 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
602 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
603 | 603 | $tab['sub-fields'][] = array( |
604 | 604 | 'id' => $sub_fields['id'], |
605 | 605 | 'label' => $sub_fields['title'], |
606 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
606 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
607 | 607 | ); |
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | - if ( ! empty( $tab ) ) { |
|
612 | + if ( ! empty($tab)) { |
|
613 | 613 | $tabs[] = $tab; |
614 | 614 | } |
615 | 615 | } |
@@ -626,27 +626,27 @@ discard block |
||
626 | 626 | */ |
627 | 627 | public function output() { |
628 | 628 | // Bailout. |
629 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
630 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
629 | + if ($form_data_tabs = $this->get_tabs()) { |
|
630 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
631 | 631 | ?> |
632 | 632 | <div class="give-metabox-panel-wrap"> |
633 | 633 | <ul class="give-form-data-tabs give-metabox-tabs"> |
634 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
635 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
634 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
635 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
636 | 636 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
637 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
637 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
638 | 638 | <?php echo $form_data_tab['icon-html']; ?> |
639 | 639 | <?php else : ?> |
640 | 640 | <span class="give-icon give-icon-default"></span> |
641 | 641 | <?php endif; ?> |
642 | 642 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
643 | 643 | </a> |
644 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
644 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
645 | 645 | <ul class="give-metabox-sub-tabs give-hidden"> |
646 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
646 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
647 | 647 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
648 | 648 | <a href="#<?php echo $sub_tab['id']; ?>"> |
649 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
649 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
650 | 650 | <?php echo $sub_tab['icon-html']; ?> |
651 | 651 | <?php else : ?> |
652 | 652 | <span class="give-icon give-icon-default"></span> |
@@ -662,30 +662,30 @@ discard block |
||
662 | 662 | </ul> |
663 | 663 | |
664 | 664 | <?php $show_first_tab_content = true; ?> |
665 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
666 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
667 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
665 | + <?php foreach ($this->settings as $setting) : ?> |
|
666 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
667 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
668 | 668 | |
669 | 669 | <div id="<?php echo $setting['id']; ?>" |
670 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
670 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
671 | 671 | $show_first_tab_content = false; ?>"> |
672 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
673 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
674 | - <?php give_render_field( $field ); ?> |
|
672 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
673 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
674 | + <?php give_render_field($field); ?> |
|
675 | 675 | <?php endforeach; ?> |
676 | 676 | <?php endif; ?> |
677 | 677 | </div> |
678 | 678 | |
679 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
679 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
680 | 680 | <?php else: ?> |
681 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
682 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
683 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
681 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
682 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
683 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
684 | 684 | <div id="<?php echo $sub_fields['id']; ?>" |
685 | 685 | class="panel give_options_panel give-hidden"> |
686 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
687 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
688 | - <?php give_render_field( $sub_field ); ?> |
|
686 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
687 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
688 | + <?php give_render_field($sub_field); ?> |
|
689 | 689 | <?php endforeach; ?> |
690 | 690 | <?php endif; ?> |
691 | 691 | </div> |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return bool |
711 | 711 | */ |
712 | - private function has_sub_tab( $field_setting ) { |
|
712 | + private function has_sub_tab($field_setting) { |
|
713 | 713 | $has_sub_tab = false; |
714 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
714 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
715 | 715 | $has_sub_tab = true; |
716 | 716 | } |
717 | 717 | |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | * @return array |
726 | 726 | */ |
727 | 727 | function cmb2_metabox_settings() { |
728 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
728 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
729 | 729 | $give_forms_settings = $all_cmb2_settings; |
730 | 730 | |
731 | 731 | // Filter settings: Use only give forms related settings. |
732 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
733 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
734 | - unset( $give_forms_settings[ $index ] ); |
|
732 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
733 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
734 | + unset($give_forms_settings[$index]); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -749,97 +749,97 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return void |
751 | 751 | */ |
752 | - public function save( $post_id, $post ) { |
|
752 | + public function save($post_id, $post) { |
|
753 | 753 | |
754 | 754 | // $post_id and $post are required. |
755 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
755 | + if (empty($post_id) || empty($post)) { |
|
756 | 756 | return; |
757 | 757 | } |
758 | 758 | |
759 | 759 | // Don't save meta boxes for revisions or autosaves. |
760 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
760 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
761 | 761 | return; |
762 | 762 | } |
763 | 763 | |
764 | 764 | // Check the nonce. |
765 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
765 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
766 | 766 | return; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
770 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
770 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
771 | 771 | return; |
772 | 772 | } |
773 | 773 | |
774 | 774 | // Check user has permission to edit. |
775 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
775 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
776 | 776 | return; |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Fire action before saving form meta. |
780 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
780 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
781 | 781 | |
782 | 782 | /** |
783 | 783 | * Filter the meta key to save. |
784 | 784 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
785 | 785 | */ |
786 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
786 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
787 | 787 | |
788 | 788 | // Save form meta data. |
789 | - if ( ! empty( $form_meta_keys ) ) { |
|
790 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
789 | + if ( ! empty($form_meta_keys)) { |
|
790 | + foreach ($form_meta_keys as $form_meta_key) { |
|
791 | 791 | |
792 | 792 | // Set default value for checkbox fields. |
793 | 793 | if ( |
794 | - ! isset( $_POST[ $form_meta_key ] ) |
|
795 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
794 | + ! isset($_POST[$form_meta_key]) |
|
795 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
796 | 796 | ) { |
797 | - $_POST[ $form_meta_key ] = ''; |
|
797 | + $_POST[$form_meta_key] = ''; |
|
798 | 798 | } |
799 | 799 | |
800 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
801 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
802 | - if ( ! empty( $setting_field['type'] ) ) { |
|
803 | - switch ( $setting_field['type'] ) { |
|
800 | + if (isset($_POST[$form_meta_key])) { |
|
801 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
802 | + if ( ! empty($setting_field['type'])) { |
|
803 | + switch ($setting_field['type']) { |
|
804 | 804 | case 'textarea': |
805 | 805 | case 'wysiwyg': |
806 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
806 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
807 | 807 | break; |
808 | 808 | |
809 | 809 | case 'group': |
810 | 810 | $form_meta_value = array(); |
811 | 811 | |
812 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
812 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
813 | 813 | |
814 | 814 | // Do not save template input field values. |
815 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
815 | + if ('{{row-count-placeholder}}' === $index) { |
|
816 | 816 | continue; |
817 | 817 | } |
818 | 818 | |
819 | 819 | $group_meta_value = array(); |
820 | - foreach ( $group as $field_id => $field_value ) { |
|
821 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
820 | + foreach ($group as $field_id => $field_value) { |
|
821 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
822 | 822 | case 'wysiwyg': |
823 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
823 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
824 | 824 | break; |
825 | 825 | |
826 | 826 | default: |
827 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
827 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | |
831 | - if ( ! empty( $group_meta_value ) ) { |
|
832 | - $form_meta_value[ $index ] = $group_meta_value; |
|
831 | + if ( ! empty($group_meta_value)) { |
|
832 | + $form_meta_value[$index] = $group_meta_value; |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | 836 | |
837 | 837 | // Arrange repeater field keys in order. |
838 | - $form_meta_value = array_values( $form_meta_value ); |
|
838 | + $form_meta_value = array_values($form_meta_value); |
|
839 | 839 | break; |
840 | 840 | |
841 | 841 | default: |
842 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
842 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | |
@@ -850,24 +850,24 @@ discard block |
||
850 | 850 | */ |
851 | 851 | $form_meta_value = apply_filters( |
852 | 852 | 'give_pre_save_form_meta_value', |
853 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
853 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
854 | 854 | $form_meta_key, |
855 | 855 | $this, |
856 | 856 | $post_id |
857 | 857 | ); |
858 | 858 | |
859 | 859 | // Save data. |
860 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
860 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
861 | 861 | |
862 | 862 | // Fire after saving form meta key. |
863 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
863 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
864 | 864 | } |
865 | 865 | } |
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
869 | 869 | // Fire action after saving form meta. |
870 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
870 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | |
@@ -880,10 +880,10 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @return string |
882 | 882 | */ |
883 | - private function get_field_id( $field ) { |
|
883 | + private function get_field_id($field) { |
|
884 | 884 | $field_id = ''; |
885 | 885 | |
886 | - if ( array_key_exists( 'id', $field ) ) { |
|
886 | + if (array_key_exists('id', $field)) { |
|
887 | 887 | $field_id = $field['id']; |
888 | 888 | |
889 | 889 | } |
@@ -900,12 +900,12 @@ discard block |
||
900 | 900 | * |
901 | 901 | * @return array |
902 | 902 | */ |
903 | - private function get_fields_id( $setting ) { |
|
903 | + private function get_fields_id($setting) { |
|
904 | 904 | $meta_keys = array(); |
905 | 905 | |
906 | - if ( ! empty( $setting ) ) { |
|
907 | - foreach ( $setting['fields'] as $field ) { |
|
908 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
906 | + if ( ! empty($setting)) { |
|
907 | + foreach ($setting['fields'] as $field) { |
|
908 | + if ($field_id = $this->get_field_id($field)) { |
|
909 | 909 | $meta_keys[] = $field_id; |
910 | 910 | } |
911 | 911 | } |
@@ -923,14 +923,14 @@ discard block |
||
923 | 923 | * |
924 | 924 | * @return array |
925 | 925 | */ |
926 | - private function get_sub_fields_id( $setting ) { |
|
926 | + private function get_sub_fields_id($setting) { |
|
927 | 927 | $meta_keys = array(); |
928 | 928 | |
929 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
930 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
931 | - if ( ! empty( $fields['fields'] ) ) { |
|
932 | - foreach ( $fields['fields'] as $field ) { |
|
933 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
929 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
930 | + foreach ($setting['sub-fields'] as $fields) { |
|
931 | + if ( ! empty($fields['fields'])) { |
|
932 | + foreach ($fields['fields'] as $field) { |
|
933 | + if ($field_id = $this->get_field_id($field)) { |
|
934 | 934 | $meta_keys[] = $field_id; |
935 | 935 | } |
936 | 936 | } |
@@ -951,14 +951,14 @@ discard block |
||
951 | 951 | private function get_meta_keys_from_settings() { |
952 | 952 | $meta_keys = array(); |
953 | 953 | |
954 | - foreach ( $this->settings as $setting ) { |
|
955 | - if ( $this->has_sub_tab( $setting ) ) { |
|
956 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
954 | + foreach ($this->settings as $setting) { |
|
955 | + if ($this->has_sub_tab($setting)) { |
|
956 | + $meta_key = $this->get_sub_fields_id($setting); |
|
957 | 957 | } else { |
958 | - $meta_key = $this->get_fields_id( $setting ); |
|
958 | + $meta_key = $this->get_fields_id($setting); |
|
959 | 959 | } |
960 | 960 | |
961 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
961 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | return $meta_keys; |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | * |
976 | 976 | * @return string |
977 | 977 | */ |
978 | - function get_field_type( $field_id, $group_id = '' ) { |
|
979 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
978 | + function get_field_type($field_id, $group_id = '') { |
|
979 | + $field = $this->get_setting_field($field_id, $group_id); |
|
980 | 980 | |
981 | - $type = array_key_exists( 'type', $field ) |
|
981 | + $type = array_key_exists('type', $field) |
|
982 | 982 | ? $field['type'] |
983 | 983 | : ''; |
984 | 984 | |
@@ -996,12 +996,12 @@ discard block |
||
996 | 996 | * |
997 | 997 | * @return array |
998 | 998 | */ |
999 | - private function get_field( $setting, $field_id ) { |
|
999 | + private function get_field($setting, $field_id) { |
|
1000 | 1000 | $setting_field = array(); |
1001 | 1001 | |
1002 | - if ( ! empty( $setting['fields'] ) ) { |
|
1003 | - foreach ( $setting['fields'] as $field ) { |
|
1004 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1002 | + if ( ! empty($setting['fields'])) { |
|
1003 | + foreach ($setting['fields'] as $field) { |
|
1004 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1005 | 1005 | $setting_field = $field; |
1006 | 1006 | break; |
1007 | 1007 | } |
@@ -1021,12 +1021,12 @@ discard block |
||
1021 | 1021 | * |
1022 | 1022 | * @return array |
1023 | 1023 | */ |
1024 | - private function get_sub_field( $setting, $field_id ) { |
|
1024 | + private function get_sub_field($setting, $field_id) { |
|
1025 | 1025 | $setting_field = array(); |
1026 | 1026 | |
1027 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1028 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1029 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1027 | + if ( ! empty($setting['sub-fields'])) { |
|
1028 | + foreach ($setting['sub-fields'] as $fields) { |
|
1029 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1030 | 1030 | $setting_field = $field; |
1031 | 1031 | break; |
1032 | 1032 | } |
@@ -1046,17 +1046,17 @@ discard block |
||
1046 | 1046 | * |
1047 | 1047 | * @return array |
1048 | 1048 | */ |
1049 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1049 | + function get_setting_field($field_id, $group_id = '') { |
|
1050 | 1050 | $setting_field = array(); |
1051 | 1051 | |
1052 | 1052 | $_field_id = $field_id; |
1053 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1053 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1054 | 1054 | |
1055 | - if ( ! empty( $this->settings ) ) { |
|
1056 | - foreach ( $this->settings as $setting ) { |
|
1055 | + if ( ! empty($this->settings)) { |
|
1056 | + foreach ($this->settings as $setting) { |
|
1057 | 1057 | if ( |
1058 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1059 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1058 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1059 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1060 | 1060 | ) { |
1061 | 1061 | break; |
1062 | 1062 | } |
@@ -1065,9 +1065,9 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | |
1067 | 1067 | // Get field from group. |
1068 | - if ( ! empty( $group_id ) ) { |
|
1069 | - foreach ( $setting_field['fields'] as $field ) { |
|
1070 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1068 | + if ( ! empty($group_id)) { |
|
1069 | + foreach ($setting_field['fields'] as $field) { |
|
1070 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1071 | 1071 | $setting_field = $field; |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -1086,14 +1086,14 @@ discard block |
||
1086 | 1086 | * |
1087 | 1087 | * @return mixed |
1088 | 1088 | */ |
1089 | - function add_offline_donations_setting_tab( $settings ) { |
|
1090 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1091 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1089 | + function add_offline_donations_setting_tab($settings) { |
|
1090 | + if (give_is_gateway_active('offline')) { |
|
1091 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1092 | 1092 | 'id' => 'offline_donations_options', |
1093 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1093 | + 'title' => __('Offline Donations', 'give'), |
|
1094 | 1094 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1095 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1096 | - ) ); |
|
1095 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1096 | + )); |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | return $settings; |
@@ -1111,22 +1111,22 @@ discard block |
||
1111 | 1111 | * |
1112 | 1112 | * @return mixed |
1113 | 1113 | */ |
1114 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1115 | - switch ( $setting_field['type'] ) { |
|
1114 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1115 | + switch ($setting_field['type']) { |
|
1116 | 1116 | case 'group': |
1117 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1118 | - foreach ( $setting_field['fields'] as $field ) { |
|
1119 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1117 | + if ( ! empty($setting_field['fields'])) { |
|
1118 | + foreach ($setting_field['fields'] as $field) { |
|
1119 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1120 | 1120 | continue; |
1121 | 1121 | } |
1122 | 1122 | |
1123 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1124 | - if( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1123 | + foreach ($meta_value as $index => $meta_data) { |
|
1124 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1125 | 1125 | continue; |
1126 | 1126 | } |
1127 | 1127 | |
1128 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) |
|
1129 | - ? give_sanitize_amount( $meta_value[ $index ][ $field['id'] ] ) |
|
1128 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) |
|
1129 | + ? give_sanitize_amount($meta_value[$index][$field['id']]) |
|
1130 | 1130 | : 0; |
1131 | 1131 | } |
1132 | 1132 | } |
@@ -1134,8 +1134,8 @@ discard block |
||
1134 | 1134 | break; |
1135 | 1135 | |
1136 | 1136 | default: |
1137 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1138 | - $meta_value = $meta_value ? give_sanitize_amount( $meta_value ) : 0; |
|
1137 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1138 | + $meta_value = $meta_value ? give_sanitize_amount($meta_value) : 0; |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 |