@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | // Exit if accessed directly. |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @param $_banner_details |
| 27 | 27 | */ |
| 28 | - function __construct( $_banner_details ) { |
|
| 28 | + function __construct($_banner_details) { |
|
| 29 | 29 | |
| 30 | 30 | $current_user = wp_get_current_user(); |
| 31 | 31 | |
| 32 | 32 | $this->banner_details = $_banner_details; |
| 33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
| 34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
| 33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
| 34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
| 35 | 35 | |
| 36 | 36 | //Get current user |
| 37 | 37 | $this->user_id = $current_user->ID; |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | public function init() { |
| 52 | 52 | |
| 53 | 53 | //Testing? |
| 54 | - if ( $this->test_mode ) { |
|
| 55 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
| 54 | + if ($this->test_mode) { |
|
| 55 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | //Get the current page to add the notice to |
| 59 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
| 60 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
| 59 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
| 60 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | $screen = get_current_screen(); |
| 72 | 72 | |
| 73 | 73 | //Make sure we're on the plugins page. |
| 74 | - if ( $screen->parent_file !== 'plugins.php' ) { |
|
| 74 | + if ($screen->parent_file !== 'plugins.php') { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // If the user hasn't already dismissed the alert, output activation banner. |
| 79 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { |
|
| 79 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { |
|
| 80 | 80 | |
| 81 | 81 | // Output inline styles here because there's no reason |
| 82 | 82 | // to enqueued them after the alert is dismissed. |
@@ -158,43 +158,43 @@ discard block |
||
| 158 | 158 | <h3><?php |
| 159 | 159 | printf( |
| 160 | 160 | /* translators: %s: Add-on name */ |
| 161 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
| 162 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
| 161 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
| 162 | + '<span>'.$this->banner_details['name'].'</span>' |
|
| 163 | 163 | ); |
| 164 | 164 | ?></h3> |
| 165 | 165 | |
| 166 | 166 | <a href="<?php |
| 167 | 167 | //The Dismiss Button. |
| 168 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
| 169 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span |
|
| 168 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
| 169 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span |
|
| 170 | 170 | class="dashicons dashicons-dismiss"></span></a> |
| 171 | 171 | |
| 172 | 172 | <div class="alert-actions"> |
| 173 | 173 | |
| 174 | 174 | <?php //Point them to your settings page. |
| 175 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
| 175 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
| 176 | 176 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
| 177 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?></a> |
|
| 177 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?></a> |
|
| 178 | 178 | <?php } ?> |
| 179 | 179 | |
| 180 | 180 | <?php |
| 181 | 181 | // Show them how to configure the Addon. |
| 182 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
| 182 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
| 183 | 183 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
| 184 | 184 | <span class="dashicons dashicons-media-text"></span><?php |
| 185 | 185 | printf( |
| 186 | 186 | /* translators: %s: Add-on name */ |
| 187 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
| 187 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
| 188 | 188 | $this->banner_details['name'] |
| 189 | 189 | ); |
| 190 | 190 | ?></a> |
| 191 | 191 | <?php } ?> |
| 192 | 192 | <?php |
| 193 | 193 | //Let them signup for plugin updates |
| 194 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
| 194 | + if (isset($this->banner_details['support_url'])) { ?> |
|
| 195 | 195 | |
| 196 | 196 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
| 197 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
| 197 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
| 198 | 198 | </a> |
| 199 | 199 | |
| 200 | 200 | <?php } ?> |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
| 222 | 222 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
| 223 | 223 | */ |
| 224 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
| 224 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
| 225 | 225 | |
| 226 | 226 | //Get the global user |
| 227 | 227 | $current_user = wp_get_current_user(); |
| 228 | 228 | $user_id = $current_user->ID; |
| 229 | 229 | |
| 230 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
| 230 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -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 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @since 1.0 |
| 32 | 32 | */ |
| 33 | - do_action( 'give_pre_process_donation' ); |
|
| 33 | + do_action('give_pre_process_donation'); |
|
| 34 | 34 | |
| 35 | 35 | // Validate the form $_POST data |
| 36 | 36 | $valid_data = give_purchase_form_validate_fields(); |
@@ -45,26 +45,26 @@ discard block |
||
| 45 | 45 | * @param bool|array $valid_data Validate fields. |
| 46 | 46 | * @param array $_POST Array of variables passed via the HTTP POST. |
| 47 | 47 | */ |
| 48 | - do_action( 'give_checkout_error_checks', $valid_data, $_POST ); |
|
| 48 | + do_action('give_checkout_error_checks', $valid_data, $_POST); |
|
| 49 | 49 | |
| 50 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
| 50 | + $is_ajax = isset($_POST['give_ajax']); |
|
| 51 | 51 | |
| 52 | 52 | // Process the login form |
| 53 | - if ( isset( $_POST['give_login_submit'] ) ) { |
|
| 53 | + if (isset($_POST['give_login_submit'])) { |
|
| 54 | 54 | give_process_form_login(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Validate the user |
| 58 | - $user = give_get_purchase_form_user( $valid_data ); |
|
| 58 | + $user = give_get_purchase_form_user($valid_data); |
|
| 59 | 59 | |
| 60 | - if ( false === $valid_data || give_get_errors() || ! $user ) { |
|
| 61 | - if ( $is_ajax ) { |
|
| 60 | + if (false === $valid_data || give_get_errors() || ! $user) { |
|
| 61 | + if ($is_ajax) { |
|
| 62 | 62 | /** |
| 63 | 63 | * Fires when AJAX sends back errors from the donation form. |
| 64 | 64 | * |
| 65 | 65 | * @since 1.0 |
| 66 | 66 | */ |
| 67 | - do_action( 'give_ajax_donation_errors' ); |
|
| 67 | + do_action('give_ajax_donation_errors'); |
|
| 68 | 68 | give_die(); |
| 69 | 69 | } else { |
| 70 | 70 | return false; |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // If AJAX send back success to proceed with form submission |
| 75 | - if ( $is_ajax ) { |
|
| 75 | + if ($is_ajax) { |
|
| 76 | 76 | echo 'success'; |
| 77 | 77 | give_die(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // After AJAX: Setup session if not using php_sessions |
| 81 | - if ( ! Give()->session->use_php_sessions() ) { |
|
| 81 | + if ( ! Give()->session->use_php_sessions()) { |
|
| 82 | 82 | // Double-check that set_cookie is publicly accessible; |
| 83 | 83 | // we're using a slightly modified class-wp-sessions.php |
| 84 | - $session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' ); |
|
| 85 | - if ( $session_reflection->isPublic() ) { |
|
| 84 | + $session_reflection = new ReflectionMethod('WP_Session', 'set_cookie'); |
|
| 85 | + if ($session_reflection->isPublic()) { |
|
| 86 | 86 | // Manually set the cookie. |
| 87 | 87 | Give()->session->init()->set_cookie(); |
| 88 | 88 | } |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | 'address' => $user['address'], |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
| 100 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
| 101 | 101 | |
| 102 | - $price = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00'; |
|
| 103 | - $purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); |
|
| 102 | + $price = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00'; |
|
| 103 | + $purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); |
|
| 104 | 104 | |
| 105 | 105 | // Setup donation information |
| 106 | 106 | $purchase_data = array( |
| 107 | 107 | 'price' => $price, |
| 108 | 108 | 'purchase_key' => $purchase_key, |
| 109 | 109 | 'user_email' => $user['user_email'], |
| 110 | - 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
|
| 111 | - 'user_info' => stripslashes_deep( $user_info ), |
|
| 110 | + 'date' => date('Y-m-d H:i:s', current_time('timestamp')), |
|
| 111 | + 'user_info' => stripslashes_deep($user_info), |
|
| 112 | 112 | 'post_data' => $_POST, |
| 113 | 113 | 'gateway' => $valid_data['gateway'], |
| 114 | 114 | 'card_info' => $valid_data['cc_info'], |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | * @param array $user_info Array containing basic user information. |
| 129 | 129 | * @param bool|array $valid_data Validate fields. |
| 130 | 130 | */ |
| 131 | - do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data ); |
|
| 131 | + do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data); |
|
| 132 | 132 | |
| 133 | 133 | // Sanity check for price |
| 134 | - if ( ! $purchase_data['price'] ) { |
|
| 134 | + if ( ! $purchase_data['price']) { |
|
| 135 | 135 | // Revert to manual |
| 136 | 136 | $purchase_data['gateway'] = 'manual'; |
| 137 | 137 | $_POST['give-gateway'] = 'manual'; |
@@ -142,27 +142,27 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @since 1.7 |
| 144 | 144 | */ |
| 145 | - $purchase_data = apply_filters( 'give_donation_data_before_gateway', $purchase_data, $valid_data ); |
|
| 145 | + $purchase_data = apply_filters('give_donation_data_before_gateway', $purchase_data, $valid_data); |
|
| 146 | 146 | |
| 147 | 147 | // Setup the data we're storing in the donation session |
| 148 | 148 | $session_data = $purchase_data; |
| 149 | 149 | |
| 150 | 150 | // Make sure credit card numbers are never stored in sessions |
| 151 | - unset( $session_data['card_info']['card_number'] ); |
|
| 152 | - unset( $session_data['post_data']['card_number'] ); |
|
| 151 | + unset($session_data['card_info']['card_number']); |
|
| 152 | + unset($session_data['post_data']['card_number']); |
|
| 153 | 153 | |
| 154 | 154 | // Used for showing data to non logged-in users after donation, and for other plugins needing donation data. |
| 155 | - give_set_purchase_session( $session_data ); |
|
| 155 | + give_set_purchase_session($session_data); |
|
| 156 | 156 | |
| 157 | 157 | // Send info to the gateway for payment processing |
| 158 | - give_send_to_gateway( $purchase_data['gateway'], $purchase_data ); |
|
| 158 | + give_send_to_gateway($purchase_data['gateway'], $purchase_data); |
|
| 159 | 159 | give_die(); |
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | -add_action( 'give_purchase', 'give_process_purchase_form' ); |
|
| 164 | -add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' ); |
|
| 165 | -add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' ); |
|
| 163 | +add_action('give_purchase', 'give_process_purchase_form'); |
|
| 164 | +add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form'); |
|
| 165 | +add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form'); |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -175,26 +175,26 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return void |
| 177 | 177 | */ |
| 178 | -function give_checkout_check_existing_email( $valid_data, $post ) { |
|
| 178 | +function give_checkout_check_existing_email($valid_data, $post) { |
|
| 179 | 179 | |
| 180 | 180 | // Verify that the email address belongs to this customer |
| 181 | - if ( is_user_logged_in() ) { |
|
| 181 | + if (is_user_logged_in()) { |
|
| 182 | 182 | |
| 183 | 183 | $email = $valid_data['logged_in_user']['user_email']; |
| 184 | - $customer = new Give_Customer( get_current_user_id(), true ); |
|
| 184 | + $customer = new Give_Customer(get_current_user_id(), true); |
|
| 185 | 185 | |
| 186 | 186 | // If this email address is not registered with this customer, see if it belongs to any other customer |
| 187 | - if ( $email !== $customer->email && ( is_array( $customer->emails ) && ! in_array( $email, $customer->emails ) ) ) { |
|
| 188 | - $found_customer = new Give_Customer( $email ); |
|
| 187 | + if ($email !== $customer->email && (is_array($customer->emails) && ! in_array($email, $customer->emails))) { |
|
| 188 | + $found_customer = new Give_Customer($email); |
|
| 189 | 189 | |
| 190 | - if ( $found_customer->id > 0 ) { |
|
| 191 | - give_set_error( 'give-customer-email-exists', sprintf( esc_html__( 'The email address %s is already in use.', 'give' ), $email ) ); |
|
| 190 | + if ($found_customer->id > 0) { |
|
| 191 | + give_set_error('give-customer-email-exists', sprintf(esc_html__('The email address %s is already in use.', 'give'), $email)); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | -add_action( 'give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2 ); |
|
| 197 | +add_action('give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2); |
|
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * Process the checkout login form |
@@ -205,37 +205,37 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | function give_process_form_login() { |
| 207 | 207 | |
| 208 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
| 208 | + $is_ajax = isset($_POST['give_ajax']); |
|
| 209 | 209 | |
| 210 | 210 | $user_data = give_purchase_form_validate_user_login(); |
| 211 | 211 | |
| 212 | - if ( give_get_errors() || $user_data['user_id'] < 1 ) { |
|
| 213 | - if ( $is_ajax ) { |
|
| 212 | + if (give_get_errors() || $user_data['user_id'] < 1) { |
|
| 213 | + if ($is_ajax) { |
|
| 214 | 214 | /** |
| 215 | 215 | * Fires when AJAX sends back errors from the donation form. |
| 216 | 216 | * |
| 217 | 217 | * @since 1.0 |
| 218 | 218 | */ |
| 219 | - do_action( 'give_ajax_donation_errors' ); |
|
| 219 | + do_action('give_ajax_donation_errors'); |
|
| 220 | 220 | give_die(); |
| 221 | 221 | } else { |
| 222 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
| 222 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 223 | 223 | exit; |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] ); |
|
| 227 | + give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']); |
|
| 228 | 228 | |
| 229 | - if ( $is_ajax ) { |
|
| 229 | + if ($is_ajax) { |
|
| 230 | 230 | echo 'success'; |
| 231 | 231 | give_die(); |
| 232 | 232 | } else { |
| 233 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
| 233 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' ); |
|
| 238 | -add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' ); |
|
| 237 | +add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login'); |
|
| 238 | +add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login'); |
|
| 239 | 239 | |
| 240 | 240 | /** |
| 241 | 241 | * Donation Form Validate Fields |
@@ -247,45 +247,45 @@ discard block |
||
| 247 | 247 | function give_purchase_form_validate_fields() { |
| 248 | 248 | |
| 249 | 249 | // Check if there is $_POST |
| 250 | - if ( empty( $_POST ) ) { |
|
| 250 | + if (empty($_POST)) { |
|
| 251 | 251 | return false; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 254 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 255 | 255 | |
| 256 | 256 | // Start an array to collect valid data |
| 257 | 257 | $valid_data = array( |
| 258 | 258 | 'gateway' => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here) |
| 259 | - 'need_new_user' => false, // New user flag |
|
| 260 | - 'need_user_login' => false, // Login user flag |
|
| 261 | - 'logged_user_data' => array(), // Logged user collected data |
|
| 262 | - 'new_user_data' => array(), // New user collected data |
|
| 263 | - 'login_user_data' => array(), // Login user collected data |
|
| 264 | - 'guest_user_data' => array(), // Guest user collected data |
|
| 265 | - 'cc_info' => give_purchase_form_validate_cc(),// Credit card info |
|
| 259 | + 'need_new_user' => false, // New user flag |
|
| 260 | + 'need_user_login' => false, // Login user flag |
|
| 261 | + 'logged_user_data' => array(), // Logged user collected data |
|
| 262 | + 'new_user_data' => array(), // New user collected data |
|
| 263 | + 'login_user_data' => array(), // Login user collected data |
|
| 264 | + 'guest_user_data' => array(), // Guest user collected data |
|
| 265 | + 'cc_info' => give_purchase_form_validate_cc(), // Credit card info |
|
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | 268 | // Validate Honeypot First |
| 269 | - if ( ! empty( $_POST['give-honeypot'] ) ) { |
|
| 270 | - give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) ); |
|
| 269 | + if ( ! empty($_POST['give-honeypot'])) { |
|
| 270 | + give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give')); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Validate agree to terms |
| 274 | - $terms_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 275 | - if ( isset( $terms_option ) && $terms_option === 'yes' ) { |
|
| 274 | + $terms_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 275 | + if (isset($terms_option) && $terms_option === 'yes') { |
|
| 276 | 276 | give_purchase_form_validate_agree_to_terms(); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - if ( is_user_logged_in() ) { |
|
| 279 | + if (is_user_logged_in()) { |
|
| 280 | 280 | // Collect logged in user data |
| 281 | 281 | $valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user(); |
| 282 | - } elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) { |
|
| 282 | + } elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') { |
|
| 283 | 283 | // Set new user registration as required |
| 284 | 284 | $valid_data['need_new_user'] = true; |
| 285 | 285 | // Validate new user data |
| 286 | 286 | $valid_data['new_user_data'] = give_purchase_form_validate_new_user(); |
| 287 | 287 | // Check if login validation is needed |
| 288 | - } elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) { |
|
| 288 | + } elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') { |
|
| 289 | 289 | // Set user login as required |
| 290 | 290 | $valid_data['need_user_login'] = true; |
| 291 | 291 | // Validate users login info |
@@ -310,40 +310,40 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | function give_purchase_form_validate_gateway() { |
| 312 | 312 | |
| 313 | - $form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0; |
|
| 314 | - $amount = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0; |
|
| 315 | - $gateway = give_get_default_gateway( $form_id ); |
|
| 313 | + $form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0; |
|
| 314 | + $amount = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0; |
|
| 315 | + $gateway = give_get_default_gateway($form_id); |
|
| 316 | 316 | |
| 317 | 317 | // Check if a gateway value is present |
| 318 | - if ( ! empty( $_REQUEST['give-gateway'] ) ) { |
|
| 318 | + if ( ! empty($_REQUEST['give-gateway'])) { |
|
| 319 | 319 | |
| 320 | - $gateway = sanitize_text_field( $_REQUEST['give-gateway'] ); |
|
| 320 | + $gateway = sanitize_text_field($_REQUEST['give-gateway']); |
|
| 321 | 321 | |
| 322 | 322 | // Is amount being donated in LIVE mode 0.00? If so, error: |
| 323 | - if ( $amount == 0 && ! give_is_test_mode() ) { |
|
| 323 | + if ($amount == 0 && ! give_is_test_mode()) { |
|
| 324 | 324 | |
| 325 | - give_set_error( 'invalid_donation_amount', esc_html__( 'Please insert a valid donation amount.', 'give' ) ); |
|
| 325 | + give_set_error('invalid_donation_amount', esc_html__('Please insert a valid donation amount.', 'give')); |
|
| 326 | 326 | |
| 327 | 327 | } //Check for a minimum custom amount |
| 328 | - elseif ( ! give_verify_minimum_price() ) { |
|
| 328 | + elseif ( ! give_verify_minimum_price()) { |
|
| 329 | 329 | // translators: %s: minimum donation amount. |
| 330 | 330 | give_set_error( |
| 331 | 331 | 'invalid_donation_minimum', |
| 332 | 332 | sprintf( |
| 333 | - esc_html__( 'This form has a minimum donation amount of %s.', 'give' ), |
|
| 334 | - give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) ) |
|
| 333 | + esc_html__('This form has a minimum donation amount of %s.', 'give'), |
|
| 334 | + give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id))) |
|
| 335 | 335 | ) |
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | 338 | } //Is this test mode zero donation? Let it through but set to manual gateway. |
| 339 | - elseif ( $amount == 0 && give_is_test_mode() ) { |
|
| 339 | + elseif ($amount == 0 && give_is_test_mode()) { |
|
| 340 | 340 | |
| 341 | 341 | $gateway = 'manual'; |
| 342 | 342 | |
| 343 | 343 | } //Check if this gateway is active. |
| 344 | - elseif ( ! give_is_gateway_active( $gateway ) ) { |
|
| 344 | + elseif ( ! give_is_gateway_active($gateway)) { |
|
| 345 | 345 | |
| 346 | - give_set_error( 'invalid_gateway', esc_html__( 'The selected payment gateway is not enabled.', 'give' ) ); |
|
| 346 | + give_set_error('invalid_gateway', esc_html__('The selected payment gateway is not enabled.', 'give')); |
|
| 347 | 347 | |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -361,23 +361,23 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | function give_verify_minimum_price() { |
| 363 | 363 | |
| 364 | - $amount = give_sanitize_amount( $_REQUEST['give-amount'] ); |
|
| 365 | - $form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0; |
|
| 366 | - $price_id = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0; |
|
| 367 | - $variable_prices = give_has_variable_prices( $form_id ); |
|
| 364 | + $amount = give_sanitize_amount($_REQUEST['give-amount']); |
|
| 365 | + $form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0; |
|
| 366 | + $price_id = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0; |
|
| 367 | + $variable_prices = give_has_variable_prices($form_id); |
|
| 368 | 368 | |
| 369 | - if ( $variable_prices && ! empty( $price_id ) ) { |
|
| 369 | + if ($variable_prices && ! empty($price_id)) { |
|
| 370 | 370 | |
| 371 | - $price_level_amount = give_get_price_option_amount( $form_id, $price_id ); |
|
| 371 | + $price_level_amount = give_get_price_option_amount($form_id, $price_id); |
|
| 372 | 372 | |
| 373 | - if ( $price_level_amount == $amount ) { |
|
| 373 | + if ($price_level_amount == $amount) { |
|
| 374 | 374 | return true; |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - $minimum = give_get_form_minimum_price( $form_id ); |
|
| 378 | + $minimum = give_get_form_minimum_price($form_id); |
|
| 379 | 379 | |
| 380 | - if ( $minimum > $amount ) { |
|
| 380 | + if ($minimum > $amount) { |
|
| 381 | 381 | return false; |
| 382 | 382 | } |
| 383 | 383 | |
@@ -393,9 +393,9 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | function give_purchase_form_validate_agree_to_terms() { |
| 395 | 395 | // Validate agree to terms. |
| 396 | - if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) { |
|
| 396 | + if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) { |
|
| 397 | 397 | // User did not agree. |
| 398 | - give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', esc_html__( 'You must agree to the terms of use.', 'give' ) ) ); |
|
| 398 | + give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', esc_html__('You must agree to the terms of use.', 'give'))); |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
@@ -409,43 +409,43 @@ discard block |
||
| 409 | 409 | * |
| 410 | 410 | * @return array |
| 411 | 411 | */ |
| 412 | -function give_purchase_form_required_fields( $form_id ) { |
|
| 412 | +function give_purchase_form_required_fields($form_id) { |
|
| 413 | 413 | |
| 414 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 414 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 415 | 415 | |
| 416 | 416 | $required_fields = array( |
| 417 | 417 | 'give_email' => array( |
| 418 | 418 | 'error_id' => 'invalid_email', |
| 419 | - 'error_message' => esc_html__( 'Please enter a valid email address.', 'give' ), |
|
| 419 | + 'error_message' => esc_html__('Please enter a valid email address.', 'give'), |
|
| 420 | 420 | ), |
| 421 | 421 | 'give_first' => array( |
| 422 | 422 | 'error_id' => 'invalid_first_name', |
| 423 | - 'error_message' => esc_html__( 'Please enter your first name.', 'give' ), |
|
| 423 | + 'error_message' => esc_html__('Please enter your first name.', 'give'), |
|
| 424 | 424 | ), |
| 425 | 425 | ); |
| 426 | 426 | |
| 427 | - $require_address = give_require_billing_address( $payment_mode ); |
|
| 427 | + $require_address = give_require_billing_address($payment_mode); |
|
| 428 | 428 | |
| 429 | - if ( $require_address ) { |
|
| 430 | - $required_fields['card_address'] = array( |
|
| 429 | + if ($require_address) { |
|
| 430 | + $required_fields['card_address'] = array( |
|
| 431 | 431 | 'error_id' => 'invalid_card_address', |
| 432 | - 'error_message' => esc_html__( 'Please enter your primary billing address.', 'give' ), |
|
| 432 | + 'error_message' => esc_html__('Please enter your primary billing address.', 'give'), |
|
| 433 | 433 | ); |
| 434 | - $required_fields['card_zip'] = array( |
|
| 434 | + $required_fields['card_zip'] = array( |
|
| 435 | 435 | 'error_id' => 'invalid_zip_code', |
| 436 | - 'error_message' => esc_html__( 'Please enter your zip / postal code.', 'give' ), |
|
| 436 | + 'error_message' => esc_html__('Please enter your zip / postal code.', 'give'), |
|
| 437 | 437 | ); |
| 438 | - $required_fields['card_city'] = array( |
|
| 438 | + $required_fields['card_city'] = array( |
|
| 439 | 439 | 'error_id' => 'invalid_city', |
| 440 | - 'error_message' => esc_html__( 'Please enter your billing city.', 'give' ), |
|
| 440 | + 'error_message' => esc_html__('Please enter your billing city.', 'give'), |
|
| 441 | 441 | ); |
| 442 | 442 | $required_fields['billing_country'] = array( |
| 443 | 443 | 'error_id' => 'invalid_country', |
| 444 | - 'error_message' => esc_html__( 'Please select your billing country.', 'give' ), |
|
| 444 | + 'error_message' => esc_html__('Please select your billing country.', 'give'), |
|
| 445 | 445 | ); |
| 446 | - $required_fields['card_state'] = array( |
|
| 446 | + $required_fields['card_state'] = array( |
|
| 447 | 447 | 'error_id' => 'invalid_state', |
| 448 | - 'error_message' => esc_html__( 'Please enter billing state / province.', 'give' ), |
|
| 448 | + 'error_message' => esc_html__('Please enter billing state / province.', 'give'), |
|
| 449 | 449 | ); |
| 450 | 450 | } |
| 451 | 451 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * |
| 455 | 455 | * @since 1.7 |
| 456 | 456 | */ |
| 457 | - $required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id ); |
|
| 457 | + $required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id); |
|
| 458 | 458 | |
| 459 | 459 | return $required_fields; |
| 460 | 460 | |
@@ -469,16 +469,16 @@ discard block |
||
| 469 | 469 | * |
| 470 | 470 | * @return mixed|void |
| 471 | 471 | */ |
| 472 | -function give_require_billing_address( $payment_mode ) { |
|
| 472 | +function give_require_billing_address($payment_mode) { |
|
| 473 | 473 | |
| 474 | 474 | $return = false; |
| 475 | 475 | |
| 476 | - if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) { |
|
| 476 | + if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) { |
|
| 477 | 477 | $return = true; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | // Let payment gateways and other extensions determine if address fields should be required. |
| 481 | - return apply_filters( 'give_require_billing_address', $return ); |
|
| 481 | + return apply_filters('give_require_billing_address', $return); |
|
| 482 | 482 | |
| 483 | 483 | } |
| 484 | 484 | |
@@ -492,42 +492,42 @@ discard block |
||
| 492 | 492 | function give_purchase_form_validate_logged_in_user() { |
| 493 | 493 | global $user_ID; |
| 494 | 494 | |
| 495 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 495 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 496 | 496 | |
| 497 | 497 | // Start empty array to collect valid user data. |
| 498 | 498 | $valid_user_data = array( |
| 499 | 499 | // Assume there will be errors. |
| 500 | - 'user_id' => - 1, |
|
| 500 | + 'user_id' => -1, |
|
| 501 | 501 | ); |
| 502 | 502 | |
| 503 | 503 | // Verify there is a user_ID. |
| 504 | - if ( $user_ID > 0 ) { |
|
| 504 | + if ($user_ID > 0) { |
|
| 505 | 505 | // Get the logged in user data. |
| 506 | - $user_data = get_userdata( $user_ID ); |
|
| 506 | + $user_data = get_userdata($user_ID); |
|
| 507 | 507 | |
| 508 | 508 | // Loop through required fields and show error messages. |
| 509 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
| 510 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
| 511 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
| 509 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
| 510 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
| 511 | + give_set_error($value['error_id'], $value['error_message']); |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | // Verify data. |
| 516 | - if ( $user_data ) { |
|
| 516 | + if ($user_data) { |
|
| 517 | 517 | // Collected logged in user data. |
| 518 | 518 | $valid_user_data = array( |
| 519 | 519 | 'user_id' => $user_ID, |
| 520 | - 'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email, |
|
| 521 | - 'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name, |
|
| 522 | - 'user_last' => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name, |
|
| 520 | + 'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email, |
|
| 521 | + 'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name, |
|
| 522 | + 'user_last' => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name, |
|
| 523 | 523 | ); |
| 524 | 524 | |
| 525 | - if ( ! is_email( $valid_user_data['user_email'] ) ) { |
|
| 526 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
| 525 | + if ( ! is_email($valid_user_data['user_email'])) { |
|
| 526 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
| 527 | 527 | } |
| 528 | 528 | } else { |
| 529 | 529 | // Set invalid user error. |
| 530 | - give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) ); |
|
| 530 | + give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give')); |
|
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | |
@@ -545,90 +545,90 @@ discard block |
||
| 545 | 545 | function give_purchase_form_validate_new_user() { |
| 546 | 546 | |
| 547 | 547 | $registering_new_user = false; |
| 548 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 548 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 549 | 549 | |
| 550 | 550 | // Start an empty array to collect valid user data. |
| 551 | 551 | $valid_user_data = array( |
| 552 | 552 | // Assume there will be errors. |
| 553 | - 'user_id' => - 1, |
|
| 553 | + 'user_id' => -1, |
|
| 554 | 554 | // Get first name. |
| 555 | - 'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '', |
|
| 555 | + 'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '', |
|
| 556 | 556 | // Get last name. |
| 557 | - 'user_last' => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '', |
|
| 557 | + 'user_last' => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '', |
|
| 558 | 558 | ); |
| 559 | 559 | |
| 560 | 560 | // Check the new user's credentials against existing ones. |
| 561 | - $user_login = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false; |
|
| 562 | - $user_email = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false; |
|
| 563 | - $user_pass = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false; |
|
| 564 | - $pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false; |
|
| 561 | + $user_login = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false; |
|
| 562 | + $user_email = isset($_POST['give_email']) ? trim($_POST['give_email']) : false; |
|
| 563 | + $user_pass = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false; |
|
| 564 | + $pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false; |
|
| 565 | 565 | |
| 566 | 566 | // Loop through required fields and show error messages. |
| 567 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
| 568 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
| 569 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
| 567 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
| 568 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
| 569 | + give_set_error($value['error_id'], $value['error_message']); |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | // Check if we have an username to register. |
| 574 | - if ( $user_login && strlen( $user_login ) > 0 ) { |
|
| 574 | + if ($user_login && strlen($user_login) > 0) { |
|
| 575 | 575 | $registering_new_user = true; |
| 576 | 576 | |
| 577 | 577 | // We have an user name, check if it already exists. |
| 578 | - if ( username_exists( $user_login ) ) { |
|
| 578 | + if (username_exists($user_login)) { |
|
| 579 | 579 | // Username already registered. |
| 580 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
| 580 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
| 581 | 581 | // Check if it's valid. |
| 582 | - } elseif ( ! give_validate_username( $user_login ) ) { |
|
| 582 | + } elseif ( ! give_validate_username($user_login)) { |
|
| 583 | 583 | // Invalid username. |
| 584 | - if ( is_multisite() ) { |
|
| 585 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
| 584 | + if (is_multisite()) { |
|
| 585 | + give_set_error('username_invalid', esc_html__('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
| 586 | 586 | } else { |
| 587 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 587 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
| 588 | 588 | } |
| 589 | 589 | } else { |
| 590 | 590 | // All the checks have run and it's good to go. |
| 591 | 591 | $valid_user_data['user_login'] = $user_login; |
| 592 | 592 | } |
| 593 | - } elseif ( give_logged_in_only( $form_id ) ) { |
|
| 594 | - give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation.', 'give' ) ); |
|
| 593 | + } elseif (give_logged_in_only($form_id)) { |
|
| 594 | + give_set_error('registration_required', esc_html__('You must register or login to complete your donation.', 'give')); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | // Check if we have an email to verify. |
| 598 | - if ( $user_email && strlen( $user_email ) > 0 ) { |
|
| 598 | + if ($user_email && strlen($user_email) > 0) { |
|
| 599 | 599 | // Validate email. |
| 600 | - if ( ! is_email( $user_email ) ) { |
|
| 601 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
| 600 | + if ( ! is_email($user_email)) { |
|
| 601 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
| 602 | 602 | // Check if email exists. |
| 603 | - } elseif ( email_exists( $user_email ) && $registering_new_user ) { |
|
| 604 | - give_set_error( 'email_used', esc_html__( 'The email already active for another user.', 'give' ) ); |
|
| 603 | + } elseif (email_exists($user_email) && $registering_new_user) { |
|
| 604 | + give_set_error('email_used', esc_html__('The email already active for another user.', 'give')); |
|
| 605 | 605 | } else { |
| 606 | 606 | // All the checks have run and it's good to go. |
| 607 | 607 | $valid_user_data['user_email'] = $user_email; |
| 608 | 608 | } |
| 609 | 609 | } else { |
| 610 | 610 | // No email. |
| 611 | - give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) ); |
|
| 611 | + give_set_error('email_empty', esc_html__('Enter an email.', 'give')); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | // Check password. |
| 615 | - if ( $user_pass && $pass_confirm ) { |
|
| 615 | + if ($user_pass && $pass_confirm) { |
|
| 616 | 616 | // Verify confirmation matches. |
| 617 | - if ( $user_pass != $pass_confirm ) { |
|
| 617 | + if ($user_pass != $pass_confirm) { |
|
| 618 | 618 | // Passwords do not match |
| 619 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
| 619 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
| 620 | 620 | } else { |
| 621 | 621 | // All is good to go. |
| 622 | 622 | $valid_user_data['user_pass'] = $user_pass; |
| 623 | 623 | } |
| 624 | 624 | } else { |
| 625 | 625 | // Password or confirmation missing. |
| 626 | - if ( ! $user_pass && $registering_new_user ) { |
|
| 626 | + if ( ! $user_pass && $registering_new_user) { |
|
| 627 | 627 | // The password is invalid. |
| 628 | - give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) ); |
|
| 629 | - } elseif ( ! $pass_confirm && $registering_new_user ) { |
|
| 628 | + give_set_error('password_empty', esc_html__('Enter a password.', 'give')); |
|
| 629 | + } elseif ( ! $pass_confirm && $registering_new_user) { |
|
| 630 | 630 | // Confirmation password is invalid. |
| 631 | - give_set_error( 'confirmation_empty', esc_html__( 'Enter the password confirmation.', 'give' ) ); |
|
| 631 | + give_set_error('confirmation_empty', esc_html__('Enter the password confirmation.', 'give')); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
@@ -647,36 +647,36 @@ discard block |
||
| 647 | 647 | // Start an array to collect valid user data. |
| 648 | 648 | $valid_user_data = array( |
| 649 | 649 | // Assume there will be errors |
| 650 | - 'user_id' => - 1, |
|
| 650 | + 'user_id' => -1, |
|
| 651 | 651 | ); |
| 652 | 652 | |
| 653 | 653 | // Username. |
| 654 | - if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) { |
|
| 655 | - give_set_error( 'must_log_in', esc_html__( 'You must register or login to complete your donation.', 'give' ) ); |
|
| 654 | + if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') { |
|
| 655 | + give_set_error('must_log_in', esc_html__('You must register or login to complete your donation.', 'give')); |
|
| 656 | 656 | |
| 657 | 657 | return $valid_user_data; |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | // Get the user by login. |
| 661 | - $user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) ); |
|
| 661 | + $user_data = get_user_by('login', strip_tags($_POST['give_user_login'])); |
|
| 662 | 662 | |
| 663 | 663 | // Check if user exists. |
| 664 | - if ( $user_data ) { |
|
| 664 | + if ($user_data) { |
|
| 665 | 665 | // Get password. |
| 666 | - $user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false; |
|
| 666 | + $user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false; |
|
| 667 | 667 | |
| 668 | 668 | // Check user_pass. |
| 669 | - if ( $user_pass ) { |
|
| 669 | + if ($user_pass) { |
|
| 670 | 670 | // Check if password is valid. |
| 671 | - if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) { |
|
| 671 | + if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) { |
|
| 672 | 672 | // Incorrect password. |
| 673 | 673 | give_set_error( |
| 674 | 674 | 'password_incorrect', |
| 675 | 675 | sprintf( |
| 676 | 676 | '%1$s <a href="%2$s">%3$s</a>', |
| 677 | - esc_html__( 'The password you entered is incorrect.', 'give' ), |
|
| 678 | - wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ), |
|
| 679 | - esc_html__( 'Reset Password', 'give' ) |
|
| 677 | + esc_html__('The password you entered is incorrect.', 'give'), |
|
| 678 | + wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"), |
|
| 679 | + esc_html__('Reset Password', 'give') |
|
| 680 | 680 | ) |
| 681 | 681 | ); |
| 682 | 682 | // All is correct. |
@@ -693,11 +693,11 @@ discard block |
||
| 693 | 693 | } |
| 694 | 694 | } else { |
| 695 | 695 | // Empty password. |
| 696 | - give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) ); |
|
| 696 | + give_set_error('password_empty', esc_html__('Enter a password.', 'give')); |
|
| 697 | 697 | } |
| 698 | 698 | } else { |
| 699 | 699 | // No username. |
| 700 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
| 700 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | return $valid_user_data; |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | */ |
| 713 | 713 | function give_purchase_form_validate_guest_user() { |
| 714 | 714 | |
| 715 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 715 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 716 | 716 | |
| 717 | 717 | // Start an array to collect valid user data. |
| 718 | 718 | $valid_user_data = array( |
@@ -721,38 +721,38 @@ discard block |
||
| 721 | 721 | ); |
| 722 | 722 | |
| 723 | 723 | // Show error message if user must be logged in. |
| 724 | - if ( give_logged_in_only( $form_id ) ) { |
|
| 725 | - give_set_error( 'logged_in_only', esc_html__( 'You must be logged in to donate.', 'give' ) ); |
|
| 724 | + if (give_logged_in_only($form_id)) { |
|
| 725 | + give_set_error('logged_in_only', esc_html__('You must be logged in to donate.', 'give')); |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | // Get the guest email. |
| 729 | - $guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
| 729 | + $guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
| 730 | 730 | |
| 731 | 731 | // Check email. |
| 732 | - if ( $guest_email && strlen( $guest_email ) > 0 ) { |
|
| 732 | + if ($guest_email && strlen($guest_email) > 0) { |
|
| 733 | 733 | // Validate email. |
| 734 | - if ( ! is_email( $guest_email ) ) { |
|
| 734 | + if ( ! is_email($guest_email)) { |
|
| 735 | 735 | // Invalid email. |
| 736 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
| 736 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
| 737 | 737 | } else { |
| 738 | 738 | // All is good to go. |
| 739 | 739 | $valid_user_data['user_email'] = $guest_email; |
| 740 | 740 | |
| 741 | 741 | // Get user_id from donor if exist. |
| 742 | - $donor = new Give_Customer( $guest_email ); |
|
| 743 | - if ( $donor->id && $donor->user_id ) { |
|
| 742 | + $donor = new Give_Customer($guest_email); |
|
| 743 | + if ($donor->id && $donor->user_id) { |
|
| 744 | 744 | $valid_user_data['user_id'] = $donor->user_id; |
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | 747 | } else { |
| 748 | 748 | // No email. |
| 749 | - give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) ); |
|
| 749 | + give_set_error('email_empty', esc_html__('Enter an email.', 'give')); |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // Loop through required fields and show error messages. |
| 753 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
| 754 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
| 755 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
| 753 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
| 754 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
| 755 | + give_set_error($value['error_id'], $value['error_message']); |
|
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | 758 | |
@@ -768,36 +768,36 @@ discard block |
||
| 768 | 768 | * @since 1.0 |
| 769 | 769 | * @return integer |
| 770 | 770 | */ |
| 771 | -function give_register_and_login_new_user( $user_data = array() ) { |
|
| 771 | +function give_register_and_login_new_user($user_data = array()) { |
|
| 772 | 772 | // Verify the array. |
| 773 | - if ( empty( $user_data ) ) { |
|
| 774 | - return - 1; |
|
| 773 | + if (empty($user_data)) { |
|
| 774 | + return -1; |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | - if ( give_get_errors() ) { |
|
| 778 | - return - 1; |
|
| 777 | + if (give_get_errors()) { |
|
| 778 | + return -1; |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - $user_args = apply_filters( 'give_insert_user_args', array( |
|
| 782 | - 'user_login' => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '', |
|
| 783 | - 'user_pass' => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '', |
|
| 784 | - 'user_email' => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '', |
|
| 785 | - 'first_name' => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '', |
|
| 786 | - 'last_name' => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '', |
|
| 787 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
| 788 | - 'role' => get_option( 'default_role' ), |
|
| 789 | - ), $user_data ); |
|
| 781 | + $user_args = apply_filters('give_insert_user_args', array( |
|
| 782 | + 'user_login' => isset($user_data['user_login']) ? $user_data['user_login'] : '', |
|
| 783 | + 'user_pass' => isset($user_data['user_pass']) ? $user_data['user_pass'] : '', |
|
| 784 | + 'user_email' => isset($user_data['user_email']) ? $user_data['user_email'] : '', |
|
| 785 | + 'first_name' => isset($user_data['user_first']) ? $user_data['user_first'] : '', |
|
| 786 | + 'last_name' => isset($user_data['user_last']) ? $user_data['user_last'] : '', |
|
| 787 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
| 788 | + 'role' => get_option('default_role'), |
|
| 789 | + ), $user_data); |
|
| 790 | 790 | |
| 791 | 791 | // Insert new user. |
| 792 | - $user_id = wp_insert_user( $user_args ); |
|
| 792 | + $user_id = wp_insert_user($user_args); |
|
| 793 | 793 | |
| 794 | 794 | // Validate inserted user. |
| 795 | - if ( is_wp_error( $user_id ) ) { |
|
| 796 | - return - 1; |
|
| 795 | + if (is_wp_error($user_id)) { |
|
| 796 | + return -1; |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | // Allow themes and plugins to filter the user data. |
| 800 | - $user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args ); |
|
| 800 | + $user_data = apply_filters('give_insert_user_data', $user_data, $user_args); |
|
| 801 | 801 | |
| 802 | 802 | /** |
| 803 | 803 | * Fires after inserting user. |
@@ -807,10 +807,10 @@ discard block |
||
| 807 | 807 | * @param int $user_id User id. |
| 808 | 808 | * @param array $user_data Array containing user data. |
| 809 | 809 | */ |
| 810 | - do_action( 'give_insert_user', $user_id, $user_data ); |
|
| 810 | + do_action('give_insert_user', $user_id, $user_data); |
|
| 811 | 811 | |
| 812 | 812 | // Login new user. |
| 813 | - give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] ); |
|
| 813 | + give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']); |
|
| 814 | 814 | |
| 815 | 815 | // Return user id. |
| 816 | 816 | return $user_id; |
@@ -825,27 +825,27 @@ discard block |
||
| 825 | 825 | * @since 1.0 |
| 826 | 826 | * @return array |
| 827 | 827 | */ |
| 828 | -function give_get_purchase_form_user( $valid_data = array() ) { |
|
| 828 | +function give_get_purchase_form_user($valid_data = array()) { |
|
| 829 | 829 | |
| 830 | 830 | // Initialize user. |
| 831 | 831 | $user = false; |
| 832 | - $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
| 832 | + $is_ajax = defined('DOING_AJAX') && DOING_AJAX; |
|
| 833 | 833 | |
| 834 | - if ( $is_ajax ) { |
|
| 834 | + if ($is_ajax) { |
|
| 835 | 835 | // Do not create or login the user during the ajax submission (check for errors only). |
| 836 | 836 | return true; |
| 837 | - } elseif ( is_user_logged_in() ) { |
|
| 837 | + } elseif (is_user_logged_in()) { |
|
| 838 | 838 | // Set the valid user as the logged in collected data. |
| 839 | 839 | $user = $valid_data['logged_in_user']; |
| 840 | - } elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) { |
|
| 840 | + } elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) { |
|
| 841 | 841 | // New user registration. |
| 842 | - if ( $valid_data['need_new_user'] === true ) { |
|
| 842 | + if ($valid_data['need_new_user'] === true) { |
|
| 843 | 843 | // Set user. |
| 844 | 844 | $user = $valid_data['new_user_data']; |
| 845 | 845 | // Register and login new user. |
| 846 | - $user['user_id'] = give_register_and_login_new_user( $user ); |
|
| 846 | + $user['user_id'] = give_register_and_login_new_user($user); |
|
| 847 | 847 | // User login |
| 848 | - } elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) { |
|
| 848 | + } elseif ($valid_data['need_user_login'] === true && ! $is_ajax) { |
|
| 849 | 849 | |
| 850 | 850 | /* |
| 851 | 851 | * The login form is now processed in the give_process_purchase_login() function. |
@@ -858,48 +858,48 @@ discard block |
||
| 858 | 858 | // Set user. |
| 859 | 859 | $user = $valid_data['login_user_data']; |
| 860 | 860 | // Login user. |
| 861 | - give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] ); |
|
| 861 | + give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']); |
|
| 862 | 862 | } |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | // Check guest checkout. |
| 866 | - if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) { |
|
| 866 | + if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) { |
|
| 867 | 867 | // Set user |
| 868 | 868 | $user = $valid_data['guest_user_data']; |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | // Verify we have an user. |
| 872 | - if ( false === $user || empty( $user ) ) { |
|
| 872 | + if (false === $user || empty($user)) { |
|
| 873 | 873 | // Return false. |
| 874 | 874 | return false; |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | // Get user first name. |
| 878 | - if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) { |
|
| 879 | - $user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
| 878 | + if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) { |
|
| 879 | + $user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | // Get user last name. |
| 883 | - if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) { |
|
| 884 | - $user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : ''; |
|
| 883 | + if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) { |
|
| 884 | + $user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : ''; |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | // Get the user's billing address details. |
| 888 | 888 | $user['address'] = array(); |
| 889 | - $user['address']['line1'] = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false; |
|
| 890 | - $user['address']['line2'] = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false; |
|
| 891 | - $user['address']['city'] = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false; |
|
| 892 | - $user['address']['state'] = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false; |
|
| 893 | - $user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false; |
|
| 894 | - $user['address']['zip'] = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false; |
|
| 895 | - |
|
| 896 | - if ( empty( $user['address']['country'] ) ) { |
|
| 889 | + $user['address']['line1'] = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false; |
|
| 890 | + $user['address']['line2'] = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false; |
|
| 891 | + $user['address']['city'] = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false; |
|
| 892 | + $user['address']['state'] = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false; |
|
| 893 | + $user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false; |
|
| 894 | + $user['address']['zip'] = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false; |
|
| 895 | + |
|
| 896 | + if (empty($user['address']['country'])) { |
|
| 897 | 897 | $user['address'] = false; |
| 898 | 898 | } // Country will always be set if address fields are present. |
| 899 | 899 | |
| 900 | - if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) { |
|
| 900 | + if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) { |
|
| 901 | 901 | // Store the address in the user's meta so the donation form can be pre-populated with it on return purchases. |
| 902 | - update_user_meta( $user['user_id'], '_give_user_address', $user['address'] ); |
|
| 902 | + update_user_meta($user['user_id'], '_give_user_address', $user['address']); |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | // Return valid user. |
@@ -918,16 +918,16 @@ discard block |
||
| 918 | 918 | $card_data = give_get_purchase_cc_info(); |
| 919 | 919 | |
| 920 | 920 | // Validate the card zip. |
| 921 | - if ( ! empty( $card_data['card_zip'] ) ) { |
|
| 922 | - if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) { |
|
| 923 | - give_set_error( 'invalid_cc_zip', esc_html__( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) ); |
|
| 921 | + if ( ! empty($card_data['card_zip'])) { |
|
| 922 | + if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) { |
|
| 923 | + give_set_error('invalid_cc_zip', esc_html__('The zip / postal code you entered for your billing address is invalid.', 'give')); |
|
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | // Ensure no spaces. |
| 928 | - if ( ! empty( $card_data['card_number'] ) ) { |
|
| 929 | - $card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs |
|
| 930 | - $card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces |
|
| 928 | + if ( ! empty($card_data['card_number'])) { |
|
| 929 | + $card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs |
|
| 930 | + $card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | // This should validate card numbers at some point too. |
@@ -943,17 +943,17 @@ discard block |
||
| 943 | 943 | */ |
| 944 | 944 | function give_get_purchase_cc_info() { |
| 945 | 945 | $cc_info = array(); |
| 946 | - $cc_info['card_name'] = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : ''; |
|
| 947 | - $cc_info['card_number'] = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : ''; |
|
| 948 | - $cc_info['card_cvc'] = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : ''; |
|
| 949 | - $cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : ''; |
|
| 950 | - $cc_info['card_exp_year'] = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : ''; |
|
| 951 | - $cc_info['card_address'] = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : ''; |
|
| 952 | - $cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : ''; |
|
| 953 | - $cc_info['card_city'] = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : ''; |
|
| 954 | - $cc_info['card_state'] = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : ''; |
|
| 955 | - $cc_info['card_country'] = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : ''; |
|
| 956 | - $cc_info['card_zip'] = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : ''; |
|
| 946 | + $cc_info['card_name'] = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : ''; |
|
| 947 | + $cc_info['card_number'] = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : ''; |
|
| 948 | + $cc_info['card_cvc'] = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : ''; |
|
| 949 | + $cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : ''; |
|
| 950 | + $cc_info['card_exp_year'] = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : ''; |
|
| 951 | + $cc_info['card_address'] = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : ''; |
|
| 952 | + $cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : ''; |
|
| 953 | + $cc_info['card_city'] = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : ''; |
|
| 954 | + $cc_info['card_state'] = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : ''; |
|
| 955 | + $cc_info['card_country'] = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : ''; |
|
| 956 | + $cc_info['card_zip'] = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : ''; |
|
| 957 | 957 | |
| 958 | 958 | // Return cc info |
| 959 | 959 | return $cc_info; |
@@ -969,14 +969,14 @@ discard block |
||
| 969 | 969 | * |
| 970 | 970 | * @return bool|mixed|void |
| 971 | 971 | */ |
| 972 | -function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) { |
|
| 972 | +function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') { |
|
| 973 | 973 | $ret = false; |
| 974 | 974 | |
| 975 | - if ( empty( $zip ) || empty( $country_code ) ) { |
|
| 975 | + if (empty($zip) || empty($country_code)) { |
|
| 976 | 976 | return $ret; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | - $country_code = strtoupper( $country_code ); |
|
| 979 | + $country_code = strtoupper($country_code); |
|
| 980 | 980 | |
| 981 | 981 | $zip_regex = array( |
| 982 | 982 | 'AD' => 'AD\d{3}', |
@@ -1136,11 +1136,11 @@ discard block |
||
| 1136 | 1136 | 'ZM' => '\d{5}', |
| 1137 | 1137 | ); |
| 1138 | 1138 | |
| 1139 | - if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) { |
|
| 1139 | + if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) { |
|
| 1140 | 1140 | $ret = true; |
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | - return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code ); |
|
| 1143 | + return apply_filters('give_is_zip_valid', $ret, $zip, $country_code); |
|
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | |
@@ -1154,36 +1154,36 @@ discard block |
||
| 1154 | 1154 | * |
| 1155 | 1155 | * @return bool |
| 1156 | 1156 | */ |
| 1157 | -function give_validate_multi_donation_form_level( $valid_data, $data ) { |
|
| 1157 | +function give_validate_multi_donation_form_level($valid_data, $data) { |
|
| 1158 | 1158 | /* @var Give_Donate_Form $form */ |
| 1159 | - $form = new Give_Donate_Form( $data['give-form-id'] ); |
|
| 1159 | + $form = new Give_Donate_Form($data['give-form-id']); |
|
| 1160 | 1160 | |
| 1161 | 1161 | $donation_level_matched = false; |
| 1162 | 1162 | |
| 1163 | - if ( $form->is_multi_type_donation_form() ) { |
|
| 1163 | + if ($form->is_multi_type_donation_form()) { |
|
| 1164 | 1164 | |
| 1165 | 1165 | // Bailout. |
| 1166 | - if ( ! ( $variable_prices = $form->get_prices() ) ) { |
|
| 1166 | + if ( ! ($variable_prices = $form->get_prices())) { |
|
| 1167 | 1167 | return false; |
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | // Sanitize donation amount. |
| 1171 | - $data['give-amount'] = give_sanitize_amount( $data['give-amount'] ); |
|
| 1171 | + $data['give-amount'] = give_sanitize_amount($data['give-amount']); |
|
| 1172 | 1172 | |
| 1173 | 1173 | // Get number of decimals. |
| 1174 | 1174 | $default_decimals = give_get_price_decimals(); |
| 1175 | 1175 | |
| 1176 | - if ( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ) { |
|
| 1176 | + if ($data['give-amount'] === give_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']), $default_decimals)) { |
|
| 1177 | 1177 | return true; |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | // Find correct donation level from all donation levels. |
| 1181 | - foreach ( $variable_prices as $variable_price ) { |
|
| 1181 | + foreach ($variable_prices as $variable_price) { |
|
| 1182 | 1182 | // Sanitize level amount. |
| 1183 | - $variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals ); |
|
| 1183 | + $variable_price['_give_amount'] = give_sanitize_amount($variable_price['_give_amount'], $default_decimals); |
|
| 1184 | 1184 | |
| 1185 | 1185 | // Set first match donation level ID. |
| 1186 | - if ( $data['give-amount'] === $variable_price['_give_amount'] ) { |
|
| 1186 | + if ($data['give-amount'] === $variable_price['_give_amount']) { |
|
| 1187 | 1187 | $_POST['give-price-id'] = $variable_price['_give_id']['level_id']; |
| 1188 | 1188 | $donation_level_matched = true; |
| 1189 | 1189 | break; |
@@ -1194,19 +1194,19 @@ discard block |
||
| 1194 | 1194 | // If yes then set price id to custom if amount is greater then custom minimum amount (if any). |
| 1195 | 1195 | if ( |
| 1196 | 1196 | ! $donation_level_matched |
| 1197 | - && ( 'yes' === get_post_meta( $data['give-form-id'], '_give_custom_amount', true ) ) |
|
| 1197 | + && ('yes' === get_post_meta($data['give-form-id'], '_give_custom_amount', true)) |
|
| 1198 | 1198 | ) { |
| 1199 | 1199 | // Sanitize custom minimum amount. |
| 1200 | - $custom_minimum_amount = give_sanitize_amount( get_post_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals ); |
|
| 1200 | + $custom_minimum_amount = give_sanitize_amount(get_post_meta($data['give-form-id'], '_give_custom_amount_minimum', true), $default_decimals); |
|
| 1201 | 1201 | |
| 1202 | - if ( $data['give-amount'] >= $custom_minimum_amount ) { |
|
| 1202 | + if ($data['give-amount'] >= $custom_minimum_amount) { |
|
| 1203 | 1203 | $_POST['give-price-id'] = 'custom'; |
| 1204 | 1204 | $donation_level_matched = true; |
| 1205 | 1205 | } |
| 1206 | 1206 | } |
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | - return ( $donation_level_matched ? true : false ); |
|
| 1209 | + return ($donation_level_matched ? true : false); |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | -add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 ); |
|
| 1212 | +add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2); |
|
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @access private |
| 22 | 22 | * @since 1.0 |
| 23 | 23 | */ |
| 24 | -add_action( 'give_paypal_cc_form', '__return_false' ); |
|
| 24 | +add_action('give_paypal_cc_form', '__return_false'); |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Process PayPal Purchase. |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | -function give_process_paypal_purchase( $purchase_data ) { |
|
| 35 | +function give_process_paypal_purchase($purchase_data) { |
|
| 36 | 36 | |
| 37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
| 38 | - wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
| 38 | + wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $form_id = intval( $purchase_data['post_data']['give-form-id'] ); |
|
| 42 | - $price_id = isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : ''; |
|
| 41 | + $form_id = intval($purchase_data['post_data']['give-form-id']); |
|
| 42 | + $price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : ''; |
|
| 43 | 43 | |
| 44 | 44 | // Collect payment data. |
| 45 | 45 | $payment_data = array( |
@@ -57,101 +57,101 @@ discard block |
||
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | // Record the pending payment. |
| 60 | - $payment_id = give_insert_payment( $payment_data ); |
|
| 60 | + $payment_id = give_insert_payment($payment_data); |
|
| 61 | 61 | |
| 62 | 62 | // Check payment. |
| 63 | - if ( ! $payment_id ) { |
|
| 63 | + if ( ! $payment_id) { |
|
| 64 | 64 | // Record the error. |
| 65 | 65 | give_record_gateway_error( |
| 66 | - esc_html__( 'Payment Error', 'give' ), |
|
| 66 | + esc_html__('Payment Error', 'give'), |
|
| 67 | 67 | sprintf( |
| 68 | 68 | /* translators: %s: payment data */ |
| 69 | - esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), |
|
| 70 | - json_encode( $payment_data ) |
|
| 69 | + esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), |
|
| 70 | + json_encode($payment_data) |
|
| 71 | 71 | ), |
| 72 | 72 | $payment_id |
| 73 | 73 | ); |
| 74 | 74 | // Problems? Send back. |
| 75 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
| 75 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
| 76 | 76 | |
| 77 | 77 | } else { |
| 78 | 78 | |
| 79 | 79 | // Only send to PayPal if the pending payment is created successfully. |
| 80 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
| 80 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
| 81 | 81 | |
| 82 | 82 | // Get the success url. |
| 83 | - $return_url = add_query_arg( array( |
|
| 83 | + $return_url = add_query_arg(array( |
|
| 84 | 84 | 'payment-confirmation' => 'paypal', |
| 85 | 85 | 'payment-id' => $payment_id |
| 86 | 86 | |
| 87 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
| 87 | + ), get_permalink(give_get_option('success_page'))); |
|
| 88 | 88 | |
| 89 | 89 | // Get the PayPal redirect uri. |
| 90 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
| 90 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
| 91 | 91 | |
| 92 | 92 | //Item name - pass level name if variable priced. |
| 93 | 93 | $item_name = $purchase_data['post_data']['give-form-title']; |
| 94 | 94 | |
| 95 | 95 | //Verify has variable prices. |
| 96 | - if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) { |
|
| 96 | + if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) { |
|
| 97 | 97 | |
| 98 | - $item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
| 98 | + $item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']); |
|
| 99 | 99 | |
| 100 | - $price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
| 100 | + $price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']); |
|
| 101 | 101 | |
| 102 | 102 | //Donation given doesn't match selected level (must be a custom amount). |
| 103 | - if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) { |
|
| 104 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 103 | + if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) { |
|
| 104 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 105 | 105 | //user custom amount text if any, fallback to default if not. |
| 106 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
| 106 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
| 107 | 107 | |
| 108 | 108 | } //Is there any donation level text? |
| 109 | - elseif ( ! empty( $item_price_level_text ) ) { |
|
| 110 | - $item_name .= ' - ' . $item_price_level_text; |
|
| 109 | + elseif ( ! empty($item_price_level_text)) { |
|
| 110 | + $item_name .= ' - '.$item_price_level_text; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | } //Single donation: Custom Amount. |
| 114 | - elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) { |
|
| 115 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 114 | + elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) { |
|
| 115 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 116 | 116 | //user custom amount text if any, fallback to default if not. |
| 117 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
| 117 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Setup PayPal API params. |
| 121 | 121 | $paypal_args = array( |
| 122 | - 'business' => give_get_option( 'paypal_email', false ), |
|
| 122 | + 'business' => give_get_option('paypal_email', false), |
|
| 123 | 123 | 'first_name' => $purchase_data['user_info']['first_name'], |
| 124 | 124 | 'last_name' => $purchase_data['user_info']['last_name'], |
| 125 | 125 | 'email' => $purchase_data['user_email'], |
| 126 | 126 | 'invoice' => $purchase_data['purchase_key'], |
| 127 | 127 | 'amount' => $purchase_data['price'], |
| 128 | - 'item_name' => stripslashes( $item_name ), |
|
| 128 | + 'item_name' => stripslashes($item_name), |
|
| 129 | 129 | 'no_shipping' => '1', |
| 130 | 130 | 'shipping' => '0', |
| 131 | 131 | 'no_note' => '1', |
| 132 | 132 | 'currency_code' => give_get_currency(), |
| 133 | - 'charset' => get_bloginfo( 'charset' ), |
|
| 133 | + 'charset' => get_bloginfo('charset'), |
|
| 134 | 134 | 'custom' => $payment_id, |
| 135 | 135 | 'rm' => '2', |
| 136 | 136 | 'return' => $return_url, |
| 137 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
| 137 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
| 138 | 138 | 'notify_url' => $listener_url, |
| 139 | 139 | 'page_style' => give_get_paypal_page_style(), |
| 140 | - 'cbt' => get_bloginfo( 'name' ), |
|
| 140 | + 'cbt' => get_bloginfo('name'), |
|
| 141 | 141 | 'bn' => 'givewp_SP' |
| 142 | 142 | ); |
| 143 | 143 | |
| 144 | 144 | //Add user address if present. |
| 145 | - if ( ! empty( $purchase_data['user_info']['address'] ) ) { |
|
| 146 | - $paypal_args['address1'] = isset( $purchase_data['user_info']['address']['line1'] ) ? $purchase_data['user_info']['address']['line1'] : ''; |
|
| 147 | - $paypal_args['address2'] = isset( $purchase_data['user_info']['address']['line2'] ) ? $purchase_data['user_info']['address']['line2'] : ''; |
|
| 148 | - $paypal_args['city'] = isset( $purchase_data['user_info']['address']['city'] ) ? $purchase_data['user_info']['address']['city'] : ''; |
|
| 149 | - $paypal_args['state'] = isset( $purchase_data['user_info']['address']['state'] ) ? $purchase_data['user_info']['address']['state'] : ''; |
|
| 150 | - $paypal_args['country'] = isset( $purchase_data['user_info']['address']['country'] ) ? $purchase_data['user_info']['address']['country'] : ''; |
|
| 145 | + if ( ! empty($purchase_data['user_info']['address'])) { |
|
| 146 | + $paypal_args['address1'] = isset($purchase_data['user_info']['address']['line1']) ? $purchase_data['user_info']['address']['line1'] : ''; |
|
| 147 | + $paypal_args['address2'] = isset($purchase_data['user_info']['address']['line2']) ? $purchase_data['user_info']['address']['line2'] : ''; |
|
| 148 | + $paypal_args['city'] = isset($purchase_data['user_info']['address']['city']) ? $purchase_data['user_info']['address']['city'] : ''; |
|
| 149 | + $paypal_args['state'] = isset($purchase_data['user_info']['address']['state']) ? $purchase_data['user_info']['address']['state'] : ''; |
|
| 150 | + $paypal_args['country'] = isset($purchase_data['user_info']['address']['country']) ? $purchase_data['user_info']['address']['country'] : ''; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | //Donations or regular transactions? |
| 154 | - if ( give_get_option( 'paypal_button_type' ) === 'standard' ) { |
|
| 154 | + if (give_get_option('paypal_button_type') === 'standard') { |
|
| 155 | 155 | $paypal_extra_args = array( |
| 156 | 156 | 'cmd' => '_xclick', |
| 157 | 157 | ); |
@@ -161,23 +161,23 @@ discard block |
||
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - $paypal_args = array_merge( $paypal_extra_args, $paypal_args ); |
|
| 165 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data ); |
|
| 164 | + $paypal_args = array_merge($paypal_extra_args, $paypal_args); |
|
| 165 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data); |
|
| 166 | 166 | |
| 167 | 167 | // Build query. |
| 168 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
| 168 | + $paypal_redirect .= http_build_query($paypal_args); |
|
| 169 | 169 | |
| 170 | 170 | // Fix for some sites that encode the entities. |
| 171 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
| 171 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
| 172 | 172 | |
| 173 | 173 | // Redirect to PayPal. |
| 174 | - wp_redirect( $paypal_redirect ); |
|
| 174 | + wp_redirect($paypal_redirect); |
|
| 175 | 175 | exit; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' ); |
|
| 180 | +add_action('give_gateway_paypal', 'give_process_paypal_purchase'); |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * Listens for a PayPal IPN requests and then sends to the processing function |
@@ -187,17 +187,17 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function give_listen_for_paypal_ipn() { |
| 189 | 189 | // Regular PayPal IPN |
| 190 | - if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) { |
|
| 190 | + if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') { |
|
| 191 | 191 | /** |
| 192 | 192 | * Fires while verifying PayPal IPN |
| 193 | 193 | * |
| 194 | 194 | * @since 1.0 |
| 195 | 195 | */ |
| 196 | - do_action( 'give_verify_paypal_ipn' ); |
|
| 196 | + do_action('give_verify_paypal_ipn'); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
| 200 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Process PayPal IPN |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | function give_process_paypal_ipn() { |
| 209 | 209 | |
| 210 | 210 | // Check the request method is POST |
| 211 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
| 211 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | $post_data = ''; |
| 217 | 217 | |
| 218 | 218 | // Fallback just in case post_max_size is lower than needed |
| 219 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
| 220 | - $post_data = file_get_contents( 'php://input' ); |
|
| 219 | + if (ini_get('allow_url_fopen')) { |
|
| 220 | + $post_data = file_get_contents('php://input'); |
|
| 221 | 221 | } else { |
| 222 | 222 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
| 223 | - ini_set( 'post_max_size', '12M' ); |
|
| 223 | + ini_set('post_max_size', '12M'); |
|
| 224 | 224 | } |
| 225 | 225 | // Start the encoded data collection with notification command |
| 226 | 226 | $encoded_data = 'cmd=_notify-validate'; |
@@ -229,40 +229,40 @@ discard block |
||
| 229 | 229 | $arg_separator = give_get_php_arg_separator_output(); |
| 230 | 230 | |
| 231 | 231 | // Verify there is a post_data |
| 232 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
| 232 | + if ($post_data || strlen($post_data) > 0) { |
|
| 233 | 233 | // Append the data |
| 234 | - $encoded_data .= $arg_separator . $post_data; |
|
| 234 | + $encoded_data .= $arg_separator.$post_data; |
|
| 235 | 235 | } else { |
| 236 | 236 | // Check if POST is empty |
| 237 | - if ( empty( $_POST ) ) { |
|
| 237 | + if (empty($_POST)) { |
|
| 238 | 238 | // Nothing to do |
| 239 | 239 | return; |
| 240 | 240 | } else { |
| 241 | 241 | // Loop through each POST |
| 242 | - foreach ( $_POST as $key => $value ) { |
|
| 242 | + foreach ($_POST as $key => $value) { |
|
| 243 | 243 | // Encode the value and append the data. |
| 244 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
| 244 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // Convert collected post data to an array. |
| 250 | - parse_str( $encoded_data, $encoded_data_array ); |
|
| 250 | + parse_str($encoded_data, $encoded_data_array); |
|
| 251 | 251 | |
| 252 | - foreach ( $encoded_data_array as $key => $value ) { |
|
| 252 | + foreach ($encoded_data_array as $key => $value) { |
|
| 253 | 253 | |
| 254 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
| 255 | - $new_key = str_replace( '&', '&', $key ); |
|
| 256 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
| 254 | + if (false !== strpos($key, 'amp;')) { |
|
| 255 | + $new_key = str_replace('&', '&', $key); |
|
| 256 | + $new_key = str_replace('amp;', '&', $new_key); |
|
| 257 | 257 | |
| 258 | - unset( $encoded_data_array[ $key ] ); |
|
| 259 | - $encoded_data_array[ $new_key ] = $value; |
|
| 258 | + unset($encoded_data_array[$key]); |
|
| 259 | + $encoded_data_array[$new_key] = $value; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | //Validate IPN request w/ PayPal if user hasn't disabled this security measure. |
| 265 | - if ( ! give_get_option( 'disable_paypal_verification' ) ) { |
|
| 265 | + if ( ! give_get_option('disable_paypal_verification')) { |
|
| 266 | 266 | |
| 267 | 267 | $remote_post_vars = array( |
| 268 | 268 | 'method' => 'POST', |
@@ -282,28 +282,28 @@ discard block |
||
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | 284 | // Validate the IPN. |
| 285 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
| 285 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
| 286 | 286 | |
| 287 | - if ( is_wp_error( $api_response ) ) { |
|
| 287 | + if (is_wp_error($api_response)) { |
|
| 288 | 288 | give_record_gateway_error( |
| 289 | - esc_html__( 'IPN Error', 'give' ), |
|
| 289 | + esc_html__('IPN Error', 'give'), |
|
| 290 | 290 | sprintf( |
| 291 | 291 | /* translators: %s: Paypal IPN response */ |
| 292 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
| 293 | - json_encode( $api_response ) |
|
| 292 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
| 293 | + json_encode($api_response) |
|
| 294 | 294 | ) |
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | 297 | return; // Something went wrong |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) { |
|
| 300 | + if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) { |
|
| 301 | 301 | give_record_gateway_error( |
| 302 | - esc_html__( 'IPN Error', 'give' ), |
|
| 302 | + esc_html__('IPN Error', 'give'), |
|
| 303 | 303 | sprintf( |
| 304 | 304 | /* translators: %s: Paypal IPN response */ |
| 305 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
| 306 | - json_encode( $api_response ) |
|
| 305 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
| 306 | + json_encode($api_response) |
|
| 307 | 307 | ) |
| 308 | 308 | ); |
| 309 | 309 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // Check if $post_data_array has been populated |
| 316 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
| 316 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
| 317 | 317 | return; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | 'payment_status' => '' |
| 323 | 323 | ); |
| 324 | 324 | |
| 325 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
| 325 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
| 326 | 326 | |
| 327 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
| 327 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
| 328 | 328 | $txn_type = $encoded_data_array['txn_type']; |
| 329 | 329 | |
| 330 | - if ( has_action( 'give_paypal_' . $txn_type ) ) { |
|
| 330 | + if (has_action('give_paypal_'.$txn_type)) { |
|
| 331 | 331 | /** |
| 332 | 332 | * Fires while processing PayPal IPN $txn_type. |
| 333 | 333 | * |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @param array $encoded_data_array Encoded data. |
| 339 | 339 | * @param int $payment_id Payment id. |
| 340 | 340 | */ |
| 341 | - do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id ); |
|
| 341 | + do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id); |
|
| 342 | 342 | } else { |
| 343 | 343 | /** |
| 344 | 344 | * Fires while process PayPal IPN. |
@@ -350,12 +350,12 @@ discard block |
||
| 350 | 350 | * @param array $encoded_data_array Encoded data. |
| 351 | 351 | * @param int $payment_id Payment id. |
| 352 | 352 | */ |
| 353 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
| 353 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
| 354 | 354 | } |
| 355 | 355 | exit; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
| 358 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * Process web accept (one time) payment IPNs. |
@@ -367,127 +367,127 @@ discard block |
||
| 367 | 367 | * |
| 368 | 368 | * @return void |
| 369 | 369 | */ |
| 370 | -function give_process_paypal_web_accept_and_cart( $data, $payment_id ) { |
|
| 370 | +function give_process_paypal_web_accept_and_cart($data, $payment_id) { |
|
| 371 | 371 | |
| 372 | 372 | //Only allow through these transaction types. |
| 373 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) { |
|
| 373 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') { |
|
| 374 | 374 | return; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | //Need $payment_id to continue. |
| 378 | - if ( empty( $payment_id ) ) { |
|
| 378 | + if (empty($payment_id)) { |
|
| 379 | 379 | return; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // Collect donation payment details. |
| 383 | 383 | $paypal_amount = $data['mc_gross']; |
| 384 | - $payment_status = strtolower( $data['payment_status'] ); |
|
| 385 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
| 386 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
| 387 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
| 384 | + $payment_status = strtolower($data['payment_status']); |
|
| 385 | + $currency_code = strtolower($data['mc_currency']); |
|
| 386 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
| 387 | + $payment_meta = give_get_payment_meta($payment_id); |
|
| 388 | 388 | |
| 389 | 389 | // Must be a PayPal standard IPN. |
| 390 | - if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) { |
|
| 390 | + if (give_get_payment_gateway($payment_id) != 'paypal') { |
|
| 391 | 391 | return; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | // Verify payment recipient |
| 395 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) { |
|
| 395 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) { |
|
| 396 | 396 | |
| 397 | 397 | give_record_gateway_error( |
| 398 | - esc_html__( 'IPN Error', 'give' ), |
|
| 398 | + esc_html__('IPN Error', 'give'), |
|
| 399 | 399 | sprintf( |
| 400 | 400 | /* translators: %s: Paypal IPN response */ |
| 401 | - esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), |
|
| 402 | - json_encode( $data ) |
|
| 401 | + esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), |
|
| 402 | + json_encode($data) |
|
| 403 | 403 | ), |
| 404 | 404 | $payment_id |
| 405 | 405 | ); |
| 406 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 407 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
| 406 | + give_update_payment_status($payment_id, 'failed'); |
|
| 407 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give')); |
|
| 408 | 408 | |
| 409 | 409 | return; |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // Verify payment currency. |
| 413 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
| 413 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
| 414 | 414 | |
| 415 | 415 | give_record_gateway_error( |
| 416 | - esc_html__( 'IPN Error', 'give' ), |
|
| 416 | + esc_html__('IPN Error', 'give'), |
|
| 417 | 417 | sprintf( |
| 418 | 418 | /* translators: %s: Paypal IPN response */ |
| 419 | - esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), |
|
| 420 | - json_encode( $data ) |
|
| 419 | + esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), |
|
| 420 | + json_encode($data) |
|
| 421 | 421 | ), |
| 422 | 422 | $payment_id |
| 423 | 423 | ); |
| 424 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 425 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
| 424 | + give_update_payment_status($payment_id, 'failed'); |
|
| 425 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
| 426 | 426 | |
| 427 | 427 | return; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | //Process refunds & reversed. |
| 431 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
| 432 | - give_process_paypal_refund( $data, $payment_id ); |
|
| 431 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
| 432 | + give_process_paypal_refund($data, $payment_id); |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // Only complete payments once. |
| 437 | - if ( get_post_status( $payment_id ) == 'publish' ) { |
|
| 437 | + if (get_post_status($payment_id) == 'publish') { |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // Retrieve the total donation amount (before PayPal). |
| 442 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
| 442 | + $payment_amount = give_get_payment_amount($payment_id); |
|
| 443 | 443 | |
| 444 | 444 | //Check that the donation PP and local db amounts match. |
| 445 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 445 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
| 446 | 446 | // The prices don't match |
| 447 | 447 | give_record_gateway_error( |
| 448 | - esc_html__( 'IPN Error', 'give' ), |
|
| 448 | + esc_html__('IPN Error', 'give'), |
|
| 449 | 449 | sprintf( |
| 450 | 450 | /* translators: %s: Paypal IPN response */ |
| 451 | - esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), |
|
| 452 | - json_encode( $data ) |
|
| 451 | + esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), |
|
| 452 | + json_encode($data) |
|
| 453 | 453 | ), |
| 454 | 454 | $payment_id |
| 455 | 455 | ); |
| 456 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 457 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
| 456 | + give_update_payment_status($payment_id, 'failed'); |
|
| 457 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
| 458 | 458 | |
| 459 | 459 | return; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | //Process completed donations. |
| 463 | - if ( $payment_status == 'completed' || give_is_test_mode() ) { |
|
| 463 | + if ($payment_status == 'completed' || give_is_test_mode()) { |
|
| 464 | 464 | |
| 465 | 465 | give_insert_payment_note( |
| 466 | 466 | $payment_id, |
| 467 | 467 | sprintf( |
| 468 | 468 | /* translators: %s: Paypal transaction ID */ |
| 469 | - esc_html__( 'PayPal Transaction ID: %s', 'give' ), |
|
| 469 | + esc_html__('PayPal Transaction ID: %s', 'give'), |
|
| 470 | 470 | $data['txn_id'] |
| 471 | 471 | ) |
| 472 | 472 | ); |
| 473 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
| 474 | - give_update_payment_status( $payment_id, 'publish' ); |
|
| 473 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
| 474 | + give_update_payment_status($payment_id, 'publish'); |
|
| 475 | 475 | |
| 476 | - } elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
| 476 | + } elseif ('pending' == $payment_status && isset($data['pending_reason'])) { |
|
| 477 | 477 | |
| 478 | 478 | // Look for possible pending reasons, such as an echeck. |
| 479 | - $note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) ); |
|
| 479 | + $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason'])); |
|
| 480 | 480 | |
| 481 | - if ( ! empty( $note ) ) { |
|
| 481 | + if ( ! empty($note)) { |
|
| 482 | 482 | |
| 483 | - give_insert_payment_note( $payment_id, $note ); |
|
| 483 | + give_insert_payment_note($payment_id, $note); |
|
| 484 | 484 | |
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 ); |
|
| 490 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2); |
|
| 491 | 491 | |
| 492 | 492 | /** |
| 493 | 493 | * Process PayPal IPN Refunds |
@@ -499,28 +499,28 @@ discard block |
||
| 499 | 499 | * |
| 500 | 500 | * @return void |
| 501 | 501 | */ |
| 502 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
| 502 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
| 503 | 503 | |
| 504 | 504 | // Collect payment details |
| 505 | 505 | |
| 506 | - if ( empty( $payment_id ) ) { |
|
| 506 | + if (empty($payment_id)) { |
|
| 507 | 507 | return; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if ( get_post_status( $payment_id ) == 'refunded' ) { |
|
| 510 | + if (get_post_status($payment_id) == 'refunded') { |
|
| 511 | 511 | return; // Only refund payments once |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
| 514 | + $payment_amount = give_get_payment_amount($payment_id); |
|
| 515 | 515 | $refund_amount = $data['payment_gross'] * - 1; |
| 516 | 516 | |
| 517 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 517 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
| 518 | 518 | |
| 519 | 519 | give_insert_payment_note( |
| 520 | 520 | $payment_id, |
| 521 | 521 | sprintf( |
| 522 | 522 | /* translators: %s: Paypal parent transaction ID */ |
| 523 | - esc_html__( 'Partial PayPal refund processed: %s', 'give' ), |
|
| 523 | + esc_html__('Partial PayPal refund processed: %s', 'give'), |
|
| 524 | 524 | $data['parent_txn_id'] |
| 525 | 525 | ) |
| 526 | 526 | ); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $payment_id, |
| 534 | 534 | sprintf( |
| 535 | 535 | /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
| 536 | - esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), |
|
| 536 | + esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), |
|
| 537 | 537 | $data['parent_txn_id'], |
| 538 | 538 | $data['reason_code'] |
| 539 | 539 | ) |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | $payment_id, |
| 543 | 543 | sprintf( |
| 544 | 544 | /* translators: %s: Paypal transaction ID */ |
| 545 | - esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ), |
|
| 545 | + esc_html__('PayPal Refund Transaction ID: %s', 'give'), |
|
| 546 | 546 | $data['txn_id'] |
| 547 | 547 | ) |
| 548 | 548 | ); |
| 549 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
| 549 | + give_update_payment_status($payment_id, 'refunded'); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | /** |
@@ -558,24 +558,24 @@ discard block |
||
| 558 | 558 | * |
| 559 | 559 | * @return string |
| 560 | 560 | */ |
| 561 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
| 561 | +function give_get_paypal_redirect($ssl_check = false) { |
|
| 562 | 562 | |
| 563 | - if ( is_ssl() || ! $ssl_check ) { |
|
| 563 | + if (is_ssl() || ! $ssl_check) { |
|
| 564 | 564 | $protocal = 'https://'; |
| 565 | 565 | } else { |
| 566 | 566 | $protocal = 'http://'; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | // Check the current payment mode |
| 570 | - if ( give_is_test_mode() ) { |
|
| 570 | + if (give_is_test_mode()) { |
|
| 571 | 571 | // Test mode |
| 572 | - $paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
| 572 | + $paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
| 573 | 573 | } else { |
| 574 | 574 | // Live mode |
| 575 | - $paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr'; |
|
| 575 | + $paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr'; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
| 578 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
@@ -585,9 +585,9 @@ discard block |
||
| 585 | 585 | * @return string |
| 586 | 586 | */ |
| 587 | 587 | function give_get_paypal_page_style() { |
| 588 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
| 588 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
| 589 | 589 | |
| 590 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
| 590 | + return apply_filters('give_paypal_page_style', $page_style); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -602,26 +602,26 @@ discard block |
||
| 602 | 602 | * @return string |
| 603 | 603 | * |
| 604 | 604 | */ |
| 605 | -function give_paypal_success_page_content( $content ) { |
|
| 605 | +function give_paypal_success_page_content($content) { |
|
| 606 | 606 | |
| 607 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
| 607 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
| 608 | 608 | return $content; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
| 611 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
| 612 | 612 | |
| 613 | - if ( ! $payment_id ) { |
|
| 613 | + if ( ! $payment_id) { |
|
| 614 | 614 | $session = give_get_purchase_session(); |
| 615 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
| 615 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | - $payment = get_post( $payment_id ); |
|
| 619 | - if ( $payment && 'pending' == $payment->post_status ) { |
|
| 618 | + $payment = get_post($payment_id); |
|
| 619 | + if ($payment && 'pending' == $payment->post_status) { |
|
| 620 | 620 | |
| 621 | 621 | // Payment is still pending so show processing indicator to fix the race condition. |
| 622 | 622 | ob_start(); |
| 623 | 623 | |
| 624 | - give_get_template_part( 'payment', 'processing' ); |
|
| 624 | + give_get_template_part('payment', 'processing'); |
|
| 625 | 625 | |
| 626 | 626 | $content = ob_get_clean(); |
| 627 | 627 | |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
| 634 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
| 635 | 635 | |
| 636 | 636 | /** |
| 637 | 637 | * Given a Payment ID, extract the transaction ID |
@@ -642,22 +642,22 @@ discard block |
||
| 642 | 642 | * |
| 643 | 643 | * @return string Transaction ID |
| 644 | 644 | */ |
| 645 | -function give_paypal_get_payment_transaction_id( $payment_id ) { |
|
| 645 | +function give_paypal_get_payment_transaction_id($payment_id) { |
|
| 646 | 646 | |
| 647 | 647 | $transaction_id = ''; |
| 648 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 648 | + $notes = give_get_payment_notes($payment_id); |
|
| 649 | 649 | |
| 650 | - foreach ( $notes as $note ) { |
|
| 651 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
| 650 | + foreach ($notes as $note) { |
|
| 651 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
| 652 | 652 | $transaction_id = $match[1]; |
| 653 | 653 | continue; |
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | - return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
| 657 | + return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); |
|
| 658 | 658 | } |
| 659 | 659 | |
| 660 | -add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 ); |
|
| 660 | +add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1); |
|
| 661 | 661 | |
| 662 | 662 | /** |
| 663 | 663 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -669,16 +669,16 @@ discard block |
||
| 669 | 669 | * |
| 670 | 670 | * @return string A link to the PayPal transaction details |
| 671 | 671 | */ |
| 672 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
| 672 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
| 673 | 673 | |
| 674 | 674 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
| 675 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
| 675 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
| 676 | 676 | |
| 677 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
| 677 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
| 678 | 678 | |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
| 681 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
| 682 | 682 | |
| 683 | 683 | |
| 684 | 684 | /** |
@@ -690,64 +690,64 @@ discard block |
||
| 690 | 690 | * |
| 691 | 691 | * @return string |
| 692 | 692 | */ |
| 693 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
| 693 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
| 694 | 694 | |
| 695 | 695 | $note = ''; |
| 696 | 696 | |
| 697 | - switch ( $pending_reason ) { |
|
| 697 | + switch ($pending_reason) { |
|
| 698 | 698 | |
| 699 | 699 | case 'echeck' : |
| 700 | 700 | |
| 701 | - $note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
| 701 | + $note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
| 702 | 702 | |
| 703 | 703 | break; |
| 704 | 704 | |
| 705 | 705 | case 'address' : |
| 706 | 706 | |
| 707 | - $note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
| 707 | + $note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
| 708 | 708 | |
| 709 | 709 | break; |
| 710 | 710 | |
| 711 | 711 | case 'intl' : |
| 712 | 712 | |
| 713 | - $note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
| 713 | + $note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
| 714 | 714 | |
| 715 | 715 | break; |
| 716 | 716 | |
| 717 | 717 | case 'multi-currency' : |
| 718 | 718 | |
| 719 | - $note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
| 719 | + $note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
| 720 | 720 | |
| 721 | 721 | break; |
| 722 | 722 | |
| 723 | 723 | case 'paymentreview' : |
| 724 | 724 | case 'regulatory_review' : |
| 725 | 725 | |
| 726 | - $note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
| 726 | + $note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
| 727 | 727 | |
| 728 | 728 | break; |
| 729 | 729 | |
| 730 | 730 | case 'unilateral' : |
| 731 | 731 | |
| 732 | - $note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
| 732 | + $note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
| 733 | 733 | |
| 734 | 734 | break; |
| 735 | 735 | |
| 736 | 736 | case 'upgrade' : |
| 737 | 737 | |
| 738 | - $note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
| 738 | + $note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
| 739 | 739 | |
| 740 | 740 | break; |
| 741 | 741 | |
| 742 | 742 | case 'verify' : |
| 743 | 743 | |
| 744 | - $note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
| 744 | + $note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
| 745 | 745 | |
| 746 | 746 | break; |
| 747 | 747 | |
| 748 | 748 | case 'other' : |
| 749 | 749 | |
| 750 | - $note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
| 750 | + $note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
| 751 | 751 | |
| 752 | 752 | break; |
| 753 | 753 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -24,16 +24,16 @@ discard block |
||
| 24 | 24 | // Default, built-in gateways |
| 25 | 25 | $gateways = array( |
| 26 | 26 | 'paypal' => array( |
| 27 | - 'admin_label' => esc_html__( 'PayPal Standard', 'give' ), |
|
| 28 | - 'checkout_label' => esc_html__( 'PayPal', 'give' ), |
|
| 27 | + 'admin_label' => esc_html__('PayPal Standard', 'give'), |
|
| 28 | + 'checkout_label' => esc_html__('PayPal', 'give'), |
|
| 29 | 29 | ), |
| 30 | 30 | 'manual' => array( |
| 31 | - 'admin_label' => esc_html__( 'Test Donation', 'give' ), |
|
| 32 | - 'checkout_label' => esc_html__( 'Test Donation', 'give' ) |
|
| 31 | + 'admin_label' => esc_html__('Test Donation', 'give'), |
|
| 32 | + 'checkout_label' => esc_html__('Test Donation', 'give') |
|
| 33 | 33 | ), |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
| 36 | + return apply_filters('give_payment_gateways', $gateways); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
@@ -47,20 +47,20 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $gateways = give_get_payment_gateways(); |
| 49 | 49 | |
| 50 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
| 50 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
| 51 | 51 | |
| 52 | 52 | $gateway_list = array(); |
| 53 | 53 | |
| 54 | - foreach ( $gateways as $key => $gateway ) { |
|
| 55 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
| 56 | - $gateway_list[ $key ] = $gateway; |
|
| 54 | + foreach ($gateways as $key => $gateway) { |
|
| 55 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
| 56 | + $gateway_list[$key] = $gateway; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Set order of payment gateway in list. |
| 61 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
| 61 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
| 62 | 62 | |
| 63 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list ); |
|
| 63 | + return apply_filters('give_enabled_payment_gateways', $gateway_list); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return boolean true if enabled, false otherwise |
| 74 | 74 | */ |
| 75 | -function give_is_gateway_active( $gateway ) { |
|
| 75 | +function give_is_gateway_active($gateway) { |
|
| 76 | 76 | $gateways = give_get_enabled_payment_gateways(); |
| 77 | 77 | |
| 78 | - $ret = array_key_exists( $gateway, $gateways ); |
|
| 78 | + $ret = array_key_exists($gateway, $gateways); |
|
| 79 | 79 | |
| 80 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
| 80 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -89,23 +89,23 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return string Gateway ID |
| 91 | 91 | */ |
| 92 | -function give_get_default_gateway( $form_id ) { |
|
| 92 | +function give_get_default_gateway($form_id) { |
|
| 93 | 93 | |
| 94 | 94 | $give_options = give_get_settings(); |
| 95 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
| 96 | - $form_default = get_post_meta( $form_id, '_give_default_gateway', true ); |
|
| 95 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
| 96 | + $form_default = get_post_meta($form_id, '_give_default_gateway', true); |
|
| 97 | 97 | |
| 98 | 98 | //Single Form settings varies compared to the Global default settings. |
| 99 | - if ( ! empty( $form_default ) && |
|
| 99 | + if ( ! empty($form_default) && |
|
| 100 | 100 | $form_id !== null && |
| 101 | 101 | $default !== $form_default && |
| 102 | 102 | $form_default !== 'global' && |
| 103 | - give_is_gateway_active( $form_default ) |
|
| 103 | + give_is_gateway_active($form_default) |
|
| 104 | 104 | ) { |
| 105 | 105 | $default = $form_default; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return apply_filters( 'give_default_gateway', $default ); |
|
| 108 | + return apply_filters('give_default_gateway', $default); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -117,18 +117,18 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return string Gateway admin label |
| 119 | 119 | */ |
| 120 | -function give_get_gateway_admin_label( $gateway ) { |
|
| 120 | +function give_get_gateway_admin_label($gateway) { |
|
| 121 | 121 | $gateways = give_get_enabled_payment_gateways(); |
| 122 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
| 123 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
| 122 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
| 123 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
| 124 | 124 | |
| 125 | - if ( $gateway == 'manual' && $payment ) { |
|
| 126 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
| 127 | - $label = esc_html__( 'Test Donation', 'give' ); |
|
| 125 | + if ($gateway == 'manual' && $payment) { |
|
| 126 | + if (give_get_payment_amount($payment) == 0) { |
|
| 127 | + $label = esc_html__('Test Donation', 'give'); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
| 131 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return string Checkout label for the gateway |
| 142 | 142 | */ |
| 143 | -function give_get_gateway_checkout_label( $gateway ) { |
|
| 143 | +function give_get_gateway_checkout_label($gateway) { |
|
| 144 | 144 | $gateways = give_get_enabled_payment_gateways(); |
| 145 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
| 145 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
| 146 | 146 | |
| 147 | - if ( $gateway == 'manual' ) { |
|
| 148 | - $label = esc_html__( 'Test Donation', 'give' ); |
|
| 147 | + if ($gateway == 'manual') { |
|
| 148 | + $label = esc_html__('Test Donation', 'give'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
| 151 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return array Options the gateway supports |
| 162 | 162 | */ |
| 163 | -function give_get_gateway_supports( $gateway ) { |
|
| 163 | +function give_get_gateway_supports($gateway) { |
|
| 164 | 164 | $gateways = give_get_enabled_payment_gateways(); |
| 165 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
| 165 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
| 166 | 166 | |
| 167 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
| 167 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return void |
| 179 | 179 | */ |
| 180 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
| 180 | +function give_send_to_gateway($gateway, $payment_data) { |
|
| 181 | 181 | |
| 182 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
| 182 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * Fires while loading payment gateway via AJAX. |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @param array $payment_data All the payment data to be sent to the gateway. |
| 192 | 192 | */ |
| 193 | - do_action( "give_gateway_{$gateway}", $payment_data ); |
|
| 193 | + do_action("give_gateway_{$gateway}", $payment_data); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -207,32 +207,32 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return string $enabled_gateway The slug of the gateway |
| 209 | 209 | */ |
| 210 | -function give_get_chosen_gateway( $form_id ) { |
|
| 210 | +function give_get_chosen_gateway($form_id) { |
|
| 211 | 211 | $gateways = give_get_enabled_payment_gateways(); |
| 212 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
| 213 | - if ( empty( $request_form_id ) ) { |
|
| 214 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
| 212 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
| 213 | + if (empty($request_form_id)) { |
|
| 214 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
| 215 | 215 | } |
| 216 | - $chosen = give_get_default_gateway( $form_id ); |
|
| 216 | + $chosen = give_get_default_gateway($form_id); |
|
| 217 | 217 | $enabled_gateway = ''; |
| 218 | 218 | |
| 219 | 219 | //Take into account request Form ID args |
| 220 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
| 221 | - $chosen = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : ''; |
|
| 220 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
| 221 | + $chosen = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : ''; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if ( $chosen ) { |
|
| 225 | - $enabled_gateway = urldecode( $chosen ); |
|
| 226 | - } else if ( count( $gateways ) >= 1 && ! $chosen ) { |
|
| 227 | - foreach ( $gateways as $gateway_id => $gateway ): |
|
| 224 | + if ($chosen) { |
|
| 225 | + $enabled_gateway = urldecode($chosen); |
|
| 226 | + } else if (count($gateways) >= 1 && ! $chosen) { |
|
| 227 | + foreach ($gateways as $gateway_id => $gateway): |
|
| 228 | 228 | $enabled_gateway = $gateway_id; |
| 229 | 229 | endforeach; |
| 230 | 230 | } else { |
| 231 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
| 231 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
| 235 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
| 235 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @return int ID of the new log entry |
| 251 | 251 | */ |
| 252 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
| 253 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
| 252 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
| 253 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @return int |
| 265 | 265 | */ |
| 266 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
| 266 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
| 267 | 267 | |
| 268 | 268 | $ret = 0; |
| 269 | 269 | $args = array( |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | 'fields' => 'ids' |
| 276 | 276 | ); |
| 277 | 277 | |
| 278 | - $payments = new WP_Query( $args ); |
|
| 278 | + $payments = new WP_Query($args); |
|
| 279 | 279 | |
| 280 | - if ( $payments ) { |
|
| 280 | + if ($payments) { |
|
| 281 | 281 | $ret = $payments->post_count; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -294,27 +294,27 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @return array $gateways All the available gateways |
| 296 | 296 | */ |
| 297 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
| 297 | +function give_get_ordered_payment_gateways($gateways) { |
|
| 298 | 298 | |
| 299 | 299 | // Get gateways setting. |
| 300 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
| 300 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
| 301 | 301 | |
| 302 | 302 | // Return from here if we do not have gateways setting. |
| 303 | - if ( empty( $gateways_setting ) ) { |
|
| 303 | + if (empty($gateways_setting)) { |
|
| 304 | 304 | return $gateways; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // Reverse array to order payment gateways. |
| 308 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
| 308 | + $gateways_setting = array_reverse($gateways_setting); |
|
| 309 | 309 | |
| 310 | 310 | // Reorder gateways array |
| 311 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
| 311 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
| 312 | 312 | |
| 313 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
| 314 | - unset( $gateways[ $gateway_key ] ); |
|
| 313 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
| 314 | + unset($gateways[$gateway_key]); |
|
| 315 | 315 | |
| 316 | - if ( ! empty( $new_gateway_value ) ) { |
|
| 317 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
| 316 | + if ( ! empty($new_gateway_value)) { |
|
| 317 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | |
@@ -325,5 +325,5 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | * @param array $gateways All the available gateways |
| 327 | 327 | */ |
| 328 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
| 328 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
| 329 | 329 | } |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return array |
| 20 | 20 | */ |
| 21 | -function give_offline_register_gateway( $gateways ) { |
|
| 21 | +function give_offline_register_gateway($gateways) { |
|
| 22 | 22 | // Format: ID => Name |
| 23 | 23 | $gateways['offline'] = array( |
| 24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
| 25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
| 24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
| 25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | 28 | return $gateways; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
| 31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return void |
| 42 | 42 | */ |
| 43 | -function give_offline_payment_cc_form( $form_id ) { |
|
| 43 | +function give_offline_payment_cc_form($form_id) { |
|
| 44 | 44 | |
| 45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
| 46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
| 47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
| 45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
| 46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
| 47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
| 48 | 48 | $offline_instructions = $global_offline_instruction; |
| 49 | 49 | |
| 50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
| 50 | + if ($post_offline_customization_option == 'yes') { |
|
| 51 | 51 | $offline_instructions = $post_offline_instructions; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param int $form_id Give form id. |
| 62 | 62 | */ |
| 63 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
| 63 | + do_action('give_before_offline_info_fields', $form_id); |
|
| 64 | 64 | ?> |
| 65 | 65 | <fieldset id="give_offline_payment_info"> |
| 66 | 66 | <?php |
| 67 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
| 67 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
| 68 | 68 | /* translators: %s: form settings url */ |
| 69 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
| 70 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
| 69 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
| 70 | + echo wpautop(stripslashes($offline_instructions)); |
|
| 71 | 71 | ?> |
| 72 | 72 | </fieldset> |
| 73 | 73 | <?php |
@@ -78,34 +78,34 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param int $form_id Give form id. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
| 81 | + do_action('give_after_offline_info_fields', $form_id); |
|
| 82 | 82 | |
| 83 | 83 | echo ob_get_clean(); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
| 86 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Give Offline Billing Field |
| 90 | 90 | * |
| 91 | 91 | * @param $form_id |
| 92 | 92 | */ |
| 93 | -function give_offline_billing_fields( $form_id ) { |
|
| 93 | +function give_offline_billing_fields($form_id) { |
|
| 94 | 94 | //Enable Default CC fields (billing info) |
| 95 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
| 96 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
| 95 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
| 96 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
| 97 | 97 | |
| 98 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
| 98 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
| 99 | 99 | |
| 100 | 100 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
| 101 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
| 102 | - give_default_cc_address_fields( $form_id ); |
|
| 103 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
| 104 | - give_default_cc_address_fields( $form_id ); |
|
| 101 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
| 102 | + give_default_cc_address_fields($form_id); |
|
| 103 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
| 104 | + give_default_cc_address_fields($form_id); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
| 108 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * Process the payment |
@@ -116,16 +116,16 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return void |
| 118 | 118 | */ |
| 119 | -function give_offline_process_payment( $purchase_data ) { |
|
| 119 | +function give_offline_process_payment($purchase_data) { |
|
| 120 | 120 | |
| 121 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
| 121 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
| 122 | 122 | |
| 123 | 123 | // setup the payment details |
| 124 | 124 | $payment_data = array( |
| 125 | 125 | 'price' => $purchase_data['price'], |
| 126 | 126 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
| 127 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
| 128 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
| 127 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
| 128 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
| 129 | 129 | 'date' => $purchase_data['date'], |
| 130 | 130 | 'user_email' => $purchase_data['user_email'], |
| 131 | 131 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -137,20 +137,20 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | // record the pending payment |
| 140 | - $payment = give_insert_payment( $payment_data ); |
|
| 140 | + $payment = give_insert_payment($payment_data); |
|
| 141 | 141 | |
| 142 | - if ( $payment ) { |
|
| 143 | - give_offline_send_admin_notice( $payment ); |
|
| 144 | - give_offline_send_donor_instructions( $payment ); |
|
| 142 | + if ($payment) { |
|
| 143 | + give_offline_send_admin_notice($payment); |
|
| 144 | + give_offline_send_donor_instructions($payment); |
|
| 145 | 145 | give_send_to_success_page(); |
| 146 | 146 | } else { |
| 147 | 147 | // if errors are present, send the user back to the donation form so they can be corrected |
| 148 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
| 148 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
| 153 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -163,59 +163,59 @@ discard block |
||
| 163 | 163 | * @since 1.0 |
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
| 166 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
| 167 | 167 | |
| 168 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
| 169 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
| 168 | + $payment_data = give_get_payment_meta($payment_id); |
|
| 169 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
| 170 | 170 | |
| 171 | 171 | //Customize email content depending on whether the single form has been customized |
| 172 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
| 172 | + $email_content = give_get_option('global_offline_donation_email'); |
|
| 173 | 173 | |
| 174 | - if ( $post_offline_customization_option === 'yes' ) { |
|
| 175 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
| 174 | + if ($post_offline_customization_option === 'yes') { |
|
| 175 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
| 178 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Filters the from name. |
| 182 | 182 | * |
| 183 | 183 | * @since 1.7 |
| 184 | 184 | */ |
| 185 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
| 185 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
| 186 | 186 | |
| 187 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
| 187 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * Filters the from email. |
| 191 | 191 | * |
| 192 | 192 | * @since 1.7 |
| 193 | 193 | */ |
| 194 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
| 194 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
| 195 | 195 | |
| 196 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
| 196 | + $to_email = give_get_payment_user_email($payment_id); |
|
| 197 | 197 | |
| 198 | - $subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
| 199 | - if ( $post_offline_customization_option === 'yes' ) { |
|
| 200 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
| 198 | + $subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give')); |
|
| 199 | + if ($post_offline_customization_option === 'yes') { |
|
| 200 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
| 204 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
| 203 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
| 204 | + $subject = give_do_email_tags($subject, $payment_id); |
|
| 205 | 205 | |
| 206 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
| 207 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
| 206 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
| 207 | + $message = give_do_email_tags($email_content, $payment_id); |
|
| 208 | 208 | |
| 209 | 209 | $emails = Give()->emails; |
| 210 | 210 | |
| 211 | - $emails->__set( 'from_name', $from_name ); |
|
| 212 | - $emails->__set( 'from_email', $from_email ); |
|
| 213 | - $emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
| 211 | + $emails->__set('from_name', $from_name); |
|
| 212 | + $emails->__set('from_email', $from_email); |
|
| 213 | + $emails->__set('heading', esc_html__('Offline Donation Instructions', 'give')); |
|
| 214 | 214 | |
| 215 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
| 216 | - $emails->__set( 'headers', $headers ); |
|
| 215 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
| 216 | + $emails->__set('headers', $headers); |
|
| 217 | 217 | |
| 218 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
| 218 | + $emails->send($to_email, $subject, $message, $attachments); |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
@@ -232,52 +232,52 @@ discard block |
||
| 232 | 232 | * @return void |
| 233 | 233 | * |
| 234 | 234 | */ |
| 235 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
| 235 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
| 236 | 236 | |
| 237 | 237 | /* Send an email notification to the admin */ |
| 238 | 238 | $admin_email = give_get_admin_notice_emails(); |
| 239 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 239 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
| 240 | 240 | |
| 241 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
| 242 | - $user_data = get_userdata( $user_info['id'] ); |
|
| 241 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
| 242 | + $user_data = get_userdata($user_info['id']); |
|
| 243 | 243 | $name = $user_data->display_name; |
| 244 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
| 245 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 244 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
| 245 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
| 246 | 246 | } else { |
| 247 | 247 | $name = $user_info['email']; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
| 250 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
| 251 | 251 | |
| 252 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
| 252 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
| 253 | 253 | |
| 254 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
| 255 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' '; |
|
| 256 | - $admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
| 254 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
| 255 | + $admin_message .= esc_attr__('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' '; |
|
| 256 | + $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - $admin_message .= '<strong>' . esc_attr__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
| 260 | - $admin_message .= '<strong>' . esc_attr__( 'Amount:', 'give' ) . '</strong> {price}' . "\n\n"; |
|
| 259 | + $admin_message .= '<strong>'.esc_attr__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
| 260 | + $admin_message .= '<strong>'.esc_attr__('Amount:', 'give').'</strong> {price}'."\n\n"; |
|
| 261 | 261 | |
| 262 | 262 | $admin_message .= sprintf( |
| 263 | 263 | '<a href="%1$s">%2$s</a>', |
| 264 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
| 265 | - esc_html__( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
| 266 | - ) . "\n\n"; |
|
| 264 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
| 265 | + esc_html__('Click Here to View and/or Update Donation Details', 'give') |
|
| 266 | + )."\n\n"; |
|
| 267 | 267 | |
| 268 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
| 269 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
| 268 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
| 269 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
| 270 | 270 | |
| 271 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
| 272 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
| 271 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
| 272 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
| 273 | 273 | |
| 274 | 274 | //Send Email |
| 275 | 275 | $emails = Give()->emails; |
| 276 | - if ( ! empty( $admin_headers ) ) { |
|
| 277 | - $emails->__set( 'headers', $admin_headers ); |
|
| 276 | + if ( ! empty($admin_headers)) { |
|
| 277 | + $emails->__set('headers', $admin_headers); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
| 280 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
| 281 | 281 | |
| 282 | 282 | } |
| 283 | 283 | |
@@ -288,15 +288,15 @@ discard block |
||
| 288 | 288 | * @since 1.0 |
| 289 | 289 | * @return array |
| 290 | 290 | */ |
| 291 | -function give_offline_add_settings( $settings ) { |
|
| 291 | +function give_offline_add_settings($settings) { |
|
| 292 | 292 | |
| 293 | 293 | //Vars |
| 294 | 294 | $prefix = '_give_'; |
| 295 | 295 | |
| 296 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
| 296 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
| 297 | 297 | |
| 298 | 298 | //this gateway isn't active |
| 299 | - if ( ! $is_gateway_active ) { |
|
| 299 | + if ( ! $is_gateway_active) { |
|
| 300 | 300 | //return settings and bounce |
| 301 | 301 | return $settings; |
| 302 | 302 | } |
@@ -305,27 +305,27 @@ discard block |
||
| 305 | 305 | $check_settings = array( |
| 306 | 306 | |
| 307 | 307 | array( |
| 308 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
| 309 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
| 310 | - 'id' => $prefix . 'customize_offline_donations', |
|
| 308 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
| 309 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
| 310 | + 'id' => $prefix.'customize_offline_donations', |
|
| 311 | 311 | 'type' => 'radio_inline', |
| 312 | 312 | 'default' => 'no', |
| 313 | 313 | 'options' => array( |
| 314 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
| 315 | - 'no' => esc_attr__( 'No', 'give' ), |
|
| 314 | + 'yes' => esc_attr__('Yes', 'give'), |
|
| 315 | + 'no' => esc_attr__('No', 'give'), |
|
| 316 | 316 | ), |
| 317 | 317 | ), |
| 318 | 318 | array( |
| 319 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
| 320 | - 'desc' => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
| 321 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
| 319 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
| 320 | + 'desc' => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
| 321 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
| 322 | 322 | 'row_classes' => 'give-subfield', |
| 323 | 323 | 'type' => 'checkbox' |
| 324 | 324 | ), |
| 325 | 325 | array( |
| 326 | - 'id' => $prefix . 'offline_checkout_notes', |
|
| 327 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
| 328 | - 'desc' => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
| 326 | + 'id' => $prefix.'offline_checkout_notes', |
|
| 327 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
| 328 | + 'desc' => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
| 329 | 329 | 'default' => give_get_default_offline_donation_content(), |
| 330 | 330 | 'type' => 'wysiwyg', |
| 331 | 331 | 'row_classes' => 'give-subfield', |
@@ -334,17 +334,17 @@ discard block |
||
| 334 | 334 | ) |
| 335 | 335 | ), |
| 336 | 336 | array( |
| 337 | - 'id' => $prefix . 'offline_donation_subject', |
|
| 338 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
| 339 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
| 340 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
| 337 | + 'id' => $prefix.'offline_donation_subject', |
|
| 338 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
| 339 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
| 340 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
| 341 | 341 | 'row_classes' => 'give-subfield', |
| 342 | 342 | 'type' => 'text' |
| 343 | 343 | ), |
| 344 | 344 | array( |
| 345 | - 'id' => $prefix . 'offline_donation_email', |
|
| 346 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
| 347 | - 'desc' => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
| 345 | + 'id' => $prefix.'offline_donation_email', |
|
| 346 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
| 347 | + 'desc' => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
| 348 | 348 | 'default' => give_get_default_offline_donation_email_content(), |
| 349 | 349 | 'type' => 'wysiwyg', |
| 350 | 350 | 'row_classes' => 'give-subfield', |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | ) |
| 355 | 355 | ); |
| 356 | 356 | |
| 357 | - return array_merge( $settings, $check_settings ); |
|
| 357 | + return array_merge($settings, $check_settings); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
| 360 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -369,32 +369,32 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | function give_get_default_offline_donation_content() { |
| 371 | 371 | |
| 372 | - $sitename = get_bloginfo( 'sitename' ); |
|
| 372 | + $sitename = get_bloginfo('sitename'); |
|
| 373 | 373 | |
| 374 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
| 374 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
| 375 | 375 | $default_text .= '<ol>'; |
| 376 | 376 | $default_text .= '<li>'; |
| 377 | 377 | $default_text .= sprintf( |
| 378 | 378 | /* translators: %s: site name */ |
| 379 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
| 379 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
| 380 | 380 | $sitename |
| 381 | 381 | ); |
| 382 | 382 | $default_text .= '</li>'; |
| 383 | 383 | $default_text .= '<li>'; |
| 384 | 384 | $default_text .= sprintf( |
| 385 | 385 | /* translators: %s: site name */ |
| 386 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
| 386 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
| 387 | 387 | $sitename |
| 388 | 388 | ); |
| 389 | 389 | $default_text .= '</li>'; |
| 390 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
| 390 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
| 391 | 391 | $default_text .= '</ol>'; |
| 392 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
| 392 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
| 393 | 393 | $default_text .= ' <em>123 G Street </em><br>'; |
| 394 | 394 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
| 395 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
| 395 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
| 396 | 396 | |
| 397 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
| 397 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
| 398 | 398 | |
| 399 | 399 | } |
| 400 | 400 | |
@@ -407,33 +407,33 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | function give_get_default_offline_donation_email_content() { |
| 409 | 409 | |
| 410 | - $sitename = get_bloginfo( 'sitename' ); |
|
| 411 | - $default_text = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>'; |
|
| 412 | - $default_text .= '<p>' . esc_html__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
| 410 | + $sitename = get_bloginfo('sitename'); |
|
| 411 | + $default_text = '<p>'.esc_html__('Dear {name},', 'give').'</p>'; |
|
| 412 | + $default_text .= '<p>'.esc_html__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
| 413 | 413 | $default_text .= '<ol>'; |
| 414 | 414 | $default_text .= '<li>'; |
| 415 | 415 | $default_text .= sprintf( |
| 416 | 416 | /* translators: %s: site name */ |
| 417 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
| 417 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
| 418 | 418 | $sitename |
| 419 | 419 | ); |
| 420 | 420 | $default_text .= '</li>'; |
| 421 | 421 | $default_text .= '<li>'; |
| 422 | 422 | $default_text .= sprintf( |
| 423 | 423 | /* translators: %s: site name */ |
| 424 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
| 424 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
| 425 | 425 | $sitename |
| 426 | 426 | ); |
| 427 | 427 | $default_text .= '</li>'; |
| 428 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
| 428 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
| 429 | 429 | $default_text .= '</ol>'; |
| 430 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
| 430 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
| 431 | 431 | $default_text .= ' <em>123 G Street </em><br>'; |
| 432 | 432 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
| 433 | - $default_text .= '<p>' . esc_html__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
| 434 | - $default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>'; |
|
| 435 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
| 433 | + $default_text .= '<p>'.esc_html__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
| 434 | + $default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>'; |
|
| 435 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
| 436 | 436 | |
| 437 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
| 437 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
| 438 | 438 | |
| 439 | 439 | } |
@@ -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,9 +23,9 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function give_get_country() { |
| 25 | 25 | $give_options = give_get_settings(); |
| 26 | - $country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US'; |
|
| 26 | + $country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US'; |
|
| 27 | 27 | |
| 28 | - return apply_filters( 'give_give_country', $country ); |
|
| 28 | + return apply_filters('give_give_country', $country); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function give_get_state() { |
| 38 | 38 | $give_options = give_get_settings(); |
| 39 | - $state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false; |
|
| 39 | + $state = isset($give_options['base_state']) ? $give_options['base_state'] : false; |
|
| 40 | 40 | |
| 41 | - return apply_filters( 'give_give_state', $state ); |
|
| 41 | + return apply_filters('give_give_state', $state); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return mixed|void A list of states for the shop's base country |
| 52 | 52 | */ |
| 53 | -function give_get_states( $country = null ) { |
|
| 53 | +function give_get_states($country = null) { |
|
| 54 | 54 | |
| 55 | - if ( empty( $country ) ) { |
|
| 55 | + if (empty($country)) { |
|
| 56 | 56 | $country = give_get_country(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - switch ( $country ) : |
|
| 59 | + switch ($country) : |
|
| 60 | 60 | |
| 61 | 61 | case 'US' : |
| 62 | 62 | $states = give_get_states_list(); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | endswitch; |
| 108 | 108 | |
| 109 | - return apply_filters( 'give_give_states', $states ); |
|
| 109 | + return apply_filters('give_give_states', $states); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
@@ -119,253 +119,253 @@ discard block |
||
| 119 | 119 | function give_get_country_list() { |
| 120 | 120 | $countries = array( |
| 121 | 121 | '' => '', |
| 122 | - 'US' => esc_html__( 'United States', 'give' ), |
|
| 123 | - 'CA' => esc_html__( 'Canada', 'give' ), |
|
| 124 | - 'GB' => esc_html__( 'United Kingdom', 'give' ), |
|
| 125 | - 'AF' => esc_html__( 'Afghanistan', 'give' ), |
|
| 126 | - 'AL' => esc_html__( 'Albania', 'give' ), |
|
| 127 | - 'DZ' => esc_html__( 'Algeria', 'give' ), |
|
| 128 | - 'AS' => esc_html__( 'American Samoa', 'give' ), |
|
| 129 | - 'AD' => esc_html__( 'Andorra', 'give' ), |
|
| 130 | - 'AO' => esc_html__( 'Angola', 'give' ), |
|
| 131 | - 'AI' => esc_html__( 'Anguilla', 'give' ), |
|
| 132 | - 'AQ' => esc_html__( 'Antarctica', 'give' ), |
|
| 133 | - 'AG' => esc_html__( 'Antigua and Barbuda', 'give' ), |
|
| 134 | - 'AR' => esc_html__( 'Argentina', 'give' ), |
|
| 135 | - 'AM' => esc_html__( 'Armenia', 'give' ), |
|
| 136 | - 'AW' => esc_html__( 'Aruba', 'give' ), |
|
| 137 | - 'AU' => esc_html__( 'Australia', 'give' ), |
|
| 138 | - 'AT' => esc_html__( 'Austria', 'give' ), |
|
| 139 | - 'AZ' => esc_html__( 'Azerbaijan', 'give' ), |
|
| 140 | - 'BS' => esc_html__( 'Bahamas', 'give'), |
|
| 141 | - 'BH' => esc_html__( 'Bahrain', 'give' ), |
|
| 142 | - 'BD' => esc_html__( 'Bangladesh', 'give' ), |
|
| 143 | - 'BB' => esc_html__( 'Barbados', 'give' ), |
|
| 144 | - 'BY' => esc_html__( 'Belarus', 'give' ), |
|
| 145 | - 'BE' => esc_html__( 'Belgium', 'give' ), |
|
| 146 | - 'BZ' => esc_html__( 'Belize', 'give' ), |
|
| 147 | - 'BJ' => esc_html__( 'Benin', 'give' ), |
|
| 148 | - 'BM' => esc_html__( 'Bermuda', 'give' ), |
|
| 149 | - 'BT' => esc_html__( 'Bhutan', 'give' ), |
|
| 150 | - 'BO' => esc_html__( 'Bolivia', 'give' ), |
|
| 151 | - 'BA' => esc_html__( 'Bosnia and Herzegovina', 'give' ), |
|
| 152 | - 'BW' => esc_html__( 'Botswana', 'give' ), |
|
| 153 | - 'BV' => esc_html__( 'Bouvet Island', 'give' ), |
|
| 154 | - 'BR' => esc_html__( 'Brazil', 'give' ), |
|
| 155 | - 'IO' => esc_html__( 'British Indian Ocean Territory', 'give' ), |
|
| 156 | - 'BN' => esc_html__( 'Brunei Darrussalam', 'give' ), |
|
| 157 | - 'BG' => esc_html__( 'Bulgaria', 'give' ), |
|
| 158 | - 'BF' => esc_html__( 'Burkina Faso', 'give' ), |
|
| 159 | - 'BI' => esc_html__( 'Burundi', 'give' ), |
|
| 160 | - 'KH' => esc_html__( 'Cambodia', 'give' ), |
|
| 161 | - 'CM' => esc_html__( 'Cameroon', 'give' ), |
|
| 162 | - 'CV' => esc_html__( 'Cape Verde', 'give' ), |
|
| 163 | - 'KY' => esc_html__( 'Cayman Islands', 'give' ), |
|
| 164 | - 'CF' => esc_html__( 'Central African Republic', 'give' ), |
|
| 165 | - 'TD' => esc_html__( 'Chad', 'give' ), |
|
| 166 | - 'CL' => esc_html__( 'Chile', 'give' ), |
|
| 167 | - 'CN' => esc_html__( 'China', 'give' ), |
|
| 168 | - 'CX' => esc_html__( 'Christmas Island', 'give' ), |
|
| 169 | - 'CC' => esc_html__( 'Cocos Islands', 'give' ), |
|
| 170 | - 'CO' => esc_html__( 'Colombia', 'give' ), |
|
| 171 | - 'KM' => esc_html__( 'Comoros', 'give' ), |
|
| 172 | - 'CD' => esc_html__( 'Congo, Democratic People\'s Republic', 'give' ), |
|
| 173 | - 'CG' => esc_html__( 'Congo, Republic of', 'give' ), |
|
| 174 | - 'CK' => esc_html__( 'Cook Islands', 'give' ), |
|
| 175 | - 'CR' => esc_html__( 'Costa Rica', 'give' ), |
|
| 176 | - 'CI' => esc_html__( 'Cote d\'Ivoire', 'give' ), |
|
| 177 | - 'HR' => esc_html__( 'Croatia/Hrvatska', 'give' ), |
|
| 178 | - 'CU' => esc_html__( 'Cuba', 'give' ), |
|
| 179 | - 'CY' => esc_html__( 'Cyprus Island', 'give' ), |
|
| 180 | - 'CZ' => esc_html__( 'Czech Republic', 'give' ), |
|
| 181 | - 'DK' => esc_html__( 'Denmark', 'give' ), |
|
| 182 | - 'DJ' => esc_html__( 'Djibouti', 'give' ), |
|
| 183 | - 'DM' => esc_html__( 'Dominica', 'give' ), |
|
| 184 | - 'DO' => esc_html__( 'Dominican Republic', 'give' ), |
|
| 185 | - 'TP' => esc_html__( 'East Timor', 'give' ), |
|
| 186 | - 'EC' => esc_html__( 'Ecuador', 'give' ), |
|
| 187 | - 'EG' => esc_html__( 'Egypt', 'give' ), |
|
| 188 | - 'GQ' => esc_html__( 'Equatorial Guinea', 'give' ), |
|
| 189 | - 'SV' => esc_html__( 'El Salvador', 'give' ), |
|
| 190 | - 'ER' => esc_html__( 'Eritrea', 'give' ), |
|
| 191 | - 'EE' => esc_html__( 'Estonia', 'give' ), |
|
| 192 | - 'ET' => esc_html__( 'Ethiopia', 'give' ), |
|
| 193 | - 'FK' => esc_html__( 'Falkland Islands', 'give' ), |
|
| 194 | - 'FO' => esc_html__( 'Faroe Islands', 'give' ), |
|
| 195 | - 'FJ' => esc_html__( 'Fiji', 'give' ), |
|
| 196 | - 'FI' => esc_html__( 'Finland', 'give' ), |
|
| 197 | - 'FR' => esc_html__( 'France', 'give' ), |
|
| 198 | - 'GF' => esc_html__( 'French Guiana', 'give' ), |
|
| 199 | - 'PF' => esc_html__( 'French Polynesia', 'give' ), |
|
| 200 | - 'TF' => esc_html__( 'French Southern Territories', 'give' ), |
|
| 201 | - 'GA' => esc_html__( 'Gabon', 'give' ), |
|
| 202 | - 'GM' => esc_html__( 'Gambia', 'give' ), |
|
| 203 | - 'GE' => esc_html__( 'Georgia', 'give' ), |
|
| 204 | - 'DE' => esc_html__( 'Germany', 'give' ), |
|
| 205 | - 'GR' => esc_html__( 'Greece', 'give' ), |
|
| 206 | - 'GH' => esc_html__( 'Ghana', 'give' ), |
|
| 207 | - 'GI' => esc_html__( 'Gibraltar', 'give' ), |
|
| 208 | - 'GL' => esc_html__( 'Greenland', 'give' ), |
|
| 209 | - 'GD' => esc_html__( 'Grenada', 'give' ), |
|
| 210 | - 'GP' => esc_html__( 'Guadeloupe', 'give' ), |
|
| 211 | - 'GU' => esc_html__( 'Guam', 'give' ), |
|
| 212 | - 'GT' => esc_html__( 'Guatemala', 'give' ), |
|
| 213 | - 'GG' => esc_html__( 'Guernsey', 'give' ), |
|
| 214 | - 'GN' => esc_html__( 'Guinea', 'give' ), |
|
| 215 | - 'GW' => esc_html__( 'Guinea-Bissau', 'give' ), |
|
| 216 | - 'GY' => esc_html__( 'Guyana', 'give' ), |
|
| 217 | - 'HT' => esc_html__( 'Haiti', 'give' ), |
|
| 218 | - 'HM' => esc_html__( 'Heard and McDonald Islands', 'give' ), |
|
| 219 | - 'VA' => esc_html__( 'Holy See (City Vatican State)', 'give' ), |
|
| 220 | - 'HN' => esc_html__( 'Honduras', 'give' ), |
|
| 221 | - 'HK' => esc_html__( 'Hong Kong', 'give' ), |
|
| 222 | - 'HU' => esc_html__( 'Hungary', 'give' ), |
|
| 223 | - 'IS' => esc_html__( 'Iceland', 'give' ), |
|
| 224 | - 'IN' => esc_html__( 'India', 'give' ), |
|
| 225 | - 'ID' => esc_html__( 'Indonesia', 'give' ), |
|
| 226 | - 'IR' => esc_html__( 'Iran', 'give' ), |
|
| 227 | - 'IQ' => esc_html__( 'Iraq', 'give' ), |
|
| 228 | - 'IE' => esc_html__( 'Ireland', 'give' ), |
|
| 229 | - 'IM' => esc_html__( 'Isle of Man', 'give' ), |
|
| 230 | - 'IL' => esc_html__( 'Israel', 'give' ), |
|
| 231 | - 'IT' => esc_html__( 'Italy', 'give' ), |
|
| 232 | - 'JM' => esc_html__( 'Jamaica', 'give' ), |
|
| 233 | - 'JP' => esc_html__( 'Japan', 'give' ), |
|
| 234 | - 'JE' => esc_html__( 'Jersey', 'give' ), |
|
| 235 | - 'JO' => esc_html__( 'Jordan', 'give' ), |
|
| 236 | - 'KZ' => esc_html__( 'Kazakhstan', 'give' ), |
|
| 237 | - 'KE' => esc_html__( 'Kenya', 'give' ), |
|
| 238 | - 'KI' => esc_html__( 'Kiribati', 'give' ), |
|
| 239 | - 'KW' => esc_html__( 'Kuwait', 'give' ), |
|
| 240 | - 'KG' => esc_html__( 'Kyrgyzstan', 'give' ), |
|
| 241 | - 'LA' => esc_html__( 'Lao People\'s Democratic Republic', 'give' ), |
|
| 242 | - 'LV' => esc_html__( 'Latvia', 'give' ), |
|
| 243 | - 'LB' => esc_html__( 'Lebanon', 'give' ), |
|
| 244 | - 'LS' => esc_html__( 'Lesotho', 'give' ), |
|
| 245 | - 'LR' => esc_html__( 'Liberia', 'give' ), |
|
| 246 | - 'LY' => esc_html__( 'Libyan Arab Jamahiriya', 'give' ), |
|
| 247 | - 'LI' => esc_html__( 'Liechtenstein', 'give' ), |
|
| 248 | - 'LT' => esc_html__( 'Lithuania', 'give' ), |
|
| 249 | - 'LU' => esc_html__( 'Luxembourg', 'give' ), |
|
| 250 | - 'MO' => esc_html__( 'Macau', 'give' ), |
|
| 251 | - 'MK' => esc_html__( 'Macedonia', 'give' ), |
|
| 252 | - 'MG' => esc_html__( 'Madagascar', 'give' ), |
|
| 253 | - 'MW' => esc_html__( 'Malawi', 'give' ), |
|
| 254 | - 'MY' => esc_html__( 'Malaysia', 'give' ), |
|
| 255 | - 'MV' => esc_html__( 'Maldives', 'give' ), |
|
| 256 | - 'ML' => esc_html__( 'Mali', 'give' ), |
|
| 257 | - 'MT' => esc_html__( 'Malta', 'give' ), |
|
| 258 | - 'MH' => esc_html__( 'Marshall Islands', 'give' ), |
|
| 259 | - 'MQ' => esc_html__( 'Martinique', 'give' ), |
|
| 260 | - 'MR' => esc_html__( 'Mauritania', 'give' ), |
|
| 261 | - 'MU' => esc_html__( 'Mauritius', 'give' ), |
|
| 262 | - 'YT' => esc_html__( 'Mayotte', 'give' ), |
|
| 263 | - 'MX' => esc_html__( 'Mexico', 'give' ), |
|
| 264 | - 'FM' => esc_html__( 'Micronesia', 'give' ), |
|
| 265 | - 'MD' => esc_html__( 'Moldova, Republic of', 'give' ), |
|
| 266 | - 'MC' => esc_html__( 'Monaco', 'give' ), |
|
| 267 | - 'MN' => esc_html__( 'Mongolia', 'give' ), |
|
| 268 | - 'ME' => esc_html__( 'Montenegro', 'give' ), |
|
| 269 | - 'MS' => esc_html__( 'Montserrat', 'give' ), |
|
| 270 | - 'MA' => esc_html__( 'Morocco', 'give' ), |
|
| 271 | - 'MZ' => esc_html__( 'Mozambique', 'give' ), |
|
| 272 | - 'MM' => esc_html__( 'Myanmar', 'give' ), |
|
| 273 | - 'NA' => esc_html__( 'Namibia', 'give' ), |
|
| 274 | - 'NR' => esc_html__( 'Nauru', 'give' ), |
|
| 275 | - 'NP' => esc_html__( 'Nepal', 'give' ), |
|
| 276 | - 'NL' => esc_html__( 'Netherlands', 'give' ), |
|
| 277 | - 'AN' => esc_html__( 'Netherlands Antilles', 'give' ), |
|
| 278 | - 'NC' => esc_html__( 'New Caledonia', 'give' ), |
|
| 279 | - 'NZ' => esc_html__( 'New Zealand', 'give' ), |
|
| 280 | - 'NI' => esc_html__( 'Nicaragua', 'give' ), |
|
| 281 | - 'NE' => esc_html__( 'Niger', 'give' ), |
|
| 282 | - 'NG' => esc_html__( 'Nigeria', 'give' ), |
|
| 283 | - 'NU' => esc_html__( 'Niue', 'give' ), |
|
| 284 | - 'NF' => esc_html__( 'Norfolk Island', 'give' ), |
|
| 285 | - 'KP' => esc_html__( 'North Korea', 'give' ), |
|
| 286 | - 'MP' => esc_html__( 'Northern Mariana Islands', 'give' ), |
|
| 287 | - 'NO' => esc_html__( 'Norway', 'give' ), |
|
| 288 | - 'OM' => esc_html__( 'Oman', 'give' ), |
|
| 289 | - 'PK' => esc_html__( 'Pakistan', 'give' ), |
|
| 290 | - 'PW' => esc_html__( 'Palau', 'give' ), |
|
| 291 | - 'PS' => esc_html__( 'Palestinian Territories', 'give' ), |
|
| 292 | - 'PA' => esc_html__( 'Panama', 'give' ), |
|
| 293 | - 'PG' => esc_html__( 'Papua New Guinea', 'give' ), |
|
| 294 | - 'PY' => esc_html__( 'Paraguay', 'give' ), |
|
| 295 | - 'PE' => esc_html__( 'Peru', 'give' ), |
|
| 296 | - 'PH' => esc_html__( 'Phillipines', 'give' ), |
|
| 297 | - 'PN' => esc_html__( 'Pitcairn Island', 'give' ), |
|
| 298 | - 'PL' => esc_html__( 'Poland', 'give' ), |
|
| 299 | - 'PT' => esc_html__( 'Portugal', 'give' ), |
|
| 300 | - 'PR' => esc_html__( 'Puerto Rico', 'give' ), |
|
| 301 | - 'QA' => esc_html__( 'Qatar', 'give' ), |
|
| 302 | - 'RE' => esc_html__( 'Reunion Island', 'give' ), |
|
| 303 | - 'RO' => esc_html__( 'Romania', 'give' ), |
|
| 304 | - 'RU' => esc_html__( 'Russian Federation', 'give' ), |
|
| 305 | - 'RW' => esc_html__( 'Rwanda', 'give' ), |
|
| 306 | - 'SH' => esc_html__( 'Saint Helena', 'give' ), |
|
| 307 | - 'KN' => esc_html__( 'Saint Kitts and Nevis', 'give' ), |
|
| 308 | - 'LC' => esc_html__( 'Saint Lucia', 'give' ), |
|
| 309 | - 'PM' => esc_html__( 'Saint Pierre and Miquelon', 'give' ), |
|
| 310 | - 'VC' => esc_html__( 'Saint Vincent and the Grenadines', 'give' ), |
|
| 311 | - 'SM' => esc_html__( 'San Marino', 'give' ), |
|
| 312 | - 'ST' => esc_html__( 'Sao Tome and Principe', 'give' ), |
|
| 313 | - 'SA' => esc_html__( 'Saudi Arabia', 'give' ), |
|
| 314 | - 'SN' => esc_html__( 'Senegal', 'give' ), |
|
| 315 | - 'RS' => esc_html__( 'Serbia', 'give' ), |
|
| 316 | - 'SC' => esc_html__( 'Seychelles', 'give' ), |
|
| 317 | - 'SL' => esc_html__( 'Sierra Leone', 'give' ), |
|
| 318 | - 'SG' => esc_html__( 'Singapore', 'give' ), |
|
| 319 | - 'SK' => esc_html__( 'Slovak Republic', 'give' ), |
|
| 320 | - 'SI' => esc_html__( 'Slovenia', 'give' ), |
|
| 321 | - 'SB' => esc_html__( 'Solomon Islands', 'give' ), |
|
| 322 | - 'SO' => esc_html__( 'Somalia', 'give' ), |
|
| 323 | - 'ZA' => esc_html__( 'South Africa', 'give' ), |
|
| 324 | - 'GS' => esc_html__( 'South Georgia', 'give' ), |
|
| 325 | - 'KR' => esc_html__( 'South Korea', 'give' ), |
|
| 326 | - 'ES' => esc_html__( 'Spain', 'give' ), |
|
| 327 | - 'LK' => esc_html__( 'Sri Lanka', 'give' ), |
|
| 328 | - 'SD' => esc_html__( 'Sudan', 'give' ), |
|
| 329 | - 'SR' => esc_html__( 'Suriname', 'give' ), |
|
| 330 | - 'SJ' => esc_html__( 'Svalbard and Jan Mayen Islands', 'give' ), |
|
| 331 | - 'SZ' => esc_html__( 'Swaziland', 'give' ), |
|
| 332 | - 'SE' => esc_html__( 'Sweden', 'give' ), |
|
| 333 | - 'CH' => esc_html__( 'Switzerland', 'give' ), |
|
| 334 | - 'SY' => esc_html__( 'Syrian Arab Republic', 'give' ), |
|
| 335 | - 'TW' => esc_html__( 'Taiwan', 'give' ), |
|
| 336 | - 'TJ' => esc_html__( 'Tajikistan', 'give' ), |
|
| 337 | - 'TZ' => esc_html__( 'Tanzania', 'give' ), |
|
| 338 | - 'TG' => esc_html__( 'Togo', 'give' ), |
|
| 339 | - 'TK' => esc_html__( 'Tokelau', 'give' ), |
|
| 340 | - 'TO' => esc_html__( 'Tonga', 'give' ), |
|
| 341 | - 'TH' => esc_html__( 'Thailand', 'give' ), |
|
| 342 | - 'TT' => esc_html__( 'Trinidad and Tobago', 'give' ), |
|
| 343 | - 'TN' => esc_html__( 'Tunisia', 'give' ), |
|
| 344 | - 'TR' => esc_html__( 'Turkey', 'give' ), |
|
| 345 | - 'TM' => esc_html__( 'Turkmenistan', 'give' ), |
|
| 346 | - 'TC' => esc_html__( 'Turks and Caicos Islands', 'give' ), |
|
| 347 | - 'TV' => esc_html__( 'Tuvalu', 'give' ), |
|
| 348 | - 'UG' => esc_html__( 'Uganda', 'give' ), |
|
| 349 | - 'UA' => esc_html__( 'Ukraine', 'give' ), |
|
| 350 | - 'AE' => esc_html__( 'United Arab Emirates', 'give' ), |
|
| 351 | - 'UY' => esc_html__( 'Uruguay', 'give' ), |
|
| 352 | - 'UM' => esc_html__( 'US Minor Outlying Islands', 'give' ), |
|
| 353 | - 'UZ' => esc_html__( 'Uzbekistan', 'give' ), |
|
| 354 | - 'VU' => esc_html__( 'Vanuatu', 'give' ), |
|
| 355 | - 'VE' => esc_html__( 'Venezuela', 'give' ), |
|
| 356 | - 'VN' => esc_html__( 'Vietnam', 'give' ), |
|
| 357 | - 'VG' => esc_html__( 'Virgin Islands (British)', 'give' ), |
|
| 358 | - 'VI' => esc_html__( 'Virgin Islands (USA)', 'give' ), |
|
| 359 | - 'WF' => esc_html__( 'Wallis and Futuna Islands', 'give' ), |
|
| 360 | - 'EH' => esc_html__( 'Western Sahara', 'give' ), |
|
| 361 | - 'WS' => esc_html__( 'Western Samoa', 'give' ), |
|
| 362 | - 'YE' => esc_html__( 'Yemen', 'give' ), |
|
| 363 | - 'YU' => esc_html__( 'Yugoslavia', 'give' ), |
|
| 364 | - 'ZM' => esc_html__( 'Zambia', 'give' ), |
|
| 365 | - 'ZW' => esc_html__( 'Zimbabwe', 'give' ) |
|
| 122 | + 'US' => esc_html__('United States', 'give'), |
|
| 123 | + 'CA' => esc_html__('Canada', 'give'), |
|
| 124 | + 'GB' => esc_html__('United Kingdom', 'give'), |
|
| 125 | + 'AF' => esc_html__('Afghanistan', 'give'), |
|
| 126 | + 'AL' => esc_html__('Albania', 'give'), |
|
| 127 | + 'DZ' => esc_html__('Algeria', 'give'), |
|
| 128 | + 'AS' => esc_html__('American Samoa', 'give'), |
|
| 129 | + 'AD' => esc_html__('Andorra', 'give'), |
|
| 130 | + 'AO' => esc_html__('Angola', 'give'), |
|
| 131 | + 'AI' => esc_html__('Anguilla', 'give'), |
|
| 132 | + 'AQ' => esc_html__('Antarctica', 'give'), |
|
| 133 | + 'AG' => esc_html__('Antigua and Barbuda', 'give'), |
|
| 134 | + 'AR' => esc_html__('Argentina', 'give'), |
|
| 135 | + 'AM' => esc_html__('Armenia', 'give'), |
|
| 136 | + 'AW' => esc_html__('Aruba', 'give'), |
|
| 137 | + 'AU' => esc_html__('Australia', 'give'), |
|
| 138 | + 'AT' => esc_html__('Austria', 'give'), |
|
| 139 | + 'AZ' => esc_html__('Azerbaijan', 'give'), |
|
| 140 | + 'BS' => esc_html__('Bahamas', 'give'), |
|
| 141 | + 'BH' => esc_html__('Bahrain', 'give'), |
|
| 142 | + 'BD' => esc_html__('Bangladesh', 'give'), |
|
| 143 | + 'BB' => esc_html__('Barbados', 'give'), |
|
| 144 | + 'BY' => esc_html__('Belarus', 'give'), |
|
| 145 | + 'BE' => esc_html__('Belgium', 'give'), |
|
| 146 | + 'BZ' => esc_html__('Belize', 'give'), |
|
| 147 | + 'BJ' => esc_html__('Benin', 'give'), |
|
| 148 | + 'BM' => esc_html__('Bermuda', 'give'), |
|
| 149 | + 'BT' => esc_html__('Bhutan', 'give'), |
|
| 150 | + 'BO' => esc_html__('Bolivia', 'give'), |
|
| 151 | + 'BA' => esc_html__('Bosnia and Herzegovina', 'give'), |
|
| 152 | + 'BW' => esc_html__('Botswana', 'give'), |
|
| 153 | + 'BV' => esc_html__('Bouvet Island', 'give'), |
|
| 154 | + 'BR' => esc_html__('Brazil', 'give'), |
|
| 155 | + 'IO' => esc_html__('British Indian Ocean Territory', 'give'), |
|
| 156 | + 'BN' => esc_html__('Brunei Darrussalam', 'give'), |
|
| 157 | + 'BG' => esc_html__('Bulgaria', 'give'), |
|
| 158 | + 'BF' => esc_html__('Burkina Faso', 'give'), |
|
| 159 | + 'BI' => esc_html__('Burundi', 'give'), |
|
| 160 | + 'KH' => esc_html__('Cambodia', 'give'), |
|
| 161 | + 'CM' => esc_html__('Cameroon', 'give'), |
|
| 162 | + 'CV' => esc_html__('Cape Verde', 'give'), |
|
| 163 | + 'KY' => esc_html__('Cayman Islands', 'give'), |
|
| 164 | + 'CF' => esc_html__('Central African Republic', 'give'), |
|
| 165 | + 'TD' => esc_html__('Chad', 'give'), |
|
| 166 | + 'CL' => esc_html__('Chile', 'give'), |
|
| 167 | + 'CN' => esc_html__('China', 'give'), |
|
| 168 | + 'CX' => esc_html__('Christmas Island', 'give'), |
|
| 169 | + 'CC' => esc_html__('Cocos Islands', 'give'), |
|
| 170 | + 'CO' => esc_html__('Colombia', 'give'), |
|
| 171 | + 'KM' => esc_html__('Comoros', 'give'), |
|
| 172 | + 'CD' => esc_html__('Congo, Democratic People\'s Republic', 'give'), |
|
| 173 | + 'CG' => esc_html__('Congo, Republic of', 'give'), |
|
| 174 | + 'CK' => esc_html__('Cook Islands', 'give'), |
|
| 175 | + 'CR' => esc_html__('Costa Rica', 'give'), |
|
| 176 | + 'CI' => esc_html__('Cote d\'Ivoire', 'give'), |
|
| 177 | + 'HR' => esc_html__('Croatia/Hrvatska', 'give'), |
|
| 178 | + 'CU' => esc_html__('Cuba', 'give'), |
|
| 179 | + 'CY' => esc_html__('Cyprus Island', 'give'), |
|
| 180 | + 'CZ' => esc_html__('Czech Republic', 'give'), |
|
| 181 | + 'DK' => esc_html__('Denmark', 'give'), |
|
| 182 | + 'DJ' => esc_html__('Djibouti', 'give'), |
|
| 183 | + 'DM' => esc_html__('Dominica', 'give'), |
|
| 184 | + 'DO' => esc_html__('Dominican Republic', 'give'), |
|
| 185 | + 'TP' => esc_html__('East Timor', 'give'), |
|
| 186 | + 'EC' => esc_html__('Ecuador', 'give'), |
|
| 187 | + 'EG' => esc_html__('Egypt', 'give'), |
|
| 188 | + 'GQ' => esc_html__('Equatorial Guinea', 'give'), |
|
| 189 | + 'SV' => esc_html__('El Salvador', 'give'), |
|
| 190 | + 'ER' => esc_html__('Eritrea', 'give'), |
|
| 191 | + 'EE' => esc_html__('Estonia', 'give'), |
|
| 192 | + 'ET' => esc_html__('Ethiopia', 'give'), |
|
| 193 | + 'FK' => esc_html__('Falkland Islands', 'give'), |
|
| 194 | + 'FO' => esc_html__('Faroe Islands', 'give'), |
|
| 195 | + 'FJ' => esc_html__('Fiji', 'give'), |
|
| 196 | + 'FI' => esc_html__('Finland', 'give'), |
|
| 197 | + 'FR' => esc_html__('France', 'give'), |
|
| 198 | + 'GF' => esc_html__('French Guiana', 'give'), |
|
| 199 | + 'PF' => esc_html__('French Polynesia', 'give'), |
|
| 200 | + 'TF' => esc_html__('French Southern Territories', 'give'), |
|
| 201 | + 'GA' => esc_html__('Gabon', 'give'), |
|
| 202 | + 'GM' => esc_html__('Gambia', 'give'), |
|
| 203 | + 'GE' => esc_html__('Georgia', 'give'), |
|
| 204 | + 'DE' => esc_html__('Germany', 'give'), |
|
| 205 | + 'GR' => esc_html__('Greece', 'give'), |
|
| 206 | + 'GH' => esc_html__('Ghana', 'give'), |
|
| 207 | + 'GI' => esc_html__('Gibraltar', 'give'), |
|
| 208 | + 'GL' => esc_html__('Greenland', 'give'), |
|
| 209 | + 'GD' => esc_html__('Grenada', 'give'), |
|
| 210 | + 'GP' => esc_html__('Guadeloupe', 'give'), |
|
| 211 | + 'GU' => esc_html__('Guam', 'give'), |
|
| 212 | + 'GT' => esc_html__('Guatemala', 'give'), |
|
| 213 | + 'GG' => esc_html__('Guernsey', 'give'), |
|
| 214 | + 'GN' => esc_html__('Guinea', 'give'), |
|
| 215 | + 'GW' => esc_html__('Guinea-Bissau', 'give'), |
|
| 216 | + 'GY' => esc_html__('Guyana', 'give'), |
|
| 217 | + 'HT' => esc_html__('Haiti', 'give'), |
|
| 218 | + 'HM' => esc_html__('Heard and McDonald Islands', 'give'), |
|
| 219 | + 'VA' => esc_html__('Holy See (City Vatican State)', 'give'), |
|
| 220 | + 'HN' => esc_html__('Honduras', 'give'), |
|
| 221 | + 'HK' => esc_html__('Hong Kong', 'give'), |
|
| 222 | + 'HU' => esc_html__('Hungary', 'give'), |
|
| 223 | + 'IS' => esc_html__('Iceland', 'give'), |
|
| 224 | + 'IN' => esc_html__('India', 'give'), |
|
| 225 | + 'ID' => esc_html__('Indonesia', 'give'), |
|
| 226 | + 'IR' => esc_html__('Iran', 'give'), |
|
| 227 | + 'IQ' => esc_html__('Iraq', 'give'), |
|
| 228 | + 'IE' => esc_html__('Ireland', 'give'), |
|
| 229 | + 'IM' => esc_html__('Isle of Man', 'give'), |
|
| 230 | + 'IL' => esc_html__('Israel', 'give'), |
|
| 231 | + 'IT' => esc_html__('Italy', 'give'), |
|
| 232 | + 'JM' => esc_html__('Jamaica', 'give'), |
|
| 233 | + 'JP' => esc_html__('Japan', 'give'), |
|
| 234 | + 'JE' => esc_html__('Jersey', 'give'), |
|
| 235 | + 'JO' => esc_html__('Jordan', 'give'), |
|
| 236 | + 'KZ' => esc_html__('Kazakhstan', 'give'), |
|
| 237 | + 'KE' => esc_html__('Kenya', 'give'), |
|
| 238 | + 'KI' => esc_html__('Kiribati', 'give'), |
|
| 239 | + 'KW' => esc_html__('Kuwait', 'give'), |
|
| 240 | + 'KG' => esc_html__('Kyrgyzstan', 'give'), |
|
| 241 | + 'LA' => esc_html__('Lao People\'s Democratic Republic', 'give'), |
|
| 242 | + 'LV' => esc_html__('Latvia', 'give'), |
|
| 243 | + 'LB' => esc_html__('Lebanon', 'give'), |
|
| 244 | + 'LS' => esc_html__('Lesotho', 'give'), |
|
| 245 | + 'LR' => esc_html__('Liberia', 'give'), |
|
| 246 | + 'LY' => esc_html__('Libyan Arab Jamahiriya', 'give'), |
|
| 247 | + 'LI' => esc_html__('Liechtenstein', 'give'), |
|
| 248 | + 'LT' => esc_html__('Lithuania', 'give'), |
|
| 249 | + 'LU' => esc_html__('Luxembourg', 'give'), |
|
| 250 | + 'MO' => esc_html__('Macau', 'give'), |
|
| 251 | + 'MK' => esc_html__('Macedonia', 'give'), |
|
| 252 | + 'MG' => esc_html__('Madagascar', 'give'), |
|
| 253 | + 'MW' => esc_html__('Malawi', 'give'), |
|
| 254 | + 'MY' => esc_html__('Malaysia', 'give'), |
|
| 255 | + 'MV' => esc_html__('Maldives', 'give'), |
|
| 256 | + 'ML' => esc_html__('Mali', 'give'), |
|
| 257 | + 'MT' => esc_html__('Malta', 'give'), |
|
| 258 | + 'MH' => esc_html__('Marshall Islands', 'give'), |
|
| 259 | + 'MQ' => esc_html__('Martinique', 'give'), |
|
| 260 | + 'MR' => esc_html__('Mauritania', 'give'), |
|
| 261 | + 'MU' => esc_html__('Mauritius', 'give'), |
|
| 262 | + 'YT' => esc_html__('Mayotte', 'give'), |
|
| 263 | + 'MX' => esc_html__('Mexico', 'give'), |
|
| 264 | + 'FM' => esc_html__('Micronesia', 'give'), |
|
| 265 | + 'MD' => esc_html__('Moldova, Republic of', 'give'), |
|
| 266 | + 'MC' => esc_html__('Monaco', 'give'), |
|
| 267 | + 'MN' => esc_html__('Mongolia', 'give'), |
|
| 268 | + 'ME' => esc_html__('Montenegro', 'give'), |
|
| 269 | + 'MS' => esc_html__('Montserrat', 'give'), |
|
| 270 | + 'MA' => esc_html__('Morocco', 'give'), |
|
| 271 | + 'MZ' => esc_html__('Mozambique', 'give'), |
|
| 272 | + 'MM' => esc_html__('Myanmar', 'give'), |
|
| 273 | + 'NA' => esc_html__('Namibia', 'give'), |
|
| 274 | + 'NR' => esc_html__('Nauru', 'give'), |
|
| 275 | + 'NP' => esc_html__('Nepal', 'give'), |
|
| 276 | + 'NL' => esc_html__('Netherlands', 'give'), |
|
| 277 | + 'AN' => esc_html__('Netherlands Antilles', 'give'), |
|
| 278 | + 'NC' => esc_html__('New Caledonia', 'give'), |
|
| 279 | + 'NZ' => esc_html__('New Zealand', 'give'), |
|
| 280 | + 'NI' => esc_html__('Nicaragua', 'give'), |
|
| 281 | + 'NE' => esc_html__('Niger', 'give'), |
|
| 282 | + 'NG' => esc_html__('Nigeria', 'give'), |
|
| 283 | + 'NU' => esc_html__('Niue', 'give'), |
|
| 284 | + 'NF' => esc_html__('Norfolk Island', 'give'), |
|
| 285 | + 'KP' => esc_html__('North Korea', 'give'), |
|
| 286 | + 'MP' => esc_html__('Northern Mariana Islands', 'give'), |
|
| 287 | + 'NO' => esc_html__('Norway', 'give'), |
|
| 288 | + 'OM' => esc_html__('Oman', 'give'), |
|
| 289 | + 'PK' => esc_html__('Pakistan', 'give'), |
|
| 290 | + 'PW' => esc_html__('Palau', 'give'), |
|
| 291 | + 'PS' => esc_html__('Palestinian Territories', 'give'), |
|
| 292 | + 'PA' => esc_html__('Panama', 'give'), |
|
| 293 | + 'PG' => esc_html__('Papua New Guinea', 'give'), |
|
| 294 | + 'PY' => esc_html__('Paraguay', 'give'), |
|
| 295 | + 'PE' => esc_html__('Peru', 'give'), |
|
| 296 | + 'PH' => esc_html__('Phillipines', 'give'), |
|
| 297 | + 'PN' => esc_html__('Pitcairn Island', 'give'), |
|
| 298 | + 'PL' => esc_html__('Poland', 'give'), |
|
| 299 | + 'PT' => esc_html__('Portugal', 'give'), |
|
| 300 | + 'PR' => esc_html__('Puerto Rico', 'give'), |
|
| 301 | + 'QA' => esc_html__('Qatar', 'give'), |
|
| 302 | + 'RE' => esc_html__('Reunion Island', 'give'), |
|
| 303 | + 'RO' => esc_html__('Romania', 'give'), |
|
| 304 | + 'RU' => esc_html__('Russian Federation', 'give'), |
|
| 305 | + 'RW' => esc_html__('Rwanda', 'give'), |
|
| 306 | + 'SH' => esc_html__('Saint Helena', 'give'), |
|
| 307 | + 'KN' => esc_html__('Saint Kitts and Nevis', 'give'), |
|
| 308 | + 'LC' => esc_html__('Saint Lucia', 'give'), |
|
| 309 | + 'PM' => esc_html__('Saint Pierre and Miquelon', 'give'), |
|
| 310 | + 'VC' => esc_html__('Saint Vincent and the Grenadines', 'give'), |
|
| 311 | + 'SM' => esc_html__('San Marino', 'give'), |
|
| 312 | + 'ST' => esc_html__('Sao Tome and Principe', 'give'), |
|
| 313 | + 'SA' => esc_html__('Saudi Arabia', 'give'), |
|
| 314 | + 'SN' => esc_html__('Senegal', 'give'), |
|
| 315 | + 'RS' => esc_html__('Serbia', 'give'), |
|
| 316 | + 'SC' => esc_html__('Seychelles', 'give'), |
|
| 317 | + 'SL' => esc_html__('Sierra Leone', 'give'), |
|
| 318 | + 'SG' => esc_html__('Singapore', 'give'), |
|
| 319 | + 'SK' => esc_html__('Slovak Republic', 'give'), |
|
| 320 | + 'SI' => esc_html__('Slovenia', 'give'), |
|
| 321 | + 'SB' => esc_html__('Solomon Islands', 'give'), |
|
| 322 | + 'SO' => esc_html__('Somalia', 'give'), |
|
| 323 | + 'ZA' => esc_html__('South Africa', 'give'), |
|
| 324 | + 'GS' => esc_html__('South Georgia', 'give'), |
|
| 325 | + 'KR' => esc_html__('South Korea', 'give'), |
|
| 326 | + 'ES' => esc_html__('Spain', 'give'), |
|
| 327 | + 'LK' => esc_html__('Sri Lanka', 'give'), |
|
| 328 | + 'SD' => esc_html__('Sudan', 'give'), |
|
| 329 | + 'SR' => esc_html__('Suriname', 'give'), |
|
| 330 | + 'SJ' => esc_html__('Svalbard and Jan Mayen Islands', 'give'), |
|
| 331 | + 'SZ' => esc_html__('Swaziland', 'give'), |
|
| 332 | + 'SE' => esc_html__('Sweden', 'give'), |
|
| 333 | + 'CH' => esc_html__('Switzerland', 'give'), |
|
| 334 | + 'SY' => esc_html__('Syrian Arab Republic', 'give'), |
|
| 335 | + 'TW' => esc_html__('Taiwan', 'give'), |
|
| 336 | + 'TJ' => esc_html__('Tajikistan', 'give'), |
|
| 337 | + 'TZ' => esc_html__('Tanzania', 'give'), |
|
| 338 | + 'TG' => esc_html__('Togo', 'give'), |
|
| 339 | + 'TK' => esc_html__('Tokelau', 'give'), |
|
| 340 | + 'TO' => esc_html__('Tonga', 'give'), |
|
| 341 | + 'TH' => esc_html__('Thailand', 'give'), |
|
| 342 | + 'TT' => esc_html__('Trinidad and Tobago', 'give'), |
|
| 343 | + 'TN' => esc_html__('Tunisia', 'give'), |
|
| 344 | + 'TR' => esc_html__('Turkey', 'give'), |
|
| 345 | + 'TM' => esc_html__('Turkmenistan', 'give'), |
|
| 346 | + 'TC' => esc_html__('Turks and Caicos Islands', 'give'), |
|
| 347 | + 'TV' => esc_html__('Tuvalu', 'give'), |
|
| 348 | + 'UG' => esc_html__('Uganda', 'give'), |
|
| 349 | + 'UA' => esc_html__('Ukraine', 'give'), |
|
| 350 | + 'AE' => esc_html__('United Arab Emirates', 'give'), |
|
| 351 | + 'UY' => esc_html__('Uruguay', 'give'), |
|
| 352 | + 'UM' => esc_html__('US Minor Outlying Islands', 'give'), |
|
| 353 | + 'UZ' => esc_html__('Uzbekistan', 'give'), |
|
| 354 | + 'VU' => esc_html__('Vanuatu', 'give'), |
|
| 355 | + 'VE' => esc_html__('Venezuela', 'give'), |
|
| 356 | + 'VN' => esc_html__('Vietnam', 'give'), |
|
| 357 | + 'VG' => esc_html__('Virgin Islands (British)', 'give'), |
|
| 358 | + 'VI' => esc_html__('Virgin Islands (USA)', 'give'), |
|
| 359 | + 'WF' => esc_html__('Wallis and Futuna Islands', 'give'), |
|
| 360 | + 'EH' => esc_html__('Western Sahara', 'give'), |
|
| 361 | + 'WS' => esc_html__('Western Samoa', 'give'), |
|
| 362 | + 'YE' => esc_html__('Yemen', 'give'), |
|
| 363 | + 'YU' => esc_html__('Yugoslavia', 'give'), |
|
| 364 | + 'ZM' => esc_html__('Zambia', 'give'), |
|
| 365 | + 'ZW' => esc_html__('Zimbabwe', 'give') |
|
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | - return apply_filters( 'give_countries', $countries ); |
|
| 368 | + return apply_filters('give_countries', $countries); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | 'AP' => 'Armed Forces - Pacific' |
| 447 | 447 | ); |
| 448 | 448 | |
| 449 | - return apply_filters( 'give_us_states', $states ); |
|
| 449 | + return apply_filters('give_us_states', $states); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -459,22 +459,22 @@ discard block |
||
| 459 | 459 | function give_get_provinces_list() { |
| 460 | 460 | $provinces = array( |
| 461 | 461 | '' => '', |
| 462 | - 'AB' => esc_html__('Alberta', 'give' ), |
|
| 463 | - 'BC' => esc_html__('British Columbia', 'give' ), |
|
| 464 | - 'MB' => esc_html__('Manitoba', 'give' ), |
|
| 465 | - 'NB' => esc_html__('New Brunswick', 'give' ), |
|
| 466 | - 'NL' => esc_html__('Newfoundland and Labrador', 'give' ), |
|
| 467 | - 'NS' => esc_html__('Nova Scotia', 'give' ), |
|
| 468 | - 'NT' => esc_html__('Northwest Territories', 'give' ), |
|
| 469 | - 'NU' => esc_html__('Nunavut', 'give' ), |
|
| 470 | - 'ON' => esc_html__('Ontario', 'give' ), |
|
| 471 | - 'PE' => esc_html__('Prince Edward Island', 'give' ), |
|
| 472 | - 'QC' => esc_html__('Quebec', 'give' ), |
|
| 473 | - 'SK' => esc_html__('Saskatchewan', 'give' ), |
|
| 474 | - 'YT' => esc_html__('Yukon', 'give' ) |
|
| 462 | + 'AB' => esc_html__('Alberta', 'give'), |
|
| 463 | + 'BC' => esc_html__('British Columbia', 'give'), |
|
| 464 | + 'MB' => esc_html__('Manitoba', 'give'), |
|
| 465 | + 'NB' => esc_html__('New Brunswick', 'give'), |
|
| 466 | + 'NL' => esc_html__('Newfoundland and Labrador', 'give'), |
|
| 467 | + 'NS' => esc_html__('Nova Scotia', 'give'), |
|
| 468 | + 'NT' => esc_html__('Northwest Territories', 'give'), |
|
| 469 | + 'NU' => esc_html__('Nunavut', 'give'), |
|
| 470 | + 'ON' => esc_html__('Ontario', 'give'), |
|
| 471 | + 'PE' => esc_html__('Prince Edward Island', 'give'), |
|
| 472 | + 'QC' => esc_html__('Quebec', 'give'), |
|
| 473 | + 'SK' => esc_html__('Saskatchewan', 'give'), |
|
| 474 | + 'YT' => esc_html__('Yukon', 'give') |
|
| 475 | 475 | ); |
| 476 | 476 | |
| 477 | - return apply_filters( 'give_canada_provinces', $provinces ); |
|
| 477 | + return apply_filters('give_canada_provinces', $provinces); |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | 'WA' => 'Western Australia' |
| 497 | 497 | ); |
| 498 | 498 | |
| 499 | - return apply_filters( 'give_australian_states', $states ); |
|
| 499 | + return apply_filters('give_australian_states', $states); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | 'TO' => 'Tocantins' |
| 538 | 538 | ); |
| 539 | 539 | |
| 540 | - return apply_filters( 'give_brazil_states', $states ); |
|
| 540 | + return apply_filters('give_brazil_states', $states); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /** |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | 'NEW TERRITORIES' => 'New Territories' |
| 555 | 555 | ); |
| 556 | 556 | |
| 557 | - return apply_filters( 'give_hong_kong_states', $states ); |
|
| 557 | + return apply_filters('give_hong_kong_states', $states); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /** |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | 'ZA' => 'Zala' |
| 589 | 589 | ); |
| 590 | 590 | |
| 591 | - return apply_filters( 'give_hungary_states', $states ); |
|
| 591 | + return apply_filters('give_hungary_states', $states); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | /** |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | 'CN32' => 'Xinjiang / 新疆' |
| 635 | 635 | ); |
| 636 | 636 | |
| 637 | - return apply_filters( 'give_chinese_states', $states ); |
|
| 637 | + return apply_filters('give_chinese_states', $states); |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | /** |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | 'WC' => 'West Coast' |
| 664 | 664 | ); |
| 665 | 665 | |
| 666 | - return apply_filters( 'give_new_zealand_states', $states ); |
|
| 666 | + return apply_filters('give_new_zealand_states', $states); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | 'PB' => 'Papua Barat' |
| 712 | 712 | ); |
| 713 | 713 | |
| 714 | - return apply_filters( 'give_indonesia_states', $states ); |
|
| 714 | + return apply_filters('give_indonesia_states', $states); |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | /** |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | 'PY' => 'Pondicherry (Puducherry)' |
| 762 | 762 | ); |
| 763 | 763 | |
| 764 | - return apply_filters( 'give_indian_states', $states ); |
|
| 764 | + return apply_filters('give_indian_states', $states); |
|
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | /** |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | 'PJY' => 'W.P. Putrajaya' |
| 792 | 792 | ); |
| 793 | 793 | |
| 794 | - return apply_filters( 'give_malaysian_states', $states ); |
|
| 794 | + return apply_filters('give_malaysian_states', $states); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | 'WC' => 'Western Cape' |
| 815 | 815 | ); |
| 816 | 816 | |
| 817 | - return apply_filters( 'give_south_african_states', $states ); |
|
| 817 | + return apply_filters('give_south_african_states', $states); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | 'TH-35' => 'Yasothon (ยโสธร)' |
| 906 | 906 | ); |
| 907 | 907 | |
| 908 | - return apply_filters( 'give_thailand_states', $states ); |
|
| 908 | + return apply_filters('give_thailand_states', $states); |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | /** |
@@ -917,59 +917,59 @@ discard block |
||
| 917 | 917 | function give_get_spain_states_list() { |
| 918 | 918 | $states = array( |
| 919 | 919 | '' => '', |
| 920 | - 'C' => esc_html__( 'A Coruña', 'give' ), |
|
| 921 | - 'VI' => esc_html__( 'Álava', 'give' ), |
|
| 922 | - 'AB' => esc_html__( 'Albacete', 'give' ), |
|
| 923 | - 'A' => esc_html__( 'Alicante', 'give' ), |
|
| 924 | - 'AL' => esc_html__( 'Almería', 'give' ), |
|
| 925 | - 'O' => esc_html__( 'Asturias', 'give' ), |
|
| 926 | - 'AV' => esc_html__( 'Ávila', 'give' ), |
|
| 927 | - 'BA' => esc_html__( 'Badajoz', 'give' ), |
|
| 928 | - 'PM' => esc_html__( 'Baleares', 'give' ), |
|
| 929 | - 'B' => esc_html__( 'Barcelona', 'give' ), |
|
| 930 | - 'BU' => esc_html__( 'Burgos', 'give' ), |
|
| 931 | - 'CC' => esc_html__( 'Cáceres', 'give' ), |
|
| 932 | - 'CA' => esc_html__( 'Cádiz', 'give' ), |
|
| 933 | - 'S' => esc_html__( 'Cantabria', 'give' ), |
|
| 934 | - 'CS' => esc_html__( 'Castellón', 'give' ), |
|
| 935 | - 'CE' => esc_html__( 'Ceuta', 'give' ), |
|
| 936 | - 'CR' => esc_html__( 'Ciudad Real', 'give' ), |
|
| 937 | - 'CO' => esc_html__( 'Córdoba', 'give' ), |
|
| 938 | - 'CU' => esc_html__( 'Cuenca', 'give' ), |
|
| 939 | - 'GI' => esc_html__( 'Girona', 'give' ), |
|
| 940 | - 'GR' => esc_html__( 'Granada', 'give' ), |
|
| 941 | - 'GU' => esc_html__( 'Guadalajara', 'give' ), |
|
| 942 | - 'SS' => esc_html__( 'Gipuzkoa', 'give' ), |
|
| 943 | - 'H' => esc_html__( 'Huelva', 'give' ), |
|
| 944 | - 'HU' => esc_html__( 'Huesca', 'give' ), |
|
| 945 | - 'J' => esc_html__( 'Jaén', 'give' ), |
|
| 946 | - 'LO' => esc_html__( 'La Rioja', 'give' ), |
|
| 947 | - 'GC' => esc_html__( 'Las Palmas', 'give' ), |
|
| 948 | - 'LE' => esc_html__( 'León', 'give' ), |
|
| 949 | - 'L' => esc_html__( 'Lleida', 'give' ), |
|
| 950 | - 'LU' => esc_html__( 'Lugo', 'give' ), |
|
| 951 | - 'M' => esc_html__( 'Madrid', 'give' ), |
|
| 952 | - 'MA' => esc_html__( 'Málaga', 'give' ), |
|
| 953 | - 'ML' => esc_html__( 'Melilla', 'give' ), |
|
| 954 | - 'MU' => esc_html__( 'Murcia', 'give' ), |
|
| 955 | - 'NA' => esc_html__( 'Navarra', 'give' ), |
|
| 956 | - 'OR' => esc_html__( 'Ourense', 'give' ), |
|
| 957 | - 'P' => esc_html__( 'Palencia', 'give' ), |
|
| 958 | - 'PO' => esc_html__( 'Pontevedra', 'give' ), |
|
| 959 | - 'SA' => esc_html__( 'Salamanca', 'give' ), |
|
| 960 | - 'TF' => esc_html__( 'Santa Cruz de Tenerife', 'give' ), |
|
| 961 | - 'SG' => esc_html__( 'Segovia', 'give' ), |
|
| 962 | - 'SE' => esc_html__( 'Sevilla', 'give' ), |
|
| 963 | - 'SO' => esc_html__( 'Soria', 'give' ), |
|
| 964 | - 'T' => esc_html__( 'Tarragona', 'give' ), |
|
| 965 | - 'TE' => esc_html__( 'Teruel', 'give' ), |
|
| 966 | - 'TO' => esc_html__( 'Toledo', 'give' ), |
|
| 967 | - 'V' => esc_html__( 'Valencia', 'give' ), |
|
| 968 | - 'VA' => esc_html__( 'Valladolid', 'give' ), |
|
| 969 | - 'BI' => esc_html__( 'Bizkaia', 'give' ), |
|
| 970 | - 'ZA' => esc_html__( 'Zamora', 'give' ), |
|
| 971 | - 'Z' => esc_html__( 'Zaragoza', 'give' ) |
|
| 920 | + 'C' => esc_html__('A Coruña', 'give'), |
|
| 921 | + 'VI' => esc_html__('Álava', 'give'), |
|
| 922 | + 'AB' => esc_html__('Albacete', 'give'), |
|
| 923 | + 'A' => esc_html__('Alicante', 'give'), |
|
| 924 | + 'AL' => esc_html__('Almería', 'give'), |
|
| 925 | + 'O' => esc_html__('Asturias', 'give'), |
|
| 926 | + 'AV' => esc_html__('Ávila', 'give'), |
|
| 927 | + 'BA' => esc_html__('Badajoz', 'give'), |
|
| 928 | + 'PM' => esc_html__('Baleares', 'give'), |
|
| 929 | + 'B' => esc_html__('Barcelona', 'give'), |
|
| 930 | + 'BU' => esc_html__('Burgos', 'give'), |
|
| 931 | + 'CC' => esc_html__('Cáceres', 'give'), |
|
| 932 | + 'CA' => esc_html__('Cádiz', 'give'), |
|
| 933 | + 'S' => esc_html__('Cantabria', 'give'), |
|
| 934 | + 'CS' => esc_html__('Castellón', 'give'), |
|
| 935 | + 'CE' => esc_html__('Ceuta', 'give'), |
|
| 936 | + 'CR' => esc_html__('Ciudad Real', 'give'), |
|
| 937 | + 'CO' => esc_html__('Córdoba', 'give'), |
|
| 938 | + 'CU' => esc_html__('Cuenca', 'give'), |
|
| 939 | + 'GI' => esc_html__('Girona', 'give'), |
|
| 940 | + 'GR' => esc_html__('Granada', 'give'), |
|
| 941 | + 'GU' => esc_html__('Guadalajara', 'give'), |
|
| 942 | + 'SS' => esc_html__('Gipuzkoa', 'give'), |
|
| 943 | + 'H' => esc_html__('Huelva', 'give'), |
|
| 944 | + 'HU' => esc_html__('Huesca', 'give'), |
|
| 945 | + 'J' => esc_html__('Jaén', 'give'), |
|
| 946 | + 'LO' => esc_html__('La Rioja', 'give'), |
|
| 947 | + 'GC' => esc_html__('Las Palmas', 'give'), |
|
| 948 | + 'LE' => esc_html__('León', 'give'), |
|
| 949 | + 'L' => esc_html__('Lleida', 'give'), |
|
| 950 | + 'LU' => esc_html__('Lugo', 'give'), |
|
| 951 | + 'M' => esc_html__('Madrid', 'give'), |
|
| 952 | + 'MA' => esc_html__('Málaga', 'give'), |
|
| 953 | + 'ML' => esc_html__('Melilla', 'give'), |
|
| 954 | + 'MU' => esc_html__('Murcia', 'give'), |
|
| 955 | + 'NA' => esc_html__('Navarra', 'give'), |
|
| 956 | + 'OR' => esc_html__('Ourense', 'give'), |
|
| 957 | + 'P' => esc_html__('Palencia', 'give'), |
|
| 958 | + 'PO' => esc_html__('Pontevedra', 'give'), |
|
| 959 | + 'SA' => esc_html__('Salamanca', 'give'), |
|
| 960 | + 'TF' => esc_html__('Santa Cruz de Tenerife', 'give'), |
|
| 961 | + 'SG' => esc_html__('Segovia', 'give'), |
|
| 962 | + 'SE' => esc_html__('Sevilla', 'give'), |
|
| 963 | + 'SO' => esc_html__('Soria', 'give'), |
|
| 964 | + 'T' => esc_html__('Tarragona', 'give'), |
|
| 965 | + 'TE' => esc_html__('Teruel', 'give'), |
|
| 966 | + 'TO' => esc_html__('Toledo', 'give'), |
|
| 967 | + 'V' => esc_html__('Valencia', 'give'), |
|
| 968 | + 'VA' => esc_html__('Valladolid', 'give'), |
|
| 969 | + 'BI' => esc_html__('Bizkaia', 'give'), |
|
| 970 | + 'ZA' => esc_html__('Zamora', 'give'), |
|
| 971 | + 'Z' => esc_html__('Zaragoza', 'give') |
|
| 972 | 972 | ); |
| 973 | 973 | |
| 974 | - return apply_filters( 'give_spain_states', $states ); |
|
| 974 | + return apply_filters('give_spain_states', $states); |
|
| 975 | 975 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | $give_map_deprecated_actions = give_deprecated_actions(); |
| 6 | 6 | |
| 7 | -foreach ( $give_map_deprecated_actions as $new => $old ) { |
|
| 8 | - add_action( $new, 'give_deprecated_action_mapping', 10, 4 ); |
|
| 7 | +foreach ($give_map_deprecated_actions as $new => $old) { |
|
| 8 | + add_action($new, 'give_deprecated_action_mapping', 10, 4); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return mixed|void |
| 61 | 61 | */ |
| 62 | -function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
| 62 | +function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
| 63 | 63 | $give_map_deprecated_actions = give_deprecated_actions(); |
| 64 | 64 | $action = current_filter(); |
| 65 | 65 | |
| 66 | - if ( isset( $give_map_deprecated_actions[ $action ] ) ) { |
|
| 67 | - if ( has_action( $give_map_deprecated_actions[ $action ] ) ) { |
|
| 68 | - do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 ); |
|
| 66 | + if (isset($give_map_deprecated_actions[$action])) { |
|
| 67 | + if (has_action($give_map_deprecated_actions[$action])) { |
|
| 68 | + do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3); |
|
| 69 | 69 | |
| 70 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
| 70 | + if ( ! defined('DOING_AJAX')) { |
|
| 71 | 71 | // translators: %s: action name. |
| 72 | 72 | _give_deprecated_function( |
| 73 | 73 | sprintf( |
| 74 | - __( 'The %s action' ), |
|
| 75 | - $give_map_deprecated_actions[ $action ] |
|
| 74 | + __('The %s action'), |
|
| 75 | + $give_map_deprecated_actions[$action] |
|
| 76 | 76 | ), |
| 77 | 77 | '1.7', |
| 78 | 78 | $action |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | $give_map_deprecated_filters = give_deprecated_filters(); |
| 6 | 6 | |
| 7 | -foreach ( $give_map_deprecated_filters as $new => $old ) { |
|
| 8 | - add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 ); |
|
| 7 | +foreach ($give_map_deprecated_filters as $new => $old) { |
|
| 8 | + add_filter($new, 'give_deprecated_filter_mapping', 10, 4); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | // Dynamic filters. |
| 31 | - switch ( true ) { |
|
| 32 | - case ( ! empty( $_GET['payment-confirmation'] ) ) : |
|
| 31 | + switch (true) { |
|
| 32 | + case ( ! empty($_GET['payment-confirmation'])) : |
|
| 33 | 33 | $give_deprecated_filters["give_donation_confirm_{$_GET['payment-confirmation']}"] = "give_payment_confirm_{$_GET['payment-confirmation']}"; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -46,20 +46,20 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return mixed|void |
| 48 | 48 | */ |
| 49 | -function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
| 49 | +function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
| 50 | 50 | $give_map_deprecated_filters = give_deprecated_filters(); |
| 51 | 51 | $filter = current_filter(); |
| 52 | 52 | |
| 53 | - if ( isset( $give_map_deprecated_filters[ $filter ] ) ) { |
|
| 54 | - if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) { |
|
| 55 | - $data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 ); |
|
| 53 | + if (isset($give_map_deprecated_filters[$filter])) { |
|
| 54 | + if (has_filter($give_map_deprecated_filters[$filter])) { |
|
| 55 | + $data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3); |
|
| 56 | 56 | |
| 57 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
| 57 | + if ( ! defined('DOING_AJAX')) { |
|
| 58 | 58 | _give_deprecated_function( |
| 59 | 59 | sprintf( |
| 60 | 60 | /* translators: %s: filter name */ |
| 61 | - __( 'The %s filter' ), |
|
| 62 | - $give_map_deprecated_filters[ $filter ] |
|
| 61 | + __('The %s filter'), |
|
| 62 | + $give_map_deprecated_filters[$filter] |
|
| 63 | 63 | ), |
| 64 | 64 | '1.7', |
| 65 | 65 | $filter |
@@ -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 | |
@@ -74,53 +74,53 @@ discard block |
||
| 74 | 74 | public function __construct() { |
| 75 | 75 | |
| 76 | 76 | $this->use_php_sessions = $this->use_php_sessions(); |
| 77 | - $this->exp_option = give_get_option( 'session_lifetime' ); |
|
| 77 | + $this->exp_option = give_get_option('session_lifetime'); |
|
| 78 | 78 | |
| 79 | 79 | // PHP Sessions. |
| 80 | - if ( $this->use_php_sessions ) { |
|
| 80 | + if ($this->use_php_sessions) { |
|
| 81 | 81 | |
| 82 | - if ( is_multisite() ) { |
|
| 82 | + if (is_multisite()) { |
|
| 83 | 83 | |
| 84 | - $this->prefix = '_' . get_current_blog_id(); |
|
| 84 | + $this->prefix = '_'.get_current_blog_id(); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - add_action( 'init', array( $this, 'maybe_start_session' ), - 2 ); |
|
| 88 | + add_action('init', array($this, 'maybe_start_session'), - 2); |
|
| 89 | 89 | |
| 90 | 90 | } else { |
| 91 | 91 | |
| 92 | - if ( ! $this->should_start_session() ) { |
|
| 92 | + if ( ! $this->should_start_session()) { |
|
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Use WP_Session. |
| 97 | - if ( ! defined( 'WP_SESSION_COOKIE' ) ) { |
|
| 98 | - define( 'WP_SESSION_COOKIE', 'give_wp_session' ); |
|
| 97 | + if ( ! defined('WP_SESSION_COOKIE')) { |
|
| 98 | + define('WP_SESSION_COOKIE', 'give_wp_session'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( ! class_exists( 'Recursive_ArrayAccess' ) ) { |
|
| 102 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
| 101 | + if ( ! class_exists('Recursive_ArrayAccess')) { |
|
| 102 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( ! class_exists( 'WP_Session' ) ) { |
|
| 106 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php'; |
|
| 107 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php'; |
|
| 105 | + if ( ! class_exists('WP_Session')) { |
|
| 106 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php'; |
|
| 107 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 ); |
|
| 111 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 ); |
|
| 110 | + add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); |
|
| 111 | + add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Init Session. |
| 116 | - if ( empty( $this->session ) && ! $this->use_php_sessions ) { |
|
| 117 | - add_action( 'plugins_loaded', array( $this, 'init' ), - 1 ); |
|
| 116 | + if (empty($this->session) && ! $this->use_php_sessions) { |
|
| 117 | + add_action('plugins_loaded', array($this, 'init'), - 1); |
|
| 118 | 118 | } else { |
| 119 | - add_action( 'init', array( $this, 'init' ), - 1 ); |
|
| 119 | + add_action('init', array($this, 'init'), - 1); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // Set cookie on Donation Completion page. |
| 123 | - add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) ); |
|
| 123 | + add_action('give_pre_process_donation', array($this, 'set_session_cookies')); |
|
| 124 | 124 | |
| 125 | 125 | } |
| 126 | 126 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function init() { |
| 138 | 138 | |
| 139 | - if ( $this->use_php_sessions ) { |
|
| 140 | - $this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array(); |
|
| 139 | + if ($this->use_php_sessions) { |
|
| 140 | + $this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array(); |
|
| 141 | 141 | } else { |
| 142 | 142 | $this->session = WP_Session::get_instance(); |
| 143 | 143 | } |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return string Session variable. |
| 174 | 174 | */ |
| 175 | - public function get( $key ) { |
|
| 176 | - $key = sanitize_key( $key ); |
|
| 175 | + public function get($key) { |
|
| 176 | + $key = sanitize_key($key); |
|
| 177 | 177 | |
| 178 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false; |
|
| 178 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false; |
|
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | |
@@ -192,21 +192,21 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @return string Session variable. |
| 194 | 194 | */ |
| 195 | - public function set( $key, $value ) { |
|
| 195 | + public function set($key, $value) { |
|
| 196 | 196 | |
| 197 | - $key = sanitize_key( $key ); |
|
| 197 | + $key = sanitize_key($key); |
|
| 198 | 198 | |
| 199 | - if ( is_array( $value ) ) { |
|
| 200 | - $this->session[ $key ] = serialize( $value ); |
|
| 199 | + if (is_array($value)) { |
|
| 200 | + $this->session[$key] = serialize($value); |
|
| 201 | 201 | } else { |
| 202 | - $this->session[ $key ] = $value; |
|
| 202 | + $this->session[$key] = $value; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if ( $this->use_php_sessions ) { |
|
| 206 | - $_SESSION[ 'give' . $this->prefix ] = $this->session; |
|
| 205 | + if ($this->use_php_sessions) { |
|
| 206 | + $_SESSION['give'.$this->prefix] = $this->session; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return $this->session[ $key ]; |
|
| 209 | + return $this->session[$key]; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | * @hook |
| 221 | 221 | */ |
| 222 | 222 | public function set_session_cookies() { |
| 223 | - if ( ! headers_sent() ) { |
|
| 224 | - $lifetime = current_time( 'timestamp' ) + $this->set_expiration_time(); |
|
| 225 | - @setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
| 226 | - @setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
| 223 | + if ( ! headers_sent()) { |
|
| 224 | + $lifetime = current_time('timestamp') + $this->set_expiration_time(); |
|
| 225 | + @setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
| 226 | + @setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function set_expiration_variant_time() { |
| 241 | 241 | |
| 242 | - return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 ); |
|
| 242 | + return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function set_expiration_time() { |
| 256 | 256 | |
| 257 | - return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 ); |
|
| 257 | + return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -272,21 +272,21 @@ discard block |
||
| 272 | 272 | $ret = false; |
| 273 | 273 | |
| 274 | 274 | // If the database variable is already set, no need to run auto detection. |
| 275 | - $give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' ); |
|
| 275 | + $give_use_php_sessions = (bool) get_option('give_use_php_sessions'); |
|
| 276 | 276 | |
| 277 | - if ( ! $give_use_php_sessions ) { |
|
| 277 | + if ( ! $give_use_php_sessions) { |
|
| 278 | 278 | |
| 279 | 279 | // Attempt to detect if the server supports PHP sessions. |
| 280 | - if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 280 | + if (function_exists('session_start') && ! ini_get('safe_mode')) { |
|
| 281 | 281 | |
| 282 | - $this->set( 'give_use_php_sessions', 1 ); |
|
| 282 | + $this->set('give_use_php_sessions', 1); |
|
| 283 | 283 | |
| 284 | - if ( $this->get( 'give_use_php_sessions' ) ) { |
|
| 284 | + if ($this->get('give_use_php_sessions')) { |
|
| 285 | 285 | |
| 286 | 286 | $ret = true; |
| 287 | 287 | |
| 288 | 288 | // Set the database option. |
| 289 | - update_option( 'give_use_php_sessions', true ); |
|
| 289 | + update_option('give_use_php_sessions', true); |
|
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -296,13 +296,13 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant. |
| 299 | - if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) { |
|
| 299 | + if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) { |
|
| 300 | 300 | $ret = true; |
| 301 | - } elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) { |
|
| 301 | + } elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) { |
|
| 302 | 302 | $ret = false; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - return (bool) apply_filters( 'give_use_php_sessions', $ret ); |
|
| 305 | + return (bool) apply_filters('give_use_php_sessions', $ret); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $start_session = true; |
| 321 | 321 | |
| 322 | - if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
|
| 322 | + if ( ! empty($_SERVER['REQUEST_URI'])) { |
|
| 323 | 323 | |
| 324 | - $blacklist = apply_filters( 'give_session_start_uri_blacklist', array( |
|
| 324 | + $blacklist = apply_filters('give_session_start_uri_blacklist', array( |
|
| 325 | 325 | 'feed', |
| 326 | 326 | 'feed', |
| 327 | 327 | 'feed/rss', |
@@ -329,21 +329,21 @@ discard block |
||
| 329 | 329 | 'feed/rdf', |
| 330 | 330 | 'feed/atom', |
| 331 | 331 | 'comments/feed/', |
| 332 | - ) ); |
|
| 333 | - $uri = ltrim( $_SERVER['REQUEST_URI'], '/' ); |
|
| 334 | - $uri = untrailingslashit( $uri ); |
|
| 335 | - if ( in_array( $uri, $blacklist ) ) { |
|
| 332 | + )); |
|
| 333 | + $uri = ltrim($_SERVER['REQUEST_URI'], '/'); |
|
| 334 | + $uri = untrailingslashit($uri); |
|
| 335 | + if (in_array($uri, $blacklist)) { |
|
| 336 | 336 | $start_session = false; |
| 337 | 337 | } |
| 338 | - if ( false !== strpos( $uri, 'feed=' ) ) { |
|
| 338 | + if (false !== strpos($uri, 'feed=')) { |
|
| 339 | 339 | $start_session = false; |
| 340 | 340 | } |
| 341 | - if ( is_admin() ) { |
|
| 341 | + if (is_admin()) { |
|
| 342 | 342 | $start_session = false; |
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - return apply_filters( 'give_start_session', $start_session ); |
|
| 346 | + return apply_filters('give_start_session', $start_session); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | public function maybe_start_session() { |
| 361 | 361 | |
| 362 | - if ( ! $this->should_start_session() ) { |
|
| 362 | + if ( ! $this->should_start_session()) { |
|
| 363 | 363 | return; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if ( ! session_id() && ! headers_sent() ) { |
|
| 366 | + if ( ! session_id() && ! headers_sent()) { |
|
| 367 | 367 | session_start(); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $expiration = false; |
| 384 | 384 | |
| 385 | - if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) { |
|
| 385 | + if (session_id() && isset($_COOKIE[session_name().'_expiration'])) { |
|
| 386 | 386 | |
| 387 | - $expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) ); |
|
| 387 | + $expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration'])); |
|
| 388 | 388 | |
| 389 | 389 | } |
| 390 | 390 | |