@@ -137,31 +137,31 @@ |
||
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | 139 | function give_process_user_logout( $data ) { |
| 140 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 140 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 141 | 141 | |
| 142 | - // Prevent occurring of any custom action on wp_logout. |
|
| 143 | - remove_all_actions( 'wp_logout' ); |
|
| 142 | + // Prevent occurring of any custom action on wp_logout. |
|
| 143 | + remove_all_actions( 'wp_logout' ); |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * Fires before processing user logout. |
| 147 | 147 | * |
| 148 | 148 | * @since 1.0 |
| 149 | 149 | */ |
| 150 | - do_action( 'give_before_user_logout' ); |
|
| 150 | + do_action( 'give_before_user_logout' ); |
|
| 151 | 151 | |
| 152 | - // Logout user. |
|
| 153 | - wp_logout(); |
|
| 152 | + // Logout user. |
|
| 153 | + wp_logout(); |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * Fires after processing user logout. |
| 157 | 157 | * |
| 158 | 158 | * @since 1.0 |
| 159 | 159 | */ |
| 160 | - do_action( 'give_after_user_logout' ); |
|
| 160 | + do_action( 'give_after_user_logout' ); |
|
| 161 | 161 | |
| 162 | - wp_redirect( $data['give_logout_redirect'] ); |
|
| 163 | - give_die(); |
|
| 164 | - } |
|
| 162 | + wp_redirect( $data['give_logout_redirect'] ); |
|
| 163 | + give_die(); |
|
| 164 | + } |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return string Login form |
| 28 | 28 | */ |
| 29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
| 30 | - if ( empty( $login_redirect ) ) { |
|
| 29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
| 30 | + if (empty($login_redirect)) { |
|
| 31 | 31 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if ( empty( $logout_redirect ) ) { |
|
| 35 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 34 | + if (empty($logout_redirect)) { |
|
| 35 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | $logout_redirect = add_query_arg( |
| 41 | 41 | array( |
| 42 | 42 | 'give_action' => 'user_logout', |
| 43 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 44 | - 'give_logout_redirect' => urlencode( $logout_redirect ), |
|
| 43 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
| 44 | + 'give_logout_redirect' => urlencode($logout_redirect), |
|
| 45 | 45 | ), |
| 46 | - home_url( '/' ) |
|
| 46 | + home_url('/') |
|
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | 49 | ob_start(); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | ) |
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
| 59 | + return apply_filters('give_login_form', ob_get_clean()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return string Register form |
| 71 | 71 | */ |
| 72 | -function give_register_form( $redirect = '' ) { |
|
| 73 | - if ( empty( $redirect ) ) { |
|
| 72 | +function give_register_form($redirect = '') { |
|
| 73 | + if (empty($redirect)) { |
|
| 74 | 74 | $redirect = give_get_current_page_url(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | ob_start(); |
| 78 | 78 | |
| 79 | - if ( ! is_user_logged_in() ) { |
|
| 79 | + if ( ! is_user_logged_in()) { |
|
| 80 | 80 | give_get_template( |
| 81 | 81 | 'shortcode-register', |
| 82 | 82 | array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
| 88 | + return apply_filters('give_register_form', ob_get_clean()); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -97,34 +97,34 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | -function give_process_login_form( $data ) { |
|
| 101 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
| 102 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
| 103 | - if ( ! $user_data ) { |
|
| 104 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
| 100 | +function give_process_login_form($data) { |
|
| 101 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
| 102 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
| 103 | + if ( ! $user_data) { |
|
| 104 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
| 105 | 105 | } |
| 106 | - if ( $user_data ) { |
|
| 106 | + if ($user_data) { |
|
| 107 | 107 | $user_ID = $user_data->ID; |
| 108 | 108 | $user_email = $user_data->user_email; |
| 109 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
| 110 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
| 109 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
| 110 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
| 111 | 111 | } else { |
| 112 | - give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) ); |
|
| 112 | + give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give')); |
|
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
| 115 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
| 116 | 116 | } |
| 117 | 117 | // Check for errors and redirect if none present |
| 118 | 118 | $errors = give_get_errors(); |
| 119 | - if ( ! $errors ) { |
|
| 120 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
| 121 | - wp_redirect( $redirect ); |
|
| 119 | + if ( ! $errors) { |
|
| 120 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
| 121 | + wp_redirect($redirect); |
|
| 122 | 122 | give_die(); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
| 127 | +add_action('give_user_login', 'give_process_login_form'); |
|
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -136,18 +136,18 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | -function give_process_user_logout( $data ) { |
|
| 140 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 139 | +function give_process_user_logout($data) { |
|
| 140 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
| 141 | 141 | |
| 142 | 142 | // Prevent occurring of any custom action on wp_logout. |
| 143 | - remove_all_actions( 'wp_logout' ); |
|
| 143 | + remove_all_actions('wp_logout'); |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * Fires before processing user logout. |
| 147 | 147 | * |
| 148 | 148 | * @since 1.0 |
| 149 | 149 | */ |
| 150 | - do_action( 'give_before_user_logout' ); |
|
| 150 | + do_action('give_before_user_logout'); |
|
| 151 | 151 | |
| 152 | 152 | // Logout user. |
| 153 | 153 | wp_logout(); |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @since 1.0 |
| 159 | 159 | */ |
| 160 | - do_action( 'give_after_user_logout' ); |
|
| 160 | + do_action('give_after_user_logout'); |
|
| 161 | 161 | |
| 162 | - wp_redirect( $data['give_logout_redirect'] ); |
|
| 162 | + wp_redirect($data['give_logout_redirect']); |
|
| 163 | 163 | give_die(); |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
| 167 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * Log User In |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return void |
| 179 | 179 | */ |
| 180 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
| 181 | - if ( $user_id < 1 ) { |
|
| 180 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
| 181 | + if ($user_id < 1) { |
|
| 182 | 182 | return; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - wp_set_auth_cookie( $user_id ); |
|
| 186 | - wp_set_current_user( $user_id, $user_login ); |
|
| 185 | + wp_set_auth_cookie($user_id); |
|
| 186 | + wp_set_current_user($user_id, $user_login); |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Fires after the user has successfully logged in. |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param string $user_login Username. |
| 194 | 194 | * @param WP_User $$user WP_User object of the logged-in user. |
| 195 | 195 | */ |
| 196 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
| 196 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * Fires after give user has successfully logged in. |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param string $user_login Username. |
| 205 | 205 | * @param string $user_pass User password. |
| 206 | 206 | */ |
| 207 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
| 207 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return void |
| 219 | 219 | */ |
| 220 | -function give_process_register_form( $data ) { |
|
| 220 | +function give_process_register_form($data) { |
|
| 221 | 221 | |
| 222 | - if ( is_user_logged_in() ) { |
|
| 222 | + if (is_user_logged_in()) { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
| 226 | + if (empty($_POST['give_register_submit'])) { |
|
| 227 | 227 | return; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -232,38 +232,38 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @since 1.0 |
| 234 | 234 | */ |
| 235 | - do_action( 'give_pre_process_register_form' ); |
|
| 235 | + do_action('give_pre_process_register_form'); |
|
| 236 | 236 | |
| 237 | - if ( empty( $data['give_user_login'] ) ) { |
|
| 238 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 237 | + if (empty($data['give_user_login'])) { |
|
| 238 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
| 242 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
| 241 | + if (username_exists($data['give_user_login'])) { |
|
| 242 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
| 246 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 245 | + if ( ! validate_username($data['give_user_login'])) { |
|
| 246 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
| 250 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
| 249 | + if (email_exists($data['give_user_email'])) { |
|
| 250 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
| 254 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
| 253 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
| 254 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
| 258 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
| 257 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
| 258 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
| 262 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
| 261 | + if (empty($_POST['give_user_pass'])) { |
|
| 262 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
| 266 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
| 265 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
| 266 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -271,26 +271,26 @@ discard block |
||
| 271 | 271 | * |
| 272 | 272 | * @since 1.0 |
| 273 | 273 | */ |
| 274 | - do_action( 'give_process_register_form' ); |
|
| 274 | + do_action('give_process_register_form'); |
|
| 275 | 275 | |
| 276 | 276 | // Check for errors and redirect if none present |
| 277 | 277 | $errors = give_get_errors(); |
| 278 | 278 | |
| 279 | - if ( empty( $errors ) ) { |
|
| 279 | + if (empty($errors)) { |
|
| 280 | 280 | |
| 281 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
| 281 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
| 282 | 282 | |
| 283 | - give_register_and_login_new_user( array( |
|
| 283 | + give_register_and_login_new_user(array( |
|
| 284 | 284 | 'user_login' => $data['give_user_login'], |
| 285 | 285 | 'user_pass' => $data['give_user_pass'], |
| 286 | 286 | 'user_email' => $data['give_user_email'], |
| 287 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
| 288 | - 'role' => get_option( 'default_role' ) |
|
| 289 | - ) ); |
|
| 287 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
| 288 | + 'role' => get_option('default_role') |
|
| 289 | + )); |
|
| 290 | 290 | |
| 291 | - wp_redirect( $redirect ); |
|
| 291 | + wp_redirect($redirect); |
|
| 292 | 292 | give_die(); |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
| 297 | 296 | \ No newline at end of file |
| 297 | +add_action('give_user_register', 'give_process_register_form'); |
|
| 298 | 298 | \ No newline at end of file |
@@ -253,7 +253,7 @@ |
||
| 253 | 253 | * |
| 254 | 254 | * @access public |
| 255 | 255 | * @since 1.0 |
| 256 | - * @return mixed string If search is present, false otherwise. |
|
| 256 | + * @return string|false string If search is present, false otherwise. |
|
| 257 | 257 | */ |
| 258 | 258 | public function get_search() { |
| 259 | 259 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -185,8 +185,8 @@ |
||
| 185 | 185 | |
| 186 | 186 | case 'num_donations' : |
| 187 | 187 | $value = '<a href="' . |
| 188 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 189 | - ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
| 188 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 189 | + ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
| 190 | 190 | break; |
| 191 | 191 | |
| 192 | 192 | case 'amount_spent' : |
@@ -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 | /** |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | public function __construct() { |
| 62 | 62 | |
| 63 | 63 | // Set parent defaults |
| 64 | - parent::__construct( array( |
|
| 65 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
| 66 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
| 64 | + parent::__construct(array( |
|
| 65 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
| 66 | + 'plural' => esc_html__('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,20 +80,20 @@ 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 '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 87 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 88 | 88 | } |
| 89 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 90 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 89 | + if ( ! empty($_REQUEST['order'])) { |
|
| 90 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 91 | 91 | } |
| 92 | 92 | ?> |
| 93 | 93 | <p class="search-box" role="search"> |
| 94 | 94 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 95 | 95 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 96 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 96 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 97 | 97 | </p> |
| 98 | 98 | <?php |
| 99 | 99 | } |
@@ -109,29 +109,29 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return string Column Name. |
| 111 | 111 | */ |
| 112 | - public function column_default( $item, $column_name ) { |
|
| 113 | - switch ( $column_name ) { |
|
| 112 | + public function column_default($item, $column_name) { |
|
| 113 | + switch ($column_name) { |
|
| 114 | 114 | |
| 115 | 115 | case 'num_donations' : |
| 116 | - $value = '<a href="' . |
|
| 117 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 118 | - ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
| 116 | + $value = '<a href="'. |
|
| 117 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
| 118 | + ).'">'.esc_html($item['num_donations']).'</a>'; |
|
| 119 | 119 | break; |
| 120 | 120 | |
| 121 | 121 | case 'amount_spent' : |
| 122 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 122 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
| 123 | 123 | break; |
| 124 | 124 | |
| 125 | 125 | case 'date_created' : |
| 126 | - $value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) ); |
|
| 126 | + $value = date_i18n(give_date_format(), strtotime($item['date_created'])); |
|
| 127 | 127 | break; |
| 128 | 128 | |
| 129 | 129 | default: |
| 130 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
| 130 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
| 131 | 131 | break; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
| 134 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
| 135 | 135 | |
| 136 | 136 | } |
| 137 | 137 | |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return string |
| 144 | 144 | */ |
| 145 | - public function column_name( $item ) { |
|
| 146 | - $name = '#' . $item['id'] . ' '; |
|
| 147 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 148 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
| 149 | - $actions = $this->get_row_actions( $item ); |
|
| 145 | + public function column_name($item) { |
|
| 146 | + $name = '#'.$item['id'].' '; |
|
| 147 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
| 148 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
| 149 | + $actions = $this->get_row_actions($item); |
|
| 150 | 150 | |
| 151 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
| 151 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -160,14 +160,14 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function get_columns() { |
| 162 | 162 | $columns = array( |
| 163 | - 'name' => esc_html__( 'Name', 'give' ), |
|
| 164 | - 'email' => esc_html__( 'Email', 'give' ), |
|
| 165 | - 'num_donations' => esc_html__( 'Donations', 'give' ), |
|
| 166 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
| 167 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
| 163 | + 'name' => esc_html__('Name', 'give'), |
|
| 164 | + 'email' => esc_html__('Email', 'give'), |
|
| 165 | + 'num_donations' => esc_html__('Donations', 'give'), |
|
| 166 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
| 167 | + 'date_created' => esc_html__('Date Created', 'give') |
|
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
| 170 | + return apply_filters('give_report_customer_columns', $columns); |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | public function get_sortable_columns() { |
| 182 | 182 | |
| 183 | 183 | $columns = array( |
| 184 | - 'date_created' => array( 'date_created', true ), |
|
| 185 | - 'name' => array( 'name', true ), |
|
| 186 | - 'num_donations' => array( 'purchase_count', false ), |
|
| 187 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 184 | + 'date_created' => array('date_created', true), |
|
| 185 | + 'name' => array('name', true), |
|
| 186 | + 'num_donations' => array('purchase_count', false), |
|
| 187 | + 'amount_spent' => array('purchase_value', false), |
|
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | - return apply_filters( 'give_report_sortable_customer_columns', $columns ); |
|
| 190 | + return apply_filters('give_report_sortable_customer_columns', $columns); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -200,34 +200,34 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return array An array of action links. |
| 202 | 202 | */ |
| 203 | - public function get_row_actions( $item ) { |
|
| 203 | + public function get_row_actions($item) { |
|
| 204 | 204 | |
| 205 | 205 | $actions = array( |
| 206 | 206 | |
| 207 | 207 | 'view' => sprintf( |
| 208 | 208 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 209 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ), |
|
| 210 | - sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ), |
|
| 211 | - esc_html__( 'View Donor', 'give' ) |
|
| 209 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']), |
|
| 210 | + sprintf(esc_attr__('View "%s"', 'give'), $item['name']), |
|
| 211 | + esc_html__('View Donor', 'give') |
|
| 212 | 212 | ), |
| 213 | 213 | |
| 214 | 214 | 'notes' => sprintf( |
| 215 | 215 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 216 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ), |
|
| 217 | - sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ), |
|
| 218 | - esc_html__( 'Notes', 'give' ) |
|
| 216 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']), |
|
| 217 | + sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']), |
|
| 218 | + esc_html__('Notes', 'give') |
|
| 219 | 219 | ), |
| 220 | 220 | |
| 221 | 221 | 'delete' => sprintf( |
| 222 | 222 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 223 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), |
|
| 224 | - sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ), |
|
| 225 | - esc_html__( 'Delete', 'give' ) |
|
| 223 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), |
|
| 224 | + sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']), |
|
| 225 | + esc_html__('Delete', 'give') |
|
| 226 | 226 | ) |
| 227 | 227 | |
| 228 | 228 | ); |
| 229 | 229 | |
| 230 | - return apply_filters( 'give_donor_row_actions', $actions, $item ); |
|
| 230 | + return apply_filters('give_donor_row_actions', $actions, $item); |
|
| 231 | 231 | |
| 232 | 232 | } |
| 233 | 233 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @since 1.0 |
| 242 | 242 | * @return void |
| 243 | 243 | */ |
| 244 | - public function bulk_actions( $which = '' ) { |
|
| 244 | + public function bulk_actions($which = '') { |
|
| 245 | 245 | // These aren't really bulk actions but this outputs the markup in the right place. |
| 246 | 246 | } |
| 247 | 247 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @return int Current page number. |
| 254 | 254 | */ |
| 255 | 255 | public function get_paged() { |
| 256 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 256 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @return mixed string If search is present, false otherwise. |
| 265 | 265 | */ |
| 266 | 266 | public function get_search() { |
| 267 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 267 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | // Get donor query. |
| 283 | 283 | $args = $this->get_donor_query(); |
| 284 | - $customers = Give()->customers->get_customers( $args ); |
|
| 284 | + $customers = Give()->customers->get_customers($args); |
|
| 285 | 285 | |
| 286 | - if ( $customers ) { |
|
| 286 | + if ($customers) { |
|
| 287 | 287 | |
| 288 | - foreach ( $customers as $customer ) { |
|
| 288 | + foreach ($customers as $customer) { |
|
| 289 | 289 | |
| 290 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
| 290 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
| 291 | 291 | |
| 292 | 292 | $data[] = array( |
| 293 | 293 | 'id' => $customer->id, |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - return apply_filters( 'give_donors_column_query_data', $data ); |
|
| 304 | + return apply_filters('give_donors_column_query_data', $data); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | $_donor_query = $this->get_donor_query(); |
| 316 | 316 | |
| 317 | 317 | $_donor_query['number'] = - 1; |
| 318 | - $donors = Give()->customers->get_customers( $_donor_query ); |
|
| 318 | + $donors = Give()->customers->get_customers($_donor_query); |
|
| 319 | 319 | |
| 320 | - return count( $donors ); |
|
| 320 | + return count($donors); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function get_donor_query() { |
| 331 | 331 | $paged = $this->get_paged(); |
| 332 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 332 | + $offset = $this->per_page * ($paged - 1); |
|
| 333 | 333 | $search = $this->get_search(); |
| 334 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 335 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 334 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 335 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 336 | 336 | |
| 337 | 337 | $args = array( |
| 338 | 338 | 'number' => $this->per_page, |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | 'orderby' => $orderby, |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | - if ( $search ) { |
|
| 345 | - if ( is_email( $search ) ) { |
|
| 344 | + if ($search) { |
|
| 345 | + if (is_email($search)) { |
|
| 346 | 346 | $args['email'] = $search; |
| 347 | - } elseif ( is_numeric( $search ) ) { |
|
| 347 | + } elseif (is_numeric($search)) { |
|
| 348 | 348 | $args['id'] = $search; |
| 349 | 349 | } else { |
| 350 | 350 | $args['name'] = $search; |
@@ -371,16 +371,16 @@ discard block |
||
| 371 | 371 | $hidden = array(); // No hidden columns |
| 372 | 372 | $sortable = $this->get_sortable_columns(); |
| 373 | 373 | |
| 374 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 374 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 375 | 375 | |
| 376 | 376 | $this->items = $this->donor_data(); |
| 377 | 377 | |
| 378 | 378 | $this->total = $this->get_donor_count(); |
| 379 | 379 | |
| 380 | - $this->set_pagination_args( array( |
|
| 380 | + $this->set_pagination_args(array( |
|
| 381 | 381 | 'total_items' => $this->total, |
| 382 | 382 | 'per_page' => $this->per_page, |
| 383 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
| 384 | - ) ); |
|
| 383 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
| 384 | + )); |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | \ No newline at end of file |
@@ -10,61 +10,61 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load Give file. |
| 18 | -include_once( 'give.php' ); |
|
| 18 | +include_once('give.php'); |
|
| 19 | 19 | |
| 20 | 20 | global $wpdb, $wp_roles; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | -if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) { |
|
| 23 | +if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) { |
|
| 24 | 24 | |
| 25 | 25 | // Delete All the Custom Post Types. |
| 26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
| 27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
| 28 | - foreach ( $give_post_types as $post_type ) { |
|
| 26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
| 27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
| 28 | + foreach ($give_post_types as $post_type) { |
|
| 29 | 29 | |
| 30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
| 31 | - $items = get_posts( array( |
|
| 30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
| 31 | + $items = get_posts(array( |
|
| 32 | 32 | 'post_type' => $post_type, |
| 33 | 33 | 'post_status' => 'any', |
| 34 | - 'numberposts' => - 1, |
|
| 34 | + 'numberposts' => -1, |
|
| 35 | 35 | 'fields' => 'ids', |
| 36 | - ) ); |
|
| 36 | + )); |
|
| 37 | 37 | |
| 38 | - if ( $items ) { |
|
| 39 | - foreach ( $items as $item ) { |
|
| 40 | - wp_delete_post( $item, true ); |
|
| 38 | + if ($items) { |
|
| 39 | + foreach ($items as $item) { |
|
| 40 | + wp_delete_post($item, true); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Delete All the Terms & Taxonomies. |
| 46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
| 46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
| 47 | 47 | |
| 48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
| 48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
| 49 | 49 | |
| 50 | 50 | // Delete Terms. |
| 51 | - if ( $terms ) { |
|
| 52 | - foreach ( $terms as $term ) { |
|
| 53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
| 54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
| 51 | + if ($terms) { |
|
| 52 | + foreach ($terms as $term) { |
|
| 53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
| 54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Delete Taxonomies. |
| 59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
| 59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Delete the Plugin Pages. |
| 63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
| 64 | - foreach ( $give_created_pages as $p ) { |
|
| 65 | - $page = give_get_option( $p, false ); |
|
| 66 | - if ( $page ) { |
|
| 67 | - wp_delete_post( $page, true ); |
|
| 63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
| 64 | + foreach ($give_created_pages as $p) { |
|
| 65 | + $page = give_get_option($p, false); |
|
| 66 | + if ($page) { |
|
| 67 | + wp_delete_post($page, true); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,20 +72,20 @@ discard block |
||
| 72 | 72 | Give()->roles->remove_caps(); |
| 73 | 73 | |
| 74 | 74 | // Delete the Roles. |
| 75 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
| 76 | - foreach ( $give_roles as $role ) { |
|
| 77 | - remove_role( $role ); |
|
| 75 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
| 76 | + foreach ($give_roles as $role) { |
|
| 77 | + remove_role($role); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Remove all database tables. |
| 81 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
| 82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
| 83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
| 81 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
| 82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
| 83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
| 84 | 84 | |
| 85 | 85 | // Cleanup Cron Events. |
| 86 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
| 87 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
| 88 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
| 86 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
| 87 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
| 88 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
| 89 | 89 | |
| 90 | 90 | // Get all options. |
| 91 | 91 | $give_option_names = $wpdb->get_results( |
@@ -96,24 +96,24 @@ discard block |
||
| 96 | 96 | ARRAY_A |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - if ( ! empty( $give_option_names ) ) { |
|
| 99 | + if ( ! empty($give_option_names)) { |
|
| 100 | 100 | // Convert option name to transient or option name. |
| 101 | 101 | $new_give_option_names = array(); |
| 102 | 102 | |
| 103 | - foreach ( $give_option_names as $option ) { |
|
| 104 | - $new_give_option_names[] = ( false !== strpos( $option['option_name'], '_transient_' ) ) |
|
| 105 | - ? str_replace( '_transient_', '', $option['option_name'] ) |
|
| 103 | + foreach ($give_option_names as $option) { |
|
| 104 | + $new_give_option_names[] = (false !== strpos($option['option_name'], '_transient_')) |
|
| 105 | + ? str_replace('_transient_', '', $option['option_name']) |
|
| 106 | 106 | : $option['option_name']; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $give_option_names = $new_give_option_names; |
| 110 | 110 | |
| 111 | 111 | // Delete all the Plugin Options. |
| 112 | - foreach ( $give_option_names as $option ) { |
|
| 113 | - if ( false !== strpos( $option, '_transient_' ) ) { |
|
| 114 | - delete_transient( $option ); |
|
| 112 | + foreach ($give_option_names as $option) { |
|
| 113 | + if (false !== strpos($option, '_transient_')) { |
|
| 114 | + delete_transient($option); |
|
| 115 | 115 | } else { |
| 116 | - delete_option( $option ); |
|
| 116 | + delete_option($option); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -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 | |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | * @param bool $_id Post id. Default is false. |
| 338 | 338 | * @param array $_args Arguments passed. |
| 339 | 339 | */ |
| 340 | - public function __construct( $_id = false, $_args = array() ) { |
|
| 340 | + public function __construct($_id = false, $_args = array()) { |
|
| 341 | 341 | |
| 342 | - $donation_form = WP_Post::get_instance( $_id ); |
|
| 342 | + $donation_form = WP_Post::get_instance($_id); |
|
| 343 | 343 | |
| 344 | - return $this->setup_donation_form( $donation_form ); |
|
| 344 | + return $this->setup_donation_form($donation_form); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -354,23 +354,23 @@ discard block |
||
| 354 | 354 | * |
| 355 | 355 | * @return bool If the setup was successful or not. |
| 356 | 356 | */ |
| 357 | - private function setup_donation_form( $donation_form ) { |
|
| 357 | + private function setup_donation_form($donation_form) { |
|
| 358 | 358 | |
| 359 | - if ( ! is_object( $donation_form ) ) { |
|
| 359 | + if ( ! is_object($donation_form)) { |
|
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
| 363 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
| 364 | 364 | return false; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
| 367 | + if ('give_forms' !== $donation_form->post_type) { |
|
| 368 | 368 | return false; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - foreach ( $donation_form as $key => $value ) { |
|
| 371 | + foreach ($donation_form as $key => $value) { |
|
| 372 | 372 | |
| 373 | - switch ( $key ) { |
|
| 373 | + switch ($key) { |
|
| 374 | 374 | |
| 375 | 375 | default: |
| 376 | 376 | $this->$key = $value; |
@@ -394,16 +394,16 @@ discard block |
||
| 394 | 394 | * |
| 395 | 395 | * @return mixed |
| 396 | 396 | */ |
| 397 | - public function __get( $key ) { |
|
| 397 | + public function __get($key) { |
|
| 398 | 398 | |
| 399 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
| 399 | + if (method_exists($this, 'get_'.$key)) { |
|
| 400 | 400 | |
| 401 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
| 401 | + return call_user_func(array($this, 'get_'.$key)); |
|
| 402 | 402 | |
| 403 | 403 | } else { |
| 404 | 404 | |
| 405 | 405 | /* translators: %s: property key */ |
| 406 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
| 406 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
| 407 | 407 | |
| 408 | 408 | } |
| 409 | 409 | |
@@ -419,30 +419,30 @@ discard block |
||
| 419 | 419 | * |
| 420 | 420 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
| 421 | 421 | */ |
| 422 | - public function create( $data = array() ) { |
|
| 422 | + public function create($data = array()) { |
|
| 423 | 423 | |
| 424 | - if ( $this->id != 0 ) { |
|
| 424 | + if ($this->id != 0) { |
|
| 425 | 425 | return false; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $defaults = array( |
| 429 | 429 | 'post_type' => 'give_forms', |
| 430 | 430 | 'post_status' => 'draft', |
| 431 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
| 431 | + 'post_title' => __('New Donation Form', 'give'), |
|
| 432 | 432 | ); |
| 433 | 433 | |
| 434 | - $args = wp_parse_args( $data, $defaults ); |
|
| 434 | + $args = wp_parse_args($data, $defaults); |
|
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | 437 | * Fired before a donation form is created |
| 438 | 438 | * |
| 439 | 439 | * @param array $args The post object arguments used for creation. |
| 440 | 440 | */ |
| 441 | - do_action( 'give_form_pre_create', $args ); |
|
| 441 | + do_action('give_form_pre_create', $args); |
|
| 442 | 442 | |
| 443 | - $id = wp_insert_post( $args, true ); |
|
| 443 | + $id = wp_insert_post($args, true); |
|
| 444 | 444 | |
| 445 | - $donation_form = WP_Post::get_instance( $id ); |
|
| 445 | + $donation_form = WP_Post::get_instance($id); |
|
| 446 | 446 | |
| 447 | 447 | /** |
| 448 | 448 | * Fired after a donation form is created |
@@ -450,9 +450,9 @@ discard block |
||
| 450 | 450 | * @param int $id The post ID of the created item. |
| 451 | 451 | * @param array $args The post object arguments used for creation. |
| 452 | 452 | */ |
| 453 | - do_action( 'give_form_post_create', $id, $args ); |
|
| 453 | + do_action('give_form_post_create', $id, $args); |
|
| 454 | 454 | |
| 455 | - return $this->setup_donation_form( $donation_form ); |
|
| 455 | + return $this->setup_donation_form($donation_form); |
|
| 456 | 456 | |
| 457 | 457 | } |
| 458 | 458 | |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | * @return string Donation form name. |
| 478 | 478 | */ |
| 479 | 479 | public function get_name() { |
| 480 | - return get_the_title( $this->ID ); |
|
| 480 | + return get_the_title($this->ID); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -490,13 +490,13 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | public function get_price() { |
| 492 | 492 | |
| 493 | - if ( ! isset( $this->price ) ) { |
|
| 493 | + if ( ! isset($this->price)) { |
|
| 494 | 494 | |
| 495 | - $this->price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
| 495 | + $this->price = get_post_meta($this->ID, '_give_set_price', true); |
|
| 496 | 496 | |
| 497 | - if ( $this->price ) { |
|
| 497 | + if ($this->price) { |
|
| 498 | 498 | |
| 499 | - $this->price = give_sanitize_amount( $this->price ); |
|
| 499 | + $this->price = give_sanitize_amount($this->price); |
|
| 500 | 500 | |
| 501 | 501 | } else { |
| 502 | 502 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * @param string $price The donation form price. |
| 515 | 515 | * @param string|int $id The form ID. |
| 516 | 516 | */ |
| 517 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
| 517 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -527,14 +527,14 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | public function get_minimum_price() { |
| 529 | 529 | |
| 530 | - if ( ! isset( $this->minimum_price ) ) { |
|
| 530 | + if ( ! isset($this->minimum_price)) { |
|
| 531 | 531 | |
| 532 | - $allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
| 533 | - $this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
| 532 | + $allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true); |
|
| 533 | + $this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true); |
|
| 534 | 534 | |
| 535 | - if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) { |
|
| 535 | + if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) { |
|
| 536 | 536 | |
| 537 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
| 537 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
| 538 | 538 | |
| 539 | 539 | } else { |
| 540 | 540 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
| 547 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
@@ -557,9 +557,9 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | public function get_prices() { |
| 559 | 559 | |
| 560 | - if ( ! isset( $this->prices ) ) { |
|
| 560 | + if ( ! isset($this->prices)) { |
|
| 561 | 561 | |
| 562 | - $this->prices = get_post_meta( $this->ID, '_give_donation_levels', true ); |
|
| 562 | + $this->prices = get_post_meta($this->ID, '_give_donation_levels', true); |
|
| 563 | 563 | |
| 564 | 564 | } |
| 565 | 565 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | * @param array $prices The array of mulit-level prices. |
| 572 | 572 | * @param int|string $ID The ID of the form. |
| 573 | 573 | */ |
| 574 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
| 574 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
| 575 | 575 | |
| 576 | 576 | } |
| 577 | 577 | |
@@ -585,13 +585,13 @@ discard block |
||
| 585 | 585 | */ |
| 586 | 586 | public function get_goal() { |
| 587 | 587 | |
| 588 | - if ( ! isset( $this->goal ) ) { |
|
| 588 | + if ( ! isset($this->goal)) { |
|
| 589 | 589 | |
| 590 | - $this->goal = get_post_meta( $this->ID, '_give_set_goal', true ); |
|
| 590 | + $this->goal = get_post_meta($this->ID, '_give_set_goal', true); |
|
| 591 | 591 | |
| 592 | - if ( $this->goal ) { |
|
| 592 | + if ($this->goal) { |
|
| 593 | 593 | |
| 594 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
| 594 | + $this->goal = give_sanitize_amount($this->goal); |
|
| 595 | 595 | |
| 596 | 596 | } else { |
| 597 | 597 | |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
| 604 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
| 605 | 605 | |
| 606 | 606 | } |
| 607 | 607 | |
@@ -615,10 +615,10 @@ discard block |
||
| 615 | 615 | */ |
| 616 | 616 | public function is_single_price_mode() { |
| 617 | 617 | |
| 618 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
| 618 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
| 619 | 619 | $ret = 0; |
| 620 | 620 | |
| 621 | - if ( empty( $option ) || $option === 'set' ) { |
|
| 621 | + if (empty($option) || $option === 'set') { |
|
| 622 | 622 | $ret = 1; |
| 623 | 623 | } |
| 624 | 624 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * @param bool $ret Is donation form in single price mode? |
| 631 | 631 | * @param int|string $ID The ID of the donation form. |
| 632 | 632 | */ |
| 633 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
| 633 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
| 634 | 634 | |
| 635 | 635 | } |
| 636 | 636 | |
@@ -644,10 +644,10 @@ discard block |
||
| 644 | 644 | */ |
| 645 | 645 | public function is_custom_price_mode() { |
| 646 | 646 | |
| 647 | - $option = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
| 647 | + $option = get_post_meta($this->ID, '_give_custom_amount', true); |
|
| 648 | 648 | $ret = 0; |
| 649 | 649 | |
| 650 | - if ( give_is_setting_enabled( $option ) ) { |
|
| 650 | + if (give_is_setting_enabled($option)) { |
|
| 651 | 651 | $ret = 1; |
| 652 | 652 | } |
| 653 | 653 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | * @param bool $ret Is donation form in custom price mode? |
| 660 | 660 | * @param int|string $ID The ID of the donation form. |
| 661 | 661 | */ |
| 662 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
| 662 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
| 663 | 663 | |
| 664 | 664 | } |
| 665 | 665 | |
@@ -675,10 +675,10 @@ discard block |
||
| 675 | 675 | */ |
| 676 | 676 | public function has_variable_prices() { |
| 677 | 677 | |
| 678 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
| 678 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
| 679 | 679 | $ret = 0; |
| 680 | 680 | |
| 681 | - if ( $option === 'multi' ) { |
|
| 681 | + if ($option === 'multi') { |
|
| 682 | 682 | $ret = 1; |
| 683 | 683 | } |
| 684 | 684 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | * @param bool $ret Does donation form have variable prices? |
| 689 | 689 | * @param int|string $ID The ID of the donation form. |
| 690 | 690 | */ |
| 691 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
| 691 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
| 692 | 692 | |
| 693 | 693 | } |
| 694 | 694 | |
@@ -702,17 +702,17 @@ discard block |
||
| 702 | 702 | */ |
| 703 | 703 | public function get_type() { |
| 704 | 704 | |
| 705 | - if ( ! isset( $this->type ) ) { |
|
| 705 | + if ( ! isset($this->type)) { |
|
| 706 | 706 | |
| 707 | - $this->type = get_post_meta( $this->ID, '_give_price_option', true ); |
|
| 707 | + $this->type = get_post_meta($this->ID, '_give_price_option', true); |
|
| 708 | 708 | |
| 709 | - if ( empty( $this->type ) ) { |
|
| 709 | + if (empty($this->type)) { |
|
| 710 | 710 | $this->type = 'set'; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
| 715 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
| 716 | 716 | |
| 717 | 717 | } |
| 718 | 718 | |
@@ -728,23 +728,23 @@ discard block |
||
| 728 | 728 | * |
| 729 | 729 | * @return string |
| 730 | 730 | */ |
| 731 | - public function get_form_classes( $args ) { |
|
| 731 | + public function get_form_classes($args) { |
|
| 732 | 732 | |
| 733 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
| 733 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
| 734 | 734 | ? 'float-labels-enabled' |
| 735 | 735 | : ''; |
| 736 | 736 | |
| 737 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
| 737 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
| 738 | 738 | 'give-form', |
| 739 | - 'give-form-' . $this->ID, |
|
| 740 | - 'give-form-type-' . $this->get_type(), |
|
| 739 | + 'give-form-'.$this->ID, |
|
| 740 | + 'give-form-type-'.$this->get_type(), |
|
| 741 | 741 | $float_labels_option, |
| 742 | - ), $this->ID, $args ); |
|
| 742 | + ), $this->ID, $args); |
|
| 743 | 743 | |
| 744 | 744 | // Remove empty class names. |
| 745 | - $form_classes_array = array_filter( $form_classes_array ); |
|
| 745 | + $form_classes_array = array_filter($form_classes_array); |
|
| 746 | 746 | |
| 747 | - return implode( ' ', $form_classes_array ); |
|
| 747 | + return implode(' ', $form_classes_array); |
|
| 748 | 748 | |
| 749 | 749 | } |
| 750 | 750 | |
@@ -759,24 +759,24 @@ discard block |
||
| 759 | 759 | * |
| 760 | 760 | * @return string |
| 761 | 761 | */ |
| 762 | - public function get_form_wrap_classes( $args ) { |
|
| 762 | + public function get_form_wrap_classes($args) { |
|
| 763 | 763 | |
| 764 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 764 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 765 | 765 | ? $args['display_style'] |
| 766 | - : get_post_meta( $this->ID, '_give_payment_display', true ); |
|
| 766 | + : get_post_meta($this->ID, '_give_payment_display', true); |
|
| 767 | 767 | |
| 768 | 768 | // If admin want to show only button for form then user inbuilt modal functionality. |
| 769 | - if( 'button' === $display_option ) { |
|
| 769 | + if ('button' === $display_option) { |
|
| 770 | 770 | $display_option = 'modal give-display-button-only'; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
| 773 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
| 774 | 774 | 'give-form-wrap', |
| 775 | - 'give-display-' . $display_option, |
|
| 776 | - ), $this->ID, $args ); |
|
| 775 | + 'give-display-'.$display_option, |
|
| 776 | + ), $this->ID, $args); |
|
| 777 | 777 | |
| 778 | 778 | |
| 779 | - return implode( ' ', $form_wrap_classes_array ); |
|
| 779 | + return implode(' ', $form_wrap_classes_array); |
|
| 780 | 780 | |
| 781 | 781 | } |
| 782 | 782 | |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | public function is_set_type_donation_form() { |
| 792 | 792 | $form_type = $this->get_type(); |
| 793 | 793 | |
| 794 | - return ( 'set' === $form_type ? true : false ); |
|
| 794 | + return ('set' === $form_type ? true : false); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | public function is_multi_type_donation_form() { |
| 806 | 806 | $form_type = $this->get_type(); |
| 807 | 807 | |
| 808 | - return ( 'multi' === $form_type ? true : false ); |
|
| 808 | + return ('multi' === $form_type ? true : false); |
|
| 809 | 809 | |
| 810 | 810 | } |
| 811 | 811 | |
@@ -819,15 +819,15 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | public function get_sales() { |
| 821 | 821 | |
| 822 | - if ( ! isset( $this->sales ) ) { |
|
| 822 | + if ( ! isset($this->sales)) { |
|
| 823 | 823 | |
| 824 | - if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) { |
|
| 825 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
| 824 | + if ('' == get_post_meta($this->ID, '_give_form_sales', true)) { |
|
| 825 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
| 826 | 826 | } // End if |
| 827 | 827 | |
| 828 | - $this->sales = get_post_meta( $this->ID, '_give_form_sales', true ); |
|
| 828 | + $this->sales = get_post_meta($this->ID, '_give_form_sales', true); |
|
| 829 | 829 | |
| 830 | - if ( $this->sales < 0 ) { |
|
| 830 | + if ($this->sales < 0) { |
|
| 831 | 831 | // Never let sales be less than zero |
| 832 | 832 | $this->sales = 0; |
| 833 | 833 | } |
@@ -848,13 +848,13 @@ discard block |
||
| 848 | 848 | * |
| 849 | 849 | * @return int|false New number of total sales. |
| 850 | 850 | */ |
| 851 | - public function increase_sales( $quantity = 1 ) { |
|
| 851 | + public function increase_sales($quantity = 1) { |
|
| 852 | 852 | |
| 853 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
| 854 | - $quantity = absint( $quantity ); |
|
| 853 | + $sales = give_get_form_sales_stats($this->ID); |
|
| 854 | + $quantity = absint($quantity); |
|
| 855 | 855 | $total_sales = $sales + $quantity; |
| 856 | 856 | |
| 857 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
| 857 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
| 858 | 858 | |
| 859 | 859 | $this->sales = $total_sales; |
| 860 | 860 | |
@@ -875,17 +875,17 @@ discard block |
||
| 875 | 875 | * |
| 876 | 876 | * @return int|false New number of total sales. |
| 877 | 877 | */ |
| 878 | - public function decrease_sales( $quantity = 1 ) { |
|
| 878 | + public function decrease_sales($quantity = 1) { |
|
| 879 | 879 | |
| 880 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
| 880 | + $sales = give_get_form_sales_stats($this->ID); |
|
| 881 | 881 | |
| 882 | 882 | // Only decrease if not already zero |
| 883 | - if ( $sales > 0 ) { |
|
| 883 | + if ($sales > 0) { |
|
| 884 | 884 | |
| 885 | - $quantity = absint( $quantity ); |
|
| 885 | + $quantity = absint($quantity); |
|
| 886 | 886 | $total_sales = $sales - $quantity; |
| 887 | 887 | |
| 888 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
| 888 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
| 889 | 889 | |
| 890 | 890 | $this->sales = $sales; |
| 891 | 891 | |
@@ -909,15 +909,15 @@ discard block |
||
| 909 | 909 | */ |
| 910 | 910 | public function get_earnings() { |
| 911 | 911 | |
| 912 | - if ( ! isset( $this->earnings ) ) { |
|
| 912 | + if ( ! isset($this->earnings)) { |
|
| 913 | 913 | |
| 914 | - if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
| 915 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
| 914 | + if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) { |
|
| 915 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | - $this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true ); |
|
| 918 | + $this->earnings = get_post_meta($this->ID, '_give_form_earnings', true); |
|
| 919 | 919 | |
| 920 | - if ( $this->earnings < 0 ) { |
|
| 920 | + if ($this->earnings < 0) { |
|
| 921 | 921 | // Never let earnings be less than zero |
| 922 | 922 | $this->earnings = 0; |
| 923 | 923 | } |
@@ -938,12 +938,12 @@ discard block |
||
| 938 | 938 | * |
| 939 | 939 | * @return float|false |
| 940 | 940 | */ |
| 941 | - public function increase_earnings( $amount = 0 ) { |
|
| 941 | + public function increase_earnings($amount = 0) { |
|
| 942 | 942 | |
| 943 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
| 943 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
| 944 | 944 | $new_amount = $earnings + (float) $amount; |
| 945 | 945 | |
| 946 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
| 946 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
| 947 | 947 | |
| 948 | 948 | $this->earnings = $new_amount; |
| 949 | 949 | |
@@ -965,16 +965,16 @@ discard block |
||
| 965 | 965 | * |
| 966 | 966 | * @return float|false |
| 967 | 967 | */ |
| 968 | - public function decrease_earnings( $amount ) { |
|
| 968 | + public function decrease_earnings($amount) { |
|
| 969 | 969 | |
| 970 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
| 970 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
| 971 | 971 | |
| 972 | - if ( $earnings > 0 ) { |
|
| 972 | + if ($earnings > 0) { |
|
| 973 | 973 | // Only decrease if greater than zero |
| 974 | 974 | $new_amount = $earnings - (float) $amount; |
| 975 | 975 | |
| 976 | 976 | |
| 977 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
| 977 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
| 978 | 978 | |
| 979 | 979 | $this->earnings = $new_amount; |
| 980 | 980 | |
@@ -998,22 +998,22 @@ discard block |
||
| 998 | 998 | * |
| 999 | 999 | * @return bool |
| 1000 | 1000 | */ |
| 1001 | - public function is_free( $price_id = false ) { |
|
| 1001 | + public function is_free($price_id = false) { |
|
| 1002 | 1002 | |
| 1003 | 1003 | $is_free = false; |
| 1004 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
| 1004 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
| 1005 | 1005 | |
| 1006 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
| 1007 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
| 1008 | - } elseif ( ! $variable_pricing ) { |
|
| 1009 | - $price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
| 1006 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
| 1007 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
| 1008 | + } elseif ( ! $variable_pricing) { |
|
| 1009 | + $price = get_post_meta($this->ID, '_give_set_price', true); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
| 1012 | + if (isset($price) && (float) $price == 0) { |
|
| 1013 | 1013 | $is_free = true; |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
| 1016 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
| 1017 | 1017 | |
| 1018 | 1018 | } |
| 1019 | 1019 | |
@@ -1040,9 +1040,9 @@ discard block |
||
| 1040 | 1040 | $is_close_form = apply_filters( |
| 1041 | 1041 | 'give_is_close_donation_form', |
| 1042 | 1042 | ( |
| 1043 | - give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
| 1044 | - && give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
| 1045 | - && ( $this->get_goal() <= $this->get_earnings() |
|
| 1043 | + give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) ) |
|
| 1044 | + && give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
| 1045 | + && ($this->get_goal() <= $this->get_earnings() |
|
| 1046 | 1046 | ), |
| 1047 | 1047 | $this->ID |
| 1048 | 1048 | ); |
@@ -1061,29 +1061,29 @@ discard block |
||
| 1061 | 1061 | * |
| 1062 | 1062 | * @return bool The result of the update query. |
| 1063 | 1063 | */ |
| 1064 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
| 1064 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
| 1065 | 1065 | |
| 1066 | 1066 | /* @var WPDB $wpdb */ |
| 1067 | 1067 | global $wpdb; |
| 1068 | 1068 | |
| 1069 | - if ( empty( $meta_key ) ) { |
|
| 1069 | + if (empty($meta_key)) { |
|
| 1070 | 1070 | return false; |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | // Make sure if it needs to be serialized, we do |
| 1074 | - $meta_value = maybe_serialize( $meta_value ); |
|
| 1074 | + $meta_value = maybe_serialize($meta_value); |
|
| 1075 | 1075 | |
| 1076 | - if ( is_numeric( $meta_value ) ) { |
|
| 1077 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
| 1076 | + if (is_numeric($meta_value)) { |
|
| 1077 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
| 1078 | 1078 | } else { |
| 1079 | 1079 | $value_type = "'%s'"; |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
| 1082 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
| 1083 | 1083 | |
| 1084 | - if ( $wpdb->query( $sql ) ) { |
|
| 1084 | + if ($wpdb->query($sql)) { |
|
| 1085 | 1085 | |
| 1086 | - clean_post_cache( $this->ID ); |
|
| 1086 | + clean_post_cache($this->ID); |
|
| 1087 | 1087 | |
| 1088 | 1088 | return true; |
| 1089 | 1089 | |
@@ -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,36 +23,36 @@ discard block |
||
| 23 | 23 | function give_setup_post_types() { |
| 24 | 24 | |
| 25 | 25 | // Give Forms single post and archive options. |
| 26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
| 27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
| 26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
| 27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
| 28 | 28 | |
| 29 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
| 29 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
| 30 | 30 | // Support for old 'GIVE_FORMS_SLUG' constant |
| 31 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
| 31 | + if (defined('GIVE_FORMS_SLUG')) { |
|
| 32 | 32 | $give_forms_slug = GIVE_FORMS_SLUG; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
| 35 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
| 36 | 36 | 'slug' => $give_forms_slug, |
| 37 | 37 | 'with_front' => false, |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
| 41 | - 'name' => esc_html__( 'Donation Forms', 'give' ), |
|
| 42 | - 'singular_name' => esc_html__( 'Form', 'give' ), |
|
| 43 | - 'add_new' => esc_html__( 'Add Form', 'give' ), |
|
| 44 | - 'add_new_item' => esc_html__( 'Add New Donation Form', 'give' ), |
|
| 45 | - 'edit_item' => esc_html__( 'Edit Donation Form', 'give' ), |
|
| 46 | - 'new_item' => esc_html__( 'New Form', 'give' ), |
|
| 47 | - 'all_items' => esc_html__( 'All Forms', 'give' ), |
|
| 48 | - 'view_item' => esc_html__( 'View Form', 'give' ), |
|
| 49 | - 'search_items' => esc_html__( 'Search Forms', 'give' ), |
|
| 50 | - 'not_found' => esc_html__( 'No forms found.', 'give' ), |
|
| 51 | - 'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ), |
|
| 40 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
| 41 | + 'name' => esc_html__('Donation Forms', 'give'), |
|
| 42 | + 'singular_name' => esc_html__('Form', 'give'), |
|
| 43 | + 'add_new' => esc_html__('Add Form', 'give'), |
|
| 44 | + 'add_new_item' => esc_html__('Add New Donation Form', 'give'), |
|
| 45 | + 'edit_item' => esc_html__('Edit Donation Form', 'give'), |
|
| 46 | + 'new_item' => esc_html__('New Form', 'give'), |
|
| 47 | + 'all_items' => esc_html__('All Forms', 'give'), |
|
| 48 | + 'view_item' => esc_html__('View Form', 'give'), |
|
| 49 | + 'search_items' => esc_html__('Search Forms', 'give'), |
|
| 50 | + 'not_found' => esc_html__('No forms found.', 'give'), |
|
| 51 | + 'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'), |
|
| 52 | 52 | 'parent_item_colon' => '', |
| 53 | - 'menu_name' => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ), |
|
| 54 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) ), |
|
| 55 | - ) ); |
|
| 53 | + 'menu_name' => apply_filters('give_menu_name', esc_html__('Donations', 'give')), |
|
| 54 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give')), |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | 57 | // Default give_forms supports. |
| 58 | 58 | $give_form_supports = array( |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | // Has the user disabled the excerpt? |
| 67 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
| 68 | - unset( $give_form_supports[2] ); |
|
| 67 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
| 68 | + unset($give_form_supports[2]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Has user disabled the featured image? |
| 72 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
| 73 | - unset( $give_form_supports[1] ); |
|
| 74 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
| 72 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
| 73 | + unset($give_form_supports[1]); |
|
| 74 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $give_forms_args = array( |
@@ -87,42 +87,42 @@ discard block |
||
| 87 | 87 | 'has_archive' => $give_forms_archives, |
| 88 | 88 | 'menu_icon' => 'dashicons-give', |
| 89 | 89 | 'hierarchical' => false, |
| 90 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
| 90 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
| 91 | 91 | ); |
| 92 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
| 92 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
| 93 | 93 | |
| 94 | 94 | /** Donation Post Type */ |
| 95 | 95 | $payment_labels = array( |
| 96 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
| 97 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
| 98 | - 'add_new' => esc_html__( 'Add New', 'give' ), |
|
| 99 | - 'add_new_item' => esc_html__( 'Add New Donation', 'give' ), |
|
| 100 | - 'edit_item' => esc_html__( 'Edit Donation', 'give' ), |
|
| 101 | - 'new_item' => esc_html__( 'New Donation', 'give' ), |
|
| 102 | - 'all_items' => esc_html__( 'All Donations', 'give' ), |
|
| 103 | - 'view_item' => esc_html__( 'View Donation', 'give' ), |
|
| 104 | - 'search_items' => esc_html__( 'Search Donations', 'give' ), |
|
| 105 | - 'not_found' => esc_html__( 'No donations found.', 'give' ), |
|
| 106 | - 'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ), |
|
| 96 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
| 97 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
| 98 | + 'add_new' => esc_html__('Add New', 'give'), |
|
| 99 | + 'add_new_item' => esc_html__('Add New Donation', 'give'), |
|
| 100 | + 'edit_item' => esc_html__('Edit Donation', 'give'), |
|
| 101 | + 'new_item' => esc_html__('New Donation', 'give'), |
|
| 102 | + 'all_items' => esc_html__('All Donations', 'give'), |
|
| 103 | + 'view_item' => esc_html__('View Donation', 'give'), |
|
| 104 | + 'search_items' => esc_html__('Search Donations', 'give'), |
|
| 105 | + 'not_found' => esc_html__('No donations found.', 'give'), |
|
| 106 | + 'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'), |
|
| 107 | 107 | 'parent_item_colon' => '', |
| 108 | - 'menu_name' => esc_html__( 'Donations', 'give' ), |
|
| 108 | + 'menu_name' => esc_html__('Donations', 'give'), |
|
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | 111 | $payment_args = array( |
| 112 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
| 112 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
| 113 | 113 | 'public' => false, |
| 114 | 114 | 'query_var' => false, |
| 115 | 115 | 'rewrite' => false, |
| 116 | 116 | 'map_meta_cap' => true, |
| 117 | 117 | 'capability_type' => 'give_payment', |
| 118 | - 'supports' => array( 'title' ), |
|
| 118 | + 'supports' => array('title'), |
|
| 119 | 119 | 'can_export' => true, |
| 120 | 120 | ); |
| 121 | - register_post_type( 'give_payment', $payment_args ); |
|
| 121 | + register_post_type('give_payment', $payment_args); |
|
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
| 125 | +add_action('init', 'give_setup_post_types', 1); |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | function give_setup_taxonomies() { |
| 137 | 137 | |
| 138 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
| 138 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
| 139 | 139 | |
| 140 | 140 | /** Categories */ |
| 141 | 141 | $category_labels = array( |
| 142 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
| 143 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
| 144 | - 'search_items' => esc_html__( 'Search Categories', 'give' ), |
|
| 145 | - 'all_items' => esc_html__( 'All Categories', 'give' ), |
|
| 146 | - 'parent_item' => esc_html__( 'Parent Category', 'give' ), |
|
| 147 | - 'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ), |
|
| 148 | - 'edit_item' => esc_html__( 'Edit Category', 'give' ), |
|
| 149 | - 'update_item' => esc_html__( 'Update Category', 'give' ), |
|
| 150 | - 'add_new_item' => esc_html__( 'Add New Category', 'give' ), |
|
| 151 | - 'new_item_name' => esc_html__( 'New Category Name', 'give' ), |
|
| 152 | - 'menu_name' => esc_html__( 'Categories', 'give' ), |
|
| 142 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
| 143 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
| 144 | + 'search_items' => esc_html__('Search Categories', 'give'), |
|
| 145 | + 'all_items' => esc_html__('All Categories', 'give'), |
|
| 146 | + 'parent_item' => esc_html__('Parent Category', 'give'), |
|
| 147 | + 'parent_item_colon' => esc_html__('Parent Category:', 'give'), |
|
| 148 | + 'edit_item' => esc_html__('Edit Category', 'give'), |
|
| 149 | + 'update_item' => esc_html__('Update Category', 'give'), |
|
| 150 | + 'add_new_item' => esc_html__('Add New Category', 'give'), |
|
| 151 | + 'new_item_name' => esc_html__('New Category Name', 'give'), |
|
| 152 | + 'menu_name' => esc_html__('Categories', 'give'), |
|
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
| 155 | + $category_args = apply_filters('give_forms_category_args', array( |
|
| 156 | 156 | 'hierarchical' => true, |
| 157 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
| 157 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
| 158 | 158 | 'show_ui' => true, |
| 159 | 159 | 'query_var' => 'give_forms_category', |
| 160 | 160 | 'rewrite' => array( |
| 161 | - 'slug' => $slug . '/category', |
|
| 161 | + 'slug' => $slug.'/category', |
|
| 162 | 162 | 'with_front' => false, |
| 163 | 163 | 'hierarchical' => true, |
| 164 | 164 | ), |
@@ -172,33 +172,33 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | // Does the user want categories? |
| 175 | - if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
| 176 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
| 177 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
| 175 | + if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
| 176 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
| 177 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** Tags */ |
| 181 | 181 | $tag_labels = array( |
| 182 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
| 183 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
| 184 | - 'search_items' => esc_html__( 'Search Tags', 'give' ), |
|
| 185 | - 'all_items' => esc_html__( 'All Tags', 'give' ), |
|
| 186 | - 'parent_item' => esc_html__( 'Parent Tag', 'give' ), |
|
| 187 | - 'parent_item_colon' => esc_html__( 'Parent Tag:', 'give' ), |
|
| 188 | - 'edit_item' => esc_html__( 'Edit Tag', 'give' ), |
|
| 189 | - 'update_item' => esc_html__( 'Update Tag', 'give' ), |
|
| 190 | - 'add_new_item' => esc_html__( 'Add New Tag', 'give' ), |
|
| 191 | - 'new_item_name' => esc_html__( 'New Tag Name', 'give' ), |
|
| 192 | - 'menu_name' => esc_html__( 'Tags', 'give' ), |
|
| 193 | - 'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ), |
|
| 182 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
| 183 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
| 184 | + 'search_items' => esc_html__('Search Tags', 'give'), |
|
| 185 | + 'all_items' => esc_html__('All Tags', 'give'), |
|
| 186 | + 'parent_item' => esc_html__('Parent Tag', 'give'), |
|
| 187 | + 'parent_item_colon' => esc_html__('Parent Tag:', 'give'), |
|
| 188 | + 'edit_item' => esc_html__('Edit Tag', 'give'), |
|
| 189 | + 'update_item' => esc_html__('Update Tag', 'give'), |
|
| 190 | + 'add_new_item' => esc_html__('Add New Tag', 'give'), |
|
| 191 | + 'new_item_name' => esc_html__('New Tag Name', 'give'), |
|
| 192 | + 'menu_name' => esc_html__('Tags', 'give'), |
|
| 193 | + 'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'), |
|
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
| 196 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
| 197 | 197 | 'hierarchical' => false, |
| 198 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
| 198 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
| 199 | 199 | 'show_ui' => true, |
| 200 | 200 | 'query_var' => 'give_forms_tag', |
| 201 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
| 201 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
| 202 | 202 | 'capabilities' => array( |
| 203 | 203 | 'manage_terms' => 'manage_give_form_terms', |
| 204 | 204 | 'edit_terms' => 'edit_give_form_terms', |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | ) |
| 209 | 209 | ); |
| 210 | 210 | |
| 211 | - if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
| 212 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
| 213 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
| 211 | + if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
| 212 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
| 213 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
| 218 | +add_action('init', 'give_setup_taxonomies', 0); |
|
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | function give_get_default_form_labels() { |
| 228 | 228 | $defaults = array( |
| 229 | - 'singular' => esc_html__( 'Form', 'give' ), |
|
| 230 | - 'plural' => esc_html__( 'Forms', 'give' ), |
|
| 229 | + 'singular' => esc_html__('Form', 'give'), |
|
| 230 | + 'plural' => esc_html__('Forms', 'give'), |
|
| 231 | 231 | ); |
| 232 | 232 | |
| 233 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
| 233 | + return apply_filters('give_default_form_name', $defaults); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @return string $defaults['singular'] Singular label |
| 244 | 244 | */ |
| 245 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
| 245 | +function give_get_forms_label_singular($lowercase = false) { |
|
| 246 | 246 | $defaults = give_get_default_form_labels(); |
| 247 | 247 | |
| 248 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
| 248 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | * @since 1.0 |
| 255 | 255 | * @return string $defaults['plural'] Plural label |
| 256 | 256 | */ |
| 257 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
| 257 | +function give_get_forms_label_plural($lowercase = false) { |
|
| 258 | 258 | $defaults = give_get_default_form_labels(); |
| 259 | 259 | |
| 260 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
| 260 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -269,24 +269,24 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return string $title New placeholder text |
| 271 | 271 | */ |
| 272 | -function give_change_default_title( $title ) { |
|
| 272 | +function give_change_default_title($title) { |
|
| 273 | 273 | // If a frontend plugin uses this filter (check extensions before changing this function) |
| 274 | - if ( ! is_admin() ) { |
|
| 275 | - $title = esc_html__( 'Enter form title here', 'give' ); |
|
| 274 | + if ( ! is_admin()) { |
|
| 275 | + $title = esc_html__('Enter form title here', 'give'); |
|
| 276 | 276 | |
| 277 | 277 | return $title; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $screen = get_current_screen(); |
| 281 | 281 | |
| 282 | - if ( 'give_forms' == $screen->post_type ) { |
|
| 283 | - $title = esc_html__( 'Enter form title here', 'give' ); |
|
| 282 | + if ('give_forms' == $screen->post_type) { |
|
| 283 | + $title = esc_html__('Enter form title here', 'give'); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $title; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
| 289 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | 292 | * Registers Custom Post Statuses which are used by the Payments |
@@ -296,50 +296,50 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | function give_register_post_type_statuses() { |
| 298 | 298 | // Payment Statuses |
| 299 | - register_post_status( 'refunded', array( |
|
| 300 | - 'label' => esc_html__( 'Refunded', 'give' ), |
|
| 299 | + register_post_status('refunded', array( |
|
| 300 | + 'label' => esc_html__('Refunded', 'give'), |
|
| 301 | 301 | 'public' => true, |
| 302 | 302 | 'exclude_from_search' => false, |
| 303 | 303 | 'show_in_admin_all_list' => true, |
| 304 | 304 | 'show_in_admin_status_list' => true, |
| 305 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
| 306 | - ) ); |
|
| 307 | - register_post_status( 'failed', array( |
|
| 308 | - 'label' => esc_html__( 'Failed', 'give' ), |
|
| 305 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
| 306 | + )); |
|
| 307 | + register_post_status('failed', array( |
|
| 308 | + 'label' => esc_html__('Failed', 'give'), |
|
| 309 | 309 | 'public' => true, |
| 310 | 310 | 'exclude_from_search' => false, |
| 311 | 311 | 'show_in_admin_all_list' => true, |
| 312 | 312 | 'show_in_admin_status_list' => true, |
| 313 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
| 314 | - ) ); |
|
| 315 | - register_post_status( 'revoked', array( |
|
| 316 | - 'label' => esc_html__( 'Revoked', 'give' ), |
|
| 313 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
| 314 | + )); |
|
| 315 | + register_post_status('revoked', array( |
|
| 316 | + 'label' => esc_html__('Revoked', 'give'), |
|
| 317 | 317 | 'public' => true, |
| 318 | 318 | 'exclude_from_search' => false, |
| 319 | 319 | 'show_in_admin_all_list' => true, |
| 320 | 320 | 'show_in_admin_status_list' => true, |
| 321 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
| 322 | - ) ); |
|
| 323 | - register_post_status( 'cancelled', array( |
|
| 324 | - 'label' => esc_html__( 'Cancelled', 'give' ), |
|
| 321 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
| 322 | + )); |
|
| 323 | + register_post_status('cancelled', array( |
|
| 324 | + 'label' => esc_html__('Cancelled', 'give'), |
|
| 325 | 325 | 'public' => true, |
| 326 | 326 | 'exclude_from_search' => false, |
| 327 | 327 | 'show_in_admin_all_list' => true, |
| 328 | 328 | 'show_in_admin_status_list' => true, |
| 329 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
| 330 | - ) ); |
|
| 331 | - register_post_status( 'abandoned', array( |
|
| 332 | - 'label' => esc_html__( 'Abandoned', 'give' ), |
|
| 329 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
| 330 | + )); |
|
| 331 | + register_post_status('abandoned', array( |
|
| 332 | + 'label' => esc_html__('Abandoned', 'give'), |
|
| 333 | 333 | 'public' => true, |
| 334 | 334 | 'exclude_from_search' => false, |
| 335 | 335 | 'show_in_admin_all_list' => true, |
| 336 | 336 | 'show_in_admin_status_list' => true, |
| 337 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
| 338 | - ) ); |
|
| 337 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
| 338 | + )); |
|
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
| 342 | +add_action('init', 'give_register_post_type_statuses'); |
|
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | 345 | * Updated Messages |
@@ -352,27 +352,27 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @return array $messages New post updated messages |
| 354 | 354 | */ |
| 355 | -function give_updated_messages( $messages ) { |
|
| 355 | +function give_updated_messages($messages) { |
|
| 356 | 356 | global $post, $post_ID; |
| 357 | 357 | |
| 358 | - if ( give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) { |
|
| 358 | + if (give_is_setting_enabled(give_get_option('forms_singular'))) { |
|
| 359 | 359 | |
| 360 | 360 | $messages['give_forms'] = array( |
| 361 | - 1 => esc_html__( 'Form updated.', 'give' ), |
|
| 362 | - 4 => esc_html__( 'Form updated.', 'give' ), |
|
| 363 | - 6 => esc_html__( 'Form published.', 'give' ), |
|
| 364 | - 7 => esc_html__( 'Form saved.', 'give' ), |
|
| 365 | - 8 => esc_html__( 'Form submitted.', 'give' ), |
|
| 361 | + 1 => esc_html__('Form updated.', 'give'), |
|
| 362 | + 4 => esc_html__('Form updated.', 'give'), |
|
| 363 | + 6 => esc_html__('Form published.', 'give'), |
|
| 364 | + 7 => esc_html__('Form saved.', 'give'), |
|
| 365 | + 8 => esc_html__('Form submitted.', 'give'), |
|
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | 368 | } else { |
| 369 | 369 | |
| 370 | 370 | $messages['give_forms'] = array( |
| 371 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
| 372 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
| 373 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
| 374 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
| 375 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
| 371 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
| 372 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
| 373 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
| 374 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
| 375 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
| 376 | 376 | ); |
| 377 | 377 | |
| 378 | 378 | } |
@@ -380,27 +380,27 @@ discard block |
||
| 380 | 380 | return $messages; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
| 383 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
| 384 | 384 | |
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | 387 | * Setup Post Type Images |
| 388 | 388 | */ |
| 389 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
| 389 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | 392 | * Ensure post thumbnail support is turned on |
| 393 | 393 | */ |
| 394 | 394 | function give_add_thumbnail_support() { |
| 395 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
| 395 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
| 396 | 396 | return; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
| 400 | - add_theme_support( 'post-thumbnails' ); |
|
| 399 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
| 400 | + add_theme_support('post-thumbnails'); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
| 403 | + add_post_type_support('give_forms', 'thumbnail'); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -412,21 +412,21 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | // Single Give Forms (disabled if single turned off in settings) |
| 414 | 414 | if ( |
| 415 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
| 416 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
| 415 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
| 416 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
| 417 | 417 | ) { |
| 418 | 418 | |
| 419 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
| 420 | - 'name' => esc_html__( 'Give Single Form Sidebar', 'give' ), |
|
| 419 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
| 420 | + 'name' => esc_html__('Give Single Form Sidebar', 'give'), |
|
| 421 | 421 | 'id' => 'give-forms-sidebar', |
| 422 | - 'description' => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
| 422 | + 'description' => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
| 423 | 423 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
| 424 | 424 | 'after_widget' => '</div>', |
| 425 | 425 | 'before_title' => '<h3 class="widgettitle widget-title">', |
| 426 | 426 | 'after_title' => '</h3>', |
| 427 | - ) ) ); |
|
| 427 | + ))); |
|
| 428 | 428 | |
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
| 432 | +add_action('widgets_init', 'give_widgets_init', 999); |
|
@@ -641,9 +641,12 @@ discard block |
||
| 641 | 641 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
| 642 | 642 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
| 643 | 643 | <?php echo $form_data_tab['icon-html']; ?> |
| 644 | - <?php else : ?> |
|
| 644 | + <?php else { |
|
| 645 | + : ?> |
|
| 645 | 646 | <span class="give-icon give-icon-default"></span> |
| 646 | - <?php endif; ?> |
|
| 647 | + <?php endif; |
|
| 648 | +} |
|
| 649 | +?> |
|
| 647 | 650 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 648 | 651 | </a> |
| 649 | 652 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -653,9 +656,12 @@ discard block |
||
| 653 | 656 | <a href="#<?php echo $sub_tab['id']; ?>"> |
| 654 | 657 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
| 655 | 658 | <?php echo $sub_tab['icon-html']; ?> |
| 656 | - <?php else : ?> |
|
| 659 | + <?php else { |
|
| 660 | + : ?> |
|
| 657 | 661 | <span class="give-icon give-icon-default"></span> |
| 658 | - <?php endif; ?> |
|
| 662 | + <?php endif; |
|
| 663 | +} |
|
| 664 | +?> |
|
| 659 | 665 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
| 660 | 666 | </a> |
| 661 | 667 | </li> |
@@ -682,11 +688,14 @@ discard block |
||
| 682 | 688 | </div> |
| 683 | 689 | |
| 684 | 690 | <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
| 685 | - <?php else: ?> |
|
| 691 | + <?php else { |
|
| 692 | + : ?> |
|
| 686 | 693 | <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
| 687 | 694 | <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
| 688 | 695 | <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
| 689 | - <div id="<?php echo $sub_fields['id']; ?>" |
|
| 696 | + <div id="<?php echo $sub_fields['id']; |
|
| 697 | +} |
|
| 698 | +?>" |
|
| 690 | 699 | class="panel give_options_panel give-hidden"> |
| 691 | 700 | <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
| 692 | 701 | <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
| 400 | 400 | 'id' => $prefix . 'form_goal_achieved_message', |
| 401 | 401 | 'type' => 'wysiwyg', |
| 402 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 402 | + 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 403 | 403 | ), |
| 404 | 404 | array( |
| 405 | 405 | 'name' => 'donation_goal_docs', |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | |
| 672 | 672 | <div id="<?php echo $setting['id']; ?>" |
| 673 | 673 | class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
| 674 | - $show_first_tab_content = false; ?>"> |
|
| 674 | + $show_first_tab_content = false; ?>"> |
|
| 675 | 675 | <?php if ( ! empty( $setting['fields'] ) ) : ?> |
| 676 | 676 | <?php foreach ( $setting['fields'] as $field ) : ?> |
| 677 | 677 | <?php give_render_field( $field ); ?> |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function __construct() { |
| 48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
| 49 | - $this->metabox_label = esc_html__( 'Donation Form Options', 'give' ); |
|
| 49 | + $this->metabox_label = esc_html__('Donation Form Options', 'give'); |
|
| 50 | 50 | |
| 51 | 51 | // Setup. |
| 52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
| 52 | + add_action('admin_init', array($this, 'setup')); |
|
| 53 | 53 | |
| 54 | 54 | // Add metabox. |
| 55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 30 ); |
|
| 55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 30); |
|
| 56 | 56 | |
| 57 | 57 | // Save form meta. |
| 58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
| 58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
| 59 | 59 | |
| 60 | 60 | // cmb2 old setting loaders. |
| 61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
| 62 | 62 | // Add offline donations options. |
| 63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
| 63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -83,18 +83,18 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function get_settings() { |
| 85 | 85 | $post_id = give_get_admin_post_id(); |
| 86 | - $price = give_get_form_price( $post_id ); |
|
| 87 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 88 | - $goal = give_get_form_goal( $post_id ); |
|
| 86 | + $price = give_get_form_price($post_id); |
|
| 87 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 88 | + $goal = give_get_form_goal($post_id); |
|
| 89 | 89 | |
| 90 | 90 | // No empty prices - min. 1.00 for new forms |
| 91 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
| 92 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 91 | + if (empty($price) && is_null($post_id)) { |
|
| 92 | + $price = esc_attr(give_format_decimal('1.00')); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Min. $1.00 for new forms |
| 96 | - if ( empty( $custom_amount_minimum ) ) { |
|
| 97 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 96 | + if (empty($custom_amount_minimum)) { |
|
| 97 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Start with an underscore to hide fields from custom fields list |
@@ -104,215 +104,215 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * Repeatable Field Groups |
| 106 | 106 | */ |
| 107 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
| 107 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
| 108 | 108 | 'id' => 'form_field_options', |
| 109 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 109 | + 'title' => esc_html__('Donation Options', 'give'), |
|
| 110 | 110 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
| 111 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 111 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
| 112 | 112 | // Donation Option |
| 113 | 113 | array( |
| 114 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
| 115 | - 'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 116 | - 'id' => $prefix . 'price_option', |
|
| 114 | + 'name' => esc_html__('Donation Option', 'give'), |
|
| 115 | + 'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
| 116 | + 'id' => $prefix.'price_option', |
|
| 117 | 117 | 'type' => 'radio_inline', |
| 118 | 118 | 'default' => 'set', |
| 119 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 120 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
| 121 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
| 122 | - ) ), |
|
| 119 | + 'options' => apply_filters('give_forms_price_options', array( |
|
| 120 | + 'set' => esc_html__('Set Donation', 'give'), |
|
| 121 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
| 122 | + )), |
|
| 123 | 123 | ), |
| 124 | 124 | array( |
| 125 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
| 126 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
| 127 | - 'id' => $prefix . 'set_price', |
|
| 125 | + 'name' => esc_html__('Set Donation', 'give'), |
|
| 126 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
| 127 | + 'id' => $prefix.'set_price', |
|
| 128 | 128 | 'type' => 'text_small', |
| 129 | 129 | 'data_type' => 'price', |
| 130 | 130 | 'attributes' => array( |
| 131 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 132 | - 'value' => give_format_decimal( $price ), |
|
| 131 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 132 | + 'value' => give_format_decimal($price), |
|
| 133 | 133 | 'class' => 'give-money-field', |
| 134 | 134 | ), |
| 135 | 135 | ), |
| 136 | 136 | // Display Style |
| 137 | 137 | array( |
| 138 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
| 139 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 140 | - 'id' => $prefix . 'display_style', |
|
| 138 | + 'name' => esc_html__('Display Style', 'give'), |
|
| 139 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
| 140 | + 'id' => $prefix.'display_style', |
|
| 141 | 141 | 'type' => 'radio_inline', |
| 142 | 142 | 'default' => 'buttons', |
| 143 | 143 | 'options' => array( |
| 144 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
| 145 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
| 146 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
| 144 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
| 145 | + 'radios' => esc_html__('Radios', 'give'), |
|
| 146 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
| 147 | 147 | ), |
| 148 | 148 | ), |
| 149 | 149 | // Custom Amount |
| 150 | 150 | array( |
| 151 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
| 152 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 153 | - 'id' => $prefix . 'custom_amount', |
|
| 151 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
| 152 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
| 153 | + 'id' => $prefix.'custom_amount', |
|
| 154 | 154 | 'type' => 'radio_inline', |
| 155 | 155 | 'default' => 'disabled', |
| 156 | 156 | 'options' => array( |
| 157 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 158 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 157 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 158 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 159 | 159 | ), |
| 160 | 160 | ), |
| 161 | 161 | array( |
| 162 | - 'name' => esc_html__( 'Minimum Amount', 'give' ), |
|
| 163 | - 'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ), |
|
| 164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 162 | + 'name' => esc_html__('Minimum Amount', 'give'), |
|
| 163 | + 'description' => esc_html__('Enter the minimum custom donation amount.', 'give'), |
|
| 164 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 165 | 165 | 'type' => 'text_small', |
| 166 | 166 | 'data_type' => 'price', |
| 167 | 167 | 'attributes' => array( |
| 168 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
| 168 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
| 170 | 170 | 'class' => 'give-money-field', |
| 171 | 171 | ), |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
| 175 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
| 176 | - 'id' => $prefix . 'custom_amount_text', |
|
| 174 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
| 175 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
| 176 | + 'id' => $prefix.'custom_amount_text', |
|
| 177 | 177 | 'type' => 'text_medium', |
| 178 | 178 | 'attributes' => array( |
| 179 | 179 | 'rows' => 3, |
| 180 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
| 180 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
| 181 | 181 | ), |
| 182 | 182 | ), |
| 183 | 183 | // Donation Levels: Repeatable CMB2 Group |
| 184 | 184 | array( |
| 185 | - 'id' => $prefix . 'donation_levels', |
|
| 185 | + 'id' => $prefix.'donation_levels', |
|
| 186 | 186 | 'type' => 'group', |
| 187 | 187 | 'options' => array( |
| 188 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
| 189 | - 'header_title' => esc_html__( 'Donation Level', 'give' ), |
|
| 188 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
| 189 | + 'header_title' => esc_html__('Donation Level', 'give'), |
|
| 190 | 190 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 191 | 191 | ), |
| 192 | 192 | // Fields array works the same, except id's only need to be unique for this group. |
| 193 | 193 | // Prefix is not needed. |
| 194 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 194 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
| 195 | 195 | array( |
| 196 | - 'name' => esc_html__( 'ID', 'give' ), |
|
| 197 | - 'id' => $prefix . 'id', |
|
| 196 | + 'name' => esc_html__('ID', 'give'), |
|
| 197 | + 'id' => $prefix.'id', |
|
| 198 | 198 | 'type' => 'levels_id', |
| 199 | 199 | ), |
| 200 | 200 | array( |
| 201 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
| 202 | - 'id' => $prefix . 'amount', |
|
| 201 | + 'name' => esc_html__('Amount', 'give'), |
|
| 202 | + 'id' => $prefix.'amount', |
|
| 203 | 203 | 'type' => 'text_small', |
| 204 | 204 | 'data_type' => 'price', |
| 205 | 205 | 'attributes' => array( |
| 206 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 206 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 207 | 207 | 'class' => 'give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | array( |
| 211 | - 'name' => esc_html__( 'Text', 'give' ), |
|
| 212 | - 'id' => $prefix . 'text', |
|
| 211 | + 'name' => esc_html__('Text', 'give'), |
|
| 212 | + 'id' => $prefix.'text', |
|
| 213 | 213 | 'type' => 'text', |
| 214 | 214 | 'attributes' => array( |
| 215 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
| 215 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
| 216 | 216 | 'class' => 'give-multilevel-text-field', |
| 217 | 217 | ), |
| 218 | 218 | ), |
| 219 | 219 | array( |
| 220 | - 'name' => esc_html__( 'Default', 'give' ), |
|
| 221 | - 'id' => $prefix . 'default', |
|
| 220 | + 'name' => esc_html__('Default', 'give'), |
|
| 221 | + 'id' => $prefix.'default', |
|
| 222 | 222 | 'type' => 'give_default_radio_inline', |
| 223 | 223 | ), |
| 224 | - ) ), |
|
| 224 | + )), |
|
| 225 | 225 | ), |
| 226 | 226 | array( |
| 227 | 227 | 'name' => 'donation_options_docs', |
| 228 | 228 | 'type' => 'docs_link', |
| 229 | 229 | 'url' => 'http://docs.givewp.com/form-donation-options', |
| 230 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 230 | + 'title' => esc_html__('Donation Options', 'give'), |
|
| 231 | 231 | ), |
| 232 | 232 | ), |
| 233 | 233 | $post_id |
| 234 | 234 | ), |
| 235 | - ) ), |
|
| 235 | + )), |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Display Options |
| 239 | 239 | */ |
| 240 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
| 240 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
| 241 | 241 | 'id' => 'form_display_options', |
| 242 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
| 242 | + 'title' => esc_html__('Form Display', 'give'), |
|
| 243 | 243 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
| 244 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 244 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
| 245 | 245 | array( |
| 246 | - 'name' => esc_html__( 'Display Options', 'give' ), |
|
| 247 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
| 248 | - 'id' => $prefix . 'payment_display', |
|
| 246 | + 'name' => esc_html__('Display Options', 'give'), |
|
| 247 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
| 248 | + 'id' => $prefix.'payment_display', |
|
| 249 | 249 | 'type' => 'radio_inline', |
| 250 | 250 | 'options' => array( |
| 251 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
| 252 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
| 253 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
| 254 | - 'button' => esc_html__( 'Button', 'give' ), |
|
| 251 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
| 252 | + 'modal' => esc_html__('Modal', 'give'), |
|
| 253 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
| 254 | + 'button' => esc_html__('Button', 'give'), |
|
| 255 | 255 | ), |
| 256 | 256 | 'default' => 'onpage', |
| 257 | 257 | ), |
| 258 | 258 | array( |
| 259 | - 'id' => $prefix . 'reveal_label', |
|
| 260 | - 'name' => esc_html__( 'Continue Button', 'give' ), |
|
| 261 | - 'desc' => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
| 259 | + 'id' => $prefix.'reveal_label', |
|
| 260 | + 'name' => esc_html__('Continue Button', 'give'), |
|
| 261 | + 'desc' => esc_html__('The button label for displaying the additional payment fields.', 'give'), |
|
| 262 | 262 | 'type' => 'text_small', |
| 263 | 263 | 'attributes' => array( |
| 264 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
| 264 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
| 265 | 265 | ), |
| 266 | 266 | ), |
| 267 | 267 | array( |
| 268 | - 'id' => $prefix . 'checkout_label', |
|
| 269 | - 'name' => esc_html__( 'Submit Button', 'give' ), |
|
| 270 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
| 268 | + 'id' => $prefix.'checkout_label', |
|
| 269 | + 'name' => esc_html__('Submit Button', 'give'), |
|
| 270 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
| 271 | 271 | 'type' => 'text_small', |
| 272 | 272 | 'attributes' => array( |
| 273 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
| 273 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
| 274 | 274 | ), |
| 275 | 275 | ), |
| 276 | 276 | array( |
| 277 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
| 278 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 279 | - 'id' => $prefix . 'default_gateway', |
|
| 277 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
| 278 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
| 279 | + 'id' => $prefix.'default_gateway', |
|
| 280 | 280 | 'type' => 'default_gateway', |
| 281 | 281 | ), |
| 282 | 282 | array( |
| 283 | - 'name' => esc_html__( 'Guest Donations', 'give' ), |
|
| 284 | - 'desc' => esc_html__( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
| 285 | - 'id' => $prefix . 'logged_in_only', |
|
| 283 | + 'name' => esc_html__('Guest Donations', 'give'), |
|
| 284 | + 'desc' => esc_html__('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
| 285 | + 'id' => $prefix.'logged_in_only', |
|
| 286 | 286 | 'type' => 'radio_inline', |
| 287 | 287 | 'default' => 'enabled', |
| 288 | 288 | 'options' => array( |
| 289 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 290 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 289 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 290 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 291 | 291 | ), |
| 292 | 292 | ), |
| 293 | 293 | array( |
| 294 | - 'name' => esc_html__( 'Registration', 'give' ), |
|
| 295 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 296 | - 'id' => $prefix . 'show_register_form', |
|
| 294 | + 'name' => esc_html__('Registration', 'give'), |
|
| 295 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
| 296 | + 'id' => $prefix.'show_register_form', |
|
| 297 | 297 | 'type' => 'radio', |
| 298 | 298 | 'options' => array( |
| 299 | - 'none' => esc_html__( 'None', 'give' ), |
|
| 300 | - 'registration' => esc_html__( 'Registration', 'give' ), |
|
| 301 | - 'login' => esc_html__( 'Login', 'give' ), |
|
| 302 | - 'both' => esc_html__( 'Registration + Login', 'give' ), |
|
| 299 | + 'none' => esc_html__('None', 'give'), |
|
| 300 | + 'registration' => esc_html__('Registration', 'give'), |
|
| 301 | + 'login' => esc_html__('Login', 'give'), |
|
| 302 | + 'both' => esc_html__('Registration + Login', 'give'), |
|
| 303 | 303 | ), |
| 304 | 304 | 'default' => 'none', |
| 305 | 305 | ), |
| 306 | 306 | array( |
| 307 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
| 307 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
| 308 | 308 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
| 309 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
| 310 | - 'id' => $prefix . 'form_floating_labels', |
|
| 309 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
| 310 | + 'id' => $prefix.'form_floating_labels', |
|
| 311 | 311 | 'type' => 'radio_inline', |
| 312 | 312 | 'options' => array( |
| 313 | - 'global' => esc_html__( 'Global Option', 'give' ), |
|
| 314 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 315 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 313 | + 'global' => esc_html__('Global Option', 'give'), |
|
| 314 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 315 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 316 | 316 | ), |
| 317 | 317 | 'default' => 'global', |
| 318 | 318 | ), |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | 'name' => 'form_display_docs', |
| 321 | 321 | 'type' => 'docs_link', |
| 322 | 322 | 'url' => 'http://docs.givewp.com/form-display-options', |
| 323 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
| 323 | + 'title' => esc_html__('Form Display', 'give'), |
|
| 324 | 324 | ), |
| 325 | 325 | ), |
| 326 | 326 | $post_id |
@@ -331,191 +331,191 @@ discard block |
||
| 331 | 331 | /** |
| 332 | 332 | * Donation Goals |
| 333 | 333 | */ |
| 334 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
| 334 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
| 335 | 335 | 'id' => 'donation_goal_options', |
| 336 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
| 336 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
| 337 | 337 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
| 338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
| 338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
| 339 | 339 | // Goals |
| 340 | 340 | array( |
| 341 | - 'name' => esc_html__( 'Donation Goal', 'give' ), |
|
| 342 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 343 | - 'id' => $prefix . 'goal_option', |
|
| 341 | + 'name' => esc_html__('Donation Goal', 'give'), |
|
| 342 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
| 343 | + 'id' => $prefix.'goal_option', |
|
| 344 | 344 | 'type' => 'radio_inline', |
| 345 | 345 | 'default' => 'disabled', |
| 346 | 346 | 'options' => array( |
| 347 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 348 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 347 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 348 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 349 | 349 | ), |
| 350 | 350 | ), |
| 351 | 351 | array( |
| 352 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
| 353 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
| 354 | - 'id' => $prefix . 'set_goal', |
|
| 352 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
| 353 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
| 354 | + 'id' => $prefix.'set_goal', |
|
| 355 | 355 | 'type' => 'text_small', |
| 356 | 356 | 'data_type' => 'price', |
| 357 | 357 | 'attributes' => array( |
| 358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
| 359 | - 'value' => give_format_decimal( $goal ), |
|
| 358 | + 'placeholder' => give_format_decimal('0.00'), |
|
| 359 | + 'value' => give_format_decimal($goal), |
|
| 360 | 360 | 'class' => 'give-money-field', |
| 361 | 361 | ), |
| 362 | 362 | ), |
| 363 | 363 | |
| 364 | 364 | array( |
| 365 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
| 366 | - 'description' => esc_html__( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
| 367 | - 'id' => $prefix . 'goal_format', |
|
| 365 | + 'name' => esc_html__('Goal Format', 'give'), |
|
| 366 | + 'description' => esc_html__('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
| 367 | + 'id' => $prefix.'goal_format', |
|
| 368 | 368 | 'type' => 'radio_inline', |
| 369 | 369 | 'default' => 'amount', |
| 370 | 370 | 'options' => array( |
| 371 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 372 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
| 371 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 372 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
| 373 | 373 | ), |
| 374 | 374 | ), |
| 375 | 375 | array( |
| 376 | - 'name' => esc_html__( 'Progress Bar Color', 'give' ), |
|
| 377 | - 'desc' => esc_html__( 'Customize the color of the goal progress bar.', 'give' ), |
|
| 378 | - 'id' => $prefix . 'goal_color', |
|
| 376 | + 'name' => esc_html__('Progress Bar Color', 'give'), |
|
| 377 | + 'desc' => esc_html__('Customize the color of the goal progress bar.', 'give'), |
|
| 378 | + 'id' => $prefix.'goal_color', |
|
| 379 | 379 | 'type' => 'colorpicker', |
| 380 | 380 | 'default' => '#2bc253', |
| 381 | 381 | ), |
| 382 | 382 | |
| 383 | 383 | array( |
| 384 | - 'name' => esc_html__( 'Close Form', 'give' ), |
|
| 385 | - 'desc' => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 384 | + 'name' => esc_html__('Close Form', 'give'), |
|
| 385 | + 'desc' => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
| 386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 387 | 387 | 'type' => 'radio_inline', |
| 388 | 388 | 'default' => 'disabled', |
| 389 | 389 | 'options' => array( |
| 390 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 391 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 390 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 391 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 392 | 392 | ), |
| 393 | 393 | ), |
| 394 | 394 | array( |
| 395 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 396 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
| 397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 395 | + 'name' => __('Goal Achieved Message', 'give'), |
|
| 396 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
| 397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 398 | 398 | 'type' => 'wysiwyg', |
| 399 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 399 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
| 400 | 400 | ), |
| 401 | 401 | array( |
| 402 | 402 | 'name' => 'donation_goal_docs', |
| 403 | 403 | 'type' => 'docs_link', |
| 404 | 404 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
| 405 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
| 405 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
| 406 | 406 | ), |
| 407 | 407 | ), |
| 408 | 408 | $post_id |
| 409 | 409 | ), |
| 410 | - ) ), |
|
| 410 | + )), |
|
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | 413 | * Content Field |
| 414 | 414 | */ |
| 415 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
| 415 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
| 416 | 416 | 'id' => 'form_content_options', |
| 417 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 417 | + 'title' => esc_html__('Form Content', 'give'), |
|
| 418 | 418 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
| 419 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 419 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
| 420 | 420 | |
| 421 | 421 | // Donation content. |
| 422 | 422 | array( |
| 423 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
| 424 | - 'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ), |
|
| 425 | - 'id' => $prefix . 'display_content', |
|
| 423 | + 'name' => esc_html__('Display Content', 'give'), |
|
| 424 | + 'description' => esc_html__('Do you want to add custom content to this form?', 'give'), |
|
| 425 | + 'id' => $prefix.'display_content', |
|
| 426 | 426 | 'type' => 'radio_inline', |
| 427 | 427 | 'options' => array( |
| 428 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 429 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 428 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 429 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 430 | 430 | ), |
| 431 | 431 | 'default' => 'disabled', |
| 432 | 432 | ), |
| 433 | 433 | |
| 434 | 434 | // Content placement. |
| 435 | 435 | array( |
| 436 | - 'name' => esc_html__( 'Content Placement', 'give' ), |
|
| 437 | - 'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ), |
|
| 438 | - 'id' => $prefix . 'content_placement', |
|
| 436 | + 'name' => esc_html__('Content Placement', 'give'), |
|
| 437 | + 'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'), |
|
| 438 | + 'id' => $prefix.'content_placement', |
|
| 439 | 439 | 'type' => 'radio_inline', |
| 440 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 441 | - 'give_pre_form' => esc_html__( 'Above fields', 'give' ), |
|
| 442 | - 'give_post_form' => esc_html__( 'Below fields', 'give' ), |
|
| 440 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 441 | + 'give_pre_form' => esc_html__('Above fields', 'give'), |
|
| 442 | + 'give_post_form' => esc_html__('Below fields', 'give'), |
|
| 443 | 443 | ) |
| 444 | 444 | ), |
| 445 | 445 | 'default' => 'give_pre_form', |
| 446 | 446 | ), |
| 447 | 447 | array( |
| 448 | - 'name' => esc_html__( 'Content', 'give' ), |
|
| 449 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
| 450 | - 'id' => $prefix . 'form_content', |
|
| 448 | + 'name' => esc_html__('Content', 'give'), |
|
| 449 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
| 450 | + 'id' => $prefix.'form_content', |
|
| 451 | 451 | 'type' => 'wysiwyg', |
| 452 | 452 | ), |
| 453 | 453 | array( |
| 454 | 454 | 'name' => 'form_content_docs', |
| 455 | 455 | 'type' => 'docs_link', |
| 456 | 456 | 'url' => 'http://docs.givewp.com/form-content', |
| 457 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 457 | + 'title' => esc_html__('Form Content', 'give'), |
|
| 458 | 458 | ), |
| 459 | 459 | ), |
| 460 | 460 | $post_id |
| 461 | 461 | ), |
| 462 | - ) ), |
|
| 462 | + )), |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Terms & Conditions |
| 466 | 466 | */ |
| 467 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
| 467 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
| 468 | 468 | 'id' => 'form_terms_options', |
| 469 | - 'title' => esc_html__( 'Terms & Conditions', 'give' ), |
|
| 469 | + 'title' => esc_html__('Terms & Conditions', 'give'), |
|
| 470 | 470 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
| 471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
| 472 | 472 | // Donation Option |
| 473 | 473 | array( |
| 474 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 475 | - 'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
| 476 | - 'id' => $prefix . 'terms_option', |
|
| 474 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
| 475 | + 'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
| 476 | + 'id' => $prefix.'terms_option', |
|
| 477 | 477 | 'type' => 'radio_inline', |
| 478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 479 | - 'global' => esc_html__( 'Global Option', 'give' ), |
|
| 480 | - 'enabled' => esc_html__( 'Customize', 'give' ), |
|
| 481 | - 'disabled' => esc_html__( 'Disable', 'give' ), |
|
| 478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 479 | + 'global' => esc_html__('Global Option', 'give'), |
|
| 480 | + 'enabled' => esc_html__('Customize', 'give'), |
|
| 481 | + 'disabled' => esc_html__('Disable', 'give'), |
|
| 482 | 482 | ) |
| 483 | 483 | ), |
| 484 | 484 | 'default' => 'global', |
| 485 | 485 | ), |
| 486 | 486 | array( |
| 487 | - 'id' => $prefix . 'agree_label', |
|
| 488 | - 'name' => esc_html__( 'Agreement Label', 'give' ), |
|
| 489 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 487 | + 'id' => $prefix.'agree_label', |
|
| 488 | + 'name' => esc_html__('Agreement Label', 'give'), |
|
| 489 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
| 490 | 490 | 'type' => 'text', |
| 491 | 491 | 'size' => 'regular', |
| 492 | 492 | 'attributes' => array( |
| 493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
| 493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
| 494 | 494 | ), |
| 495 | 495 | ), |
| 496 | 496 | array( |
| 497 | - 'id' => $prefix . 'agree_text', |
|
| 498 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
| 499 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 497 | + 'id' => $prefix.'agree_text', |
|
| 498 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
| 499 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
| 500 | 500 | 'type' => 'wysiwyg', |
| 501 | 501 | ), |
| 502 | 502 | array( |
| 503 | 503 | 'name' => 'terms_docs', |
| 504 | 504 | 'type' => 'docs_link', |
| 505 | 505 | 'url' => 'http://docs.givewp.com/form-terms', |
| 506 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 506 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
| 507 | 507 | ), |
| 508 | 508 | ), |
| 509 | 509 | $post_id |
| 510 | 510 | ), |
| 511 | - ) ), |
|
| 511 | + )), |
|
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | 514 | |
| 515 | 515 | /** |
| 516 | 516 | * Filter the metabox tabbed panel settings. |
| 517 | 517 | */ |
| 518 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
| 518 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
| 519 | 519 | |
| 520 | 520 | // Output. |
| 521 | 521 | return $settings; |
@@ -531,8 +531,8 @@ discard block |
||
| 531 | 531 | add_meta_box( |
| 532 | 532 | $this->get_metabox_ID(), |
| 533 | 533 | $this->get_metabox_label(), |
| 534 | - array( $this, 'output' ), |
|
| 535 | - array( 'give_forms' ), |
|
| 534 | + array($this, 'output'), |
|
| 535 | + array('give_forms'), |
|
| 536 | 536 | 'normal', |
| 537 | 537 | 'high' |
| 538 | 538 | ); |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | function enqueue_script() { |
| 549 | 549 | global $post; |
| 550 | 550 | |
| 551 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 551 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -583,32 +583,32 @@ discard block |
||
| 583 | 583 | public function get_tabs() { |
| 584 | 584 | $tabs = array(); |
| 585 | 585 | |
| 586 | - if ( ! empty( $this->settings ) ) { |
|
| 587 | - foreach ( $this->settings as $setting ) { |
|
| 588 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
| 586 | + if ( ! empty($this->settings)) { |
|
| 587 | + foreach ($this->settings as $setting) { |
|
| 588 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
| 589 | 589 | continue; |
| 590 | 590 | } |
| 591 | 591 | $tab = array( |
| 592 | 592 | 'id' => $setting['id'], |
| 593 | 593 | 'label' => $setting['title'], |
| 594 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
| 594 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
| 595 | 595 | ); |
| 596 | 596 | |
| 597 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 598 | - if ( empty( $setting['sub-fields'] ) ) { |
|
| 597 | + if ($this->has_sub_tab($setting)) { |
|
| 598 | + if (empty($setting['sub-fields'])) { |
|
| 599 | 599 | $tab = array(); |
| 600 | 600 | } else { |
| 601 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
| 601 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
| 602 | 602 | $tab['sub-fields'][] = array( |
| 603 | 603 | 'id' => $sub_fields['id'], |
| 604 | 604 | 'label' => $sub_fields['title'], |
| 605 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
| 605 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
| 606 | 606 | ); |
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if ( ! empty( $tab ) ) { |
|
| 611 | + if ( ! empty($tab)) { |
|
| 612 | 612 | $tabs[] = $tab; |
| 613 | 613 | } |
| 614 | 614 | } |
@@ -625,27 +625,27 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function output() { |
| 627 | 627 | // Bailout. |
| 628 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
| 629 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
| 628 | + if ($form_data_tabs = $this->get_tabs()) { |
|
| 629 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
| 630 | 630 | ?> |
| 631 | 631 | <div class="give-metabox-panel-wrap"> |
| 632 | 632 | <ul class="give-form-data-tabs give-metabox-tabs"> |
| 633 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
| 634 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
| 633 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
| 634 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
| 635 | 635 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
| 636 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
| 636 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
| 637 | 637 | <?php echo $form_data_tab['icon-html']; ?> |
| 638 | 638 | <?php else : ?> |
| 639 | 639 | <span class="give-icon give-icon-default"></span> |
| 640 | 640 | <?php endif; ?> |
| 641 | 641 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 642 | 642 | </a> |
| 643 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
| 643 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
| 644 | 644 | <ul class="give-metabox-sub-tabs give-hidden"> |
| 645 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
| 645 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
| 646 | 646 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
| 647 | 647 | <a href="#<?php echo $sub_tab['id']; ?>"> |
| 648 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
| 648 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
| 649 | 649 | <?php echo $sub_tab['icon-html']; ?> |
| 650 | 650 | <?php else : ?> |
| 651 | 651 | <span class="give-icon give-icon-default"></span> |
@@ -661,30 +661,30 @@ discard block |
||
| 661 | 661 | </ul> |
| 662 | 662 | |
| 663 | 663 | <?php $show_first_tab_content = true; ?> |
| 664 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
| 665 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
| 666 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
| 664 | + <?php foreach ($this->settings as $setting) : ?> |
|
| 665 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
| 666 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
| 667 | 667 | |
| 668 | 668 | <div id="<?php echo $setting['id']; ?>" |
| 669 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
| 669 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
| 670 | 670 | $show_first_tab_content = false; ?>"> |
| 671 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
| 672 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
| 673 | - <?php give_render_field( $field ); ?> |
|
| 671 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
| 672 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
| 673 | + <?php give_render_field($field); ?> |
|
| 674 | 674 | <?php endforeach; ?> |
| 675 | 675 | <?php endif; ?> |
| 676 | 676 | </div> |
| 677 | 677 | |
| 678 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
| 678 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
| 679 | 679 | <?php else: ?> |
| 680 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
| 681 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
| 682 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
| 680 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
| 681 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
| 682 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
| 683 | 683 | <div id="<?php echo $sub_fields['id']; ?>" |
| 684 | 684 | class="panel give_options_panel give-hidden"> |
| 685 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
| 686 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
| 687 | - <?php give_render_field( $sub_field ); ?> |
|
| 685 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
| 686 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
| 687 | + <?php give_render_field($sub_field); ?> |
|
| 688 | 688 | <?php endforeach; ?> |
| 689 | 689 | <?php endif; ?> |
| 690 | 690 | </div> |
@@ -708,9 +708,9 @@ discard block |
||
| 708 | 708 | * |
| 709 | 709 | * @return bool |
| 710 | 710 | */ |
| 711 | - private function has_sub_tab( $field_setting ) { |
|
| 711 | + private function has_sub_tab($field_setting) { |
|
| 712 | 712 | $has_sub_tab = false; |
| 713 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
| 713 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
| 714 | 714 | $has_sub_tab = true; |
| 715 | 715 | } |
| 716 | 716 | |
@@ -724,13 +724,13 @@ discard block |
||
| 724 | 724 | * @return array |
| 725 | 725 | */ |
| 726 | 726 | function cmb2_metabox_settings() { |
| 727 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
| 727 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
| 728 | 728 | $give_forms_settings = $all_cmb2_settings; |
| 729 | 729 | |
| 730 | 730 | // Filter settings: Use only give forms related settings. |
| 731 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
| 732 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
| 733 | - unset( $give_forms_settings[ $index ] ); |
|
| 731 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
| 732 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
| 733 | + unset($give_forms_settings[$index]); |
|
| 734 | 734 | } |
| 735 | 735 | } |
| 736 | 736 | |
@@ -748,114 +748,114 @@ discard block |
||
| 748 | 748 | * |
| 749 | 749 | * @return void |
| 750 | 750 | */ |
| 751 | - public function save( $post_id, $post ) { |
|
| 751 | + public function save($post_id, $post) { |
|
| 752 | 752 | |
| 753 | 753 | // $post_id and $post are required. |
| 754 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 754 | + if (empty($post_id) || empty($post)) { |
|
| 755 | 755 | return; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | // Don't save meta boxes for revisions or autosaves. |
| 759 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 759 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 760 | 760 | return; |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // Check the nonce. |
| 764 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
| 764 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
| 765 | 765 | return; |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 769 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
| 769 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
| 770 | 770 | return; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Check user has permission to edit. |
| 774 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 774 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 775 | 775 | return; |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | // Fire action before saving form meta. |
| 779 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
| 779 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | 782 | * Filter the meta key to save. |
| 783 | 783 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
| 784 | 784 | */ |
| 785 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
| 785 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
| 786 | 786 | |
| 787 | 787 | // Save form meta data. |
| 788 | - if ( ! empty( $form_meta_keys ) ) { |
|
| 789 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
| 788 | + if ( ! empty($form_meta_keys)) { |
|
| 789 | + foreach ($form_meta_keys as $form_meta_key) { |
|
| 790 | 790 | |
| 791 | 791 | // Set default value for checkbox fields. |
| 792 | 792 | if ( |
| 793 | - ! isset( $_POST[ $form_meta_key ] ) |
|
| 794 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
| 793 | + ! isset($_POST[$form_meta_key]) |
|
| 794 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
| 795 | 795 | ) { |
| 796 | - $_POST[ $form_meta_key ] = ''; |
|
| 796 | + $_POST[$form_meta_key] = ''; |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
| 800 | - if ( $field_type = $this->get_field_type( $form_meta_key ) ) { |
|
| 801 | - switch ( $field_type ) { |
|
| 799 | + if (isset($_POST[$form_meta_key])) { |
|
| 800 | + if ($field_type = $this->get_field_type($form_meta_key)) { |
|
| 801 | + switch ($field_type) { |
|
| 802 | 802 | case 'textarea': |
| 803 | 803 | case 'wysiwyg': |
| 804 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
| 805 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 804 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
| 805 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 806 | 806 | break; |
| 807 | 807 | |
| 808 | 808 | case 'group': |
| 809 | 809 | $form_meta_value = array(); |
| 810 | 810 | |
| 811 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
| 811 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
| 812 | 812 | |
| 813 | 813 | // Do not save template input field values. |
| 814 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
| 814 | + if ('{{row-count-placeholder}}' === $index) { |
|
| 815 | 815 | continue; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | $group_meta_value = array(); |
| 819 | - foreach ( $group as $field_id => $field_value ) { |
|
| 820 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
| 819 | + foreach ($group as $field_id => $field_value) { |
|
| 820 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
| 821 | 821 | case 'wysiwyg': |
| 822 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
| 822 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
| 823 | 823 | break; |
| 824 | 824 | |
| 825 | 825 | default: |
| 826 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
| 826 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
| 827 | 827 | } |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | - if ( ! empty( $group_meta_value ) ) { |
|
| 831 | - $form_meta_value[ $index ] = $group_meta_value; |
|
| 830 | + if ( ! empty($group_meta_value)) { |
|
| 831 | + $form_meta_value[$index] = $group_meta_value; |
|
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | // Arrange repeater field keys in order. |
| 837 | - $form_meta_value = array_values( $form_meta_value ); |
|
| 837 | + $form_meta_value = array_values($form_meta_value); |
|
| 838 | 838 | |
| 839 | 839 | // Save data. |
| 840 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 840 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 841 | 841 | break; |
| 842 | 842 | |
| 843 | 843 | default: |
| 844 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
| 844 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
| 845 | 845 | |
| 846 | 846 | // Save data. |
| 847 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 847 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | // Fire after saving form meta key. |
| 851 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
| 851 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | // Fire action after saving form meta. |
| 858 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
| 858 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | |
@@ -868,10 +868,10 @@ discard block |
||
| 868 | 868 | * |
| 869 | 869 | * @return string |
| 870 | 870 | */ |
| 871 | - private function get_field_id( $field ) { |
|
| 871 | + private function get_field_id($field) { |
|
| 872 | 872 | $field_id = ''; |
| 873 | 873 | |
| 874 | - if ( array_key_exists( 'id', $field ) ) { |
|
| 874 | + if (array_key_exists('id', $field)) { |
|
| 875 | 875 | $field_id = $field['id']; |
| 876 | 876 | |
| 877 | 877 | } |
@@ -888,12 +888,12 @@ discard block |
||
| 888 | 888 | * |
| 889 | 889 | * @return array |
| 890 | 890 | */ |
| 891 | - private function get_fields_id( $setting ) { |
|
| 891 | + private function get_fields_id($setting) { |
|
| 892 | 892 | $meta_keys = array(); |
| 893 | 893 | |
| 894 | - if ( ! empty( $setting ) ) { |
|
| 895 | - foreach ( $setting['fields'] as $field ) { |
|
| 896 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 894 | + if ( ! empty($setting)) { |
|
| 895 | + foreach ($setting['fields'] as $field) { |
|
| 896 | + if ($field_id = $this->get_field_id($field)) { |
|
| 897 | 897 | $meta_keys[] = $field_id; |
| 898 | 898 | } |
| 899 | 899 | } |
@@ -911,14 +911,14 @@ discard block |
||
| 911 | 911 | * |
| 912 | 912 | * @return array |
| 913 | 913 | */ |
| 914 | - private function get_sub_fields_id( $setting ) { |
|
| 914 | + private function get_sub_fields_id($setting) { |
|
| 915 | 915 | $meta_keys = array(); |
| 916 | 916 | |
| 917 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
| 918 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 919 | - if ( ! empty( $fields['fields'] ) ) { |
|
| 920 | - foreach ( $fields['fields'] as $field ) { |
|
| 921 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 917 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
| 918 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 919 | + if ( ! empty($fields['fields'])) { |
|
| 920 | + foreach ($fields['fields'] as $field) { |
|
| 921 | + if ($field_id = $this->get_field_id($field)) { |
|
| 922 | 922 | $meta_keys[] = $field_id; |
| 923 | 923 | } |
| 924 | 924 | } |
@@ -939,14 +939,14 @@ discard block |
||
| 939 | 939 | private function get_meta_keys_from_settings() { |
| 940 | 940 | $meta_keys = array(); |
| 941 | 941 | |
| 942 | - foreach ( $this->settings as $setting ) { |
|
| 943 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 944 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
| 942 | + foreach ($this->settings as $setting) { |
|
| 943 | + if ($this->has_sub_tab($setting)) { |
|
| 944 | + $meta_key = $this->get_sub_fields_id($setting); |
|
| 945 | 945 | } else { |
| 946 | - $meta_key = $this->get_fields_id( $setting ); |
|
| 946 | + $meta_key = $this->get_fields_id($setting); |
|
| 947 | 947 | } |
| 948 | 948 | |
| 949 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
| 949 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | return $meta_keys; |
@@ -963,10 +963,10 @@ discard block |
||
| 963 | 963 | * |
| 964 | 964 | * @return string |
| 965 | 965 | */ |
| 966 | - function get_field_type( $field_id, $group_id = '' ) { |
|
| 967 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
| 966 | + function get_field_type($field_id, $group_id = '') { |
|
| 967 | + $field = $this->get_setting_field($field_id, $group_id); |
|
| 968 | 968 | |
| 969 | - $type = array_key_exists( 'type', $field ) |
|
| 969 | + $type = array_key_exists('type', $field) |
|
| 970 | 970 | ? $field['type'] |
| 971 | 971 | : ''; |
| 972 | 972 | |
@@ -984,12 +984,12 @@ discard block |
||
| 984 | 984 | * |
| 985 | 985 | * @return array |
| 986 | 986 | */ |
| 987 | - private function get_field( $setting, $field_id ) { |
|
| 987 | + private function get_field($setting, $field_id) { |
|
| 988 | 988 | $setting_field = array(); |
| 989 | 989 | |
| 990 | - if ( ! empty( $setting['fields'] ) ) { |
|
| 991 | - foreach ( $setting['fields'] as $field ) { |
|
| 992 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
| 990 | + if ( ! empty($setting['fields'])) { |
|
| 991 | + foreach ($setting['fields'] as $field) { |
|
| 992 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
| 993 | 993 | $setting_field = $field; |
| 994 | 994 | break; |
| 995 | 995 | } |
@@ -1009,12 +1009,12 @@ discard block |
||
| 1009 | 1009 | * |
| 1010 | 1010 | * @return array |
| 1011 | 1011 | */ |
| 1012 | - private function get_sub_field( $setting, $field_id ) { |
|
| 1012 | + private function get_sub_field($setting, $field_id) { |
|
| 1013 | 1013 | $setting_field = array(); |
| 1014 | 1014 | |
| 1015 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
| 1016 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 1017 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
| 1015 | + if ( ! empty($setting['sub-fields'])) { |
|
| 1016 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 1017 | + if ($field = $this->get_field($fields, $field_id)) { |
|
| 1018 | 1018 | $setting_field = $field; |
| 1019 | 1019 | break; |
| 1020 | 1020 | } |
@@ -1034,17 +1034,17 @@ discard block |
||
| 1034 | 1034 | * |
| 1035 | 1035 | * @return array |
| 1036 | 1036 | */ |
| 1037 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
| 1037 | + function get_setting_field($field_id, $group_id = '') { |
|
| 1038 | 1038 | $setting_field = array(); |
| 1039 | 1039 | |
| 1040 | 1040 | $_field_id = $field_id; |
| 1041 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
| 1041 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
| 1042 | 1042 | |
| 1043 | - if ( ! empty( $this->settings ) ) { |
|
| 1044 | - foreach ( $this->settings as $setting ) { |
|
| 1043 | + if ( ! empty($this->settings)) { |
|
| 1044 | + foreach ($this->settings as $setting) { |
|
| 1045 | 1045 | if ( |
| 1046 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
| 1047 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
| 1046 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
| 1047 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
| 1048 | 1048 | ) { |
| 1049 | 1049 | break; |
| 1050 | 1050 | } |
@@ -1053,9 +1053,9 @@ discard block |
||
| 1053 | 1053 | |
| 1054 | 1054 | |
| 1055 | 1055 | // Get field from group. |
| 1056 | - if ( ! empty( $group_id ) ) { |
|
| 1057 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1058 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
| 1056 | + if ( ! empty($group_id)) { |
|
| 1057 | + foreach ($setting_field['fields'] as $field) { |
|
| 1058 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
| 1059 | 1059 | $setting_field = $field; |
| 1060 | 1060 | } |
| 1061 | 1061 | } |
@@ -1074,14 +1074,14 @@ discard block |
||
| 1074 | 1074 | * |
| 1075 | 1075 | * @return mixed |
| 1076 | 1076 | */ |
| 1077 | - function add_offline_donations_setting_tab( $settings ) { |
|
| 1078 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
| 1079 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
| 1077 | + function add_offline_donations_setting_tab($settings) { |
|
| 1078 | + if (give_is_gateway_active('offline')) { |
|
| 1079 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
| 1080 | 1080 | 'id' => 'offline_donations_options', |
| 1081 | - 'title' => esc_html__( 'Offline Donations', 'give' ), |
|
| 1081 | + 'title' => esc_html__('Offline Donations', 'give'), |
|
| 1082 | 1082 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
| 1083 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
| 1084 | - ) ); |
|
| 1083 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
| 1084 | + )); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | return $settings; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct() { |
| 89 | 89 | |
| 90 | - if ( 'none' === $this->get_template() ) { |
|
| 90 | + if ('none' === $this->get_template()) { |
|
| 91 | 91 | $this->html = false; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
| 95 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
| 94 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
| 95 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param $key |
| 105 | 105 | * @param $value |
| 106 | 106 | */ |
| 107 | - public function __set( $key, $value ) { |
|
| 107 | + public function __set($key, $value) { |
|
| 108 | 108 | $this->$key = $value; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | * @since 1.0 |
| 115 | 115 | */ |
| 116 | 116 | public function get_from_name() { |
| 117 | - if ( ! $this->from_name ) { |
|
| 118 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
| 117 | + if ( ! $this->from_name) { |
|
| 118 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
| 121 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | * @since 1.0 |
| 128 | 128 | */ |
| 129 | 129 | public function get_from_address() { |
| 130 | - if ( ! $this->from_address ) { |
|
| 131 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
| 130 | + if ( ! $this->from_address) { |
|
| 131 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
| 134 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | * @since 1.0 |
| 141 | 141 | */ |
| 142 | 142 | public function get_content_type() { |
| 143 | - if ( ! $this->content_type && $this->html ) { |
|
| 144 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
| 145 | - } else if ( ! $this->html ) { |
|
| 143 | + if ( ! $this->content_type && $this->html) { |
|
| 144 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
| 145 | + } else if ( ! $this->html) { |
|
| 146 | 146 | $this->content_type = 'text/plain'; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
| 149 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | * @since 1.0 |
| 156 | 156 | */ |
| 157 | 157 | public function get_headers() { |
| 158 | - if ( ! $this->headers ) { |
|
| 158 | + if ( ! $this->headers) { |
|
| 159 | 159 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
| 160 | 160 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
| 161 | 161 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
| 164 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function get_templates() { |
| 173 | 173 | $templates = array( |
| 174 | - 'default' => esc_html__( 'Default Template', 'give' ), |
|
| 175 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) |
|
| 174 | + 'default' => esc_html__('Default Template', 'give'), |
|
| 175 | + 'none' => esc_html__('No template, plain text only', 'give') |
|
| 176 | 176 | ); |
| 177 | 177 | |
| 178 | - return apply_filters( 'give_email_templates', $templates ); |
|
| 178 | + return apply_filters('give_email_templates', $templates); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | * @since 1.0 |
| 185 | 185 | */ |
| 186 | 186 | public function get_template() { |
| 187 | - if ( ! $this->template ) { |
|
| 188 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
| 187 | + if ( ! $this->template) { |
|
| 188 | + $this->template = give_get_option('email_template', 'default'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return apply_filters( 'give_email_template', $this->template ); |
|
| 191 | + return apply_filters('give_email_template', $this->template); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @since 1.0 |
| 198 | 198 | */ |
| 199 | 199 | public function get_heading() { |
| 200 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
| 200 | + return apply_filters('give_email_heading', $this->heading); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return mixed |
| 209 | 209 | */ |
| 210 | - public function parse_tags( $content ) { |
|
| 210 | + public function parse_tags($content) { |
|
| 211 | 211 | return $content; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -220,19 +220,19 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @return string |
| 222 | 222 | */ |
| 223 | - public function build_email( $message ) { |
|
| 223 | + public function build_email($message) { |
|
| 224 | 224 | |
| 225 | - if ( false === $this->html ) { |
|
| 226 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
| 225 | + if (false === $this->html) { |
|
| 226 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - $message = $this->text_to_html( $message ); |
|
| 229 | + $message = $this->text_to_html($message); |
|
| 230 | 230 | |
| 231 | 231 | $template = $this->get_template(); |
| 232 | 232 | |
| 233 | 233 | ob_start(); |
| 234 | 234 | |
| 235 | - give_get_template_part( 'emails/header', $template, true ); |
|
| 235 | + give_get_template_part('emails/header', $template, true); |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Fires in the email head. |
@@ -241,17 +241,17 @@ discard block |
||
| 241 | 241 | * |
| 242 | 242 | * @param Give_Emails $this The email object. |
| 243 | 243 | */ |
| 244 | - do_action( 'give_email_header', $this ); |
|
| 244 | + do_action('give_email_header', $this); |
|
| 245 | 245 | |
| 246 | - if ( has_action( 'give_email_template_' . $template ) ) { |
|
| 246 | + if (has_action('give_email_template_'.$template)) { |
|
| 247 | 247 | /** |
| 248 | 248 | * Fires in a specific email template. |
| 249 | 249 | * |
| 250 | 250 | * @since 1.0 |
| 251 | 251 | */ |
| 252 | - do_action( "give_email_template_{$template}" ); |
|
| 252 | + do_action("give_email_template_{$template}"); |
|
| 253 | 253 | } else { |
| 254 | - give_get_template_part( 'emails/body', $template, true ); |
|
| 254 | + give_get_template_part('emails/body', $template, true); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | * |
| 262 | 262 | * @param Give_Emails $this The email object. |
| 263 | 263 | */ |
| 264 | - do_action( 'give_email_body', $this ); |
|
| 264 | + do_action('give_email_body', $this); |
|
| 265 | 265 | |
| 266 | - give_get_template_part( 'emails/footer', $template, true ); |
|
| 266 | + give_get_template_part('emails/footer', $template, true); |
|
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | 269 | * Fires in the email footer. |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @param Give_Emails $this The email object. |
| 274 | 274 | */ |
| 275 | - do_action( 'give_email_footer', $this ); |
|
| 275 | + do_action('give_email_footer', $this); |
|
| 276 | 276 | |
| 277 | 277 | $body = ob_get_clean(); |
| 278 | - $message = str_replace( '{email}', $message, $body ); |
|
| 278 | + $message = str_replace('{email}', $message, $body); |
|
| 279 | 279 | |
| 280 | - return apply_filters( 'give_email_message', $message, $this ); |
|
| 280 | + return apply_filters('give_email_message', $message, $this); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | * @return bool |
| 292 | 292 | */ |
| 293 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
| 293 | + public function send($to, $subject, $message, $attachments = '') { |
|
| 294 | 294 | |
| 295 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
| 296 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
| 295 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
| 296 | + _doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
| 297 | 297 | |
| 298 | 298 | return false; |
| 299 | 299 | } |
@@ -305,16 +305,16 @@ discard block |
||
| 305 | 305 | * |
| 306 | 306 | * @param Give_Emails $this The email object. |
| 307 | 307 | */ |
| 308 | - do_action( 'give_email_send_before', $this ); |
|
| 308 | + do_action('give_email_send_before', $this); |
|
| 309 | 309 | |
| 310 | - $subject = $this->parse_tags( $subject ); |
|
| 311 | - $message = $this->parse_tags( $message ); |
|
| 310 | + $subject = $this->parse_tags($subject); |
|
| 311 | + $message = $this->parse_tags($message); |
|
| 312 | 312 | |
| 313 | - $message = $this->build_email( $message ); |
|
| 313 | + $message = $this->build_email($message); |
|
| 314 | 314 | |
| 315 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
| 315 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
| 316 | 316 | |
| 317 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
| 317 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * Fires after sending an email. |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @param Give_Emails $this The email object. |
| 325 | 325 | */ |
| 326 | - do_action( 'give_email_send_after', $this ); |
|
| 326 | + do_action('give_email_send_after', $this); |
|
| 327 | 327 | |
| 328 | 328 | return $sent; |
| 329 | 329 | |
@@ -335,9 +335,9 @@ discard block |
||
| 335 | 335 | * @since 1.0 |
| 336 | 336 | */ |
| 337 | 337 | public function send_before() { |
| 338 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
| 339 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
| 340 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
| 338 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
| 339 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
| 340 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | * @since 1.0 |
| 347 | 347 | */ |
| 348 | 348 | public function send_after() { |
| 349 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
| 350 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
| 351 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
| 349 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
| 350 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
| 351 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
| 352 | 352 | |
| 353 | 353 | // Reset heading to an empty string |
| 354 | 354 | $this->heading = ''; |
@@ -359,10 +359,10 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @since 1.0 |
| 361 | 361 | */ |
| 362 | - public function text_to_html( $message ) { |
|
| 362 | + public function text_to_html($message) { |
|
| 363 | 363 | |
| 364 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
| 365 | - $message = wpautop( $message ); |
|
| 364 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
| 365 | + $message = wpautop($message); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | return $message; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param array $args An array of form arguments. |
| 23 | 23 | * |
| 24 | - * @return string Donation form. |
|
| 24 | + * @return false|null Donation form. |
|
| 25 | 25 | */ |
| 26 | 26 | function give_get_donation_form( $args = array() ) { |
| 27 | 27 | |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | * |
| 1474 | 1474 | * @param int $form_id The form ID. |
| 1475 | 1475 | * |
| 1476 | - * @return bool |
|
| 1476 | + * @return false|null |
|
| 1477 | 1477 | */ |
| 1478 | 1478 | function give_terms_agreement( $form_id ) { |
| 1479 | 1479 | $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | * @param int $form_id The form ID. |
| 1684 | 1684 | * @param array $args An array of form arguments. |
| 1685 | 1685 | * |
| 1686 | - * @return mixed |
|
| 1686 | + * @return boolean |
|
| 1687 | 1687 | */ |
| 1688 | 1688 | function give_show_goal_progress( $form_id, $args ) { |
| 1689 | 1689 | |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | * |
| 1704 | 1704 | * @since 1.8 |
| 1705 | 1705 | * |
| 1706 | - * @param $form_id |
|
| 1706 | + * @param integer $form_id |
|
| 1707 | 1707 | * @param $args |
| 1708 | 1708 | * |
| 1709 | 1709 | * @return mixed|string |
@@ -1744,7 +1744,7 @@ discard block |
||
| 1744 | 1744 | * @param int $form_id The form ID. |
| 1745 | 1745 | * @param array $args An array of form arguments. |
| 1746 | 1746 | * |
| 1747 | - * @return void|bool |
|
| 1747 | + * @return false|null |
|
| 1748 | 1748 | */ |
| 1749 | 1749 | function give_form_content( $form_id, $args ) { |
| 1750 | 1750 | |
@@ -1042,9 +1042,12 @@ |
||
| 1042 | 1042 | } |
| 1043 | 1043 | ?> |
| 1044 | 1044 | </select> |
| 1045 | - <?php else : ?> |
|
| 1045 | + <?php else { |
|
| 1046 | + : ?> |
|
| 1046 | 1047 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1047 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1048 | + placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
| 1049 | +} |
|
| 1050 | +?>"/> |
|
| 1048 | 1051 | <?php endif; ?> |
| 1049 | 1052 | </p> |
| 1050 | 1053 | <?php |
@@ -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,50 +23,50 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID. |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 58 | 58 | if ( |
| 59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 60 | - || ( 'trash' === $form->post_status ) |
|
| 59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 60 | + || ('trash' === $form->post_status) |
|
| 61 | 61 | ) { |
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | //Get the form wrap CSS classes. |
| 66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | //Get the <form> tag wrap CSS classes. |
| 69 | - $form_classes = $form->get_form_classes( $args ); |
|
| 69 | + $form_classes = $form->get_form_classes($args); |
|
| 70 | 70 | |
| 71 | 71 | ob_start(); |
| 72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * @param int $form_id The form ID. |
| 79 | 79 | * @param array $args An array of form arguments. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 85 | 85 | |
| 86 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 86 | + <?php if ($form->is_close_donation_form()) { |
|
| 87 | 87 | |
| 88 | 88 | // Get Goal thank you message. |
| 89 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
| 89 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
| 91 | 91 | |
| 92 | 92 | // Print thank you message. |
| 93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
| 93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
| 94 | 94 | |
| 95 | 95 | } else { |
| 96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * 1. if show_title params set to true |
| 99 | 99 | * 2. if admin set form display_style to button |
| 100 | 100 | */ |
| 101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 102 | 102 | if ( |
| 103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
| 104 | - && ! doing_action( 'give_single_form_summary' ) |
|
| 103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
| 104 | + && ! doing_action('give_single_form_summary') |
|
| 105 | 105 | ) { |
| 106 | 106 | echo $form_title; |
| 107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param int $form_id The form ID. |
| 115 | 115 | * @param array $args An array of form arguments. |
| 116 | 116 | */ |
| 117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 117 | + do_action('give_pre_form', $form->ID, $args); |
|
| 118 | 118 | ?> |
| 119 | 119 | |
| 120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 124 | 124 | <input type="hidden" name="give-current-url" |
| 125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 126 | 126 | <input type="hidden" name="give-form-url" |
| 127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 128 | 128 | <input type="hidden" name="give-form-minimum" |
| 129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 130 | 130 | |
| 131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
| 132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | 140 | // Price ID hidden field for variable (mult-level) donation forms. |
| 141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 141 | + if (give_has_variable_prices($form_id)) { |
|
| 142 | 142 | // Get default selected price ID. |
| 143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 144 | 144 | $price_id = 0; |
| 145 | 145 | //loop through prices. |
| 146 | - foreach ( $prices as $price ) { |
|
| 147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 146 | + foreach ($prices as $price) { |
|
| 147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 148 | 148 | $price_id = $price['_give_id']['level_id']; |
| 149 | 149 | }; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param int $form_id The form ID. |
| 161 | 161 | * @param array $args An array of form arguments. |
| 162 | 162 | */ |
| 163 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 163 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Fires while outputing donation form, for payment gatways fields. |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param int $form_id The form ID. |
| 171 | 171 | * @param array $args An array of form arguments. |
| 172 | 172 | */ |
| 173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Fires while outputing donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param int $form_id The form ID. |
| 181 | 181 | * @param array $args An array of form arguments. |
| 182 | 182 | */ |
| 183 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 183 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 184 | 184 | |
| 185 | 185 | ?> |
| 186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | * @param int $form_id The form ID. |
| 195 | 195 | * @param array $args An array of form arguments. |
| 196 | 196 | */ |
| 197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 197 | + do_action('give_post_form', $form->ID, $args); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | 201 | |
| 202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 203 | 203 | <?php |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @param int $form_id The form ID. |
| 211 | 211 | * @param array $args An array of form arguments. |
| 212 | 212 | */ |
| 213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 213 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 214 | 214 | |
| 215 | 215 | $final_output = ob_get_clean(); |
| 216 | 216 | |
| 217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return string |
| 233 | 233 | */ |
| 234 | -function give_show_purchase_form( $form_id ) { |
|
| 234 | +function give_show_purchase_form($form_id) { |
|
| 235 | 235 | |
| 236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 237 | 237 | |
| 238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 239 | 239 | $form_id = $_POST['give_form_id']; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @since 1.7 |
| 246 | 246 | */ |
| 247 | - do_action( 'give_donation_form_top', $form_id ); |
|
| 247 | + do_action('give_donation_form_top', $form_id); |
|
| 248 | 248 | |
| 249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 249 | + if (give_can_checkout() && isset($form_id)) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Fires while displaying donation form, before registration login. |
| 253 | 253 | * |
| 254 | 254 | * @since 1.7 |
| 255 | 255 | */ |
| 256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Fire when register/login form fields render. |
| 260 | 260 | * |
| 261 | 261 | * @since 1.7 |
| 262 | 262 | */ |
| 263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Fire when credit card form fields render. |
| 267 | 267 | * |
| 268 | 268 | * @since 1.7 |
| 269 | 269 | */ |
| 270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 271 | 271 | |
| 272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
| 273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 274 | 274 | /** |
| 275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param int $form_id The form ID. |
| 280 | 280 | */ |
| 281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 282 | 282 | } else { |
| 283 | 283 | /** |
| 284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param int $form_id The form ID. |
| 289 | 289 | */ |
| 290 | - do_action( 'give_cc_form', $form_id ); |
|
| 290 | + do_action('give_cc_form', $form_id); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @since 1.7 |
| 297 | 297 | */ |
| 298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @since 1.7 |
| 305 | 305 | */ |
| 306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 306 | + do_action('give_donation_form_no_access', $form_id); |
|
| 307 | 307 | |
| 308 | 308 | } |
| 309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.7 |
| 314 | 314 | */ |
| 315 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
| 315 | + do_action('give_donation_form_bottom', $form_id); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return void |
| 328 | 328 | */ |
| 329 | -function give_show_register_login_fields( $form_id ) { |
|
| 329 | +function give_show_register_login_fields($form_id) { |
|
| 330 | 330 | |
| 331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 331 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 332 | 332 | |
| 333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 334 | 334 | ?> |
| 335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.7 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 342 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 343 | 343 | ?> |
| 344 | 344 | </div> |
| 345 | 345 | <?php |
| 346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 347 | 347 | ?> |
| 348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @since 1.7 |
| 354 | 354 | */ |
| 355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 355 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 356 | 356 | ?> |
| 357 | 357 | </div> |
| 358 | 358 | <?php |
| 359 | 359 | endif; |
| 360 | 360 | |
| 361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 362 | 362 | /** |
| 363 | 363 | * Fire when user info render. |
| 364 | 364 | * |
| 365 | 365 | * @since 1.7 |
| 366 | 366 | */ |
| 367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 387 | 387 | |
| 388 | 388 | $give_options = give_get_settings(); |
| 389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 390 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 395 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 390 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 395 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
| 402 | 402 | * @param int $form_id The form ID. |
| 403 | 403 | * @param array $args An array of form arguments. |
| 404 | 404 | */ |
| 405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 406 | 406 | |
| 407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
| 408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
| 408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
| 409 | 409 | ?> |
| 410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
| 414 | - <?php if ( $currency_position == 'before' ) { |
|
| 414 | + <?php if ($currency_position == 'before') { |
|
| 415 | 415 | echo $currency_output; |
| 416 | 416 | } ?> |
| 417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 418 | - <?php if ( $currency_position == 'after' ) { |
|
| 418 | + <?php if ($currency_position == 'after') { |
|
| 419 | 419 | echo $currency_output; |
| 420 | 420 | } ?> |
| 421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | ?> |
| 426 | 426 | <div class="give-total-wrap"> |
| 427 | 427 | <div class="give-donation-amount form-row-wide"> |
| 428 | - <?php if ( $currency_position == 'before' ) { |
|
| 428 | + <?php if ($currency_position == 'before') { |
|
| 429 | 429 | echo $currency_output; |
| 430 | 430 | } ?> |
| 431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 434 | - <?php if ( $currency_position == 'after' ) { |
|
| 434 | + <?php if ($currency_position == 'after') { |
|
| 435 | 435 | echo $currency_output; |
| 436 | 436 | } ?> |
| 437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | * @param int $form_id The form ID. |
| 447 | 447 | * @param array $args An array of form arguments. |
| 448 | 448 | */ |
| 449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 450 | 450 | |
| 451 | 451 | //Custom Amount Text |
| 452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
| 452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
| 453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 454 | 454 | <?php } |
| 455 | 455 | |
| 456 | 456 | //Output Variable Pricing Levels. |
| 457 | - if ( $variable_pricing ) { |
|
| 458 | - give_output_levels( $form_id ); |
|
| 457 | + if ($variable_pricing) { |
|
| 458 | + give_output_levels($form_id); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @param int $form_id The form ID. |
| 467 | 467 | * @param array $args An array of form arguments. |
| 468 | 468 | */ |
| 469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 472 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,32 +480,32 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @return string Donation levels. |
| 482 | 482 | */ |
| 483 | -function give_output_levels( $form_id ) { |
|
| 483 | +function give_output_levels($form_id) { |
|
| 484 | 484 | |
| 485 | 485 | //Get variable pricing. |
| 486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 487 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 488 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 489 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 490 | - if ( empty( $custom_amount_text ) ) { |
|
| 491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 487 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 488 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 489 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 490 | + if (empty($custom_amount_text)) { |
|
| 491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $output = ''; |
| 495 | 495 | $counter = 0; |
| 496 | 496 | |
| 497 | - switch ( $display_style ) { |
|
| 497 | + switch ($display_style) { |
|
| 498 | 498 | case 'buttons': |
| 499 | 499 | |
| 500 | 500 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 501 | 501 | |
| 502 | - foreach ( $prices as $price ) { |
|
| 503 | - $counter ++; |
|
| 504 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 505 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 502 | + foreach ($prices as $price) { |
|
| 503 | + $counter++; |
|
| 504 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 505 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 506 | 506 | |
| 507 | 507 | $output .= '<li>'; |
| 508 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 508 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 509 | 509 | $output .= $level_text; |
| 510 | 510 | $output .= '</button>'; |
| 511 | 511 | $output .= '</li>'; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | //Custom Amount. |
| 516 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 516 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 517 | 517 | $output .= '<li>'; |
| 518 | 518 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 519 | 519 | $output .= $custom_amount_text; |
@@ -529,23 +529,23 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 531 | 531 | |
| 532 | - foreach ( $prices as $price ) { |
|
| 533 | - $counter ++; |
|
| 534 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 535 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 532 | + foreach ($prices as $price) { |
|
| 533 | + $counter++; |
|
| 534 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 535 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 536 | 536 | |
| 537 | 537 | $output .= '<li>'; |
| 538 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 539 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 538 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 539 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 540 | 540 | $output .= '</li>'; |
| 541 | 541 | |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | //Custom Amount. |
| 545 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 545 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 546 | 546 | $output .= '<li>'; |
| 547 | 547 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 548 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 548 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 549 | 549 | $output .= '</li>'; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -555,23 +555,23 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | case 'dropdown': |
| 557 | 557 | |
| 558 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 559 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 558 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 559 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 560 | 560 | |
| 561 | 561 | //first loop through prices. |
| 562 | - foreach ( $prices as $price ) { |
|
| 563 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 564 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 562 | + foreach ($prices as $price) { |
|
| 563 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 564 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 565 | 565 | |
| 566 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 566 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 567 | 567 | $output .= $level_text; |
| 568 | 568 | $output .= '</option>'; |
| 569 | 569 | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | //Custom Amount. |
| 573 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 574 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 573 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 574 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | $output .= '</select>'; |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | break; |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 582 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | /** |
@@ -594,27 +594,27 @@ discard block |
||
| 594 | 594 | * |
| 595 | 595 | * @return string Checkout button. |
| 596 | 596 | */ |
| 597 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 597 | +function give_display_checkout_button($form_id, $args) { |
|
| 598 | 598 | |
| 599 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 599 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 600 | 600 | ? $args['display_style'] |
| 601 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 601 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 602 | 602 | |
| 603 | - if ( 'button' === $display_option ) { |
|
| 603 | + if ('button' === $display_option) { |
|
| 604 | 604 | $display_option = 'modal'; |
| 605 | - } elseif ( $display_option === 'onpage' ) { |
|
| 605 | + } elseif ($display_option === 'onpage') { |
|
| 606 | 606 | return ''; |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 610 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 609 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 610 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 611 | 611 | |
| 612 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 612 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 613 | 613 | |
| 614 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 614 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 617 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 618 | 618 | |
| 619 | 619 | /** |
| 620 | 620 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -625,57 +625,57 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | -function give_user_info_fields( $form_id ) { |
|
| 628 | +function give_user_info_fields($form_id) { |
|
| 629 | 629 | // Get user info. |
| 630 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 630 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 631 | 631 | |
| 632 | 632 | /** |
| 633 | 633 | * Fire before user personal information fields |
| 634 | 634 | * |
| 635 | 635 | * @since 1.7 |
| 636 | 636 | */ |
| 637 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 637 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 638 | 638 | ?> |
| 639 | 639 | <fieldset id="give_checkout_user_info"> |
| 640 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 640 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 641 | 641 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
| 642 | 642 | <label class="give-label" for="give-first"> |
| 643 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 644 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 643 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 644 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 645 | 645 | <span class="give-required-indicator">*</span> |
| 646 | 646 | <?php endif ?> |
| 647 | 647 | <span class="give-tooltip give-icon give-icon-question" |
| 648 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 648 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 649 | 649 | </label> |
| 650 | 650 | <input |
| 651 | 651 | class="give-input required" |
| 652 | 652 | type="text" |
| 653 | 653 | name="give_first" |
| 654 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 654 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 655 | 655 | id="give-first" |
| 656 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 656 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 658 | 658 | /> |
| 659 | 659 | </p> |
| 660 | 660 | |
| 661 | 661 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
| 662 | 662 | <label class="give-label" for="give-last"> |
| 663 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 664 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 663 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 664 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 665 | 665 | <span class="give-required-indicator">*</span> |
| 666 | 666 | <?php endif ?> |
| 667 | 667 | <span class="give-tooltip give-icon give-icon-question" |
| 668 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 668 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 669 | 669 | </label> |
| 670 | 670 | |
| 671 | 671 | <input |
| 672 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 672 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 673 | 673 | type="text" |
| 674 | 674 | name="give_last" |
| 675 | 675 | id="give-last" |
| 676 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 677 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 676 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 677 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 679 | 679 | /> |
| 680 | 680 | </p> |
| 681 | 681 | |
@@ -685,26 +685,26 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @since 1.7 |
| 687 | 687 | */ |
| 688 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 688 | + do_action('give_donation_form_before_email', $form_id); |
|
| 689 | 689 | ?> |
| 690 | 690 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 691 | 691 | <label class="give-label" for="give-email"> |
| 692 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 693 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 692 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 693 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 694 | 694 | <span class="give-required-indicator">*</span> |
| 695 | 695 | <?php } ?> |
| 696 | 696 | <span class="give-tooltip give-icon give-icon-question" |
| 697 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 697 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 698 | 698 | </label> |
| 699 | 699 | |
| 700 | 700 | <input |
| 701 | 701 | class="give-input required" |
| 702 | 702 | type="email" |
| 703 | 703 | name="give_email" |
| 704 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 704 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 705 | 705 | id="give-email" |
| 706 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 706 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 708 | 708 | /> |
| 709 | 709 | |
| 710 | 710 | </p> |
@@ -714,14 +714,14 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @since 1.7 |
| 716 | 716 | */ |
| 717 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 717 | + do_action('give_donation_form_after_email', $form_id); |
|
| 718 | 718 | |
| 719 | 719 | /** |
| 720 | 720 | * Fire after personal email field |
| 721 | 721 | * |
| 722 | 722 | * @since 1.7 |
| 723 | 723 | */ |
| 724 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 724 | + do_action('give_donation_form_user_info', $form_id); |
|
| 725 | 725 | ?> |
| 726 | 726 | </fieldset> |
| 727 | 727 | <?php |
@@ -730,11 +730,11 @@ discard block |
||
| 730 | 730 | * |
| 731 | 731 | * @since 1.7 |
| 732 | 732 | */ |
| 733 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 733 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 737 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 736 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 737 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 738 | 738 | |
| 739 | 739 | /** |
| 740 | 740 | * Renders the credit card info form. |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @return void |
| 747 | 747 | */ |
| 748 | -function give_get_cc_form( $form_id ) { |
|
| 748 | +function give_get_cc_form($form_id) { |
|
| 749 | 749 | |
| 750 | 750 | ob_start(); |
| 751 | 751 | |
@@ -756,53 +756,53 @@ discard block |
||
| 756 | 756 | * |
| 757 | 757 | * @param int $form_id The form ID. |
| 758 | 758 | */ |
| 759 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 759 | + do_action('give_before_cc_fields', $form_id); |
|
| 760 | 760 | ?> |
| 761 | 761 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 762 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 763 | - <?php if ( is_ssl() ) : ?> |
|
| 762 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 763 | + <?php if (is_ssl()) : ?> |
|
| 764 | 764 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 765 | 765 | <span class="give-icon padlock"></span> |
| 766 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 766 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 767 | 767 | </div> |
| 768 | 768 | <?php endif; ?> |
| 769 | 769 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 770 | 770 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 771 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 771 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 772 | 772 | <span class="give-required-indicator">*</span> |
| 773 | 773 | <span class="give-tooltip give-icon give-icon-question" |
| 774 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 774 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 775 | 775 | <span class="card-type"></span> |
| 776 | 776 | </label> |
| 777 | 777 | |
| 778 | 778 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 779 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 779 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 780 | 780 | required aria-required="true"/> |
| 781 | 781 | </p> |
| 782 | 782 | |
| 783 | 783 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
| 784 | 784 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 785 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 785 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 786 | 786 | <span class="give-required-indicator">*</span> |
| 787 | 787 | <span class="give-tooltip give-icon give-icon-question" |
| 788 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 788 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 789 | 789 | </label> |
| 790 | 790 | |
| 791 | 791 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 792 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 792 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 793 | 793 | required aria-required="true"/> |
| 794 | 794 | </p> |
| 795 | 795 | |
| 796 | 796 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 797 | 797 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 798 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 798 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 799 | 799 | <span class="give-required-indicator">*</span> |
| 800 | 800 | <span class="give-tooltip give-icon give-icon-question" |
| 801 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 801 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 802 | 802 | </label> |
| 803 | 803 | |
| 804 | 804 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 805 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 805 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 806 | 806 | required aria-required="true"/> |
| 807 | 807 | </p> |
| 808 | 808 | <?php |
@@ -813,14 +813,14 @@ discard block |
||
| 813 | 813 | * |
| 814 | 814 | * @param int $form_id The form ID. |
| 815 | 815 | */ |
| 816 | - do_action( 'give_before_cc_expiration' ); |
|
| 816 | + do_action('give_before_cc_expiration'); |
|
| 817 | 817 | ?> |
| 818 | 818 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
| 819 | 819 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 820 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 820 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 821 | 821 | <span class="give-required-indicator">*</span> |
| 822 | 822 | <span class="give-tooltip give-icon give-icon-question" |
| 823 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 823 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 824 | 824 | </label> |
| 825 | 825 | |
| 826 | 826 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | class="card-expiry-year"/> |
| 830 | 830 | |
| 831 | 831 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 832 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 832 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 833 | 833 | required aria-required="true"/> |
| 834 | 834 | </p> |
| 835 | 835 | <?php |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | * |
| 841 | 841 | * @param int $form_id The form ID. |
| 842 | 842 | */ |
| 843 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 843 | + do_action('give_after_cc_expiration', $form_id); |
|
| 844 | 844 | ?> |
| 845 | 845 | </fieldset> |
| 846 | 846 | <?php |
@@ -851,12 +851,12 @@ discard block |
||
| 851 | 851 | * |
| 852 | 852 | * @param int $form_id The form ID. |
| 853 | 853 | */ |
| 854 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 854 | + do_action('give_after_cc_fields', $form_id); |
|
| 855 | 855 | |
| 856 | 856 | echo ob_get_clean(); |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 859 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * Outputs the default credit card address fields. |
@@ -867,24 +867,24 @@ discard block |
||
| 867 | 867 | * |
| 868 | 868 | * @return void |
| 869 | 869 | */ |
| 870 | -function give_default_cc_address_fields( $form_id ) { |
|
| 870 | +function give_default_cc_address_fields($form_id) { |
|
| 871 | 871 | // Get user info. |
| 872 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 872 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 873 | 873 | |
| 874 | 874 | $logged_in = is_user_logged_in(); |
| 875 | 875 | |
| 876 | - if ( $logged_in ) { |
|
| 877 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 876 | + if ($logged_in) { |
|
| 877 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 878 | 878 | } |
| 879 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 880 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 881 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 882 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 879 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 880 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 881 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 882 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 883 | 883 | |
| 884 | 884 | ob_start(); |
| 885 | 885 | ?> |
| 886 | 886 | <fieldset id="give_cc_address" class="cc-address"> |
| 887 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 887 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 888 | 888 | <?php |
| 889 | 889 | /** |
| 890 | 890 | * Fires while rendering credit card billing form, before address fields. |
@@ -893,79 +893,79 @@ discard block |
||
| 893 | 893 | * |
| 894 | 894 | * @param int $form_id The form ID. |
| 895 | 895 | */ |
| 896 | - do_action( 'give_cc_billing_top' ); |
|
| 896 | + do_action('give_cc_billing_top'); |
|
| 897 | 897 | ?> |
| 898 | 898 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
| 899 | 899 | <label for="card_address" class="give-label"> |
| 900 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 900 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 901 | 901 | <?php |
| 902 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 902 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 903 | 903 | <span class="give-required-indicator">*</span> |
| 904 | 904 | <?php endif; ?> |
| 905 | 905 | <span class="give-tooltip give-icon give-icon-question" |
| 906 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 906 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 907 | 907 | </label> |
| 908 | 908 | |
| 909 | 909 | <input |
| 910 | 910 | type="text" |
| 911 | 911 | id="card_address" |
| 912 | 912 | name="card_address" |
| 913 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 914 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 915 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 913 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 914 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 915 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 917 | 917 | /> |
| 918 | 918 | </p> |
| 919 | 919 | |
| 920 | 920 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
| 921 | 921 | <label for="card_address_2" class="give-label"> |
| 922 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 923 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 922 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 923 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 924 | 924 | <span class="give-required-indicator">*</span> |
| 925 | 925 | <?php endif; ?> |
| 926 | 926 | <span class="give-tooltip give-icon give-icon-question" |
| 927 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 927 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 928 | 928 | </label> |
| 929 | 929 | |
| 930 | 930 | <input |
| 931 | 931 | type="text" |
| 932 | 932 | id="card_address_2" |
| 933 | 933 | name="card_address_2" |
| 934 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 935 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 936 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 934 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 935 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 936 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 938 | 938 | /> |
| 939 | 939 | </p> |
| 940 | 940 | |
| 941 | 941 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
| 942 | 942 | <label for="card_city" class="give-label"> |
| 943 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 944 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 943 | + <?php esc_html_e('City', 'give'); ?> |
|
| 944 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 945 | 945 | <span class="give-required-indicator">*</span> |
| 946 | 946 | <?php endif; ?> |
| 947 | 947 | <span class="give-tooltip give-icon give-icon-question" |
| 948 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 948 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 949 | 949 | </label> |
| 950 | 950 | <input |
| 951 | 951 | type="text" |
| 952 | 952 | id="card_city" |
| 953 | 953 | name="card_city" |
| 954 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 955 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 956 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 954 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 955 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 956 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 958 | 958 | /> |
| 959 | 959 | </p> |
| 960 | 960 | |
| 961 | 961 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 962 | 962 | <label for="card_zip" class="give-label"> |
| 963 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 964 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 963 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 964 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 965 | 965 | <span class="give-required-indicator">*</span> |
| 966 | 966 | <?php endif; ?> |
| 967 | 967 | <span class="give-tooltip give-icon give-icon-question" |
| 968 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 968 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 969 | 969 | </label> |
| 970 | 970 | |
| 971 | 971 | <input |
@@ -973,40 +973,40 @@ discard block |
||
| 973 | 973 | size="4" |
| 974 | 974 | id="card_zip" |
| 975 | 975 | name="card_zip" |
| 976 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 977 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 978 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 976 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 977 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 978 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 980 | 980 | /> |
| 981 | 981 | </p> |
| 982 | 982 | |
| 983 | 983 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
| 984 | 984 | <label for="billing_country" class="give-label"> |
| 985 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 986 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 985 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 986 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 987 | 987 | <span class="give-required-indicator">*</span> |
| 988 | 988 | <?php endif; ?> |
| 989 | 989 | <span class="give-tooltip give-icon give-icon-question" |
| 990 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 990 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 991 | 991 | </label> |
| 992 | 992 | |
| 993 | 993 | <select |
| 994 | 994 | name="billing_country" |
| 995 | 995 | id="billing_country" |
| 996 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 997 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 996 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 997 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 998 | 998 | > |
| 999 | 999 | <?php |
| 1000 | 1000 | |
| 1001 | 1001 | $selected_country = give_get_country(); |
| 1002 | 1002 | |
| 1003 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1003 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1004 | 1004 | $selected_country = $give_user_info['billing_country']; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $countries = give_get_country_list(); |
| 1008 | - foreach ( $countries as $country_code => $country ) { |
|
| 1009 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1008 | + foreach ($countries as $country_code => $country) { |
|
| 1009 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | ?> |
| 1012 | 1012 | </select> |
@@ -1014,37 +1014,37 @@ discard block |
||
| 1014 | 1014 | |
| 1015 | 1015 | <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive"> |
| 1016 | 1016 | <label for="card_state" class="give-label"> |
| 1017 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 1018 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
| 1017 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 1018 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
| 1019 | 1019 | <span class="give-required-indicator">*</span> |
| 1020 | 1020 | <?php endif; ?> |
| 1021 | 1021 | <span class="give-tooltip give-icon give-icon-question" |
| 1022 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 1022 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 1023 | 1023 | </label> |
| 1024 | 1024 | |
| 1025 | 1025 | <?php |
| 1026 | 1026 | $selected_state = give_get_state(); |
| 1027 | - $states = give_get_states( $selected_country ); |
|
| 1027 | + $states = give_get_states($selected_country); |
|
| 1028 | 1028 | |
| 1029 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1029 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1030 | 1030 | $selected_state = $give_user_info['card_state']; |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | - if ( ! empty( $states ) ) : ?> |
|
| 1033 | + if ( ! empty($states)) : ?> |
|
| 1034 | 1034 | <select |
| 1035 | 1035 | name="card_state" |
| 1036 | 1036 | id="card_state" |
| 1037 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1038 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
| 1037 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1038 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
| 1039 | 1039 | <?php |
| 1040 | - foreach ( $states as $state_code => $state ) { |
|
| 1041 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1040 | + foreach ($states as $state_code => $state) { |
|
| 1041 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | ?> |
| 1044 | 1044 | </select> |
| 1045 | 1045 | <?php else : ?> |
| 1046 | 1046 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1047 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1047 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 1048 | 1048 | <?php endif; ?> |
| 1049 | 1049 | </p> |
| 1050 | 1050 | <?php |
@@ -1055,14 +1055,14 @@ discard block |
||
| 1055 | 1055 | * |
| 1056 | 1056 | * @param int $form_id The form ID. |
| 1057 | 1057 | */ |
| 1058 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1058 | + do_action('give_cc_billing_bottom'); |
|
| 1059 | 1059 | ?> |
| 1060 | 1060 | </fieldset> |
| 1061 | 1061 | <?php |
| 1062 | 1062 | echo ob_get_clean(); |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1065 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1066 | 1066 | |
| 1067 | 1067 | |
| 1068 | 1068 | /** |
@@ -1075,24 +1075,24 @@ discard block |
||
| 1075 | 1075 | * |
| 1076 | 1076 | * @return string |
| 1077 | 1077 | */ |
| 1078 | -function give_get_register_fields( $form_id ) { |
|
| 1078 | +function give_get_register_fields($form_id) { |
|
| 1079 | 1079 | |
| 1080 | 1080 | global $user_ID; |
| 1081 | 1081 | |
| 1082 | - if ( is_user_logged_in() ) { |
|
| 1083 | - $user_data = get_userdata( $user_ID ); |
|
| 1082 | + if (is_user_logged_in()) { |
|
| 1083 | + $user_data = get_userdata($user_ID); |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1086 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1087 | 1087 | |
| 1088 | 1088 | ob_start(); ?> |
| 1089 | 1089 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1090 | 1090 | |
| 1091 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1091 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1092 | 1092 | <div class="give-login-account-wrap"> |
| 1093 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1094 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1095 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1093 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1094 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1095 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1096 | 1096 | </p> |
| 1097 | 1097 | <p class="give-loading-text"> |
| 1098 | 1098 | <span class="give-loading-animation"></span> |
@@ -1108,15 +1108,15 @@ discard block |
||
| 1108 | 1108 | * |
| 1109 | 1109 | * @param int $form_id The form ID. |
| 1110 | 1110 | */ |
| 1111 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1111 | + do_action('give_register_fields_before', $form_id); |
|
| 1112 | 1112 | ?> |
| 1113 | 1113 | |
| 1114 | 1114 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1115 | 1115 | <legend> |
| 1116 | 1116 | <?php |
| 1117 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1118 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1119 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1117 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1118 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1119 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | ?> |
| 1122 | 1122 | </legend> |
@@ -1128,54 +1128,54 @@ discard block |
||
| 1128 | 1128 | * |
| 1129 | 1129 | * @param int $form_id The form ID. |
| 1130 | 1130 | */ |
| 1131 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1131 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1132 | 1132 | ?> |
| 1133 | 1133 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
| 1134 | 1134 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
| 1135 | 1135 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1136 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1137 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1136 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1137 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1138 | 1138 | <span class="give-required-indicator">*</span> |
| 1139 | 1139 | <?php } ?> |
| 1140 | 1140 | <span class="give-tooltip give-icon give-icon-question" |
| 1141 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1141 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1142 | 1142 | </label> |
| 1143 | 1143 | |
| 1144 | 1144 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1145 | 1145 | type="text" |
| 1146 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1146 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1147 | 1147 | </div> |
| 1148 | 1148 | |
| 1149 | 1149 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1150 | 1150 | class="form-row form-row-one-third form-row-responsive"> |
| 1151 | 1151 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1152 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1153 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1152 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1153 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1154 | 1154 | <span class="give-required-indicator">*</span> |
| 1155 | 1155 | <?php } ?> |
| 1156 | 1156 | <span class="give-tooltip give-icon give-icon-question" |
| 1157 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1157 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1158 | 1158 | </label> |
| 1159 | 1159 | |
| 1160 | 1160 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1161 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1162 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1161 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1162 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1163 | 1163 | </div> |
| 1164 | 1164 | |
| 1165 | 1165 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1166 | 1166 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
| 1167 | 1167 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1168 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1169 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1168 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1169 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1170 | 1170 | <span class="give-required-indicator">*</span> |
| 1171 | 1171 | <?php } ?> |
| 1172 | 1172 | <span class="give-tooltip give-icon give-icon-question" |
| 1173 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1173 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1174 | 1174 | </label> |
| 1175 | 1175 | |
| 1176 | 1176 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1177 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1178 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1177 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1178 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1179 | 1179 | </div> |
| 1180 | 1180 | <?php |
| 1181 | 1181 | /** |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | * |
| 1186 | 1186 | * @param int $form_id The form ID. |
| 1187 | 1187 | */ |
| 1188 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1188 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1189 | 1189 | ?> |
| 1190 | 1190 | </fieldset> |
| 1191 | 1191 | |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | * |
| 1198 | 1198 | * @param int $form_id The form ID. |
| 1199 | 1199 | */ |
| 1200 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1200 | + do_action('give_register_fields_after', $form_id); |
|
| 1201 | 1201 | ?> |
| 1202 | 1202 | |
| 1203 | 1203 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | * |
| 1209 | 1209 | * @since 1.7 |
| 1210 | 1210 | */ |
| 1211 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1211 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1212 | 1212 | ?> |
| 1213 | 1213 | |
| 1214 | 1214 | </fieldset> |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | echo ob_get_clean(); |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1219 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1220 | 1220 | |
| 1221 | 1221 | /** |
| 1222 | 1222 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1229,27 +1229,27 @@ discard block |
||
| 1229 | 1229 | * |
| 1230 | 1230 | * @return string |
| 1231 | 1231 | */ |
| 1232 | -function give_get_login_fields( $form_id ) { |
|
| 1232 | +function give_get_login_fields($form_id) { |
|
| 1233 | 1233 | |
| 1234 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1235 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1234 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1235 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1236 | 1236 | |
| 1237 | 1237 | ob_start(); |
| 1238 | 1238 | ?> |
| 1239 | 1239 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1240 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1241 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1242 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1240 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1241 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1242 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1243 | 1243 | } ?> |
| 1244 | 1244 | </legend> |
| 1245 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1245 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1246 | 1246 | <p class="give-new-account-link"> |
| 1247 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1248 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1247 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1248 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1249 | 1249 | data-action="give_checkout_register"> |
| 1250 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1251 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1252 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 1250 | + <?php esc_html_e('Register', 'give'); |
|
| 1251 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1252 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 1253 | 1253 | } ?> |
| 1254 | 1254 | </a> |
| 1255 | 1255 | </p> |
@@ -1265,49 +1265,49 @@ discard block |
||
| 1265 | 1265 | * |
| 1266 | 1266 | * @param int $form_id The form ID. |
| 1267 | 1267 | */ |
| 1268 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1268 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1269 | 1269 | ?> |
| 1270 | 1270 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
| 1271 | 1271 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1272 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1273 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1272 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1273 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1274 | 1274 | <span class="give-required-indicator">*</span> |
| 1275 | 1275 | <?php } ?> |
| 1276 | 1276 | </label> |
| 1277 | 1277 | |
| 1278 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1278 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1279 | 1279 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1280 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1280 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1281 | 1281 | </div> |
| 1282 | 1282 | |
| 1283 | 1283 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1284 | 1284 | class="give_login_password form-row form-row-last form-row-responsive"> |
| 1285 | 1285 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1286 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1287 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1286 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1287 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1288 | 1288 | <span class="give-required-indicator">*</span> |
| 1289 | 1289 | <?php } ?> |
| 1290 | 1290 | </label> |
| 1291 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1291 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1292 | 1292 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1293 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1293 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1294 | 1294 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1295 | 1295 | </div> |
| 1296 | 1296 | |
| 1297 | 1297 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1298 | 1298 | <span class="give-forgot-password "> |
| 1299 | 1299 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1300 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1300 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1301 | 1301 | </span> |
| 1302 | 1302 | </div> |
| 1303 | 1303 | |
| 1304 | 1304 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1305 | 1305 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1306 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1307 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1306 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1307 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1308 | 1308 | <input type="button" data-action="give_cancel_login" |
| 1309 | 1309 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1310 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1310 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1311 | 1311 | <?php } ?> |
| 1312 | 1312 | <span class="give-loading-animation"></span> |
| 1313 | 1313 | </div> |
@@ -1319,14 +1319,14 @@ discard block |
||
| 1319 | 1319 | * |
| 1320 | 1320 | * @param int $form_id The form ID. |
| 1321 | 1321 | */ |
| 1322 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1322 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1323 | 1323 | ?> |
| 1324 | 1324 | </fieldset><!--end #give-login-fields--> |
| 1325 | 1325 | <?php |
| 1326 | 1326 | echo ob_get_clean(); |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1329 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1330 | 1330 | |
| 1331 | 1331 | /** |
| 1332 | 1332 | * Payment Mode Select. |
@@ -1342,9 +1342,9 @@ discard block |
||
| 1342 | 1342 | * |
| 1343 | 1343 | * @return void |
| 1344 | 1344 | */ |
| 1345 | -function give_payment_mode_select( $form_id ) { |
|
| 1345 | +function give_payment_mode_select($form_id) { |
|
| 1346 | 1346 | |
| 1347 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
| 1347 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
| 1348 | 1348 | |
| 1349 | 1349 | /** |
| 1350 | 1350 | * Fires while selecting payment gateways, before the fields. |
@@ -1353,10 +1353,10 @@ discard block |
||
| 1353 | 1353 | * |
| 1354 | 1354 | * @param int $form_id The form ID. |
| 1355 | 1355 | */ |
| 1356 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1356 | + do_action('give_payment_mode_top', $form_id); |
|
| 1357 | 1357 | ?> |
| 1358 | 1358 | |
| 1359 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1359 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1360 | 1360 | echo 'style="display: none;"'; |
| 1361 | 1361 | } ?>> |
| 1362 | 1362 | <?php |
@@ -1367,10 +1367,10 @@ discard block |
||
| 1367 | 1367 | * |
| 1368 | 1368 | * @param int $form_id The form ID. |
| 1369 | 1369 | */ |
| 1370 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1370 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1371 | 1371 | ?> |
| 1372 | 1372 | <legend |
| 1373 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1373 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1374 | 1374 | <span class="give-loading-text"><span |
| 1375 | 1375 | class="give-loading-animation"></span> |
| 1376 | 1376 | </span> |
@@ -1383,26 +1383,26 @@ discard block |
||
| 1383 | 1383 | * |
| 1384 | 1384 | * @since 1.7 |
| 1385 | 1385 | */ |
| 1386 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1386 | + do_action('give_payment_mode_before_gateways') |
|
| 1387 | 1387 | ?> |
| 1388 | 1388 | <ul id="give-gateway-radio-list"> |
| 1389 | 1389 | <?php |
| 1390 | 1390 | /** |
| 1391 | 1391 | * Loop through the active payment gateways. |
| 1392 | 1392 | */ |
| 1393 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1393 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1394 | 1394 | |
| 1395 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1395 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1396 | 1396 | //Determine the default gateway. |
| 1397 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1397 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1398 | 1398 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
| 1399 | 1399 | <li<?php echo $checked_class ?>> |
| 1400 | 1400 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1401 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1402 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1403 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1401 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1402 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1403 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1404 | 1404 | class="give-gateway-option" |
| 1405 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1405 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1406 | 1406 | </li> |
| 1407 | 1407 | <?php |
| 1408 | 1408 | endforeach; |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 1.7 |
| 1416 | 1416 | */ |
| 1417 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1417 | + do_action('give_payment_mode_after_gateways'); |
|
| 1418 | 1418 | ?> |
| 1419 | 1419 | </div> |
| 1420 | 1420 | <?php |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | * |
| 1426 | 1426 | * @param int $form_id The form ID. |
| 1427 | 1427 | */ |
| 1428 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1428 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1429 | 1429 | ?> |
| 1430 | 1430 | </fieldset> |
| 1431 | 1431 | |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | * |
| 1438 | 1438 | * @param int $form_id The form ID. |
| 1439 | 1439 | */ |
| 1440 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1440 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1441 | 1441 | ?> |
| 1442 | 1442 | |
| 1443 | 1443 | <div id="give_purchase_form_wrap"> |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | * |
| 1449 | 1449 | * @since 1.7 |
| 1450 | 1450 | */ |
| 1451 | - do_action( 'give_donation_form', $form_id ); |
|
| 1451 | + do_action('give_donation_form', $form_id); |
|
| 1452 | 1452 | ?> |
| 1453 | 1453 | |
| 1454 | 1454 | </div> |
@@ -1459,10 +1459,10 @@ discard block |
||
| 1459 | 1459 | * |
| 1460 | 1460 | * @since 1.7 |
| 1461 | 1461 | */ |
| 1462 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1462 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1465 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1466 | 1466 | |
| 1467 | 1467 | /** |
| 1468 | 1468 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1475,31 +1475,31 @@ discard block |
||
| 1475 | 1475 | * |
| 1476 | 1476 | * @return bool |
| 1477 | 1477 | */ |
| 1478 | -function give_terms_agreement( $form_id ) { |
|
| 1479 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1478 | +function give_terms_agreement($form_id) { |
|
| 1479 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1480 | 1480 | |
| 1481 | 1481 | // Bailout if per form and global term and conditions is not setup. |
| 1482 | 1482 | if ( |
| 1483 | - give_is_setting_enabled( $form_option, 'global' ) |
|
| 1484 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
| 1483 | + give_is_setting_enabled($form_option, 'global') |
|
| 1484 | + && give_is_setting_enabled(give_get_option('terms')) |
|
| 1485 | 1485 | ) { |
| 1486 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1487 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
| 1488 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
| 1486 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1487 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
| 1488 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
| 1489 | 1489 | |
| 1490 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
| 1491 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
| 1492 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1493 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
| 1490 | + } elseif (give_is_setting_enabled($form_option)) { |
|
| 1491 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
| 1492 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1493 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
| 1494 | 1494 | |
| 1495 | 1495 | } else { |
| 1496 | 1496 | return false; |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | // Bailout: Check if term and conditions text is empty or not. |
| 1500 | - if ( empty( $terms ) ) { |
|
| 1501 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
| 1502 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
| 1500 | + if (empty($terms)) { |
|
| 1501 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
| 1502 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | return false; |
@@ -1507,7 +1507,7 @@ discard block |
||
| 1507 | 1507 | |
| 1508 | 1508 | ?> |
| 1509 | 1509 | <fieldset id="give_terms_agreement"> |
| 1510 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1510 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1511 | 1511 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1512 | 1512 | <?php |
| 1513 | 1513 | /** |
@@ -1515,22 +1515,22 @@ discard block |
||
| 1515 | 1515 | * |
| 1516 | 1516 | * @since 1.0 |
| 1517 | 1517 | */ |
| 1518 | - do_action( 'give_before_terms' ); |
|
| 1518 | + do_action('give_before_terms'); |
|
| 1519 | 1519 | |
| 1520 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1520 | + echo wpautop(stripslashes($terms)); |
|
| 1521 | 1521 | /** |
| 1522 | 1522 | * Fires while rendering terms of agreement, after the fields. |
| 1523 | 1523 | * |
| 1524 | 1524 | * @since 1.0 |
| 1525 | 1525 | */ |
| 1526 | - do_action( 'give_after_terms' ); |
|
| 1526 | + do_action('give_after_terms'); |
|
| 1527 | 1527 | ?> |
| 1528 | 1528 | </div> |
| 1529 | 1529 | <div id="give_show_terms"> |
| 1530 | 1530 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1531 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1531 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1532 | 1532 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1533 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1533 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1534 | 1534 | </div> |
| 1535 | 1535 | |
| 1536 | 1536 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | <?php |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1544 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1545 | 1545 | |
| 1546 | 1546 | /** |
| 1547 | 1547 | * Checkout Final Total. |
@@ -1554,29 +1554,29 @@ discard block |
||
| 1554 | 1554 | * |
| 1555 | 1555 | * @return void |
| 1556 | 1556 | */ |
| 1557 | -function give_checkout_final_total( $form_id ) { |
|
| 1557 | +function give_checkout_final_total($form_id) { |
|
| 1558 | 1558 | |
| 1559 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1560 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1559 | + if (isset($_POST['give_total'])) { |
|
| 1560 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1561 | 1561 | } else { |
| 1562 | 1562 | //default total. |
| 1563 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1563 | + $total = give_get_default_form_amount($form_id); |
|
| 1564 | 1564 | } |
| 1565 | 1565 | //Only proceed if give_total available. |
| 1566 | - if ( empty( $total ) ) { |
|
| 1566 | + if (empty($total)) { |
|
| 1567 | 1567 | return; |
| 1568 | 1568 | } |
| 1569 | 1569 | ?> |
| 1570 | 1570 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1571 | 1571 | <span |
| 1572 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1572 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1573 | 1573 | <span class="give-final-total-amount" |
| 1574 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1574 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1575 | 1575 | </p> |
| 1576 | 1576 | <?php |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1579 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1580 | 1580 | |
| 1581 | 1581 | /** |
| 1582 | 1582 | * Renders the Checkout Submit section. |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | * |
| 1588 | 1588 | * @return void |
| 1589 | 1589 | */ |
| 1590 | -function give_checkout_submit( $form_id ) { |
|
| 1590 | +function give_checkout_submit($form_id) { |
|
| 1591 | 1591 | ?> |
| 1592 | 1592 | <fieldset id="give_purchase_submit"> |
| 1593 | 1593 | <?php |
@@ -1596,24 +1596,24 @@ discard block |
||
| 1596 | 1596 | * |
| 1597 | 1597 | * @since 1.7 |
| 1598 | 1598 | */ |
| 1599 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1599 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1600 | 1600 | |
| 1601 | - give_checkout_hidden_fields( $form_id ); |
|
| 1601 | + give_checkout_hidden_fields($form_id); |
|
| 1602 | 1602 | |
| 1603 | - echo give_checkout_button_purchase( $form_id ); |
|
| 1603 | + echo give_checkout_button_purchase($form_id); |
|
| 1604 | 1604 | |
| 1605 | 1605 | /** |
| 1606 | 1606 | * Fire after donation form submit. |
| 1607 | 1607 | * |
| 1608 | 1608 | * @since 1.7 |
| 1609 | 1609 | */ |
| 1610 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1610 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1611 | 1611 | ?> |
| 1612 | 1612 | </fieldset> |
| 1613 | 1613 | <?php |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1616 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1617 | 1617 | |
| 1618 | 1618 | /** |
| 1619 | 1619 | * Give Checkout Button. |
@@ -1626,10 +1626,10 @@ discard block |
||
| 1626 | 1626 | * |
| 1627 | 1627 | * @return string |
| 1628 | 1628 | */ |
| 1629 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1629 | +function give_checkout_button_purchase($form_id) { |
|
| 1630 | 1630 | |
| 1631 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1632 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1631 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1632 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1633 | 1633 | ob_start(); ?> |
| 1634 | 1634 | <div class="give-submit-button-wrap give-clearfix"> |
| 1635 | 1635 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1637,7 +1637,7 @@ discard block |
||
| 1637 | 1637 | <span class="give-loading-animation"></span> |
| 1638 | 1638 | </div> |
| 1639 | 1639 | <?php |
| 1640 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1640 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | /** |
@@ -1651,18 +1651,18 @@ discard block |
||
| 1651 | 1651 | * |
| 1652 | 1652 | * @return void |
| 1653 | 1653 | */ |
| 1654 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1654 | +function give_agree_to_terms_js($form_id) { |
|
| 1655 | 1655 | |
| 1656 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1656 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1657 | 1657 | |
| 1658 | - if ( give_is_setting_enabled( $form_option, array( 'enabled', 'global' ) ) ) { |
|
| 1658 | + if (give_is_setting_enabled($form_option, array('enabled', 'global'))) { |
|
| 1659 | 1659 | ?> |
| 1660 | 1660 | <script type="text/javascript"> |
| 1661 | 1661 | jQuery(document).ready(function ($) { |
| 1662 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1662 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1663 | 1663 | e.preventDefault(); |
| 1664 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1665 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1664 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1665 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1666 | 1666 | return false; |
| 1667 | 1667 | }); |
| 1668 | 1668 | }); |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | } |
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1674 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1675 | 1675 | |
| 1676 | 1676 | /** |
| 1677 | 1677 | * Show Give Goals. |
@@ -1685,17 +1685,17 @@ discard block |
||
| 1685 | 1685 | * |
| 1686 | 1686 | * @return mixed |
| 1687 | 1687 | */ |
| 1688 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1688 | +function give_show_goal_progress($form_id, $args) { |
|
| 1689 | 1689 | |
| 1690 | 1690 | ob_start(); |
| 1691 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1691 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1692 | 1692 | |
| 1693 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1693 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1694 | 1694 | |
| 1695 | 1695 | return true; |
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1698 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1699 | 1699 | |
| 1700 | 1700 | |
| 1701 | 1701 | /** |
@@ -1708,10 +1708,10 @@ discard block |
||
| 1708 | 1708 | * |
| 1709 | 1709 | * @return mixed|string |
| 1710 | 1710 | */ |
| 1711 | -function give_get_form_content_placement( $form_id, $args ) { |
|
| 1711 | +function give_get_form_content_placement($form_id, $args) { |
|
| 1712 | 1712 | $show_content = ''; |
| 1713 | 1713 | |
| 1714 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
| 1714 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
| 1715 | 1715 | // Content positions. |
| 1716 | 1716 | $content_placement = array( |
| 1717 | 1717 | 'above' => 'give_pre_form', |
@@ -1719,18 +1719,18 @@ discard block |
||
| 1719 | 1719 | ); |
| 1720 | 1720 | |
| 1721 | 1721 | // Check if content position already decoded. |
| 1722 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
| 1722 | + if (in_array($args['show_content'], $content_placement)) { |
|
| 1723 | 1723 | return $args['show_content']; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
| 1726 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
| 1727 | 1727 | |
| 1728 | - } elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) { |
|
| 1729 | - $show_content = get_post_meta( $form_id, '_give_content_placement', true ); |
|
| 1728 | + } elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) { |
|
| 1729 | + $show_content = get_post_meta($form_id, '_give_content_placement', true); |
|
| 1730 | 1730 | |
| 1731 | - } elseif ( 'none' !== get_post_meta( $form_id, '_give_content_option', true ) ) { |
|
| 1731 | + } elseif ('none' !== get_post_meta($form_id, '_give_content_option', true)) { |
|
| 1732 | 1732 | // Backward compatibility for _give_content_option for v18. |
| 1733 | - $show_content = get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1733 | + $show_content = get_post_meta($form_id, '_give_content_option', true); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | 1736 | return $show_content; |
@@ -1746,20 +1746,20 @@ discard block |
||
| 1746 | 1746 | * |
| 1747 | 1747 | * @return void|bool |
| 1748 | 1748 | */ |
| 1749 | -function give_form_content( $form_id, $args ) { |
|
| 1749 | +function give_form_content($form_id, $args) { |
|
| 1750 | 1750 | |
| 1751 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1751 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1752 | 1752 | |
| 1753 | 1753 | // Bailout. |
| 1754 | - if ( empty( $show_content ) ) { |
|
| 1754 | + if (empty($show_content)) { |
|
| 1755 | 1755 | return false; |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | 1758 | // Add action according to value. |
| 1759 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1759 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1762 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1763 | 1763 | |
| 1764 | 1764 | /** |
| 1765 | 1765 | * Renders Post Form Content. |
@@ -1773,22 +1773,22 @@ discard block |
||
| 1773 | 1773 | * |
| 1774 | 1774 | * @return void |
| 1775 | 1775 | */ |
| 1776 | -function give_form_display_content( $form_id, $args ) { |
|
| 1776 | +function give_form_display_content($form_id, $args) { |
|
| 1777 | 1777 | |
| 1778 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1779 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1778 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1779 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1780 | 1780 | |
| 1781 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
| 1782 | - $content = apply_filters( 'the_content', $content ); |
|
| 1781 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
| 1782 | + $content = apply_filters('the_content', $content); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
| 1785 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
| 1786 | 1786 | |
| 1787 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1787 | + echo apply_filters('give_form_content_output', $output); |
|
| 1788 | 1788 | |
| 1789 | 1789 | //remove action to prevent content output on addition forms on page. |
| 1790 | 1790 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1791 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1791 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | /** |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | * |
| 1801 | 1801 | * @return void |
| 1802 | 1802 | */ |
| 1803 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1803 | +function give_checkout_hidden_fields($form_id) { |
|
| 1804 | 1804 | |
| 1805 | 1805 | /** |
| 1806 | 1806 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1809,13 +1809,13 @@ discard block |
||
| 1809 | 1809 | * |
| 1810 | 1810 | * @param int $form_id The form ID. |
| 1811 | 1811 | */ |
| 1812 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1812 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1813 | 1813 | |
| 1814 | - if ( is_user_logged_in() ) { ?> |
|
| 1814 | + if (is_user_logged_in()) { ?> |
|
| 1815 | 1815 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1816 | 1816 | <?php } ?> |
| 1817 | 1817 | <input type="hidden" name="give_action" value="purchase"/> |
| 1818 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1818 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1819 | 1819 | <?php |
| 1820 | 1820 | /** |
| 1821 | 1821 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1824,7 +1824,7 @@ discard block |
||
| 1824 | 1824 | * |
| 1825 | 1825 | * @param int $form_id The form ID. |
| 1826 | 1826 | */ |
| 1827 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1827 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1828 | 1828 | |
| 1829 | 1829 | } |
| 1830 | 1830 | |
@@ -1839,20 +1839,20 @@ discard block |
||
| 1839 | 1839 | * |
| 1840 | 1840 | * @return string $content Filtered content. |
| 1841 | 1841 | */ |
| 1842 | -function give_filter_success_page_content( $content ) { |
|
| 1842 | +function give_filter_success_page_content($content) { |
|
| 1843 | 1843 | |
| 1844 | 1844 | $give_options = give_get_settings(); |
| 1845 | 1845 | |
| 1846 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1847 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1848 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1846 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1847 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1848 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1849 | 1849 | } |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | 1852 | return $content; |
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1855 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1856 | 1856 | |
| 1857 | 1857 | /** |
| 1858 | 1858 | * Test Mode Frontend Warning. |
@@ -1863,12 +1863,12 @@ discard block |
||
| 1863 | 1863 | */ |
| 1864 | 1864 | function give_test_mode_frontend_warning() { |
| 1865 | 1865 | |
| 1866 | - if ( give_is_test_mode() ) { |
|
| 1867 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 1866 | + if (give_is_test_mode()) { |
|
| 1867 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 1868 | 1868 | } |
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1871 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1872 | 1872 | |
| 1873 | 1873 | /** |
| 1874 | 1874 | * Members-only Form. |
@@ -1882,21 +1882,21 @@ discard block |
||
| 1882 | 1882 | * |
| 1883 | 1883 | * @return string |
| 1884 | 1884 | */ |
| 1885 | -function give_members_only_form( $final_output, $args ) { |
|
| 1885 | +function give_members_only_form($final_output, $args) { |
|
| 1886 | 1886 | |
| 1887 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1887 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1888 | 1888 | |
| 1889 | 1889 | //Sanity Check: Must have form_id & not be logged in. |
| 1890 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1890 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1891 | 1891 | return $final_output; |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | 1894 | //Logged in only and Register / Login set to none. |
| 1895 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1895 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1896 | 1896 | |
| 1897 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1897 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1898 | 1898 | |
| 1899 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1899 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1900 | 1900 | |
| 1901 | 1901 | } |
| 1902 | 1902 | |
@@ -1904,4 +1904,4 @@ discard block |
||
| 1904 | 1904 | |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1907 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -725,9 +725,9 @@ |
||
| 725 | 725 | <td class="give-docs-link" colspan="2"> |
| 726 | 726 | <?php |
| 727 | 727 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
| 728 | - . '" target="_blank">' |
|
| 729 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 730 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 728 | + . '" target="_blank">' |
|
| 729 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 730 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 731 | 731 | ?> |
| 732 | 732 | </td> |
| 733 | 733 | </tr><?php |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param array $settings Array of settings class object. |
| 74 | 74 | */ |
| 75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
| 75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
| 76 | 76 | |
| 77 | 77 | return self::$settings; |
| 78 | 78 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public static function save() { |
| 87 | 87 | $current_tab = give_get_current_setting_tab(); |
| 88 | 88 | |
| 89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
| 90 | - die( __( 'Action failed. Please refresh the page and retry.', 'give' ) ); |
|
| 89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
| 90 | + die(__('Action failed. Please refresh the page and retry.', 'give')); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @since 1.8 |
| 101 | 101 | */ |
| 102 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
| 102 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
| 103 | 103 | |
| 104 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
| 104 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Trigger Action. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @since 1.8 |
| 114 | 114 | */ |
| 115 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
| 115 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @return void |
| 127 | 127 | */ |
| 128 | - public static function add_message( $code, $message ) { |
|
| 129 | - self::$messages[ $code ] = $message; |
|
| 128 | + public static function add_message($code, $message) { |
|
| 129 | + self::$messages[$code] = $message; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return void |
| 141 | 141 | */ |
| 142 | - public static function add_error( $code, $message ) { |
|
| 143 | - self::$errors[ $code ] = $message; |
|
| 142 | + public static function add_error($code, $message) { |
|
| 143 | + self::$errors[$code] = $message; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | $notice_html = ''; |
| 154 | 154 | $classes = 'give-notice settings-error notice is-dismissible'; |
| 155 | 155 | |
| 156 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
| 157 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
| 156 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
| 157 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
| 158 | 158 | |
| 159 | - if ( 0 < count( self::$errors ) ) { |
|
| 160 | - foreach ( self::$errors as $code => $message ) { |
|
| 161 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
| 159 | + if (0 < count(self::$errors)) { |
|
| 160 | + foreach (self::$errors as $code => $message) { |
|
| 161 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( 0 < count( self::$messages ) ) { |
|
| 166 | - foreach ( self::$messages as $code => $message ) { |
|
| 167 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
| 165 | + if (0 < count(self::$messages)) { |
|
| 166 | + foreach (self::$messages as $code => $message) { |
|
| 167 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | self::$setting_filter_prefix = give_get_current_setting_page(); |
| 185 | 185 | |
| 186 | 186 | // Bailout: Exit if setting page is not defined. |
| 187 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
| 187 | + if (empty(self::$setting_filter_prefix)) { |
|
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @since 1.8 |
| 199 | 199 | */ |
| 200 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
| 200 | + do_action(self::$setting_filter_prefix.'_start'); |
|
| 201 | 201 | |
| 202 | 202 | $current_tab = give_get_current_setting_tab(); |
| 203 | 203 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | self::get_settings_pages(); |
| 206 | 206 | |
| 207 | 207 | // Save settings if data has been posted. |
| 208 | - if ( ! empty( $_POST ) ) { |
|
| 208 | + if ( ! empty($_POST)) { |
|
| 209 | 209 | self::save(); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @since 1.8 |
| 220 | 220 | */ |
| 221 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
| 221 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
| 222 | 222 | |
| 223 | 223 | include 'views/html-admin-settings.php'; |
| 224 | 224 | |
@@ -236,25 +236,25 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return string|bool |
| 238 | 238 | */ |
| 239 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
| 239 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
| 240 | 240 | // Bailout. |
| 241 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
| 241 | + if (empty($option_name) && empty($field_id)) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
| 245 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
| 246 | 246 | // Get field value if any. |
| 247 | - $option_value = get_option( $option_name ); |
|
| 247 | + $option_value = get_option($option_name); |
|
| 248 | 248 | |
| 249 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
| 250 | - ? $option_value[ $field_id ] |
|
| 249 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
| 250 | + ? $option_value[$field_id] |
|
| 251 | 251 | : $default; |
| 252 | 252 | } else { |
| 253 | 253 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
| 254 | 254 | $option_name = ! $option_name ? $field_id : $option_name; |
| 255 | 255 | |
| 256 | 256 | // Get option value if any. |
| 257 | - $option_value = get_option( $option_name, $default ); |
|
| 257 | + $option_value = get_option($option_name, $default); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | return $option_value; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @return void |
| 274 | 274 | */ |
| 275 | - public static function output_fields( $options, $option_name = '' ) { |
|
| 275 | + public static function output_fields($options, $option_name = '') { |
|
| 276 | 276 | $current_tab = give_get_current_setting_tab(); |
| 277 | 277 | |
| 278 | 278 | // Field Default values. |
@@ -285,52 +285,52 @@ discard block |
||
| 285 | 285 | 'table_html' => true, |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | - foreach ( $options as $value ) { |
|
| 289 | - if ( ! isset( $value['type'] ) ) { |
|
| 288 | + foreach ($options as $value) { |
|
| 289 | + if ( ! isset($value['type'])) { |
|
| 290 | 290 | continue; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Set title. |
| 294 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
| 294 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
| 295 | 295 | |
| 296 | 296 | // Set default setting. |
| 297 | - $value = wp_parse_args( $value, $defaults ); |
|
| 297 | + $value = wp_parse_args($value, $defaults); |
|
| 298 | 298 | |
| 299 | 299 | // Colorpicker field. |
| 300 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
| 301 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
| 300 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
| 301 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | // Custom attribute handling. |
| 305 | 305 | $custom_attributes = array(); |
| 306 | 306 | |
| 307 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
| 308 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
| 309 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
| 307 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
| 308 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
| 309 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // Description handling. |
| 314 | - $description = self::get_field_description( $value ); |
|
| 314 | + $description = self::get_field_description($value); |
|
| 315 | 315 | |
| 316 | 316 | // Switch based on type. |
| 317 | - switch ( $value['type'] ) { |
|
| 317 | + switch ($value['type']) { |
|
| 318 | 318 | |
| 319 | 319 | // Section Titles |
| 320 | 320 | case 'title': |
| 321 | - if ( ! empty( $value['title'] ) ) { |
|
| 322 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
| 321 | + if ( ! empty($value['title'])) { |
|
| 322 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( ! empty( $value['desc'] ) ) { |
|
| 326 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
| 325 | + if ( ! empty($value['desc'])) { |
|
| 326 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if ( $value['table_html'] ) { |
|
| 330 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
| 329 | + if ($value['table_html']) { |
|
| 330 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ( ! empty( $value['id'] ) ) { |
|
| 333 | + if ( ! empty($value['id'])) { |
|
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | 336 | * Trigger Action. |
@@ -339,14 +339,14 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.8 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
| 342 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | break; |
| 346 | 346 | |
| 347 | 347 | // Section Ends. |
| 348 | 348 | case 'sectionend': |
| 349 | - if ( ! empty( $value['id'] ) ) { |
|
| 349 | + if ( ! empty($value['id'])) { |
|
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | 352 | * Trigger Action. |
@@ -355,14 +355,14 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @since 1.8 |
| 357 | 357 | */ |
| 358 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
| 358 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if ( $value['table_html'] ) { |
|
| 361 | + if ($value['table_html']) { |
|
| 362 | 362 | echo '</table>'; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if ( ! empty( $value['id'] ) ) { |
|
| 365 | + if ( ! empty($value['id'])) { |
|
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | 368 | * Trigger Action. |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @since 1.8 |
| 373 | 373 | */ |
| 374 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
| 374 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | break; |
@@ -384,22 +384,22 @@ discard block |
||
| 384 | 384 | case 'password' : |
| 385 | 385 | |
| 386 | 386 | $type = $value['type']; |
| 387 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 387 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 388 | 388 | |
| 389 | 389 | ?> |
| 390 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 390 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 391 | 391 | <th scope="row" class="titledesc"> |
| 392 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 392 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 393 | 393 | </th> |
| 394 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 394 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 395 | 395 | <input |
| 396 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 397 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 398 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 399 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 400 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
| 401 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 402 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 396 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 397 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 398 | + type="<?php echo esc_attr($type); ?>" |
|
| 399 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 400 | + value="<?php echo esc_attr($option_value); ?>" |
|
| 401 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 402 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 403 | 403 | /> <?php echo $description; ?> |
| 404 | 404 | </td> |
| 405 | 405 | </tr><?php |
@@ -408,23 +408,23 @@ discard block |
||
| 408 | 408 | // Textarea. |
| 409 | 409 | case 'textarea': |
| 410 | 410 | |
| 411 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 411 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 412 | 412 | |
| 413 | 413 | ?> |
| 414 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 414 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 415 | 415 | <th scope="row" class="titledesc"> |
| 416 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 416 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 417 | 417 | </th> |
| 418 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 418 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 419 | 419 | <textarea |
| 420 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 421 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 422 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 423 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 420 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 421 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 422 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 423 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 424 | 424 | rows="10" |
| 425 | 425 | cols="60" |
| 426 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 427 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
| 426 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 427 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
| 428 | 428 | <?php echo $description; ?> |
| 429 | 429 | </td> |
| 430 | 430 | </tr><?php |
@@ -434,35 +434,35 @@ discard block |
||
| 434 | 434 | case 'select' : |
| 435 | 435 | case 'multiselect' : |
| 436 | 436 | |
| 437 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 437 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 438 | 438 | |
| 439 | 439 | ?> |
| 440 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 440 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 441 | 441 | <th scope="row" class="titledesc"> |
| 442 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 442 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 443 | 443 | </th> |
| 444 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 444 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 445 | 445 | <select |
| 446 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
| 446 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
| 447 | 447 | echo '[]'; |
| 448 | 448 | } ?>" |
| 449 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 450 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 451 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 452 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 453 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
| 449 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 450 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 451 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 452 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 453 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
| 454 | 454 | > |
| 455 | 455 | |
| 456 | 456 | <?php |
| 457 | - if ( ! empty( $value['options'] ) ) { |
|
| 458 | - foreach ( $value['options'] as $key => $val ) { |
|
| 457 | + if ( ! empty($value['options'])) { |
|
| 458 | + foreach ($value['options'] as $key => $val) { |
|
| 459 | 459 | ?> |
| 460 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
| 460 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
| 461 | 461 | |
| 462 | - if ( is_array( $option_value ) ) { |
|
| 463 | - selected( in_array( $key, $option_value ), true ); |
|
| 462 | + if (is_array($option_value)) { |
|
| 463 | + selected(in_array($key, $option_value), true); |
|
| 464 | 464 | } else { |
| 465 | - selected( $option_value, $key ); |
|
| 465 | + selected($option_value, $key); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | ?>><?php echo $val ?></option> |
@@ -478,28 +478,28 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | // Radio inputs. |
| 480 | 480 | case 'radio_inline' : |
| 481 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
| 481 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
| 482 | 482 | case 'radio' : |
| 483 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 483 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 484 | 484 | ?> |
| 485 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 485 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 486 | 486 | <th scope="row" class="titledesc"> |
| 487 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 487 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 488 | 488 | </th> |
| 489 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 489 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 490 | 490 | <fieldset> |
| 491 | 491 | <ul> |
| 492 | 492 | <?php |
| 493 | - foreach ( $value['options'] as $key => $val ) { |
|
| 493 | + foreach ($value['options'] as $key => $val) { |
|
| 494 | 494 | ?> |
| 495 | 495 | <li> |
| 496 | 496 | <label><input |
| 497 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 497 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 498 | 498 | value="<?php echo $key; ?>" |
| 499 | 499 | type="radio" |
| 500 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 501 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 502 | - <?php checked( $key, $option_value ); ?> |
|
| 500 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 501 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 502 | + <?php checked($key, $option_value); ?> |
|
| 503 | 503 | /> <?php echo $val ?></label> |
| 504 | 504 | </li> |
| 505 | 505 | <?php |
@@ -513,21 +513,21 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | // Checkbox input. |
| 515 | 515 | case 'checkbox' : |
| 516 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 516 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 517 | 517 | ?> |
| 518 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 518 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 519 | 519 | <th scope="row" class="titledesc"> |
| 520 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 520 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 521 | 521 | </th> |
| 522 | 522 | <td class="give-forminp"> |
| 523 | 523 | <input |
| 524 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 525 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 524 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 525 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 526 | 526 | type="checkbox" |
| 527 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
| 527 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
| 528 | 528 | value="1" |
| 529 | - <?php checked( $option_value, 'on' ); ?> |
|
| 530 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 529 | + <?php checked($option_value, 'on'); ?> |
|
| 530 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 531 | 531 | /> |
| 532 | 532 | <?php echo $description; ?> |
| 533 | 533 | </td> |
@@ -537,28 +537,28 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | // Multi Checkbox input. |
| 539 | 539 | case 'multicheck' : |
| 540 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 541 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
| 540 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 541 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
| 542 | 542 | ?> |
| 543 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 543 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 544 | 544 | <th scope="row" class="titledesc"> |
| 545 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 545 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 546 | 546 | </th> |
| 547 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 547 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 548 | 548 | <fieldset> |
| 549 | 549 | <ul> |
| 550 | 550 | <?php |
| 551 | - foreach ( $value['options'] as $key => $val ) { |
|
| 551 | + foreach ($value['options'] as $key => $val) { |
|
| 552 | 552 | ?> |
| 553 | 553 | <li> |
| 554 | 554 | <label> |
| 555 | 555 | <input |
| 556 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
| 556 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
| 557 | 557 | value="<?php echo $key; ?>" |
| 558 | 558 | type="checkbox" |
| 559 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 560 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 561 | - <?php if ( in_array( $key, $option_value ) ) { |
|
| 559 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 560 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 561 | + <?php if (in_array($key, $option_value)) { |
|
| 562 | 562 | echo 'checked="checked"'; |
| 563 | 563 | } ?> |
| 564 | 564 | /> <?php echo $val ?> |
@@ -576,25 +576,25 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | // File input field. |
| 578 | 578 | case 'file' : |
| 579 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 579 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 580 | 580 | ?> |
| 581 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 581 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 582 | 582 | <th scope="row" class="titledesc"> |
| 583 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 583 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 584 | 584 | </th> |
| 585 | 585 | <td class="give-forminp"> |
| 586 | 586 | <div class="give-field-wrap"> |
| 587 | 587 | <label for="<?php echo $value['id'] ?>"> |
| 588 | 588 | <input |
| 589 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 590 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 589 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 590 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 591 | 591 | type="text" |
| 592 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
| 592 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
| 593 | 593 | value="<?php echo $option_value; ?>" |
| 594 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 595 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 594 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 595 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 596 | 596 | /> <input class="give-upload-button button" type="button" |
| 597 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
| 597 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
| 598 | 598 | <?php echo $description ?> |
| 599 | 599 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
| 600 | 600 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -609,17 +609,17 @@ discard block |
||
| 609 | 609 | // WordPress Editor. |
| 610 | 610 | case 'wysiwyg' : |
| 611 | 611 | // Get option value. |
| 612 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 612 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 613 | 613 | |
| 614 | 614 | // Get editor settings. |
| 615 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
| 615 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
| 616 | 616 | ?> |
| 617 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 617 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 618 | 618 | <th scope="row" class="titledesc"> |
| 619 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 619 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 620 | 620 | </th> |
| 621 | 621 | <td class="give-forminp"> |
| 622 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
| 622 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
| 623 | 623 | <?php echo $description; ?> |
| 624 | 624 | </td> |
| 625 | 625 | </tr><?php |
@@ -628,9 +628,9 @@ discard block |
||
| 628 | 628 | // Custom: System setting field. |
| 629 | 629 | case 'system_info' : |
| 630 | 630 | ?> |
| 631 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 631 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 632 | 632 | <th scope="row" class="titledesc"> |
| 633 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 633 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 634 | 634 | </th> |
| 635 | 635 | <td class="give-forminp"> |
| 636 | 636 | <?php give_system_info_callback(); ?> |
@@ -641,14 +641,14 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | // Custom: Default gateways setting field. |
| 643 | 643 | case 'default_gateway' : |
| 644 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 644 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 645 | 645 | ?> |
| 646 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 646 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 647 | 647 | <th scope="row" class="titledesc"> |
| 648 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 648 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 649 | 649 | </th> |
| 650 | 650 | <td class="give-forminp"> |
| 651 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
| 651 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
| 652 | 652 | <?php echo $description; ?> |
| 653 | 653 | </td> |
| 654 | 654 | </tr><?php |
@@ -656,14 +656,14 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | // Custom: Enable gateways setting field. |
| 658 | 658 | case 'enabled_gateways' : |
| 659 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 659 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 660 | 660 | ?> |
| 661 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 661 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 662 | 662 | <th scope="row" class="titledesc"> |
| 663 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 663 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 664 | 664 | </th> |
| 665 | 665 | <td class="give-forminp"> |
| 666 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
| 666 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
| 667 | 667 | <?php echo $description; ?> |
| 668 | 668 | </td> |
| 669 | 669 | </tr><?php |
@@ -672,9 +672,9 @@ discard block |
||
| 672 | 672 | // Custom: Email preview buttons field. |
| 673 | 673 | case 'email_preview_buttons' : |
| 674 | 674 | ?> |
| 675 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 675 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 676 | 676 | <th scope="row" class="titledesc"> |
| 677 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 677 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 678 | 678 | </th> |
| 679 | 679 | <td class="give-forminp"> |
| 680 | 680 | <?php give_email_preview_buttons_callback(); ?> |
@@ -691,22 +691,22 @@ discard block |
||
| 691 | 691 | |
| 692 | 692 | // Custom: Gateway API key. |
| 693 | 693 | case 'api_key' : |
| 694 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 695 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
| 694 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 695 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
| 696 | 696 | ?> |
| 697 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 697 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 698 | 698 | <th scope="row" class="titledesc"> |
| 699 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 699 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 700 | 700 | </th> |
| 701 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 701 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 702 | 702 | <input |
| 703 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 704 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 705 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 706 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 707 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
| 708 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 709 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 703 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 704 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 705 | + type="<?php echo esc_attr($type); ?>" |
|
| 706 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 707 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
| 708 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 709 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 710 | 710 | /> <?php echo $description; ?> |
| 711 | 711 | </td> |
| 712 | 712 | </tr><?php |
@@ -728,12 +728,12 @@ discard block |
||
| 728 | 728 | // Custom: Give Docs Link field type. |
| 729 | 729 | case 'give_docs_link' : |
| 730 | 730 | ?> |
| 731 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 731 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 732 | 732 | <td class="give-docs-link" colspan="2"> |
| 733 | 733 | <?php |
| 734 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
| 734 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
| 735 | 735 | . '" target="_blank">' |
| 736 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 736 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title']) |
|
| 737 | 737 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 738 | 738 | ?> |
| 739 | 739 | </td> |
@@ -744,8 +744,8 @@ discard block |
||
| 744 | 744 | // You can add or handle your custom field action. |
| 745 | 745 | default: |
| 746 | 746 | // Get option value. |
| 747 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 748 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
| 747 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 748 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
| 749 | 749 | break; |
| 750 | 750 | } |
| 751 | 751 | } |
@@ -761,15 +761,15 @@ discard block |
||
| 761 | 761 | * |
| 762 | 762 | * @return string The HTML description of the field. |
| 763 | 763 | */ |
| 764 | - public static function get_field_description( $value ) { |
|
| 764 | + public static function get_field_description($value) { |
|
| 765 | 765 | $description = ''; |
| 766 | 766 | |
| 767 | 767 | // Support for both 'description' and 'desc' args. |
| 768 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
| 769 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
| 768 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
| 769 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
| 770 | 770 | |
| 771 | - if ( ! empty( $value ) ) { |
|
| 772 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
| 771 | + if ( ! empty($value)) { |
|
| 772 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | return $description; |
@@ -786,11 +786,11 @@ discard block |
||
| 786 | 786 | * |
| 787 | 787 | * @return array The description and tip as a 2 element array |
| 788 | 788 | */ |
| 789 | - public static function get_field_title( $value ) { |
|
| 790 | - $title = esc_html( $value['title'] ); |
|
| 789 | + public static function get_field_title($value) { |
|
| 790 | + $title = esc_html($value['title']); |
|
| 791 | 791 | |
| 792 | 792 | // If html tag detected then allow them to print. |
| 793 | - if ( strip_tags( $title ) ) { |
|
| 793 | + if (strip_tags($title)) { |
|
| 794 | 794 | $title = $value['title']; |
| 795 | 795 | } |
| 796 | 796 | |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | * |
| 810 | 810 | * @return bool |
| 811 | 811 | */ |
| 812 | - public static function save_fields( $options, $option_name = '' ) { |
|
| 813 | - if ( empty( $_POST ) ) { |
|
| 812 | + public static function save_fields($options, $option_name = '') { |
|
| 813 | + if (empty($_POST)) { |
|
| 814 | 814 | return false; |
| 815 | 815 | } |
| 816 | 816 | |
@@ -818,37 +818,37 @@ discard block |
||
| 818 | 818 | $update_options = array(); |
| 819 | 819 | |
| 820 | 820 | // Loop options and get values to save. |
| 821 | - foreach ( $options as $option ) { |
|
| 822 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
| 821 | + foreach ($options as $option) { |
|
| 822 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
| 823 | 823 | continue; |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | // Get posted value. |
| 827 | - if ( strstr( $option['id'], '[' ) ) { |
|
| 828 | - parse_str( $option['id'], $option_name_array ); |
|
| 829 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
| 830 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
| 831 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
| 827 | + if (strstr($option['id'], '[')) { |
|
| 828 | + parse_str($option['id'], $option_name_array); |
|
| 829 | + $field_option_name = current(array_keys($option_name_array)); |
|
| 830 | + $setting_name = key($option_name_array[$field_option_name]); |
|
| 831 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
| 832 | 832 | } else { |
| 833 | 833 | $field_option_name = $option['id']; |
| 834 | 834 | $setting_name = ''; |
| 835 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
| 835 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | // Format the value based on option type. |
| 839 | - switch ( $option['type'] ) { |
|
| 839 | + switch ($option['type']) { |
|
| 840 | 840 | case 'checkbox' : |
| 841 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
| 841 | + $value = is_null($raw_value) ? '' : 'on'; |
|
| 842 | 842 | break; |
| 843 | 843 | case 'wysiwyg' : |
| 844 | 844 | case 'textarea' : |
| 845 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
| 845 | + $value = wp_kses_post(trim($raw_value)); |
|
| 846 | 846 | break; |
| 847 | 847 | case 'multiselect' : |
| 848 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
| 848 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
| 849 | 849 | break; |
| 850 | 850 | default : |
| 851 | - $value = give_clean( $raw_value ); |
|
| 851 | + $value = give_clean($raw_value); |
|
| 852 | 852 | break; |
| 853 | 853 | } |
| 854 | 854 | |
@@ -857,37 +857,37 @@ discard block |
||
| 857 | 857 | * |
| 858 | 858 | * @since 1.8 |
| 859 | 859 | */ |
| 860 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
| 860 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * Sanitize the value of an option by option name. |
| 864 | 864 | * |
| 865 | 865 | * @since 1.8 |
| 866 | 866 | */ |
| 867 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
| 867 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
| 868 | 868 | |
| 869 | - if ( is_null( $value ) ) { |
|
| 869 | + if (is_null($value)) { |
|
| 870 | 870 | continue; |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | // Check if option is an array and handle that differently to single values. |
| 874 | - if ( $field_option_name && $setting_name ) { |
|
| 875 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
| 876 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
| 874 | + if ($field_option_name && $setting_name) { |
|
| 875 | + if ( ! isset($update_options[$field_option_name])) { |
|
| 876 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
| 877 | 877 | } |
| 878 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
| 879 | - $update_options[ $field_option_name ] = array(); |
|
| 878 | + if ( ! is_array($update_options[$field_option_name])) { |
|
| 879 | + $update_options[$field_option_name] = array(); |
|
| 880 | 880 | } |
| 881 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
| 881 | + $update_options[$field_option_name][$setting_name] = $value; |
|
| 882 | 882 | } else { |
| 883 | - $update_options[ $field_option_name ] = $value; |
|
| 883 | + $update_options[$field_option_name] = $value; |
|
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | // Save all options in our array or there own option name i.e. option id. |
| 888 | - if ( empty( $option_name ) ) { |
|
| 889 | - foreach ( $update_options as $name => $value ) { |
|
| 890 | - update_option( $name, $value ); |
|
| 888 | + if (empty($option_name)) { |
|
| 889 | + foreach ($update_options as $name => $value) { |
|
| 890 | + update_option($name, $value); |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * Trigger action. |
@@ -896,13 +896,13 @@ discard block |
||
| 896 | 896 | * |
| 897 | 897 | * @since 1.8 |
| 898 | 898 | */ |
| 899 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
| 899 | + do_action("give_save_option_{$name}", $value, $name); |
|
| 900 | 900 | } |
| 901 | 901 | } else { |
| 902 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
| 903 | - $update_options = array_merge( $old_options, $update_options ); |
|
| 902 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
| 903 | + $update_options = array_merge($old_options, $update_options); |
|
| 904 | 904 | |
| 905 | - update_option( $option_name, $update_options ); |
|
| 905 | + update_option($option_name, $update_options); |
|
| 906 | 906 | |
| 907 | 907 | /** |
| 908 | 908 | * Trigger action. |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | * |
| 912 | 912 | * @since 1.8 |
| 913 | 913 | */ |
| 914 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
| 914 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | return true; |