@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -20,19 +20,19 @@ discard block |
||
| 20 | 20 | * @since 1.8 |
| 21 | 21 | */ |
| 22 | 22 | function give_load_wp_editor() { |
| 23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
| 23 | + if ( ! isset($_POST['wp_editor'])) { |
|
| 24 | 24 | die(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
| 27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
| 28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
| 29 | 29 | |
| 30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
| 30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
| 31 | 31 | |
| 32 | 32 | die(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
| 35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | // Get current page. |
| 55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
| 55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
| 56 | 56 | |
| 57 | 57 | // Bailout. |
| 58 | 58 | if ( |
| 59 | - empty( $current_page ) |
|
| 60 | - || empty( $_GET['_wp_http_referer'] ) |
|
| 61 | - || ! in_array( $current_page, $give_pages ) |
|
| 59 | + empty($current_page) |
|
| 60 | + || empty($_GET['_wp_http_referer']) |
|
| 61 | + || ! in_array($current_page, $give_pages) |
|
| 62 | 62 | ) { |
| 63 | 63 | return false; |
| 64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @since 1.8 |
| 70 | 70 | */ |
| 71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
| 71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
| 72 | 72 | |
| 73 | - if ( $redirect ) { |
|
| 73 | + if ($redirect) { |
|
| 74 | 74 | // Redirect. |
| 75 | 75 | wp_redirect( |
| 76 | 76 | remove_query_arg( |
| 77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
| 78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
| 77 | + array('_wp_http_referer', '_wpnonce'), |
|
| 78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
| 79 | 79 | ) |
| 80 | 80 | ); |
| 81 | 81 | exit; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
| 85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | function give_hide_outdated_php_notice() { |
| 98 | 98 | |
| 99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
| 99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
| 100 | 100 | give_die(); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Transient key name. |
| 104 | 104 | $transient_key = '_give_hide_outdated_php_notices_shortly'; |
| 105 | 105 | |
| 106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
| 106 | + if (Give_Cache::get($transient_key, true)) { |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Hide notice for 24 hours. |
| 111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
| 111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
| 112 | 112 | |
| 113 | 113 | give_die(); |
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
| 117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Register admin notices. |
@@ -123,27 +123,27 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | function _give_register_admin_notices() { |
| 125 | 125 | // Bailout. |
| 126 | - if ( ! is_admin() ) { |
|
| 126 | + if ( ! is_admin()) { |
|
| 127 | 127 | return; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Bulk action notices. |
| 131 | 131 | if ( |
| 132 | - isset( $_GET['action'] ) && |
|
| 133 | - ! empty( $_GET['action'] ) |
|
| 132 | + isset($_GET['action']) && |
|
| 133 | + ! empty($_GET['action']) |
|
| 134 | 134 | ) { |
| 135 | 135 | |
| 136 | 136 | // Add payment bulk notice. |
| 137 | 137 | if ( |
| 138 | - current_user_can( 'edit_give_payments' ) && |
|
| 139 | - isset( $_GET['payment'] ) && |
|
| 140 | - ! empty( $_GET['payment'] ) |
|
| 138 | + current_user_can('edit_give_payments') && |
|
| 139 | + isset($_GET['payment']) && |
|
| 140 | + ! empty($_GET['payment']) |
|
| 141 | 141 | ) { |
| 142 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
| 142 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
| 143 | 143 | |
| 144 | - switch ( $_GET['action'] ) { |
|
| 144 | + switch ($_GET['action']) { |
|
| 145 | 145 | case 'delete': |
| 146 | - Give()->notices->register_notice( array( |
|
| 146 | + Give()->notices->register_notice(array( |
|
| 147 | 147 | 'id' => 'bulk_action_delete', |
| 148 | 148 | 'type' => 'updated', |
| 149 | 149 | 'description' => sprintf( |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | ), |
| 156 | 156 | $payment_count ), |
| 157 | 157 | 'show' => true, |
| 158 | - ) ); |
|
| 158 | + )); |
|
| 159 | 159 | |
| 160 | 160 | break; |
| 161 | 161 | |
| 162 | 162 | case 'resend-receipt': |
| 163 | - Give()->notices->register_notice( array( |
|
| 163 | + Give()->notices->register_notice(array( |
|
| 164 | 164 | 'id' => 'bulk_action_resend_receipt', |
| 165 | 165 | 'type' => 'updated', |
| 166 | 166 | 'description' => sprintf( |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $payment_count |
| 174 | 174 | ), |
| 175 | 175 | 'show' => true, |
| 176 | - ) ); |
|
| 176 | + )); |
|
| 177 | 177 | break; |
| 178 | 178 | |
| 179 | 179 | case 'set-status-publish' : |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | case 'set-status-cancelled' : |
| 186 | 186 | case 'set-status-abandoned' : |
| 187 | 187 | case 'set-status-preapproval' : |
| 188 | - Give()->notices->register_notice( array( |
|
| 188 | + Give()->notices->register_notice(array( |
|
| 189 | 189 | 'id' => 'bulk_action_status_change', |
| 190 | 190 | 'type' => 'updated', |
| 191 | 191 | 'description' => _n( |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | 'give' |
| 196 | 196 | ), |
| 197 | 197 | 'show' => true, |
| 198 | - ) ); |
|
| 198 | + )); |
|
| 199 | 199 | break; |
| 200 | 200 | }// End switch(). |
| 201 | 201 | }// End if(). |
@@ -203,239 +203,239 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | // Add give message notices. |
| 205 | 205 | $message_notices = give_get_admin_messages_key(); |
| 206 | - if ( ! empty( $message_notices ) ) { |
|
| 207 | - foreach ( $message_notices as $message_notice ) { |
|
| 206 | + if ( ! empty($message_notices)) { |
|
| 207 | + foreach ($message_notices as $message_notice) { |
|
| 208 | 208 | // Donation reports errors. |
| 209 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
| 210 | - switch ( $message_notice ) { |
|
| 209 | + if (current_user_can('view_give_reports')) { |
|
| 210 | + switch ($message_notice) { |
|
| 211 | 211 | case 'donation-deleted' : |
| 212 | - Give()->notices->register_notice( array( |
|
| 212 | + Give()->notices->register_notice(array( |
|
| 213 | 213 | 'id' => 'give-donation-deleted', |
| 214 | 214 | 'type' => 'updated', |
| 215 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
| 215 | + 'description' => __('The donation has been deleted.', 'give'), |
|
| 216 | 216 | 'show' => true, |
| 217 | - ) ); |
|
| 217 | + )); |
|
| 218 | 218 | break; |
| 219 | 219 | case 'email-sent' : |
| 220 | - Give()->notices->register_notice( array( |
|
| 220 | + Give()->notices->register_notice(array( |
|
| 221 | 221 | 'id' => 'give-email-sent', |
| 222 | 222 | 'type' => 'updated', |
| 223 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
| 223 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
| 224 | 224 | 'show' => true, |
| 225 | - ) ); |
|
| 225 | + )); |
|
| 226 | 226 | break; |
| 227 | 227 | case 'refreshed-reports' : |
| 228 | - Give()->notices->register_notice( array( |
|
| 228 | + Give()->notices->register_notice(array( |
|
| 229 | 229 | 'id' => 'give-refreshed-reports', |
| 230 | 230 | 'type' => 'updated', |
| 231 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
| 231 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
| 232 | 232 | 'show' => true, |
| 233 | - ) ); |
|
| 233 | + )); |
|
| 234 | 234 | break; |
| 235 | 235 | case 'donation-note-deleted' : |
| 236 | - Give()->notices->register_notice( array( |
|
| 236 | + Give()->notices->register_notice(array( |
|
| 237 | 237 | 'id' => 'give-donation-note-deleted', |
| 238 | 238 | 'type' => 'updated', |
| 239 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
| 239 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
| 240 | 240 | 'show' => true, |
| 241 | - ) ); |
|
| 241 | + )); |
|
| 242 | 242 | break; |
| 243 | 243 | }// End switch(). |
| 244 | 244 | }// End if(). |
| 245 | 245 | |
| 246 | 246 | // Give settings notices and errors. |
| 247 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
| 248 | - switch ( $message_notice ) { |
|
| 247 | + if (current_user_can('manage_give_settings')) { |
|
| 248 | + switch ($message_notice) { |
|
| 249 | 249 | case 'settings-imported' : |
| 250 | - Give()->notices->register_notice( array( |
|
| 250 | + Give()->notices->register_notice(array( |
|
| 251 | 251 | 'id' => 'give-settings-imported', |
| 252 | 252 | 'type' => 'updated', |
| 253 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
| 253 | + 'description' => __('The settings have been imported.', 'give'), |
|
| 254 | 254 | 'show' => true, |
| 255 | - ) ); |
|
| 255 | + )); |
|
| 256 | 256 | break; |
| 257 | 257 | case 'api-key-generated' : |
| 258 | - Give()->notices->register_notice( array( |
|
| 258 | + Give()->notices->register_notice(array( |
|
| 259 | 259 | 'id' => 'give-api-key-generated', |
| 260 | 260 | 'type' => 'updated', |
| 261 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
| 261 | + 'description' => __('API keys have been generated.', 'give'), |
|
| 262 | 262 | 'show' => true, |
| 263 | - ) ); |
|
| 263 | + )); |
|
| 264 | 264 | break; |
| 265 | 265 | case 'api-key-exists' : |
| 266 | - Give()->notices->register_notice( array( |
|
| 266 | + Give()->notices->register_notice(array( |
|
| 267 | 267 | 'id' => 'give-api-key-exists', |
| 268 | 268 | 'type' => 'updated', |
| 269 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
| 269 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
| 270 | 270 | 'show' => true, |
| 271 | - ) ); |
|
| 271 | + )); |
|
| 272 | 272 | break; |
| 273 | 273 | case 'api-key-regenerated' : |
| 274 | - Give()->notices->register_notice( array( |
|
| 274 | + Give()->notices->register_notice(array( |
|
| 275 | 275 | 'id' => 'give-api-key-regenerated', |
| 276 | 276 | 'type' => 'updated', |
| 277 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
| 277 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
| 278 | 278 | 'show' => true, |
| 279 | - ) ); |
|
| 279 | + )); |
|
| 280 | 280 | break; |
| 281 | 281 | case 'api-key-revoked' : |
| 282 | - Give()->notices->register_notice( array( |
|
| 282 | + Give()->notices->register_notice(array( |
|
| 283 | 283 | 'id' => 'give-api-key-revoked', |
| 284 | 284 | 'type' => 'updated', |
| 285 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
| 285 | + 'description' => __('API keys have been revoked.', 'give'), |
|
| 286 | 286 | 'show' => true, |
| 287 | - ) ); |
|
| 287 | + )); |
|
| 288 | 288 | break; |
| 289 | 289 | case 'sent-test-email' : |
| 290 | - Give()->notices->register_notice( array( |
|
| 290 | + Give()->notices->register_notice(array( |
|
| 291 | 291 | 'id' => 'give-sent-test-email', |
| 292 | 292 | 'type' => 'updated', |
| 293 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
| 293 | + 'description' => __('The test email has been sent.', 'give'), |
|
| 294 | 294 | 'show' => true, |
| 295 | - ) ); |
|
| 295 | + )); |
|
| 296 | 296 | break; |
| 297 | 297 | case 'matched-success-failure-page': |
| 298 | - Give()->notices->register_notice( array( |
|
| 298 | + Give()->notices->register_notice(array( |
|
| 299 | 299 | 'id' => 'give-matched-success-failure-page', |
| 300 | 300 | 'type' => 'updated', |
| 301 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
| 301 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
| 302 | 302 | 'show' => true, |
| 303 | - ) ); |
|
| 303 | + )); |
|
| 304 | 304 | break; |
| 305 | 305 | }// End switch(). |
| 306 | 306 | }// End if(). |
| 307 | 307 | |
| 308 | 308 | // Payments errors. |
| 309 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
| 310 | - switch ( $message_notice ) { |
|
| 309 | + if (current_user_can('edit_give_payments')) { |
|
| 310 | + switch ($message_notice) { |
|
| 311 | 311 | case 'note-added' : |
| 312 | - Give()->notices->register_notice( array( |
|
| 312 | + Give()->notices->register_notice(array( |
|
| 313 | 313 | 'id' => 'give-note-added', |
| 314 | 314 | 'type' => 'updated', |
| 315 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
| 315 | + 'description' => __('The donation note has been added.', 'give'), |
|
| 316 | 316 | 'show' => true, |
| 317 | - ) ); |
|
| 317 | + )); |
|
| 318 | 318 | break; |
| 319 | 319 | case 'payment-updated' : |
| 320 | - Give()->notices->register_notice( array( |
|
| 320 | + Give()->notices->register_notice(array( |
|
| 321 | 321 | 'id' => 'give-payment-updated', |
| 322 | 322 | 'type' => 'updated', |
| 323 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
| 323 | + 'description' => __('The donation has been updated.', 'give'), |
|
| 324 | 324 | 'show' => true, |
| 325 | - ) ); |
|
| 325 | + )); |
|
| 326 | 326 | break; |
| 327 | 327 | }// End switch(). |
| 328 | 328 | }// End if(). |
| 329 | 329 | |
| 330 | 330 | // Donor Notices. |
| 331 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
| 332 | - switch ( $message_notice ) { |
|
| 331 | + if (current_user_can('edit_give_payments')) { |
|
| 332 | + switch ($message_notice) { |
|
| 333 | 333 | case 'donor-deleted' : |
| 334 | - Give()->notices->register_notice( array( |
|
| 334 | + Give()->notices->register_notice(array( |
|
| 335 | 335 | 'id' => 'give-donor-deleted', |
| 336 | 336 | 'type' => 'updated', |
| 337 | - 'description' => __( 'The selected donor(s) has been deleted.', 'give' ), |
|
| 337 | + 'description' => __('The selected donor(s) has been deleted.', 'give'), |
|
| 338 | 338 | 'show' => true, |
| 339 | - ) ); |
|
| 339 | + )); |
|
| 340 | 340 | break; |
| 341 | 341 | |
| 342 | 342 | case 'donor-donations-deleted' : |
| 343 | - Give()->notices->register_notice( array( |
|
| 343 | + Give()->notices->register_notice(array( |
|
| 344 | 344 | 'id' => 'give-donor-donations-deleted', |
| 345 | 345 | 'type' => 'updated', |
| 346 | - 'description' => __( 'The selected donor(s) and the associated donation(s) has been deleted.', 'give' ), |
|
| 346 | + 'description' => __('The selected donor(s) and the associated donation(s) has been deleted.', 'give'), |
|
| 347 | 347 | 'show' => true, |
| 348 | - ) ); |
|
| 348 | + )); |
|
| 349 | 349 | break; |
| 350 | 350 | |
| 351 | 351 | case 'confirm-delete-donor' : |
| 352 | - Give()->notices->register_notice( array( |
|
| 352 | + Give()->notices->register_notice(array( |
|
| 353 | 353 | 'id' => 'give-confirm-delete-donor', |
| 354 | 354 | 'type' => 'updated', |
| 355 | - 'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ), |
|
| 355 | + 'description' => __('You must confirm to delete the selected donor(s).', 'give'), |
|
| 356 | 356 | 'show' => true, |
| 357 | - ) ); |
|
| 357 | + )); |
|
| 358 | 358 | break; |
| 359 | 359 | |
| 360 | 360 | case 'invalid-donor-id' : |
| 361 | - Give()->notices->register_notice( array( |
|
| 361 | + Give()->notices->register_notice(array( |
|
| 362 | 362 | 'id' => 'give-invalid-donor-id', |
| 363 | 363 | 'type' => 'updated', |
| 364 | - 'description' => __( 'Invalid Donor ID.', 'give' ), |
|
| 364 | + 'description' => __('Invalid Donor ID.', 'give'), |
|
| 365 | 365 | 'show' => true, |
| 366 | - ) ); |
|
| 366 | + )); |
|
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 'donor-delete-failed' : |
| 370 | - Give()->notices->register_notice( array( |
|
| 370 | + Give()->notices->register_notice(array( |
|
| 371 | 371 | 'id' => 'give-donor-delete-failed', |
| 372 | 372 | 'type' => 'error', |
| 373 | - 'description' => __( 'Unable to delete selected donor(s).', 'give' ), |
|
| 373 | + 'description' => __('Unable to delete selected donor(s).', 'give'), |
|
| 374 | 374 | 'show' => true, |
| 375 | - ) ); |
|
| 375 | + )); |
|
| 376 | 376 | break; |
| 377 | 377 | |
| 378 | 378 | case 'email-added' : |
| 379 | - Give()->notices->register_notice( array( |
|
| 379 | + Give()->notices->register_notice(array( |
|
| 380 | 380 | 'id' => 'give-email-added', |
| 381 | 381 | 'type' => 'updated', |
| 382 | - 'description' => __( 'Donor email added.', 'give' ), |
|
| 382 | + 'description' => __('Donor email added.', 'give'), |
|
| 383 | 383 | 'show' => true, |
| 384 | - ) ); |
|
| 384 | + )); |
|
| 385 | 385 | break; |
| 386 | 386 | |
| 387 | 387 | case 'email-removed' : |
| 388 | - Give()->notices->register_notice( array( |
|
| 388 | + Give()->notices->register_notice(array( |
|
| 389 | 389 | 'id' => 'give-email-removed', |
| 390 | 390 | 'type' => 'updated', |
| 391 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
| 391 | + 'description' => __('Donor email removed.', 'give'), |
|
| 392 | 392 | 'show' => true, |
| 393 | - ) ); |
|
| 393 | + )); |
|
| 394 | 394 | break; |
| 395 | 395 | |
| 396 | 396 | case 'email-remove-failed' : |
| 397 | - Give()->notices->register_notice( array( |
|
| 397 | + Give()->notices->register_notice(array( |
|
| 398 | 398 | 'id' => 'give-email-remove-failed', |
| 399 | 399 | 'type' => 'updated', |
| 400 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
| 400 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
| 401 | 401 | 'show' => true, |
| 402 | - ) ); |
|
| 402 | + )); |
|
| 403 | 403 | break; |
| 404 | 404 | |
| 405 | 405 | case 'primary-email-updated' : |
| 406 | - Give()->notices->register_notice( array( |
|
| 406 | + Give()->notices->register_notice(array( |
|
| 407 | 407 | 'id' => 'give-primary-email-updated', |
| 408 | 408 | 'type' => 'updated', |
| 409 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
| 409 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
| 410 | 410 | 'show' => true, |
| 411 | - ) ); |
|
| 411 | + )); |
|
| 412 | 412 | break; |
| 413 | 413 | |
| 414 | 414 | case 'primary-email-failed' : |
| 415 | - Give()->notices->register_notice( array( |
|
| 415 | + Give()->notices->register_notice(array( |
|
| 416 | 416 | 'id' => 'give-primary-email-failed', |
| 417 | 417 | 'type' => 'updated', |
| 418 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
| 418 | + 'description' => __('Failed to set primary email.', 'give'), |
|
| 419 | 419 | 'show' => true, |
| 420 | - ) ); |
|
| 420 | + )); |
|
| 421 | 421 | break; |
| 422 | 422 | |
| 423 | 423 | case 'reconnect-user' : |
| 424 | - Give()->notices->register_notice( array( |
|
| 424 | + Give()->notices->register_notice(array( |
|
| 425 | 425 | 'id' => 'give-reconnect-user', |
| 426 | 426 | 'type' => 'updated', |
| 427 | - 'description' => __( 'User has been successfully connected with Donor.', 'give' ), |
|
| 427 | + 'description' => __('User has been successfully connected with Donor.', 'give'), |
|
| 428 | 428 | 'show' => true, |
| 429 | - ) ); |
|
| 429 | + )); |
|
| 430 | 430 | break; |
| 431 | 431 | |
| 432 | 432 | case 'profile-updated' : |
| 433 | - Give()->notices->register_notice( array( |
|
| 433 | + Give()->notices->register_notice(array( |
|
| 434 | 434 | 'id' => 'give-profile-updated', |
| 435 | 435 | 'type' => 'updated', |
| 436 | - 'description' => __( 'Donor information updated successfully.', 'give' ), |
|
| 436 | + 'description' => __('Donor information updated successfully.', 'give'), |
|
| 437 | 437 | 'show' => true, |
| 438 | - ) ); |
|
| 438 | + )); |
|
| 439 | 439 | break; |
| 440 | 440 | }// End switch(). |
| 441 | 441 | }// End if(). |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
| 446 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -453,39 +453,38 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @return bool |
| 455 | 455 | */ |
| 456 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
| 457 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
| 458 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
| 459 | - give_is_test_mode(); |
|
| 456 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
| 457 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
| 458 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
| 460 | 459 | |
| 461 | 460 | if ( |
| 462 | - ! current_user_can( 'view_give_reports' ) || |
|
| 461 | + ! current_user_can('view_give_reports') || |
|
| 463 | 462 | ! $is_test_mode |
| 464 | 463 | ) { |
| 465 | 464 | return false; |
| 466 | 465 | } |
| 467 | 466 | |
| 468 | 467 | // Add the main site admin menu item. |
| 469 | - $wp_admin_bar->add_menu( array( |
|
| 468 | + $wp_admin_bar->add_menu(array( |
|
| 470 | 469 | 'id' => 'give-test-notice', |
| 471 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
| 470 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
| 472 | 471 | 'parent' => 'top-secondary', |
| 473 | - 'title' => __( 'Give Test Mode Active', 'give' ), |
|
| 472 | + 'title' => __('Give Test Mode Active', 'give'), |
|
| 474 | 473 | 'meta' => array( |
| 475 | 474 | 'class' => 'give-test-mode-active', |
| 476 | 475 | ), |
| 477 | - ) ); |
|
| 476 | + )); |
|
| 478 | 477 | |
| 479 | 478 | return true; |
| 480 | 479 | } |
| 481 | 480 | |
| 482 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
| 481 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
| 483 | 482 | |
| 484 | 483 | /** |
| 485 | 484 | * Outputs the Give admin bar CSS. |
| 486 | 485 | */ |
| 487 | 486 | function _give_test_mode_notice_admin_bar_css() { |
| 488 | - if ( ! give_is_test_mode() ) { |
|
| 487 | + if ( ! give_is_test_mode()) { |
|
| 489 | 488 | return; |
| 490 | 489 | } |
| 491 | 490 | ?> |
@@ -503,7 +502,7 @@ discard block |
||
| 503 | 502 | <?php |
| 504 | 503 | } |
| 505 | 504 | |
| 506 | -add_action( 'admin_head', '_give_test_mode_notice_admin_bar_css' ); |
|
| 505 | +add_action('admin_head', '_give_test_mode_notice_admin_bar_css'); |
|
| 507 | 506 | |
| 508 | 507 | |
| 509 | 508 | /** |
@@ -513,12 +512,12 @@ discard block |
||
| 513 | 512 | */ |
| 514 | 513 | function give_import_page_link_callback() { |
| 515 | 514 | ?> |
| 516 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
| 517 | - class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a> |
|
| 515 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
| 516 | + class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a> |
|
| 518 | 517 | |
| 519 | 518 | <?php |
| 520 | 519 | // Check if view donation single page only. |
| 521 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
| 520 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
| 522 | 521 | ?> |
| 523 | 522 | <style type="text/css"> |
| 524 | 523 | .wrap #transaction-details-heading { |
@@ -529,7 +528,7 @@ discard block |
||
| 529 | 528 | } |
| 530 | 529 | } |
| 531 | 530 | |
| 532 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
| 531 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
| 533 | 532 | |
| 534 | 533 | /** |
| 535 | 534 | * Load donation import ajax callback |
@@ -545,9 +544,9 @@ discard block |
||
| 545 | 544 | Give_Cache::get_instance()->disable(); |
| 546 | 545 | |
| 547 | 546 | $import_setting = array(); |
| 548 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
| 547 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
| 549 | 548 | |
| 550 | - parse_str( $fields, $output ); |
|
| 549 | + parse_str($fields, $output); |
|
| 551 | 550 | |
| 552 | 551 | $import_setting['create_user'] = $output['create_user']; |
| 553 | 552 | $import_setting['mode'] = $output['mode']; |
@@ -557,69 +556,69 @@ discard block |
||
| 557 | 556 | $import_setting['dry_run'] = $output['dry_run']; |
| 558 | 557 | |
| 559 | 558 | // Parent key id. |
| 560 | - $main_key = maybe_unserialize( $output['main_key'] ); |
|
| 561 | - |
|
| 562 | - $current = absint( $_REQUEST['current'] ); |
|
| 563 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
| 564 | - $start = absint( $_REQUEST['start'] ); |
|
| 565 | - $end = absint( $_REQUEST['end'] ); |
|
| 566 | - $next = absint( $_REQUEST['next'] ); |
|
| 567 | - $total = absint( $_REQUEST['total'] ); |
|
| 568 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
| 569 | - if ( empty( $output['delimiter'] ) ) { |
|
| 559 | + $main_key = maybe_unserialize($output['main_key']); |
|
| 560 | + |
|
| 561 | + $current = absint($_REQUEST['current']); |
|
| 562 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
| 563 | + $start = absint($_REQUEST['start']); |
|
| 564 | + $end = absint($_REQUEST['end']); |
|
| 565 | + $next = absint($_REQUEST['next']); |
|
| 566 | + $total = absint($_REQUEST['total']); |
|
| 567 | + $per_page = absint($_REQUEST['per_page']); |
|
| 568 | + if (empty($output['delimiter'])) { |
|
| 570 | 569 | $delimiter = ','; |
| 571 | 570 | } else { |
| 572 | 571 | $delimiter = $output['delimiter']; |
| 573 | 572 | } |
| 574 | 573 | |
| 575 | 574 | // Processing done here. |
| 576 | - $raw_data = give_get_donation_data_from_csv( $output['csv'], $start, $end, $delimiter ); |
|
| 577 | - $raw_key = maybe_unserialize( $output['mapto'] ); |
|
| 575 | + $raw_data = give_get_donation_data_from_csv($output['csv'], $start, $end, $delimiter); |
|
| 576 | + $raw_key = maybe_unserialize($output['mapto']); |
|
| 578 | 577 | $import_setting['raw_key'] = $raw_key; |
| 579 | 578 | |
| 580 | - if ( ! empty( $output['dry_run'] ) ) { |
|
| 581 | - $import_setting['csv_raw_data'] = give_get_donation_data_from_csv( $output['csv'], 1, $end, $delimiter ); |
|
| 579 | + if ( ! empty($output['dry_run'])) { |
|
| 580 | + $import_setting['csv_raw_data'] = give_get_donation_data_from_csv($output['csv'], 1, $end, $delimiter); |
|
| 582 | 581 | |
| 583 | - $import_setting['donors_list'] = Give()->donors->get_donors( array( |
|
| 584 | - 'number' => - 1, |
|
| 585 | - 'fields' => array( 'id', 'user_id', 'email' ), |
|
| 586 | - ) ); |
|
| 582 | + $import_setting['donors_list'] = Give()->donors->get_donors(array( |
|
| 583 | + 'number' => -1, |
|
| 584 | + 'fields' => array('id', 'user_id', 'email'), |
|
| 585 | + )); |
|
| 587 | 586 | } |
| 588 | 587 | |
| 589 | 588 | // Prevent normal emails. |
| 590 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
| 591 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
| 592 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
| 589 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
| 590 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
| 591 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
| 593 | 592 | |
| 594 | 593 | $current_key = $start; |
| 595 | - foreach ( $raw_data as $row_data ) { |
|
| 594 | + foreach ($raw_data as $row_data) { |
|
| 596 | 595 | $import_setting['donation_key'] = $current_key; |
| 597 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
| 598 | - $current_key ++; |
|
| 596 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
| 597 | + $current_key++; |
|
| 599 | 598 | } |
| 600 | 599 | |
| 601 | 600 | // Check if function exists or not. |
| 602 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
| 603 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
| 601 | + if (function_exists('give_payment_save_page_data')) { |
|
| 602 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
| 604 | 603 | } |
| 605 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
| 606 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
| 604 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
| 605 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
| 607 | 606 | |
| 608 | - if ( $next == false ) { |
|
| 607 | + if ($next == false) { |
|
| 609 | 608 | $json_data = array( |
| 610 | 609 | 'success' => true, |
| 611 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
| 610 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
| 612 | 611 | ); |
| 613 | 612 | } else { |
| 614 | 613 | $index_start = $start; |
| 615 | 614 | $index_end = $end; |
| 616 | 615 | $last = false; |
| 617 | 616 | $next = true; |
| 618 | - if ( $next ) { |
|
| 617 | + if ($next) { |
|
| 619 | 618 | $index_start = $index_start + $per_page; |
| 620 | - $index_end = $per_page + ( $index_start - 1 ); |
|
| 619 | + $index_end = $per_page + ($index_start - 1); |
|
| 621 | 620 | } |
| 622 | - if ( $index_end >= $total ) { |
|
| 621 | + if ($index_end >= $total) { |
|
| 623 | 622 | $index_end = $total; |
| 624 | 623 | $last = true; |
| 625 | 624 | } |
@@ -633,31 +632,31 @@ discard block |
||
| 633 | 632 | ); |
| 634 | 633 | } |
| 635 | 634 | |
| 636 | - $url = give_import_page_url( array( |
|
| 635 | + $url = give_import_page_url(array( |
|
| 637 | 636 | 'step' => '4', |
| 638 | 637 | 'importer-type' => 'import_donations', |
| 639 | 638 | 'csv' => $output['csv'], |
| 640 | 639 | 'total' => $total, |
| 641 | 640 | 'delete_csv' => $import_setting['delete_csv'], |
| 642 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
| 641 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
| 643 | 642 | 'dry_run' => $output['dry_run'], |
| 644 | - ) ); |
|
| 643 | + )); |
|
| 645 | 644 | $json_data['url'] = $url; |
| 646 | 645 | |
| 647 | - $current ++; |
|
| 646 | + $current++; |
|
| 648 | 647 | $json_data['current'] = $current; |
| 649 | 648 | |
| 650 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
| 649 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
| 651 | 650 | $json_data['percentage'] = $percentage; |
| 652 | 651 | |
| 653 | 652 | // Enable Give cache |
| 654 | 653 | Give_Cache::get_instance()->enable(); |
| 655 | 654 | |
| 656 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
| 657 | - wp_die( json_encode( $json_data ) ); |
|
| 655 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
| 656 | + wp_die(json_encode($json_data)); |
|
| 658 | 657 | } |
| 659 | 658 | |
| 660 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
| 659 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
| 661 | 660 | |
| 662 | 661 | /** |
| 663 | 662 | * Load core settings import ajax callback |
@@ -669,8 +668,8 @@ discard block |
||
| 669 | 668 | */ |
| 670 | 669 | |
| 671 | 670 | function give_core_settings_import_callback() { |
| 672 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
| 673 | - parse_str( $fields, $fields ); |
|
| 671 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
| 672 | + parse_str($fields, $fields); |
|
| 674 | 673 | |
| 675 | 674 | $json_data['success'] = false; |
| 676 | 675 | |
@@ -685,22 +684,22 @@ discard block |
||
| 685 | 684 | * |
| 686 | 685 | * @return array $fields |
| 687 | 686 | */ |
| 688 | - $fields = (array) apply_filters( 'give_import_core_settings_fields', $fields ); |
|
| 687 | + $fields = (array) apply_filters('give_import_core_settings_fields', $fields); |
|
| 689 | 688 | |
| 690 | - $file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false ); |
|
| 689 | + $file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false); |
|
| 691 | 690 | |
| 692 | - if ( ! empty( $file_name ) ) { |
|
| 693 | - $type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' ); |
|
| 691 | + if ( ! empty($file_name)) { |
|
| 692 | + $type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge'); |
|
| 694 | 693 | |
| 695 | 694 | // Get the json data from the file and then alter it in array format |
| 696 | - $json_string = give_get_core_settings_json( $file_name ); |
|
| 697 | - $json_to_array = json_decode( $json_string, true ); |
|
| 695 | + $json_string = give_get_core_settings_json($file_name); |
|
| 696 | + $json_to_array = json_decode($json_string, true); |
|
| 698 | 697 | |
| 699 | 698 | // get the current settign from the options table. |
| 700 | - $host_give_options = get_option( 'give_settings', array() ); |
|
| 699 | + $host_give_options = get_option('give_settings', array()); |
|
| 701 | 700 | |
| 702 | 701 | // Save old settins for backup. |
| 703 | - update_option( 'give_settings_old', $host_give_options, false ); |
|
| 702 | + update_option('give_settings_old', $host_give_options, false); |
|
| 704 | 703 | |
| 705 | 704 | /** |
| 706 | 705 | * Filter to Modify Core Settings that are being going to get import in options table as give settings. |
@@ -716,9 +715,9 @@ discard block |
||
| 716 | 715 | * |
| 717 | 716 | * @return array $json_to_array Setting that are being going to get imported |
| 718 | 717 | */ |
| 719 | - $json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields ); |
|
| 718 | + $json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields); |
|
| 720 | 719 | |
| 721 | - update_option( 'give_settings', $json_to_array, false ); |
|
| 720 | + update_option('give_settings', $json_to_array, false); |
|
| 722 | 721 | |
| 723 | 722 | $json_data['success'] = true; |
| 724 | 723 | } |
@@ -734,16 +733,16 @@ discard block |
||
| 734 | 733 | * |
| 735 | 734 | * @return array $url |
| 736 | 735 | */ |
| 737 | - $json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array( |
|
| 738 | - 'step' => ( empty( $json_data['success'] ) ? '1' : '3' ), |
|
| 736 | + $json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array( |
|
| 737 | + 'step' => (empty($json_data['success']) ? '1' : '3'), |
|
| 739 | 738 | 'importer-type' => 'import_core_setting', |
| 740 | - 'success' => ( empty( $json_data['success'] ) ? '0' : '1' ), |
|
| 741 | - ) ) ); |
|
| 739 | + 'success' => (empty($json_data['success']) ? '0' : '1'), |
|
| 740 | + ))); |
|
| 742 | 741 | |
| 743 | - wp_send_json( $json_data ); |
|
| 742 | + wp_send_json($json_data); |
|
| 744 | 743 | } |
| 745 | 744 | |
| 746 | -add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' ); |
|
| 745 | +add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback'); |
|
| 747 | 746 | |
| 748 | 747 | /** |
| 749 | 748 | * Initializes blank slate content if a list table is empty. |
@@ -755,7 +754,7 @@ discard block |
||
| 755 | 754 | $blank_slate->init(); |
| 756 | 755 | } |
| 757 | 756 | |
| 758 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
| 757 | +add_action('current_screen', 'give_blank_slate'); |
|
| 759 | 758 | |
| 760 | 759 | /** |
| 761 | 760 | * Validate Fields of User Profile |
@@ -768,24 +767,24 @@ discard block |
||
| 768 | 767 | * |
| 769 | 768 | * @return mixed |
| 770 | 769 | */ |
| 771 | -function give_validate_user_profile( $errors, $update, $user ) { |
|
| 770 | +function give_validate_user_profile($errors, $update, $user) { |
|
| 772 | 771 | |
| 773 | - if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) { |
|
| 772 | + if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) { |
|
| 774 | 773 | return; |
| 775 | 774 | } |
| 776 | 775 | |
| 777 | - if ( ! empty( $user->ID ) ) { |
|
| 778 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
| 776 | + if ( ! empty($user->ID)) { |
|
| 777 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
| 779 | 778 | |
| 780 | - if ( $donor ) { |
|
| 779 | + if ($donor) { |
|
| 781 | 780 | // If Donor is attached with User, then validate first name. |
| 782 | - if ( empty( $_POST['first_name'] ) ) { |
|
| 781 | + if (empty($_POST['first_name'])) { |
|
| 783 | 782 | $errors->add( |
| 784 | 783 | 'empty_first_name', |
| 785 | 784 | sprintf( |
| 786 | 785 | '<strong>%1$s:</strong> %2$s', |
| 787 | - __( 'ERROR', 'give' ), |
|
| 788 | - __( 'Please enter your first name.', 'give' ) |
|
| 786 | + __('ERROR', 'give'), |
|
| 787 | + __('Please enter your first name.', 'give') |
|
| 789 | 788 | ) |
| 790 | 789 | ); |
| 791 | 790 | } |
@@ -794,7 +793,7 @@ discard block |
||
| 794 | 793 | |
| 795 | 794 | } |
| 796 | 795 | |
| 797 | -add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 ); |
|
| 796 | +add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3); |
|
| 798 | 797 | |
| 799 | 798 | /** |
| 800 | 799 | * Show Donor Information on User Profile Page. |
@@ -803,19 +802,19 @@ discard block |
||
| 803 | 802 | * |
| 804 | 803 | * @since 2.0 |
| 805 | 804 | */ |
| 806 | -function give_donor_information_profile_fields( $user ) { |
|
| 807 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
| 805 | +function give_donor_information_profile_fields($user) { |
|
| 806 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
| 808 | 807 | |
| 809 | 808 | // Display Donor Information, only if donor is attached with User. |
| 810 | - if ( ! empty( $donor->user_id ) ) { |
|
| 809 | + if ( ! empty($donor->user_id)) { |
|
| 811 | 810 | ?> |
| 812 | 811 | <table class="form-table"> |
| 813 | 812 | <tbody> |
| 814 | 813 | <tr> |
| 815 | - <th scope="row"><?php _e( 'Donor', 'give' ); ?></th> |
|
| 814 | + <th scope="row"><?php _e('Donor', 'give'); ?></th> |
|
| 816 | 815 | <td> |
| 817 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
| 818 | - <?php _e( 'View Donor Information', 'give' ); ?> |
|
| 816 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
| 817 | + <?php _e('View Donor Information', 'give'); ?> |
|
| 819 | 818 | </a> |
| 820 | 819 | </td> |
| 821 | 820 | </tr> |
@@ -825,7 +824,7 @@ discard block |
||
| 825 | 824 | } |
| 826 | 825 | } |
| 827 | 826 | |
| 828 | -add_action( 'personal_options', 'give_donor_information_profile_fields' ); |
|
| 827 | +add_action('personal_options', 'give_donor_information_profile_fields'); |
|
| 829 | 828 | /** |
| 830 | 829 | * Get Array of WP User Roles. |
| 831 | 830 | * |
@@ -837,8 +836,8 @@ discard block |
||
| 837 | 836 | $user_roles = array(); |
| 838 | 837 | |
| 839 | 838 | // Loop through User Roles. |
| 840 | - foreach ( get_editable_roles() as $role_name => $role_info ) : |
|
| 841 | - $user_roles[ $role_name ] = $role_info['name']; |
|
| 839 | + foreach (get_editable_roles() as $role_name => $role_info) : |
|
| 840 | + $user_roles[$role_name] = $role_info['name']; |
|
| 842 | 841 | endforeach; |
| 843 | 842 | |
| 844 | 843 | return $user_roles; |
@@ -855,48 +854,46 @@ discard block |
||
| 855 | 854 | function __give_ajax_donor_manage_addresses() { |
| 856 | 855 | // Bailout. |
| 857 | 856 | if ( |
| 858 | - empty( $_POST['form'] ) || |
|
| 859 | - empty( $_POST['donorID'] ) |
|
| 857 | + empty($_POST['form']) || |
|
| 858 | + empty($_POST['donorID']) |
|
| 860 | 859 | ) { |
| 861 | - wp_send_json_error( array( |
|
| 860 | + wp_send_json_error(array( |
|
| 862 | 861 | 'error' => 1, |
| 863 | - ) ); |
|
| 862 | + )); |
|
| 864 | 863 | } |
| 865 | 864 | |
| 866 | - $post = give_clean( wp_parse_args( $_POST ) ); |
|
| 867 | - $donorID = absint( $post['donorID'] ); |
|
| 868 | - $form_data = give_clean( wp_parse_args( $post['form'] ) ); |
|
| 869 | - $is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) ); |
|
| 870 | - $address_type = false !== strpos( $form_data['address-id'], '_' ) ? |
|
| 871 | - array_shift( explode( '_', $form_data['address-id'] ) ) : |
|
| 872 | - $form_data['address-id']; |
|
| 873 | - $address_id = false !== strpos( $form_data['address-id'], '_' ) ? |
|
| 874 | - array_pop( explode( '_', $form_data['address-id'] ) ) : |
|
| 875 | - null; |
|
| 865 | + $post = give_clean(wp_parse_args($_POST)); |
|
| 866 | + $donorID = absint($post['donorID']); |
|
| 867 | + $form_data = give_clean(wp_parse_args($post['form'])); |
|
| 868 | + $is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_')); |
|
| 869 | + $address_type = false !== strpos($form_data['address-id'], '_') ? |
|
| 870 | + array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id']; |
|
| 871 | + $address_id = false !== strpos($form_data['address-id'], '_') ? |
|
| 872 | + array_pop(explode('_', $form_data['address-id'])) : null; |
|
| 876 | 873 | $response_data = array( |
| 877 | 874 | 'action' => $form_data['address-action'], |
| 878 | 875 | 'id' => $form_data['address-id'], |
| 879 | 876 | ); |
| 880 | 877 | |
| 881 | 878 | // Security check. |
| 882 | - if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) { |
|
| 883 | - wp_send_json_error( array( |
|
| 879 | + if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) { |
|
| 880 | + wp_send_json_error(array( |
|
| 884 | 881 | 'error' => 1, |
| 885 | 882 | 'error_msg' => wp_sprintf( |
| 886 | 883 | '<div class="notice notice-error"><p>%s</p></div>', |
| 887 | - __( 'Error: Security issue.', 'give' ) |
|
| 884 | + __('Error: Security issue.', 'give') |
|
| 888 | 885 | ), |
| 889 | 886 | ) |
| 890 | 887 | ); |
| 891 | 888 | } |
| 892 | 889 | |
| 893 | - $donor = new Give_Donor( $donorID ); |
|
| 890 | + $donor = new Give_Donor($donorID); |
|
| 894 | 891 | |
| 895 | 892 | // Verify donor. |
| 896 | - if ( ! $donor->id ) { |
|
| 897 | - wp_send_json_error( array( |
|
| 893 | + if ( ! $donor->id) { |
|
| 894 | + wp_send_json_error(array( |
|
| 898 | 895 | 'error' => 3, |
| 899 | - ) ); |
|
| 896 | + )); |
|
| 900 | 897 | } |
| 901 | 898 | |
| 902 | 899 | // Unset all data except address. |
@@ -907,59 +904,57 @@ discard block |
||
| 907 | 904 | ); |
| 908 | 905 | |
| 909 | 906 | // Process action. |
| 910 | - switch ( $response_data['action'] ) { |
|
| 907 | + switch ($response_data['action']) { |
|
| 911 | 908 | |
| 912 | 909 | case 'add': |
| 913 | - if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) { |
|
| 914 | - wp_send_json_error( array( |
|
| 910 | + if ( ! $donor->add_address("{$address_type}[]", $form_data)) { |
|
| 911 | + wp_send_json_error(array( |
|
| 915 | 912 | 'error' => 1, |
| 916 | 913 | 'error_msg' => wp_sprintf( |
| 917 | 914 | '<div class="notice notice-error"><p>%s</p></div>', |
| 918 | - __( 'Error: Unable to save the address. Please check if address already exist.', 'give' ) |
|
| 915 | + __('Error: Unable to save the address. Please check if address already exist.', 'give') |
|
| 919 | 916 | ), |
| 920 | 917 | ) |
| 921 | 918 | ); |
| 922 | 919 | } |
| 923 | 920 | |
| 924 | - $total_addresses = count( $donor->address[ $address_type ] ); |
|
| 921 | + $total_addresses = count($donor->address[$address_type]); |
|
| 925 | 922 | |
| 926 | 923 | $address_index = $is_multi_address_type ? |
| 927 | - $total_addresses - 1 : |
|
| 928 | - $address_type; |
|
| 924 | + $total_addresses - 1 : $address_type; |
|
| 929 | 925 | |
| 930 | - $array_keys = array_keys( $donor->address[ $address_type ] ); |
|
| 926 | + $array_keys = array_keys($donor->address[$address_type]); |
|
| 931 | 927 | |
| 932 | 928 | $address_id = $is_multi_address_type ? |
| 933 | - end( $array_keys ) : |
|
| 934 | - $address_type; |
|
| 929 | + end($array_keys) : $address_type; |
|
| 935 | 930 | |
| 936 | 931 | $response_data['address_html'] = __give_get_format_address( |
| 937 | - end( $donor->address['billing'] ), |
|
| 932 | + end($donor->address['billing']), |
|
| 938 | 933 | array( |
| 939 | 934 | // We can add only billing address from donor screen. |
| 940 | 935 | 'type' => 'billing', |
| 941 | 936 | 'id' => $address_id, |
| 942 | - 'index' => ++ $address_index, |
|
| 937 | + 'index' => ++$address_index, |
|
| 943 | 938 | ) |
| 944 | 939 | ); |
| 945 | - $response_data['success_msg'] = wp_sprintf( |
|
| 940 | + $response_data['success_msg'] = wp_sprintf( |
|
| 946 | 941 | '<div class="notice updated"><p>%s</p></div>', |
| 947 | - __( 'Successfully added a new address to the donor.', 'give' ) |
|
| 942 | + __('Successfully added a new address to the donor.', 'give') |
|
| 948 | 943 | ); |
| 949 | 944 | |
| 950 | - if ( $is_multi_address_type ) { |
|
| 945 | + if ($is_multi_address_type) { |
|
| 951 | 946 | $response_data['id'] = "{$response_data['id']}_{$address_index}"; |
| 952 | 947 | } |
| 953 | 948 | |
| 954 | 949 | break; |
| 955 | 950 | |
| 956 | 951 | case 'remove': |
| 957 | - if ( ! $donor->remove_address( $response_data['id'] ) ) { |
|
| 958 | - wp_send_json_error( array( |
|
| 952 | + if ( ! $donor->remove_address($response_data['id'])) { |
|
| 953 | + wp_send_json_error(array( |
|
| 959 | 954 | 'error' => 2, |
| 960 | 955 | 'error_msg' => wp_sprintf( |
| 961 | 956 | '<div class="notice notice-error"><p>%s</p></div>', |
| 962 | - __( 'Error: Unable to delete address.', 'give' ) |
|
| 957 | + __('Error: Unable to delete address.', 'give') |
|
| 963 | 958 | ), |
| 964 | 959 | ) |
| 965 | 960 | ); |
@@ -967,18 +962,18 @@ discard block |
||
| 967 | 962 | |
| 968 | 963 | $response_data['success_msg'] = wp_sprintf( |
| 969 | 964 | '<div class="notice updated"><p>%s</p></div>', |
| 970 | - __( 'Successfully removed a address of donor.', 'give' ) |
|
| 965 | + __('Successfully removed a address of donor.', 'give') |
|
| 971 | 966 | ); |
| 972 | 967 | |
| 973 | 968 | break; |
| 974 | 969 | |
| 975 | 970 | case 'update': |
| 976 | - if ( ! $donor->update_address( $response_data['id'], $form_data ) ) { |
|
| 977 | - wp_send_json_error( array( |
|
| 971 | + if ( ! $donor->update_address($response_data['id'], $form_data)) { |
|
| 972 | + wp_send_json_error(array( |
|
| 978 | 973 | 'error' => 3, |
| 979 | 974 | 'error_msg' => wp_sprintf( |
| 980 | 975 | '<div class="notice notice-error"><p>%s</p></div>', |
| 981 | - __( 'Error: Unable to update address. Please check if address already exist.', 'give' ) |
|
| 976 | + __('Error: Unable to update address. Please check if address already exist.', 'give') |
|
| 982 | 977 | ), |
| 983 | 978 | ) |
| 984 | 979 | ); |
@@ -986,26 +981,25 @@ discard block |
||
| 986 | 981 | |
| 987 | 982 | $response_data['address_html'] = __give_get_format_address( |
| 988 | 983 | $is_multi_address_type ? |
| 989 | - $donor->address[ $address_type ][ $address_id ] : |
|
| 990 | - $donor->address[ $address_type ], |
|
| 984 | + $donor->address[$address_type][$address_id] : $donor->address[$address_type], |
|
| 991 | 985 | array( |
| 992 | 986 | 'type' => $address_type, |
| 993 | 987 | 'id' => $address_id, |
| 994 | 988 | 'index' => $address_id, |
| 995 | 989 | ) |
| 996 | 990 | ); |
| 997 | - $response_data['success_msg'] = wp_sprintf( |
|
| 991 | + $response_data['success_msg'] = wp_sprintf( |
|
| 998 | 992 | '<div class="notice updated"><p>%s</p></div>', |
| 999 | - __( 'Successfully updated a address of donor', 'give' ) |
|
| 993 | + __('Successfully updated a address of donor', 'give') |
|
| 1000 | 994 | ); |
| 1001 | 995 | |
| 1002 | 996 | break; |
| 1003 | 997 | }// End switch(). |
| 1004 | 998 | |
| 1005 | - wp_send_json_success( $response_data ); |
|
| 999 | + wp_send_json_success($response_data); |
|
| 1006 | 1000 | } |
| 1007 | 1001 | |
| 1008 | -add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' ); |
|
| 1002 | +add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses'); |
|
| 1009 | 1003 | |
| 1010 | 1004 | /** |
| 1011 | 1005 | * Admin donor billing address label |
@@ -1016,13 +1010,13 @@ discard block |
||
| 1016 | 1010 | * |
| 1017 | 1011 | * @return string |
| 1018 | 1012 | */ |
| 1019 | -function __give_donor_billing_address_label( $address_label ) { |
|
| 1020 | - $address_label = __( 'Billing Address', 'give' ); |
|
| 1013 | +function __give_donor_billing_address_label($address_label) { |
|
| 1014 | + $address_label = __('Billing Address', 'give'); |
|
| 1021 | 1015 | |
| 1022 | 1016 | return $address_label; |
| 1023 | 1017 | } |
| 1024 | 1018 | |
| 1025 | -add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' ); |
|
| 1019 | +add_action('give_donor_billing_address_label', '__give_donor_billing_address_label'); |
|
| 1026 | 1020 | |
| 1027 | 1021 | /** |
| 1028 | 1022 | * Admin donor personal address label |
@@ -1033,13 +1027,13 @@ discard block |
||
| 1033 | 1027 | * |
| 1034 | 1028 | * @return string |
| 1035 | 1029 | */ |
| 1036 | -function __give_donor_personal_address_label( $address_label ) { |
|
| 1037 | - $address_label = __( 'Personal Address', 'give' ); |
|
| 1030 | +function __give_donor_personal_address_label($address_label) { |
|
| 1031 | + $address_label = __('Personal Address', 'give'); |
|
| 1038 | 1032 | |
| 1039 | 1033 | return $address_label; |
| 1040 | 1034 | } |
| 1041 | 1035 | |
| 1042 | -add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' ); |
|
| 1036 | +add_action('give_donor_personal_address_label', '__give_donor_personal_address_label'); |
|
| 1043 | 1037 | |
| 1044 | 1038 | /** |
| 1045 | 1039 | * Update Donor Information when User Profile is updated from admin. |
@@ -1052,34 +1046,34 @@ discard block |
||
| 1052 | 1046 | * |
| 1053 | 1047 | * @return bool |
| 1054 | 1048 | */ |
| 1055 | -function give_update_donor_name_on_user_update( $user_id = 0 ) { |
|
| 1049 | +function give_update_donor_name_on_user_update($user_id = 0) { |
|
| 1056 | 1050 | |
| 1057 | - if ( current_user_can( 'edit_user', $user_id ) ) { |
|
| 1051 | + if (current_user_can('edit_user', $user_id)) { |
|
| 1058 | 1052 | |
| 1059 | - $donor = new Give_Donor( $user_id, true ); |
|
| 1053 | + $donor = new Give_Donor($user_id, true); |
|
| 1060 | 1054 | |
| 1061 | 1055 | // Bailout, if donor doesn't exists. |
| 1062 | - if ( ! $donor ) { |
|
| 1056 | + if ( ! $donor) { |
|
| 1063 | 1057 | return false; |
| 1064 | 1058 | } |
| 1065 | 1059 | |
| 1066 | 1060 | // Get User First name and Last name. |
| 1067 | - $first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true ); |
|
| 1068 | - $last_name = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true ); |
|
| 1069 | - $full_name = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
| 1061 | + $first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true); |
|
| 1062 | + $last_name = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true); |
|
| 1063 | + $full_name = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
| 1070 | 1064 | |
| 1071 | 1065 | // Assign User First name and Last name to Donor. |
| 1072 | - Give()->donors->update( $donor->id, array( |
|
| 1066 | + Give()->donors->update($donor->id, array( |
|
| 1073 | 1067 | 'name' => $full_name, |
| 1074 | - ) ); |
|
| 1075 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name ); |
|
| 1076 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name ); |
|
| 1068 | + )); |
|
| 1069 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name); |
|
| 1070 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name); |
|
| 1077 | 1071 | |
| 1078 | 1072 | } |
| 1079 | 1073 | } |
| 1080 | 1074 | |
| 1081 | -add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 ); |
|
| 1082 | -add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 ); |
|
| 1075 | +add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10); |
|
| 1076 | +add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10); |
|
| 1083 | 1077 | |
| 1084 | 1078 | |
| 1085 | 1079 | /** |
@@ -1094,31 +1088,31 @@ discard block |
||
| 1094 | 1088 | * |
| 1095 | 1089 | * @return bool |
| 1096 | 1090 | */ |
| 1097 | -function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
|
| 1091 | +function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) { |
|
| 1098 | 1092 | |
| 1099 | - $donor = new Give_Donor( $user_id, true ); |
|
| 1093 | + $donor = new Give_Donor($user_id, true); |
|
| 1100 | 1094 | |
| 1101 | - if ( ! $donor ) { |
|
| 1095 | + if ( ! $donor) { |
|
| 1102 | 1096 | return false; |
| 1103 | 1097 | } |
| 1104 | 1098 | |
| 1105 | - $user = get_userdata( $user_id ); |
|
| 1099 | + $user = get_userdata($user_id); |
|
| 1106 | 1100 | |
| 1107 | - if ( ! empty( $user ) && $user->user_email !== $donor->email ) { |
|
| 1101 | + if ( ! empty($user) && $user->user_email !== $donor->email) { |
|
| 1108 | 1102 | |
| 1109 | - $success = Give()->donors->update( $donor->id, array( |
|
| 1103 | + $success = Give()->donors->update($donor->id, array( |
|
| 1110 | 1104 | 'email' => $user->user_email, |
| 1111 | - ) ); |
|
| 1105 | + )); |
|
| 1112 | 1106 | |
| 1113 | - if ( $success ) { |
|
| 1107 | + if ($success) { |
|
| 1114 | 1108 | // Update some payment meta if we need to |
| 1115 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
| 1109 | + $payments_array = explode(',', $donor->payment_ids); |
|
| 1116 | 1110 | |
| 1117 | - if ( ! empty( $payments_array ) ) { |
|
| 1111 | + if ( ! empty($payments_array)) { |
|
| 1118 | 1112 | |
| 1119 | - foreach ( $payments_array as $payment_id ) { |
|
| 1113 | + foreach ($payments_array as $payment_id) { |
|
| 1120 | 1114 | |
| 1121 | - give_update_payment_meta( $payment_id, 'email', $user->user_email ); |
|
| 1115 | + give_update_payment_meta($payment_id, 'email', $user->user_email); |
|
| 1122 | 1116 | |
| 1123 | 1117 | } |
| 1124 | 1118 | } |
@@ -1131,14 +1125,14 @@ discard block |
||
| 1131 | 1125 | * @param WP_User $user WordPress User object. |
| 1132 | 1126 | * @param Give_Donor $donor Give donor object. |
| 1133 | 1127 | */ |
| 1134 | - do_action( 'give_update_donor_email_on_user_update', $user, $donor ); |
|
| 1128 | + do_action('give_update_donor_email_on_user_update', $user, $donor); |
|
| 1135 | 1129 | |
| 1136 | 1130 | } |
| 1137 | 1131 | } |
| 1138 | 1132 | |
| 1139 | 1133 | } |
| 1140 | 1134 | |
| 1141 | -add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 ); |
|
| 1135 | +add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2); |
|
| 1142 | 1136 | |
| 1143 | 1137 | |
| 1144 | 1138 | /** |
@@ -1147,15 +1141,15 @@ discard block |
||
| 1147 | 1141 | function give_cache_flush() { |
| 1148 | 1142 | $result = Give_Cache::flush_cache(); |
| 1149 | 1143 | |
| 1150 | - if ( $result ) { |
|
| 1151 | - wp_send_json_success( array( |
|
| 1152 | - 'message' => __( 'Cache flushed successfully.', 'give' ), |
|
| 1144 | + if ($result) { |
|
| 1145 | + wp_send_json_success(array( |
|
| 1146 | + 'message' => __('Cache flushed successfully.', 'give'), |
|
| 1153 | 1147 | )); |
| 1154 | 1148 | } else { |
| 1155 | - wp_send_json_error( array( |
|
| 1156 | - 'message' => __( 'An error occured while flushing the cache.', 'give' ), |
|
| 1149 | + wp_send_json_error(array( |
|
| 1150 | + 'message' => __('An error occured while flushing the cache.', 'give'), |
|
| 1157 | 1151 | )); |
| 1158 | 1152 | } |
| 1159 | 1153 | } |
| 1160 | 1154 | |
| 1161 | -add_action( 'wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0 ); |
|
| 1155 | +add_action('wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0); |
|
@@ -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 | /** |
@@ -136,15 +136,15 @@ discard block |
||
| 136 | 136 | // Set parent defaults. |
| 137 | 137 | parent::__construct( |
| 138 | 138 | array( |
| 139 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 140 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 141 | - 'ajax' => false, // Does this table support ajax? |
|
| 139 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 140 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 141 | + 'ajax' => false, // Does this table support ajax? |
|
| 142 | 142 | ) |
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | $this->process_bulk_action(); |
| 146 | 146 | $this->get_payment_counts(); |
| 147 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 147 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -153,32 +153,32 @@ discard block |
||
| 153 | 153 | * @return void |
| 154 | 154 | */ |
| 155 | 155 | public function advanced_filters() { |
| 156 | - $start_date = isset( $_GET['start-date'] ) ? give_clean( $_GET['start-date'] ) : null; |
|
| 157 | - $end_date = isset( $_GET['end-date'] ) ? give_clean( $_GET['end-date'] ) : null; |
|
| 158 | - $status = isset( $_GET['status'] ) ? give_clean( $_GET['status'] ) : ''; |
|
| 159 | - $donor = isset( $_GET['donor'] ) ? absint( $_GET['donor'] ) : ''; |
|
| 160 | - $search = isset( $_GET['s'] ) ? give_clean( $_GET['s'] ) : ''; |
|
| 161 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; |
|
| 156 | + $start_date = isset($_GET['start-date']) ? give_clean($_GET['start-date']) : null; |
|
| 157 | + $end_date = isset($_GET['end-date']) ? give_clean($_GET['end-date']) : null; |
|
| 158 | + $status = isset($_GET['status']) ? give_clean($_GET['status']) : ''; |
|
| 159 | + $donor = isset($_GET['donor']) ? absint($_GET['donor']) : ''; |
|
| 160 | + $search = isset($_GET['s']) ? give_clean($_GET['s']) : ''; |
|
| 161 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; |
|
| 162 | 162 | $localized_date_format = give_get_localized_date_format_to_js(); |
| 163 | 163 | ?> |
| 164 | 164 | <div id="give-payment-filters" class="give-filters"> |
| 165 | - <?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 165 | + <?php $this->search_box(__('Search', 'give'), 'give-payments'); ?> |
|
| 166 | 166 | <div id="give-payment-date-filters"> |
| 167 | 167 | <div class="give-filter give-filter-half"> |
| 168 | 168 | <label for="start-date" |
| 169 | - class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label> |
|
| 169 | + class="give-start-date-label"><?php _e('Start Date', 'give'); ?></label> |
|
| 170 | 170 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
| 171 | - value="<?php printf( esc_attr( $start_date ) ); ?>" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
| 171 | + value="<?php printf(esc_attr($start_date)); ?>" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
| 172 | 172 | </div> |
| 173 | 173 | <div class="give-filter give-filter-half"> |
| 174 | - <label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label> |
|
| 174 | + <label for="end-date" class="give-end-date-label"><?php _e('End Date', 'give'); ?></label> |
|
| 175 | 175 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
| 176 | - value="<?php printf( esc_attr( $end_date ) ); ?>" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
| 176 | + value="<?php printf(esc_attr($end_date)); ?>" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
| 177 | 177 | </div> |
| 178 | 178 | </div> |
| 179 | 179 | <div id="give-payment-form-filter" class="give-filter"> |
| 180 | 180 | <label for="give-donation-forms-filter" |
| 181 | - class="give-donation-forms-filter-label"><?php _e( 'Form', 'give' ); ?></label> |
|
| 181 | + class="give-donation-forms-filter-label"><?php _e('Form', 'give'); ?></label> |
|
| 182 | 182 | <?php |
| 183 | 183 | // Filter Donations by Donation Forms. |
| 184 | 184 | echo Give()->html->forms_dropdown( |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | 'class' => 'give-donation-forms-filter', |
| 189 | 189 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. |
| 190 | 190 | 'chosen' => true, |
| 191 | - 'number' => - 1, |
|
| 191 | + 'number' => -1, |
|
| 192 | 192 | ) |
| 193 | 193 | ); |
| 194 | 194 | ?> |
@@ -200,26 +200,26 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @since 1.8.18 |
| 202 | 202 | */ |
| 203 | - do_action( 'give_payment_table_advanced_filters' ); |
|
| 203 | + do_action('give_payment_table_advanced_filters'); |
|
| 204 | 204 | |
| 205 | 205 | |
| 206 | - if ( ! empty( $status ) ) { |
|
| 207 | - echo sprintf( '<input type="hidden" name="status" value="%s"/>', esc_attr( $status ) ); |
|
| 206 | + if ( ! empty($status)) { |
|
| 207 | + echo sprintf('<input type="hidden" name="status" value="%s"/>', esc_attr($status)); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( ! empty( $donor ) ) { |
|
| 211 | - echo sprintf( '<input type="hidden" name="donor" value="%s"/>', absint( $donor ) ); |
|
| 210 | + if ( ! empty($donor)) { |
|
| 211 | + echo sprintf('<input type="hidden" name="donor" value="%s"/>', absint($donor)); |
|
| 212 | 212 | } |
| 213 | 213 | ?> |
| 214 | 214 | |
| 215 | 215 | <div class="give-filter"> |
| 216 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
|
| 216 | + <?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> |
|
| 217 | 217 | <?php |
| 218 | 218 | // Clear active filters button. |
| 219 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : |
|
| 219 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : |
|
| 220 | 220 | ?> |
| 221 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
| 222 | - class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a> |
|
| 221 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
| 222 | + class="button give-clear-filters-button"><?php _e('Clear Filters', 'give'); ?></a> |
|
| 223 | 223 | <?php endif; ?> |
| 224 | 224 | </div> |
| 225 | 225 | </div> |
@@ -238,18 +238,18 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return void |
| 240 | 240 | */ |
| 241 | - public function search_box( $text, $input_id ) { |
|
| 242 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 241 | + public function search_box($text, $input_id) { |
|
| 242 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 243 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $input_id = $input_id . '-search-input'; |
|
| 246 | + $input_id = $input_id.'-search-input'; |
|
| 247 | 247 | |
| 248 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 249 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 248 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 249 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 250 | 250 | } |
| 251 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 252 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 251 | + if ( ! empty($_REQUEST['order'])) { |
|
| 252 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 253 | 253 | } |
| 254 | 254 | ?> |
| 255 | 255 | <div class="give-filter give-filter-search" role="search"> |
@@ -261,13 +261,13 @@ discard block |
||
| 261 | 261 | * |
| 262 | 262 | * @since 1.7 |
| 263 | 263 | */ |
| 264 | - do_action( 'give_payment_history_search' ); |
|
| 264 | + do_action('give_payment_history_search'); |
|
| 265 | 265 | ?> |
| 266 | 266 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 267 | 267 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 268 | - <?php submit_button( $text, 'button', false, false, array( |
|
| 268 | + <?php submit_button($text, 'button', false, false, array( |
|
| 269 | 269 | 'ID' => 'search-submit', |
| 270 | - ) ); ?><br/> |
|
| 270 | + )); ?><br/> |
|
| 271 | 271 | </div> |
| 272 | 272 | <?php |
| 273 | 273 | } |
@@ -282,48 +282,48 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | public function get_views() { |
| 284 | 284 | |
| 285 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 285 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 286 | 286 | $views = array(); |
| 287 | 287 | $tabs = array( |
| 288 | 288 | 'all' => array( |
| 289 | 289 | 'total_count', |
| 290 | - __( 'All', 'give' ), |
|
| 290 | + __('All', 'give'), |
|
| 291 | 291 | ), |
| 292 | 292 | 'publish' => array( |
| 293 | 293 | 'complete_count', |
| 294 | - __( 'Completed', 'give' ), |
|
| 294 | + __('Completed', 'give'), |
|
| 295 | 295 | ), |
| 296 | 296 | 'pending' => array( |
| 297 | 297 | 'pending_count', |
| 298 | - __( 'Pending', 'give' ), |
|
| 298 | + __('Pending', 'give'), |
|
| 299 | 299 | ), |
| 300 | 300 | 'processing' => array( |
| 301 | 301 | 'processing_count', |
| 302 | - __( 'Processing', 'give' ), |
|
| 302 | + __('Processing', 'give'), |
|
| 303 | 303 | ), |
| 304 | 304 | 'refunded' => array( |
| 305 | 305 | 'refunded_count', |
| 306 | - __( 'Refunded', 'give' ), |
|
| 306 | + __('Refunded', 'give'), |
|
| 307 | 307 | ), |
| 308 | 308 | 'revoked' => array( |
| 309 | 309 | 'revoked_count', |
| 310 | - __( 'Revoked', 'give' ), |
|
| 310 | + __('Revoked', 'give'), |
|
| 311 | 311 | ), |
| 312 | 312 | 'failed' => array( |
| 313 | 313 | 'failed_count', |
| 314 | - __( 'Failed', 'give' ), |
|
| 314 | + __('Failed', 'give'), |
|
| 315 | 315 | ), |
| 316 | 316 | 'cancelled' => array( |
| 317 | 317 | 'cancelled_count', |
| 318 | - __( 'Cancelled', 'give' ), |
|
| 318 | + __('Cancelled', 'give'), |
|
| 319 | 319 | ), |
| 320 | 320 | 'abandoned' => array( |
| 321 | 321 | 'abandoned_count', |
| 322 | - __( 'Abandoned', 'give' ), |
|
| 322 | + __('Abandoned', 'give'), |
|
| 323 | 323 | ), |
| 324 | 324 | 'preapproval' => array( |
| 325 | 325 | 'preapproval_count', |
| 326 | - __( 'Preapproval Pending', 'give' ), |
|
| 326 | + __('Preapproval Pending', 'give'), |
|
| 327 | 327 | ), |
| 328 | 328 | ); |
| 329 | 329 | |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | * |
| 333 | 333 | * @since 1.8.18 |
| 334 | 334 | */ |
| 335 | - $args = (array) apply_filters( 'give_payments_table_status_remove_query_arg', array( 'paged', '_wpnonce', '_wp_http_referer' ) ); |
|
| 335 | + $args = (array) apply_filters('give_payments_table_status_remove_query_arg', array('paged', '_wpnonce', '_wp_http_referer')); |
|
| 336 | 336 | |
| 337 | 337 | // Build URL. |
| 338 | - $staus_url = remove_query_arg( $args ); |
|
| 338 | + $staus_url = remove_query_arg($args); |
|
| 339 | 339 | |
| 340 | - foreach ( $tabs as $key => $tab ) { |
|
| 340 | + foreach ($tabs as $key => $tab) { |
|
| 341 | 341 | $count_key = $tab[0]; |
| 342 | 342 | $name = $tab[1]; |
| 343 | 343 | $count = $this->$count_key; |
@@ -352,16 +352,15 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @since 1.8.12 |
| 354 | 354 | */ |
| 355 | - if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { |
|
| 355 | + if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { |
|
| 356 | 356 | |
| 357 | 357 | $staus_url = 'all' === $key ? |
| 358 | - add_query_arg( array( 'status' => false ), $staus_url ) : |
|
| 359 | - add_query_arg( array( 'status' => $key ), $staus_url ); |
|
| 358 | + add_query_arg(array('status' => false), $staus_url) : add_query_arg(array('status' => $key), $staus_url); |
|
| 360 | 359 | |
| 361 | - $views[ $key ] = sprintf( |
|
| 360 | + $views[$key] = sprintf( |
|
| 362 | 361 | '<a href="%s"%s>%s <span class="count">(%s)</span></a>', |
| 363 | - esc_url( $staus_url ), |
|
| 364 | - ( ( 'all' === $key && empty( $current ) ) ) ? ' class="current"' : ( $current == $key ? 'class="current"' : '' ), |
|
| 362 | + esc_url($staus_url), |
|
| 363 | + (('all' === $key && empty($current))) ? ' class="current"' : ($current == $key ? 'class="current"' : ''), |
|
| 365 | 364 | $name, |
| 366 | 365 | $count |
| 367 | 366 | ); |
@@ -376,7 +375,7 @@ discard block |
||
| 376 | 375 | * @param array $views |
| 377 | 376 | * @param Give_Payment_History_Table |
| 378 | 377 | */ |
| 379 | - return apply_filters( 'give_payments_table_views', $views, $this ); |
|
| 378 | + return apply_filters('give_payments_table_views', $views, $this); |
|
| 380 | 379 | } |
| 381 | 380 | |
| 382 | 381 | /** |
@@ -390,18 +389,18 @@ discard block |
||
| 390 | 389 | public function get_columns() { |
| 391 | 390 | $columns = array( |
| 392 | 391 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 393 | - 'donation' => __( 'Donation', 'give' ), |
|
| 394 | - 'donation_form' => __( 'Donation Form', 'give' ), |
|
| 395 | - 'status' => __( 'Status', 'give' ), |
|
| 396 | - 'date' => __( 'Date', 'give' ), |
|
| 397 | - 'amount' => __( 'Amount', 'give' ), |
|
| 392 | + 'donation' => __('Donation', 'give'), |
|
| 393 | + 'donation_form' => __('Donation Form', 'give'), |
|
| 394 | + 'status' => __('Status', 'give'), |
|
| 395 | + 'date' => __('Date', 'give'), |
|
| 396 | + 'amount' => __('Amount', 'give'), |
|
| 398 | 397 | ); |
| 399 | 398 | |
| 400 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
| 401 | - $columns['details'] = __( 'Details', 'give' ); |
|
| 399 | + if (current_user_can('view_give_payments')) { |
|
| 400 | + $columns['details'] = __('Details', 'give'); |
|
| 402 | 401 | } |
| 403 | 402 | |
| 404 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 403 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 405 | 404 | } |
| 406 | 405 | |
| 407 | 406 | /** |
@@ -414,14 +413,14 @@ discard block |
||
| 414 | 413 | */ |
| 415 | 414 | public function get_sortable_columns() { |
| 416 | 415 | $columns = array( |
| 417 | - 'donation' => array( 'ID', true ), |
|
| 418 | - 'donation_form' => array( 'donation_form', false ), |
|
| 419 | - 'status' => array( 'status', false ), |
|
| 420 | - 'amount' => array( 'amount', false ), |
|
| 421 | - 'date' => array( 'date', false ), |
|
| 416 | + 'donation' => array('ID', true), |
|
| 417 | + 'donation_form' => array('donation_form', false), |
|
| 418 | + 'status' => array('status', false), |
|
| 419 | + 'amount' => array('amount', false), |
|
| 420 | + 'date' => array('date', false), |
|
| 422 | 421 | ); |
| 423 | 422 | |
| 424 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 423 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 425 | 424 | } |
| 426 | 425 | |
| 427 | 426 | /** |
@@ -447,43 +446,43 @@ discard block |
||
| 447 | 446 | * |
| 448 | 447 | * @return string Column Name |
| 449 | 448 | */ |
| 450 | - public function column_default( $payment, $column_name ) { |
|
| 449 | + public function column_default($payment, $column_name) { |
|
| 451 | 450 | |
| 452 | - $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' ) ) ); |
|
| 453 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 451 | + $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'))); |
|
| 452 | + $row_actions = $this->get_row_actions($payment); |
|
| 454 | 453 | $value = ''; |
| 455 | 454 | |
| 456 | - switch ( $column_name ) { |
|
| 455 | + switch ($column_name) { |
|
| 457 | 456 | case 'donation' : |
| 458 | - $serial_code = Give()->seq_donation_number->get_serial_code( $payment ); |
|
| 459 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
| 460 | - $value = Give()->tooltips->render_link( array( |
|
| 461 | - 'label' => sprintf( __( 'View Donation %s', 'give' ), $serial_code ), |
|
| 457 | + $serial_code = Give()->seq_donation_number->get_serial_code($payment); |
|
| 458 | + if (current_user_can('view_give_payments')) { |
|
| 459 | + $value = Give()->tooltips->render_link(array( |
|
| 460 | + 'label' => sprintf(__('View Donation %s', 'give'), $serial_code), |
|
| 462 | 461 | 'tag_content' => $serial_code, |
| 463 | 462 | 'link' => $single_donation_url, |
| 464 | - ) ); |
|
| 463 | + )); |
|
| 465 | 464 | } else { |
| 466 | 465 | $value = $serial_code; |
| 467 | 466 | } |
| 468 | 467 | |
| 469 | 468 | $value .= sprintf( |
| 470 | 469 | ' %1$s %2$s<br>', |
| 471 | - __( 'by', 'give' ), |
|
| 472 | - $this->get_donor( $payment ) |
|
| 470 | + __('by', 'give'), |
|
| 471 | + $this->get_donor($payment) |
|
| 473 | 472 | ); |
| 474 | 473 | |
| 475 | - $value .= $this->get_donor_email( $payment ); |
|
| 476 | - $value .= $this->row_actions( $row_actions ); |
|
| 474 | + $value .= $this->get_donor_email($payment); |
|
| 475 | + $value .= $this->row_actions($row_actions); |
|
| 477 | 476 | break; |
| 478 | 477 | |
| 479 | 478 | case 'amount': |
| 480 | - $value = give_donation_amount( $payment, true ); |
|
| 481 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
| 479 | + $value = give_donation_amount($payment, true); |
|
| 480 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
| 482 | 481 | break; |
| 483 | 482 | |
| 484 | 483 | case 'donation_form': |
| 485 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
| 486 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
| 484 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
| 485 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
| 487 | 486 | $level = give_get_donation_form_title( |
| 488 | 487 | $payment, |
| 489 | 488 | array( |
@@ -491,44 +490,44 @@ discard block |
||
| 491 | 490 | ) |
| 492 | 491 | ); |
| 493 | 492 | |
| 494 | - if ( ! empty( $level ) ) { |
|
| 493 | + if ( ! empty($level)) { |
|
| 495 | 494 | $value .= $level; |
| 496 | 495 | } |
| 497 | 496 | |
| 498 | 497 | break; |
| 499 | 498 | |
| 500 | 499 | case 'date': |
| 501 | - $date = strtotime( $payment->date ); |
|
| 502 | - $value = date_i18n( give_date_format(), $date ); |
|
| 500 | + $date = strtotime($payment->date); |
|
| 501 | + $value = date_i18n(give_date_format(), $date); |
|
| 503 | 502 | break; |
| 504 | 503 | |
| 505 | 504 | case 'status': |
| 506 | - $value = $this->get_payment_status( $payment ); |
|
| 505 | + $value = $this->get_payment_status($payment); |
|
| 507 | 506 | break; |
| 508 | 507 | |
| 509 | 508 | |
| 510 | 509 | case 'details' : |
| 511 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
| 512 | - $value = Give()->tooltips->render_link( array( |
|
| 513 | - 'label' => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ), |
|
| 510 | + if (current_user_can('view_give_payments')) { |
|
| 511 | + $value = Give()->tooltips->render_link(array( |
|
| 512 | + 'label' => sprintf(__('View Donation #%s', 'give'), $payment->ID), |
|
| 514 | 513 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
| 515 | 514 | 'link' => $single_donation_url, |
| 516 | 515 | 'attributes' => array( |
| 517 | 516 | 'class' => 'give-payment-details-link button button-small', |
| 518 | 517 | ), |
| 519 | - ) ); |
|
| 518 | + )); |
|
| 520 | 519 | |
| 521 | 520 | $value = "<div class=\"give-payment-details-link-wrap\">{$value}</div>"; |
| 522 | 521 | } |
| 523 | 522 | break; |
| 524 | 523 | |
| 525 | 524 | default: |
| 526 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 525 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 527 | 526 | break; |
| 528 | 527 | |
| 529 | 528 | }// End switch(). |
| 530 | 529 | |
| 531 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 530 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 532 | 531 | } |
| 533 | 532 | |
| 534 | 533 | /** |
@@ -541,22 +540,22 @@ discard block |
||
| 541 | 540 | * |
| 542 | 541 | * @return string Data shown in the Email column |
| 543 | 542 | */ |
| 544 | - public function get_donor_email( $payment ) { |
|
| 543 | + public function get_donor_email($payment) { |
|
| 545 | 544 | |
| 546 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 545 | + $email = give_get_payment_user_email($payment->ID); |
|
| 547 | 546 | |
| 548 | - if ( empty( $email ) ) { |
|
| 549 | - $email = __( '(unknown)', 'give' ); |
|
| 547 | + if (empty($email)) { |
|
| 548 | + $email = __('(unknown)', 'give'); |
|
| 550 | 549 | } |
| 551 | 550 | |
| 552 | 551 | |
| 553 | - $value = Give()->tooltips->render_link( array( |
|
| 552 | + $value = Give()->tooltips->render_link(array( |
|
| 554 | 553 | 'link' => "mailto:{$email}", |
| 555 | - 'label' => __( 'Email donor', 'give' ), |
|
| 554 | + 'label' => __('Email donor', 'give'), |
|
| 556 | 555 | 'tag_content' => $email, |
| 557 | - ) ); |
|
| 556 | + )); |
|
| 558 | 557 | |
| 559 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 558 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 560 | 559 | } |
| 561 | 560 | |
| 562 | 561 | /** |
@@ -568,18 +567,18 @@ discard block |
||
| 568 | 567 | * |
| 569 | 568 | * @return array $actions |
| 570 | 569 | */ |
| 571 | - function get_row_actions( $payment ) { |
|
| 570 | + function get_row_actions($payment) { |
|
| 572 | 571 | |
| 573 | 572 | $actions = array(); |
| 574 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 573 | + $email = give_get_payment_user_email($payment->ID); |
|
| 575 | 574 | |
| 576 | 575 | // Add search term string back to base URL. |
| 577 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 578 | - if ( ! empty( $search_terms ) ) { |
|
| 579 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 576 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 577 | + if ( ! empty($search_terms)) { |
|
| 578 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 580 | 579 | } |
| 581 | 580 | |
| 582 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 581 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 583 | 582 | |
| 584 | 583 | $actions['email_links'] = sprintf( |
| 585 | 584 | '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( |
@@ -589,12 +588,12 @@ discard block |
||
| 589 | 588 | 'purchase_id' => $payment->ID, |
| 590 | 589 | ), $this->base_url |
| 591 | 590 | ), 'give_payment_nonce' |
| 592 | - ), sprintf( __( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), __( 'Resend Receipt', 'give' ) |
|
| 591 | + ), sprintf(__('Resend Donation %s Receipt', 'give'), $payment->ID), __('Resend Receipt', 'give') |
|
| 593 | 592 | ); |
| 594 | 593 | |
| 595 | 594 | } |
| 596 | 595 | |
| 597 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
| 596 | + if (current_user_can('view_give_payments')) { |
|
| 598 | 597 | $actions['delete'] = sprintf( |
| 599 | 598 | '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', |
| 600 | 599 | wp_nonce_url( |
@@ -604,11 +603,11 @@ discard block |
||
| 604 | 603 | 'purchase_id' => $payment->ID, |
| 605 | 604 | ), $this->base_url |
| 606 | 605 | ), 'give_donation_nonce' |
| 607 | - ), sprintf( __( 'Delete Donation %s', 'give' ), $payment->ID ), __( 'Delete', 'give' ) |
|
| 606 | + ), sprintf(__('Delete Donation %s', 'give'), $payment->ID), __('Delete', 'give') |
|
| 608 | 607 | ); |
| 609 | 608 | } |
| 610 | 609 | |
| 611 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 610 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 612 | 611 | } |
| 613 | 612 | |
| 614 | 613 | |
@@ -622,30 +621,30 @@ discard block |
||
| 622 | 621 | * |
| 623 | 622 | * @return string Data shown in the Email column |
| 624 | 623 | */ |
| 625 | - function get_payment_status( $payment ) { |
|
| 624 | + function get_payment_status($payment) { |
|
| 626 | 625 | $value = sprintf( |
| 627 | 626 | '<div class="give-donation-status status-%1$s"><span class="give-donation-status-icon"></span> %2$s</div>', |
| 628 | 627 | $payment->status, |
| 629 | - give_get_payment_status( $payment, true ) |
|
| 628 | + give_get_payment_status($payment, true) |
|
| 630 | 629 | ); |
| 631 | 630 | |
| 632 | - if ( $payment->mode == 'test' ) { |
|
| 633 | - $value .= Give()->tooltips->render_span( array( |
|
| 634 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
| 635 | - 'tag_content' => __( 'Test', 'give' ), |
|
| 631 | + if ($payment->mode == 'test') { |
|
| 632 | + $value .= Give()->tooltips->render_span(array( |
|
| 633 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
| 634 | + 'tag_content' => __('Test', 'give'), |
|
| 636 | 635 | 'attributes' => array( |
| 637 | 636 | 'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label', |
| 638 | 637 | ), |
| 639 | 638 | |
| 640 | 639 | |
| 641 | - ) ); |
|
| 640 | + )); |
|
| 642 | 641 | } |
| 643 | 642 | |
| 644 | - if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) { |
|
| 643 | + if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) { |
|
| 645 | 644 | $value .= sprintf( |
| 646 | 645 | ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="%1$s">%2$s</span>', |
| 647 | - __( 'This donation was imported.', 'give' ), |
|
| 648 | - __( 'Import', 'give' ) |
|
| 646 | + __('This donation was imported.', 'give'), |
|
| 647 | + __('Import', 'give') |
|
| 649 | 648 | ); |
| 650 | 649 | } |
| 651 | 650 | |
@@ -662,8 +661,8 @@ discard block |
||
| 662 | 661 | * |
| 663 | 662 | * @return string Displays a checkbox. |
| 664 | 663 | */ |
| 665 | - public function column_cb( $payment ) { |
|
| 666 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
| 664 | + public function column_cb($payment) { |
|
| 665 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
| 667 | 666 | } |
| 668 | 667 | |
| 669 | 668 | /** |
@@ -676,8 +675,8 @@ discard block |
||
| 676 | 675 | * |
| 677 | 676 | * @return string Displays a checkbox. |
| 678 | 677 | */ |
| 679 | - public function get_payment_id( $payment ) { |
|
| 680 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 678 | + public function get_payment_id($payment) { |
|
| 679 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 681 | 680 | } |
| 682 | 681 | |
| 683 | 682 | /** |
@@ -690,32 +689,32 @@ discard block |
||
| 690 | 689 | * |
| 691 | 690 | * @return string Data shown in the User column |
| 692 | 691 | */ |
| 693 | - public function get_donor( $payment ) { |
|
| 692 | + public function get_donor($payment) { |
|
| 694 | 693 | |
| 695 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
| 696 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
| 697 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 694 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
| 695 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
| 696 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 698 | 697 | |
| 699 | 698 | $value = ''; |
| 700 | - if ( ! empty( $donor_id ) ) { |
|
| 699 | + if ( ! empty($donor_id)) { |
|
| 701 | 700 | |
| 702 | 701 | // Check whether the donor name and WP_User name is same or not. |
| 703 | - if ( sanitize_title( $donor_billing_name ) !== sanitize_title( $donor_name ) ) { |
|
| 704 | - $value .= $donor_billing_name . ' ('; |
|
| 702 | + if (sanitize_title($donor_billing_name) !== sanitize_title($donor_name)) { |
|
| 703 | + $value .= $donor_billing_name.' ('; |
|
| 705 | 704 | } |
| 706 | 705 | |
| 707 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
| 706 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
| 708 | 707 | |
| 709 | 708 | // Check whether the donor name and WP_User name is same or not. |
| 710 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 709 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 711 | 710 | $value .= ')'; |
| 712 | 711 | } |
| 713 | 712 | } else { |
| 714 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 715 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . __( '(donor missing)', 'give' ) . '</a>'; |
|
| 713 | + $email = give_get_payment_user_email($payment->ID); |
|
| 714 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.__('(donor missing)', 'give').'</a>'; |
|
| 716 | 715 | } |
| 717 | 716 | |
| 718 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 717 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 719 | 718 | } |
| 720 | 719 | |
| 721 | 720 | /** |
@@ -728,20 +727,20 @@ discard block |
||
| 728 | 727 | */ |
| 729 | 728 | public function get_bulk_actions() { |
| 730 | 729 | $actions = array( |
| 731 | - 'delete' => __( 'Delete', 'give' ), |
|
| 732 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
| 733 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
| 734 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
| 735 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
| 736 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
| 737 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
| 738 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
| 739 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
| 740 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
| 741 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
| 730 | + 'delete' => __('Delete', 'give'), |
|
| 731 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
| 732 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
| 733 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
| 734 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
| 735 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
| 736 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
| 737 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
| 738 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
| 739 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
| 740 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
| 742 | 741 | ); |
| 743 | 742 | |
| 744 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 743 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 745 | 744 | } |
| 746 | 745 | |
| 747 | 746 | /** |
@@ -753,59 +752,59 @@ discard block |
||
| 753 | 752 | * @return void |
| 754 | 753 | */ |
| 755 | 754 | public function process_bulk_action() { |
| 756 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 755 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 757 | 756 | $action = $this->current_action(); |
| 758 | 757 | |
| 759 | - if ( ! is_array( $ids ) ) { |
|
| 760 | - $ids = array( $ids ); |
|
| 758 | + if ( ! is_array($ids)) { |
|
| 759 | + $ids = array($ids); |
|
| 761 | 760 | } |
| 762 | 761 | |
| 763 | - if ( empty( $action ) ) { |
|
| 762 | + if (empty($action)) { |
|
| 764 | 763 | return; |
| 765 | 764 | } |
| 766 | 765 | |
| 767 | - foreach ( $ids as $id ) { |
|
| 766 | + foreach ($ids as $id) { |
|
| 768 | 767 | |
| 769 | 768 | // Detect when a bulk action is being triggered. |
| 770 | - switch ( $this->current_action() ) { |
|
| 769 | + switch ($this->current_action()) { |
|
| 771 | 770 | |
| 772 | 771 | case 'delete': |
| 773 | - give_delete_donation( $id ); |
|
| 772 | + give_delete_donation($id); |
|
| 774 | 773 | break; |
| 775 | 774 | |
| 776 | 775 | case 'set-status-publish': |
| 777 | - give_update_payment_status( $id, 'publish' ); |
|
| 776 | + give_update_payment_status($id, 'publish'); |
|
| 778 | 777 | break; |
| 779 | 778 | |
| 780 | 779 | case 'set-status-pending': |
| 781 | - give_update_payment_status( $id, 'pending' ); |
|
| 780 | + give_update_payment_status($id, 'pending'); |
|
| 782 | 781 | break; |
| 783 | 782 | |
| 784 | 783 | case 'set-status-processing': |
| 785 | - give_update_payment_status( $id, 'processing' ); |
|
| 784 | + give_update_payment_status($id, 'processing'); |
|
| 786 | 785 | break; |
| 787 | 786 | |
| 788 | 787 | case 'set-status-refunded': |
| 789 | - give_update_payment_status( $id, 'refunded' ); |
|
| 788 | + give_update_payment_status($id, 'refunded'); |
|
| 790 | 789 | break; |
| 791 | 790 | case 'set-status-revoked': |
| 792 | - give_update_payment_status( $id, 'revoked' ); |
|
| 791 | + give_update_payment_status($id, 'revoked'); |
|
| 793 | 792 | break; |
| 794 | 793 | |
| 795 | 794 | case 'set-status-failed': |
| 796 | - give_update_payment_status( $id, 'failed' ); |
|
| 795 | + give_update_payment_status($id, 'failed'); |
|
| 797 | 796 | break; |
| 798 | 797 | |
| 799 | 798 | case 'set-status-cancelled': |
| 800 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 799 | + give_update_payment_status($id, 'cancelled'); |
|
| 801 | 800 | break; |
| 802 | 801 | |
| 803 | 802 | case 'set-status-abandoned': |
| 804 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 803 | + give_update_payment_status($id, 'abandoned'); |
|
| 805 | 804 | break; |
| 806 | 805 | |
| 807 | 806 | case 'set-status-preapproval': |
| 808 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 807 | + give_update_payment_status($id, 'preapproval'); |
|
| 809 | 808 | break; |
| 810 | 809 | |
| 811 | 810 | case 'resend-receipt': |
@@ -814,7 +813,7 @@ discard block |
||
| 814 | 813 | * |
| 815 | 814 | * @since 2.0 |
| 816 | 815 | */ |
| 817 | - do_action( 'give_donation-receipt_email_notification', $id ); |
|
| 816 | + do_action('give_donation-receipt_email_notification', $id); |
|
| 818 | 817 | break; |
| 819 | 818 | }// End switch(). |
| 820 | 819 | |
@@ -826,7 +825,7 @@ discard block |
||
| 826 | 825 | * |
| 827 | 826 | * @since 1.7 |
| 828 | 827 | */ |
| 829 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 828 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 830 | 829 | }// End foreach(). |
| 831 | 830 | |
| 832 | 831 | } |
@@ -843,32 +842,32 @@ discard block |
||
| 843 | 842 | |
| 844 | 843 | $args = array(); |
| 845 | 844 | |
| 846 | - if ( isset( $_GET['user'] ) ) { |
|
| 847 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 848 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
| 849 | - $args['donor'] = absint( $_GET['donor'] ); |
|
| 850 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 851 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 852 | - if ( $is_user ) { |
|
| 853 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 854 | - unset( $args['s'] ); |
|
| 845 | + if (isset($_GET['user'])) { |
|
| 846 | + $args['user'] = urldecode($_GET['user']); |
|
| 847 | + } elseif (isset($_GET['donor'])) { |
|
| 848 | + $args['donor'] = absint($_GET['donor']); |
|
| 849 | + } elseif (isset($_GET['s'])) { |
|
| 850 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 851 | + if ($is_user) { |
|
| 852 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 853 | + unset($args['s']); |
|
| 855 | 854 | } else { |
| 856 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 855 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 857 | 856 | } |
| 858 | 857 | } |
| 859 | 858 | |
| 860 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 861 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 859 | + if ( ! empty($_GET['start-date'])) { |
|
| 860 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 862 | 861 | } |
| 863 | 862 | |
| 864 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 865 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 863 | + if ( ! empty($_GET['end-date'])) { |
|
| 864 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 866 | 865 | } |
| 867 | 866 | |
| 868 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
| 869 | - $args['gateway'] = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null; |
|
| 867 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
| 868 | + $args['gateway'] = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null; |
|
| 870 | 869 | |
| 871 | - $payment_count = give_count_payments( $args ); |
|
| 870 | + $payment_count = give_count_payments($args); |
|
| 872 | 871 | $this->complete_count = $payment_count->publish; |
| 873 | 872 | $this->pending_count = $payment_count->pending; |
| 874 | 873 | $this->processing_count = $payment_count->processing; |
@@ -879,7 +878,7 @@ discard block |
||
| 879 | 878 | $this->abandoned_count = $payment_count->abandoned; |
| 880 | 879 | $this->preapproval_count = $payment_count->preapproval; |
| 881 | 880 | |
| 882 | - foreach ( $payment_count as $count ) { |
|
| 881 | + foreach ($payment_count as $count) { |
|
| 883 | 882 | $this->total_count += $count; |
| 884 | 883 | } |
| 885 | 884 | |
@@ -897,25 +896,25 @@ discard block |
||
| 897 | 896 | public function payments_data() { |
| 898 | 897 | |
| 899 | 898 | $per_page = $this->per_page; |
| 900 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 901 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 902 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 903 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
| 904 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 905 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 906 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 907 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 908 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 909 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 910 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 911 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 912 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
| 913 | - $gateway = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null; |
|
| 899 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 900 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 901 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 902 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
| 903 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 904 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 905 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 906 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 907 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 908 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 909 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 910 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 911 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
| 912 | + $gateway = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null; |
|
| 914 | 913 | |
| 915 | 914 | $args = array( |
| 916 | 915 | 'output' => 'payments', |
| 917 | 916 | 'number' => $per_page, |
| 918 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 917 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 919 | 918 | 'orderby' => $orderby, |
| 920 | 919 | 'order' => $order, |
| 921 | 920 | 'user' => $user, |
@@ -932,9 +931,9 @@ discard block |
||
| 932 | 931 | 'give_forms' => $form_id, |
| 933 | 932 | ); |
| 934 | 933 | |
| 935 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 934 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 936 | 935 | $args['search_in_notes'] = true; |
| 937 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 936 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 938 | 937 | } |
| 939 | 938 | |
| 940 | 939 | /** |
@@ -942,9 +941,9 @@ discard block |
||
| 942 | 941 | * |
| 943 | 942 | * @since 1.8.18 |
| 944 | 943 | */ |
| 945 | - $args = (array) apply_filters( 'give_payment_table_payments_query', $args ); |
|
| 944 | + $args = (array) apply_filters('give_payment_table_payments_query', $args); |
|
| 946 | 945 | |
| 947 | - $p_query = new Give_Payments_Query( $args ); |
|
| 946 | + $p_query = new Give_Payments_Query($args); |
|
| 948 | 947 | |
| 949 | 948 | return $p_query->get_payments(); |
| 950 | 949 | |
@@ -965,17 +964,17 @@ discard block |
||
| 965 | 964 | */ |
| 966 | 965 | public function prepare_items() { |
| 967 | 966 | |
| 968 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 967 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 969 | 968 | |
| 970 | 969 | $columns = $this->get_columns(); |
| 971 | 970 | $hidden = array(); // No hidden columns. |
| 972 | 971 | $sortable = $this->get_sortable_columns(); |
| 973 | 972 | $data = $this->payments_data(); |
| 974 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 973 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 975 | 974 | |
| 976 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 975 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 977 | 976 | |
| 978 | - switch ( $status ) { |
|
| 977 | + switch ($status) { |
|
| 979 | 978 | case 'publish': |
| 980 | 979 | $total_items = $this->complete_count; |
| 981 | 980 | break; |
@@ -1008,8 +1007,8 @@ discard block |
||
| 1008 | 1007 | break; |
| 1009 | 1008 | default: |
| 1010 | 1009 | // Retrieve the count of the non-default-Give status. |
| 1011 | - $count = wp_count_posts( 'give_payment' ); |
|
| 1012 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
| 1010 | + $count = wp_count_posts('give_payment'); |
|
| 1011 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
| 1013 | 1012 | break; |
| 1014 | 1013 | } |
| 1015 | 1014 | |
@@ -1020,7 +1019,7 @@ discard block |
||
| 1020 | 1019 | * |
| 1021 | 1020 | * @since 1.8.19 |
| 1022 | 1021 | */ |
| 1023 | - $total_items = (int) apply_filters( 'give_payment_table_pagination_total_count', $total_items, $this ); |
|
| 1022 | + $total_items = (int) apply_filters('give_payment_table_pagination_total_count', $total_items, $this); |
|
| 1024 | 1023 | |
| 1025 | 1024 | $this->set_pagination_args( |
| 1026 | 1025 | array( |
@@ -1028,7 +1027,7 @@ discard block |
||
| 1028 | 1027 | // We have to calculate the total number of items. |
| 1029 | 1028 | 'per_page' => $this->per_page, |
| 1030 | 1029 | // We have to determine how many items to show on a page. |
| 1031 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 1030 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 1032 | 1031 | // We have to calculate the total number of pages. |
| 1033 | 1032 | ) |
| 1034 | 1033 | ); |
@@ -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 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
| 17 | +if ( ! current_user_can('view_give_payments')) { |
|
| 18 | 18 | wp_die( |
| 19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
| 19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
| 20 | 20 | 'response' => 403, |
| 21 | 21 | ) |
| 22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
| 28 | 28 | * @since 1.0 |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Setup the variables |
| 36 | -$payment_id = absint( $_GET['id'] ); |
|
| 37 | -$payment = new Give_Payment( $payment_id ); |
|
| 36 | +$payment_id = absint($_GET['id']); |
|
| 37 | +$payment = new Give_Payment($payment_id); |
|
| 38 | 38 | |
| 39 | 39 | // Sanity check... fail if donation ID is invalid |
| 40 | 40 | $payment_exists = $payment->ID; |
| 41 | -if ( empty( $payment_exists ) ) { |
|
| 42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 41 | +if (empty($payment_exists)) { |
|
| 42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $number = $payment->number; |
| 46 | 46 | $payment_meta = $payment->get_meta(); |
| 47 | 47 | |
| 48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
| 49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
| 48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
| 49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
| 50 | 50 | $user_id = $payment->user_id; |
| 51 | 51 | $donor_id = $payment->customer_id; |
| 52 | -$payment_date = strtotime( $payment->date ); |
|
| 53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 52 | +$payment_date = strtotime($payment->date); |
|
| 53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 54 | 54 | $address = $payment->address; |
| 55 | 55 | $currency_code = $payment->currency; |
| 56 | 56 | $gateway = $payment->gateway; |
| 57 | 57 | $currency_code = $payment->currency; |
| 58 | 58 | $payment_mode = $payment->mode; |
| 59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 60 | 60 | |
| 61 | 61 | ?> |
| 62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | <?php |
| 66 | 66 | printf( |
| 67 | 67 | /* translators: %s: donation number */ |
| 68 | - esc_html__( 'Donation %s', 'give' ), |
|
| 68 | + esc_html__('Donation %s', 'give'), |
|
| 69 | 69 | $number |
| 70 | 70 | ); |
| 71 | - if ( $payment_mode == 'test' ) { |
|
| 71 | + if ($payment_mode == 'test') { |
|
| 72 | 72 | echo Give()->tooltips->render_span(array( |
| 73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
| 74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
| 73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
| 74 | + 'tag_content' => __('Test Donation', 'give'), |
|
| 75 | 75 | 'position'=> 'right', |
| 76 | 76 | 'attributes' => array( |
| 77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @param int $payment_id Payment id. |
| 92 | 92 | */ |
| 93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
| 93 | + do_action('give_view_donation_details_before', $payment_id); |
|
| 94 | 94 | ?> |
| 95 | 95 | |
| 96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @param int $payment_id Payment id. |
| 106 | 106 | */ |
| 107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
| 107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
| 108 | 108 | ?> |
| 109 | 109 | <div id="poststuff"> |
| 110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @param int $payment_id Payment id. |
| 122 | 122 | */ |
| 123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
| 123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
| 124 | 124 | ?> |
| 125 | 125 | |
| 126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
| 127 | 127 | |
| 128 | 128 | <div class="give-order-top"> |
| 129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
| 129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
| 130 | 130 | |
| 131 | 131 | <?php |
| 132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
| 132 | + if (current_user_can('view_give_payments')) { |
|
| 133 | 133 | echo sprintf( |
| 134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
| 135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | ), $base_url |
| 142 | 142 | ), 'give_donation_nonce' |
| 143 | 143 | ), |
| 144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
| 144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | ?> |
@@ -158,34 +158,34 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @param int $payment_id Payment id. |
| 160 | 160 | */ |
| 161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
| 161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
| 162 | 162 | ?> |
| 163 | 163 | |
| 164 | 164 | <div class="give-admin-box-inside"> |
| 165 | 165 | <p> |
| 166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
| 166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
| 167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 170 | 170 | <?php endforeach; ?> |
| 171 | 171 | </select> |
| 172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 173 | 173 | </p> |
| 174 | 174 | </div> |
| 175 | 175 | |
| 176 | 176 | <div class="give-admin-box-inside"> |
| 177 | 177 | <?php $localized_date_format = give_get_localized_date_format_to_js(); ?> |
| 178 | 178 | <p> |
| 179 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
| 180 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
| 179 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
| 180 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
| 181 | 181 | </p> |
| 182 | 182 | </div> |
| 183 | 183 | |
| 184 | 184 | <div class="give-admin-box-inside"> |
| 185 | 185 | <p> |
| 186 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
| 187 | - <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"/> : |
|
| 188 | - <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"/> |
|
| 186 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
| 187 | + <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"/> : |
|
| 188 | + <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"/> |
|
| 189 | 189 | </p> |
| 190 | 190 | </div> |
| 191 | 191 | |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @param int $payment_id Payment id. |
| 201 | 201 | */ |
| 202 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
| 202 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
| 203 | 203 | ?> |
| 204 | 204 | |
| 205 | 205 | <div class="give-order-payment give-admin-box-inside"> |
| 206 | 206 | <p> |
| 207 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
| 208 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 209 | - <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_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
| 207 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
| 208 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 209 | + <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_donation_amount($payment_id), false, false)); ?>"/> |
|
| 210 | 210 | </p> |
| 211 | 211 | </div> |
| 212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @param int $payment_id Payment id. |
| 220 | 220 | */ |
| 221 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
| 221 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
| 222 | 222 | ?> |
| 223 | 223 | |
| 224 | 224 | </div> |
@@ -236,26 +236,26 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @param int $payment_id Payment id. |
| 238 | 238 | */ |
| 239 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
| 239 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
| 240 | 240 | ?> |
| 241 | 241 | |
| 242 | 242 | <div id="major-publishing-actions"> |
| 243 | 243 | <div id="publishing-action"> |
| 244 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 244 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 245 | 245 | <?php |
| 246 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
| 246 | + if (give_is_payment_complete($payment_id)) { |
|
| 247 | 247 | $url = add_query_arg( |
| 248 | 248 | array( |
| 249 | 249 | 'give-action' => 'email_links', |
| 250 | 250 | 'purchase_id' => $payment_id, |
| 251 | 251 | ), |
| 252 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ) |
|
| 252 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id) |
|
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | 255 | echo sprintf( |
| 256 | 256 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
| 257 | - esc_url( $url ), |
|
| 258 | - esc_html__( 'Resend Receipt', 'give' ) |
|
| 257 | + esc_url($url), |
|
| 258 | + esc_html__('Resend Receipt', 'give') |
|
| 259 | 259 | ); |
| 260 | 260 | } |
| 261 | 261 | ?> |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @param int $payment_id Payment id. |
| 272 | 272 | */ |
| 273 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
| 273 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
| 274 | 274 | ?> |
| 275 | 275 | |
| 276 | 276 | </div> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | <div id="give-order-details" class="postbox give-order-data"> |
| 283 | 283 | |
| 284 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
| 284 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
| 285 | 285 | |
| 286 | 286 | <div class="inside"> |
| 287 | 287 | <div class="give-admin-box"> |
@@ -294,30 +294,30 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @param int $payment_id Payment id. |
| 296 | 296 | */ |
| 297 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
| 297 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
| 298 | 298 | |
| 299 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 300 | - if ( $gateway ) : |
|
| 299 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 300 | + if ($gateway) : |
|
| 301 | 301 | ?> |
| 302 | 302 | <div class="give-order-gateway give-admin-box-inside"> |
| 303 | 303 | <p> |
| 304 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
| 305 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 304 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
| 305 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 306 | 306 | </p> |
| 307 | 307 | </div> |
| 308 | 308 | <?php endif; ?> |
| 309 | 309 | |
| 310 | 310 | <div class="give-order-payment-key give-admin-box-inside"> |
| 311 | 311 | <p> |
| 312 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
| 313 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 312 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
| 313 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 314 | 314 | </p> |
| 315 | 315 | </div> |
| 316 | 316 | |
| 317 | 317 | <div class="give-order-ip give-admin-box-inside"> |
| 318 | 318 | <p> |
| 319 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
| 320 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 319 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
| 320 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 321 | 321 | </p> |
| 322 | 322 | </div> |
| 323 | 323 | |
@@ -325,18 +325,18 @@ discard block |
||
| 325 | 325 | // Display the transaction ID present. |
| 326 | 326 | // The transaction ID is the charge ID from the gateway. |
| 327 | 327 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
| 328 | - if ( $transaction_id != $payment_id ) : ?> |
|
| 328 | + if ($transaction_id != $payment_id) : ?> |
|
| 329 | 329 | <div class="give-order-tx-id give-admin-box-inside"> |
| 330 | 330 | <p> |
| 331 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
| 332 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 331 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
| 332 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 333 | 333 | </p> |
| 334 | 334 | </div> |
| 335 | 335 | <?php endif; ?> |
| 336 | 336 | |
| 337 | 337 | <div class="give-admin-box-inside"> |
| 338 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
| 339 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 338 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
| 339 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
| 340 | 340 | </p> |
| 341 | 341 | </div> |
| 342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | * |
| 349 | 349 | * @param int $payment_id Payment id. |
| 350 | 350 | */ |
| 351 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
| 351 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
| 352 | 352 | ?> |
| 353 | 353 | |
| 354 | 354 | </div> |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * |
| 369 | 369 | * @param int $payment_id Payment id. |
| 370 | 370 | */ |
| 371 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
| 371 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
| 372 | 372 | ?> |
| 373 | 373 | |
| 374 | 374 | </div> |
@@ -388,31 +388,31 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @param int $payment_id Payment id. |
| 390 | 390 | */ |
| 391 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
| 391 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
| 392 | 392 | ?> |
| 393 | 393 | |
| 394 | 394 | <?php $column_count = 'columns-3'; ?> |
| 395 | 395 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 396 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
| 396 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
| 397 | 397 | |
| 398 | 398 | <div class="inside"> |
| 399 | 399 | |
| 400 | 400 | <div class="column-container"> |
| 401 | 401 | <div class="column"> |
| 402 | 402 | <p> |
| 403 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 403 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 404 | 404 | <?php |
| 405 | - if ( $payment_meta['form_id'] ) : |
|
| 405 | + if ($payment_meta['form_id']) : |
|
| 406 | 406 | printf( |
| 407 | 407 | '<a href="%1$s">%2$s</a>', |
| 408 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 408 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 409 | 409 | $payment_meta['form_id'] |
| 410 | 410 | ); |
| 411 | 411 | endif; |
| 412 | 412 | ?> |
| 413 | 413 | </p> |
| 414 | 414 | <p> |
| 415 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 415 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 416 | 416 | <?php |
| 417 | 417 | echo Give()->html->forms_dropdown( |
| 418 | 418 | array( |
@@ -428,21 +428,21 @@ discard block |
||
| 428 | 428 | </div> |
| 429 | 429 | <div class="column"> |
| 430 | 430 | <p> |
| 431 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 432 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 431 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
| 432 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 433 | 433 | </p> |
| 434 | 434 | <p> |
| 435 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 435 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
| 436 | 436 | <span class="give-donation-level"> |
| 437 | 437 | <?php |
| 438 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 439 | - if ( empty( $var_prices ) ) { |
|
| 440 | - _e( 'n/a', 'give' ); |
|
| 438 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 439 | + if (empty($var_prices)) { |
|
| 440 | + _e('n/a', 'give'); |
|
| 441 | 441 | } else { |
| 442 | 442 | $prices_atts = array(); |
| 443 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 444 | - foreach ( $variable_prices as $variable_price ) { |
|
| 445 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
| 443 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 444 | + foreach ($variable_prices as $variable_price) { |
|
| 445 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | // Variable price dropdown options. |
@@ -451,12 +451,12 @@ discard block |
||
| 451 | 451 | 'name' => 'give-variable-price', |
| 452 | 452 | 'chosen' => true, |
| 453 | 453 | 'show_option_all' => '', |
| 454 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
| 455 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
| 454 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
| 455 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
| 456 | 456 | 'selected' => $payment_meta['price_id'], |
| 457 | 457 | ); |
| 458 | 458 | // Render variable prices select tag html. |
| 459 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 459 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 460 | 460 | } |
| 461 | 461 | ?> |
| 462 | 462 | </span> |
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | </div> |
| 465 | 465 | <div class="column"> |
| 466 | 466 | <p> |
| 467 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 468 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
| 467 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 468 | + <?php echo give_donation_amount($payment, true); ?> |
|
| 469 | 469 | </p> |
| 470 | 470 | |
| 471 | - <?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ): ?> |
|
| 471 | + <?php if (give_is_anonymous_donation_field_enabled($payment->form_id)): ?> |
|
| 472 | 472 | <div> |
| 473 | - <strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong> |
|
| 473 | + <strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong> |
|
| 474 | 474 | <ul class="give-radio-inline"> |
| 475 | 475 | <li> |
| 476 | 476 | <label> |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | name="give_anonymous_donation" |
| 479 | 479 | value="1" |
| 480 | 480 | type="radio" |
| 481 | - <?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
| 482 | - ><?php _e( 'Yes', 'give' ); ?> |
|
| 481 | + <?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
| 482 | + ><?php _e('Yes', 'give'); ?> |
|
| 483 | 483 | </label> |
| 484 | 484 | </li> |
| 485 | 485 | <li> |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | name="give_anonymous_donation" |
| 489 | 489 | value="0" |
| 490 | 490 | type="radio" |
| 491 | - <?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
| 492 | - ><?php _e( 'No', 'give' ); ?> |
|
| 491 | + <?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
| 492 | + ><?php _e('No', 'give'); ?> |
|
| 493 | 493 | </label> |
| 494 | 494 | </li> |
| 495 | 495 | </ul> |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * |
| 507 | 507 | * @param int $payment_id Payment id. |
| 508 | 508 | */ |
| 509 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 509 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 510 | 510 | |
| 511 | 511 | |
| 512 | 512 | /** |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | * |
| 519 | 519 | * @param int $payment_id Payment id. |
| 520 | 520 | */ |
| 521 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 521 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 522 | 522 | |
| 523 | 523 | /** |
| 524 | 524 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | * |
| 530 | 530 | * @param int $payment_id Payment id. |
| 531 | 531 | */ |
| 532 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 532 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 533 | 533 | |
| 534 | 534 | /** |
| 535 | 535 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * |
| 541 | 541 | * @param int $payment_id Payment id. |
| 542 | 542 | */ |
| 543 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 543 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 544 | 544 | ?> |
| 545 | 545 | </p> |
| 546 | 546 | </div> |
@@ -560,67 +560,67 @@ discard block |
||
| 560 | 560 | * |
| 561 | 561 | * @param int $payment_id Payment id. |
| 562 | 562 | */ |
| 563 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
| 563 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
| 564 | 564 | ?> |
| 565 | 565 | |
| 566 | 566 | <div id="give-donor-details" class="postbox"> |
| 567 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
| 567 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
| 568 | 568 | |
| 569 | 569 | <div class="inside"> |
| 570 | 570 | |
| 571 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
| 571 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
| 572 | 572 | |
| 573 | 573 | <div class="column-container donor-info"> |
| 574 | 574 | <div class="column"> |
| 575 | 575 | <p> |
| 576 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 576 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 577 | 577 | <?php |
| 578 | - if ( ! empty( $donor->id ) ) { |
|
| 578 | + if ( ! empty($donor->id)) { |
|
| 579 | 579 | printf( |
| 580 | 580 | '<a href="%1$s">%2$s</a>', |
| 581 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ), |
|
| 582 | - intval( $donor->id ) |
|
| 581 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)), |
|
| 582 | + intval($donor->id) |
|
| 583 | 583 | ); |
| 584 | 584 | } |
| 585 | 585 | ?> |
| 586 | - <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
| 586 | + <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span> |
|
| 587 | 587 | </p> |
| 588 | 588 | <p> |
| 589 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 590 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 589 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 590 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 591 | 591 | </p> |
| 592 | 592 | </div> |
| 593 | 593 | <div class="column"> |
| 594 | 594 | <p> |
| 595 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 595 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 596 | 596 | <?php |
| 597 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 598 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 597 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
| 598 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 599 | 599 | |
| 600 | 600 | // Check whether the donor name and WP_User name is same or not. |
| 601 | - if ( $donor_billing_name !== $donor_name ) { |
|
| 601 | + if ($donor_billing_name !== $donor_name) { |
|
| 602 | 602 | echo sprintf( |
| 603 | 603 | '%1$s (<a href="%2$s">%3$s</a>)', |
| 604 | - esc_html( $donor_billing_name ), |
|
| 604 | + esc_html($donor_billing_name), |
|
| 605 | 605 | sprintf( |
| 606 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=%s' ) ), |
|
| 607 | - intval( $donor_id ) |
|
| 606 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=%s')), |
|
| 607 | + intval($donor_id) |
|
| 608 | 608 | ), |
| 609 | - esc_html( $donor_name ) |
|
| 609 | + esc_html($donor_name) |
|
| 610 | 610 | ); |
| 611 | 611 | } else { |
| 612 | - echo esc_html( $donor_name ); |
|
| 612 | + echo esc_html($donor_name); |
|
| 613 | 613 | } |
| 614 | 614 | ?> |
| 615 | 615 | </p> |
| 616 | 616 | <p> |
| 617 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 618 | - <?php echo esc_attr( $donor->email ); ?> |
|
| 617 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 618 | + <?php echo esc_attr($donor->email); ?> |
|
| 619 | 619 | </p> |
| 620 | 620 | </div> |
| 621 | 621 | <div class="column"> |
| 622 | 622 | <p> |
| 623 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 623 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 624 | 624 | <?php |
| 625 | 625 | echo Give()->html->donor_dropdown( |
| 626 | 626 | array( |
@@ -631,9 +631,9 @@ discard block |
||
| 631 | 631 | ?> |
| 632 | 632 | </p> |
| 633 | 633 | <p> |
| 634 | - <?php if ( ! empty( $company_name ) ) { |
|
| 634 | + <?php if ( ! empty($company_name)) { |
|
| 635 | 635 | ?> |
| 636 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
| 636 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
| 637 | 637 | <?php |
| 638 | 638 | echo $company_name; |
| 639 | 639 | } ?> |
@@ -644,19 +644,19 @@ discard block |
||
| 644 | 644 | <div class="column-container new-donor" style="display: none"> |
| 645 | 645 | <div class="column"> |
| 646 | 646 | <p> |
| 647 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
| 647 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
| 648 | 648 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
| 649 | 649 | </p> |
| 650 | 650 | </div> |
| 651 | 651 | <div class="column"> |
| 652 | 652 | <p> |
| 653 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
| 653 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
| 654 | 654 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
| 655 | 655 | </p> |
| 656 | 656 | </div> |
| 657 | 657 | <div class="column"> |
| 658 | 658 | <p> |
| 659 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
| 659 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
| 660 | 660 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
| 661 | 661 | </p> |
| 662 | 662 | </div> |
@@ -664,9 +664,9 @@ discard block |
||
| 664 | 664 | <p> |
| 665 | 665 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
| 666 | 666 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
| 667 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 667 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 668 | 668 | <br> |
| 669 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 669 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 670 | 670 | </p> |
| 671 | 671 | </div> |
| 672 | 672 | </div> |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * @param array $payment_meta Payment meta. |
| 682 | 682 | * @param array $user_info User information. |
| 683 | 683 | */ |
| 684 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 684 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 685 | 685 | |
| 686 | 686 | /** |
| 687 | 687 | * Fires on the donation details page, in the donor-details metabox. |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | * |
| 691 | 691 | * @param int $payment_id Payment id. |
| 692 | 692 | */ |
| 693 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 693 | + do_action('give_payment_view_details', $payment_id); |
|
| 694 | 694 | ?> |
| 695 | 695 | |
| 696 | 696 | </div> |
@@ -706,11 +706,11 @@ discard block |
||
| 706 | 706 | * |
| 707 | 707 | * @param int $payment_id Payment id. |
| 708 | 708 | */ |
| 709 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
| 709 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
| 710 | 710 | ?> |
| 711 | 711 | |
| 712 | 712 | <div id="give-billing-details" class="postbox"> |
| 713 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
| 713 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
| 714 | 714 | |
| 715 | 715 | <div class="inside"> |
| 716 | 716 | |
@@ -720,9 +720,9 @@ discard block |
||
| 720 | 720 | <div class="data column-container"> |
| 721 | 721 | |
| 722 | 722 | <?php |
| 723 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
| 723 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
| 724 | 724 | |
| 725 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
| 725 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
| 726 | 726 | |
| 727 | 727 | // Get the country list that does not have any states init. |
| 728 | 728 | $no_states_country = give_no_states_country_list(); |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | <div class="row"> |
| 732 | 732 | <div id="give-order-address-country-wrap"> |
| 733 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
| 733 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
| 734 | 734 | <?php |
| 735 | 735 | echo Give()->html->select( |
| 736 | 736 | array( |
@@ -740,8 +740,8 @@ discard block |
||
| 740 | 740 | 'show_option_all' => false, |
| 741 | 741 | 'show_option_none' => false, |
| 742 | 742 | 'chosen' => true, |
| 743 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 744 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 743 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 744 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 745 | 745 | ) |
| 746 | 746 | ); |
| 747 | 747 | ?> |
@@ -750,35 +750,35 @@ discard block |
||
| 750 | 750 | |
| 751 | 751 | <div class="row"> |
| 752 | 752 | <div class="give-wrap-address-line1"> |
| 753 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
| 754 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 753 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
| 754 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 755 | 755 | </div> |
| 756 | 756 | </div> |
| 757 | 757 | |
| 758 | 758 | <div class="row"> |
| 759 | 759 | <div class="give-wrap-address-line2"> |
| 760 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
| 761 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 760 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
| 761 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 762 | 762 | </div> |
| 763 | 763 | </div> |
| 764 | 764 | |
| 765 | 765 | <div class="row"> |
| 766 | 766 | <div class="give-wrap-address-city"> |
| 767 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 768 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 767 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 768 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 769 | 769 | </div> |
| 770 | 770 | </div> |
| 771 | 771 | |
| 772 | 772 | <?php |
| 773 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
| 773 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
| 774 | 774 | ?> |
| 775 | 775 | <div class="row"> |
| 776 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
| 777 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
| 778 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
| 776 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
| 777 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
| 778 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
| 779 | 779 | <?php |
| 780 | - $states = give_get_states( $address['country'] ); |
|
| 781 | - if ( ! empty( $states ) ) { |
|
| 780 | + $states = give_get_states($address['country']); |
|
| 781 | + if ( ! empty($states)) { |
|
| 782 | 782 | echo Give()->html->select( |
| 783 | 783 | array( |
| 784 | 784 | 'options' => $states, |
@@ -787,23 +787,23 @@ discard block |
||
| 787 | 787 | 'show_option_all' => false, |
| 788 | 788 | 'show_option_none' => false, |
| 789 | 789 | 'chosen' => true, |
| 790 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 791 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 790 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 791 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 792 | 792 | ) |
| 793 | 793 | ); |
| 794 | 794 | } else { |
| 795 | 795 | ?> |
| 796 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 796 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 797 | 797 | <?php |
| 798 | 798 | } |
| 799 | 799 | ?> |
| 800 | 800 | </div> |
| 801 | 801 | </div> |
| 802 | 802 | |
| 803 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
| 803 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
| 804 | 804 | <div class="give-wrap-address-zip"> |
| 805 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 806 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 805 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
| 806 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 807 | 807 | </div> |
| 808 | 808 | </div> |
| 809 | 809 | </div> |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | * |
| 823 | 823 | * @param int $payment_id Payment id. |
| 824 | 824 | */ |
| 825 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 825 | + do_action('give_payment_billing_details', $payment_id); |
|
| 826 | 826 | ?> |
| 827 | 827 | |
| 828 | 828 | </div> |
@@ -838,34 +838,34 @@ discard block |
||
| 838 | 838 | * |
| 839 | 839 | * @param int $payment_id Payment id. |
| 840 | 840 | */ |
| 841 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
| 841 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
| 842 | 842 | ?> |
| 843 | 843 | |
| 844 | 844 | <div id="give-payment-notes" class="postbox"> |
| 845 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
| 845 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
| 846 | 846 | |
| 847 | 847 | <div class="inside"> |
| 848 | 848 | <div id="give-payment-notes-inner"> |
| 849 | 849 | <?php |
| 850 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 851 | - if ( ! empty( $notes ) ) { |
|
| 850 | + $notes = give_get_payment_notes($payment_id); |
|
| 851 | + if ( ! empty($notes)) { |
|
| 852 | 852 | $no_notes_display = ' style="display:none;"'; |
| 853 | - foreach ( $notes as $note ) : |
|
| 853 | + foreach ($notes as $note) : |
|
| 854 | 854 | |
| 855 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 855 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 856 | 856 | |
| 857 | 857 | endforeach; |
| 858 | 858 | } else { |
| 859 | 859 | $no_notes_display = ''; |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
| 862 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
| 863 | 863 | ?> |
| 864 | 864 | </div> |
| 865 | 865 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 866 | 866 | |
| 867 | 867 | <div class="give-clearfix"> |
| 868 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
| 868 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
| 869 | 869 | </div> |
| 870 | 870 | |
| 871 | 871 | </div> |
@@ -881,18 +881,18 @@ discard block |
||
| 881 | 881 | * |
| 882 | 882 | * @param int $payment_id Payment id. |
| 883 | 883 | */ |
| 884 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
| 884 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
| 885 | 885 | ?> |
| 886 | 886 | |
| 887 | - <?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?> |
|
| 887 | + <?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?> |
|
| 888 | 888 | <div id="give-payment-donor-comment" class="postbox"> |
| 889 | - <h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3> |
|
| 889 | + <h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3> |
|
| 890 | 890 | |
| 891 | 891 | <div class="inside"> |
| 892 | 892 | <div id="give-payment-donor-comment-inner"> |
| 893 | 893 | <p> |
| 894 | 894 | <?php |
| 895 | - $donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id ); |
|
| 895 | + $donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id); |
|
| 896 | 896 | |
| 897 | 897 | echo sprintf( |
| 898 | 898 | '<input type="hidden" name="give_comment_id" value="%s">', |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | |
| 902 | 902 | echo sprintf( |
| 903 | 903 | '<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>', |
| 904 | - __( 'Add a comment', 'give' ), |
|
| 904 | + __('Add a comment', 'give'), |
|
| 905 | 905 | $donor_comment instanceof WP_Comment ? $donor_comment->comment_content : '' |
| 906 | 906 | ); |
| 907 | 907 | ?> |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | * |
| 923 | 923 | * @param int $payment_id Payment id. |
| 924 | 924 | */ |
| 925 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
| 925 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
| 926 | 926 | ?> |
| 927 | 927 | |
| 928 | 928 | </div> |
@@ -944,11 +944,11 @@ discard block |
||
| 944 | 944 | * |
| 945 | 945 | * @param int $payment_id Payment id. |
| 946 | 946 | */ |
| 947 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
| 947 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
| 948 | 948 | |
| 949 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 949 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 950 | 950 | ?> |
| 951 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 951 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 952 | 952 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 953 | 953 | </form> |
| 954 | 954 | <?php |
@@ -959,6 +959,6 @@ discard block |
||
| 959 | 959 | * |
| 960 | 960 | * @param int $payment_id Payment id. |
| 961 | 961 | */ |
| 962 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
| 962 | + do_action('give_view_donation_details_after', $payment_id); |
|
| 963 | 963 | ?> |
| 964 | 964 | </div><!-- /.wrap --> |
@@ -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,48 +25,48 @@ 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( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
| 31 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('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 | $status = $data['give-payment-status']; |
| 43 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
| 44 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
| 43 | + $date = sanitize_text_field($data['give-payment-date']); |
|
| 44 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
| 45 | 45 | |
| 46 | 46 | // Restrict to our high and low. |
| 47 | - if ( $hour > 23 ) { |
|
| 47 | + if ($hour > 23) { |
|
| 48 | 48 | $hour = 23; |
| 49 | - } elseif ( $hour < 0 ) { |
|
| 49 | + } elseif ($hour < 0) { |
|
| 50 | 50 | $hour = 00; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
| 53 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
| 54 | 54 | |
| 55 | 55 | // Restrict to our high and low. |
| 56 | - if ( $minute > 59 ) { |
|
| 56 | + if ($minute > 59) { |
|
| 57 | 57 | $minute = 59; |
| 58 | - } elseif ( $minute < 0 ) { |
|
| 58 | + } elseif ($minute < 0) { |
|
| 59 | 59 | $minute = 00; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $address = give_clean( $data['give-payment-address'][0] ); |
|
| 62 | + $address = give_clean($data['give-payment-address'][0]); |
|
| 63 | 63 | |
| 64 | 64 | $curr_total = $payment->total; |
| 65 | - $new_total = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) ); |
|
| 66 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
| 65 | + $new_total = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0)); |
|
| 66 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
| 67 | 67 | |
| 68 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
| 69 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
| 68 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
| 69 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Fires before updating edited donation. |
@@ -76,74 +76,74 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @param int $payment_id The ID of the payment. |
| 78 | 78 | */ |
| 79 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
| 79 | + do_action('give_update_edited_donation', $payment_id); |
|
| 80 | 80 | |
| 81 | 81 | $payment->date = $date; |
| 82 | - $payment->anonymous = isset( $data['give_anonymous_donation'] ) ? absint( $data['give_anonymous_donation'] ) : 0; |
|
| 82 | + $payment->anonymous = isset($data['give_anonymous_donation']) ? absint($data['give_anonymous_donation']) : 0; |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | - $updated = $payment->save(); |
|
| 85 | + $updated = $payment->save(); |
|
| 86 | 86 | |
| 87 | - if ( 0 === $updated ) { |
|
| 88 | - wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 87 | + if (0 === $updated) { |
|
| 88 | + wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $donor_changed = false; |
| 92 | 92 | |
| 93 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
| 93 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
| 94 | 94 | |
| 95 | - $email = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
| 96 | - $first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : ''; |
|
| 97 | - $last_name = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : ''; |
|
| 98 | - $names = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
| 95 | + $email = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
| 96 | + $first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : ''; |
|
| 97 | + $last_name = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : ''; |
|
| 98 | + $names = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
| 99 | 99 | |
| 100 | - if ( empty( $email ) || empty( $first_name ) ) { |
|
| 101 | - wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 100 | + if (empty($email) || empty($first_name)) { |
|
| 101 | + wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $donor = new Give_Donor( $email ); |
|
| 105 | - if ( empty( $donor->id ) ) { |
|
| 106 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
| 107 | - $user_id = email_exists( $email ); |
|
| 108 | - if ( false !== $user_id ) { |
|
| 104 | + $donor = new Give_Donor($email); |
|
| 105 | + if (empty($donor->id)) { |
|
| 106 | + $donor_data = array('name' => $names, 'email' => $email); |
|
| 107 | + $user_id = email_exists($email); |
|
| 108 | + if (false !== $user_id) { |
|
| 109 | 109 | $donor_data['user_id'] = $user_id; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if ( ! $donor->create( $donor_data ) ) { |
|
| 112 | + if ( ! $donor->create($donor_data)) { |
|
| 113 | 113 | // Failed to create the new donor, assume the previous donor. |
| 114 | 114 | $donor_changed = false; |
| 115 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 116 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
| 115 | + $donor = new Give_Donor($curr_donor_id); |
|
| 116 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Create and Update Donor First Name and Last Name in Meta Fields. |
| 121 | - $donor->update_meta( '_give_donor_first_name', $first_name ); |
|
| 122 | - $donor->update_meta( '_give_donor_last_name', $last_name ); |
|
| 121 | + $donor->update_meta('_give_donor_first_name', $first_name); |
|
| 122 | + $donor->update_meta('_give_donor_last_name', $last_name); |
|
| 123 | 123 | |
| 124 | 124 | $new_donor_id = $donor->id; |
| 125 | 125 | |
| 126 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 126 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 127 | 127 | |
| 128 | 128 | $donor_changed = true; |
| 129 | 129 | |
| 130 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
| 130 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
| 131 | 131 | |
| 132 | - $donor = new Give_Donor( $new_donor_id ); |
|
| 132 | + $donor = new Give_Donor($new_donor_id); |
|
| 133 | 133 | $email = $donor->email; |
| 134 | 134 | $names = $donor->name; |
| 135 | 135 | |
| 136 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 136 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 137 | 137 | |
| 138 | 138 | $donor_changed = true; |
| 139 | 139 | |
| 140 | 140 | } else { |
| 141 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 141 | + $donor = new Give_Donor($curr_donor_id); |
|
| 142 | 142 | $email = $donor->email; |
| 143 | 143 | $names = $donor->name; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if ( $donor_changed ) { |
|
| 146 | + if ($donor_changed) { |
|
| 147 | 147 | |
| 148 | 148 | // Setup first and last name from input values. |
| 149 | 149 | $first_name = $donor->get_first_name(); |
@@ -153,26 +153,26 @@ discard block |
||
| 153 | 153 | $payment->last_name = $last_name; |
| 154 | 154 | |
| 155 | 155 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
| 156 | - $previous_donor->remove_payment( $payment_id, false ); |
|
| 157 | - $donor->attach_payment( $payment_id, false ); |
|
| 156 | + $previous_donor->remove_payment($payment_id, false); |
|
| 157 | + $donor->attach_payment($payment_id, false); |
|
| 158 | 158 | |
| 159 | - if ( 'publish' == $status ) { |
|
| 159 | + if ('publish' == $status) { |
|
| 160 | 160 | |
| 161 | 161 | // Reduce previous user donation count and amount. |
| 162 | 162 | $previous_donor->decrease_donation_count(); |
| 163 | - $previous_donor->decrease_value( $curr_total ); |
|
| 163 | + $previous_donor->decrease_value($curr_total); |
|
| 164 | 164 | |
| 165 | 165 | // If donation was completed adjust stats of new donors. |
| 166 | 166 | $donor->increase_purchase_count(); |
| 167 | - $donor->increase_value( $new_total ); |
|
| 167 | + $donor->increase_value($new_total); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $payment->customer_id = $donor->id; |
| 171 | 171 | } else { |
| 172 | 172 | |
| 173 | - if ( 'publish' === $status ) { |
|
| 173 | + if ('publish' === $status) { |
|
| 174 | 174 | // Update user donation stat. |
| 175 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
| 175 | + $donor->update_donation_value($curr_total, $new_total); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | $payment->total = $new_total; |
| 184 | 184 | |
| 185 | 185 | // Check for payment notes. |
| 186 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
| 186 | + if ( ! empty($data['give-payment-note'])) { |
|
| 187 | 187 | |
| 188 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
| 189 | - give_insert_payment_note( $payment_id, $note ); |
|
| 188 | + $note = wp_kses($data['give-payment-note'], array()); |
|
| 189 | + give_insert_payment_note($payment_id, $note); |
|
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | |
@@ -194,77 +194,77 @@ discard block |
||
| 194 | 194 | $payment->status = $status; |
| 195 | 195 | |
| 196 | 196 | // Adjust total store earnings if the payment total has been changed. |
| 197 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
| 197 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
| 198 | 198 | |
| 199 | - if ( $new_total > $curr_total ) { |
|
| 199 | + if ($new_total > $curr_total) { |
|
| 200 | 200 | // Increase if our new total is higher. |
| 201 | 201 | $difference = $new_total - $curr_total; |
| 202 | - give_increase_total_earnings( $difference ); |
|
| 202 | + give_increase_total_earnings($difference); |
|
| 203 | 203 | |
| 204 | 204 | // Increase form earnings. |
| 205 | - give_increase_earnings( $payment->form_id, $difference, $payment->ID ); |
|
| 206 | - } elseif ( $curr_total > $new_total ) { |
|
| 205 | + give_increase_earnings($payment->form_id, $difference, $payment->ID); |
|
| 206 | + } elseif ($curr_total > $new_total) { |
|
| 207 | 207 | // Decrease if our new total is lower. |
| 208 | 208 | $difference = $curr_total - $new_total; |
| 209 | - give_decrease_total_earnings( $difference ); |
|
| 209 | + give_decrease_total_earnings($difference); |
|
| 210 | 210 | |
| 211 | 211 | // Decrease form earnings. |
| 212 | - give_decrease_form_earnings( $payment->form_id, $difference, $payment->ID ); |
|
| 212 | + give_decrease_form_earnings($payment->form_id, $difference, $payment->ID); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $payment->save(); |
| 217 | 217 | |
| 218 | 218 | // Get new give form ID. |
| 219 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
| 220 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
| 219 | + $new_form_id = absint($data['give-payment-form-select']); |
|
| 220 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
| 221 | 221 | |
| 222 | 222 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
| 223 | 223 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
| 224 | 224 | // Check if user want to transfer current payment to new give form id. |
| 225 | - if ( $new_form_id && $new_form_id != $current_form_id ) { |
|
| 225 | + if ($new_form_id && $new_form_id != $current_form_id) { |
|
| 226 | 226 | |
| 227 | 227 | // Get new give form title. |
| 228 | - $new_form_title = get_the_title( $new_form_id ); |
|
| 228 | + $new_form_title = get_the_title($new_form_id); |
|
| 229 | 229 | |
| 230 | 230 | // Update payment give form meta data. |
| 231 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
| 232 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
| 231 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
| 232 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
| 233 | 233 | |
| 234 | 234 | // Update price id payment metadata. |
| 235 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 236 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
| 235 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 236 | + $payment->update_meta('_give_payment_price_id', ''); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | // If donation was completed, adjust stats of forms. |
| 240 | - if ( 'publish' == $status ) { |
|
| 240 | + if ('publish' == $status) { |
|
| 241 | 241 | |
| 242 | 242 | // Decrease sale of old give form. For other payment status. |
| 243 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
| 243 | + $current_form = new Give_Donate_Form($current_form_id); |
|
| 244 | 244 | $current_form->decrease_sales(); |
| 245 | - $current_form->decrease_earnings( $curr_total, $payment->ID ); |
|
| 245 | + $current_form->decrease_earnings($curr_total, $payment->ID); |
|
| 246 | 246 | |
| 247 | 247 | // Increase sale of new give form. |
| 248 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
| 248 | + $new_form = new Give_Donate_Form($new_form_id); |
|
| 249 | 249 | $new_form->increase_sales(); |
| 250 | - $new_form->increase_earnings( $new_total, $payment->ID ); |
|
| 250 | + $new_form->increase_earnings($new_total, $payment->ID); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // Re setup payment to update new meta value in object. |
| 254 | - $payment->update_payment_setup( $payment->ID ); |
|
| 254 | + $payment->update_payment_setup($payment->ID); |
|
| 255 | 255 | |
| 256 | 256 | // Update form id in payment logs. |
| 257 | - Give()->async_process->data( array( |
|
| 258 | - 'data' => array( $new_form_id, $payment_id ), |
|
| 257 | + Give()->async_process->data(array( |
|
| 258 | + 'data' => array($new_form_id, $payment_id), |
|
| 259 | 259 | 'hook' => 'give_update_log_form_id', |
| 260 | - ) )->dispatch(); |
|
| 260 | + ))->dispatch(); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Update price id if current form is variable form. |
| 264 | 264 | /* @var Give_Donate_Form $form */ |
| 265 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
| 265 | + $form = new Give_Donate_Form($payment->form_id); |
|
| 266 | 266 | |
| 267 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
| 267 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
| 268 | 268 | |
| 269 | 269 | // Get payment meta data. |
| 270 | 270 | $payment_meta = $payment->get_meta(); |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | $price_id = ''; |
| 274 | 274 | |
| 275 | 275 | // Get price info |
| 276 | - if( 0 <= $data['give-variable-price'] ) { |
|
| 277 | - foreach ( $form->prices as $variable_price ) { |
|
| 278 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
| 276 | + if (0 <= $data['give-variable-price']) { |
|
| 277 | + foreach ($form->prices as $variable_price) { |
|
| 278 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
| 279 | 279 | $price_info = $variable_price; |
| 280 | 280 | break; |
| 281 | 281 | } |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // Set price id. |
| 286 | - if( ! empty( $price_info ) ) { |
|
| 286 | + if ( ! empty($price_info)) { |
|
| 287 | 287 | $price_id = $data['give-variable-price']; |
| 288 | 288 | |
| 289 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
| 289 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
| 290 | 290 | // Set price id to amount match. |
| 291 | 291 | $price_id = $price_info['_give_id']['level_id']; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - } elseif( $form->is_custom_price_mode() ){ |
|
| 294 | + } elseif ($form->is_custom_price_mode()) { |
|
| 295 | 295 | $price_id = 'custom'; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -299,34 +299,34 @@ discard block |
||
| 299 | 299 | $payment_meta['price_id'] = $price_id; |
| 300 | 300 | |
| 301 | 301 | // Update payment give form meta data. |
| 302 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
| 303 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 302 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
| 303 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 304 | 304 | |
| 305 | 305 | // Re setup payment to update new meta value in object. |
| 306 | - $payment->update_payment_setup( $payment->ID ); |
|
| 306 | + $payment->update_payment_setup($payment->ID); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - $comment_id = isset( $data['give_comment_id'] ) ? absint( $data['give_comment_id'] ) : 0; |
|
| 310 | - $is_anonymous_donation = give_is_anonymous_donation_field_enabled( $payment->form_id ); |
|
| 309 | + $comment_id = isset($data['give_comment_id']) ? absint($data['give_comment_id']) : 0; |
|
| 310 | + $is_anonymous_donation = give_is_anonymous_donation_field_enabled($payment->form_id); |
|
| 311 | 311 | |
| 312 | - if ( $is_anonymous_donation ) { |
|
| 313 | - give_update_meta( $payment->ID, '_give_anonymous_donation', $payment->anonymous ); |
|
| 314 | - Give()->donor_meta->update_meta( $payment->donor_id, '_give_anonymous_donor', $payment->anonymous ); |
|
| 312 | + if ($is_anonymous_donation) { |
|
| 313 | + give_update_meta($payment->ID, '_give_anonymous_donation', $payment->anonymous); |
|
| 314 | + Give()->donor_meta->update_meta($payment->donor_id, '_give_anonymous_donor', $payment->anonymous); |
|
| 315 | 315 | |
| 316 | 316 | // Update comment meta if admin is not updating comment. |
| 317 | - if( $comment_id ) { |
|
| 318 | - update_comment_meta( $comment_id, '_give_anonymous_donation', $payment->anonymous ); |
|
| 317 | + if ($comment_id) { |
|
| 318 | + update_comment_meta($comment_id, '_give_anonymous_donation', $payment->anonymous); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | // Update comment. |
| 323 | - if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) { |
|
| 323 | + if (give_is_donor_comment_field_enabled($payment->form_id)) { |
|
| 324 | 324 | // We are access comment directly from $_POST because comment formatting remove because of give_clean in give_post_actions. |
| 325 | - $data['give_comment'] = trim( $_POST['give_comment'] ); |
|
| 325 | + $data['give_comment'] = trim($_POST['give_comment']); |
|
| 326 | 326 | |
| 327 | - if ( empty( $data['give_comment'] ) ) { |
|
| 327 | + if (empty($data['give_comment'])) { |
|
| 328 | 328 | // Delete comment if empty |
| 329 | - Give_Comment::delete( $comment_id, $payment_id, 'payment' ); |
|
| 329 | + Give_Comment::delete($comment_id, $payment_id, 'payment'); |
|
| 330 | 330 | |
| 331 | 331 | } else { |
| 332 | 332 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | 'comment_author_email' => $payment->email |
| 338 | 338 | ); |
| 339 | 339 | |
| 340 | - if ( $comment_id ) { |
|
| 340 | + if ($comment_id) { |
|
| 341 | 341 | $comment_args['comment_ID'] = $comment_id; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -348,16 +348,16 @@ discard block |
||
| 348 | 348 | $comment_args |
| 349 | 349 | ); |
| 350 | 350 | |
| 351 | - if ( $is_update_comment_meta ) { |
|
| 352 | - update_comment_meta( $comment_id, '_give_anonymous_donation', $is_anonymous_donation ); |
|
| 351 | + if ($is_update_comment_meta) { |
|
| 352 | + update_comment_meta($comment_id, '_give_anonymous_donation', $is_anonymous_donation); |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - $donor_has_comment = empty( $data['give_comment'] ) |
|
| 357 | - ? ( $latest_comment = give_get_donor_latest_comment( $payment->donor_id ) && empty( $latest_comment ) ? '0' : '1' ) |
|
| 356 | + $donor_has_comment = empty($data['give_comment']) |
|
| 357 | + ? ($latest_comment = give_get_donor_latest_comment($payment->donor_id) && empty($latest_comment) ? '0' : '1') |
|
| 358 | 358 | : '1'; |
| 359 | 359 | |
| 360 | - Give()->donor_meta->update_meta( $payment->donor_id, '_give_has_comment', $donor_has_comment ); |
|
| 360 | + Give()->donor_meta->update_meta($payment->donor_id, '_give_has_comment', $donor_has_comment); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -368,13 +368,13 @@ discard block |
||
| 368 | 368 | * |
| 369 | 369 | * @param int $payment_id The ID of the payment. |
| 370 | 370 | */ |
| 371 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
| 371 | + do_action('give_updated_edited_donation', $payment_id); |
|
| 372 | 372 | |
| 373 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id=' . $payment_id ) ); |
|
| 373 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id='.$payment_id)); |
|
| 374 | 374 | exit; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
| 377 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Trigger a Donation Deletion. |
@@ -385,48 +385,48 @@ discard block |
||
| 385 | 385 | * |
| 386 | 386 | * @return void |
| 387 | 387 | */ |
| 388 | -function give_trigger_donation_delete( $data ) { |
|
| 389 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
| 388 | +function give_trigger_donation_delete($data) { |
|
| 389 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
| 390 | 390 | |
| 391 | - $payment_id = absint( $data['purchase_id'] ); |
|
| 391 | + $payment_id = absint($data['purchase_id']); |
|
| 392 | 392 | |
| 393 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 394 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 393 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 394 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - give_delete_donation( $payment_id ); |
|
| 398 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted' ) ); |
|
| 397 | + give_delete_donation($payment_id); |
|
| 398 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted')); |
|
| 399 | 399 | give_die(); |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
| 403 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
| 404 | 404 | |
| 405 | 405 | /** |
| 406 | 406 | * AJAX Store Donation Note |
| 407 | 407 | */ |
| 408 | 408 | function give_ajax_store_payment_note() { |
| 409 | 409 | |
| 410 | - $payment_id = absint( $_POST['payment_id'] ); |
|
| 411 | - $note = wp_kses( $_POST['note'], array() ); |
|
| 410 | + $payment_id = absint($_POST['payment_id']); |
|
| 411 | + $note = wp_kses($_POST['note'], array()); |
|
| 412 | 412 | |
| 413 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 414 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 413 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 414 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - if ( empty( $payment_id ) ) { |
|
| 418 | - die( '-1' ); |
|
| 417 | + if (empty($payment_id)) { |
|
| 418 | + die('-1'); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - if ( empty( $note ) ) { |
|
| 422 | - die( '-1' ); |
|
| 421 | + if (empty($note)) { |
|
| 422 | + die('-1'); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
| 426 | - die( give_get_payment_note_html( $note_id ) ); |
|
| 425 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
| 426 | + die(give_get_payment_note_html($note_id)); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
| 429 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * Triggers a donation note deletion without ajax |
@@ -437,24 +437,24 @@ discard block |
||
| 437 | 437 | * |
| 438 | 438 | * @return void |
| 439 | 439 | */ |
| 440 | -function give_trigger_payment_note_deletion( $data ) { |
|
| 440 | +function give_trigger_payment_note_deletion($data) { |
|
| 441 | 441 | |
| 442 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
| 442 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
| 443 | 443 | return; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
| 447 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 446 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
| 447 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
| 450 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id='.absint($data['payment_id'])); |
|
| 451 | 451 | |
| 452 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
| 452 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
| 453 | 453 | |
| 454 | - wp_redirect( $edit_order_url ); |
|
| 454 | + wp_redirect($edit_order_url); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
| 457 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
| 458 | 458 | |
| 459 | 459 | /** |
| 460 | 460 | * Delete a payment note deletion with ajax |
@@ -465,16 +465,16 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | function give_ajax_delete_payment_note() { |
| 467 | 467 | |
| 468 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
| 469 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 468 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
| 469 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
| 473 | - die( '1' ); |
|
| 472 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
| 473 | + die('1'); |
|
| 474 | 474 | } else { |
| 475 | - die( '-1' ); |
|
| 475 | + die('-1'); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
| 480 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array An array of updated action links. |
| 25 | 25 | */ |
| 26 | -function give_plugin_action_links( $actions ) { |
|
| 26 | +function give_plugin_action_links($actions) { |
|
| 27 | 27 | $new_actions = array( |
| 28 | 28 | 'settings' => sprintf( |
| 29 | 29 | '<a href="%1$s">%2$s</a>', |
| 30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
| 31 | - __( 'Settings', 'give' ) |
|
| 30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
| 31 | + __('Settings', 'give') |
|
| 32 | 32 | ), |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | - return array_merge( $new_actions, $actions ); |
|
| 35 | + return array_merge($new_actions, $actions); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
| 38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return array |
| 50 | 50 | */ |
| 51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
| 52 | - if ( GIVE_PLUGIN_BASENAME !== $plugin_file ) { |
|
| 51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
| 52 | + if (GIVE_PLUGIN_BASENAME !== $plugin_file) { |
|
| 53 | 53 | return $plugin_meta; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ), 'https://givewp.com/documentation/' |
| 66 | 66 | ) |
| 67 | 67 | ), |
| 68 | - __( 'Documentation', 'give' ) |
|
| 68 | + __('Documentation', 'give') |
|
| 69 | 69 | ), |
| 70 | 70 | sprintf( |
| 71 | 71 | '<a href="%1$s" target="_blank">%2$s</a>', |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | ), 'https://givewp.com/addons/' |
| 79 | 79 | ) |
| 80 | 80 | ), |
| 81 | - __( 'Add-ons', 'give' ) |
|
| 81 | + __('Add-ons', 'give') |
|
| 82 | 82 | ), |
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
| 85 | + return array_merge($plugin_meta, $new_meta_links); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
| 88 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -103,19 +103,18 @@ discard block |
||
| 103 | 103 | $title = ''; |
| 104 | 104 | global $submenu, $plugin_page; |
| 105 | 105 | |
| 106 | - foreach ( array_keys( $submenu ) as $parent ) { |
|
| 107 | - if ( 'edit.php?post_type=give_forms' !== $parent ) { |
|
| 106 | + foreach (array_keys($submenu) as $parent) { |
|
| 107 | + if ('edit.php?post_type=give_forms' !== $parent) { |
|
| 108 | 108 | continue; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - foreach ( $submenu[ $parent ] as $submenu_array ) { |
|
| 112 | - if ( $plugin_page !== $submenu_array[2] ) { |
|
| 111 | + foreach ($submenu[$parent] as $submenu_array) { |
|
| 112 | + if ($plugin_page !== $submenu_array[2]) { |
|
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $title = isset( $submenu_array[0] ) ? |
|
| 117 | - $submenu_array[0] : |
|
| 118 | - $submenu_array[3]; |
|
| 116 | + $title = isset($submenu_array[0]) ? |
|
| 117 | + $submenu_array[0] : $submenu_array[3]; |
|
| 119 | 118 | } |
| 120 | 119 | } |
| 121 | 120 | |
@@ -129,11 +128,11 @@ discard block |
||
| 129 | 128 | */ |
| 130 | 129 | function give_recently_activated_addons() { |
| 131 | 130 | // Check if action is set. |
| 132 | - if ( isset( $_REQUEST['action'] ) ) { |
|
| 133 | - $plugin_action = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : ( isset( $_REQUEST['action2'] ) ? $_REQUEST['action2'] : '' ); |
|
| 131 | + if (isset($_REQUEST['action'])) { |
|
| 132 | + $plugin_action = ('-1' !== $_REQUEST['action']) ? $_REQUEST['action'] : (isset($_REQUEST['action2']) ? $_REQUEST['action2'] : ''); |
|
| 134 | 133 | $plugins = array(); |
| 135 | 134 | |
| 136 | - switch ( $plugin_action ) { |
|
| 135 | + switch ($plugin_action) { |
|
| 137 | 136 | case 'activate': // Single add-on activation. |
| 138 | 137 | $plugins[] = $_REQUEST['plugin']; |
| 139 | 138 | break; |
@@ -143,27 +142,27 @@ discard block |
||
| 143 | 142 | } |
| 144 | 143 | |
| 145 | 144 | |
| 146 | - if ( ! empty( $plugins ) ) { |
|
| 145 | + if ( ! empty($plugins)) { |
|
| 147 | 146 | |
| 148 | 147 | $give_addons = give_get_recently_activated_addons(); |
| 149 | 148 | |
| 150 | - foreach ( $plugins as $plugin ) { |
|
| 149 | + foreach ($plugins as $plugin) { |
|
| 151 | 150 | // Get plugins which has 'Give-' as prefix. |
| 152 | - if ( stripos( $plugin, 'Give-' ) !== false ) { |
|
| 151 | + if (stripos($plugin, 'Give-') !== false) { |
|
| 153 | 152 | $give_addons[] = $plugin; |
| 154 | 153 | } |
| 155 | 154 | } |
| 156 | 155 | |
| 157 | - if ( ! empty( $give_addons ) ) { |
|
| 156 | + if ( ! empty($give_addons)) { |
|
| 158 | 157 | // Update the Give's activated add-ons. |
| 159 | - update_option( 'give_recently_activated_addons', $give_addons, false ); |
|
| 158 | + update_option('give_recently_activated_addons', $give_addons, false); |
|
| 160 | 159 | } |
| 161 | 160 | } |
| 162 | 161 | } |
| 163 | 162 | } |
| 164 | 163 | |
| 165 | 164 | // Add add-on plugins to wp option table. |
| 166 | -add_action( 'activated_plugin', 'give_recently_activated_addons', 10 ); |
|
| 165 | +add_action('activated_plugin', 'give_recently_activated_addons', 10); |
|
| 167 | 166 | |
| 168 | 167 | /** |
| 169 | 168 | * Create new menu in plugin section that include all the add-on |
@@ -174,19 +173,19 @@ discard block |
||
| 174 | 173 | * |
| 175 | 174 | * @return mixed |
| 176 | 175 | */ |
| 177 | -function give_filter_addons_do_filter_addons( $plugin_menu ) { |
|
| 176 | +function give_filter_addons_do_filter_addons($plugin_menu) { |
|
| 178 | 177 | global $plugins; |
| 179 | 178 | |
| 180 | - foreach ( $plugins['all'] as $plugin_slug => $plugin_data ) { |
|
| 179 | + foreach ($plugins['all'] as $plugin_slug => $plugin_data) { |
|
| 181 | 180 | |
| 182 | - if ( false !== strpos( $plugin_data['Name'], 'Give' ) && false !== strpos( $plugin_data['AuthorName'], 'WordImpress' ) ) { |
|
| 183 | - $plugins['give'][ $plugin_slug ] = $plugins['all'][ $plugin_slug ]; |
|
| 184 | - $plugins['give'][ $plugin_slug ]['plugin'] = $plugin_slug; |
|
| 181 | + if (false !== strpos($plugin_data['Name'], 'Give') && false !== strpos($plugin_data['AuthorName'], 'WordImpress')) { |
|
| 182 | + $plugins['give'][$plugin_slug] = $plugins['all'][$plugin_slug]; |
|
| 183 | + $plugins['give'][$plugin_slug]['plugin'] = $plugin_slug; |
|
| 185 | 184 | // replicate the next step. |
| 186 | - if ( current_user_can( 'update_plugins' ) ) { |
|
| 187 | - $current = get_site_transient( 'update_plugins' ); |
|
| 188 | - if ( isset( $current->response[ $plugin_slug ] ) ) { |
|
| 189 | - $plugins['give'][ $plugin_slug ]['update'] = true; |
|
| 185 | + if (current_user_can('update_plugins')) { |
|
| 186 | + $current = get_site_transient('update_plugins'); |
|
| 187 | + if (isset($current->response[$plugin_slug])) { |
|
| 188 | + $plugins['give'][$plugin_slug]['update'] = true; |
|
| 190 | 189 | } |
| 191 | 190 | } |
| 192 | 191 | } |
@@ -196,8 +195,8 @@ discard block |
||
| 196 | 195 | |
| 197 | 196 | } |
| 198 | 197 | |
| 199 | -add_filter( 'show_advanced_plugins', 'give_filter_addons_do_filter_addons' ); |
|
| 200 | -add_filter( 'show_network_active_plugins', 'give_filter_addons_do_filter_addons' ); |
|
| 198 | +add_filter('show_advanced_plugins', 'give_filter_addons_do_filter_addons'); |
|
| 199 | +add_filter('show_network_active_plugins', 'give_filter_addons_do_filter_addons'); |
|
| 201 | 200 | |
| 202 | 201 | /** |
| 203 | 202 | * Keep activating the same add-on when admin activate or deactivate from Give Menu |
@@ -207,18 +206,18 @@ discard block |
||
| 207 | 206 | * @param $action |
| 208 | 207 | * @param $result |
| 209 | 208 | */ |
| 210 | -function give_prepare_filter_addons_referer( $action, $result ) { |
|
| 211 | - if ( ! function_exists( 'get_current_screen' ) ) { |
|
| 209 | +function give_prepare_filter_addons_referer($action, $result) { |
|
| 210 | + if ( ! function_exists('get_current_screen')) { |
|
| 212 | 211 | return; |
| 213 | 212 | } |
| 214 | 213 | $screen = get_current_screen(); |
| 215 | - if ( is_object( $screen ) && $screen->base === 'plugins' && ! empty( $_REQUEST['plugin_status'] ) && $_REQUEST['plugin_status'] === 'give' ) { |
|
| 214 | + if (is_object($screen) && $screen->base === 'plugins' && ! empty($_REQUEST['plugin_status']) && $_REQUEST['plugin_status'] === 'give') { |
|
| 216 | 215 | global $status; |
| 217 | 216 | $status = 'give'; |
| 218 | 217 | } |
| 219 | 218 | } |
| 220 | 219 | |
| 221 | -add_action( 'check_admin_referer', 'give_prepare_filter_addons_referer', 10, 2 ); |
|
| 220 | +add_action('check_admin_referer', 'give_prepare_filter_addons_referer', 10, 2); |
|
| 222 | 221 | |
| 223 | 222 | /** |
| 224 | 223 | * Make the Give Menu as an default menu and update the Menu Name |
@@ -229,30 +228,30 @@ discard block |
||
| 229 | 228 | * |
| 230 | 229 | * @return mixed |
| 231 | 230 | */ |
| 232 | -function give_filter_addons_filter_addons( $views ) { |
|
| 231 | +function give_filter_addons_filter_addons($views) { |
|
| 233 | 232 | |
| 234 | 233 | global $status, $plugins; |
| 235 | 234 | |
| 236 | - if ( ! empty( $plugins['give'] ) ) { |
|
| 235 | + if ( ! empty($plugins['give'])) { |
|
| 237 | 236 | $class = ''; |
| 238 | 237 | |
| 239 | - if ( 'give' === $status ) { |
|
| 238 | + if ('give' === $status) { |
|
| 240 | 239 | $class = 'current'; |
| 241 | 240 | } |
| 242 | 241 | |
| 243 | 242 | $views['give'] = sprintf( |
| 244 | 243 | '<a class="%s" href="plugins.php?plugin_status=give"> %s <span class="count">(%s) </span></a>', |
| 245 | 244 | $class, |
| 246 | - __( 'Give', 'give' ), |
|
| 247 | - count( $plugins['give'] ) |
|
| 245 | + __('Give', 'give'), |
|
| 246 | + count($plugins['give']) |
|
| 248 | 247 | ); |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | return $views; |
| 252 | 251 | } |
| 253 | 252 | |
| 254 | -add_filter( 'views_plugins', 'give_filter_addons_filter_addons' ); |
|
| 255 | -add_filter( 'views_plugins-network', 'give_filter_addons_filter_addons' ); |
|
| 253 | +add_filter('views_plugins', 'give_filter_addons_filter_addons'); |
|
| 254 | +add_filter('views_plugins-network', 'give_filter_addons_filter_addons'); |
|
| 256 | 255 | |
| 257 | 256 | /** |
| 258 | 257 | * Set the Give as the Main menu when admin click on the Give Menu in Plugin section. |
@@ -263,17 +262,17 @@ discard block |
||
| 263 | 262 | * |
| 264 | 263 | * @return mixed |
| 265 | 264 | */ |
| 266 | -function give_prepare_filter_addons( $plugins ) { |
|
| 265 | +function give_prepare_filter_addons($plugins) { |
|
| 267 | 266 | global $status; |
| 268 | 267 | |
| 269 | - if ( isset( $_REQUEST['plugin_status'] ) && 'give' === $_REQUEST['plugin_status'] ) { |
|
| 268 | + if (isset($_REQUEST['plugin_status']) && 'give' === $_REQUEST['plugin_status']) { |
|
| 270 | 269 | $status = 'give'; |
| 271 | 270 | } |
| 272 | 271 | |
| 273 | 272 | return $plugins; |
| 274 | 273 | } |
| 275 | 274 | |
| 276 | -add_filter( 'all_plugins', 'give_prepare_filter_addons' ); |
|
| 275 | +add_filter('all_plugins', 'give_prepare_filter_addons'); |
|
| 277 | 276 | |
| 278 | 277 | |
| 279 | 278 | /** |
@@ -284,26 +283,26 @@ discard block |
||
| 284 | 283 | * |
| 285 | 284 | * @since 2.1 |
| 286 | 285 | */ |
| 287 | -function give_in_plugin_update_message( $data, $response ) { |
|
| 286 | +function give_in_plugin_update_message($data, $response) { |
|
| 288 | 287 | $new_version = $data['new_version']; |
| 289 | - $current_version_parts = explode( '.', GIVE_VERSION ); |
|
| 290 | - $new_version_parts = explode( '.', $new_version ); |
|
| 288 | + $current_version_parts = explode('.', GIVE_VERSION); |
|
| 289 | + $new_version_parts = explode('.', $new_version); |
|
| 291 | 290 | |
| 292 | 291 | // If it is a minor upgrade then return. |
| 293 | - if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) { |
|
| 292 | + if (version_compare($current_version_parts[0].'.'.$current_version_parts[1], $new_version_parts[0].'.'.$new_version_parts[1], '=')) { |
|
| 294 | 293 | |
| 295 | 294 | return; |
| 296 | 295 | } |
| 297 | 296 | |
| 298 | 297 | // Get the upgrade notice from the trunk. |
| 299 | - $upgrade_notice = give_get_plugin_upgrade_notice( $new_version ); |
|
| 298 | + $upgrade_notice = give_get_plugin_upgrade_notice($new_version); |
|
| 300 | 299 | |
| 301 | 300 | // Display upgrade notice. |
| 302 | - echo apply_filters( 'give_in_plugin_update_message', $upgrade_notice ? '</p>' . wp_kses_post( $upgrade_notice ) . '<p class="dummy">' : '' ); |
|
| 301 | + echo apply_filters('give_in_plugin_update_message', $upgrade_notice ? '</p>'.wp_kses_post($upgrade_notice).'<p class="dummy">' : ''); |
|
| 303 | 302 | } |
| 304 | 303 | |
| 305 | 304 | // Display upgrade notice. |
| 306 | -add_action( 'in_plugin_update_message-' . GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2 ); |
|
| 305 | +add_action('in_plugin_update_message-'.GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2); |
|
| 307 | 306 | |
| 308 | 307 | |
| 309 | 308 | /** |
@@ -317,18 +316,18 @@ discard block |
||
| 317 | 316 | * |
| 318 | 317 | * @return string |
| 319 | 318 | */ |
| 320 | -function give_get_plugin_upgrade_notice( $new_version ) { |
|
| 319 | +function give_get_plugin_upgrade_notice($new_version) { |
|
| 321 | 320 | |
| 322 | 321 | // Cache the upgrade notice. |
| 323 | 322 | $transient_name = "give_upgrade_notice_{$new_version}"; |
| 324 | - $upgrade_notice = get_transient( $transient_name ); |
|
| 323 | + $upgrade_notice = get_transient($transient_name); |
|
| 325 | 324 | |
| 326 | - if ( false === $upgrade_notice ) { |
|
| 327 | - $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/give/trunk/readme.txt' ); |
|
| 325 | + if (false === $upgrade_notice) { |
|
| 326 | + $response = wp_safe_remote_get('https://plugins.svn.wordpress.org/give/trunk/readme.txt'); |
|
| 328 | 327 | |
| 329 | - if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) { |
|
| 330 | - $upgrade_notice = give_parse_plugin_update_notice( $response['body'], $new_version ); |
|
| 331 | - set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS ); |
|
| 328 | + if ( ! is_wp_error($response) && ! empty($response['body'])) { |
|
| 329 | + $upgrade_notice = give_parse_plugin_update_notice($response['body'], $new_version); |
|
| 330 | + set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS); |
|
| 332 | 331 | } |
| 333 | 332 | } |
| 334 | 333 | |
@@ -348,46 +347,46 @@ discard block |
||
| 348 | 347 | * |
| 349 | 348 | * @return string |
| 350 | 349 | */ |
| 351 | -function give_parse_plugin_update_notice( $content, $new_version ) { |
|
| 352 | - $version_parts = explode( '.', $new_version ); |
|
| 350 | +function give_parse_plugin_update_notice($content, $new_version) { |
|
| 351 | + $version_parts = explode('.', $new_version); |
|
| 353 | 352 | $check_for_notices = array( |
| 354 | - $version_parts[0] . '.0', |
|
| 355 | - $version_parts[0] . '.0.0', |
|
| 356 | - $version_parts[0] . '.' . $version_parts[1] . '.' . '0', |
|
| 353 | + $version_parts[0].'.0', |
|
| 354 | + $version_parts[0].'.0.0', |
|
| 355 | + $version_parts[0].'.'.$version_parts[1].'.'.'0', |
|
| 357 | 356 | ); |
| 358 | 357 | |
| 359 | 358 | // Regex to extract Upgrade notice from the readme.txt file. |
| 360 | - $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis'; |
|
| 359 | + $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote($new_version).'\s*=|$)~Uis'; |
|
| 361 | 360 | |
| 362 | 361 | $upgrade_notice = ''; |
| 363 | 362 | |
| 364 | - foreach ( $check_for_notices as $check_version ) { |
|
| 365 | - if ( version_compare( GIVE_VERSION, $check_version, '>' ) ) { |
|
| 363 | + foreach ($check_for_notices as $check_version) { |
|
| 364 | + if (version_compare(GIVE_VERSION, $check_version, '>')) { |
|
| 366 | 365 | continue; |
| 367 | 366 | } |
| 368 | 367 | |
| 369 | 368 | $matches = null; |
| 370 | 369 | |
| 371 | - if ( preg_match( $notice_regexp, $content, $matches ) ) { |
|
| 372 | - $notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) ); |
|
| 370 | + if (preg_match($notice_regexp, $content, $matches)) { |
|
| 371 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2])); |
|
| 373 | 372 | |
| 374 | - if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) { |
|
| 373 | + if (version_compare(trim($matches[1]), $check_version, '=')) { |
|
| 375 | 374 | $upgrade_notice .= '<p class="give-plugin-upgrade-notice">'; |
| 376 | 375 | |
| 377 | - foreach ( $notices as $index => $line ) { |
|
| 378 | - $upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ); |
|
| 376 | + foreach ($notices as $index => $line) { |
|
| 377 | + $upgrade_notice .= preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line); |
|
| 379 | 378 | } |
| 380 | 379 | |
| 381 | 380 | $upgrade_notice .= '</p>'; |
| 382 | 381 | } |
| 383 | 382 | |
| 384 | - if ( ! empty( $upgrade_notice ) ) { |
|
| 383 | + if ( ! empty($upgrade_notice)) { |
|
| 385 | 384 | break; |
| 386 | 385 | } |
| 387 | 386 | } |
| 388 | 387 | } |
| 389 | 388 | |
| 390 | - return wp_kses_post( $upgrade_notice ); |
|
| 389 | + return wp_kses_post($upgrade_notice); |
|
| 391 | 390 | } |
| 392 | 391 | |
| 393 | 392 | |
@@ -424,7 +423,7 @@ discard block |
||
| 424 | 423 | <?php |
| 425 | 424 | } |
| 426 | 425 | |
| 427 | -add_action( 'admin_head', 'give_plugin_notice_css' ); |
|
| 426 | +add_action('admin_head', 'give_plugin_notice_css'); |
|
| 428 | 427 | |
| 429 | 428 | /** |
| 430 | 429 | * Get list of add-on last activated. |
@@ -434,7 +433,7 @@ discard block |
||
| 434 | 433 | * @return mixed|array list of recently activated add-on |
| 435 | 434 | */ |
| 436 | 435 | function give_get_recently_activated_addons() { |
| 437 | - return get_option( 'give_recently_activated_addons', array() ); |
|
| 436 | + return get_option('give_recently_activated_addons', array()); |
|
| 438 | 437 | } |
| 439 | 438 | |
| 440 | 439 | /** |
@@ -452,34 +451,34 @@ discard block |
||
| 452 | 451 | ?> |
| 453 | 452 | |
| 454 | 453 | <h2 id="deactivation-survey-title"> |
| 455 | - <img src="<?php echo esc_url( GIVE_PLUGIN_URL ) ?>/assets/dist/images/give-icon-full-circle.svg"> |
|
| 456 | - <span><?php esc_html_e( 'Give Deactivation', 'give' ); ?></span> |
|
| 454 | + <img src="<?php echo esc_url(GIVE_PLUGIN_URL) ?>/assets/dist/images/give-icon-full-circle.svg"> |
|
| 455 | + <span><?php esc_html_e('Give Deactivation', 'give'); ?></span> |
|
| 457 | 456 | </h2> |
| 458 | 457 | <form class="deactivation-survey-form" method="POST"> |
| 459 | - <p><?php esc_html_e( 'If you have a moment, please let us know why you are deactivating Give. All submissions are anonymous and we only use this feedback to improve this plugin.', 'give' ); ?></p> |
|
| 458 | + <p><?php esc_html_e('If you have a moment, please let us know why you are deactivating Give. All submissions are anonymous and we only use this feedback to improve this plugin.', 'give'); ?></p> |
|
| 460 | 459 | |
| 461 | 460 | <div> |
| 462 | 461 | <label class="give-field-description"> |
| 463 | 462 | <input type="radio" name="give-survey-radios" value="1"> |
| 464 | - <?php esc_html_e( "I'm only deactivating temporarily", 'give' ); ?> |
|
| 463 | + <?php esc_html_e("I'm only deactivating temporarily", 'give'); ?> |
|
| 465 | 464 | </label> |
| 466 | 465 | </div> |
| 467 | 466 | |
| 468 | 467 | <div> |
| 469 | 468 | <label class="give-field-description"> |
| 470 | 469 | <input type="radio" name="give-survey-radios" value="2"> |
| 471 | - <?php esc_html_e( 'I no longer need the plugin', 'give' ); ?> |
|
| 470 | + <?php esc_html_e('I no longer need the plugin', 'give'); ?> |
|
| 472 | 471 | </label> |
| 473 | 472 | </div> |
| 474 | 473 | |
| 475 | 474 | <div> |
| 476 | 475 | <label class="give-field-description"> |
| 477 | 476 | <input type="radio" name="give-survey-radios" value="3" data-has-field="true"> |
| 478 | - <?php esc_html_e( 'I found a better plugin', 'give' ); ?> |
|
| 477 | + <?php esc_html_e('I found a better plugin', 'give'); ?> |
|
| 479 | 478 | </label> |
| 480 | 479 | |
| 481 | 480 | <div class="give-survey-extra-field"> |
| 482 | - <p><?php esc_html_e( 'What is the name of the plugin?', 'give' ); ?></p> |
|
| 481 | + <p><?php esc_html_e('What is the name of the plugin?', 'give'); ?></p> |
|
| 483 | 482 | <input type="text" name="user-reason" class="widefat"> |
| 484 | 483 | </div> |
| 485 | 484 | </div> |
@@ -487,23 +486,23 @@ discard block |
||
| 487 | 486 | <div> |
| 488 | 487 | <label class="give-field-description"> |
| 489 | 488 | <input type="radio" name="give-survey-radios" value="4"> |
| 490 | - <?php esc_html_e( 'I only needed the plugin for a short period', 'give' ); ?> |
|
| 489 | + <?php esc_html_e('I only needed the plugin for a short period', 'give'); ?> |
|
| 491 | 490 | </label> |
| 492 | 491 | </div> |
| 493 | 492 | |
| 494 | 493 | <div> |
| 495 | 494 | <label class="give-field-description"> |
| 496 | 495 | <input type="radio" name="give-survey-radios" value="5" data-has-field="true"> |
| 497 | - <?php esc_html_e( 'The plugin broke my site', 'give' ); ?> |
|
| 496 | + <?php esc_html_e('The plugin broke my site', 'give'); ?> |
|
| 498 | 497 | </label> |
| 499 | 498 | |
| 500 | 499 | <div class="give-survey-extra-field"> |
| 501 | 500 | <p><?php |
| 502 | 501 | printf( |
| 503 | 502 | '%1$s %2$s %3$s', |
| 504 | - __( "We're sorry to hear that, check", 'give' ), |
|
| 503 | + __("We're sorry to hear that, check", 'give'), |
|
| 505 | 504 | '<a href="https://wordpress.org/support/plugin/give">Give Support</a>.', |
| 506 | - __( 'Can you describe the issue?', 'give' ) |
|
| 505 | + __('Can you describe the issue?', 'give') |
|
| 507 | 506 | ); |
| 508 | 507 | ?> |
| 509 | 508 | </p> |
@@ -514,16 +513,16 @@ discard block |
||
| 514 | 513 | <div> |
| 515 | 514 | <label class="give-field-description"> |
| 516 | 515 | <input type="radio" name="give-survey-radios" value="6" data-has-field="true"> |
| 517 | - <?php esc_html_e( 'The plugin suddenly stopped working', 'give' ); ?> |
|
| 516 | + <?php esc_html_e('The plugin suddenly stopped working', 'give'); ?> |
|
| 518 | 517 | </label> |
| 519 | 518 | |
| 520 | 519 | <div class="give-survey-extra-field"> |
| 521 | 520 | <p><?php |
| 522 | 521 | printf( |
| 523 | 522 | '%1$s %2$s %3$s', |
| 524 | - __( "We're sorry to hear that, check", 'give' ), |
|
| 523 | + __("We're sorry to hear that, check", 'give'), |
|
| 525 | 524 | '<a href="https://wordpress.org/support/plugin/give">Give Support</a>.', |
| 526 | - __( 'Can you describe the issue?', 'give' ) |
|
| 525 | + __('Can you describe the issue?', 'give') |
|
| 527 | 526 | ); |
| 528 | 527 | ?> |
| 529 | 528 | </p> |
@@ -534,11 +533,11 @@ discard block |
||
| 534 | 533 | <div> |
| 535 | 534 | <label class="give-field-description"> |
| 536 | 535 | <input type="radio" name="give-survey-radios" value="7" data-has-field="true"> |
| 537 | - <?php esc_html_e( 'Other', 'give' ); ?> |
|
| 536 | + <?php esc_html_e('Other', 'give'); ?> |
|
| 538 | 537 | </label> |
| 539 | 538 | |
| 540 | 539 | <div class="give-survey-extra-field"> |
| 541 | - <p><?php esc_html_e( "Please describe why you're deactivating Give", 'give' ); ?></p> |
|
| 540 | + <p><?php esc_html_e("Please describe why you're deactivating Give", 'give'); ?></p> |
|
| 542 | 541 | <textarea disabled name="user-reason" class="widefat" rows="6"></textarea disabled> |
| 543 | 542 | </div> |
| 544 | 543 | </div> |
@@ -547,10 +546,10 @@ discard block |
||
| 547 | 546 | <p> |
| 548 | 547 | <label> |
| 549 | 548 | <input type="checkbox" name="confirm_reset_store" value="1"> |
| 550 | - <?php esc_html_e( 'Would you like to delete all Give data?', 'give' ); ?> |
|
| 549 | + <?php esc_html_e('Would you like to delete all Give data?', 'give'); ?> |
|
| 551 | 550 | </label> |
| 552 | 551 | <section class="give-field-description"> |
| 553 | - <?php esc_html_e( 'By default the custom roles, Give options, and database entries are not deleted when you deactivate Give. If you are deleting Give completely from your website and want those items removed as well check this option. Note: This will permanently delete all Give data from your database.', 'give' ); ?> |
|
| 552 | + <?php esc_html_e('By default the custom roles, Give options, and database entries are not deleted when you deactivate Give. If you are deleting Give completely from your website and want those items removed as well check this option. Note: This will permanently delete all Give data from your database.', 'give'); ?> |
|
| 554 | 553 | </section> |
| 555 | 554 | </p> |
| 556 | 555 | </div> |
@@ -559,9 +558,9 @@ discard block |
||
| 559 | 558 | $current_user_email = $current_user->user_email; |
| 560 | 559 | ?> |
| 561 | 560 | <input type="hidden" name="current-user-email" value="<?php echo $current_user_email; ?>"> |
| 562 | - <input type="hidden" name="current-site-url" value="<?php echo esc_url( get_bloginfo( 'url' ) ); ?>"> |
|
| 561 | + <input type="hidden" name="current-site-url" value="<?php echo esc_url(get_bloginfo('url')); ?>"> |
|
| 563 | 562 | <input type="hidden" name="give-export-class" value="Give_Tools_Reset_Stats"> |
| 564 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 563 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 565 | 564 | </form> |
| 566 | 565 | |
| 567 | 566 | <?php |
@@ -574,10 +573,10 @@ discard block |
||
| 574 | 573 | |
| 575 | 574 | $results['html'] = $output; |
| 576 | 575 | |
| 577 | - wp_send_json( $results ); |
|
| 576 | + wp_send_json($results); |
|
| 578 | 577 | } |
| 579 | 578 | |
| 580 | -add_action( 'wp_ajax_give_deactivation_popup', 'give_deactivation_popup' ); |
|
| 579 | +add_action('wp_ajax_give_deactivation_popup', 'give_deactivation_popup'); |
|
| 581 | 580 | |
| 582 | 581 | /** |
| 583 | 582 | * Ajax callback after the deactivation survey form has been submitted. |
@@ -587,27 +586,27 @@ discard block |
||
| 587 | 586 | */ |
| 588 | 587 | function give_deactivation_form_submit() { |
| 589 | 588 | |
| 590 | - if ( ! check_ajax_referer( 'deactivation_survey_nonce', 'nonce', false ) ) { |
|
| 589 | + if ( ! check_ajax_referer('deactivation_survey_nonce', 'nonce', false)) { |
|
| 591 | 590 | wp_send_json_error(); |
| 592 | 591 | wp_die(); |
| 593 | 592 | } |
| 594 | 593 | |
| 595 | - $form_data = give_clean( wp_parse_args( $_POST['form-data'] ) ); |
|
| 594 | + $form_data = give_clean(wp_parse_args($_POST['form-data'])); |
|
| 596 | 595 | |
| 597 | 596 | // Get the selected radio value. |
| 598 | - $radio_value = isset( $form_data['give-survey-radios'] ) ? $form_data['give-survey-radios'] : 0; |
|
| 597 | + $radio_value = isset($form_data['give-survey-radios']) ? $form_data['give-survey-radios'] : 0; |
|
| 599 | 598 | |
| 600 | 599 | // Get the reason if any radio button has an optional text field. |
| 601 | - $user_reason = isset( $form_data['user-reason'] ) ? $form_data['user-reason'] : ''; |
|
| 600 | + $user_reason = isset($form_data['user-reason']) ? $form_data['user-reason'] : ''; |
|
| 602 | 601 | |
| 603 | 602 | // Get the email of the user who deactivated the plugin. |
| 604 | - $user_email = isset( $form_data['current-user-email'] ) ? $form_data['current-user-email'] : ''; |
|
| 603 | + $user_email = isset($form_data['current-user-email']) ? $form_data['current-user-email'] : ''; |
|
| 605 | 604 | |
| 606 | 605 | // Get the URL of the website on which Give plugin is being deactivated. |
| 607 | - $site_url = isset( $form_data['current-site-url'] ) ? $form_data['current-site-url'] : ''; |
|
| 606 | + $site_url = isset($form_data['current-site-url']) ? $form_data['current-site-url'] : ''; |
|
| 608 | 607 | |
| 609 | 608 | // Get the value of the checkbox for deleting Give's data. |
| 610 | - $delete_data = isset( $form_data['confirm_reset_store'] ) ? $form_data['confirm_reset_store'] : ''; |
|
| 609 | + $delete_data = isset($form_data['confirm_reset_store']) ? $form_data['confirm_reset_store'] : ''; |
|
| 611 | 610 | |
| 612 | 611 | /** |
| 613 | 612 | * Make a POST request to the endpoint to send the survey data. |
@@ -625,10 +624,10 @@ discard block |
||
| 625 | 624 | ); |
| 626 | 625 | |
| 627 | 626 | // Check if the data is sent and stored correctly. |
| 628 | - $response = wp_remote_retrieve_body( $response ); |
|
| 627 | + $response = wp_remote_retrieve_body($response); |
|
| 629 | 628 | |
| 630 | - if ( 'true' === $response ) { |
|
| 631 | - if ( '1' === $delete_data ) { |
|
| 629 | + if ('true' === $response) { |
|
| 630 | + if ('1' === $delete_data) { |
|
| 632 | 631 | wp_send_json_success( |
| 633 | 632 | array( |
| 634 | 633 | 'delete_data' => true, |
@@ -648,4 +647,4 @@ discard block |
||
| 648 | 647 | wp_die(); |
| 649 | 648 | } |
| 650 | 649 | |
| 651 | -add_action( 'wp_ajax_deactivation_form_submit', 'give_deactivation_form_submit' ); |
|
| 650 | +add_action('wp_ajax_deactivation_form_submit', 'give_deactivation_form_submit'); |
|
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; // Exit if accessed directly |
| 13 | 13 | } |
| 14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return bool|string |
| 24 | 24 | */ |
| 25 | -function give_is_field_callback_exist( $field ) { |
|
| 26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
| 25 | +function give_is_field_callback_exist($field) { |
|
| 26 | + return (give_get_field_callback($field) ? true : false); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return bool|string |
| 37 | 37 | */ |
| 38 | -function give_get_field_callback( $field ) { |
|
| 38 | +function give_get_field_callback($field) { |
|
| 39 | 39 | $func_name_prefix = 'give'; |
| 40 | 40 | $func_name = ''; |
| 41 | 41 | |
| 42 | 42 | // Set callback function on basis of cmb2 field name. |
| 43 | - switch ( $field['type'] ) { |
|
| 43 | + switch ($field['type']) { |
|
| 44 | 44 | case 'radio_inline': |
| 45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
| 46 | 46 | break; |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | default: |
| 87 | 87 | |
| 88 | 88 | if ( |
| 89 | - array_key_exists( 'callback', $field ) |
|
| 90 | - && ! empty( $field['callback'] ) |
|
| 89 | + array_key_exists('callback', $field) |
|
| 90 | + && ! empty($field['callback']) |
|
| 91 | 91 | ) { |
| 92 | 92 | $func_name = $field['callback']; |
| 93 | 93 | } else { |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @since 1.8 |
| 102 | 102 | */ |
| 103 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
| 103 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
| 104 | 104 | |
| 105 | 105 | // Exit if not any function exist. |
| 106 | 106 | // Check if render callback exist or not. |
| 107 | - if ( empty( $func_name ) ) { |
|
| 107 | + if (empty($func_name)) { |
|
| 108 | 108 | return false; |
| 109 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
| 109 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
| 110 | 110 | return false; |
| 111 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
| 111 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
| 112 | 112 | return false; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -124,35 +124,35 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return bool |
| 126 | 126 | */ |
| 127 | -function give_render_field( $field ) { |
|
| 127 | +function give_render_field($field) { |
|
| 128 | 128 | |
| 129 | 129 | // Check if render callback exist or not. |
| 130 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
| 130 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
| 131 | 131 | return false; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // CMB2 compatibility: Push all classes to attributes's class key |
| 135 | - if ( empty( $field['class'] ) ) { |
|
| 135 | + if (empty($field['class'])) { |
|
| 136 | 136 | $field['class'] = ''; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ( empty( $field['attributes']['class'] ) ) { |
|
| 139 | + if (empty($field['attributes']['class'])) { |
|
| 140 | 140 | $field['attributes']['class'] = ''; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
| 144 | - unset( $field['class'] ); |
|
| 143 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
| 144 | + unset($field['class']); |
|
| 145 | 145 | |
| 146 | 146 | // CMB2 compatibility: Set wrapper class if any. |
| 147 | - if ( ! empty( $field['row_classes'] ) ) { |
|
| 147 | + if ( ! empty($field['row_classes'])) { |
|
| 148 | 148 | $field['wrapper_class'] = $field['row_classes']; |
| 149 | - unset( $field['row_classes'] ); |
|
| 149 | + unset($field['row_classes']); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Set field params on basis of cmb2 field name. |
| 153 | - switch ( $field['type'] ) { |
|
| 153 | + switch ($field['type']) { |
|
| 154 | 154 | case 'radio_inline': |
| 155 | - if ( empty( $field['wrapper_class'] ) ) { |
|
| 155 | + if (empty($field['wrapper_class'])) { |
|
| 156 | 156 | $field['wrapper_class'] = ''; |
| 157 | 157 | } |
| 158 | 158 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | case 'text-small' : |
| 166 | 166 | case 'text_small' : |
| 167 | 167 | // CMB2 compatibility: Set field type to text. |
| 168 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
| 168 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
| 169 | 169 | |
| 170 | 170 | // CMB2 compatibility: Set data type to price. |
| 171 | 171 | if ( |
| 172 | - empty( $field['data_type'] ) |
|
| 173 | - && ! empty( $field['attributes']['class'] ) |
|
| 172 | + empty($field['data_type']) |
|
| 173 | + && ! empty($field['attributes']['class']) |
|
| 174 | 174 | && ( |
| 175 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
| 176 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
| 175 | + false !== strpos($field['attributes']['class'], 'money') |
|
| 176 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
| 177 | 177 | ) |
| 178 | 178 | ) { |
| 179 | 179 | $field['data_type'] = 'decimal'; |
@@ -192,26 +192,26 @@ discard block |
||
| 192 | 192 | case 'give_default_radio_inline': |
| 193 | 193 | $field['type'] = 'radio'; |
| 194 | 194 | $field['options'] = array( |
| 195 | - 'default' => __( 'Default' ), |
|
| 195 | + 'default' => __('Default'), |
|
| 196 | 196 | ); |
| 197 | 197 | break; |
| 198 | 198 | |
| 199 | 199 | case 'donation_limit': |
| 200 | - $field['type'] = 'donation_limit'; |
|
| 200 | + $field['type'] = 'donation_limit'; |
|
| 201 | 201 | break; |
| 202 | 202 | } // End switch(). |
| 203 | 203 | |
| 204 | 204 | // CMB2 compatibility: Add support to define field description by desc & description param. |
| 205 | 205 | // We encourage you to use description param. |
| 206 | - $field['description'] = ( ! empty( $field['description'] ) |
|
| 206 | + $field['description'] = ( ! empty($field['description']) |
|
| 207 | 207 | ? $field['description'] |
| 208 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
| 208 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
| 209 | 209 | |
| 210 | 210 | // Call render function. |
| 211 | - if ( is_array( $func_name ) ) { |
|
| 212 | - $func_name[0]->{$func_name[1]}( $field ); |
|
| 211 | + if (is_array($func_name)) { |
|
| 212 | + $func_name[0]->{$func_name[1]}($field); |
|
| 213 | 213 | } else { |
| 214 | - $func_name( $field ); |
|
| 214 | + $func_name($field); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | return true; |
@@ -241,29 +241,29 @@ discard block |
||
| 241 | 241 | * } |
| 242 | 242 | * @return void |
| 243 | 243 | */ |
| 244 | -function give_text_input( $field ) { |
|
| 244 | +function give_text_input($field) { |
|
| 245 | 245 | global $thepostid, $post; |
| 246 | 246 | |
| 247 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 248 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 249 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 250 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 251 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
| 247 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 248 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 249 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 250 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 251 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
| 252 | 252 | $field['before_field'] = ''; |
| 253 | 253 | $field['after_field'] = ''; |
| 254 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
| 254 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
| 255 | 255 | |
| 256 | - switch ( $data_type ) { |
|
| 256 | + switch ($data_type) { |
|
| 257 | 257 | case 'price' : |
| 258 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
| 258 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
| 259 | 259 | |
| 260 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
| 261 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
| 260 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
| 261 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
| 262 | 262 | break; |
| 263 | 263 | |
| 264 | 264 | case 'decimal' : |
| 265 | 265 | $field['attributes']['class'] .= ' give_input_decimal'; |
| 266 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
| 266 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
| 267 | 267 | break; |
| 268 | 268 | |
| 269 | 269 | default : |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | ?> |
| 274 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 275 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 274 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 275 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 276 | 276 | <?php echo $field['before_field']; ?> |
| 277 | 277 | <input |
| 278 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 279 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 280 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 281 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 282 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 283 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 278 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 279 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 280 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 281 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 282 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 283 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 284 | 284 | /> |
| 285 | 285 | <?php echo $field['after_field']; ?> |
| 286 | 286 | <?php |
| 287 | - echo give_get_field_description( $field ); |
|
| 287 | + echo give_get_field_description($field); |
|
| 288 | 288 | echo '</p>'; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -314,59 +314,57 @@ discard block |
||
| 314 | 314 | * |
| 315 | 315 | * @return void |
| 316 | 316 | */ |
| 317 | -function give_chosen_input( $field ) { |
|
| 317 | +function give_chosen_input($field) { |
|
| 318 | 318 | global $thepostid, $post; |
| 319 | 319 | |
| 320 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 321 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 322 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 320 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 321 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 322 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 323 | 323 | $field['before_field'] = ''; |
| 324 | 324 | $field['after_field'] = ''; |
| 325 | - $placeholder = isset( $field['placeholder'] ) ? 'data-placeholder="' . $field['placeholder'] . '"' : ''; |
|
| 326 | - $data_type = ! empty( $field['data_type'] ) ? $field['data_type'] : ''; |
|
| 325 | + $placeholder = isset($field['placeholder']) ? 'data-placeholder="'.$field['placeholder'].'"' : ''; |
|
| 326 | + $data_type = ! empty($field['data_type']) ? $field['data_type'] : ''; |
|
| 327 | 327 | $type = ''; |
| 328 | 328 | $allow_new_values = ''; |
| 329 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 330 | - $field['value'] = is_array( $field['value'] ) ? |
|
| 331 | - array_fill_keys( array_filter( $field['value'] ), 'selected' ) : |
|
| 332 | - $field['value']; |
|
| 333 | - $title_prefixes_value = ( is_array( $field['value'] ) && count( $field['value'] ) > 0 ) ? |
|
| 334 | - array_merge( $field['options'], $field['value'] ) : |
|
| 335 | - $field['options']; |
|
| 329 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 330 | + $field['value'] = is_array($field['value']) ? |
|
| 331 | + array_fill_keys(array_filter($field['value']), 'selected') : $field['value']; |
|
| 332 | + $title_prefixes_value = (is_array($field['value']) && count($field['value']) > 0) ? |
|
| 333 | + array_merge($field['options'], $field['value']) : $field['options']; |
|
| 336 | 334 | |
| 337 | 335 | // Set attributes based on multiselect datatype. |
| 338 | - if ( 'multiselect' === $data_type ) { |
|
| 336 | + if ('multiselect' === $data_type) { |
|
| 339 | 337 | $type = 'multiple'; |
| 340 | 338 | $allow_new_values = 'data-allows-new-values="true"'; |
| 341 | 339 | } |
| 342 | 340 | |
| 343 | 341 | ?> |
| 344 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 345 | - <label for="<?php echo esc_attr( give_get_field_name( $field ) ); ?>"> |
|
| 346 | - <?php echo wp_kses_post( $field['name'] ); ?> |
|
| 342 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 343 | + <label for="<?php echo esc_attr(give_get_field_name($field)); ?>"> |
|
| 344 | + <?php echo wp_kses_post($field['name']); ?> |
|
| 347 | 345 | </label> |
| 348 | - <?php echo esc_attr( $field['before_field'] ); ?> |
|
| 346 | + <?php echo esc_attr($field['before_field']); ?> |
|
| 349 | 347 | <select |
| 350 | 348 | class="give-select-chosen give-chosen-settings" |
| 351 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 352 | - name="<?php echo esc_attr( give_get_field_name( $field ) ); ?>[]" |
|
| 353 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 349 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 350 | + name="<?php echo esc_attr(give_get_field_name($field)); ?>[]" |
|
| 351 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 354 | 352 | <?php echo "{$type} {$allow_new_values} {$placeholder}"; ?> |
| 355 | 353 | > |
| 356 | 354 | <?php |
| 357 | - if ( is_array( $title_prefixes_value ) && count( $title_prefixes_value ) > 0 ) { |
|
| 358 | - foreach ( $title_prefixes_value as $key => $value ) { |
|
| 355 | + if (is_array($title_prefixes_value) && count($title_prefixes_value) > 0) { |
|
| 356 | + foreach ($title_prefixes_value as $key => $value) { |
|
| 359 | 357 | echo sprintf( |
| 360 | 358 | '<option %1$s value="%2$s">%2$s</option>', |
| 361 | - ( 'selected' === $value ) ? 'selected="selected"' : '', |
|
| 362 | - esc_attr( $key ) |
|
| 359 | + ('selected' === $value) ? 'selected="selected"' : '', |
|
| 360 | + esc_attr($key) |
|
| 363 | 361 | ); |
| 364 | 362 | } |
| 365 | 363 | } |
| 366 | 364 | ?> |
| 367 | 365 | </select> |
| 368 | - <?php echo esc_attr( $field['after_field'] ); ?> |
|
| 369 | - <?php echo give_get_field_description( $field ); ?> |
|
| 366 | + <?php echo esc_attr($field['after_field']); ?> |
|
| 367 | + <?php echo give_get_field_description($field); ?> |
|
| 370 | 368 | </p> |
| 371 | 369 | <?php |
| 372 | 370 | } |
@@ -397,107 +395,107 @@ discard block |
||
| 397 | 395 | * |
| 398 | 396 | * @return void |
| 399 | 397 | */ |
| 400 | -function give_donation_limit( $field ) { |
|
| 398 | +function give_donation_limit($field) { |
|
| 401 | 399 | global $thepostid, $post; |
| 402 | 400 | |
| 403 | 401 | // Get Give donation form ID. |
| 404 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 402 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 405 | 403 | |
| 406 | 404 | // Default arguments. |
| 407 | 405 | $default_options = array( |
| 408 | 406 | 'style' => '', |
| 409 | 407 | 'wrapper_class' => '', |
| 410 | - 'value' => give_get_field_value( $field, $thepostid ), |
|
| 408 | + 'value' => give_get_field_value($field, $thepostid), |
|
| 411 | 409 | 'data_type' => 'decimal', |
| 412 | 410 | 'before_field' => '', |
| 413 | 411 | 'after_field' => '', |
| 414 | 412 | ); |
| 415 | 413 | |
| 416 | 414 | // Field options. |
| 417 | - $field['options'] = ! empty( $field['options'] ) ? $field['options'] : array(); |
|
| 415 | + $field['options'] = ! empty($field['options']) ? $field['options'] : array(); |
|
| 418 | 416 | |
| 419 | 417 | // Default field option arguments. |
| 420 | - $field['options'] = wp_parse_args( $field['options'], array( |
|
| 418 | + $field['options'] = wp_parse_args($field['options'], array( |
|
| 421 | 419 | 'display_label' => '', |
| 422 | - 'minimum' => give_format_decimal( '1.00', false, false ), |
|
| 423 | - 'maximum' => give_format_decimal( '999999.99', false, false ), |
|
| 420 | + 'minimum' => give_format_decimal('1.00', false, false), |
|
| 421 | + 'maximum' => give_format_decimal('999999.99', false, false), |
|
| 424 | 422 | ) |
| 425 | 423 | ); |
| 426 | 424 | |
| 427 | 425 | // Set default field options. |
| 428 | - $field_options = wp_parse_args( $field, $default_options ); |
|
| 426 | + $field_options = wp_parse_args($field, $default_options); |
|
| 429 | 427 | |
| 430 | 428 | // Get default minimum value, if empty. |
| 431 | - $field_options['value']['minimum'] = ! empty( $field_options['value']['minimum'] ) |
|
| 429 | + $field_options['value']['minimum'] = ! empty($field_options['value']['minimum']) |
|
| 432 | 430 | ? $field_options['value']['minimum'] |
| 433 | 431 | : $field_options['options']['minimum']; |
| 434 | 432 | |
| 435 | 433 | // Get default maximum value, if empty. |
| 436 | - $field_options['value']['maximum'] = ! empty( $field_options['value']['maximum'] ) |
|
| 434 | + $field_options['value']['maximum'] = ! empty($field_options['value']['maximum']) |
|
| 437 | 435 | ? $field_options['value']['maximum'] |
| 438 | 436 | : $field_options['options']['maximum']; |
| 439 | 437 | ?> |
| 440 | - <p class="give-field-wrap <?php echo esc_attr( $field_options['id'] ); ?>_field <?php echo esc_attr( $field_options['wrapper_class'] ); ?>"> |
|
| 441 | - <label for="<?php echo give_get_field_name( $field_options ); ?>"><?php echo wp_kses_post( $field_options['name'] ); ?></label> |
|
| 438 | + <p class="give-field-wrap <?php echo esc_attr($field_options['id']); ?>_field <?php echo esc_attr($field_options['wrapper_class']); ?>"> |
|
| 439 | + <label for="<?php echo give_get_field_name($field_options); ?>"><?php echo wp_kses_post($field_options['name']); ?></label> |
|
| 442 | 440 | <span class="give_donation_limit_display"> |
| 443 | 441 | <?php |
| 444 | - foreach ( $field_options['value'] as $amount_range => $amount_value ) { |
|
| 442 | + foreach ($field_options['value'] as $amount_range => $amount_value) { |
|
| 445 | 443 | |
| 446 | - switch ( $field_options['data_type'] ) { |
|
| 444 | + switch ($field_options['data_type']) { |
|
| 447 | 445 | case 'price' : |
| 448 | - $currency_position = give_get_option( 'currency_position', 'before' ); |
|
| 449 | - $price_field_labels = 'minimum' === $amount_range ? __( 'Minimum amount', 'give' ) : __( 'Maximum amount', 'give' ); |
|
| 446 | + $currency_position = give_get_option('currency_position', 'before'); |
|
| 447 | + $price_field_labels = 'minimum' === $amount_range ? __('Minimum amount', 'give') : __('Maximum amount', 'give'); |
|
| 450 | 448 | |
| 451 | 449 | $tooltip_html = array( |
| 452 | - 'before' => Give()->tooltips->render_span( array( |
|
| 450 | + 'before' => Give()->tooltips->render_span(array( |
|
| 453 | 451 | 'label' => $price_field_labels, |
| 454 | - 'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol() ), |
|
| 455 | - ) ), |
|
| 456 | - 'after' => Give()->tooltips->render_span( array( |
|
| 452 | + 'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol()), |
|
| 453 | + )), |
|
| 454 | + 'after' => Give()->tooltips->render_span(array( |
|
| 457 | 455 | 'label' => $price_field_labels, |
| 458 | - 'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol() ), |
|
| 459 | - ) ), |
|
| 456 | + 'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol()), |
|
| 457 | + )), |
|
| 460 | 458 | ); |
| 461 | 459 | |
| 462 | - $before_html = ! empty( $field_options['before_field'] ) |
|
| 460 | + $before_html = ! empty($field_options['before_field']) |
|
| 463 | 461 | ? $field_options['before_field'] |
| 464 | - : ( 'before' === $currency_position ? $tooltip_html['before'] : '' ); |
|
| 462 | + : ('before' === $currency_position ? $tooltip_html['before'] : ''); |
|
| 465 | 463 | |
| 466 | - $after_html = ! empty( $field_options['after_field'] ) |
|
| 464 | + $after_html = ! empty($field_options['after_field']) |
|
| 467 | 465 | ? $field_options['after_field'] |
| 468 | - : ( 'after' === $currency_position ? $tooltip_html['after'] : '' ); |
|
| 466 | + : ('after' === $currency_position ? $tooltip_html['after'] : ''); |
|
| 469 | 467 | |
| 470 | - $field_options['attributes']['class'] .= ' give-text_small'; |
|
| 471 | - $field_options['value'][ $amount_range ] = $amount_value; |
|
| 468 | + $field_options['attributes']['class'] .= ' give-text_small'; |
|
| 469 | + $field_options['value'][$amount_range] = $amount_value; |
|
| 472 | 470 | break; |
| 473 | 471 | |
| 474 | 472 | case 'decimal' : |
| 475 | - $field_options['attributes']['class'] .= ' give_input_decimal give-text_small'; |
|
| 476 | - $field_options['value'][ $amount_range ] = $amount_value; |
|
| 473 | + $field_options['attributes']['class'] .= ' give_input_decimal give-text_small'; |
|
| 474 | + $field_options['value'][$amount_range] = $amount_value; |
|
| 477 | 475 | break; |
| 478 | 476 | } |
| 479 | 477 | |
| 480 | 478 | echo '<span class=give-minmax-wrap>'; |
| 481 | - printf( '<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr( $field_options['id'] ), esc_attr( $amount_range ), esc_html( $price_field_labels ) ); |
|
| 479 | + printf('<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr($field_options['id']), esc_attr($amount_range), esc_html($price_field_labels)); |
|
| 482 | 480 | |
| 483 | - echo isset( $before_html ) ? $before_html : ''; |
|
| 481 | + echo isset($before_html) ? $before_html : ''; |
|
| 484 | 482 | ?> |
| 485 | 483 | <input |
| 486 | - name="<?php echo give_get_field_name( $field_options ); ?>[<?php echo esc_attr( $amount_range ); ?>]" |
|
| 484 | + name="<?php echo give_get_field_name($field_options); ?>[<?php echo esc_attr($amount_range); ?>]" |
|
| 487 | 485 | type="text" |
| 488 | 486 | id="<?php echo $field_options['id']; ?>_give_donation_limit_<?php echo $amount_range; ?>" |
| 489 | - data-range_type="<?php echo esc_attr( $amount_range ); ?>" |
|
| 490 | - value="<?php echo give_format_decimal( esc_attr( $field_options['value'][ $amount_range ] ) ); ?>" |
|
| 491 | - placeholder="<?php echo give_format_decimal( $field_options['options'][ $amount_range ] ); ?>" |
|
| 492 | - <?php echo give_get_custom_attributes( $field_options ); ?> |
|
| 487 | + data-range_type="<?php echo esc_attr($amount_range); ?>" |
|
| 488 | + value="<?php echo give_format_decimal(esc_attr($field_options['value'][$amount_range])); ?>" |
|
| 489 | + placeholder="<?php echo give_format_decimal($field_options['options'][$amount_range]); ?>" |
|
| 490 | + <?php echo give_get_custom_attributes($field_options); ?> |
|
| 493 | 491 | /> |
| 494 | 492 | <?php |
| 495 | - echo isset( $after_html ) ? $after_html : ''; |
|
| 493 | + echo isset($after_html) ? $after_html : ''; |
|
| 496 | 494 | echo '</span>'; |
| 497 | 495 | } |
| 498 | 496 | ?> |
| 499 | 497 | </span> |
| 500 | - <?php echo give_get_field_description( $field_options ); ?> |
|
| 498 | + <?php echo give_get_field_description($field_options); ?> |
|
| 501 | 499 | </p> |
| 502 | 500 | <?php |
| 503 | 501 | } |
@@ -520,29 +518,29 @@ discard block |
||
| 520 | 518 | * } |
| 521 | 519 | * @return void |
| 522 | 520 | */ |
| 523 | -function give_hidden_input( $field ) { |
|
| 521 | +function give_hidden_input($field) { |
|
| 524 | 522 | global $thepostid, $post; |
| 525 | 523 | |
| 526 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 527 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 524 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 525 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 528 | 526 | |
| 529 | 527 | // Custom attribute handling |
| 530 | 528 | $custom_attributes = array(); |
| 531 | 529 | |
| 532 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 530 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 533 | 531 | |
| 534 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 535 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 532 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 533 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 536 | 534 | } |
| 537 | 535 | } |
| 538 | 536 | ?> |
| 539 | 537 | |
| 540 | 538 | <input |
| 541 | 539 | type="hidden" |
| 542 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 543 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 544 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 545 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 540 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 541 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 542 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 543 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 546 | 544 | /> |
| 547 | 545 | <?php |
| 548 | 546 | } |
@@ -568,28 +566,28 @@ discard block |
||
| 568 | 566 | * } |
| 569 | 567 | * @return void |
| 570 | 568 | */ |
| 571 | -function give_textarea_input( $field ) { |
|
| 569 | +function give_textarea_input($field) { |
|
| 572 | 570 | global $thepostid, $post; |
| 573 | 571 | |
| 574 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 575 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 576 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 577 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 572 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 573 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 574 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 575 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 578 | 576 | $default_attributes = array( |
| 579 | 577 | 'cols' => 20, |
| 580 | 578 | 'rows' => 10 |
| 581 | 579 | ); |
| 582 | 580 | ?> |
| 583 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 584 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 581 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 582 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 585 | 583 | <textarea |
| 586 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 587 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 588 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 589 | - <?php echo give_get_attribute_str( $field, $default_attributes ); ?> |
|
| 590 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
| 584 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 585 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 586 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 587 | + <?php echo give_get_attribute_str($field, $default_attributes); ?> |
|
| 588 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
| 591 | 589 | <?php |
| 592 | - echo give_get_field_description( $field ); |
|
| 590 | + echo give_get_field_description($field); |
|
| 593 | 591 | echo '</p>'; |
| 594 | 592 | } |
| 595 | 593 | |
@@ -613,29 +611,29 @@ discard block |
||
| 613 | 611 | * } |
| 614 | 612 | * @return void |
| 615 | 613 | */ |
| 616 | -function give_wysiwyg( $field ) { |
|
| 614 | +function give_wysiwyg($field) { |
|
| 617 | 615 | global $thepostid, $post; |
| 618 | 616 | |
| 619 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 620 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 621 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 622 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 617 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 618 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 619 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 620 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 623 | 621 | |
| 624 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
| 622 | + $field['unique_field_id'] = give_get_field_name($field); |
|
| 625 | 623 | $editor_attributes = array( |
| 626 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
| 624 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
| 627 | 625 | 'textarea_rows' => '10', |
| 628 | - 'editor_css' => esc_attr( $field['style'] ), |
|
| 626 | + 'editor_css' => esc_attr($field['style']), |
|
| 629 | 627 | 'editor_class' => $field['attributes']['class'], |
| 630 | 628 | ); |
| 631 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
| 629 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
| 632 | 630 | $field['value'], |
| 633 | 631 | $field['unique_field_id'], |
| 634 | 632 | $editor_attributes, |
| 635 | - ) ) ) . '"'; |
|
| 636 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
| 633 | + ))).'"'; |
|
| 634 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
| 637 | 635 | |
| 638 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
| 636 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
| 639 | 637 | |
| 640 | 638 | wp_editor( |
| 641 | 639 | $field['value'], |
@@ -643,7 +641,7 @@ discard block |
||
| 643 | 641 | $editor_attributes |
| 644 | 642 | ); |
| 645 | 643 | |
| 646 | - echo give_get_field_description( $field ); |
|
| 644 | + echo give_get_field_description($field); |
|
| 647 | 645 | echo '</div>'; |
| 648 | 646 | } |
| 649 | 647 | |
@@ -668,29 +666,29 @@ discard block |
||
| 668 | 666 | * } |
| 669 | 667 | * @return void |
| 670 | 668 | */ |
| 671 | -function give_checkbox( $field ) { |
|
| 669 | +function give_checkbox($field) { |
|
| 672 | 670 | global $thepostid, $post; |
| 673 | 671 | |
| 674 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 675 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 676 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 677 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 678 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
| 679 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 672 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 673 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 674 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 675 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 676 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
| 677 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 680 | 678 | ?> |
| 681 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 682 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 679 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 680 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 683 | 681 | <input |
| 684 | 682 | type="checkbox" |
| 685 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 686 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 687 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 688 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
| 689 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
| 690 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 683 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 684 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 685 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 686 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
| 687 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
| 688 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 691 | 689 | /> |
| 692 | 690 | <?php |
| 693 | - echo give_get_field_description( $field ); |
|
| 691 | + echo give_get_field_description($field); |
|
| 694 | 692 | echo '</p>'; |
| 695 | 693 | } |
| 696 | 694 | |
@@ -716,29 +714,29 @@ discard block |
||
| 716 | 714 | * } |
| 717 | 715 | * @return void |
| 718 | 716 | */ |
| 719 | -function give_select( $field ) { |
|
| 717 | +function give_select($field) { |
|
| 720 | 718 | global $thepostid, $post; |
| 721 | 719 | |
| 722 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 723 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 724 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 725 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 726 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 720 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 721 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 722 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 723 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 724 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 727 | 725 | ?> |
| 728 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 729 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 726 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 727 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 730 | 728 | <select |
| 731 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 732 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 733 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
| 734 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 729 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 730 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 731 | + style="<?php echo esc_attr($field['style']) ?>" |
|
| 732 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 735 | 733 | > |
| 736 | 734 | <?php |
| 737 | - foreach ( $field['options'] as $key => $value ) { |
|
| 738 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
| 735 | + foreach ($field['options'] as $key => $value) { |
|
| 736 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
| 739 | 737 | } |
| 740 | 738 | echo '</select>'; |
| 741 | - echo give_get_field_description( $field ); |
|
| 739 | + echo give_get_field_description($field); |
|
| 742 | 740 | echo '</p>'; |
| 743 | 741 | } |
| 744 | 742 | |
@@ -765,32 +763,32 @@ discard block |
||
| 765 | 763 | * } |
| 766 | 764 | * @return void |
| 767 | 765 | */ |
| 768 | -function give_radio( $field ) { |
|
| 766 | +function give_radio($field) { |
|
| 769 | 767 | global $thepostid, $post; |
| 770 | 768 | |
| 771 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 772 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 773 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 774 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 775 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 769 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 770 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 771 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 772 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 773 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 776 | 774 | |
| 777 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
| 775 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
| 778 | 776 | |
| 779 | - foreach ( $field['options'] as $key => $value ) { |
|
| 777 | + foreach ($field['options'] as $key => $value) { |
|
| 780 | 778 | |
| 781 | 779 | echo '<li><label><input |
| 782 | - name="' . give_get_field_name( $field ) . '" |
|
| 783 | - value="' . esc_attr( $key ) . '" |
|
| 780 | + name="' . give_get_field_name($field).'" |
|
| 781 | + value="' . esc_attr($key).'" |
|
| 784 | 782 | type="radio" |
| 785 | - style="' . esc_attr( $field['style'] ) . '" |
|
| 786 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
| 787 | - . give_get_custom_attributes( $field ) . ' |
|
| 788 | - /> ' . esc_html( $value ) . '</label> |
|
| 783 | + style="' . esc_attr($field['style']).'" |
|
| 784 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
| 785 | + . give_get_custom_attributes($field).' |
|
| 786 | + /> ' . esc_html($value).'</label> |
|
| 789 | 787 | </li>'; |
| 790 | 788 | } |
| 791 | 789 | echo '</ul>'; |
| 792 | 790 | |
| 793 | - echo give_get_field_description( $field ); |
|
| 791 | + echo give_get_field_description($field); |
|
| 794 | 792 | echo '</fieldset>'; |
| 795 | 793 | } |
| 796 | 794 | |
@@ -814,27 +812,27 @@ discard block |
||
| 814 | 812 | * } |
| 815 | 813 | * @return void |
| 816 | 814 | */ |
| 817 | -function give_colorpicker( $field ) { |
|
| 815 | +function give_colorpicker($field) { |
|
| 818 | 816 | global $thepostid, $post; |
| 819 | 817 | |
| 820 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 821 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 822 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 823 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 824 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 818 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 819 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 820 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 821 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 822 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 825 | 823 | $field['type'] = 'text'; |
| 826 | 824 | ?> |
| 827 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 828 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 825 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 826 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 829 | 827 | <input |
| 830 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 831 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 832 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 833 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 834 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 828 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 829 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 830 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 831 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
| 832 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 835 | 833 | /> |
| 836 | 834 | <?php |
| 837 | - echo give_get_field_description( $field ); |
|
| 835 | + echo give_get_field_description($field); |
|
| 838 | 836 | echo '</p>'; |
| 839 | 837 | } |
| 840 | 838 | |
@@ -845,8 +843,8 @@ discard block |
||
| 845 | 843 | * |
| 846 | 844 | * @param array $field |
| 847 | 845 | */ |
| 848 | -function give_file( $field ) { |
|
| 849 | - give_media( $field ); |
|
| 846 | +function give_file($field) { |
|
| 847 | + give_media($field); |
|
| 850 | 848 | } |
| 851 | 849 | |
| 852 | 850 | |
@@ -857,37 +855,37 @@ discard block |
||
| 857 | 855 | * |
| 858 | 856 | * @param array $field |
| 859 | 857 | */ |
| 860 | -function give_media( $field ) { |
|
| 858 | +function give_media($field) { |
|
| 861 | 859 | global $thepostid, $post; |
| 862 | 860 | |
| 863 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 864 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $field['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
| 861 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 862 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $field['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
| 865 | 863 | |
| 866 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 867 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 868 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 869 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 864 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 865 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 866 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 867 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 870 | 868 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
| 871 | 869 | |
| 872 | 870 | // Allow developer to save attachment ID or attachment url as metadata. |
| 873 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
| 871 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
| 874 | 872 | |
| 875 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
| 876 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#'; |
|
| 877 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
| 878 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
| 873 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
| 874 | + $preview_image_src = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; |
|
| 875 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
| 876 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
| 879 | 877 | ?> |
| 880 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 881 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 878 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 879 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 882 | 880 | <input |
| 883 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 884 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 881 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 882 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 885 | 883 | type="text" |
| 886 | 884 | value="<?php echo $field['value']; ?>" |
| 887 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 888 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 885 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 886 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 889 | 887 | /> <input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>"> |
| 890 | - <?php echo give_get_field_description( $field ); ?> |
|
| 888 | + <?php echo give_get_field_description($field); ?> |
|
| 891 | 889 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
| 892 | 890 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
| 893 | 891 | <img src="<?php echo $preview_image_src; ?>" alt=""> |
@@ -905,27 +903,27 @@ discard block |
||
| 905 | 903 | * |
| 906 | 904 | * @return void |
| 907 | 905 | */ |
| 908 | -function give_default_gateway( $field ) { |
|
| 906 | +function give_default_gateway($field) { |
|
| 909 | 907 | global $thepostid, $post; |
| 910 | 908 | |
| 911 | 909 | // get all active payment gateways. |
| 912 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
| 910 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
| 913 | 911 | $field['options'] = array(); |
| 914 | 912 | |
| 915 | 913 | // Set field option value. |
| 916 | - if ( ! empty( $gateways ) ) { |
|
| 917 | - foreach ( $gateways as $key => $option ) { |
|
| 918 | - $field['options'][ $key ] = $option['admin_label']; |
|
| 914 | + if ( ! empty($gateways)) { |
|
| 915 | + foreach ($gateways as $key => $option) { |
|
| 916 | + $field['options'][$key] = $option['admin_label']; |
|
| 919 | 917 | } |
| 920 | 918 | } |
| 921 | 919 | |
| 922 | 920 | // Add a field to the Give Form admin single post view of this field |
| 923 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 924 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
| 921 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 922 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
| 925 | 923 | } |
| 926 | 924 | |
| 927 | 925 | // Render select field. |
| 928 | - give_select( $field ); |
|
| 926 | + give_select($field); |
|
| 929 | 927 | } |
| 930 | 928 | |
| 931 | 929 | /** |
@@ -947,13 +945,13 @@ discard block |
||
| 947 | 945 | * @return void |
| 948 | 946 | */ |
| 949 | 947 | |
| 950 | -function give_docs_link( $field ) { |
|
| 951 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 952 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
| 948 | +function give_docs_link($field) { |
|
| 949 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 950 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
| 953 | 951 | |
| 954 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
| 952 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
| 955 | 953 | . '" target="_blank">' |
| 956 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
| 954 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
| 957 | 955 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 958 | 956 | } |
| 959 | 957 | |
@@ -965,15 +963,15 @@ discard block |
||
| 965 | 963 | * |
| 966 | 964 | * @param $field |
| 967 | 965 | */ |
| 968 | -function give_email_preview_buttons( $field ) { |
|
| 966 | +function give_email_preview_buttons($field) { |
|
| 969 | 967 | /* @var WP_Post $post */ |
| 970 | 968 | global $post; |
| 971 | 969 | |
| 972 | - $field_id = str_replace( array( '_give_', '_preview_buttons' ), '', $field['id'] ); |
|
| 970 | + $field_id = str_replace(array('_give_', '_preview_buttons'), '', $field['id']); |
|
| 973 | 971 | |
| 974 | 972 | ob_start(); |
| 975 | 973 | |
| 976 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
| 974 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'; |
|
| 977 | 975 | |
| 978 | 976 | echo sprintf( |
| 979 | 977 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
@@ -1001,12 +999,12 @@ discard block |
||
| 1001 | 999 | 'form_id' => $post->ID, |
| 1002 | 1000 | ) |
| 1003 | 1001 | ), 'give-send-preview-email' ), |
| 1004 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
| 1005 | - esc_html__( 'Send Test Email', 'give' ) |
|
| 1002 | + esc_attr__('Send Test Email.', 'give'), |
|
| 1003 | + esc_html__('Send Test Email', 'give') |
|
| 1006 | 1004 | ); |
| 1007 | 1005 | |
| 1008 | - if ( ! empty( $field['description'] ) ) { |
|
| 1009 | - echo '<span class="give-field-description">' . wp_kses_post( $field['desc'] ) . '</span>'; |
|
| 1006 | + if ( ! empty($field['description'])) { |
|
| 1007 | + echo '<span class="give-field-description">'.wp_kses_post($field['desc']).'</span>'; |
|
| 1010 | 1008 | } |
| 1011 | 1009 | |
| 1012 | 1010 | echo '</p>'; |
@@ -1027,29 +1025,29 @@ discard block |
||
| 1027 | 1025 | * |
| 1028 | 1026 | * @return mixed |
| 1029 | 1027 | */ |
| 1030 | -function give_get_field_value( $field, $postid ) { |
|
| 1031 | - if ( isset( $field['attributes']['value'] ) ) { |
|
| 1028 | +function give_get_field_value($field, $postid) { |
|
| 1029 | + if (isset($field['attributes']['value'])) { |
|
| 1032 | 1030 | return $field['attributes']['value']; |
| 1033 | 1031 | } |
| 1034 | 1032 | |
| 1035 | 1033 | // If field is range slider. |
| 1036 | - if ( 'donation_limit' === $field['type'] ) { |
|
| 1034 | + if ('donation_limit' === $field['type']) { |
|
| 1037 | 1035 | |
| 1038 | 1036 | // Get minimum value. |
| 1039 | - $minimum = give_get_meta( $postid, $field['id'] . '_minimum', true ); |
|
| 1037 | + $minimum = give_get_meta($postid, $field['id'].'_minimum', true); |
|
| 1040 | 1038 | |
| 1041 | 1039 | // Give < 2.1 |
| 1042 | - if ( '_give_custom_amount_range' === $field['id'] && empty( $minimum ) ) { |
|
| 1043 | - $minimum = give_get_meta( $postid, '_give_custom_amount_minimum', true ); |
|
| 1040 | + if ('_give_custom_amount_range' === $field['id'] && empty($minimum)) { |
|
| 1041 | + $minimum = give_get_meta($postid, '_give_custom_amount_minimum', true); |
|
| 1044 | 1042 | } |
| 1045 | 1043 | |
| 1046 | 1044 | $field_value = array( |
| 1047 | 1045 | 'minimum' => $minimum, |
| 1048 | - 'maximum' => give_get_meta( $postid, $field['id'] . '_maximum', true ), |
|
| 1046 | + 'maximum' => give_get_meta($postid, $field['id'].'_maximum', true), |
|
| 1049 | 1047 | ); |
| 1050 | 1048 | } else { |
| 1051 | 1049 | // Get value from db. |
| 1052 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
| 1050 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
| 1053 | 1051 | } |
| 1054 | 1052 | |
| 1055 | 1053 | /** |
@@ -1059,10 +1057,10 @@ discard block |
||
| 1059 | 1057 | * |
| 1060 | 1058 | * @param mixed $field_value Field value. |
| 1061 | 1059 | */ |
| 1062 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
| 1060 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
| 1063 | 1061 | |
| 1064 | 1062 | // Set default value if no any data saved to db. |
| 1065 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
| 1063 | + if ( ! $field_value && isset($field['default'])) { |
|
| 1066 | 1064 | $field_value = $field['default']; |
| 1067 | 1065 | } |
| 1068 | 1066 | |
@@ -1079,20 +1077,20 @@ discard block |
||
| 1079 | 1077 | * |
| 1080 | 1078 | * @return string |
| 1081 | 1079 | */ |
| 1082 | -function give_get_field_description( $field ) { |
|
| 1080 | +function give_get_field_description($field) { |
|
| 1083 | 1081 | $field_desc_html = ''; |
| 1084 | 1082 | $description = ''; |
| 1085 | 1083 | |
| 1086 | 1084 | // Check for both `description` and `desc`. |
| 1087 | - if ( isset( $field['description'] ) ) { |
|
| 1085 | + if (isset($field['description'])) { |
|
| 1088 | 1086 | $description = $field['description']; |
| 1089 | - } elseif ( isset( $field['desc'] ) ) { |
|
| 1087 | + } elseif (isset($field['desc'])) { |
|
| 1090 | 1088 | $description = $field['desc']; |
| 1091 | 1089 | } |
| 1092 | 1090 | |
| 1093 | 1091 | // Set if there is a description. |
| 1094 | - if ( ! empty( $description ) ) { |
|
| 1095 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
| 1092 | + if ( ! empty($description)) { |
|
| 1093 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
| 1096 | 1094 | } |
| 1097 | 1095 | |
| 1098 | 1096 | return $field_desc_html; |
@@ -1112,8 +1110,8 @@ discard block |
||
| 1112 | 1110 | * |
| 1113 | 1111 | * @return string |
| 1114 | 1112 | */ |
| 1115 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
| 1116 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
| 1113 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
| 1114 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
| 1117 | 1115 | |
| 1118 | 1116 | /** |
| 1119 | 1117 | * Filter the specific repeater field value |
@@ -1122,7 +1120,7 @@ discard block |
||
| 1122 | 1120 | * |
| 1123 | 1121 | * @param string $field_id |
| 1124 | 1122 | */ |
| 1125 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
| 1123 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
| 1126 | 1124 | |
| 1127 | 1125 | /** |
| 1128 | 1126 | * Filter the repeater field value |
@@ -1131,7 +1129,7 @@ discard block |
||
| 1131 | 1129 | * |
| 1132 | 1130 | * @param string $field_id |
| 1133 | 1131 | */ |
| 1134 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
| 1132 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
| 1135 | 1133 | |
| 1136 | 1134 | return $field_value; |
| 1137 | 1135 | } |
@@ -1149,7 +1147,7 @@ discard block |
||
| 1149 | 1147 | * |
| 1150 | 1148 | * @return string |
| 1151 | 1149 | */ |
| 1152 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
| 1150 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
| 1153 | 1151 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 1154 | 1152 | |
| 1155 | 1153 | // Get field id. |
@@ -1162,7 +1160,7 @@ discard block |
||
| 1162 | 1160 | * |
| 1163 | 1161 | * @param string $field_id |
| 1164 | 1162 | */ |
| 1165 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
| 1163 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
| 1166 | 1164 | |
| 1167 | 1165 | /** |
| 1168 | 1166 | * Filter the repeater field id |
@@ -1171,7 +1169,7 @@ discard block |
||
| 1171 | 1169 | * |
| 1172 | 1170 | * @param string $field_id |
| 1173 | 1171 | */ |
| 1174 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
| 1172 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
| 1175 | 1173 | |
| 1176 | 1174 | return $field_id; |
| 1177 | 1175 | } |
@@ -1186,8 +1184,8 @@ discard block |
||
| 1186 | 1184 | * |
| 1187 | 1185 | * @return string |
| 1188 | 1186 | */ |
| 1189 | -function give_get_field_name( $field ) { |
|
| 1190 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
| 1187 | +function give_get_field_name($field) { |
|
| 1188 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
| 1191 | 1189 | |
| 1192 | 1190 | /** |
| 1193 | 1191 | * Filter the field name. |
@@ -1196,7 +1194,7 @@ discard block |
||
| 1196 | 1194 | * |
| 1197 | 1195 | * @param string $field_name |
| 1198 | 1196 | */ |
| 1199 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
| 1197 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
| 1200 | 1198 | |
| 1201 | 1199 | return $field_name; |
| 1202 | 1200 | } |
@@ -1213,40 +1211,40 @@ discard block |
||
| 1213 | 1211 | * |
| 1214 | 1212 | * @return void |
| 1215 | 1213 | */ |
| 1216 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
| 1214 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
| 1217 | 1215 | global $thepostid, $post; |
| 1218 | 1216 | |
| 1219 | 1217 | // Bailout. |
| 1220 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
| 1218 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
| 1221 | 1219 | return; |
| 1222 | 1220 | } |
| 1223 | 1221 | |
| 1224 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 1225 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 1226 | - $wrapper_class = isset( $fields['wrapper_class'] ) ? $fields['wrapper_class'] : ''; |
|
| 1222 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 1223 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 1224 | + $wrapper_class = isset($fields['wrapper_class']) ? $fields['wrapper_class'] : ''; |
|
| 1227 | 1225 | ?> |
| 1228 | - <div class="give-repeatable-field-section <?php echo esc_attr( $wrapper_class ); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
| 1226 | + <div class="give-repeatable-field-section <?php echo esc_attr($wrapper_class); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
| 1229 | 1227 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
| 1230 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
| 1228 | + <?php if ( ! empty($fields['name'])) : ?> |
|
| 1231 | 1229 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
| 1232 | 1230 | <?php endif; ?> |
| 1233 | 1231 | |
| 1234 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
| 1232 | + <?php if ( ! empty($fields['description'])) : ?> |
|
| 1235 | 1233 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
| 1236 | 1234 | <?php endif; ?> |
| 1237 | 1235 | |
| 1238 | 1236 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
| 1239 | 1237 | <?php |
| 1240 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
| 1241 | - $header_title = isset( $fields['options']['header_title'] ) |
|
| 1238 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
| 1239 | + $header_title = isset($fields['options']['header_title']) |
|
| 1242 | 1240 | ? $fields['options']['header_title'] |
| 1243 | - : esc_attr__( 'Group', 'give' ); |
|
| 1241 | + : esc_attr__('Group', 'give'); |
|
| 1244 | 1242 | |
| 1245 | 1243 | $add_default_donation_field = false; |
| 1246 | 1244 | |
| 1247 | 1245 | // Check if level is not created or we have to add default level. |
| 1248 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
| 1249 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
| 1246 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
| 1247 | + $repeater_field_values = array_values($repeater_field_values); |
|
| 1250 | 1248 | } else { |
| 1251 | 1249 | $fields_count = 1; |
| 1252 | 1250 | $add_default_donation_field = true; |
@@ -1259,77 +1257,77 @@ discard block |
||
| 1259 | 1257 | <div class="give-row-head give-move"> |
| 1260 | 1258 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
| 1261 | 1259 | </button> |
| 1262 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
| 1260 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
| 1263 | 1261 | <h2> |
| 1264 | 1262 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 1265 | 1263 | </h2> |
| 1266 | 1264 | </div> |
| 1267 | 1265 | <div class="give-row-body"> |
| 1268 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 1266 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 1269 | 1267 | <?php |
| 1270 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1268 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 1271 | 1269 | continue; |
| 1272 | 1270 | } |
| 1273 | 1271 | ?> |
| 1274 | 1272 | <?php |
| 1275 | 1273 | $field['repeat'] = true; |
| 1276 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
| 1274 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
| 1277 | 1275 | $field['id'] = str_replace( |
| 1278 | - array( '[', ']' ), |
|
| 1279 | - array( '_', '', ), |
|
| 1276 | + array('[', ']'), |
|
| 1277 | + array('_', '',), |
|
| 1280 | 1278 | $field['repeatable_field_id'] |
| 1281 | 1279 | ); |
| 1282 | 1280 | ?> |
| 1283 | - <?php give_render_field( $field ); ?> |
|
| 1281 | + <?php give_render_field($field); ?> |
|
| 1284 | 1282 | <?php endforeach; ?> |
| 1285 | 1283 | </div> |
| 1286 | 1284 | </td> |
| 1287 | 1285 | </tr> |
| 1288 | 1286 | |
| 1289 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
| 1287 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
| 1290 | 1288 | <!--Stored repeater field group--> |
| 1291 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
| 1289 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
| 1292 | 1290 | <tr class="give-row"> |
| 1293 | 1291 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 1294 | 1292 | <div class="give-row-head give-move"> |
| 1295 | 1293 | <button type="button" class="handlediv button-link"> |
| 1296 | 1294 | <span class="toggle-indicator"></span></button> |
| 1297 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 1295 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 1298 | 1296 | </span> |
| 1299 | 1297 | <h2> |
| 1300 | 1298 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 1301 | 1299 | </h2> |
| 1302 | 1300 | </div> |
| 1303 | 1301 | <div class="give-row-body"> |
| 1304 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 1305 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1302 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 1303 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 1306 | 1304 | continue; |
| 1307 | 1305 | } ?> |
| 1308 | 1306 | <?php |
| 1309 | 1307 | $field['repeat'] = true; |
| 1310 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
| 1311 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
| 1308 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
| 1309 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
| 1312 | 1310 | $field['id'] = str_replace( |
| 1313 | - array( '[', ']' ), |
|
| 1314 | - array( '_', '', ), |
|
| 1311 | + array('[', ']'), |
|
| 1312 | + array('_', '',), |
|
| 1315 | 1313 | $field['repeatable_field_id'] |
| 1316 | 1314 | ); |
| 1317 | 1315 | ?> |
| 1318 | - <?php give_render_field( $field ); ?> |
|
| 1316 | + <?php give_render_field($field); ?> |
|
| 1319 | 1317 | <?php endforeach; ?> |
| 1320 | 1318 | </div> |
| 1321 | 1319 | </td> |
| 1322 | 1320 | </tr> |
| 1323 | - <?php endforeach;; ?> |
|
| 1321 | + <?php endforeach; ; ?> |
|
| 1324 | 1322 | |
| 1325 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
| 1323 | + <?php elseif ($add_default_donation_field) : ?> |
|
| 1326 | 1324 | <!--Default repeater field group--> |
| 1327 | 1325 | <tr class="give-row"> |
| 1328 | 1326 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 1329 | 1327 | <div class="give-row-head give-move"> |
| 1330 | 1328 | <button type="button" class="handlediv button-link"> |
| 1331 | 1329 | <span class="toggle-indicator"></span></button> |
| 1332 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 1330 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 1333 | 1331 | </span> |
| 1334 | 1332 | <h2> |
| 1335 | 1333 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1337,25 +1335,25 @@ discard block |
||
| 1337 | 1335 | </div> |
| 1338 | 1336 | <div class="give-row-body"> |
| 1339 | 1337 | <?php |
| 1340 | - foreach ( $fields['fields'] as $field ) : |
|
| 1341 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1338 | + foreach ($fields['fields'] as $field) : |
|
| 1339 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 1342 | 1340 | continue; |
| 1343 | 1341 | } |
| 1344 | 1342 | |
| 1345 | 1343 | $field['repeat'] = true; |
| 1346 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
| 1344 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
| 1347 | 1345 | $field['attributes']['value'] = apply_filters( |
| 1348 | 1346 | "give_default_field_group_field_{$field['id']}_value", |
| 1349 | - ( ! empty( $field['default'] ) ? $field['default'] : '' ), |
|
| 1347 | + ( ! empty($field['default']) ? $field['default'] : ''), |
|
| 1350 | 1348 | $field, |
| 1351 | 1349 | $fields |
| 1352 | 1350 | ); |
| 1353 | - $field['id'] = str_replace( |
|
| 1354 | - array( '[', ']' ), |
|
| 1355 | - array( '_', '', ), |
|
| 1351 | + $field['id'] = str_replace( |
|
| 1352 | + array('[', ']'), |
|
| 1353 | + array('_', '',), |
|
| 1356 | 1354 | $field['repeatable_field_id'] |
| 1357 | 1355 | ); |
| 1358 | - give_render_field( $field ); |
|
| 1356 | + give_render_field($field); |
|
| 1359 | 1357 | |
| 1360 | 1358 | endforeach; |
| 1361 | 1359 | ?> |
@@ -1367,9 +1365,9 @@ discard block |
||
| 1367 | 1365 | <tfoot> |
| 1368 | 1366 | <tr> |
| 1369 | 1367 | <?php |
| 1370 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
| 1368 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
| 1371 | 1369 | ? $add_row_btn_title = $fields['options']['add_button'] |
| 1372 | - : esc_html__( 'Add Row', 'give' ); |
|
| 1370 | + : esc_html__('Add Row', 'give'); |
|
| 1373 | 1371 | ?> |
| 1374 | 1372 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
| 1375 | 1373 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1399,10 +1397,10 @@ discard block |
||
| 1399 | 1397 | * |
| 1400 | 1398 | * @param string |
| 1401 | 1399 | */ |
| 1402 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
| 1400 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
| 1403 | 1401 | |
| 1404 | 1402 | // Get current tab. |
| 1405 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
| 1403 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
| 1406 | 1404 | |
| 1407 | 1405 | // Output. |
| 1408 | 1406 | return $current_tab; |
@@ -1426,10 +1424,10 @@ discard block |
||
| 1426 | 1424 | * |
| 1427 | 1425 | * @param string |
| 1428 | 1426 | */ |
| 1429 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
| 1427 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
| 1430 | 1428 | |
| 1431 | 1429 | // Get current section. |
| 1432 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
| 1430 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
| 1433 | 1431 | |
| 1434 | 1432 | // Output. |
| 1435 | 1433 | return $current_section; |
@@ -1443,7 +1441,7 @@ discard block |
||
| 1443 | 1441 | */ |
| 1444 | 1442 | function give_get_current_setting_page() { |
| 1445 | 1443 | // Get current page. |
| 1446 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
| 1444 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
| 1447 | 1445 | |
| 1448 | 1446 | // Output. |
| 1449 | 1447 | return $setting_page; |
@@ -1463,13 +1461,13 @@ discard block |
||
| 1463 | 1461 | * |
| 1464 | 1462 | * @return string |
| 1465 | 1463 | */ |
| 1466 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
| 1467 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
| 1464 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
| 1465 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
| 1468 | 1466 | |
| 1469 | 1467 | if ( |
| 1470 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
| 1468 | + ! give_get_meta($postid, '_give_display_content', true) |
|
| 1471 | 1469 | && $show_content |
| 1472 | - && ( 'none' !== $show_content ) |
|
| 1470 | + && ('none' !== $show_content) |
|
| 1473 | 1471 | ) { |
| 1474 | 1472 | $field_value = 'enabled'; |
| 1475 | 1473 | } |
@@ -1477,7 +1475,7 @@ discard block |
||
| 1477 | 1475 | return $field_value; |
| 1478 | 1476 | } |
| 1479 | 1477 | |
| 1480 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
| 1478 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
| 1481 | 1479 | |
| 1482 | 1480 | |
| 1483 | 1481 | /** |
@@ -1494,12 +1492,12 @@ discard block |
||
| 1494 | 1492 | * |
| 1495 | 1493 | * @return string |
| 1496 | 1494 | */ |
| 1497 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
| 1498 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
| 1495 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
| 1496 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
| 1499 | 1497 | |
| 1500 | 1498 | if ( |
| 1501 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
| 1502 | - && ( 'none' !== $show_content ) |
|
| 1499 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
| 1500 | + && ('none' !== $show_content) |
|
| 1503 | 1501 | ) { |
| 1504 | 1502 | $field_value = $show_content; |
| 1505 | 1503 | } |
@@ -1507,7 +1505,7 @@ discard block |
||
| 1507 | 1505 | return $field_value; |
| 1508 | 1506 | } |
| 1509 | 1507 | |
| 1510 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
| 1508 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
| 1511 | 1509 | |
| 1512 | 1510 | |
| 1513 | 1511 | /** |
@@ -1523,17 +1521,17 @@ discard block |
||
| 1523 | 1521 | * |
| 1524 | 1522 | * @return string |
| 1525 | 1523 | */ |
| 1526 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
| 1527 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
| 1524 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
| 1525 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
| 1528 | 1526 | |
| 1529 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
| 1530 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
| 1527 | + if (in_array($term_option, array('none', 'yes'))) { |
|
| 1528 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
| 1531 | 1529 | } |
| 1532 | 1530 | |
| 1533 | 1531 | return $field_value; |
| 1534 | 1532 | } |
| 1535 | 1533 | |
| 1536 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
| 1534 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
| 1537 | 1535 | |
| 1538 | 1536 | |
| 1539 | 1537 | /** |
@@ -1550,17 +1548,17 @@ discard block |
||
| 1550 | 1548 | * |
| 1551 | 1549 | * @return string |
| 1552 | 1550 | */ |
| 1553 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
| 1554 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
| 1551 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
| 1552 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
| 1555 | 1553 | |
| 1556 | - if ( 'on' === $offline_donation ) { |
|
| 1554 | + if ('on' === $offline_donation) { |
|
| 1557 | 1555 | $field_value = 'enabled'; |
| 1558 | 1556 | } |
| 1559 | 1557 | |
| 1560 | 1558 | return $field_value; |
| 1561 | 1559 | } |
| 1562 | 1560 | |
| 1563 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
| 1561 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
| 1564 | 1562 | |
| 1565 | 1563 | |
| 1566 | 1564 | /** |
@@ -1576,17 +1574,17 @@ discard block |
||
| 1576 | 1574 | * |
| 1577 | 1575 | * @return string |
| 1578 | 1576 | */ |
| 1579 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
| 1580 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
| 1577 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
| 1578 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
| 1581 | 1579 | |
| 1582 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
| 1583 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
| 1580 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
| 1581 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
| 1584 | 1582 | } |
| 1585 | 1583 | |
| 1586 | 1584 | return $field_value; |
| 1587 | 1585 | } |
| 1588 | 1586 | |
| 1589 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
| 1587 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
| 1590 | 1588 | |
| 1591 | 1589 | |
| 1592 | 1590 | /** |
@@ -1602,17 +1600,17 @@ discard block |
||
| 1602 | 1600 | * |
| 1603 | 1601 | * @return string |
| 1604 | 1602 | */ |
| 1605 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
| 1606 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
| 1603 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
| 1604 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
| 1607 | 1605 | |
| 1608 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
| 1609 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
| 1606 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
| 1607 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
| 1610 | 1608 | } |
| 1611 | 1609 | |
| 1612 | 1610 | return $field_value; |
| 1613 | 1611 | } |
| 1614 | 1612 | |
| 1615 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
| 1613 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
| 1616 | 1614 | |
| 1617 | 1615 | /** |
| 1618 | 1616 | * Set value for Donation Goal --> close Form. |
@@ -1628,17 +1626,17 @@ discard block |
||
| 1628 | 1626 | * |
| 1629 | 1627 | * @return string |
| 1630 | 1628 | */ |
| 1631 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
| 1632 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
| 1629 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
| 1630 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
| 1633 | 1631 | |
| 1634 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
| 1635 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
| 1632 | + if (in_array($close_form, array('yes', 'no'))) { |
|
| 1633 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
| 1636 | 1634 | } |
| 1637 | 1635 | |
| 1638 | 1636 | return $field_value; |
| 1639 | 1637 | } |
| 1640 | 1638 | |
| 1641 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
| 1639 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
| 1642 | 1640 | |
| 1643 | 1641 | |
| 1644 | 1642 | /** |
@@ -1654,17 +1652,17 @@ discard block |
||
| 1654 | 1652 | * |
| 1655 | 1653 | * @return string |
| 1656 | 1654 | */ |
| 1657 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
| 1658 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
| 1655 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
| 1656 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
| 1659 | 1657 | |
| 1660 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
| 1661 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
| 1658 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
| 1659 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
| 1662 | 1660 | } |
| 1663 | 1661 | |
| 1664 | 1662 | return $field_value; |
| 1665 | 1663 | } |
| 1666 | 1664 | |
| 1667 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
| 1665 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
| 1668 | 1666 | |
| 1669 | 1667 | /** |
| 1670 | 1668 | * Set value for Offline Donations --> Offline Donations. |
@@ -1680,17 +1678,17 @@ discard block |
||
| 1680 | 1678 | * |
| 1681 | 1679 | * @return string |
| 1682 | 1680 | */ |
| 1683 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
| 1684 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
| 1681 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
| 1682 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
| 1685 | 1683 | |
| 1686 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
| 1687 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
| 1684 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
| 1685 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
| 1688 | 1686 | } |
| 1689 | 1687 | |
| 1690 | 1688 | return $field_value; |
| 1691 | 1689 | } |
| 1692 | 1690 | |
| 1693 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
| 1691 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
| 1694 | 1692 | |
| 1695 | 1693 | |
| 1696 | 1694 | /** |
@@ -1705,14 +1703,14 @@ discard block |
||
| 1705 | 1703 | * |
| 1706 | 1704 | * @return mixed |
| 1707 | 1705 | */ |
| 1708 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
| 1706 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
| 1709 | 1707 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 1710 | 1708 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
| 1711 | 1709 | |
| 1712 | 1710 | return $field_id; |
| 1713 | 1711 | } |
| 1714 | 1712 | |
| 1715 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
| 1713 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
| 1716 | 1714 | |
| 1717 | 1715 | /** |
| 1718 | 1716 | * Set repeater field value for multi donation form. |
@@ -1726,13 +1724,13 @@ discard block |
||
| 1726 | 1724 | * |
| 1727 | 1725 | * @return mixed |
| 1728 | 1726 | */ |
| 1729 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
| 1730 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
| 1727 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
| 1728 | + $field_value = $field_group[$field['id']]['level_id']; |
|
| 1731 | 1729 | |
| 1732 | 1730 | return $field_value; |
| 1733 | 1731 | } |
| 1734 | 1732 | |
| 1735 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
| 1733 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
| 1736 | 1734 | |
| 1737 | 1735 | /** |
| 1738 | 1736 | * Set default value for _give_id field. |
@@ -1743,11 +1741,11 @@ discard block |
||
| 1743 | 1741 | * |
| 1744 | 1742 | * @return string |
| 1745 | 1743 | */ |
| 1746 | -function _give_set_field_give_id_default_value( $field ) { |
|
| 1744 | +function _give_set_field_give_id_default_value($field) { |
|
| 1747 | 1745 | return 0; |
| 1748 | 1746 | } |
| 1749 | 1747 | |
| 1750 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
| 1748 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
| 1751 | 1749 | |
| 1752 | 1750 | /** |
| 1753 | 1751 | * Set default value for _give_default field. |
@@ -1758,11 +1756,11 @@ discard block |
||
| 1758 | 1756 | * |
| 1759 | 1757 | * @return string |
| 1760 | 1758 | */ |
| 1761 | -function _give_set_field_give_default_default_value( $field ) { |
|
| 1759 | +function _give_set_field_give_default_default_value($field) { |
|
| 1762 | 1760 | return 'default'; |
| 1763 | 1761 | } |
| 1764 | 1762 | |
| 1765 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
| 1763 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
| 1766 | 1764 | |
| 1767 | 1765 | /** |
| 1768 | 1766 | * Set repeater field editor id for field type wysiwyg. |
@@ -1774,15 +1772,15 @@ discard block |
||
| 1774 | 1772 | * |
| 1775 | 1773 | * @return string |
| 1776 | 1774 | */ |
| 1777 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
| 1778 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
| 1779 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
| 1775 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
| 1776 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
| 1777 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
| 1780 | 1778 | } |
| 1781 | 1779 | |
| 1782 | 1780 | return $field_name; |
| 1783 | 1781 | } |
| 1784 | 1782 | |
| 1785 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
| 1783 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
| 1786 | 1784 | |
| 1787 | 1785 | /** |
| 1788 | 1786 | * Output Donation form radio input box. |
@@ -1807,45 +1805,45 @@ discard block |
||
| 1807 | 1805 | * } |
| 1808 | 1806 | * @return void |
| 1809 | 1807 | */ |
| 1810 | -function give_donation_form_goal( $field ) { |
|
| 1808 | +function give_donation_form_goal($field) { |
|
| 1811 | 1809 | global $thepostid, $post; |
| 1812 | 1810 | |
| 1813 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 1814 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 1815 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 1816 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 1817 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 1811 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 1812 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 1813 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 1814 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 1815 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 1818 | 1816 | |
| 1819 | 1817 | |
| 1820 | 1818 | printf( |
| 1821 | 1819 | '<fieldset class="give-field-wrap %s_field %s">', |
| 1822 | - esc_attr( $field['id'] ), |
|
| 1823 | - esc_attr( $field['wrapper_class'] ) |
|
| 1820 | + esc_attr($field['id']), |
|
| 1821 | + esc_attr($field['wrapper_class']) |
|
| 1824 | 1822 | ); |
| 1825 | 1823 | |
| 1826 | 1824 | printf( |
| 1827 | 1825 | '<span class="give-field-label">%s</span>', |
| 1828 | - esc_html( $field['name'] ) |
|
| 1826 | + esc_html($field['name']) |
|
| 1829 | 1827 | ); |
| 1830 | 1828 | |
| 1831 | 1829 | printf( |
| 1832 | 1830 | '<legend class="screen-reader-text">%s</legend>', |
| 1833 | - esc_html( $field['name'] ) |
|
| 1831 | + esc_html($field['name']) |
|
| 1834 | 1832 | ); |
| 1835 | 1833 | ?> |
| 1836 | 1834 | |
| 1837 | 1835 | <ul class="give-radios"> |
| 1838 | 1836 | <?php |
| 1839 | - foreach ( $field['options'] as $key => $value ) { |
|
| 1840 | - $attributes = empty( $field['attributes'] ) ? '' : give_get_attribute_str( $field['attributes'] ); |
|
| 1837 | + foreach ($field['options'] as $key => $value) { |
|
| 1838 | + $attributes = empty($field['attributes']) ? '' : give_get_attribute_str($field['attributes']); |
|
| 1841 | 1839 | printf( |
| 1842 | 1840 | '<li><label><input name="%s" value="%s" type="radio" style="%s" %s %s /> %s </label></li>', |
| 1843 | - give_get_field_name( $field ), |
|
| 1844 | - esc_attr( $key ), |
|
| 1845 | - esc_attr( $field['style'] ), |
|
| 1846 | - checked( esc_attr( $field['value'] ), esc_attr( $key ), false ), |
|
| 1841 | + give_get_field_name($field), |
|
| 1842 | + esc_attr($key), |
|
| 1843 | + esc_attr($field['style']), |
|
| 1844 | + checked(esc_attr($field['value']), esc_attr($key), false), |
|
| 1847 | 1845 | $attributes, |
| 1848 | - esc_html( $value ) |
|
| 1846 | + esc_html($value) |
|
| 1849 | 1847 | ); |
| 1850 | 1848 | } |
| 1851 | 1849 | ?> |
@@ -1859,9 +1857,9 @@ discard block |
||
| 1859 | 1857 | * |
| 1860 | 1858 | * @param array $field Array of radio field arguments. |
| 1861 | 1859 | */ |
| 1862 | - do_action( 'give_donation_form_goal_before_description', $field ); |
|
| 1860 | + do_action('give_donation_form_goal_before_description', $field); |
|
| 1863 | 1861 | |
| 1864 | - echo give_get_field_description( $field ); |
|
| 1862 | + echo give_get_field_description($field); |
|
| 1865 | 1863 | |
| 1866 | 1864 | echo '</fieldset>'; |
| 1867 | 1865 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Exit if accessed directly. |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | * 'testing' => false, // (required) Never leave as "true" in production!!! |
| 36 | 36 | * } |
| 37 | 37 | */ |
| 38 | - function __construct( $_banner_details ) { |
|
| 38 | + function __construct($_banner_details) { |
|
| 39 | 39 | global $give_addons, $pagenow; |
| 40 | 40 | |
| 41 | 41 | // Append add-on information to the global variable. |
| 42 | 42 | $give_addons[] = $_banner_details; |
| 43 | 43 | |
| 44 | - if ( 'plugins.php' === $pagenow ) { |
|
| 44 | + if ('plugins.php' === $pagenow) { |
|
| 45 | 45 | |
| 46 | 46 | // Get the current user. |
| 47 | 47 | $current_user = wp_get_current_user(); |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | $this->add_addon_activate_meta(); |
| 55 | 55 | |
| 56 | 56 | // Check if notice callback is already hooked. |
| 57 | - if ( ! $this->is_banner_notice_hooked() ) { |
|
| 57 | + if ( ! $this->is_banner_notice_hooked()) { |
|
| 58 | 58 | // If multiple add-on are activated then show activation banner in tab view. |
| 59 | - add_action( 'admin_notices', array( $this, 'addon_activation_banner_notices' ), 10 ); |
|
| 59 | + add_action('admin_notices', array($this, 'addon_activation_banner_notices'), 10); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return string |
| 71 | 71 | */ |
| 72 | - public static function get_banner_user_meta_key( $addon_banner_key ) { |
|
| 73 | - $addon_slug = sanitize_text_field( $addon_banner_key ); |
|
| 72 | + public static function get_banner_user_meta_key($addon_banner_key) { |
|
| 73 | + $addon_slug = sanitize_text_field($addon_banner_key); |
|
| 74 | 74 | |
| 75 | 75 | return "give_addon_{$addon_slug}_active_by_user"; |
| 76 | 76 | } |
@@ -85,24 +85,24 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function init() { |
| 87 | 87 | // Get the current page to add the notice to |
| 88 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
| 88 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
| 89 | 89 | |
| 90 | 90 | // Get the Give add-ons. |
| 91 | 91 | $give_addons = $this->get_plugin_file_names(); |
| 92 | 92 | |
| 93 | - if ( ! empty( $give_addons ) ) { |
|
| 93 | + if ( ! empty($give_addons)) { |
|
| 94 | 94 | |
| 95 | 95 | // Go through each of the add-on and hook deactivate action. |
| 96 | - foreach ( $give_addons as $addon_name => $give_addon ) { |
|
| 96 | + foreach ($give_addons as $addon_name => $give_addon) { |
|
| 97 | 97 | |
| 98 | 98 | // Testing? |
| 99 | - if ( true === $give_addon['testing'] ) { |
|
| 100 | - $nag_meta_key = 'give_addon_activation_ignore_' . $addon_name; |
|
| 101 | - delete_user_meta( $this->user_id, $nag_meta_key ); |
|
| 99 | + if (true === $give_addon['testing']) { |
|
| 100 | + $nag_meta_key = 'give_addon_activation_ignore_'.$addon_name; |
|
| 101 | + delete_user_meta($this->user_id, $nag_meta_key); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // Add deactivate hook. |
| 105 | - add_action( 'deactivate_' . $give_addon['plugin_main_file'], array( $this, 'remove_addon_activate_meta' ) ); |
|
| 105 | + add_action('deactivate_'.$give_addon['plugin_main_file'], array($this, 'remove_addon_activate_meta')); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -118,29 +118,29 @@ discard block |
||
| 118 | 118 | global $give_addons; |
| 119 | 119 | |
| 120 | 120 | // Get recently activated plugins. |
| 121 | - $active_plugins = get_option( 'active_plugins' ); |
|
| 121 | + $active_plugins = get_option('active_plugins'); |
|
| 122 | 122 | |
| 123 | 123 | $file_names = array(); |
| 124 | 124 | |
| 125 | - if ( empty( $give_addons ) ) { |
|
| 125 | + if (empty($give_addons)) { |
|
| 126 | 126 | return $file_names; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // Go through each addon and get the plugin file url. |
| 130 | - foreach ( $give_addons as $give_addon ) { |
|
| 130 | + foreach ($give_addons as $give_addon) { |
|
| 131 | 131 | $file_name = ''; |
| 132 | - $file_path = explode( '/plugins/', $give_addon['file'] ); |
|
| 133 | - if ( $file_path ) { |
|
| 134 | - $file_path = array_pop( $file_path ); |
|
| 135 | - $file_name = current( explode( '/', $file_path ) ); |
|
| 132 | + $file_path = explode('/plugins/', $give_addon['file']); |
|
| 133 | + if ($file_path) { |
|
| 134 | + $file_path = array_pop($file_path); |
|
| 135 | + $file_name = current(explode('/', $file_path)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if ( ! empty( $file_name ) ) { |
|
| 139 | - foreach ( $active_plugins as $plugin ) { |
|
| 140 | - if ( false !== strpos( $plugin, $file_name ) ) { |
|
| 141 | - $add_on_key = sanitize_title( $give_addon['name'] ); |
|
| 138 | + if ( ! empty($file_name)) { |
|
| 139 | + foreach ($active_plugins as $plugin) { |
|
| 140 | + if (false !== strpos($plugin, $file_name)) { |
|
| 141 | + $add_on_key = sanitize_title($give_addon['name']); |
|
| 142 | 142 | $give_addon['plugin_main_file'] = $plugin; // Include plugin file. |
| 143 | - $file_names[ $add_on_key ] = $give_addon; |
|
| 143 | + $file_names[$add_on_key] = $give_addon; |
|
| 144 | 144 | break; |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -160,16 +160,16 @@ discard block |
||
| 160 | 160 | // Get all activated add-ons. |
| 161 | 161 | $give_addons = $this->get_plugin_file_names(); |
| 162 | 162 | |
| 163 | - if ( ! empty( $give_addons ) ) { |
|
| 163 | + if ( ! empty($give_addons)) { |
|
| 164 | 164 | |
| 165 | 165 | // Go through rach add-ons and add meta data. |
| 166 | - foreach ( $give_addons as $banner_addon_name => $addon ) { |
|
| 166 | + foreach ($give_addons as $banner_addon_name => $addon) { |
|
| 167 | 167 | |
| 168 | 168 | // User meta key. |
| 169 | - $user_id = __give_get_active_by_user_meta( $banner_addon_name ); |
|
| 169 | + $user_id = __give_get_active_by_user_meta($banner_addon_name); |
|
| 170 | 170 | |
| 171 | - if ( ! $user_id ) { |
|
| 172 | - update_option( self::get_banner_user_meta_key( $banner_addon_name ), $this->user_id, false ); |
|
| 171 | + if ( ! $user_id) { |
|
| 172 | + update_option(self::get_banner_user_meta_key($banner_addon_name), $this->user_id, false); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | global $wp_filter; |
| 187 | 187 | $notice_already_hooked = false; |
| 188 | 188 | |
| 189 | - if ( isset( $wp_filter['admin_notices']->callbacks[10] ) ) { |
|
| 189 | + if (isset($wp_filter['admin_notices']->callbacks[10])) { |
|
| 190 | 190 | // Get all of the hooks. |
| 191 | - $admin_notice_callbacks = array_keys( $wp_filter['admin_notices']->callbacks[10] ); |
|
| 191 | + $admin_notice_callbacks = array_keys($wp_filter['admin_notices']->callbacks[10]); |
|
| 192 | 192 | |
| 193 | - if ( ! empty( $admin_notice_callbacks ) ) { |
|
| 194 | - foreach ( $admin_notice_callbacks as $key ) { |
|
| 193 | + if ( ! empty($admin_notice_callbacks)) { |
|
| 194 | + foreach ($admin_notice_callbacks as $key) { |
|
| 195 | 195 | //If the key is found in your string, set $found to true |
| 196 | - if ( false !== strpos( $key, 'addon_activation_banner_notices' ) ) { |
|
| 196 | + if (false !== strpos($key, 'addon_activation_banner_notices')) { |
|
| 197 | 197 | $notice_already_hooked = true; |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | global $pagenow, $give_addons; |
| 213 | 213 | |
| 214 | 214 | // Bailout. |
| 215 | - if ( 'plugins.php' !== $pagenow ) { |
|
| 215 | + if ('plugins.php' !== $pagenow) { |
|
| 216 | 216 | return false; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -224,55 +224,55 @@ discard block |
||
| 224 | 224 | $latest_addon = array(); |
| 225 | 225 | |
| 226 | 226 | // Get the plugin folder name, because many give-addon not sending proper plugin_file. |
| 227 | - if ( ! empty( $recent_activated ) ) { |
|
| 228 | - foreach ( $recent_activated as $recent_addon ) { |
|
| 227 | + if ( ! empty($recent_activated)) { |
|
| 228 | + foreach ($recent_activated as $recent_addon) { |
|
| 229 | 229 | // Get the add-on folder name. |
| 230 | - $latest_addon[] = substr( $recent_addon, 0, strpos( $recent_addon, '/' ) ); |
|
| 230 | + $latest_addon[] = substr($recent_addon, 0, strpos($recent_addon, '/')); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Go through each of the give add-on. |
| 235 | - foreach ( $give_addons as $addon ) { |
|
| 236 | - $addon_sanitized_name = sanitize_title( $addon['name'] ); |
|
| 235 | + foreach ($give_addons as $addon) { |
|
| 236 | + $addon_sanitized_name = sanitize_title($addon['name']); |
|
| 237 | 237 | |
| 238 | 238 | // Get the add-on dismiss status. |
| 239 | - $add_on_state = get_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true ); |
|
| 239 | + $add_on_state = get_user_meta($this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true); |
|
| 240 | 240 | |
| 241 | 241 | // Get the option key. |
| 242 | - $activate_by_user = (int) __give_get_active_by_user_meta( $addon_sanitized_name ); |
|
| 242 | + $activate_by_user = (int) __give_get_active_by_user_meta($addon_sanitized_name); |
|
| 243 | 243 | |
| 244 | 244 | // Remove plugin file and get the Add-on's folder name only. |
| 245 | - $file_path = $this->get_plugin_folder_name( $addon['file'] ); |
|
| 245 | + $file_path = $this->get_plugin_folder_name($addon['file']); |
|
| 246 | 246 | |
| 247 | 247 | // If add-on were never dismissed. |
| 248 | - if ( 'true' !== $add_on_state && $this->user_id === $activate_by_user ) { |
|
| 249 | - if ( ! empty( $latest_addon ) && ( in_array( $file_path, $latest_addon, true ) || empty( $latest_addon ) ) ) { |
|
| 248 | + if ('true' !== $add_on_state && $this->user_id === $activate_by_user) { |
|
| 249 | + if ( ! empty($latest_addon) && (in_array($file_path, $latest_addon, true) || empty($latest_addon))) { |
|
| 250 | 250 | $addon_to_display[] = $addon; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( ! empty( $addon_to_display ) ) { |
|
| 255 | + if ( ! empty($addon_to_display)) { |
|
| 256 | 256 | ob_start(); |
| 257 | 257 | |
| 258 | 258 | // Output inline styles here because there's no reason |
| 259 | 259 | // to enqueued them after the alert is dismissed. |
| 260 | 260 | $this->print_css_js(); |
| 261 | 261 | ?> |
| 262 | - <div class="<?php echo ( 1 !== count( $addon_to_display ) ) ? 'give-alert-tab-wrapper' : ''; ?> updated give-addon-alert give-notice"> |
|
| 262 | + <div class="<?php echo (1 !== count($addon_to_display)) ? 'give-alert-tab-wrapper' : ''; ?> updated give-addon-alert give-notice"> |
|
| 263 | 263 | <?php |
| 264 | 264 | // If multiple add-on are activated. |
| 265 | - if ( 1 !== count( $addon_to_display ) ) { |
|
| 265 | + if (1 !== count($addon_to_display)) { |
|
| 266 | 266 | ?> |
| 267 | 267 | <div class="give-vertical-tab"> |
| 268 | 268 | <div class="give-addon-tab-list"> |
| 269 | 269 | <ul class="give-alert-addon-list"> |
| 270 | 270 | <?php |
| 271 | 271 | $is_first = true; |
| 272 | - foreach ( $addon_to_display as $banner ) { |
|
| 272 | + foreach ($addon_to_display as $banner) { |
|
| 273 | 273 | ?> |
| 274 | - <li class="give-tab-list<?php echo ( true === $is_first ) ? ' active' : ''; ?>" id="give-addon-<?php echo esc_attr( basename( $banner['file'], '.php' ) ); ?>"> |
|
| 275 | - <a href="#"><?php echo esc_html( $banner['name'] ); ?></a> |
|
| 274 | + <li class="give-tab-list<?php echo (true === $is_first) ? ' active' : ''; ?>" id="give-addon-<?php echo esc_attr(basename($banner['file'], '.php')); ?>"> |
|
| 275 | + <a href="#"><?php echo esc_html($banner['name']); ?></a> |
|
| 276 | 276 | </li> |
| 277 | 277 | <?php |
| 278 | 278 | $is_first = false; |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | </ul> |
| 283 | 283 | </div> |
| 284 | 284 | <div class="give-right-side-block"> |
| 285 | - <?php foreach ( $addon_to_display as $banner ) : ?> |
|
| 286 | - <div class="give-tab-details <?php echo ( true === $is_first ) ? ' active' : ''; ?> " id="give-addon-<?php echo esc_attr( basename( $banner['file'], '.php' ) ); ?>"> |
|
| 285 | + <?php foreach ($addon_to_display as $banner) : ?> |
|
| 286 | + <div class="give-tab-details <?php echo (true === $is_first) ? ' active' : ''; ?> " id="give-addon-<?php echo esc_attr(basename($banner['file'], '.php')); ?>"> |
|
| 287 | 287 | <?php |
| 288 | 288 | // Render single add banner. |
| 289 | - $this->render_single_addon_banner( $banner, false ); |
|
| 289 | + $this->render_single_addon_banner($banner, false); |
|
| 290 | 290 | $is_first = false; |
| 291 | 291 | ?> |
| 292 | 292 | </div> |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | </div> |
| 296 | 296 | <?php |
| 297 | 297 | } else { |
| 298 | - $this->render_single_addon_banner( $addon_to_display[0], true ); |
|
| 298 | + $this->render_single_addon_banner($addon_to_display[0], true); |
|
| 299 | 299 | } |
| 300 | 300 | ?> |
| 301 | 301 | </div> |
@@ -303,12 +303,12 @@ discard block |
||
| 303 | 303 | $notice_html = ob_get_clean(); |
| 304 | 304 | |
| 305 | 305 | // Register notice. |
| 306 | - Give()->notices->register_notice( array( |
|
| 306 | + Give()->notices->register_notice(array( |
|
| 307 | 307 | 'id' => 'give_add_on_activation_notice', |
| 308 | 308 | 'type' => 'updated', |
| 309 | 309 | 'description_html' => $notice_html, |
| 310 | 310 | 'show' => true, |
| 311 | - ) ); |
|
| 311 | + )); |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @param array $banner_arr Banner options. |
| 321 | 321 | * @param bool $is_single Is single. |
| 322 | 322 | */ |
| 323 | - private function render_single_addon_banner( $banner_arr, $is_single ) { |
|
| 323 | + private function render_single_addon_banner($banner_arr, $is_single) { |
|
| 324 | 324 | // Get all give add-on. |
| 325 | 325 | $give_addons = give_get_plugins(); |
| 326 | 326 | |
@@ -328,80 +328,80 @@ discard block |
||
| 328 | 328 | $plugin_file = $banner_arr['file']; |
| 329 | 329 | |
| 330 | 330 | // Get the plugin main file. |
| 331 | - foreach ( $give_addons as $main_file => $addon ) { |
|
| 331 | + foreach ($give_addons as $main_file => $addon) { |
|
| 332 | 332 | // Plugin should be activated. |
| 333 | - if ( ! is_plugin_active( $main_file ) ) { |
|
| 333 | + if ( ! is_plugin_active($main_file)) { |
|
| 334 | 334 | continue; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if ( |
| 338 | - isset( $banner_arr['name'] ) |
|
| 338 | + isset($banner_arr['name']) |
|
| 339 | 339 | && 'add-on' === $addon['Type'] |
| 340 | - && $this->get_plugin_folder_name( $main_file ) === $this->get_plugin_folder_name( $plugin_file ) |
|
| 340 | + && $this->get_plugin_folder_name($main_file) === $this->get_plugin_folder_name($plugin_file) |
|
| 341 | 341 | ) { |
| 342 | - $plugin_file = WP_PLUGIN_DIR . '/' . $main_file; |
|
| 342 | + $plugin_file = WP_PLUGIN_DIR.'/'.$main_file; |
|
| 343 | 343 | break; |
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // Create dismiss URL. |
| 348 | 348 | $dismiss_url = $is_single |
| 349 | - ? admin_url( 'plugins.php?give_addon_activation_ignore=1&give_addon=' . sanitize_title( $banner_arr['name'] ) ) |
|
| 350 | - : admin_url( 'plugins.php?give_addon_activation_ignore=1&give_addon=all' ); |
|
| 349 | + ? admin_url('plugins.php?give_addon_activation_ignore=1&give_addon='.sanitize_title($banner_arr['name'])) |
|
| 350 | + : admin_url('plugins.php?give_addon_activation_ignore=1&give_addon=all'); |
|
| 351 | 351 | |
| 352 | 352 | // Get the add-on details. |
| 353 | - $plugin_data = get_plugin_data( $plugin_file ); |
|
| 353 | + $plugin_data = get_plugin_data($plugin_file); |
|
| 354 | 354 | ?> |
| 355 | - <img src="<?php echo esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg' ); ?>" class="give-logo" /> |
|
| 355 | + <img src="<?php echo esc_url(GIVE_PLUGIN_URL.'assets/dist/images/give-icon-full-circle.svg'); ?>" class="give-logo" /> |
|
| 356 | 356 | <div class="give-alert-message"> |
| 357 | 357 | <h3> |
| 358 | 358 | <?php |
| 359 | 359 | printf( |
| 360 | 360 | /* translators: %s: Add-on name */ |
| 361 | 361 | '%s<span>%s</span>', |
| 362 | - __( 'New Give Add-on Activated: ', 'give' ), |
|
| 363 | - esc_html( $banner_arr['name'] ) |
|
| 362 | + __('New Give Add-on Activated: ', 'give'), |
|
| 363 | + esc_html($banner_arr['name']) |
|
| 364 | 364 | ); |
| 365 | 365 | ?> |
| 366 | 366 | </h3> |
| 367 | - <a href="<?php echo esc_url( $dismiss_url ); ?>" class="dismiss"> |
|
| 367 | + <a href="<?php echo esc_url($dismiss_url); ?>" class="dismiss"> |
|
| 368 | 368 | <span class="dashicons dashicons-dismiss"></span> |
| 369 | 369 | </a> |
| 370 | 370 | <div class="alert-actions"> |
| 371 | 371 | <?php |
| 372 | 372 | //Point them to your settings page. |
| 373 | - if ( ! empty( $plugin_data['Description'] ) ) { |
|
| 373 | + if ( ! empty($plugin_data['Description'])) { |
|
| 374 | 374 | ?> |
| 375 | 375 | <span class="give-addon-description"> |
| 376 | - <em><?php echo esc_html( strip_tags( $plugin_data['Description'] ) ); ?></em></span><br /> |
|
| 376 | + <em><?php echo esc_html(strip_tags($plugin_data['Description'])); ?></em></span><br /> |
|
| 377 | 377 | <?php |
| 378 | 378 | } |
| 379 | - if ( isset( $banner_arr['settings_url'] ) ) { |
|
| 379 | + if (isset($banner_arr['settings_url'])) { |
|
| 380 | 380 | printf( |
| 381 | 381 | '<a href="%s"><span class="dashicons dashicons-admin-settings"></span>%s</a>', |
| 382 | - esc_url( $banner_arr['settings_url'] ), |
|
| 383 | - esc_html__( 'Go to Settings', 'give' ) |
|
| 382 | + esc_url($banner_arr['settings_url']), |
|
| 383 | + esc_html__('Go to Settings', 'give') |
|
| 384 | 384 | ); |
| 385 | 385 | } |
| 386 | 386 | // Show them how to configure the Addon. |
| 387 | - if ( isset( $banner_arr['documentation_url'] ) ) { |
|
| 387 | + if (isset($banner_arr['documentation_url'])) { |
|
| 388 | 388 | printf( |
| 389 | 389 | '<a href="%s" target="_blank"><span class="dashicons dashicons-media-text"></span>%s</a>', |
| 390 | - esc_url( $banner_arr['documentation_url'] ), |
|
| 390 | + esc_url($banner_arr['documentation_url']), |
|
| 391 | 391 | sprintf( |
| 392 | 392 | /* translators: %s: Add-on name */ |
| 393 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
| 394 | - esc_html( $banner_arr['name'] ) |
|
| 393 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
| 394 | + esc_html($banner_arr['name']) |
|
| 395 | 395 | ) |
| 396 | 396 | ); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | //Let them signup for plugin updates |
| 400 | - if ( isset( $banner_arr['support_url'] ) ) { |
|
| 400 | + if (isset($banner_arr['support_url'])) { |
|
| 401 | 401 | printf( |
| 402 | 402 | '<a href="%s" target="_blank"><span class="dashicons dashicons-sos"></span>%s</a>', |
| 403 | - esc_url( $banner_arr['support_url'] ), |
|
| 404 | - esc_html__( 'Get Support', 'give' ) |
|
| 403 | + esc_url($banner_arr['support_url']), |
|
| 404 | + esc_html__('Get Support', 'give') |
|
| 405 | 405 | ); |
| 406 | 406 | } |
| 407 | 407 | ?> |
@@ -424,30 +424,30 @@ discard block |
||
| 424 | 424 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
| 425 | 425 | */ |
| 426 | 426 | if ( |
| 427 | - isset( $_GET['give_addon'], $_GET['give_addon_activation_ignore'] ) |
|
| 427 | + isset($_GET['give_addon'], $_GET['give_addon_activation_ignore']) |
|
| 428 | 428 | && '1' === $_GET['give_addon_activation_ignore'] |
| 429 | 429 | ) { |
| 430 | 430 | // Get the value of the 'give_addon' query string. |
| 431 | - $addon_query_arg = sanitize_text_field( wp_unslash( $_GET['give_addon'] ) ); |
|
| 431 | + $addon_query_arg = sanitize_text_field(wp_unslash($_GET['give_addon'])); |
|
| 432 | 432 | $deactivated_addons = array(); |
| 433 | 433 | |
| 434 | 434 | // If All add-on requested to dismiss. |
| 435 | - if ( 'all' === $addon_query_arg ) { |
|
| 435 | + if ('all' === $addon_query_arg) { |
|
| 436 | 436 | // Get all activated add-ons. |
| 437 | 437 | $give_addons = $this->get_plugin_file_names(); |
| 438 | 438 | |
| 439 | - if ( ! empty( $give_addons ) ) { |
|
| 440 | - $deactivated_addons = array_keys( $give_addons ); |
|
| 439 | + if ( ! empty($give_addons)) { |
|
| 440 | + $deactivated_addons = array_keys($give_addons); |
|
| 441 | 441 | } |
| 442 | 442 | } else { |
| 443 | 443 | // Store the addon to deactivate. |
| 444 | 444 | $deactivated_addons[] = $addon_query_arg; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - if ( ! empty( $deactivated_addons ) ) { |
|
| 448 | - foreach ( $deactivated_addons as $addon ) { |
|
| 447 | + if ( ! empty($deactivated_addons)) { |
|
| 448 | + foreach ($deactivated_addons as $addon) { |
|
| 449 | 449 | // Record it user meta. |
| 450 | - add_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon}", 'true', true ); |
|
| 450 | + add_user_meta($this->user_id, "give_addon_activation_ignore_{$addon}", 'true', true); |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | } |
@@ -462,26 +462,26 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | public function remove_addon_activate_meta() { |
| 464 | 464 | // Get the hook name and then grab the plugin file from it. |
| 465 | - $plugin_file = str_replace( 'deactivate_', '', current_action() ); |
|
| 465 | + $plugin_file = str_replace('deactivate_', '', current_action()); |
|
| 466 | 466 | |
| 467 | 467 | // Get all activated add-ons. |
| 468 | 468 | $give_addons = $this->get_plugin_file_names(); |
| 469 | 469 | |
| 470 | - if ( ! empty( $give_addons ) ) { |
|
| 471 | - foreach ( $give_addons as $banner_addon_name => $addon ) { |
|
| 472 | - if ( $plugin_file === $addon['plugin_main_file'] ) { |
|
| 470 | + if ( ! empty($give_addons)) { |
|
| 471 | + foreach ($give_addons as $banner_addon_name => $addon) { |
|
| 472 | + if ($plugin_file === $addon['plugin_main_file']) { |
|
| 473 | 473 | |
| 474 | 474 | // Get the user meta key. |
| 475 | - $user_id = (int) __give_get_active_by_user_meta( $banner_addon_name ); |
|
| 475 | + $user_id = (int) __give_get_active_by_user_meta($banner_addon_name); |
|
| 476 | 476 | |
| 477 | - if ( $user_id ) { |
|
| 477 | + if ($user_id) { |
|
| 478 | 478 | // Get user meta for this add-on. |
| 479 | 479 | $nag_meta_key = "give_addon_activation_ignore_{$banner_addon_name}"; |
| 480 | 480 | |
| 481 | 481 | // Delete plugin activation option key. |
| 482 | - delete_option( self::get_banner_user_meta_key( $banner_addon_name ) ); |
|
| 482 | + delete_option(self::get_banner_user_meta_key($banner_addon_name)); |
|
| 483 | 483 | // Delete user meta of plugin activation. |
| 484 | - delete_user_meta( $user_id, $nag_meta_key ); |
|
| 484 | + delete_user_meta($user_id, $nag_meta_key); |
|
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | } |
@@ -508,11 +508,11 @@ discard block |
||
| 508 | 508 | * |
| 509 | 509 | * @return bool|mixed|string |
| 510 | 510 | */ |
| 511 | - public function get_plugin_folder_name( $main_file ) { |
|
| 511 | + public function get_plugin_folder_name($main_file) { |
|
| 512 | 512 | // Remove plugin file and get the Add-on's folder name only. |
| 513 | - $file_path = explode( '/plugins/', $main_file ); |
|
| 514 | - $addon_file_path = array_pop( $file_path ); |
|
| 515 | - $addon_file_path = substr( $addon_file_path, 0, strpos( $addon_file_path, '/' ) ); |
|
| 513 | + $file_path = explode('/plugins/', $main_file); |
|
| 514 | + $addon_file_path = array_pop($file_path); |
|
| 515 | + $addon_file_path = substr($addon_file_path, 0, strpos($addon_file_path, '/')); |
|
| 516 | 516 | |
| 517 | 517 | return $addon_file_path; |
| 518 | 518 | } |
@@ -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,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | -function __give_get_format_address( $address, $address_args = array() ) { |
|
| 28 | +function __give_get_format_address($address, $address_args = array()) { |
|
| 29 | 29 | $address_html = ''; |
| 30 | 30 | $address_args = wp_parse_args( |
| 31 | 31 | $address_args, |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $address_id = $address_args['type']; |
| 41 | 41 | |
| 42 | 42 | // Bailout. |
| 43 | - if ( empty( $address ) || ! is_array( $address ) ) { |
|
| 43 | + if (empty($address) || ! is_array($address)) { |
|
| 44 | 44 | return $address_html; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | $address_html .= sprintf( |
| 50 | 50 | '<span data-address-type="line1">%1$s</span>%2$s', |
| 51 | 51 | $address['line1'], |
| 52 | - ( ! empty( $address['line2'] ) ? '<br>' : '' ) |
|
| 52 | + ( ! empty($address['line2']) ? '<br>' : '') |
|
| 53 | 53 | ); |
| 54 | 54 | $address_html .= sprintf( |
| 55 | 55 | '<span data-address-type="line2">%1$s</span>%2$s', |
| 56 | 56 | $address['line2'], |
| 57 | - ( ! empty( $address['city'] ) ? '<br>' : '' ) |
|
| 57 | + ( ! empty($address['city']) ? '<br>' : '') |
|
| 58 | 58 | ); |
| 59 | 59 | $address_html .= sprintf( |
| 60 | 60 | '<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
| 61 | 61 | $address['city'], |
| 62 | - ( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
|
| 63 | - ( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
|
| 64 | - ( ! empty( $address['country'] ) ? '<br>' : '' ) |
|
| 62 | + ( ! empty($address['state']) ? ", {$address['state']}" : ''), |
|
| 63 | + ( ! empty($address['zip']) ? " {$address['zip']}" : ''), |
|
| 64 | + ( ! empty($address['country']) ? '<br>' : '') |
|
| 65 | 65 | ); |
| 66 | 66 | $address_html .= sprintf( |
| 67 | 67 | '<span data-address-type="country">%s</span><br>', |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | // Address action. |
| 72 | 72 | $address_html .= sprintf( |
| 73 | 73 | '<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
| 74 | - __( 'Edit', 'give' ), |
|
| 75 | - __( 'Remove', 'give' ) |
|
| 74 | + __('Edit', 'give'), |
|
| 75 | + __('Remove', 'give') |
|
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @since 2.0 |
| 82 | 82 | */ |
| 83 | - $address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
|
| 83 | + $address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args); |
|
| 84 | 84 | |
| 85 | 85 | // Set unique id and index for multi type address. |
| 86 | - if ( isset( $address_args['index'] ) ) { |
|
| 86 | + if (isset($address_args['index'])) { |
|
| 87 | 87 | $address_label = "{$address_label} #{$address_args['index']}"; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( isset( $address_args['id'] ) ) { |
|
| 90 | + if (isset($address_args['id'])) { |
|
| 91 | 91 | $address_id = "{$address_id}_{$address_args['id']}"; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function give_donors_page() { |
| 114 | 114 | $default_views = give_donor_views(); |
| 115 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
| 116 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
| 117 | - give_render_donor_view( $requested_view, $default_views ); |
|
| 115 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
| 116 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
| 117 | + give_render_donor_view($requested_view, $default_views); |
|
| 118 | 118 | } else { |
| 119 | 119 | give_donors_list(); |
| 120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $views = array(); |
| 132 | 132 | |
| 133 | - return apply_filters( 'give_donor_views', $views ); |
|
| 133 | + return apply_filters('give_donor_views', $views); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $tabs = array(); |
| 146 | 146 | |
| 147 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
| 147 | + return apply_filters('give_donor_tabs', $tabs); |
|
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function give_donors_list() { |
| 158 | 158 | |
| 159 | - include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
|
| 159 | + include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php'; |
|
| 160 | 160 | |
| 161 | 161 | $donors_table = new Give_Donor_List_Table(); |
| 162 | 162 | $donors_table->prepare_items(); |
@@ -169,13 +169,13 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @since 1.0 |
| 171 | 171 | */ |
| 172 | - do_action( 'give_donors_table_top' ); |
|
| 172 | + do_action('give_donors_table_top'); |
|
| 173 | 173 | ?> |
| 174 | 174 | |
| 175 | 175 | <hr class="wp-header-end"> |
| 176 | 176 | <form id="give-donors-search-filter" method="get" |
| 177 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
| 178 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
| 177 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
| 178 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
| 179 | 179 | <input type="hidden" name="post_type" value="give_forms"/> |
| 180 | 180 | <input type="hidden" name="page" value="give-donors"/> |
| 181 | 181 | <input type="hidden" name="view" value="donors"/> |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @since 1.0 |
| 194 | 194 | */ |
| 195 | - do_action( 'give_donors_table_bottom' ); |
|
| 195 | + do_action('give_donors_table_bottom'); |
|
| 196 | 196 | ?> |
| 197 | 197 | </div> |
| 198 | 198 | <?php |
@@ -208,33 +208,33 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return void |
| 210 | 210 | */ |
| 211 | -function give_render_donor_view( $view, $callbacks ) { |
|
| 211 | +function give_render_donor_view($view, $callbacks) { |
|
| 212 | 212 | |
| 213 | 213 | $render = true; |
| 214 | 214 | |
| 215 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
| 215 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
| 216 | 216 | |
| 217 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
| 218 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
| 217 | + if ( ! current_user_can($donor_view_role)) { |
|
| 218 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
| 219 | 219 | $render = false; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 223 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
| 222 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 223 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
| 224 | 224 | $render = false; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $donor_id = (int) $_GET['id']; |
| 228 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
| 229 | - $donor = new Give_Donor( $donor_id ); |
|
| 228 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
| 229 | + $donor = new Give_Donor($donor_id); |
|
| 230 | 230 | |
| 231 | 231 | // Reconnect User with Donor profile. |
| 232 | - if ( $reconnect_user_id ) { |
|
| 233 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
| 232 | + if ($reconnect_user_id) { |
|
| 233 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if ( empty( $donor->id ) ) { |
|
| 237 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
| 236 | + if (empty($donor->id)) { |
|
| 237 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
| 238 | 238 | $render = false; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -243,9 +243,9 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | <div class='wrap'> |
| 245 | 245 | |
| 246 | - <?php if ( give_get_errors() ) : ?> |
|
| 246 | + <?php if (give_get_errors()) : ?> |
|
| 247 | 247 | <div class="error settings-error"> |
| 248 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
| 248 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
| 249 | 249 | </div> |
| 250 | 250 | <?php endif; ?> |
| 251 | 251 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | <?php |
| 254 | 254 | printf( |
| 255 | 255 | /* translators: %s: donor first name */ |
| 256 | - __( 'Edit Donor: %s %s', 'give' ), |
|
| 256 | + __('Edit Donor: %s %s', 'give'), |
|
| 257 | 257 | $donor->get_first_name(), |
| 258 | 258 | $donor->get_last_name() |
| 259 | 259 | ); |
@@ -262,26 +262,26 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | <hr class="wp-header-end"> |
| 264 | 264 | |
| 265 | - <?php if ( $donor && $render ) : ?> |
|
| 265 | + <?php if ($donor && $render) : ?> |
|
| 266 | 266 | |
| 267 | 267 | <h2 class="nav-tab-wrapper"> |
| 268 | 268 | <?php |
| 269 | - foreach ( $donor_tabs as $key => $tab ) : |
|
| 269 | + foreach ($donor_tabs as $key => $tab) : |
|
| 270 | 270 | $active = $key === $view ? true : false; |
| 271 | 271 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
| 272 | 272 | printf( |
| 273 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
| 274 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
| 275 | - esc_attr( $class ), |
|
| 276 | - sanitize_html_class( $tab['dashicon'] ), |
|
| 277 | - esc_html( $tab['title'] ) |
|
| 273 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
| 274 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
| 275 | + esc_attr($class), |
|
| 276 | + sanitize_html_class($tab['dashicon']), |
|
| 277 | + esc_html($tab['title']) |
|
| 278 | 278 | ); |
| 279 | 279 | endforeach; |
| 280 | 280 | ?> |
| 281 | 281 | </h2> |
| 282 | 282 | |
| 283 | 283 | <div id="give-donor-card-wrapper"> |
| 284 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
| 284 | + <?php $callbacks[$view]($donor) ?> |
|
| 285 | 285 | </div> |
| 286 | 286 | |
| 287 | 287 | <?php endif; ?> |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | * |
| 302 | 302 | * @return void |
| 303 | 303 | */ |
| 304 | -function give_donor_view( $donor ) { |
|
| 304 | +function give_donor_view($donor) { |
|
| 305 | 305 | |
| 306 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
| 306 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | 309 | * Fires in donor profile screen, above the donor card. |
@@ -312,11 +312,11 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @param object $donor The donor object being displayed. |
| 314 | 314 | */ |
| 315 | - do_action( 'give_donor_card_top', $donor ); |
|
| 315 | + do_action('give_donor_card_top', $donor); |
|
| 316 | 316 | |
| 317 | 317 | // Set Read only to the fields which needs to be locked. |
| 318 | 318 | $read_only = ''; |
| 319 | - if ( $donor->user_id ) { |
|
| 319 | + if ($donor->user_id) { |
|
| 320 | 320 | $read_only = 'readonly="readonly"'; |
| 321 | 321 | } |
| 322 | 322 | |
@@ -324,28 +324,28 @@ discard block |
||
| 324 | 324 | $title_prefixes = give_get_name_title_prefixes(); |
| 325 | 325 | |
| 326 | 326 | // Prepend title prefix to name if it is set. |
| 327 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
| 328 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
| 327 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
| 328 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
| 329 | 329 | ?> |
| 330 | 330 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
| 331 | 331 | <form id="edit-donor-info" method="post" |
| 332 | - action="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); ?>"> |
|
| 332 | + action="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); ?>"> |
|
| 333 | 333 | <div class="donor-info"> |
| 334 | 334 | <div class="donor-bio-header clearfix"> |
| 335 | 335 | <div class="avatar-wrap left" id="donor-avatar"> |
| 336 | - <?php echo get_avatar( $donor->email ); ?> |
|
| 336 | + <?php echo get_avatar($donor->email); ?> |
|
| 337 | 337 | </div> |
| 338 | 338 | <div id="donor-name-wrap" class="left"> |
| 339 | 339 | <span class="donor-name info-item edit-item"> |
| 340 | 340 | <select name="donor_info[title]"> |
| 341 | - <option disabled value="0"><?php esc_html_e( 'Title', 'give' ); ?></option> |
|
| 341 | + <option disabled value="0"><?php esc_html_e('Title', 'give'); ?></option> |
|
| 342 | 342 | <?php |
| 343 | - if ( is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { |
|
| 344 | - foreach ( $title_prefixes as $title ) { |
|
| 343 | + if (is_array($title_prefixes) && count($title_prefixes) > 0) { |
|
| 344 | + foreach ($title_prefixes as $title) { |
|
| 345 | 345 | echo sprintf( |
| 346 | 346 | '<option %1$s value="%2$s">%2$s</option>', |
| 347 | - selected( $title_prefix, $title, false ), |
|
| 348 | - esc_html( $title ) |
|
| 347 | + selected($title_prefix, $title, false), |
|
| 348 | + esc_html($title) |
|
| 349 | 349 | ); |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -353,34 +353,34 @@ discard block |
||
| 353 | 353 | </select> |
| 354 | 354 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
| 355 | 355 | name="donor_info[first_name]" type="text" |
| 356 | - value="<?php echo esc_html( $donor->get_first_name() ); ?>" |
|
| 357 | - placeholder="<?php esc_html_e( 'First Name', 'give' ); ?>"/> |
|
| 358 | - <?php if ( $donor->user_id ) : ?> |
|
| 356 | + value="<?php echo esc_html($donor->get_first_name()); ?>" |
|
| 357 | + placeholder="<?php esc_html_e('First Name', 'give'); ?>"/> |
|
| 358 | + <?php if ($donor->user_id) : ?> |
|
| 359 | 359 | <a href="#" class="give-lock-block"> |
| 360 | 360 | <i class="give-icon give-icon-locked"></i> |
| 361 | 361 | </a> |
| 362 | 362 | <?php endif; ?> |
| 363 | 363 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
| 364 | 364 | name="donor_info[last_name]" type="text" |
| 365 | - value="<?php echo esc_html( $donor->get_last_name() ); ?>" |
|
| 366 | - placeholder="<?php esc_html_e( 'Last Name', 'give' ); ?>"/> |
|
| 367 | - <?php if ( $donor->user_id ) : ?> |
|
| 365 | + value="<?php echo esc_html($donor->get_last_name()); ?>" |
|
| 366 | + placeholder="<?php esc_html_e('Last Name', 'give'); ?>"/> |
|
| 367 | + <?php if ($donor->user_id) : ?> |
|
| 368 | 368 | <a href="#" class="give-lock-block"> |
| 369 | 369 | <i class="give-icon give-icon-locked"></i> |
| 370 | 370 | </a> |
| 371 | 371 | <?php endif; ?> |
| 372 | 372 | </span> |
| 373 | 373 | <span class="donor-name info-item editable"> |
| 374 | - <span data-key="name"><?php echo esc_html( $donor->name ); ?></span> |
|
| 374 | + <span data-key="name"><?php echo esc_html($donor->name); ?></span> |
|
| 375 | 375 | </span> |
| 376 | 376 | </div> |
| 377 | 377 | <p class="donor-since info-item"> |
| 378 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
| 379 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 378 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
| 379 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 380 | 380 | </p> |
| 381 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
| 381 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
| 382 | 382 | <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"> |
| 383 | - <?php esc_html_e( 'Edit Donor', 'give' ); ?> |
|
| 383 | + <?php esc_html_e('Edit Donor', 'give'); ?> |
|
| 384 | 384 | </a> |
| 385 | 385 | <?php endif; ?> |
| 386 | 386 | </div> |
@@ -391,12 +391,12 @@ discard block |
||
| 391 | 391 | <table class="widefat striped"> |
| 392 | 392 | <tbody> |
| 393 | 393 | <tr> |
| 394 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'Donor ID:', 'give' ); ?></label> |
|
| 394 | + <th scope="col"><label for="tablecell"><?php esc_html_e('Donor ID:', 'give'); ?></label> |
|
| 395 | 395 | </th> |
| 396 | - <td><?php echo intval( $donor->id ); ?></td> |
|
| 396 | + <td><?php echo intval($donor->id); ?></td> |
|
| 397 | 397 | </tr> |
| 398 | 398 | <tr> |
| 399 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label> |
|
| 399 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label> |
|
| 400 | 400 | </th> |
| 401 | 401 | <td> |
| 402 | 402 | <span class="donor-user-id info-item edit-item"> |
@@ -414,24 +414,24 @@ discard block |
||
| 414 | 414 | 'data' => $data_atts, |
| 415 | 415 | ); |
| 416 | 416 | |
| 417 | - if ( ! empty( $user_id ) ) { |
|
| 418 | - $userdata = get_userdata( $user_id ); |
|
| 417 | + if ( ! empty($user_id)) { |
|
| 418 | + $userdata = get_userdata($user_id); |
|
| 419 | 419 | $user_args['selected'] = $user_id; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - echo Give()->html->ajax_user_search( $user_args ); |
|
| 422 | + echo Give()->html->ajax_user_search($user_args); |
|
| 423 | 423 | ?> |
| 424 | 424 | </span> |
| 425 | 425 | |
| 426 | 426 | <span class="donor-user-id info-item editable"> |
| 427 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
| 427 | + <?php if ( ! empty($userdata)) : ?> |
|
| 428 | 428 | <span |
| 429 | - data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
| 429 | + data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
| 430 | 430 | <?php else : ?> |
| 431 | 431 | <span |
| 432 | - data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
|
| 432 | + data-key="user_id"><?php esc_html_e('Unregistered', 'give'); ?></span> |
|
| 433 | 433 | <?php endif; ?> |
| 434 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
|
| 434 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) : |
|
| 435 | 435 | |
| 436 | 436 | echo sprintf( |
| 437 | 437 | '- <span class="disconnect-user"> |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | <span class="view-user-profile"> |
| 441 | 441 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
| 442 | 442 | </span>', |
| 443 | - esc_html__( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
| 444 | - esc_html__( 'Disconnect User', 'give' ), |
|
| 445 | - esc_url( 'user-edit.php?user_id=' . $donor->user_id ), |
|
| 446 | - esc_html__( 'View User Profile of current user ID.', 'give' ), |
|
| 447 | - esc_html__( 'View User Profile', 'give' ) |
|
| 443 | + esc_html__('Disconnects the current user ID from this donor record.', 'give'), |
|
| 444 | + esc_html__('Disconnect User', 'give'), |
|
| 445 | + esc_url('user-edit.php?user_id='.$donor->user_id), |
|
| 446 | + esc_html__('View User Profile of current user ID.', 'give'), |
|
| 447 | + esc_html__('View User Profile', 'give') |
|
| 448 | 448 | ); |
| 449 | 449 | |
| 450 | 450 | endif; ?> |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | </tr> |
| 454 | 454 | |
| 455 | 455 | <?php |
| 456 | - $donor_company = $donor->get_meta( '_give_donor_company', true ); |
|
| 456 | + $donor_company = $donor->get_meta('_give_donor_company', true); |
|
| 457 | 457 | ?> |
| 458 | 458 | <tr class="alternate"> |
| 459 | 459 | <th scope="col"> |
| 460 | - <label for="tablecell"><?php esc_html_e( 'Company Name:', 'give' ); ?></label> |
|
| 460 | + <label for="tablecell"><?php esc_html_e('Company Name:', 'give'); ?></label> |
|
| 461 | 461 | </th> |
| 462 | 462 | <td> |
| 463 | 463 | <span class="donor-user-id info-item edit-item"> |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | </td> |
| 471 | 471 | </tr> |
| 472 | 472 | |
| 473 | - <?php $anonymous_donor = absint( $donor->get_meta( '_give_anonymous_donor', true ) ); ?> |
|
| 473 | + <?php $anonymous_donor = absint($donor->get_meta('_give_anonymous_donor', true)); ?> |
|
| 474 | 474 | <tr class="alternate"> |
| 475 | 475 | <th scope="col"> |
| 476 | - <label for="tablecell"><?php _e( 'Anonymous Donor:', 'give' ); ?></label> |
|
| 476 | + <label for="tablecell"><?php _e('Anonymous Donor:', 'give'); ?></label> |
|
| 477 | 477 | </th> |
| 478 | 478 | <td> |
| 479 | 479 | <span class="donor-anonymous-donor info-item edit-item"> |
@@ -484,8 +484,8 @@ discard block |
||
| 484 | 484 | name="give_anonymous_donor" |
| 485 | 485 | value="1" |
| 486 | 486 | type="radio" |
| 487 | - <?php checked( 1, $anonymous_donor ) ?> |
|
| 488 | - ><?php _e( 'Yes', 'give' ); ?> |
|
| 487 | + <?php checked(1, $anonymous_donor) ?> |
|
| 488 | + ><?php _e('Yes', 'give'); ?> |
|
| 489 | 489 | </label> |
| 490 | 490 | </li> |
| 491 | 491 | <li> |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | name="give_anonymous_donor" |
| 495 | 495 | value="0" |
| 496 | 496 | type="radio" |
| 497 | - <?php checked( 0, $anonymous_donor ) ?> |
|
| 498 | - ><?php _e( 'No', 'give' ); ?> |
|
| 497 | + <?php checked(0, $anonymous_donor) ?> |
|
| 498 | + ><?php _e('No', 'give'); ?> |
|
| 499 | 499 | </label> |
| 500 | 500 | </li> |
| 501 | 501 | </ul> |
| 502 | 502 | </span> |
| 503 | 503 | <span class="donor-anonymous-donor info-item editable"> |
| 504 | - <?php echo( $anonymous_donor ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ); ?> |
|
| 504 | + <?php echo($anonymous_donor ? __('Yes', 'give') : __('No', 'give')); ?> |
|
| 505 | 505 | </span> |
| 506 | 506 | </td> |
| 507 | 507 | </tr> |
@@ -513,12 +513,12 @@ discard block |
||
| 513 | 513 | </div> |
| 514 | 514 | |
| 515 | 515 | <span id="donor-edit-actions" class="edit-item"> |
| 516 | - <input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval( $donor->id ); ?>"/> |
|
| 517 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
| 516 | + <input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval($donor->id); ?>"/> |
|
| 517 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
| 518 | 518 | <input type="hidden" name="give_action" value="edit-donor"/> |
| 519 | 519 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
| 520 | - value="<?php esc_html_e( 'Update Donor', 'give' ); ?>"/> |
|
| 521 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 520 | + value="<?php esc_html_e('Update Donor', 'give'); ?>"/> |
|
| 521 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 522 | 522 | </span> |
| 523 | 523 | |
| 524 | 524 | </form> |
@@ -533,24 +533,24 @@ discard block |
||
| 533 | 533 | * |
| 534 | 534 | * @param Give_Donor $donor The donor object being displayed. |
| 535 | 535 | */ |
| 536 | - do_action( 'give_donor_before_stats', $donor ); |
|
| 536 | + do_action('give_donor_before_stats', $donor); |
|
| 537 | 537 | ?> |
| 538 | 538 | |
| 539 | 539 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
| 540 | 540 | <ul> |
| 541 | 541 | <li> |
| 542 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
| 542 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
| 543 | 543 | <span class="dashicons dashicons-heart"></span> |
| 544 | 544 | <?php |
| 545 | 545 | // Completed Donations. |
| 546 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
| 547 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
| 546 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
| 547 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
| 548 | 548 | ?> |
| 549 | 549 | </a> |
| 550 | 550 | </li> |
| 551 | 551 | <li> |
| 552 | 552 | <span class="dashicons dashicons-chart-area"></span> |
| 553 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
| 553 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
| 554 | 554 | </li> |
| 555 | 555 | <?php |
| 556 | 556 | /** |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | * |
| 563 | 563 | * @param object $donor The donor object being displayed. |
| 564 | 564 | */ |
| 565 | - do_action( 'give_donor_stats_list', $donor ); |
|
| 565 | + do_action('give_donor_stats_list', $donor); |
|
| 566 | 566 | ?> |
| 567 | 567 | </ul> |
| 568 | 568 | </div> |
@@ -575,11 +575,11 @@ discard block |
||
| 575 | 575 | * |
| 576 | 576 | * @param Give_Donor $donor The donor object being displayed. |
| 577 | 577 | */ |
| 578 | - do_action( 'give_donor_before_address', $donor ); |
|
| 578 | + do_action('give_donor_before_address', $donor); |
|
| 579 | 579 | ?> |
| 580 | 580 | |
| 581 | 581 | <div id="donor-address-wrapper" class="donor-section clear"> |
| 582 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
| 582 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
| 583 | 583 | |
| 584 | 584 | <div class="postbox"> |
| 585 | 585 | <div class="give-spinner-wrapper"> |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | <div class="all-address"> |
| 590 | 590 | <div class="give-grid-row"> |
| 591 | 591 | <?php |
| 592 | - if ( ! empty( $donor->address ) ) : |
|
| 592 | + if ( ! empty($donor->address)) : |
|
| 593 | 593 | // Default address always will be at zero array index. |
| 594 | 594 | $is_set_as_default = null; |
| 595 | 595 | |
| 596 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
| 596 | + foreach ($donor->address as $address_type => $addresses) { |
|
| 597 | 597 | |
| 598 | - switch ( true ) { |
|
| 599 | - case is_array( end( $addresses ) ): |
|
| 598 | + switch (true) { |
|
| 599 | + case is_array(end($addresses)): |
|
| 600 | 600 | $index = 1; |
| 601 | - foreach ( $addresses as $id => $address ) { |
|
| 601 | + foreach ($addresses as $id => $address) { |
|
| 602 | 602 | echo __give_get_format_address( |
| 603 | 603 | $address, |
| 604 | 604 | array( |
@@ -608,11 +608,11 @@ discard block |
||
| 608 | 608 | ) |
| 609 | 609 | ); |
| 610 | 610 | |
| 611 | - $index ++; |
|
| 611 | + $index++; |
|
| 612 | 612 | } |
| 613 | 613 | break; |
| 614 | 614 | |
| 615 | - case is_string( end( $addresses ) ): |
|
| 615 | + case is_string(end($addresses)): |
|
| 616 | 616 | echo __give_get_format_address( |
| 617 | 617 | $addresses, |
| 618 | 618 | array( |
@@ -625,13 +625,13 @@ discard block |
||
| 625 | 625 | endif; |
| 626 | 626 | ?> |
| 627 | 627 | </div> |
| 628 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
| 628 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
| 629 | 629 | echo ' give-hidden'; |
| 630 | 630 | } ?>"> |
| 631 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
| 631 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
| 632 | 632 | </span> |
| 633 | 633 | <button class="button add-new-address"> |
| 634 | - <?php _e( 'Add Address', 'give' ); ?> |
|
| 634 | + <?php _e('Add Address', 'give'); ?> |
|
| 635 | 635 | </button> |
| 636 | 636 | </div> |
| 637 | 637 | |
@@ -641,26 +641,26 @@ discard block |
||
| 641 | 641 | <tbody> |
| 642 | 642 | <tr> |
| 643 | 643 | <th class="col"> |
| 644 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 644 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 645 | 645 | </th> |
| 646 | 646 | <td> |
| 647 | 647 | <?php |
| 648 | - echo Give()->html->select( array( |
|
| 648 | + echo Give()->html->select(array( |
|
| 649 | 649 | 'options' => give_get_country_list(), |
| 650 | 650 | 'name' => 'country', |
| 651 | - 'selected' => give_get_option( 'base_country' ), |
|
| 651 | + 'selected' => give_get_option('base_country'), |
|
| 652 | 652 | 'show_option_all' => false, |
| 653 | 653 | 'show_option_none' => false, |
| 654 | 654 | 'chosen' => true, |
| 655 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 656 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 657 | - ) ); |
|
| 655 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 656 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 657 | + )); |
|
| 658 | 658 | ?> |
| 659 | 659 | </td> |
| 660 | 660 | </tr> |
| 661 | 661 | <tr> |
| 662 | 662 | <th class="col"> |
| 663 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 663 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 664 | 664 | </th> |
| 665 | 665 | <td> |
| 666 | 666 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | </tr> |
| 669 | 669 | <tr> |
| 670 | 670 | <th class="col"> |
| 671 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 671 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 672 | 672 | </th> |
| 673 | 673 | <td> |
| 674 | 674 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | </tr> |
| 678 | 678 | <tr> |
| 679 | 679 | <th class="col"> |
| 680 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 680 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 681 | 681 | </th> |
| 682 | 682 | <td> |
| 683 | 683 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -685,42 +685,42 @@ discard block |
||
| 685 | 685 | </tr> |
| 686 | 686 | <?php |
| 687 | 687 | $no_states_country = give_no_states_country_list(); |
| 688 | - $base_country = give_get_option( 'base_country' ); |
|
| 689 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
| 688 | + $base_country = give_get_option('base_country'); |
|
| 689 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
| 690 | 690 | ?> |
| 691 | 691 | <tr class="give-field-wrap"> |
| 692 | 692 | <th class="col"> |
| 693 | 693 | <label |
| 694 | - for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
| 694 | + for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
| 695 | 695 | </th> |
| 696 | 696 | <td> |
| 697 | 697 | <?php |
| 698 | - $states = give_get_states( $base_country ); |
|
| 698 | + $states = give_get_states($base_country); |
|
| 699 | 699 | $state_args = array( |
| 700 | 700 | 'name' => 'state', |
| 701 | 701 | 'class' => 'regular-text', |
| 702 | 702 | ); |
| 703 | 703 | |
| 704 | - if ( empty( $states ) ) { |
|
| 704 | + if (empty($states)) { |
|
| 705 | 705 | |
| 706 | 706 | // Show Text field, if empty states. |
| 707 | - $state_args = wp_parse_args( $state_args, array( |
|
| 708 | - 'value' => give_get_option( 'base_state' ), |
|
| 709 | - ) ); |
|
| 710 | - echo Give()->html->text( $state_args ); |
|
| 707 | + $state_args = wp_parse_args($state_args, array( |
|
| 708 | + 'value' => give_get_option('base_state'), |
|
| 709 | + )); |
|
| 710 | + echo Give()->html->text($state_args); |
|
| 711 | 711 | } else { |
| 712 | 712 | |
| 713 | 713 | // Show Chosen DropDown, if states are not empty. |
| 714 | - $state_args = wp_parse_args( $state_args, array( |
|
| 714 | + $state_args = wp_parse_args($state_args, array( |
|
| 715 | 715 | 'options' => $states, |
| 716 | - 'selected' => give_get_option( 'base_state' ), |
|
| 716 | + 'selected' => give_get_option('base_state'), |
|
| 717 | 717 | 'show_option_all' => false, |
| 718 | 718 | 'show_option_none' => false, |
| 719 | 719 | 'chosen' => true, |
| 720 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
| 721 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 722 | - ) ); |
|
| 723 | - echo Give()->html->select( $state_args ); |
|
| 720 | + 'placeholder' => __('Select a state', 'give'), |
|
| 721 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 722 | + )); |
|
| 723 | + echo Give()->html->select($state_args); |
|
| 724 | 724 | } |
| 725 | 725 | ?> |
| 726 | 726 | </td> |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | ?> |
| 731 | 731 | <tr> |
| 732 | 732 | <th class="col"> |
| 733 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 733 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 734 | 734 | </th> |
| 735 | 735 | <td> |
| 736 | 736 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | </tr> |
| 739 | 739 | <tr> |
| 740 | 740 | <td colspan="2"> |
| 741 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
| 741 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
| 742 | 742 | <input type="hidden" name="address-action" value="add"> |
| 743 | 743 | <input type="hidden" name="address-id" value=""> |
| 744 | 744 | <input type="submit" class="button button-primary js-save" |
| 745 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
| 746 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
| 745 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
| 746 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
| 747 | 747 | </td> |
| 748 | 748 | </tr> |
| 749 | 749 | </tbody> |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | * |
| 763 | 763 | * @param Give_Donor $donor The donor object being displayed. |
| 764 | 764 | */ |
| 765 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
| 765 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
| 766 | 766 | ?> |
| 767 | 767 | |
| 768 | 768 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -775,46 +775,46 @@ discard block |
||
| 775 | 775 | * |
| 776 | 776 | * @param object $donor The donor object being displayed. |
| 777 | 777 | */ |
| 778 | - do_action( 'give_donor_before_tables', $donor ); |
|
| 778 | + do_action('give_donor_before_tables', $donor); |
|
| 779 | 779 | ?> |
| 780 | 780 | |
| 781 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
| 781 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
| 782 | 782 | |
| 783 | 783 | <table class="wp-list-table widefat striped emails"> |
| 784 | 784 | <thead> |
| 785 | 785 | <tr> |
| 786 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
| 787 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
| 786 | + <th><?php _e('Email', 'give'); ?></th> |
|
| 787 | + <th><?php _e('Actions', 'give'); ?></th> |
|
| 788 | 788 | </tr> |
| 789 | 789 | </thead> |
| 790 | 790 | |
| 791 | 791 | <tbody> |
| 792 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
| 792 | + <?php if ( ! empty($donor->emails)) { ?> |
|
| 793 | 793 | |
| 794 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
| 794 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
| 795 | 795 | <tr data-key="<?php echo $key; ?>"> |
| 796 | 796 | <td> |
| 797 | 797 | <?php echo $email; ?> |
| 798 | - <?php if ( 'primary' === $key ) : ?> |
|
| 798 | + <?php if ('primary' === $key) : ?> |
|
| 799 | 799 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
| 800 | 800 | <?php endif; ?> |
| 801 | 801 | </td> |
| 802 | 802 | <td> |
| 803 | - <?php if ( 'primary' !== $key ) : ?> |
|
| 803 | + <?php if ('primary' !== $key) : ?> |
|
| 804 | 804 | <?php |
| 805 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
| 806 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
| 807 | - 'email' => rawurlencode( $email ), |
|
| 805 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
| 806 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
| 807 | + 'email' => rawurlencode($email), |
|
| 808 | 808 | 'give_action' => 'set_donor_primary_email', |
| 809 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
| 810 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
| 811 | - 'email' => rawurlencode( $email ), |
|
| 809 | + ), $base_url), 'give-set-donor-primary-email'); |
|
| 810 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
| 811 | + 'email' => rawurlencode($email), |
|
| 812 | 812 | 'give_action' => 'remove_donor_email', |
| 813 | - ), $base_url ), 'give-remove-donor-email' ); |
|
| 813 | + ), $base_url), 'give-remove-donor-email'); |
|
| 814 | 814 | ?> |
| 815 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
| 815 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
| 816 | 816 | | |
| 817 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
| 817 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
| 818 | 818 | <?php endif; ?> |
| 819 | 819 | </td> |
| 820 | 820 | </tr> |
@@ -824,14 +824,14 @@ discard block |
||
| 824 | 824 | <td colspan="2" class="add-donor-email-td"> |
| 825 | 825 | <div class="add-donor-email-wrapper"> |
| 826 | 826 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
| 827 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
| 827 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
| 828 | 828 | <input type="email" name="additional-email" value="" |
| 829 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
| 829 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
| 830 | 830 | <input type="checkbox" name="make-additional-primary" value="1" |
| 831 | 831 | id="make-additional-primary"/> <label |
| 832 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
| 832 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
| 833 | 833 | <button class="button-secondary give-add-donor-email" |
| 834 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
| 834 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
| 835 | 835 | <span class="spinner"></span> |
| 836 | 836 | </div> |
| 837 | 837 | <div class="notice-wrap"></div> |
@@ -839,54 +839,54 @@ discard block |
||
| 839 | 839 | </tr> |
| 840 | 840 | <?php } else { ?> |
| 841 | 841 | <tr> |
| 842 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
| 842 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
| 843 | 843 | </tr> |
| 844 | 844 | <?php }// End if(). |
| 845 | 845 | ?> |
| 846 | 846 | </tbody> |
| 847 | 847 | </table> |
| 848 | 848 | |
| 849 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
| 849 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
| 850 | 850 | <?php |
| 851 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
| 852 | - $payments = give_get_payments( array( |
|
| 851 | + $payment_ids = explode(',', $donor->payment_ids); |
|
| 852 | + $payments = give_get_payments(array( |
|
| 853 | 853 | 'post__in' => $payment_ids, |
| 854 | - ) ); |
|
| 855 | - $payments = array_slice( $payments, 0, 10 ); |
|
| 854 | + )); |
|
| 855 | + $payments = array_slice($payments, 0, 10); |
|
| 856 | 856 | ?> |
| 857 | 857 | <table class="wp-list-table widefat striped payments"> |
| 858 | 858 | <thead> |
| 859 | 859 | <tr> |
| 860 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
| 861 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
| 862 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
| 863 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
| 864 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
| 860 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
| 861 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
| 862 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
| 863 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
| 864 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
| 865 | 865 | </tr> |
| 866 | 866 | </thead> |
| 867 | 867 | <tbody> |
| 868 | - <?php if ( ! empty( $payments ) ) { ?> |
|
| 869 | - <?php foreach ( $payments as $payment ) : ?> |
|
| 868 | + <?php if ( ! empty($payments)) { ?> |
|
| 869 | + <?php foreach ($payments as $payment) : ?> |
|
| 870 | 870 | <tr> |
| 871 | - <td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td> |
|
| 872 | - <td><?php echo give_donation_amount( $payment->ID, array( |
|
| 871 | + <td><?php echo Give()->seq_donation_number->get_serial_code($payment->ID); ?></td> |
|
| 872 | + <td><?php echo give_donation_amount($payment->ID, array( |
|
| 873 | 873 | 'currency' => true, |
| 874 | 874 | 'amount' => true, |
| 875 | 875 | 'type' => 'donor' |
| 876 | - ) ); ?></td> |
|
| 877 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
| 878 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
| 876 | + )); ?></td> |
|
| 877 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
| 878 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
| 879 | 879 | <td> |
| 880 | 880 | <?php |
| 881 | 881 | printf( |
| 882 | 882 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 883 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
| 883 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
| 884 | 884 | sprintf( |
| 885 | 885 | /* translators: %s: Donation ID */ |
| 886 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
| 886 | + esc_attr__('View Donation %s.', 'give'), |
|
| 887 | 887 | $payment->ID |
| 888 | 888 | ), |
| 889 | - __( 'View Donation', 'give' ) |
|
| 889 | + __('View Donation', 'give') |
|
| 890 | 890 | ); |
| 891 | 891 | ?> |
| 892 | 892 | |
@@ -901,47 +901,47 @@ discard block |
||
| 901 | 901 | * @param object $donor The donor object being displayed. |
| 902 | 902 | * @param object $payment The payment object being displayed. |
| 903 | 903 | */ |
| 904 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
| 904 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
| 905 | 905 | ?> |
| 906 | 906 | </td> |
| 907 | 907 | </tr> |
| 908 | 908 | <?php endforeach; ?> |
| 909 | 909 | <?php } else { ?> |
| 910 | 910 | <tr> |
| 911 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
| 911 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
| 912 | 912 | </tr> |
| 913 | 913 | <?php }// End if(). |
| 914 | 914 | ?> |
| 915 | 915 | </tbody> |
| 916 | 916 | </table> |
| 917 | 917 | |
| 918 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
| 918 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
| 919 | 919 | <?php |
| 920 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
| 920 | + $donations = give_get_users_completed_donations($donor->email); |
|
| 921 | 921 | ?> |
| 922 | 922 | <table class="wp-list-table widefat striped donations"> |
| 923 | 923 | <thead> |
| 924 | 924 | <tr> |
| 925 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
| 926 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
| 925 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
| 926 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
| 927 | 927 | </tr> |
| 928 | 928 | </thead> |
| 929 | 929 | <tbody> |
| 930 | - <?php if ( ! empty( $donations ) ) { ?> |
|
| 931 | - <?php foreach ( $donations as $donation ) : ?> |
|
| 930 | + <?php if ( ! empty($donations)) { ?> |
|
| 931 | + <?php foreach ($donations as $donation) : ?> |
|
| 932 | 932 | <tr> |
| 933 | 933 | <td><?php echo $donation->post_title; ?></td> |
| 934 | 934 | <td> |
| 935 | 935 | <?php |
| 936 | 936 | printf( |
| 937 | 937 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 938 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
| 938 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
| 939 | 939 | sprintf( |
| 940 | 940 | /* translators: %s: form name */ |
| 941 | - esc_attr__( 'View Form %s.', 'give' ), |
|
| 941 | + esc_attr__('View Form %s.', 'give'), |
|
| 942 | 942 | $donation->post_title |
| 943 | 943 | ), |
| 944 | - __( 'View Form', 'give' ) |
|
| 944 | + __('View Form', 'give') |
|
| 945 | 945 | ); |
| 946 | 946 | ?> |
| 947 | 947 | </td> |
@@ -949,62 +949,62 @@ discard block |
||
| 949 | 949 | <?php endforeach; ?> |
| 950 | 950 | <?php } else { ?> |
| 951 | 951 | <tr> |
| 952 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
| 952 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
| 953 | 953 | </tr> |
| 954 | 954 | <?php } ?> |
| 955 | 955 | </tbody> |
| 956 | 956 | </table> |
| 957 | 957 | |
| 958 | - <h3><?php _e( 'Comments', 'give' ); ?></h3> |
|
| 958 | + <h3><?php _e('Comments', 'give'); ?></h3> |
|
| 959 | 959 | <?php |
| 960 | 960 | // @todo load comment by ajax to improve performance. |
| 961 | - $donations = give_get_users_donations( $donor->email ); |
|
| 961 | + $donations = give_get_users_donations($donor->email); |
|
| 962 | 962 | ?> |
| 963 | 963 | <table class="wp-list-table widefat striped comments"> |
| 964 | 964 | <thead> |
| 965 | 965 | <tr> |
| 966 | - <th scope="col"><?php _e( 'Donation', 'give' ); ?></th> |
|
| 967 | - <th scope="col"><?php _e( 'Anonymous', 'give' ); ?></th> |
|
| 968 | - <th scope="col" colspan="3"><?php _e( 'Comment', 'give' ); ?></th> |
|
| 966 | + <th scope="col"><?php _e('Donation', 'give'); ?></th> |
|
| 967 | + <th scope="col"><?php _e('Anonymous', 'give'); ?></th> |
|
| 968 | + <th scope="col" colspan="3"><?php _e('Comment', 'give'); ?></th> |
|
| 969 | 969 | </tr> |
| 970 | 970 | </thead> |
| 971 | 971 | <tbody> |
| 972 | - <?php if ( ! empty( $donations ) ) : ?> |
|
| 973 | - <?php foreach ( $donations as $donation ) : ?> |
|
| 972 | + <?php if ( ! empty($donations)) : ?> |
|
| 973 | + <?php foreach ($donations as $donation) : ?> |
|
| 974 | 974 | <?php |
| 975 | - $comment = give_get_donor_donation_comment( $donation->ID, give_get_payment_donor_id( $donation->ID ) ); |
|
| 975 | + $comment = give_get_donor_donation_comment($donation->ID, give_get_payment_donor_id($donation->ID)); |
|
| 976 | 976 | |
| 977 | - if ( ! $comment instanceof WP_Comment ) { |
|
| 977 | + if ( ! $comment instanceof WP_Comment) { |
|
| 978 | 978 | continue; |
| 979 | 979 | } |
| 980 | 980 | ?> |
| 981 | 981 | <tr> |
| 982 | 982 | <td> |
| 983 | 983 | <?php |
| 984 | - $donation_number = Give()->seq_donation_number->get_serial_code( $donation ); |
|
| 984 | + $donation_number = Give()->seq_donation_number->get_serial_code($donation); |
|
| 985 | 985 | echo $donation_number; |
| 986 | 986 | ?> |
| 987 | 987 | </td> |
| 988 | 988 | <td> |
| 989 | 989 | <?php |
| 990 | - echo absint( give_get_payment_meta( $donation->ID, '_give_anonymous_donation' ) ) |
|
| 991 | - ? __( 'Yes', 'give' ) |
|
| 992 | - : __( 'No', 'give' ); |
|
| 990 | + echo absint(give_get_payment_meta($donation->ID, '_give_anonymous_donation')) |
|
| 991 | + ? __('Yes', 'give') |
|
| 992 | + : __('No', 'give'); |
|
| 993 | 993 | ?> |
| 994 | 994 | </td> |
| 995 | 995 | <td> |
| 996 | 996 | <?php |
| 997 | - echo apply_filters( 'the_content', $comment->comment_content ); |
|
| 997 | + echo apply_filters('the_content', $comment->comment_content); |
|
| 998 | 998 | |
| 999 | 999 | echo sprintf( |
| 1000 | 1000 | '<a href="%1$s" aria-label="%2$s" target="_blank">%3$s</a>', |
| 1001 | - admin_url( "edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id={$donation->ID}#give-payment-donor-comment" ), |
|
| 1001 | + admin_url("edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id={$donation->ID}#give-payment-donor-comment"), |
|
| 1002 | 1002 | sprintf( |
| 1003 | 1003 | /* translators: %s: Comment ID */ |
| 1004 | - esc_attr__( 'Edit Comment %s.', 'give' ), |
|
| 1004 | + esc_attr__('Edit Comment %s.', 'give'), |
|
| 1005 | 1005 | $comment->comment_ID |
| 1006 | 1006 | ), |
| 1007 | - __( 'Edit Comment', 'give' ) |
|
| 1007 | + __('Edit Comment', 'give') |
|
| 1008 | 1008 | ); |
| 1009 | 1009 | ?> |
| 1010 | 1010 | </td> |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | <?php endforeach; ?> |
| 1013 | 1013 | <?php else: ?> |
| 1014 | 1014 | <tr> |
| 1015 | - <td colspan="5"><?php _e( 'No comment found.', 'give' ); ?></td> |
|
| 1015 | + <td colspan="5"><?php _e('No comment found.', 'give'); ?></td> |
|
| 1016 | 1016 | </tr> |
| 1017 | 1017 | <?php endif ?> |
| 1018 | 1018 | </tbody> |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | * |
| 1027 | 1027 | * @param object $donor The donor object being displayed. |
| 1028 | 1028 | */ |
| 1029 | - do_action( 'give_donor_after_tables', $donor ); |
|
| 1029 | + do_action('give_donor_after_tables', $donor); |
|
| 1030 | 1030 | ?> |
| 1031 | 1031 | |
| 1032 | 1032 | </div> |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | * |
| 1040 | 1040 | * @param object $donor The donor object being displayed. |
| 1041 | 1041 | */ |
| 1042 | - do_action( 'give_donor_card_bottom', $donor ); |
|
| 1042 | + do_action('give_donor_card_bottom', $donor); |
|
| 1043 | 1043 | |
| 1044 | 1044 | } |
| 1045 | 1045 | |
@@ -1052,31 +1052,31 @@ discard block |
||
| 1052 | 1052 | * |
| 1053 | 1053 | * @return void |
| 1054 | 1054 | */ |
| 1055 | -function give_donor_notes_view( $donor ) { |
|
| 1055 | +function give_donor_notes_view($donor) { |
|
| 1056 | 1056 | |
| 1057 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
| 1058 | - $paged = absint( $paged ); |
|
| 1057 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
| 1058 | + $paged = absint($paged); |
|
| 1059 | 1059 | $note_count = $donor->get_notes_count(); |
| 1060 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
| 1061 | - $total_pages = ceil( $note_count / $per_page ); |
|
| 1062 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
| 1060 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
| 1061 | + $total_pages = ceil($note_count / $per_page); |
|
| 1062 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
| 1063 | 1063 | ?> |
| 1064 | 1064 | |
| 1065 | 1065 | <div id="donor-notes-wrapper"> |
| 1066 | 1066 | <div class="donor-notes-header"> |
| 1067 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
| 1067 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
| 1068 | 1068 | </div> |
| 1069 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
| 1069 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
| 1070 | 1070 | |
| 1071 | - <?php if ( 1 == $paged ) : ?> |
|
| 1071 | + <?php if (1 == $paged) : ?> |
|
| 1072 | 1072 | <div style="display: block; margin-bottom: 55px;"> |
| 1073 | 1073 | <form id="give-add-donor-note" method="post" |
| 1074 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
| 1074 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
| 1075 | 1075 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
| 1076 | 1076 | <br/> |
| 1077 | 1077 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
| 1078 | 1078 | <input type="hidden" name="give_action" value="add-donor-note"/> |
| 1079 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
| 1079 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
| 1080 | 1080 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
| 1081 | 1081 | </form> |
| 1082 | 1082 | </div> |
@@ -1091,26 +1091,26 @@ discard block |
||
| 1091 | 1091 | 'show_all' => true, |
| 1092 | 1092 | ); |
| 1093 | 1093 | |
| 1094 | - echo paginate_links( $pagination_args ); |
|
| 1094 | + echo paginate_links($pagination_args); |
|
| 1095 | 1095 | ?> |
| 1096 | 1096 | |
| 1097 | 1097 | <div id="give-donor-notes" class="postbox"> |
| 1098 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
| 1099 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
| 1098 | + <?php if (count($donor_notes) > 0) { ?> |
|
| 1099 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
| 1100 | 1100 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
| 1101 | 1101 | <span class="note-content-wrap"> |
| 1102 | - <?php echo stripslashes( $note ); ?> |
|
| 1102 | + <?php echo stripslashes($note); ?> |
|
| 1103 | 1103 | </span> |
| 1104 | 1104 | </div> |
| 1105 | 1105 | <?php endforeach; ?> |
| 1106 | 1106 | <?php } else { ?> |
| 1107 | 1107 | <div class="give-no-donor-notes"> |
| 1108 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
| 1108 | + <?php _e('No donor notes found.', 'give'); ?> |
|
| 1109 | 1109 | </div> |
| 1110 | 1110 | <?php } ?> |
| 1111 | 1111 | </div> |
| 1112 | 1112 | |
| 1113 | - <?php echo paginate_links( $pagination_args ); ?> |
|
| 1113 | + <?php echo paginate_links($pagination_args); ?> |
|
| 1114 | 1114 | |
| 1115 | 1115 | </div> |
| 1116 | 1116 | |
@@ -1126,9 +1126,9 @@ discard block |
||
| 1126 | 1126 | * |
| 1127 | 1127 | * @return void |
| 1128 | 1128 | */ |
| 1129 | -function give_donor_delete_view( $donor ) { |
|
| 1129 | +function give_donor_delete_view($donor) { |
|
| 1130 | 1130 | |
| 1131 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
| 1131 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
| 1132 | 1132 | |
| 1133 | 1133 | /** |
| 1134 | 1134 | * Fires in donor delete screen, above the content. |
@@ -1137,16 +1137,16 @@ discard block |
||
| 1137 | 1137 | * |
| 1138 | 1138 | * @param object $donor The donor object being displayed. |
| 1139 | 1139 | */ |
| 1140 | - do_action( 'give_donor_delete_top', $donor ); |
|
| 1140 | + do_action('give_donor_delete_top', $donor); |
|
| 1141 | 1141 | ?> |
| 1142 | 1142 | |
| 1143 | 1143 | <div class="info-wrapper donor-section"> |
| 1144 | 1144 | |
| 1145 | 1145 | <form id="delete-donor" method="post" |
| 1146 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
| 1146 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
| 1147 | 1147 | |
| 1148 | 1148 | <div class="donor-notes-header"> |
| 1149 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
| 1149 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
| 1150 | 1150 | </div> |
| 1151 | 1151 | |
| 1152 | 1152 | |
@@ -1154,22 +1154,22 @@ discard block |
||
| 1154 | 1154 | |
| 1155 | 1155 | <span class="delete-donor-options"> |
| 1156 | 1156 | <p> |
| 1157 | - <?php echo Give()->html->checkbox( array( |
|
| 1157 | + <?php echo Give()->html->checkbox(array( |
|
| 1158 | 1158 | 'name' => 'give-donor-delete-confirm', |
| 1159 | - ) ); ?> |
|
| 1159 | + )); ?> |
|
| 1160 | 1160 | <label |
| 1161 | - for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
| 1161 | + for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
| 1162 | 1162 | </p> |
| 1163 | 1163 | |
| 1164 | 1164 | <p> |
| 1165 | - <?php echo Give()->html->checkbox( array( |
|
| 1165 | + <?php echo Give()->html->checkbox(array( |
|
| 1166 | 1166 | 'name' => 'give-donor-delete-records', |
| 1167 | 1167 | 'options' => array( |
| 1168 | 1168 | 'disabled' => true, |
| 1169 | 1169 | ), |
| 1170 | - ) ); ?> |
|
| 1170 | + )); ?> |
|
| 1171 | 1171 | <label |
| 1172 | - for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
| 1172 | + for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
| 1173 | 1173 | </p> |
| 1174 | 1174 | |
| 1175 | 1175 | <?php |
@@ -1182,19 +1182,19 @@ discard block |
||
| 1182 | 1182 | * |
| 1183 | 1183 | * @param object $donor The donor object being displayed. |
| 1184 | 1184 | */ |
| 1185 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
| 1185 | + do_action('give_donor_delete_inputs', $donor); |
|
| 1186 | 1186 | ?> |
| 1187 | 1187 | </span> |
| 1188 | 1188 | |
| 1189 | 1189 | <span id="donor-edit-actions"> |
| 1190 | 1190 | <input type="hidden" name="donor_id" value="<?php echo $donor->id; ?>"/> |
| 1191 | - <?php wp_nonce_field( 'give-delete-donor', '_wpnonce', false, true ); ?> |
|
| 1191 | + <?php wp_nonce_field('give-delete-donor', '_wpnonce', false, true); ?> |
|
| 1192 | 1192 | <input type="hidden" name="give_action" value="delete_donor"/> |
| 1193 | 1193 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
| 1194 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
| 1194 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
| 1195 | 1195 | <a id="give-delete-donor-cancel" |
| 1196 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
| 1197 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 1196 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
| 1197 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 1198 | 1198 | </span> |
| 1199 | 1199 | |
| 1200 | 1200 | </div> |
@@ -1210,5 +1210,5 @@ discard block |
||
| 1210 | 1210 | * |
| 1211 | 1211 | * @param object $donor The donor object being displayed. |
| 1212 | 1212 | */ |
| 1213 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
| 1213 | + do_action('give_donor_delete_bottom', $donor); |
|
| 1214 | 1214 | } |
@@ -427,9 +427,12 @@ discard block |
||
| 427 | 427 | <?php if ( ! empty( $userdata ) ) : ?> |
| 428 | 428 | <span |
| 429 | 429 | data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
| 430 | - <?php else : ?> |
|
| 430 | + <?php else { |
|
| 431 | + : ?> |
|
| 431 | 432 | <span |
| 432 | - data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
|
| 433 | + data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); |
|
| 434 | +} |
|
| 435 | +?></span> |
|
| 433 | 436 | <?php endif; ?> |
| 434 | 437 | <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
| 435 | 438 | |
@@ -1010,9 +1013,12 @@ discard block |
||
| 1010 | 1013 | </td> |
| 1011 | 1014 | </tr> |
| 1012 | 1015 | <?php endforeach; ?> |
| 1013 | - <?php else: ?> |
|
| 1016 | + <?php else { |
|
| 1017 | + : ?> |
|
| 1014 | 1018 | <tr> |
| 1015 | - <td colspan="5"><?php _e( 'No comment found.', 'give' ); ?></td> |
|
| 1019 | + <td colspan="5"><?php _e( 'No comment found.', 'give' ); |
|
| 1020 | +} |
|
| 1021 | +?></td> |
|
| 1016 | 1022 | </tr> |
| 1017 | 1023 | <?php endif ?> |
| 1018 | 1024 | </tbody> |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // Load WP_List_Table if not loaded. |
| 20 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 21 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | +if ( ! class_exists('WP_List_Table')) { |
|
| 21 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | public function __construct() { |
| 62 | 62 | |
| 63 | 63 | // Set parent defaults. |
| 64 | - parent::__construct( array( |
|
| 65 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records. |
|
| 66 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records. |
|
| 64 | + parent::__construct(array( |
|
| 65 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records. |
|
| 66 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records. |
|
| 67 | 67 | 'ajax' => false, // Does this table support ajax?. |
| 68 | - ) ); |
|
| 68 | + )); |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
@@ -80,23 +80,23 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | - public function search_box( $text, $input_id ) { |
|
| 84 | - $input_id = $input_id . '-search-input'; |
|
| 83 | + public function search_box($text, $input_id) { |
|
| 84 | + $input_id = $input_id.'-search-input'; |
|
| 85 | 85 | |
| 86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 87 | - echo sprintf( '<input type="hidden" name="orderby" value="%1$s" />', esc_attr( $_REQUEST['orderby'] ) ); |
|
| 86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 87 | + echo sprintf('<input type="hidden" name="orderby" value="%1$s" />', esc_attr($_REQUEST['orderby'])); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 91 | - echo sprintf( '<input type="hidden" name="order" value="%1$s" />', esc_attr( $_REQUEST['order'] ) ); |
|
| 90 | + if ( ! empty($_REQUEST['order'])) { |
|
| 91 | + echo sprintf('<input type="hidden" name="order" value="%1$s" />', esc_attr($_REQUEST['order'])); |
|
| 92 | 92 | } |
| 93 | 93 | ?> |
| 94 | 94 | <p class="search-box" role="search"> |
| 95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 97 | - <?php submit_button( $text, 'button', false, false, array( |
|
| 97 | + <?php submit_button($text, 'button', false, false, array( |
|
| 98 | 98 | 'ID' => 'search-submit', |
| 99 | - ) ); ?> |
|
| 99 | + )); ?> |
|
| 100 | 100 | </p> |
| 101 | 101 | <?php |
| 102 | 102 | } |
@@ -112,32 +112,32 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return string Column Name. |
| 114 | 114 | */ |
| 115 | - public function column_default( $donor, $column_name ) { |
|
| 115 | + public function column_default($donor, $column_name) { |
|
| 116 | 116 | |
| 117 | - switch ( $column_name ) { |
|
| 117 | + switch ($column_name) { |
|
| 118 | 118 | |
| 119 | 119 | case 'num_donations' : |
| 120 | 120 | $value = sprintf( |
| 121 | 121 | '<a href="%s">%s</a>', |
| 122 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor['id'] ) ), |
|
| 123 | - esc_html( $donor['num_donations'] ) |
|
| 122 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor['id'])), |
|
| 123 | + esc_html($donor['num_donations']) |
|
| 124 | 124 | ); |
| 125 | 125 | break; |
| 126 | 126 | |
| 127 | 127 | case 'amount_spent' : |
| 128 | - $value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) ); |
|
| 128 | + $value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false))); |
|
| 129 | 129 | break; |
| 130 | 130 | |
| 131 | 131 | case 'date_created' : |
| 132 | - $value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) ); |
|
| 132 | + $value = date_i18n(give_date_format(), strtotime($donor['date_created'])); |
|
| 133 | 133 | break; |
| 134 | 134 | |
| 135 | 135 | default: |
| 136 | - $value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null; |
|
| 136 | + $value = isset($donor[$column_name]) ? $donor[$column_name] : null; |
|
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] ); |
|
| 140 | + return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']); |
|
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - public function column_cb( $donor ) { |
|
| 154 | + public function column_cb($donor) { |
|
| 155 | 155 | return sprintf( |
| 156 | 156 | '<input class="donor-selector" type="checkbox" name="%1$s[]" value="%2$d" data-name="%3$s" />', |
| 157 | 157 | $this->_args['singular'], |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return string |
| 172 | 172 | */ |
| 173 | - public function column_name( $donor ) { |
|
| 174 | - $name = ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 175 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ); |
|
| 176 | - $actions = $this->get_row_actions( $donor ); |
|
| 173 | + public function column_name($donor) { |
|
| 174 | + $name = ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
| 175 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']); |
|
| 176 | + $actions = $this->get_row_actions($donor); |
|
| 177 | 177 | |
| 178 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
| 178 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | public function get_columns() { |
| 190 | 190 | $columns = array( |
| 191 | 191 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 192 | - 'name' => __( 'Name', 'give' ), |
|
| 193 | - 'email' => __( 'Email', 'give' ), |
|
| 194 | - 'num_donations' => __( 'Donations', 'give' ), |
|
| 195 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
| 196 | - 'date_created' => __( 'Date Created', 'give' ), |
|
| 192 | + 'name' => __('Name', 'give'), |
|
| 193 | + 'email' => __('Email', 'give'), |
|
| 194 | + 'num_donations' => __('Donations', 'give'), |
|
| 195 | + 'amount_spent' => __('Total Donated', 'give'), |
|
| 196 | + 'date_created' => __('Date Created', 'give'), |
|
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | - return apply_filters( 'give_list_donors_columns', $columns ); |
|
| 199 | + return apply_filters('give_list_donors_columns', $columns); |
|
| 200 | 200 | |
| 201 | 201 | } |
| 202 | 202 | |
@@ -210,13 +210,13 @@ discard block |
||
| 210 | 210 | public function get_sortable_columns() { |
| 211 | 211 | |
| 212 | 212 | $columns = array( |
| 213 | - 'date_created' => array( 'date_created', true ), |
|
| 214 | - 'name' => array( 'name', true ), |
|
| 215 | - 'num_donations' => array( 'purchase_count', false ), |
|
| 216 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 213 | + 'date_created' => array('date_created', true), |
|
| 214 | + 'name' => array('name', true), |
|
| 215 | + 'num_donations' => array('purchase_count', false), |
|
| 216 | + 'amount_spent' => array('purchase_value', false), |
|
| 217 | 217 | ); |
| 218 | 218 | |
| 219 | - return apply_filters( 'give_list_donors_sortable_columns', $columns ); |
|
| 219 | + return apply_filters('give_list_donors_sortable_columns', $columns); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -229,15 +229,15 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return array An array of action links. |
| 231 | 231 | */ |
| 232 | - public function get_row_actions( $donor ) { |
|
| 232 | + public function get_row_actions($donor) { |
|
| 233 | 233 | |
| 234 | 234 | $actions = array( |
| 235 | - 'view' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ), |
|
| 236 | - 'notes' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ), |
|
| 237 | - 'delete' => sprintf( '<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'],sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ), |
|
| 235 | + 'view' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')), |
|
| 236 | + 'notes' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')), |
|
| 237 | + 'delete' => sprintf('<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'], sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')), |
|
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | - return apply_filters( 'give_donor_row_actions', $actions, $donor ); |
|
| 240 | + return apply_filters('give_donor_row_actions', $actions, $donor); |
|
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @return int Current page number. |
| 251 | 251 | */ |
| 252 | 252 | public function get_paged() { |
| 253 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 253 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @return mixed string If search is present, false otherwise. |
| 263 | 263 | */ |
| 264 | 264 | public function get_search() { |
| 265 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 265 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function get_bulk_actions() { |
| 277 | 277 | $actions = array( |
| 278 | - 'delete' => __( 'Delete', 'give' ), |
|
| 278 | + 'delete' => __('Delete', 'give'), |
|
| 279 | 279 | ); |
| 280 | 280 | return $actions; |
| 281 | 281 | } |
@@ -288,19 +288,19 @@ discard block |
||
| 288 | 288 | * @access protected |
| 289 | 289 | * @since 1.8.16 |
| 290 | 290 | */ |
| 291 | - protected function display_tablenav( $which ) { |
|
| 292 | - if ( 'top' === $which ) { |
|
| 293 | - wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false ); |
|
| 291 | + protected function display_tablenav($which) { |
|
| 292 | + if ('top' === $which) { |
|
| 293 | + wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false); |
|
| 294 | 294 | } |
| 295 | 295 | ?> |
| 296 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 297 | - <?php if ( $this->has_items() ) : ?> |
|
| 296 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 297 | + <?php if ($this->has_items()) : ?> |
|
| 298 | 298 | <div class="alignleft actions bulkactions"> |
| 299 | - <?php $this->bulk_actions( $which ); ?> |
|
| 299 | + <?php $this->bulk_actions($which); ?> |
|
| 300 | 300 | </div> |
| 301 | 301 | <?php endif; |
| 302 | - $this->extra_tablenav( $which ); |
|
| 303 | - $this->pagination( $which ); |
|
| 302 | + $this->extra_tablenav($which); |
|
| 303 | + $this->pagination($which); |
|
| 304 | 304 | ?> |
| 305 | 305 | <br class="clear" /> |
| 306 | 306 | </div> |
@@ -321,17 +321,17 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | // Get donor query. |
| 323 | 323 | $args = $this->get_donor_query(); |
| 324 | - $donors = Give()->donors->get_donors( $args ); |
|
| 324 | + $donors = Give()->donors->get_donors($args); |
|
| 325 | 325 | |
| 326 | - if ( $donors ) { |
|
| 326 | + if ($donors) { |
|
| 327 | 327 | |
| 328 | - foreach ( $donors as $donor ) { |
|
| 328 | + foreach ($donors as $donor) { |
|
| 329 | 329 | |
| 330 | - $user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0; |
|
| 331 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
| 330 | + $user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0; |
|
| 331 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
| 332 | 332 | |
| 333 | 333 | // If title prefix is set, then update the donor name. |
| 334 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
| 334 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
| 335 | 335 | |
| 336 | 336 | $data[] = array( |
| 337 | 337 | 'id' => $donor->id, |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - return apply_filters( 'give_donors_column_query_data', $data ); |
|
| 348 | + return apply_filters('give_donors_column_query_data', $data); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | $_donor_query['number'] = - 1; |
| 362 | 362 | $_donor_query['offset'] = 0; |
| 363 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
| 363 | + $donors = Give()->donors->get_donors($_donor_query); |
|
| 364 | 364 | |
| 365 | - return count( $donors ); |
|
| 365 | + return count($donors); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /** |
@@ -375,10 +375,10 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function get_donor_query() { |
| 377 | 377 | $paged = $this->get_paged(); |
| 378 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 378 | + $offset = $this->per_page * ($paged - 1); |
|
| 379 | 379 | $search = $this->get_search(); |
| 380 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 381 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 380 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 381 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 382 | 382 | |
| 383 | 383 | $args = array( |
| 384 | 384 | 'number' => $this->per_page, |
@@ -387,10 +387,10 @@ discard block |
||
| 387 | 387 | 'orderby' => $orderby, |
| 388 | 388 | ); |
| 389 | 389 | |
| 390 | - if ( $search ) { |
|
| 391 | - if ( is_email( $search ) ) { |
|
| 390 | + if ($search) { |
|
| 391 | + if (is_email($search)) { |
|
| 392 | 392 | $args['email'] = $search; |
| 393 | - } elseif ( is_numeric( $search ) ) { |
|
| 393 | + } elseif (is_numeric($search)) { |
|
| 394 | 394 | $args['id'] = $search; |
| 395 | 395 | } else { |
| 396 | 396 | $args['name'] = $search; |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | * @since 1.8.17 |
| 409 | 409 | * @access public |
| 410 | 410 | */ |
| 411 | - public function single_row( $item ) { |
|
| 412 | - echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] ); |
|
| 413 | - $this->single_row_columns( $item ); |
|
| 411 | + public function single_row($item) { |
|
| 412 | + echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']); |
|
| 413 | + $this->single_row_columns($item); |
|
| 414 | 414 | echo '</tr>'; |
| 415 | 415 | } |
| 416 | 416 | |
@@ -423,17 +423,17 @@ discard block |
||
| 423 | 423 | public function display() { |
| 424 | 424 | $singular = $this->_args['singular']; |
| 425 | 425 | |
| 426 | - $this->display_tablenav( 'top' ); |
|
| 426 | + $this->display_tablenav('top'); |
|
| 427 | 427 | |
| 428 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
| 428 | + $this->screen->render_screen_reader_content('heading_list'); |
|
| 429 | 429 | |
| 430 | - $get_data = give_clean( $_GET ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
| 430 | + $get_data = give_clean($_GET); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
| 431 | 431 | |
| 432 | - $search_keyword = ! empty( $get_data['s'] ) ? $get_data['s'] : ''; |
|
| 433 | - $order = ! empty( $get_data['order'] ) ? $get_data['order'] : 'DESC'; |
|
| 434 | - $order_by = ! empty( $get_data['orderby'] ) ? $get_data['orderby'] : 'ID'; |
|
| 432 | + $search_keyword = ! empty($get_data['s']) ? $get_data['s'] : ''; |
|
| 433 | + $order = ! empty($get_data['order']) ? $get_data['order'] : 'DESC'; |
|
| 434 | + $order_by = ! empty($get_data['orderby']) ? $get_data['orderby'] : 'ID'; |
|
| 435 | 435 | ?> |
| 436 | - <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
| 436 | + <table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
| 437 | 437 | <thead> |
| 438 | 438 | <tr> |
| 439 | 439 | <?php $this->print_column_headers(); ?> |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | </thead> |
| 442 | 442 | |
| 443 | 443 | <tbody id="the-list"<?php |
| 444 | - if ( $singular ) { |
|
| 444 | + if ($singular) { |
|
| 445 | 445 | echo " data-wp-lists='list:$singular'"; |
| 446 | 446 | } ?>> |
| 447 | 447 | <tr class="hidden"></tr> |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | <td colspan="6" class="colspanchange"> |
| 450 | 450 | |
| 451 | 451 | <fieldset class="inline-edit-col-left"> |
| 452 | - <legend class="inline-edit-legend"><?php esc_attr_e( 'BULK DELETE', 'give' ); ?></legend> |
|
| 452 | + <legend class="inline-edit-legend"><?php esc_attr_e('BULK DELETE', 'give'); ?></legend> |
|
| 453 | 453 | <div class="inline-edit-col"> |
| 454 | 454 | <div id="bulk-titles"> |
| 455 | 455 | <div id="give-bulk-donors" class="give-bulk-donors"> |
@@ -462,22 +462,22 @@ discard block |
||
| 462 | 462 | <div class="inline-edit-col"> |
| 463 | 463 | <label> |
| 464 | 464 | <input class="give-donor-delete-confirm" type="checkbox" name="give-donor-delete-confirm"/> |
| 465 | - <?php esc_attr_e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?> |
|
| 465 | + <?php esc_attr_e('Are you sure you want to delete the selected donor(s)?', 'give'); ?> |
|
| 466 | 466 | </label> |
| 467 | 467 | <label> |
| 468 | 468 | <input class="give-donor-delete-records" type="checkbox" name="give-donor-delete-records"/> |
| 469 | - <?php esc_attr_e( 'Delete all associated donations and records?', 'give' ); ?> |
|
| 469 | + <?php esc_attr_e('Delete all associated donations and records?', 'give'); ?> |
|
| 470 | 470 | </label> |
| 471 | 471 | </div> |
| 472 | 472 | </fieldset> |
| 473 | 473 | |
| 474 | 474 | <p class="submit inline-edit-save"> |
| 475 | 475 | <input type="hidden" name="give_action" value="delete_bulk_donor"/> |
| 476 | - <input type="hidden" name="s" value="<?php echo esc_html( $search_keyword ); ?>"/> |
|
| 477 | - <input type="hidden" name="orderby" value="<?php echo esc_html( $order_by ); ?>"/> |
|
| 478 | - <input type="hidden" name="order" value="<?php echo esc_html( $order ); ?>"/> |
|
| 479 | - <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php esc_attr_e( 'Cancel', 'give' ); ?></button> |
|
| 480 | - <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php esc_attr_e( 'Delete', 'give' ); ?>"> |
|
| 476 | + <input type="hidden" name="s" value="<?php echo esc_html($search_keyword); ?>"/> |
|
| 477 | + <input type="hidden" name="orderby" value="<?php echo esc_html($order_by); ?>"/> |
|
| 478 | + <input type="hidden" name="order" value="<?php echo esc_html($order); ?>"/> |
|
| 479 | + <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php esc_attr_e('Cancel', 'give'); ?></button> |
|
| 480 | + <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php esc_attr_e('Delete', 'give'); ?>"> |
|
| 481 | 481 | <br class="clear"> |
| 482 | 482 | </p> |
| 483 | 483 | </td> |
@@ -487,13 +487,13 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | <tfoot> |
| 489 | 489 | <tr> |
| 490 | - <?php $this->print_column_headers( false ); ?> |
|
| 490 | + <?php $this->print_column_headers(false); ?> |
|
| 491 | 491 | </tr> |
| 492 | 492 | </tfoot> |
| 493 | 493 | |
| 494 | 494 | </table> |
| 495 | 495 | <?php |
| 496 | - $this->display_tablenav( 'bottom' ); |
|
| 496 | + $this->display_tablenav('bottom'); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | /** |
@@ -510,16 +510,16 @@ discard block |
||
| 510 | 510 | $hidden = array(); // No hidden columns. |
| 511 | 511 | $sortable = $this->get_sortable_columns(); |
| 512 | 512 | |
| 513 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 513 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 514 | 514 | |
| 515 | 515 | $this->items = $this->donor_data(); |
| 516 | 516 | |
| 517 | 517 | $this->total = $this->get_donor_count(); |
| 518 | 518 | |
| 519 | - $this->set_pagination_args( array( |
|
| 519 | + $this->set_pagination_args(array( |
|
| 520 | 520 | 'total_items' => $this->total, |
| 521 | 521 | 'per_page' => $this->per_page, |
| 522 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
| 523 | - ) ); |
|
| 522 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
| 523 | + )); |
|
| 524 | 524 | } |
| 525 | 525 | } |