@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Misc Functions |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Functions |
|
| 7 | - * @copyright Copyright (c) 2016, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * Misc Functions |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Functions |
|
| 7 | + * @copyright Copyright (c) 2016, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.0 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -770,10 +770,10 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ( ! is_int( $params[1] ) |
| 773 | - && ! is_float( $params[1] ) |
|
| 774 | - && ! is_string( $params[1] ) |
|
| 775 | - && $params[1] !== null |
|
| 776 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 773 | + && ! is_float( $params[1] ) |
|
| 774 | + && ! is_string( $params[1] ) |
|
| 775 | + && $params[1] !== null |
|
| 776 | + && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 777 | 777 | ) { |
| 778 | 778 | trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
| 779 | 779 | |
@@ -781,10 +781,10 @@ discard block |
||
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | if ( isset( $params[2] ) |
| 784 | - && ! is_int( $params[2] ) |
|
| 785 | - && ! is_float( $params[2] ) |
|
| 786 | - && ! is_string( $params[2] ) |
|
| 787 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 784 | + && ! is_int( $params[2] ) |
|
| 785 | + && ! is_float( $params[2] ) |
|
| 786 | + && ! is_string( $params[2] ) |
|
| 787 | + && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 788 | 788 | ) { |
| 789 | 789 | trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
| 790 | 790 | |
@@ -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,9 +24,9 @@ discard block |
||
| 24 | 24 | function give_is_test_mode() { |
| 25 | 25 | global $give_options; |
| 26 | 26 | |
| 27 | - $ret = ! empty( $give_options['test_mode'] ); |
|
| 27 | + $ret = ! empty($give_options['test_mode']); |
|
| 28 | 28 | |
| 29 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
| 29 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function give_get_currency() { |
| 39 | 39 | global $give_options; |
| 40 | - $currency = isset( $give_options['currency'] ) ? $give_options['currency'] : 'USD'; |
|
| 40 | + $currency = isset($give_options['currency']) ? $give_options['currency'] : 'USD'; |
|
| 41 | 41 | |
| 42 | - return apply_filters( 'give_currency', $currency ); |
|
| 42 | + return apply_filters('give_currency', $currency); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function give_get_currency_position() { |
| 53 | 53 | global $give_options; |
| 54 | - $currency_pos = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 54 | + $currency_pos = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 55 | 55 | |
| 56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
| 56 | + return apply_filters('give_currency_position', $currency_pos); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
@@ -65,36 +65,36 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function give_get_currencies() { |
| 67 | 67 | $currencies = array( |
| 68 | - 'USD' => __( 'US Dollars ($)', 'give' ), |
|
| 69 | - 'EUR' => __( 'Euros (€)', 'give' ), |
|
| 70 | - 'GBP' => __( 'Pounds Sterling (£)', 'give' ), |
|
| 71 | - 'AUD' => __( 'Australian Dollars ($)', 'give' ), |
|
| 72 | - 'BRL' => __( 'Brazilian Real (R$)', 'give' ), |
|
| 73 | - 'CAD' => __( 'Canadian Dollars ($)', 'give' ), |
|
| 74 | - 'CZK' => __( 'Czech Koruna (Kč)', 'give' ), |
|
| 75 | - 'DKK' => __( 'Danish Krone (kr)', 'give' ), |
|
| 76 | - 'HKD' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
| 77 | - 'HUF' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
| 78 | - 'ILS' => __( 'Israeli Shekel (₪)', 'give' ), |
|
| 79 | - 'JPY' => __( 'Japanese Yen (¥)', 'give' ), |
|
| 80 | - 'MYR' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
| 81 | - 'MXN' => __( 'Mexican Peso ($)', 'give' ), |
|
| 82 | - 'NZD' => __( 'New Zealand Dollar ($)', 'give' ), |
|
| 83 | - 'NOK' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
| 84 | - 'PHP' => __( 'Philippine Pesos (₱)', 'give' ), |
|
| 85 | - 'PLN' => __( 'Polish Zloty (zł)', 'give' ), |
|
| 86 | - 'SGD' => __( 'Singapore Dollar ($)', 'give' ), |
|
| 87 | - 'SEK' => __( 'Swedish Krona (kr)', 'give' ), |
|
| 88 | - 'CHF' => __( 'Swiss Franc (CHF)', 'give' ), |
|
| 89 | - 'TWD' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
| 90 | - 'THB' => __( 'Thai Baht (฿)', 'give' ), |
|
| 91 | - 'INR' => __( 'Indian Rupee (₹)', 'give' ), |
|
| 92 | - 'TRY' => __( 'Turkish Lira (₺)', 'give' ), |
|
| 93 | - 'RIAL' => __( 'Iranian Rial (﷼)', 'give' ), |
|
| 94 | - 'RUB' => __( 'Russian Rubles (руб)', 'give' ) |
|
| 68 | + 'USD' => __('US Dollars ($)', 'give'), |
|
| 69 | + 'EUR' => __('Euros (€)', 'give'), |
|
| 70 | + 'GBP' => __('Pounds Sterling (£)', 'give'), |
|
| 71 | + 'AUD' => __('Australian Dollars ($)', 'give'), |
|
| 72 | + 'BRL' => __('Brazilian Real (R$)', 'give'), |
|
| 73 | + 'CAD' => __('Canadian Dollars ($)', 'give'), |
|
| 74 | + 'CZK' => __('Czech Koruna (Kč)', 'give'), |
|
| 75 | + 'DKK' => __('Danish Krone (kr)', 'give'), |
|
| 76 | + 'HKD' => __('Hong Kong Dollar ($)', 'give'), |
|
| 77 | + 'HUF' => __('Hungarian Forint (Ft)', 'give'), |
|
| 78 | + 'ILS' => __('Israeli Shekel (₪)', 'give'), |
|
| 79 | + 'JPY' => __('Japanese Yen (¥)', 'give'), |
|
| 80 | + 'MYR' => __('Malaysian Ringgits (RM)', 'give'), |
|
| 81 | + 'MXN' => __('Mexican Peso ($)', 'give'), |
|
| 82 | + 'NZD' => __('New Zealand Dollar ($)', 'give'), |
|
| 83 | + 'NOK' => __('Norwegian Krone (Kr.)', 'give'), |
|
| 84 | + 'PHP' => __('Philippine Pesos (₱)', 'give'), |
|
| 85 | + 'PLN' => __('Polish Zloty (zł)', 'give'), |
|
| 86 | + 'SGD' => __('Singapore Dollar ($)', 'give'), |
|
| 87 | + 'SEK' => __('Swedish Krona (kr)', 'give'), |
|
| 88 | + 'CHF' => __('Swiss Franc (CHF)', 'give'), |
|
| 89 | + 'TWD' => __('Taiwan New Dollars (NT$)', 'give'), |
|
| 90 | + 'THB' => __('Thai Baht (฿)', 'give'), |
|
| 91 | + 'INR' => __('Indian Rupee (₹)', 'give'), |
|
| 92 | + 'TRY' => __('Turkish Lira (₺)', 'give'), |
|
| 93 | + 'RIAL' => __('Iranian Rial (﷼)', 'give'), |
|
| 94 | + 'RUB' => __('Russian Rubles (руб)', 'give') |
|
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - return apply_filters( 'give_currencies', $currencies ); |
|
| 97 | + return apply_filters('give_currencies', $currencies); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return string The symbol to use for the currency |
| 111 | 111 | */ |
| 112 | -function give_currency_symbol( $currency = '' ) { |
|
| 112 | +function give_currency_symbol($currency = '') { |
|
| 113 | 113 | |
| 114 | - if ( empty( $currency ) ) { |
|
| 114 | + if (empty($currency)) { |
|
| 115 | 115 | $currency = give_get_currency(); |
| 116 | 116 | } |
| 117 | - switch ( $currency ) : |
|
| 117 | + switch ($currency) : |
|
| 118 | 118 | case 'GBP' : |
| 119 | 119 | $symbol = '£'; |
| 120 | 120 | break; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | break; |
| 184 | 184 | endswitch; |
| 185 | 185 | |
| 186 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
| 186 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function give_get_current_page_url() { |
| 197 | 197 | |
| 198 | - if ( is_front_page() ) { |
|
| 199 | - $current_url = home_url( '/' ); |
|
| 198 | + if (is_front_page()) { |
|
| 199 | + $current_url = home_url('/'); |
|
| 200 | 200 | } else { |
| 201 | - $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 201 | + $current_url = (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) ); |
|
| 204 | + return apply_filters('give_get_current_page_url', esc_url($current_url)); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
@@ -222,15 +222,15 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | $gateways = give_get_enabled_payment_gateways(); |
| 224 | 224 | |
| 225 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
| 225 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
| 226 | 226 | $ret = true; |
| 227 | - } else if ( count( $gateways ) == 1 ) { |
|
| 227 | + } else if (count($gateways) == 1) { |
|
| 228 | 228 | $ret = false; |
| 229 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
| 229 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
| 230 | 230 | $ret = false; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
| 233 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | * @global $give_options |
| 242 | 242 | * @return bool $ret Whether or not the logged_in_only setting is set |
| 243 | 243 | */ |
| 244 | -function give_logged_in_only( $form_id ) { |
|
| 244 | +function give_logged_in_only($form_id) { |
|
| 245 | 245 | |
| 246 | - $form_option = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
| 246 | + $form_option = get_post_meta($form_id, '_give_logged_in_only', true); |
|
| 247 | 247 | |
| 248 | - $ret = ! empty( $form_option ) ? $form_option : false; |
|
| 248 | + $ret = ! empty($form_option) ? $form_option : false; |
|
| 249 | 249 | |
| 250 | - return (bool) apply_filters( 'give_logged_in_only', $ret ); |
|
| 250 | + return (bool) apply_filters('give_logged_in_only', $ret); |
|
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | |
@@ -261,26 +261,26 @@ discard block |
||
| 261 | 261 | function give_get_timezone_id() { |
| 262 | 262 | |
| 263 | 263 | // if site timezone string exists, return it |
| 264 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
| 264 | + if ($timezone = get_option('timezone_string')) { |
|
| 265 | 265 | return $timezone; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // get UTC offset, if it isn't set return UTC |
| 269 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
| 269 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
| 270 | 270 | return 'UTC'; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // attempt to guess the timezone string from the UTC offset |
| 274 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
| 274 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
| 275 | 275 | |
| 276 | 276 | // last try, guess timezone string manually |
| 277 | - if ( $timezone === false ) { |
|
| 277 | + if ($timezone === false) { |
|
| 278 | 278 | |
| 279 | - $is_dst = date( 'I' ); |
|
| 279 | + $is_dst = date('I'); |
|
| 280 | 280 | |
| 281 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
| 282 | - foreach ( $abbr as $city ) { |
|
| 283 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
| 281 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
| 282 | + foreach ($abbr as $city) { |
|
| 283 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
| 284 | 284 | return $city['timezone_id']; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -304,17 +304,17 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | $ip = '127.0.0.1'; |
| 306 | 306 | |
| 307 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
| 307 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
| 308 | 308 | //check ip from share internet |
| 309 | 309 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
| 310 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
| 310 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
| 311 | 311 | //to check ip is pass from proxy |
| 312 | 312 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 313 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
| 313 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
| 314 | 314 | $ip = $_SERVER['REMOTE_ADDR']; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - return apply_filters( 'give_get_ip', $ip ); |
|
| 317 | + return apply_filters('give_get_ip', $ip); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | * |
| 330 | 330 | * @uses Give()->session->set() |
| 331 | 331 | */ |
| 332 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
| 333 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
| 332 | +function give_set_purchase_session($purchase_data = array()) { |
|
| 333 | + Give()->session->set('give_purchase', $purchase_data); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * @return mixed array | false |
| 345 | 345 | */ |
| 346 | 346 | function give_get_purchase_session() { |
| 347 | - return Give()->session->get( 'give_purchase' ); |
|
| 347 | + return Give()->session->get('give_purchase'); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -359,14 +359,14 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @return string |
| 361 | 361 | */ |
| 362 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
| 362 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
| 363 | 363 | $summary = ''; |
| 364 | 364 | |
| 365 | - if ( $email ) { |
|
| 366 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
| 365 | + if ($email) { |
|
| 366 | + $summary .= $purchase_data['user_email'].' - '; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
| 369 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
| 370 | 370 | |
| 371 | 371 | return $summary; |
| 372 | 372 | } |
@@ -383,31 +383,31 @@ discard block |
||
| 383 | 383 | function give_get_host() { |
| 384 | 384 | $host = false; |
| 385 | 385 | |
| 386 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 386 | + if (defined('WPE_APIKEY')) { |
|
| 387 | 387 | $host = 'WP Engine'; |
| 388 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
| 388 | + } elseif (defined('PAGELYBIN')) { |
|
| 389 | 389 | $host = 'Pagely'; |
| 390 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
| 390 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
| 391 | 391 | $host = 'ICDSoft'; |
| 392 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
| 392 | + } elseif (DB_HOST == 'mysqlv5') { |
|
| 393 | 393 | $host = 'NetworkSolutions'; |
| 394 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
| 394 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
| 395 | 395 | $host = 'iPage'; |
| 396 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
| 396 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
| 397 | 397 | $host = 'IPower'; |
| 398 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
| 398 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
| 399 | 399 | $host = 'MediaTemple Grid'; |
| 400 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
| 400 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
| 401 | 401 | $host = 'pair Networks'; |
| 402 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
| 402 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
| 403 | 403 | $host = 'Rackspace Cloud'; |
| 404 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
| 404 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
| 405 | 405 | $host = 'SysFix.eu Power Hosting'; |
| 406 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
| 406 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
| 407 | 407 | $host = 'Flywheel'; |
| 408 | 408 | } else { |
| 409 | 409 | // Adding a general fallback for data gathering |
| 410 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
| 410 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | return $host; |
@@ -423,67 +423,67 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @return bool true if host matches, false if not |
| 425 | 425 | */ |
| 426 | -function give_is_host( $host = false ) { |
|
| 426 | +function give_is_host($host = false) { |
|
| 427 | 427 | |
| 428 | 428 | $return = false; |
| 429 | 429 | |
| 430 | - if ( $host ) { |
|
| 431 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
| 430 | + if ($host) { |
|
| 431 | + $host = str_replace(' ', '', strtolower($host)); |
|
| 432 | 432 | |
| 433 | - switch ( $host ) { |
|
| 433 | + switch ($host) { |
|
| 434 | 434 | case 'wpengine': |
| 435 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 435 | + if (defined('WPE_APIKEY')) { |
|
| 436 | 436 | $return = true; |
| 437 | 437 | } |
| 438 | 438 | break; |
| 439 | 439 | case 'pagely': |
| 440 | - if ( defined( 'PAGELYBIN' ) ) { |
|
| 440 | + if (defined('PAGELYBIN')) { |
|
| 441 | 441 | $return = true; |
| 442 | 442 | } |
| 443 | 443 | break; |
| 444 | 444 | case 'icdsoft': |
| 445 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
| 445 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
| 446 | 446 | $return = true; |
| 447 | 447 | } |
| 448 | 448 | break; |
| 449 | 449 | case 'networksolutions': |
| 450 | - if ( DB_HOST == 'mysqlv5' ) { |
|
| 450 | + if (DB_HOST == 'mysqlv5') { |
|
| 451 | 451 | $return = true; |
| 452 | 452 | } |
| 453 | 453 | break; |
| 454 | 454 | case 'ipage': |
| 455 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
| 455 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
| 456 | 456 | $return = true; |
| 457 | 457 | } |
| 458 | 458 | break; |
| 459 | 459 | case 'ipower': |
| 460 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
| 460 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
| 461 | 461 | $return = true; |
| 462 | 462 | } |
| 463 | 463 | break; |
| 464 | 464 | case 'mediatemplegrid': |
| 465 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
| 465 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
| 466 | 466 | $return = true; |
| 467 | 467 | } |
| 468 | 468 | break; |
| 469 | 469 | case 'pairnetworks': |
| 470 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
| 470 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
| 471 | 471 | $return = true; |
| 472 | 472 | } |
| 473 | 473 | break; |
| 474 | 474 | case 'rackspacecloud': |
| 475 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
| 475 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
| 476 | 476 | $return = true; |
| 477 | 477 | } |
| 478 | 478 | break; |
| 479 | 479 | case 'sysfix.eu': |
| 480 | 480 | case 'sysfix.eupowerhosting': |
| 481 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
| 481 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
| 482 | 482 | $return = true; |
| 483 | 483 | } |
| 484 | 484 | break; |
| 485 | 485 | case 'flywheel': |
| 486 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
| 486 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
| 487 | 487 | $return = true; |
| 488 | 488 | } |
| 489 | 489 | break; |
@@ -516,20 +516,20 @@ discard block |
||
| 516 | 516 | * @param string $replacement Optional. The function that should have been called |
| 517 | 517 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function |
| 518 | 518 | */ |
| 519 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
| 520 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
| 519 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
| 520 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
| 521 | 521 | |
| 522 | - $show_errors = current_user_can( 'manage_options' ); |
|
| 522 | + $show_errors = current_user_can('manage_options'); |
|
| 523 | 523 | |
| 524 | 524 | // Allow plugin to filter the output error trigger |
| 525 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
| 526 | - if ( ! is_null( $replacement ) ) { |
|
| 527 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
| 528 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
| 525 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
| 526 | + if ( ! is_null($replacement)) { |
|
| 527 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
| 528 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
| 529 | 529 | // Alternatively we could dump this to a file. |
| 530 | 530 | } else { |
| 531 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
| 532 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
| 531 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
| 532 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
| 533 | 533 | // Alternatively we could dump this to a file. |
| 534 | 534 | } |
| 535 | 535 | } |
@@ -543,8 +543,8 @@ discard block |
||
| 543 | 543 | * @return string $post_id |
| 544 | 544 | */ |
| 545 | 545 | function give_get_admin_post_id() { |
| 546 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
| 547 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
| 546 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
| 547 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
| 548 | 548 | $post_id = $_POST['post_id']; |
| 549 | 549 | } |
| 550 | 550 | |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | * @return string Arg separator output |
| 559 | 559 | */ |
| 560 | 560 | function give_get_php_arg_separator_output() { |
| 561 | - return ini_get( 'arg_separator.output' ); |
|
| 561 | + return ini_get('arg_separator.output'); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | |
@@ -573,10 +573,10 @@ discard block |
||
| 573 | 573 | * |
| 574 | 574 | * @return string Short month name |
| 575 | 575 | */ |
| 576 | -function give_month_num_to_name( $n ) { |
|
| 577 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
| 576 | +function give_month_num_to_name($n) { |
|
| 577 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
| 578 | 578 | |
| 579 | - return date_i18n( "M", $timestamp ); |
|
| 579 | + return date_i18n("M", $timestamp); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | |
@@ -589,10 +589,10 @@ discard block |
||
| 589 | 589 | * |
| 590 | 590 | * @return bool Whether or not function is disabled. |
| 591 | 591 | */ |
| 592 | -function give_is_func_disabled( $function ) { |
|
| 593 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
| 592 | +function give_is_func_disabled($function) { |
|
| 593 | + $disabled = explode(',', ini_get('disable_functions')); |
|
| 594 | 594 | |
| 595 | - return in_array( $function, $disabled ); |
|
| 595 | + return in_array($function, $disabled); |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | <form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> |
| 609 | 609 | <div class="give-newsletter-confirmation"> |
| 610 | - <p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
| 610 | + <p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
| 611 | 611 | </div> |
| 612 | 612 | |
| 613 | 613 | <table class="form-table give-newsletter-form"> |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | * |
| 704 | 704 | * @return mixed |
| 705 | 705 | */ |
| 706 | -function give_svg_icons( $icon ) { |
|
| 706 | +function give_svg_icons($icon) { |
|
| 707 | 707 | |
| 708 | 708 | // Store your SVGs in an associative array |
| 709 | 709 | $svgs = array( |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | ); |
| 716 | 716 | |
| 717 | 717 | // Return the chosen icon's SVG string |
| 718 | - return $svgs[ $icon ]; |
|
| 718 | + return $svgs[$icon]; |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | /** |
@@ -727,15 +727,15 @@ discard block |
||
| 727 | 727 | * |
| 728 | 728 | * @return mixed |
| 729 | 729 | */ |
| 730 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
| 731 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
| 730 | +function modify_nav_menu_meta_box_object($post_type) { |
|
| 731 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
| 732 | 732 | $post_type->labels->name = 'Donation Forms'; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | return $post_type; |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
| 738 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
| 739 | 739 | |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | * @license http://opensource.org/licenses/MIT MIT |
| 749 | 749 | */ |
| 750 | 750 | |
| 751 | -if ( ! function_exists( 'array_column' ) ) { |
|
| 751 | +if ( ! function_exists('array_column')) { |
|
| 752 | 752 | /** |
| 753 | 753 | * Returns the values from a single column of the input array, identified by |
| 754 | 754 | * the $columnKey. |
@@ -767,56 +767,56 @@ discard block |
||
| 767 | 767 | * |
| 768 | 768 | * @return array |
| 769 | 769 | */ |
| 770 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
| 770 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
| 771 | 771 | // Using func_get_args() in order to check for proper number of |
| 772 | 772 | // parameters and trigger errors exactly as the built-in array_column() |
| 773 | 773 | // does in PHP 5.5. |
| 774 | 774 | $argc = func_num_args(); |
| 775 | 775 | $params = func_get_args(); |
| 776 | 776 | |
| 777 | - if ( $argc < 2 ) { |
|
| 778 | - trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING ); |
|
| 777 | + if ($argc < 2) { |
|
| 778 | + trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING); |
|
| 779 | 779 | |
| 780 | 780 | return null; |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - if ( ! is_array( $params[0] ) ) { |
|
| 783 | + if ( ! is_array($params[0])) { |
|
| 784 | 784 | trigger_error( |
| 785 | - 'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given', |
|
| 785 | + 'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given', |
|
| 786 | 786 | E_USER_WARNING |
| 787 | 787 | ); |
| 788 | 788 | |
| 789 | 789 | return null; |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - if ( ! is_int( $params[1] ) |
|
| 793 | - && ! is_float( $params[1] ) |
|
| 794 | - && ! is_string( $params[1] ) |
|
| 792 | + if ( ! is_int($params[1]) |
|
| 793 | + && ! is_float($params[1]) |
|
| 794 | + && ! is_string($params[1]) |
|
| 795 | 795 | && $params[1] !== null |
| 796 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 796 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
| 797 | 797 | ) { |
| 798 | - trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
|
| 798 | + trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
|
| 799 | 799 | |
| 800 | 800 | return false; |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | - if ( isset( $params[2] ) |
|
| 804 | - && ! is_int( $params[2] ) |
|
| 805 | - && ! is_float( $params[2] ) |
|
| 806 | - && ! is_string( $params[2] ) |
|
| 807 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 803 | + if (isset($params[2]) |
|
| 804 | + && ! is_int($params[2]) |
|
| 805 | + && ! is_float($params[2]) |
|
| 806 | + && ! is_string($params[2]) |
|
| 807 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
| 808 | 808 | ) { |
| 809 | - trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
|
| 809 | + trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
|
| 810 | 810 | |
| 811 | 811 | return false; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | $paramsInput = $params[0]; |
| 815 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
| 815 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
| 816 | 816 | |
| 817 | 817 | $paramsIndexKey = null; |
| 818 | - if ( isset( $params[2] ) ) { |
|
| 819 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
| 818 | + if (isset($params[2])) { |
|
| 819 | + if (is_float($params[2]) || is_int($params[2])) { |
|
| 820 | 820 | $paramsIndexKey = (int) $params[2]; |
| 821 | 821 | } else { |
| 822 | 822 | $paramsIndexKey = (string) $params[2]; |
@@ -825,26 +825,26 @@ discard block |
||
| 825 | 825 | |
| 826 | 826 | $resultArray = array(); |
| 827 | 827 | |
| 828 | - foreach ( $paramsInput as $row ) { |
|
| 828 | + foreach ($paramsInput as $row) { |
|
| 829 | 829 | $key = $value = null; |
| 830 | 830 | $keySet = $valueSet = false; |
| 831 | 831 | |
| 832 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
| 832 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
| 833 | 833 | $keySet = true; |
| 834 | - $key = (string) $row[ $paramsIndexKey ]; |
|
| 834 | + $key = (string) $row[$paramsIndexKey]; |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ( $paramsColumnKey === null ) { |
|
| 837 | + if ($paramsColumnKey === null) { |
|
| 838 | 838 | $valueSet = true; |
| 839 | 839 | $value = $row; |
| 840 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
| 840 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
| 841 | 841 | $valueSet = true; |
| 842 | - $value = $row[ $paramsColumnKey ]; |
|
| 842 | + $value = $row[$paramsColumnKey]; |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | - if ( $valueSet ) { |
|
| 846 | - if ( $keySet ) { |
|
| 847 | - $resultArray[ $key ] = $value; |
|
| 845 | + if ($valueSet) { |
|
| 846 | + if ($keySet) { |
|
| 847 | + $resultArray[$key] = $value; |
|
| 848 | 848 | } else { |
| 849 | 849 | $resultArray[] = $value; |
| 850 | 850 | } |
@@ -866,39 +866,39 @@ discard block |
||
| 866 | 866 | * |
| 867 | 867 | * @return bool Whether the receipt is visible or not. |
| 868 | 868 | */ |
| 869 | -function give_can_view_receipt( $payment_key = '' ) { |
|
| 869 | +function give_can_view_receipt($payment_key = '') { |
|
| 870 | 870 | |
| 871 | 871 | $return = false; |
| 872 | 872 | |
| 873 | - if ( empty( $payment_key ) ) { |
|
| 873 | + if (empty($payment_key)) { |
|
| 874 | 874 | return $return; |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | global $give_receipt_args; |
| 878 | 878 | |
| 879 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
| 879 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
| 880 | 880 | |
| 881 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
| 881 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
| 882 | 882 | |
| 883 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
| 883 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
| 884 | 884 | |
| 885 | - if ( is_user_logged_in() ) { |
|
| 886 | - if ( $user_id === (int) get_current_user_id() ) { |
|
| 885 | + if (is_user_logged_in()) { |
|
| 886 | + if ($user_id === (int) get_current_user_id()) { |
|
| 887 | 887 | $return = true; |
| 888 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
| 888 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
| 889 | 889 | $return = true; |
| 890 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
| 890 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
| 891 | 891 | $return = true; |
| 892 | 892 | } |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | $session = give_get_purchase_session(); |
| 896 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
| 897 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
| 896 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
| 897 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
| 898 | 898 | $return = true; |
| 899 | 899 | } |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
| 902 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
| 903 | 903 | |
| 904 | 904 | } |
| 905 | 905 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return bool $ret True if guest checkout is enabled, false otherwise |
| 30 | 30 | */ |
| 31 | -function give_no_guest_checkout( $form_id ) { |
|
| 31 | +function give_no_guest_checkout($form_id) { |
|
| 32 | 32 | |
| 33 | 33 | $backtrace = debug_backtrace(); |
| 34 | 34 | |
| 35 | - _give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace ); |
|
| 35 | + _give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace); |
|
| 36 | 36 | |
| 37 | - $ret = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
| 37 | + $ret = get_post_meta($form_id, '_give_logged_in_only', true); |
|
| 38 | 38 | |
| 39 | - return (bool) apply_filters( 'give_no_guest_checkout', $ret ); |
|
| 39 | + return (bool) apply_filters('give_no_guest_checkout', $ret); |
|
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,27 +25,27 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_process_purchase_form() { |
| 27 | 27 | |
| 28 | - do_action( 'give_pre_process_purchase' ); |
|
| 28 | + do_action('give_pre_process_purchase'); |
|
| 29 | 29 | |
| 30 | 30 | // Validate the form $_POST data |
| 31 | 31 | $valid_data = give_purchase_form_validate_fields(); |
| 32 | 32 | |
| 33 | 33 | // Allow themes and plugins to hook to errors |
| 34 | - do_action( 'give_checkout_error_checks', $valid_data, $_POST ); |
|
| 34 | + do_action('give_checkout_error_checks', $valid_data, $_POST); |
|
| 35 | 35 | |
| 36 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
| 36 | + $is_ajax = isset($_POST['give_ajax']); |
|
| 37 | 37 | |
| 38 | 38 | // Process the login form |
| 39 | - if ( isset( $_POST['give_login_submit'] ) ) { |
|
| 39 | + if (isset($_POST['give_login_submit'])) { |
|
| 40 | 40 | give_process_form_login(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Validate the user |
| 44 | - $user = give_get_purchase_form_user( $valid_data ); |
|
| 44 | + $user = give_get_purchase_form_user($valid_data); |
|
| 45 | 45 | |
| 46 | - if ( give_get_errors() || ! $user ) { |
|
| 47 | - if ( $is_ajax ) { |
|
| 48 | - do_action( 'give_ajax_checkout_errors' ); |
|
| 46 | + if (give_get_errors() || ! $user) { |
|
| 47 | + if ($is_ajax) { |
|
| 48 | + do_action('give_ajax_checkout_errors'); |
|
| 49 | 49 | give_die(); |
| 50 | 50 | } else { |
| 51 | 51 | return false; |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //If AJAX send back success to proceed with form submission |
| 56 | - if ( $is_ajax ) { |
|
| 56 | + if ($is_ajax) { |
|
| 57 | 57 | echo 'success'; |
| 58 | 58 | give_die(); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | //After AJAX: Setup session if not using php_sessions |
| 62 | - if ( ! Give()->session->use_php_sessions() ) { |
|
| 62 | + if ( ! Give()->session->use_php_sessions()) { |
|
| 63 | 63 | //Double-check that set_cookie is publicly accessible; |
| 64 | 64 | // we're using a slightly modified class-wp-sessions.php |
| 65 | - $session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' ); |
|
| 66 | - if ( $session_reflection->isPublic() ) { |
|
| 65 | + $session_reflection = new ReflectionMethod('WP_Session', 'set_cookie'); |
|
| 66 | + if ($session_reflection->isPublic()) { |
|
| 67 | 67 | // Manually set the cookie. |
| 68 | 68 | Give()->session->init()->set_cookie(); |
| 69 | 69 | } |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | 'address' => $user['address'] |
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
| 81 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
| 82 | 82 | |
| 83 | 83 | // Setup purchase information |
| 84 | 84 | $purchase_data = array( |
| 85 | - 'price' => ( isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00' ), |
|
| 86 | - 'purchase_key' => strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ), |
|
| 85 | + 'price' => (isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00'), |
|
| 86 | + 'purchase_key' => strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true))), |
|
| 87 | 87 | 'user_email' => $user['user_email'], |
| 88 | - 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
|
| 89 | - 'user_info' => stripslashes_deep( $user_info ), |
|
| 88 | + 'date' => date('Y-m-d H:i:s', current_time('timestamp')), |
|
| 89 | + 'user_info' => stripslashes_deep($user_info), |
|
| 90 | 90 | 'post_data' => $_POST, |
| 91 | 91 | 'gateway' => $valid_data['gateway'], |
| 92 | 92 | 'card_info' => $valid_data['cc_info'] |
@@ -96,36 +96,36 @@ discard block |
||
| 96 | 96 | $valid_data['user'] = $user; |
| 97 | 97 | |
| 98 | 98 | // Allow themes and plugins to hook before the gateway |
| 99 | - do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data ); |
|
| 99 | + do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data); |
|
| 100 | 100 | |
| 101 | 101 | //Sanity check for price |
| 102 | - if ( ! $purchase_data['price'] ) { |
|
| 102 | + if ( ! $purchase_data['price']) { |
|
| 103 | 103 | // Revert to manual |
| 104 | 104 | $purchase_data['gateway'] = 'manual'; |
| 105 | 105 | $_POST['give-gateway'] = 'manual'; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Allow the purchase data to be modified before it is sent to the gateway |
| 109 | - $purchase_data = apply_filters( 'give_purchase_data_before_gateway', $purchase_data, $valid_data ); |
|
| 109 | + $purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data); |
|
| 110 | 110 | |
| 111 | 111 | // Setup the data we're storing in the purchase session |
| 112 | 112 | $session_data = $purchase_data; |
| 113 | 113 | |
| 114 | 114 | // Make sure credit card numbers are never stored in sessions |
| 115 | - unset( $session_data['card_info']['card_number'] ); |
|
| 115 | + unset($session_data['card_info']['card_number']); |
|
| 116 | 116 | |
| 117 | 117 | // Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data. |
| 118 | - give_set_purchase_session( $session_data ); |
|
| 118 | + give_set_purchase_session($session_data); |
|
| 119 | 119 | |
| 120 | 120 | // Send info to the gateway for payment processing |
| 121 | - give_send_to_gateway( $purchase_data['gateway'], $purchase_data ); |
|
| 121 | + give_send_to_gateway($purchase_data['gateway'], $purchase_data); |
|
| 122 | 122 | give_die(); |
| 123 | 123 | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | -add_action( 'give_purchase', 'give_process_purchase_form' ); |
|
| 127 | -add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' ); |
|
| 128 | -add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' ); |
|
| 126 | +add_action('give_purchase', 'give_process_purchase_form'); |
|
| 127 | +add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form'); |
|
| 128 | +add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form'); |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * Process the checkout login form |
@@ -136,32 +136,32 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | function give_process_form_login() { |
| 138 | 138 | |
| 139 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
| 139 | + $is_ajax = isset($_POST['give_ajax']); |
|
| 140 | 140 | |
| 141 | 141 | $user_data = give_purchase_form_validate_user_login(); |
| 142 | 142 | |
| 143 | - if ( give_get_errors() || $user_data['user_id'] < 1 ) { |
|
| 144 | - if ( $is_ajax ) { |
|
| 145 | - do_action( 'give_ajax_checkout_errors' ); |
|
| 143 | + if (give_get_errors() || $user_data['user_id'] < 1) { |
|
| 144 | + if ($is_ajax) { |
|
| 145 | + do_action('give_ajax_checkout_errors'); |
|
| 146 | 146 | give_die(); |
| 147 | 147 | } else { |
| 148 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
| 148 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 149 | 149 | exit; |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] ); |
|
| 153 | + give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']); |
|
| 154 | 154 | |
| 155 | - if ( $is_ajax ) { |
|
| 155 | + if ($is_ajax) { |
|
| 156 | 156 | echo 'success'; |
| 157 | 157 | give_die(); |
| 158 | 158 | } else { |
| 159 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
| 159 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | -add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' ); |
|
| 164 | -add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' ); |
|
| 163 | +add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login'); |
|
| 164 | +add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login'); |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * Purchase Form Validate Fields |
@@ -173,40 +173,40 @@ discard block |
||
| 173 | 173 | function give_purchase_form_validate_fields() { |
| 174 | 174 | |
| 175 | 175 | // Check if there is $_POST |
| 176 | - if ( empty( $_POST ) ) { |
|
| 176 | + if (empty($_POST)) { |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 180 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 181 | 181 | |
| 182 | 182 | // Start an array to collect valid data |
| 183 | 183 | $valid_data = array( |
| 184 | 184 | 'gateway' => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here) |
| 185 | - 'need_new_user' => false, // New user flag |
|
| 186 | - 'need_user_login' => false, // Login user flag |
|
| 187 | - 'logged_user_data' => array(), // Logged user collected data |
|
| 188 | - 'new_user_data' => array(), // New user collected data |
|
| 189 | - 'login_user_data' => array(), // Login user collected data |
|
| 190 | - 'guest_user_data' => array(), // Guest user collected data |
|
| 185 | + 'need_new_user' => false, // New user flag |
|
| 186 | + 'need_user_login' => false, // Login user flag |
|
| 187 | + 'logged_user_data' => array(), // Logged user collected data |
|
| 188 | + 'new_user_data' => array(), // New user collected data |
|
| 189 | + 'login_user_data' => array(), // Login user collected data |
|
| 190 | + 'guest_user_data' => array(), // Guest user collected data |
|
| 191 | 191 | 'cc_info' => give_purchase_form_validate_cc() // Credit card info |
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | 194 | // Validate agree to terms |
| 195 | - $terms_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 196 | - if ( isset( $terms_option ) && $terms_option === 'yes' ) { |
|
| 195 | + $terms_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 196 | + if (isset($terms_option) && $terms_option === 'yes') { |
|
| 197 | 197 | give_purchase_form_validate_agree_to_terms(); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if ( is_user_logged_in() ) { |
|
| 200 | + if (is_user_logged_in()) { |
|
| 201 | 201 | // Collect logged in user data |
| 202 | 202 | $valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user(); |
| 203 | - } else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) { |
|
| 203 | + } else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') { |
|
| 204 | 204 | // Set new user registration as required |
| 205 | 205 | $valid_data['need_new_user'] = true; |
| 206 | 206 | // Validate new user data |
| 207 | 207 | $valid_data['new_user_data'] = give_purchase_form_validate_new_user(); |
| 208 | 208 | // Check if login validation is needed |
| 209 | - } else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) { |
|
| 209 | + } else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') { |
|
| 210 | 210 | // Set user login as required |
| 211 | 211 | $valid_data['need_user_login'] = true; |
| 212 | 212 | // Validate users login info |
@@ -229,35 +229,35 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function give_purchase_form_validate_gateway() { |
| 231 | 231 | |
| 232 | - $gateway = give_get_default_gateway( $_REQUEST['give-form-id'] ); |
|
| 232 | + $gateway = give_get_default_gateway($_REQUEST['give-form-id']); |
|
| 233 | 233 | |
| 234 | 234 | // Check if a gateway value is present |
| 235 | - if ( ! empty( $_REQUEST['give-gateway'] ) ) { |
|
| 235 | + if ( ! empty($_REQUEST['give-gateway'])) { |
|
| 236 | 236 | |
| 237 | - $gateway = sanitize_text_field( $_REQUEST['give-gateway'] ); |
|
| 237 | + $gateway = sanitize_text_field($_REQUEST['give-gateway']); |
|
| 238 | 238 | |
| 239 | 239 | //Is amount being donated in LIVE mode above 0.00? |
| 240 | - if ( '0.00' == $_REQUEST['give-amount'] && ! give_is_test_mode() ) { |
|
| 240 | + if ('0.00' == $_REQUEST['give-amount'] && ! give_is_test_mode()) { |
|
| 241 | 241 | |
| 242 | - give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) ); |
|
| 242 | + give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give')); |
|
| 243 | 243 | |
| 244 | 244 | } //Check for a minimum custom amount |
| 245 | - elseif ( ! give_verify_minimum_price() ) { |
|
| 245 | + elseif ( ! give_verify_minimum_price()) { |
|
| 246 | 246 | |
| 247 | - $minimum = give_currency_filter( give_format_amount( give_get_form_minimum_price( $_REQUEST['give-form-id'] ) ) ); |
|
| 248 | - $error_message = __( 'This form has a minimum donation amount of %s', 'give' ); |
|
| 247 | + $minimum = give_currency_filter(give_format_amount(give_get_form_minimum_price($_REQUEST['give-form-id']))); |
|
| 248 | + $error_message = __('This form has a minimum donation amount of %s', 'give'); |
|
| 249 | 249 | |
| 250 | - give_set_error( 'invalid_donation_minimum', sprintf( $error_message, $minimum ) ); |
|
| 250 | + give_set_error('invalid_donation_minimum', sprintf($error_message, $minimum)); |
|
| 251 | 251 | |
| 252 | 252 | } //Is this test mode zero donation? Let it through but set to manual gateway |
| 253 | - elseif ( '0.00' == $_REQUEST['give-amount'] && give_is_test_mode() ) { |
|
| 253 | + elseif ('0.00' == $_REQUEST['give-amount'] && give_is_test_mode()) { |
|
| 254 | 254 | |
| 255 | 255 | $gateway = 'manual'; |
| 256 | 256 | |
| 257 | 257 | } //Check if this gateway is active |
| 258 | - elseif ( ! give_is_gateway_active( $gateway ) ) { |
|
| 258 | + elseif ( ! give_is_gateway_active($gateway)) { |
|
| 259 | 259 | |
| 260 | - give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'give' ) ); |
|
| 260 | + give_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'give')); |
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
@@ -276,23 +276,23 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | function give_verify_minimum_price() { |
| 278 | 278 | |
| 279 | - $amount = give_sanitize_amount( $_REQUEST['give-amount'] ); |
|
| 279 | + $amount = give_sanitize_amount($_REQUEST['give-amount']); |
|
| 280 | 280 | $form_id = $_REQUEST['give-form-id']; |
| 281 | - $price_id = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0; |
|
| 282 | - $variable_prices = give_has_variable_prices( $form_id ); |
|
| 281 | + $price_id = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0; |
|
| 282 | + $variable_prices = give_has_variable_prices($form_id); |
|
| 283 | 283 | |
| 284 | - if ( $variable_prices && ! empty( $price_id ) ) { |
|
| 284 | + if ($variable_prices && ! empty($price_id)) { |
|
| 285 | 285 | |
| 286 | - $price_level_amount = give_get_price_option_amount( $form_id, $price_id ); |
|
| 286 | + $price_level_amount = give_get_price_option_amount($form_id, $price_id); |
|
| 287 | 287 | |
| 288 | - if ( $price_level_amount == $amount ) { |
|
| 288 | + if ($price_level_amount == $amount) { |
|
| 289 | 289 | return true; |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - $minimum = give_get_form_minimum_price( $form_id ); |
|
| 293 | + $minimum = give_get_form_minimum_price($form_id); |
|
| 294 | 294 | |
| 295 | - if ( $minimum > $amount ) { |
|
| 295 | + if ($minimum > $amount) { |
|
| 296 | 296 | return false; |
| 297 | 297 | } |
| 298 | 298 | |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | function give_purchase_form_validate_agree_to_terms() { |
| 310 | 310 | // Validate agree to terms |
| 311 | - if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) { |
|
| 311 | + if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) { |
|
| 312 | 312 | // User did not agree |
| 313 | - give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use', 'give' ) ) ); |
|
| 313 | + give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use', 'give'))); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
@@ -324,47 +324,47 @@ discard block |
||
| 324 | 324 | * |
| 325 | 325 | * @return array |
| 326 | 326 | */ |
| 327 | -function give_purchase_form_required_fields( $form_id ) { |
|
| 327 | +function give_purchase_form_required_fields($form_id) { |
|
| 328 | 328 | |
| 329 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 329 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 330 | 330 | |
| 331 | 331 | $required_fields = array( |
| 332 | 332 | 'give_email' => array( |
| 333 | 333 | 'error_id' => 'invalid_email', |
| 334 | - 'error_message' => __( 'Please enter a valid email address', 'give' ) |
|
| 334 | + 'error_message' => __('Please enter a valid email address', 'give') |
|
| 335 | 335 | ), |
| 336 | 336 | 'give_first' => array( |
| 337 | 337 | 'error_id' => 'invalid_first_name', |
| 338 | - 'error_message' => __( 'Please enter your first name', 'give' ) |
|
| 338 | + 'error_message' => __('Please enter your first name', 'give') |
|
| 339 | 339 | ) |
| 340 | 340 | ); |
| 341 | 341 | |
| 342 | - $require_address = give_require_billing_address( $payment_mode ); |
|
| 342 | + $require_address = give_require_billing_address($payment_mode); |
|
| 343 | 343 | |
| 344 | - if ( $require_address ) { |
|
| 345 | - $required_fields['card_address'] = array( |
|
| 344 | + if ($require_address) { |
|
| 345 | + $required_fields['card_address'] = array( |
|
| 346 | 346 | 'error_id' => 'invalid_card_address', |
| 347 | - 'error_message' => __( 'Please enter your primary billing address', 'give' ) |
|
| 347 | + 'error_message' => __('Please enter your primary billing address', 'give') |
|
| 348 | 348 | ); |
| 349 | - $required_fields['card_zip'] = array( |
|
| 349 | + $required_fields['card_zip'] = array( |
|
| 350 | 350 | 'error_id' => 'invalid_zip_code', |
| 351 | - 'error_message' => __( 'Please enter your zip / postal code', 'give' ) |
|
| 351 | + 'error_message' => __('Please enter your zip / postal code', 'give') |
|
| 352 | 352 | ); |
| 353 | - $required_fields['card_city'] = array( |
|
| 353 | + $required_fields['card_city'] = array( |
|
| 354 | 354 | 'error_id' => 'invalid_city', |
| 355 | - 'error_message' => __( 'Please enter your billing city', 'give' ) |
|
| 355 | + 'error_message' => __('Please enter your billing city', 'give') |
|
| 356 | 356 | ); |
| 357 | 357 | $required_fields['billing_country'] = array( |
| 358 | 358 | 'error_id' => 'invalid_country', |
| 359 | - 'error_message' => __( 'Please select your billing country', 'give' ) |
|
| 359 | + 'error_message' => __('Please select your billing country', 'give') |
|
| 360 | 360 | ); |
| 361 | - $required_fields['card_state'] = array( |
|
| 361 | + $required_fields['card_state'] = array( |
|
| 362 | 362 | 'error_id' => 'invalid_state', |
| 363 | - 'error_message' => __( 'Please enter billing state / province', 'give' ) |
|
| 363 | + 'error_message' => __('Please enter billing state / province', 'give') |
|
| 364 | 364 | ); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id ); |
|
| 367 | + return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id); |
|
| 368 | 368 | |
| 369 | 369 | } |
| 370 | 370 | |
@@ -377,16 +377,16 @@ discard block |
||
| 377 | 377 | * |
| 378 | 378 | * @return mixed|void |
| 379 | 379 | */ |
| 380 | -function give_require_billing_address( $payment_mode ) { |
|
| 380 | +function give_require_billing_address($payment_mode) { |
|
| 381 | 381 | |
| 382 | 382 | $return = false; |
| 383 | 383 | |
| 384 | - if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) { |
|
| 384 | + if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) { |
|
| 385 | 385 | $return = true; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // Let payment gateways and other extensions determine if address fields should be required |
| 389 | - return apply_filters( 'give_require_billing_address', $return ); |
|
| 389 | + return apply_filters('give_require_billing_address', $return); |
|
| 390 | 390 | |
| 391 | 391 | } |
| 392 | 392 | |
@@ -400,43 +400,43 @@ discard block |
||
| 400 | 400 | function give_purchase_form_validate_logged_in_user() { |
| 401 | 401 | global $user_ID; |
| 402 | 402 | |
| 403 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 403 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 404 | 404 | |
| 405 | 405 | // Start empty array to collect valid user data |
| 406 | 406 | $valid_user_data = array( |
| 407 | 407 | // Assume there will be errors |
| 408 | - 'user_id' => - 1 |
|
| 408 | + 'user_id' => -1 |
|
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | 411 | // Verify there is a user_ID |
| 412 | - if ( $user_ID > 0 ) { |
|
| 412 | + if ($user_ID > 0) { |
|
| 413 | 413 | // Get the logged in user data |
| 414 | - $user_data = get_userdata( $user_ID ); |
|
| 414 | + $user_data = get_userdata($user_ID); |
|
| 415 | 415 | |
| 416 | 416 | // Loop through required fields and show error messages |
| 417 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
| 418 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
| 419 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
| 417 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
| 418 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
| 419 | + give_set_error($value['error_id'], $value['error_message']); |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | // Verify data |
| 424 | - if ( $user_data ) { |
|
| 424 | + if ($user_data) { |
|
| 425 | 425 | // Collected logged in user data |
| 426 | 426 | $valid_user_data = array( |
| 427 | 427 | 'user_id' => $user_ID, |
| 428 | - 'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email, |
|
| 429 | - 'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name, |
|
| 430 | - 'user_last' => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name, |
|
| 428 | + 'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email, |
|
| 429 | + 'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name, |
|
| 430 | + 'user_last' => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name, |
|
| 431 | 431 | ); |
| 432 | 432 | |
| 433 | - if ( ! is_email( $valid_user_data['user_email'] ) ) { |
|
| 434 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
| 433 | + if ( ! is_email($valid_user_data['user_email'])) { |
|
| 434 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | } else { |
| 438 | 438 | // Set invalid user error |
| 439 | - give_set_error( 'invalid_user', __( 'The user information is invalid', 'give' ) ); |
|
| 439 | + give_set_error('invalid_user', __('The user information is invalid', 'give')); |
|
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | |
@@ -454,90 +454,90 @@ discard block |
||
| 454 | 454 | function give_purchase_form_validate_new_user() { |
| 455 | 455 | |
| 456 | 456 | $registering_new_user = false; |
| 457 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 457 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 458 | 458 | |
| 459 | 459 | // Start an empty array to collect valid user data |
| 460 | 460 | $valid_user_data = array( |
| 461 | 461 | // Assume there will be errors |
| 462 | - 'user_id' => - 1, |
|
| 462 | + 'user_id' => -1, |
|
| 463 | 463 | // Get first name |
| 464 | - 'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '', |
|
| 464 | + 'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '', |
|
| 465 | 465 | // Get last name |
| 466 | - 'user_last' => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '', |
|
| 466 | + 'user_last' => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '', |
|
| 467 | 467 | ); |
| 468 | 468 | |
| 469 | 469 | // Check the new user's credentials against existing ones |
| 470 | - $user_login = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false; |
|
| 471 | - $user_email = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false; |
|
| 472 | - $user_pass = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false; |
|
| 473 | - $pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false; |
|
| 470 | + $user_login = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false; |
|
| 471 | + $user_email = isset($_POST['give_email']) ? trim($_POST['give_email']) : false; |
|
| 472 | + $user_pass = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false; |
|
| 473 | + $pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false; |
|
| 474 | 474 | |
| 475 | 475 | // Loop through required fields and show error messages |
| 476 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
| 477 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
| 478 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
| 476 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
| 477 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
| 478 | + give_set_error($value['error_id'], $value['error_message']); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | // Check if we have an username to register |
| 483 | - if ( $user_login && strlen( $user_login ) > 0 ) { |
|
| 483 | + if ($user_login && strlen($user_login) > 0) { |
|
| 484 | 484 | $registering_new_user = true; |
| 485 | 485 | |
| 486 | 486 | // We have an user name, check if it already exists |
| 487 | - if ( username_exists( $user_login ) ) { |
|
| 487 | + if (username_exists($user_login)) { |
|
| 488 | 488 | // Username already registered |
| 489 | - give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) ); |
|
| 489 | + give_set_error('username_unavailable', __('Username already taken', 'give')); |
|
| 490 | 490 | // Check if it's valid |
| 491 | - } else if ( ! give_validate_username( $user_login ) ) { |
|
| 491 | + } else if ( ! give_validate_username($user_login)) { |
|
| 492 | 492 | // Invalid username |
| 493 | - if ( is_multisite() ) { |
|
| 494 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give' ) ); |
|
| 493 | + if (is_multisite()) { |
|
| 494 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give')); |
|
| 495 | 495 | } else { |
| 496 | - give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) ); |
|
| 496 | + give_set_error('username_invalid', __('Invalid username', 'give')); |
|
| 497 | 497 | } |
| 498 | 498 | } else { |
| 499 | 499 | // All the checks have run and it's good to go |
| 500 | 500 | $valid_user_data['user_login'] = $user_login; |
| 501 | 501 | } |
| 502 | - } elseif ( give_logged_in_only( $form_id ) ) { |
|
| 503 | - give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation', 'give' ) ); |
|
| 502 | + } elseif (give_logged_in_only($form_id)) { |
|
| 503 | + give_set_error('registration_required', esc_html__('You must register or login to complete your donation', 'give')); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // Check if we have an email to verify |
| 507 | - if ( $user_email && strlen( $user_email ) > 0 ) { |
|
| 507 | + if ($user_email && strlen($user_email) > 0) { |
|
| 508 | 508 | // Validate email |
| 509 | - if ( ! is_email( $user_email ) ) { |
|
| 510 | - give_set_error( 'email_invalid', __( 'Sorry, that email is invalid', 'give' ) ); |
|
| 509 | + if ( ! is_email($user_email)) { |
|
| 510 | + give_set_error('email_invalid', __('Sorry, that email is invalid', 'give')); |
|
| 511 | 511 | // Check if email exists |
| 512 | - } else if ( email_exists( $user_email ) && $registering_new_user ) { |
|
| 513 | - give_set_error( 'email_used', __( 'Sorry, that email already active for another user', 'give' ) ); |
|
| 512 | + } else if (email_exists($user_email) && $registering_new_user) { |
|
| 513 | + give_set_error('email_used', __('Sorry, that email already active for another user', 'give')); |
|
| 514 | 514 | } else { |
| 515 | 515 | // All the checks have run and it's good to go |
| 516 | 516 | $valid_user_data['user_email'] = $user_email; |
| 517 | 517 | } |
| 518 | 518 | } else { |
| 519 | 519 | // No email |
| 520 | - give_set_error( 'email_empty', __( 'Enter an email', 'give' ) ); |
|
| 520 | + give_set_error('email_empty', __('Enter an email', 'give')); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | // Check password |
| 524 | - if ( $user_pass && $pass_confirm ) { |
|
| 524 | + if ($user_pass && $pass_confirm) { |
|
| 525 | 525 | // Verify confirmation matches |
| 526 | - if ( $user_pass != $pass_confirm ) { |
|
| 526 | + if ($user_pass != $pass_confirm) { |
|
| 527 | 527 | // Passwords do not match |
| 528 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) ); |
|
| 528 | + give_set_error('password_mismatch', __('Passwords don\'t match', 'give')); |
|
| 529 | 529 | } else { |
| 530 | 530 | // All is good to go |
| 531 | 531 | $valid_user_data['user_pass'] = $user_pass; |
| 532 | 532 | } |
| 533 | 533 | } else { |
| 534 | 534 | // Password or confirmation missing |
| 535 | - if ( ! $user_pass && $registering_new_user ) { |
|
| 535 | + if ( ! $user_pass && $registering_new_user) { |
|
| 536 | 536 | // The password is invalid |
| 537 | - give_set_error( 'password_empty', __( 'Enter a password', 'give' ) ); |
|
| 538 | - } else if ( ! $pass_confirm && $registering_new_user ) { |
|
| 537 | + give_set_error('password_empty', __('Enter a password', 'give')); |
|
| 538 | + } else if ( ! $pass_confirm && $registering_new_user) { |
|
| 539 | 539 | // Confirmation password is invalid |
| 540 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation', 'give' ) ); |
|
| 540 | + give_set_error('confirmation_empty', __('Enter the password confirmation', 'give')); |
|
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | 543 | |
@@ -556,34 +556,34 @@ discard block |
||
| 556 | 556 | // Start an array to collect valid user data |
| 557 | 557 | $valid_user_data = array( |
| 558 | 558 | // Assume there will be errors |
| 559 | - 'user_id' => - 1 |
|
| 559 | + 'user_id' => -1 |
|
| 560 | 560 | ); |
| 561 | 561 | |
| 562 | 562 | // Username |
| 563 | - if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) { |
|
| 564 | - give_set_error( 'must_log_in', __( 'You must login or register to complete your donation', 'give' ) ); |
|
| 563 | + if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') { |
|
| 564 | + give_set_error('must_log_in', __('You must login or register to complete your donation', 'give')); |
|
| 565 | 565 | |
| 566 | 566 | return $valid_user_data; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | // Get the user by login |
| 570 | - $user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) ); |
|
| 570 | + $user_data = get_user_by('login', strip_tags($_POST['give_user_login'])); |
|
| 571 | 571 | |
| 572 | 572 | // Check if user exists |
| 573 | - if ( $user_data ) { |
|
| 573 | + if ($user_data) { |
|
| 574 | 574 | // Get password |
| 575 | - $user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false; |
|
| 575 | + $user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false; |
|
| 576 | 576 | |
| 577 | 577 | // Check user_pass |
| 578 | - if ( $user_pass ) { |
|
| 578 | + if ($user_pass) { |
|
| 579 | 579 | // Check if password is valid |
| 580 | - if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) { |
|
| 580 | + if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) { |
|
| 581 | 581 | // Incorrect password |
| 582 | 582 | give_set_error( |
| 583 | 583 | 'password_incorrect', |
| 584 | 584 | sprintf( |
| 585 | - __( 'The password you entered is incorrect. %sReset Password%s', 'give' ), |
|
| 586 | - '<a href="' . wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ) . '" title="' . __( 'Lost Password', 'give' ) . '">', |
|
| 585 | + __('The password you entered is incorrect. %sReset Password%s', 'give'), |
|
| 586 | + '<a href="'.wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]").'" title="'.__('Lost Password', 'give').'">', |
|
| 587 | 587 | '</a>' |
| 588 | 588 | ) |
| 589 | 589 | ); |
@@ -601,11 +601,11 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | } else { |
| 603 | 603 | // Empty password |
| 604 | - give_set_error( 'password_empty', __( 'Enter a password', 'give' ) ); |
|
| 604 | + give_set_error('password_empty', __('Enter a password', 'give')); |
|
| 605 | 605 | } |
| 606 | 606 | } else { |
| 607 | 607 | // no username |
| 608 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) ); |
|
| 608 | + give_set_error('username_incorrect', __('The username you entered does not exist', 'give')); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | return $valid_user_data; |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | */ |
| 621 | 621 | function give_purchase_form_validate_guest_user() { |
| 622 | 622 | |
| 623 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
| 623 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
| 624 | 624 | |
| 625 | 625 | // Start an array to collect valid user data |
| 626 | 626 | $valid_user_data = array( |
@@ -629,32 +629,32 @@ discard block |
||
| 629 | 629 | ); |
| 630 | 630 | |
| 631 | 631 | // Show error message if user must be logged in |
| 632 | - if ( give_logged_in_only( $form_id ) ) { |
|
| 633 | - give_set_error( 'logged_in_only', __( 'You must be logged into to donate', 'give' ) ); |
|
| 632 | + if (give_logged_in_only($form_id)) { |
|
| 633 | + give_set_error('logged_in_only', __('You must be logged into to donate', 'give')); |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | // Get the guest email |
| 637 | - $guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
| 637 | + $guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
| 638 | 638 | |
| 639 | 639 | // Check email |
| 640 | - if ( $guest_email && strlen( $guest_email ) > 0 ) { |
|
| 640 | + if ($guest_email && strlen($guest_email) > 0) { |
|
| 641 | 641 | // Validate email |
| 642 | - if ( ! is_email( $guest_email ) ) { |
|
| 642 | + if ( ! is_email($guest_email)) { |
|
| 643 | 643 | // Invalid email |
| 644 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
| 644 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
| 645 | 645 | } else { |
| 646 | 646 | // All is good to go |
| 647 | 647 | $valid_user_data['user_email'] = $guest_email; |
| 648 | 648 | } |
| 649 | 649 | } else { |
| 650 | 650 | // No email |
| 651 | - give_set_error( 'email_empty', __( 'Enter an email', 'give' ) ); |
|
| 651 | + give_set_error('email_empty', __('Enter an email', 'give')); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | // Loop through required fields and show error messages |
| 655 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
| 656 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
| 657 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
| 655 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
| 656 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
| 657 | + give_set_error($value['error_id'], $value['error_message']); |
|
| 658 | 658 | } |
| 659 | 659 | } |
| 660 | 660 | |
@@ -670,42 +670,42 @@ discard block |
||
| 670 | 670 | * @since 1.0 |
| 671 | 671 | * @return integer |
| 672 | 672 | */ |
| 673 | -function give_register_and_login_new_user( $user_data = array() ) { |
|
| 673 | +function give_register_and_login_new_user($user_data = array()) { |
|
| 674 | 674 | // Verify the array |
| 675 | - if ( empty( $user_data ) ) { |
|
| 676 | - return - 1; |
|
| 675 | + if (empty($user_data)) { |
|
| 676 | + return -1; |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - if ( give_get_errors() ) { |
|
| 680 | - return - 1; |
|
| 679 | + if (give_get_errors()) { |
|
| 680 | + return -1; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $user_args = apply_filters( 'give_insert_user_args', array( |
|
| 684 | - 'user_login' => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '', |
|
| 685 | - 'user_pass' => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '', |
|
| 686 | - 'user_email' => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '', |
|
| 687 | - 'first_name' => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '', |
|
| 688 | - 'last_name' => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '', |
|
| 689 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
| 690 | - 'role' => get_option( 'default_role' ) |
|
| 691 | - ), $user_data ); |
|
| 683 | + $user_args = apply_filters('give_insert_user_args', array( |
|
| 684 | + 'user_login' => isset($user_data['user_login']) ? $user_data['user_login'] : '', |
|
| 685 | + 'user_pass' => isset($user_data['user_pass']) ? $user_data['user_pass'] : '', |
|
| 686 | + 'user_email' => isset($user_data['user_email']) ? $user_data['user_email'] : '', |
|
| 687 | + 'first_name' => isset($user_data['user_first']) ? $user_data['user_first'] : '', |
|
| 688 | + 'last_name' => isset($user_data['user_last']) ? $user_data['user_last'] : '', |
|
| 689 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
| 690 | + 'role' => get_option('default_role') |
|
| 691 | + ), $user_data); |
|
| 692 | 692 | |
| 693 | 693 | // Insert new user |
| 694 | - $user_id = wp_insert_user( $user_args ); |
|
| 694 | + $user_id = wp_insert_user($user_args); |
|
| 695 | 695 | |
| 696 | 696 | // Validate inserted user |
| 697 | - if ( is_wp_error( $user_id ) ) { |
|
| 698 | - return - 1; |
|
| 697 | + if (is_wp_error($user_id)) { |
|
| 698 | + return -1; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | // Allow themes and plugins to filter the user data |
| 702 | - $user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args ); |
|
| 702 | + $user_data = apply_filters('give_insert_user_data', $user_data, $user_args); |
|
| 703 | 703 | |
| 704 | 704 | // Allow themes and plugins to hook |
| 705 | - do_action( 'give_insert_user', $user_id, $user_data ); |
|
| 705 | + do_action('give_insert_user', $user_id, $user_data); |
|
| 706 | 706 | |
| 707 | 707 | // Login new user |
| 708 | - give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] ); |
|
| 708 | + give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']); |
|
| 709 | 709 | |
| 710 | 710 | // Return user id |
| 711 | 711 | return $user_id; |
@@ -720,27 +720,27 @@ discard block |
||
| 720 | 720 | * @since 1.0 |
| 721 | 721 | * @return array |
| 722 | 722 | */ |
| 723 | -function give_get_purchase_form_user( $valid_data = array() ) { |
|
| 723 | +function give_get_purchase_form_user($valid_data = array()) { |
|
| 724 | 724 | |
| 725 | 725 | // Initialize user |
| 726 | 726 | $user = false; |
| 727 | - $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
| 727 | + $is_ajax = defined('DOING_AJAX') && DOING_AJAX; |
|
| 728 | 728 | |
| 729 | - if ( $is_ajax ) { |
|
| 729 | + if ($is_ajax) { |
|
| 730 | 730 | // Do not create or login the user during the ajax submission (check for errors only) |
| 731 | 731 | return true; |
| 732 | - } else if ( is_user_logged_in() ) { |
|
| 732 | + } else if (is_user_logged_in()) { |
|
| 733 | 733 | // Set the valid user as the logged in collected data |
| 734 | 734 | $user = $valid_data['logged_in_user']; |
| 735 | - } else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) { |
|
| 735 | + } else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) { |
|
| 736 | 736 | // New user registration |
| 737 | - if ( $valid_data['need_new_user'] === true ) { |
|
| 737 | + if ($valid_data['need_new_user'] === true) { |
|
| 738 | 738 | // Set user |
| 739 | 739 | $user = $valid_data['new_user_data']; |
| 740 | 740 | // Register and login new user |
| 741 | - $user['user_id'] = give_register_and_login_new_user( $user ); |
|
| 741 | + $user['user_id'] = give_register_and_login_new_user($user); |
|
| 742 | 742 | // User login |
| 743 | - } else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) { |
|
| 743 | + } else if ($valid_data['need_user_login'] === true && ! $is_ajax) { |
|
| 744 | 744 | |
| 745 | 745 | /* |
| 746 | 746 | * The login form is now processed in the give_process_purchase_login() function. |
@@ -755,48 +755,48 @@ discard block |
||
| 755 | 755 | // Set user |
| 756 | 756 | $user = $valid_data['login_user_data']; |
| 757 | 757 | // Login user |
| 758 | - give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] ); |
|
| 758 | + give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']); |
|
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | // Check guest checkout |
| 763 | - if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) { |
|
| 763 | + if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) { |
|
| 764 | 764 | // Set user |
| 765 | 765 | $user = $valid_data['guest_user_data']; |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | // Verify we have an user |
| 769 | - if ( false === $user || empty( $user ) ) { |
|
| 769 | + if (false === $user || empty($user)) { |
|
| 770 | 770 | // Return false |
| 771 | 771 | return false; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | // Get user first name |
| 775 | - if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) { |
|
| 776 | - $user['user_first'] = isset( $_POST["give_first"] ) ? strip_tags( trim( $_POST["give_first"] ) ) : ''; |
|
| 775 | + if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) { |
|
| 776 | + $user['user_first'] = isset($_POST["give_first"]) ? strip_tags(trim($_POST["give_first"])) : ''; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | // Get user last name |
| 780 | - if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) { |
|
| 781 | - $user['user_last'] = isset( $_POST["give_last"] ) ? strip_tags( trim( $_POST["give_last"] ) ) : ''; |
|
| 780 | + if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) { |
|
| 781 | + $user['user_last'] = isset($_POST["give_last"]) ? strip_tags(trim($_POST["give_last"])) : ''; |
|
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | // Get the user's billing address details |
| 785 | 785 | $user['address'] = array(); |
| 786 | - $user['address']['line1'] = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false; |
|
| 787 | - $user['address']['line2'] = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false; |
|
| 788 | - $user['address']['city'] = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false; |
|
| 789 | - $user['address']['state'] = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false; |
|
| 790 | - $user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false; |
|
| 791 | - $user['address']['zip'] = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false; |
|
| 792 | - |
|
| 793 | - if ( empty( $user['address']['country'] ) ) { |
|
| 786 | + $user['address']['line1'] = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false; |
|
| 787 | + $user['address']['line2'] = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false; |
|
| 788 | + $user['address']['city'] = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false; |
|
| 789 | + $user['address']['state'] = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false; |
|
| 790 | + $user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false; |
|
| 791 | + $user['address']['zip'] = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false; |
|
| 792 | + |
|
| 793 | + if (empty($user['address']['country'])) { |
|
| 794 | 794 | $user['address'] = false; |
| 795 | 795 | } // Country will always be set if address fields are present |
| 796 | 796 | |
| 797 | - if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) { |
|
| 797 | + if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) { |
|
| 798 | 798 | // Store the address in the user's meta so the donation form can be pre-populated with it on return purchases |
| 799 | - update_user_meta( $user['user_id'], '_give_user_address', $user['address'] ); |
|
| 799 | + update_user_meta($user['user_id'], '_give_user_address', $user['address']); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | // Return valid user |
@@ -815,16 +815,16 @@ discard block |
||
| 815 | 815 | $card_data = give_get_purchase_cc_info(); |
| 816 | 816 | |
| 817 | 817 | // Validate the card zip |
| 818 | - if ( ! empty( $card_data['card_zip'] ) ) { |
|
| 819 | - if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) { |
|
| 820 | - give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid', 'give' ) ); |
|
| 818 | + if ( ! empty($card_data['card_zip'])) { |
|
| 819 | + if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) { |
|
| 820 | + give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give')); |
|
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | //Ensure no spaces |
| 825 | - if ( ! empty( $card_data['card_number'] ) ) { |
|
| 826 | - $card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs |
|
| 827 | - $card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces |
|
| 825 | + if ( ! empty($card_data['card_number'])) { |
|
| 826 | + $card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs |
|
| 827 | + $card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces |
|
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | // This should validate card numbers at some point too |
@@ -840,17 +840,17 @@ discard block |
||
| 840 | 840 | */ |
| 841 | 841 | function give_get_purchase_cc_info() { |
| 842 | 842 | $cc_info = array(); |
| 843 | - $cc_info['card_name'] = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : ''; |
|
| 844 | - $cc_info['card_number'] = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : ''; |
|
| 845 | - $cc_info['card_cvc'] = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : ''; |
|
| 846 | - $cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : ''; |
|
| 847 | - $cc_info['card_exp_year'] = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : ''; |
|
| 848 | - $cc_info['card_address'] = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : ''; |
|
| 849 | - $cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : ''; |
|
| 850 | - $cc_info['card_city'] = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : ''; |
|
| 851 | - $cc_info['card_state'] = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : ''; |
|
| 852 | - $cc_info['card_country'] = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : ''; |
|
| 853 | - $cc_info['card_zip'] = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : ''; |
|
| 843 | + $cc_info['card_name'] = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : ''; |
|
| 844 | + $cc_info['card_number'] = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : ''; |
|
| 845 | + $cc_info['card_cvc'] = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : ''; |
|
| 846 | + $cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : ''; |
|
| 847 | + $cc_info['card_exp_year'] = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : ''; |
|
| 848 | + $cc_info['card_address'] = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : ''; |
|
| 849 | + $cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : ''; |
|
| 850 | + $cc_info['card_city'] = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : ''; |
|
| 851 | + $cc_info['card_state'] = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : ''; |
|
| 852 | + $cc_info['card_country'] = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : ''; |
|
| 853 | + $cc_info['card_zip'] = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : ''; |
|
| 854 | 854 | |
| 855 | 855 | // Return cc info |
| 856 | 856 | return $cc_info; |
@@ -866,14 +866,14 @@ discard block |
||
| 866 | 866 | * |
| 867 | 867 | * @return bool|mixed|void |
| 868 | 868 | */ |
| 869 | -function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) { |
|
| 869 | +function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') { |
|
| 870 | 870 | $ret = false; |
| 871 | 871 | |
| 872 | - if ( empty( $zip ) || empty( $country_code ) ) { |
|
| 872 | + if (empty($zip) || empty($country_code)) { |
|
| 873 | 873 | return $ret; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $country_code = strtoupper( $country_code ); |
|
| 876 | + $country_code = strtoupper($country_code); |
|
| 877 | 877 | |
| 878 | 878 | $zip_regex = array( |
| 879 | 879 | "AD" => "AD\d{3}", |
@@ -1033,11 +1033,11 @@ discard block |
||
| 1033 | 1033 | "ZM" => "\d{5}" |
| 1034 | 1034 | ); |
| 1035 | 1035 | |
| 1036 | - if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) { |
|
| 1036 | + if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) { |
|
| 1037 | 1037 | $ret = true; |
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | - return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code ); |
|
| 1040 | + return apply_filters('give_is_zip_valid', $ret, $zip, $country_code); |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | |
@@ -1047,48 +1047,48 @@ discard block |
||
| 1047 | 1047 | * @since 1.0 |
| 1048 | 1048 | * @return void |
| 1049 | 1049 | */ |
| 1050 | -function give_check_purchase_email( $valid_data, $posted ) { |
|
| 1050 | +function give_check_purchase_email($valid_data, $posted) { |
|
| 1051 | 1051 | $is_banned = false; |
| 1052 | 1052 | $banned = give_get_banned_emails(); |
| 1053 | 1053 | |
| 1054 | - if ( empty( $banned ) ) { |
|
| 1054 | + if (empty($banned)) { |
|
| 1055 | 1055 | return; |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | - if ( is_user_logged_in() ) { |
|
| 1058 | + if (is_user_logged_in()) { |
|
| 1059 | 1059 | |
| 1060 | 1060 | // The user is logged in, check that their account email is not banned |
| 1061 | - $user_data = get_userdata( get_current_user_id() ); |
|
| 1062 | - if ( give_is_email_banned( $user_data->user_email ) ) { |
|
| 1061 | + $user_data = get_userdata(get_current_user_id()); |
|
| 1062 | + if (give_is_email_banned($user_data->user_email)) { |
|
| 1063 | 1063 | |
| 1064 | 1064 | $is_banned = true; |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | - if ( give_is_email_banned( $posted['give_email'] ) ) { |
|
| 1067 | + if (give_is_email_banned($posted['give_email'])) { |
|
| 1068 | 1068 | $is_banned = true; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | - } elseif ( isset( $posted['give-purchase-var'] ) && $posted['give-purchase-var'] == 'needs-to-login' ) { |
|
| 1071 | + } elseif (isset($posted['give-purchase-var']) && $posted['give-purchase-var'] == 'needs-to-login') { |
|
| 1072 | 1072 | |
| 1073 | 1073 | // The user is logging in, check that their email is not banned |
| 1074 | - $user_data = get_user_by( 'login', $posted['give_user_login'] ); |
|
| 1075 | - if ( $user_data && give_is_email_banned( $user_data->user_email ) ) { |
|
| 1074 | + $user_data = get_user_by('login', $posted['give_user_login']); |
|
| 1075 | + if ($user_data && give_is_email_banned($user_data->user_email)) { |
|
| 1076 | 1076 | $is_banned = true; |
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | } else { |
| 1080 | 1080 | |
| 1081 | 1081 | // Guest purchase, check that the email is not banned |
| 1082 | - if ( give_is_email_banned( $posted['give_email'] ) ) { |
|
| 1082 | + if (give_is_email_banned($posted['give_email'])) { |
|
| 1083 | 1083 | $is_banned = true; |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | - if ( $is_banned ) { |
|
| 1088 | + if ($is_banned) { |
|
| 1089 | 1089 | // Set an error and give the donor a general error (don't alert them that they were banned) |
| 1090 | - give_set_error( 'email_banned', __( 'An internal error has occurred, please try again or contact support.', 'give' ) ); |
|
| 1090 | + give_set_error('email_banned', __('An internal error has occurred, please try again or contact support.', 'give')); |
|
| 1091 | 1091 | } |
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | -add_action( 'give_checkout_error_checks', 'give_check_purchase_email', 10, 2 ); |
|
| 1094 | +add_action('give_checkout_error_checks', 'give_check_purchase_email', 10, 2); |
|
@@ -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,56 +23,56 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string $purchase_form |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $post_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $post_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $post_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $post_id |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_product', $form->ID ) ) { |
|
| 57 | + if ('publish' !== $form->post_status && ! current_user_can('edit_product', $form->ID)) { |
|
| 58 | 58 | return false; // Product not published or user doesn't have permission to view drafts |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 61 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 62 | 62 | ? $args['display_style'] |
| 63 | - : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
| 63 | + : get_post_meta($form->ID, '_give_payment_display', true); |
|
| 64 | 64 | |
| 65 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
| 65 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
| 66 | 66 | ? ' float-labels-enabled' |
| 67 | 67 | : ''; |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
| 70 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
| 71 | 71 | 'give-form-wrap', |
| 72 | - 'give-display-' . $display_option |
|
| 73 | - ), $form->ID, $args ); |
|
| 72 | + 'give-display-'.$display_option |
|
| 73 | + ), $form->ID, $args); |
|
| 74 | 74 | |
| 75 | - $form_classes = implode( ' ', $form_classes_array ); |
|
| 75 | + $form_classes = implode(' ', $form_classes_array); |
|
| 76 | 76 | |
| 77 | 77 | ob_start(); |
| 78 | 78 | |
@@ -84,34 +84,34 @@ discard block |
||
| 84 | 84 | * @param int $form ->ID The current form ID |
| 85 | 85 | * @param array $args An array of form args |
| 86 | 86 | */ |
| 87 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
| 87 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
| 88 | 88 | |
| 89 | 89 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_classes; ?>"> |
| 90 | 90 | |
| 91 | 91 | <?php |
| 92 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
| 92 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
| 93 | 93 | |
| 94 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $post_id ) . '</h2>' ); |
|
| 94 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($post_id).'</h2>'); |
|
| 95 | 95 | |
| 96 | 96 | } ?> |
| 97 | 97 | |
| 98 | - <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
| 98 | + <?php do_action('give_pre_form', $form->ID, $args); ?> |
|
| 99 | 99 | |
| 100 | - <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint( $form->ID ); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
| 100 | + <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint($form->ID); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
| 101 | 101 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 102 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 103 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 104 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 105 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price( $form->ID ); ?>"/> |
|
| 102 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 103 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 104 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 105 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price($form->ID); ?>"/> |
|
| 106 | 106 | <?php |
| 107 | 107 | //Price ID hidden field for variable (mult-level) donation forms |
| 108 | - if ( give_has_variable_prices( $post_id ) ) { |
|
| 108 | + if (give_has_variable_prices($post_id)) { |
|
| 109 | 109 | //get default selected price ID |
| 110 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $post_id ), $post_id ); |
|
| 110 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($post_id), $post_id); |
|
| 111 | 111 | $price_id = 0; |
| 112 | 112 | //loop through prices |
| 113 | - foreach ( $prices as $price ) { |
|
| 114 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 113 | + foreach ($prices as $price) { |
|
| 114 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 115 | 115 | $price_id = $price['_give_id']['level_id']; |
| 116 | 116 | }; |
| 117 | 117 | } |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
| 120 | 120 | <?php } |
| 121 | 121 | |
| 122 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 122 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 123 | 123 | |
| 124 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 124 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 125 | 125 | |
| 126 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 126 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 127 | 127 | |
| 128 | 128 | ?> |
| 129 | 129 | |
| 130 | 130 | </form> |
| 131 | 131 | |
| 132 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
| 132 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
| 133 | 133 | |
| 134 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
| 134 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
| 135 | 135 | <?php |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | * @param int $form ->ID The current form ID |
| 143 | 143 | * @param array $args An array of form args |
| 144 | 144 | */ |
| 145 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 145 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 146 | 146 | |
| 147 | 147 | $final_output = ob_get_clean(); |
| 148 | 148 | |
| 149 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 149 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -166,57 +166,57 @@ discard block |
||
| 166 | 166 | * @global $give_options Array of all the Give options |
| 167 | 167 | * @return string |
| 168 | 168 | */ |
| 169 | -function give_show_purchase_form( $form_id ) { |
|
| 169 | +function give_show_purchase_form($form_id) { |
|
| 170 | 170 | |
| 171 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 171 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 172 | 172 | |
| 173 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 173 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 174 | 174 | $form_id = $_POST['give_form_id']; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - do_action( 'give_purchase_form_top', $form_id ); |
|
| 177 | + do_action('give_purchase_form_top', $form_id); |
|
| 178 | 178 | |
| 179 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 179 | + if (give_can_checkout() && isset($form_id)) { |
|
| 180 | 180 | |
| 181 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
| 181 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
| 182 | 182 | |
| 183 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
| 183 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
| 184 | 184 | |
| 185 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
| 185 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
| 186 | 186 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 187 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
| 187 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
| 188 | 188 | </div> |
| 189 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
| 189 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
| 190 | 190 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 191 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
| 191 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
| 192 | 192 | </div> |
| 193 | 193 | <?php endif; ?> |
| 194 | 194 | |
| 195 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 196 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
| 195 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 196 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
| 199 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
| 200 | 200 | |
| 201 | 201 | // Load the credit card form and allow gateways to load their own if they wish |
| 202 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 203 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
| 202 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 203 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
| 204 | 204 | } else { |
| 205 | - do_action( 'give_cc_form', $form_id ); |
|
| 205 | + do_action('give_cc_form', $form_id); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
| 208 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
| 209 | 209 | |
| 210 | 210 | } else { |
| 211 | 211 | // Can't checkout |
| 212 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
| 212 | + do_action('give_purchase_form_no_access', $form_id); |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
| 216 | + do_action('give_purchase_form_bottom', $form_id); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
| 219 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * Donation Amount Field |
@@ -230,37 +230,37 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return void |
| 232 | 232 | */ |
| 233 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 233 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 234 | 234 | |
| 235 | 235 | global $give_options; |
| 236 | 236 | |
| 237 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 238 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 239 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 240 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 241 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 242 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 243 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 237 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 238 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 239 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 240 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 241 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 242 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 243 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 244 | 244 | |
| 245 | - do_action( 'give_before_donation_levels', $form_id ); |
|
| 245 | + do_action('give_before_donation_levels', $form_id); |
|
| 246 | 246 | |
| 247 | 247 | //Set Price, No Custom Amount Allowed means hidden price field |
| 248 | - if ( $allow_custom_amount == 'no' ) { |
|
| 248 | + if ($allow_custom_amount == 'no') { |
|
| 249 | 249 | ?> |
| 250 | 250 | |
| 251 | - <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
| 251 | + <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
| 252 | 252 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 253 | 253 | value="<?php echo $default_amount; ?>" required> |
| 254 | 254 | <p class="set-price give-donation-amount form-row-wide"> |
| 255 | - <?php if ( $currency_position == 'before' ) { |
|
| 255 | + <?php if ($currency_position == 'before') { |
|
| 256 | 256 | echo $currency_output; |
| 257 | 257 | } ?> |
| 258 | 258 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 259 | - <?php if ( $currency_position == 'after' ) { |
|
| 259 | + <?php if ($currency_position == 'after') { |
|
| 260 | 260 | echo $currency_output; |
| 261 | 261 | } ?> |
| 262 | 262 | <span class="give-loading-text give-updating-price-loader"> |
| 263 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
| 263 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
| 264 | 264 | </span> |
| 265 | 265 | </p> |
| 266 | 266 | <?php |
@@ -269,37 +269,37 @@ discard block |
||
| 269 | 269 | ?> |
| 270 | 270 | <div class="give-total-wrap"> |
| 271 | 271 | <div class="give-donation-amount form-row-wide"> |
| 272 | - <?php if ( $currency_position == 'before' ) { |
|
| 272 | + <?php if ($currency_position == 'before') { |
|
| 273 | 273 | echo $currency_output; |
| 274 | 274 | } ?> |
| 275 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
| 275 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
| 276 | 276 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 277 | - <?php if ( $currency_position == 'after' ) { |
|
| 277 | + <?php if ($currency_position == 'after') { |
|
| 278 | 278 | echo $currency_output; |
| 279 | 279 | } ?> |
| 280 | 280 | <span class="give-loading-text give-updating-price-loader"> |
| 281 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
| 281 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
| 282 | 282 | </span> |
| 283 | 283 | </div> |
| 284 | 284 | </div> |
| 285 | 285 | <?php } |
| 286 | 286 | |
| 287 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 287 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 288 | 288 | |
| 289 | 289 | //Custom Amount Text |
| 290 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
| 290 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
| 291 | 291 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 292 | 292 | <?php } |
| 293 | 293 | |
| 294 | 294 | //Output Variable Pricing Levels |
| 295 | - if ( $variable_pricing ) { |
|
| 296 | - give_output_levels( $form_id ); |
|
| 295 | + if ($variable_pricing) { |
|
| 296 | + give_output_levels($form_id); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 299 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 302 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -311,32 +311,32 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @return string |
| 313 | 313 | */ |
| 314 | -function give_output_levels( $form_id ) { |
|
| 314 | +function give_output_levels($form_id) { |
|
| 315 | 315 | |
| 316 | 316 | //Get variable pricing |
| 317 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 318 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 319 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 320 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 321 | - if ( empty( $custom_amount_text ) ) { |
|
| 322 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
| 317 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 318 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 319 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 320 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 321 | + if (empty($custom_amount_text)) { |
|
| 322 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | $output = ''; |
| 326 | 326 | $counter = 0; |
| 327 | 327 | |
| 328 | - switch ( $display_style ) { |
|
| 328 | + switch ($display_style) { |
|
| 329 | 329 | case 'buttons': |
| 330 | 330 | |
| 331 | 331 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 332 | 332 | |
| 333 | - foreach ( $prices as $price ) { |
|
| 334 | - $counter ++; |
|
| 335 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 336 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 333 | + foreach ($prices as $price) { |
|
| 334 | + $counter++; |
|
| 335 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 336 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 337 | 337 | |
| 338 | 338 | $output .= '<li>'; |
| 339 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 339 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 340 | 340 | $output .= $level_text; |
| 341 | 341 | $output .= '</button>'; |
| 342 | 342 | $output .= '</li>'; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | //Custom Amount |
| 347 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 347 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 348 | 348 | $output .= '<li>'; |
| 349 | 349 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 350 | 350 | $output .= $custom_amount_text; |
@@ -360,23 +360,23 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 362 | 362 | |
| 363 | - foreach ( $prices as $price ) { |
|
| 364 | - $counter ++; |
|
| 365 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 366 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 363 | + foreach ($prices as $price) { |
|
| 364 | + $counter++; |
|
| 365 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 366 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 367 | 367 | |
| 368 | 368 | $output .= '<li>'; |
| 369 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 370 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 369 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 370 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 371 | 371 | $output .= '</li>'; |
| 372 | 372 | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | //Custom Amount |
| 376 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 376 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 377 | 377 | $output .= '<li>'; |
| 378 | 378 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 379 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 379 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 380 | 380 | $output .= '</li>'; |
| 381 | 381 | } |
| 382 | 382 | |
@@ -386,23 +386,23 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | case 'dropdown': |
| 388 | 388 | |
| 389 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 390 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
| 389 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 390 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
| 391 | 391 | |
| 392 | 392 | //first loop through prices |
| 393 | - foreach ( $prices as $price ) { |
|
| 394 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 395 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id, $form_id, $price ); |
|
| 393 | + foreach ($prices as $price) { |
|
| 394 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 395 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id, $form_id, $price); |
|
| 396 | 396 | |
| 397 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 397 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 398 | 398 | $output .= $level_text; |
| 399 | 399 | $output .= '</option>'; |
| 400 | 400 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | //Custom Amount |
| 404 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 405 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 404 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 405 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | $output .= '</select>'; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | break; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 413 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
@@ -422,26 +422,26 @@ discard block |
||
| 422 | 422 | * @param array $args |
| 423 | 423 | * |
| 424 | 424 | */ |
| 425 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 425 | +function give_display_checkout_button($form_id, $args) { |
|
| 426 | 426 | |
| 427 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 427 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 428 | 428 | ? $args['display_style'] |
| 429 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 429 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 430 | 430 | |
| 431 | 431 | //no btn for onpage |
| 432 | - if ( $display_option === 'onpage' ) { |
|
| 432 | + if ($display_option === 'onpage') { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 437 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
| 436 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 437 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
| 438 | 438 | |
| 439 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 439 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 440 | 440 | |
| 441 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 441 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 444 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | 447 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -452,71 +452,71 @@ discard block |
||
| 452 | 452 | * |
| 453 | 453 | * @return void |
| 454 | 454 | */ |
| 455 | -function give_user_info_fields( $form_id ) { |
|
| 455 | +function give_user_info_fields($form_id) { |
|
| 456 | 456 | |
| 457 | - if ( is_user_logged_in() ) : |
|
| 458 | - $user_data = get_userdata( get_current_user_id() ); |
|
| 457 | + if (is_user_logged_in()) : |
|
| 458 | + $user_data = get_userdata(get_current_user_id()); |
|
| 459 | 459 | endif; |
| 460 | 460 | |
| 461 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
| 461 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
| 462 | 462 | ?> |
| 463 | 463 | <fieldset id="give_checkout_user_info"> |
| 464 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
| 464 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
| 465 | 465 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
| 466 | 466 | <label class="give-label" for="give-first"> |
| 467 | - <?php _e( 'First Name', 'give' ); ?> |
|
| 468 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
| 467 | + <?php _e('First Name', 'give'); ?> |
|
| 468 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
| 469 | 469 | <span class="give-required-indicator">*</span> |
| 470 | 470 | <?php } ?> |
| 471 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 471 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 472 | 472 | </label> |
| 473 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
| 473 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
| 474 | 474 | echo ' required '; |
| 475 | 475 | } ?>/> |
| 476 | 476 | </p> |
| 477 | 477 | |
| 478 | 478 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
| 479 | 479 | <label class="give-label" for="give-last"> |
| 480 | - <?php _e( 'Last Name', 'give' ); ?> |
|
| 481 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
| 480 | + <?php _e('Last Name', 'give'); ?> |
|
| 481 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
| 482 | 482 | <span class="give-required-indicator">*</span> |
| 483 | 483 | <?php } ?> |
| 484 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 484 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 485 | 485 | </label> |
| 486 | 486 | |
| 487 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 487 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 488 | 488 | echo ' required'; |
| 489 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 489 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 490 | 490 | echo ' required '; |
| 491 | 491 | } ?> /> |
| 492 | 492 | </p> |
| 493 | 493 | |
| 494 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
| 494 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
| 495 | 495 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 496 | 496 | <label class="give-label" for="give-email"> |
| 497 | - <?php _e( 'Email Address', 'give' ); ?> |
|
| 498 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 497 | + <?php _e('Email Address', 'give'); ?> |
|
| 498 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 499 | 499 | <span class="give-required-indicator">*</span> |
| 500 | 500 | <?php } ?> |
| 501 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
| 501 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
| 502 | 502 | </label> |
| 503 | 503 | |
| 504 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
| 504 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
| 505 | 505 | echo ' required '; |
| 506 | 506 | } ?>/> |
| 507 | 507 | |
| 508 | 508 | </p> |
| 509 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
| 509 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
| 510 | 510 | |
| 511 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
| 511 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
| 512 | 512 | </fieldset> |
| 513 | 513 | <?php |
| 514 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
| 514 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
| 515 | 515 | |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
| 519 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 518 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
| 519 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 520 | 520 | |
| 521 | 521 | /** |
| 522 | 522 | * Renders the credit card info form. |
@@ -527,73 +527,73 @@ discard block |
||
| 527 | 527 | * |
| 528 | 528 | * @return void |
| 529 | 529 | */ |
| 530 | -function give_get_cc_form( $form_id ) { |
|
| 530 | +function give_get_cc_form($form_id) { |
|
| 531 | 531 | |
| 532 | 532 | ob_start(); |
| 533 | 533 | |
| 534 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
| 534 | + do_action('give_before_cc_fields', $form_id); ?> |
|
| 535 | 535 | |
| 536 | 536 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 537 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 538 | - <?php if ( is_ssl() ) : ?> |
|
| 537 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
| 538 | + <?php if (is_ssl()) : ?> |
|
| 539 | 539 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 540 | 540 | <span class="give-icon padlock"></span> |
| 541 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 541 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 542 | 542 | </div> |
| 543 | 543 | <?php endif; ?> |
| 544 | 544 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 545 | 545 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 546 | - <?php _e( 'Card Number', 'give' ); ?> |
|
| 546 | + <?php _e('Card Number', 'give'); ?> |
|
| 547 | 547 | <span class="give-required-indicator">*</span> |
| 548 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 548 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 549 | 549 | <span class="card-type"></span> |
| 550 | 550 | </label> |
| 551 | 551 | |
| 552 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/> |
|
| 552 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/> |
|
| 553 | 553 | </p> |
| 554 | 554 | |
| 555 | 555 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
| 556 | 556 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 557 | - <?php _e( 'CVC', 'give' ); ?> |
|
| 557 | + <?php _e('CVC', 'give'); ?> |
|
| 558 | 558 | <span class="give-required-indicator">*</span> |
| 559 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 559 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 560 | 560 | </label> |
| 561 | 561 | |
| 562 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/> |
|
| 562 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/> |
|
| 563 | 563 | </p> |
| 564 | 564 | |
| 565 | 565 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 566 | 566 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 567 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
| 567 | + <?php _e('Name on the Card', 'give'); ?> |
|
| 568 | 568 | <span class="give-required-indicator">*</span> |
| 569 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 569 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 570 | 570 | </label> |
| 571 | 571 | |
| 572 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/> |
|
| 572 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/> |
|
| 573 | 573 | </p> |
| 574 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
| 574 | + <?php do_action('give_before_cc_expiration'); ?> |
|
| 575 | 575 | <p class="card-expiration form-row form-row-one-third"> |
| 576 | 576 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 577 | - <?php _e( 'Expiration', 'give' ); ?> |
|
| 577 | + <?php _e('Expiration', 'give'); ?> |
|
| 578 | 578 | <span class="give-required-indicator">*</span> |
| 579 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 579 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 580 | 580 | </label> |
| 581 | 581 | |
| 582 | 582 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
| 583 | 583 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
| 584 | 584 | |
| 585 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/> |
|
| 585 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/> |
|
| 586 | 586 | </p> |
| 587 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
| 587 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
| 588 | 588 | |
| 589 | 589 | </fieldset> |
| 590 | 590 | <?php |
| 591 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 591 | + do_action('give_after_cc_fields', $form_id); |
|
| 592 | 592 | |
| 593 | 593 | echo ob_get_clean(); |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 596 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 597 | 597 | |
| 598 | 598 | /** |
| 599 | 599 | * Outputs the default credit card address fields |
@@ -604,110 +604,110 @@ discard block |
||
| 604 | 604 | * |
| 605 | 605 | * @return void |
| 606 | 606 | */ |
| 607 | -function give_default_cc_address_fields( $form_id ) { |
|
| 607 | +function give_default_cc_address_fields($form_id) { |
|
| 608 | 608 | |
| 609 | 609 | $logged_in = is_user_logged_in(); |
| 610 | 610 | |
| 611 | - if ( $logged_in ) { |
|
| 612 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 611 | + if ($logged_in) { |
|
| 612 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 613 | 613 | } |
| 614 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 615 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 616 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 617 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 614 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 615 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 616 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 617 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 618 | 618 | ob_start(); ?> |
| 619 | 619 | <fieldset id="give_cc_address" class="cc-address"> |
| 620 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
| 621 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
| 620 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
| 621 | + <?php do_action('give_cc_billing_top'); ?> |
|
| 622 | 622 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
| 623 | 623 | <label for="card_address" class="give-label"> |
| 624 | - <?php _e( 'Address', 'give' ); ?> |
|
| 624 | + <?php _e('Address', 'give'); ?> |
|
| 625 | 625 | <?php |
| 626 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
| 626 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
| 627 | 627 | <span class="give-required-indicator">*</span> |
| 628 | 628 | <?php } ?> |
| 629 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 629 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 630 | 630 | </label> |
| 631 | 631 | |
| 632 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 632 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 633 | 633 | echo ' required'; |
| 634 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 634 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 635 | 635 | echo ' required '; |
| 636 | 636 | } ?>/> |
| 637 | 637 | </p> |
| 638 | 638 | |
| 639 | 639 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
| 640 | 640 | <label for="card_address_2" class="give-label"> |
| 641 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
| 642 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
| 641 | + <?php _e('Address Line 2', 'give'); ?> |
|
| 642 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
| 643 | 643 | <span class="give-required-indicator">*</span> |
| 644 | 644 | <?php } ?> |
| 645 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 645 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 646 | 646 | </label> |
| 647 | 647 | |
| 648 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 648 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 649 | 649 | echo ' required'; |
| 650 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 650 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 651 | 651 | echo ' required '; |
| 652 | 652 | } ?>/> |
| 653 | 653 | </p> |
| 654 | 654 | |
| 655 | 655 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
| 656 | 656 | <label for="card_city" class="give-label"> |
| 657 | - <?php _e( 'City', 'give' ); ?> |
|
| 658 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
| 657 | + <?php _e('City', 'give'); ?> |
|
| 658 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
| 659 | 659 | <span class="give-required-indicator">*</span> |
| 660 | 660 | <?php } ?> |
| 661 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 661 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
| 662 | 662 | </label> |
| 663 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 663 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 664 | 664 | echo ' required'; |
| 665 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 665 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 666 | 666 | echo ' required '; |
| 667 | 667 | } ?>/> |
| 668 | 668 | </p> |
| 669 | 669 | |
| 670 | 670 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
| 671 | 671 | <label for="card_zip" class="give-label"> |
| 672 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
| 673 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
| 672 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
| 673 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
| 674 | 674 | <span class="give-required-indicator">*</span> |
| 675 | 675 | <?php } ?> |
| 676 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 676 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 677 | 677 | </label> |
| 678 | 678 | |
| 679 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 679 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 680 | 680 | echo ' required'; |
| 681 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 681 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 682 | 682 | echo ' required '; |
| 683 | 683 | } ?>/> |
| 684 | 684 | </p> |
| 685 | 685 | |
| 686 | 686 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
| 687 | 687 | <label for="billing_country" class="give-label"> |
| 688 | - <?php _e( 'Country', 'give' ); ?> |
|
| 689 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
| 688 | + <?php _e('Country', 'give'); ?> |
|
| 689 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
| 690 | 690 | <span class="give-required-indicator">*</span> |
| 691 | 691 | <?php } ?> |
| 692 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 692 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
| 693 | 693 | </label> |
| 694 | 694 | |
| 695 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 695 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 696 | 696 | echo ' required'; |
| 697 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 697 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 698 | 698 | echo ' required '; |
| 699 | 699 | } ?>> |
| 700 | 700 | <?php |
| 701 | 701 | |
| 702 | 702 | $selected_country = give_get_country(); |
| 703 | 703 | |
| 704 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
| 704 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
| 705 | 705 | $selected_country = $user_address['country']; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | $countries = give_get_country_list(); |
| 709 | - foreach ( $countries as $country_code => $country ) { |
|
| 710 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 709 | + foreach ($countries as $country_code => $country) { |
|
| 710 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 711 | 711 | } |
| 712 | 712 | ?> |
| 713 | 713 | </select> |
@@ -715,44 +715,44 @@ discard block |
||
| 715 | 715 | |
| 716 | 716 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
| 717 | 717 | <label for="card_state" class="give-label"> |
| 718 | - <?php _e( 'State / Province', 'give' ); ?> |
|
| 719 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
| 718 | + <?php _e('State / Province', 'give'); ?> |
|
| 719 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
| 720 | 720 | <span class="give-required-indicator">*</span> |
| 721 | 721 | <?php } ?> |
| 722 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 722 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 723 | 723 | </label> |
| 724 | 724 | |
| 725 | 725 | <?php |
| 726 | 726 | $selected_state = give_get_state(); |
| 727 | - $states = give_get_states( $selected_country ); |
|
| 727 | + $states = give_get_states($selected_country); |
|
| 728 | 728 | |
| 729 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
| 729 | + if ($logged_in && ! empty($user_address['state'])) { |
|
| 730 | 730 | $selected_state = $user_address['state']; |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | - if ( ! empty( $states ) ) : ?> |
|
| 734 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 733 | + if ( ! empty($states)) : ?> |
|
| 734 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 735 | 735 | echo ' required'; |
| 736 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 736 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 737 | 737 | echo ' required '; |
| 738 | 738 | } ?>> |
| 739 | 739 | <?php |
| 740 | - foreach ( $states as $state_code => $state ) { |
|
| 741 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 740 | + foreach ($states as $state_code => $state) { |
|
| 741 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 742 | 742 | } |
| 743 | 743 | ?> |
| 744 | 744 | </select> |
| 745 | 745 | <?php else : ?> |
| 746 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
| 746 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
| 747 | 747 | <?php endif; ?> |
| 748 | 748 | </p> |
| 749 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
| 749 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
| 750 | 750 | </fieldset> |
| 751 | 751 | <?php |
| 752 | 752 | echo ob_get_clean(); |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 755 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 756 | 756 | |
| 757 | 757 | |
| 758 | 758 | /** |
@@ -764,94 +764,94 @@ discard block |
||
| 764 | 764 | * |
| 765 | 765 | * @return string |
| 766 | 766 | */ |
| 767 | -function give_get_register_fields( $form_id ) { |
|
| 767 | +function give_get_register_fields($form_id) { |
|
| 768 | 768 | |
| 769 | 769 | global $give_options; |
| 770 | 770 | global $user_ID; |
| 771 | 771 | |
| 772 | - if ( is_user_logged_in() ) { |
|
| 773 | - $user_data = get_userdata( $user_ID ); |
|
| 772 | + if (is_user_logged_in()) { |
|
| 773 | + $user_data = get_userdata($user_ID); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
| 776 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
| 777 | 777 | |
| 778 | 778 | ob_start(); ?> |
| 779 | 779 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 780 | 780 | |
| 781 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 781 | + <?php if ($show_register_form == 'both') { ?> |
|
| 782 | 782 | <div class="give-login-account-wrap"> |
| 783 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
| 784 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
| 783 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
| 784 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
| 785 | 785 | </p> |
| 786 | 786 | <p class="give-loading-text"> |
| 787 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
| 787 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
| 788 | 788 | </div> |
| 789 | 789 | <?php } ?> |
| 790 | 790 | |
| 791 | - <?php do_action( 'give_register_fields_before' ); ?> |
|
| 791 | + <?php do_action('give_register_fields_before'); ?> |
|
| 792 | 792 | |
| 793 | 793 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 794 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
| 795 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 796 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
| 794 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
| 795 | + if ( ! give_logged_in_only($form_id)) { |
|
| 796 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
| 797 | 797 | } ?></legend> |
| 798 | - <?php do_action( 'give_register_account_fields_before' ); ?> |
|
| 798 | + <?php do_action('give_register_account_fields_before'); ?> |
|
| 799 | 799 | <p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
| 800 | 800 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 801 | - <?php _e( 'Username', 'give' ); ?> |
|
| 802 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 801 | + <?php _e('Username', 'give'); ?> |
|
| 802 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 803 | 803 | <span class="give-required-indicator">*</span> |
| 804 | 804 | <?php } ?> |
| 805 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 805 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 806 | 806 | </label> |
| 807 | 807 | |
| 808 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 808 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
| 809 | 809 | echo 'required '; |
| 810 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
| 810 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
| 811 | 811 | </p> |
| 812 | 812 | |
| 813 | 813 | <p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
| 814 | 814 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 815 | - <?php _e( 'Password', 'give' ); ?> |
|
| 816 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 815 | + <?php _e('Password', 'give'); ?> |
|
| 816 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 817 | 817 | <span class="give-required-indicator">*</span> |
| 818 | 818 | <?php } ?> |
| 819 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 819 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
| 820 | 820 | </label> |
| 821 | 821 | |
| 822 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 822 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
| 823 | 823 | echo 'required '; |
| 824 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
| 824 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
| 825 | 825 | </p> |
| 826 | 826 | |
| 827 | 827 | <p id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
| 828 | 828 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 829 | - <?php _e( 'Confirm PW', 'give' ); ?> |
|
| 830 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 829 | + <?php _e('Confirm PW', 'give'); ?> |
|
| 830 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 831 | 831 | <span class="give-required-indicator">*</span> |
| 832 | 832 | <?php } ?> |
| 833 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 833 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 834 | 834 | </label> |
| 835 | 835 | |
| 836 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 836 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
| 837 | 837 | echo 'required '; |
| 838 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
| 838 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
| 839 | 839 | </p> |
| 840 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
| 840 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
| 841 | 841 | </fieldset> |
| 842 | 842 | |
| 843 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
| 843 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
| 844 | 844 | |
| 845 | 845 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
| 846 | 846 | |
| 847 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
| 847 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
| 848 | 848 | |
| 849 | 849 | </fieldset> |
| 850 | 850 | <?php |
| 851 | 851 | echo ob_get_clean(); |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
| 854 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | 857 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -864,76 +864,76 @@ discard block |
||
| 864 | 864 | * |
| 865 | 865 | * @return string |
| 866 | 866 | */ |
| 867 | -function give_get_login_fields( $form_id ) { |
|
| 867 | +function give_get_login_fields($form_id) { |
|
| 868 | 868 | |
| 869 | 869 | global $give_options; |
| 870 | 870 | |
| 871 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 872 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
| 871 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 872 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
| 873 | 873 | |
| 874 | 874 | ob_start(); |
| 875 | 875 | ?> |
| 876 | 876 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 877 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
| 878 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 879 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
| 877 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
| 878 | + if ( ! give_logged_in_only($form_id)) { |
|
| 879 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
| 880 | 880 | } ?> |
| 881 | 881 | </legend> |
| 882 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 882 | + <?php if ($show_register_form == 'both') { ?> |
|
| 883 | 883 | <p class="give-new-account-link"> |
| 884 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
| 885 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-login" |
|
| 884 | + <?php _e('Need to create an account?', 'give'); ?> |
|
| 885 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-login" |
|
| 886 | 886 | data-action="give_checkout_register"> |
| 887 | - <?php _e( 'Register', 'give' ); |
|
| 888 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 889 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
| 887 | + <?php _e('Register', 'give'); |
|
| 888 | + if ( ! give_logged_in_only($form_id)) { |
|
| 889 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
| 890 | 890 | } ?> |
| 891 | 891 | </a> |
| 892 | 892 | </p> |
| 893 | 893 | <p class="give-loading-text"> |
| 894 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
| 894 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
| 895 | 895 | <?php } ?> |
| 896 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
| 896 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
| 897 | 897 | <p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
| 898 | 898 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 899 | - <?php _e( 'Username', 'give' ); ?> |
|
| 900 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 899 | + <?php _e('Username', 'give'); ?> |
|
| 900 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 901 | 901 | <span class="give-required-indicator">*</span> |
| 902 | 902 | <?php } ?> |
| 903 | 903 | </label> |
| 904 | 904 | |
| 905 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 905 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
| 906 | 906 | echo 'required '; |
| 907 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
| 907 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
| 908 | 908 | </p> |
| 909 | 909 | |
| 910 | 910 | <p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
| 911 | 911 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 912 | - <?php _e( 'Password', 'give' ); ?> |
|
| 913 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 912 | + <?php _e('Password', 'give'); ?> |
|
| 913 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 914 | 914 | <span class="give-required-indicator">*</span> |
| 915 | 915 | <?php } ?> |
| 916 | 916 | </label> |
| 917 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 917 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
| 918 | 918 | echo 'required '; |
| 919 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
| 919 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
| 920 | 920 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 921 | 921 | </p> |
| 922 | 922 | |
| 923 | 923 | <p id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 924 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
| 925 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 926 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
| 924 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
| 925 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 926 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
| 927 | 927 | <?php } ?> |
| 928 | 928 | <span class="give-loading-animation"></span> |
| 929 | 929 | </p> |
| 930 | - <?php do_action( 'give_checkout_login_fields_after' ); ?> |
|
| 930 | + <?php do_action('give_checkout_login_fields_after'); ?> |
|
| 931 | 931 | </fieldset><!--end #give-login-fields--> |
| 932 | 932 | <?php |
| 933 | 933 | echo ob_get_clean(); |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 936 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 937 | 937 | |
| 938 | 938 | /** |
| 939 | 939 | * Payment Mode Select |
@@ -949,49 +949,49 @@ discard block |
||
| 949 | 949 | * |
| 950 | 950 | * @return void |
| 951 | 951 | */ |
| 952 | -function give_payment_mode_select( $form_id ) { |
|
| 952 | +function give_payment_mode_select($form_id) { |
|
| 953 | 953 | |
| 954 | 954 | $gateways = give_get_enabled_payment_gateways(); |
| 955 | 955 | |
| 956 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
| 956 | + do_action('give_payment_mode_top', $form_id); ?> |
|
| 957 | 957 | |
| 958 | 958 | <fieldset id="give-payment-mode-select"> |
| 959 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
| 959 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
| 960 | 960 | <div id="give-payment-mode-wrap"> |
| 961 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
| 962 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
| 961 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
| 962 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
| 963 | 963 | </legend> |
| 964 | 964 | <?php |
| 965 | 965 | |
| 966 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
| 966 | + do_action('give_payment_mode_before_gateways') ?> |
|
| 967 | 967 | |
| 968 | 968 | <ul id="give-gateway-radio-list"> |
| 969 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 970 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
| 969 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
| 970 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
| 971 | 971 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
| 972 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
| 973 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
| 972 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
| 973 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
| 974 | 974 | echo '</label></li>'; |
| 975 | 975 | endforeach; ?> |
| 976 | 976 | </ul> |
| 977 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
| 977 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
| 978 | 978 | </div> |
| 979 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
| 979 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
| 980 | 980 | </fieldset> |
| 981 | 981 | |
| 982 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
| 982 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
| 983 | 983 | |
| 984 | 984 | <div id="give_purchase_form_wrap"> |
| 985 | 985 | |
| 986 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
| 986 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
| 987 | 987 | |
| 988 | 988 | </div><!-- the checkout fields are loaded into this--> |
| 989 | 989 | |
| 990 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
| 990 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
| 991 | 991 | |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 994 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 995 | 995 | |
| 996 | 996 | |
| 997 | 997 | /** |
@@ -1006,35 +1006,35 @@ discard block |
||
| 1006 | 1006 | * |
| 1007 | 1007 | * @return void |
| 1008 | 1008 | */ |
| 1009 | -function give_terms_agreement( $form_id ) { |
|
| 1009 | +function give_terms_agreement($form_id) { |
|
| 1010 | 1010 | |
| 1011 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1012 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
| 1013 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1011 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1012 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
| 1013 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1014 | 1014 | |
| 1015 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
| 1015 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
| 1016 | 1016 | <fieldset id="give_terms_agreement"> |
| 1017 | 1017 | <div id="give_terms" style="display:none;"> |
| 1018 | 1018 | <?php |
| 1019 | - do_action( 'give_before_terms' ); |
|
| 1020 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1021 | - do_action( 'give_after_terms' ); |
|
| 1019 | + do_action('give_before_terms'); |
|
| 1020 | + echo wpautop(stripslashes($terms)); |
|
| 1021 | + do_action('give_after_terms'); |
|
| 1022 | 1022 | ?> |
| 1023 | 1023 | </div> |
| 1024 | 1024 | <div id="give_show_terms"> |
| 1025 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
| 1026 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
| 1025 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
| 1026 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
| 1027 | 1027 | </div> |
| 1028 | 1028 | |
| 1029 | 1029 | <label |
| 1030 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
| 1030 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
| 1031 | 1031 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
| 1032 | 1032 | </fieldset> |
| 1033 | 1033 | <?php |
| 1034 | 1034 | } |
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
| 1037 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
| 1038 | 1038 | |
| 1039 | 1039 | /** |
| 1040 | 1040 | * Checkout Final Total |
@@ -1046,27 +1046,27 @@ discard block |
||
| 1046 | 1046 | * @since 1.0 |
| 1047 | 1047 | * @return void |
| 1048 | 1048 | */ |
| 1049 | -function give_checkout_final_total( $form_id ) { |
|
| 1049 | +function give_checkout_final_total($form_id) { |
|
| 1050 | 1050 | |
| 1051 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1052 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1051 | + if (isset($_POST['give_total'])) { |
|
| 1052 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1053 | 1053 | } else { |
| 1054 | 1054 | //default total |
| 1055 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1055 | + $total = give_get_default_form_amount($form_id); |
|
| 1056 | 1056 | } |
| 1057 | 1057 | //Only proceed if give_total available |
| 1058 | - if ( empty( $total ) ) { |
|
| 1058 | + if (empty($total)) { |
|
| 1059 | 1059 | return; |
| 1060 | 1060 | } |
| 1061 | 1061 | ?> |
| 1062 | 1062 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1063 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1064 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1063 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
| 1064 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1065 | 1065 | </p> |
| 1066 | 1066 | <?php |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1069 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1070 | 1070 | |
| 1071 | 1071 | |
| 1072 | 1072 | /** |
@@ -1078,22 +1078,22 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @return void |
| 1080 | 1080 | */ |
| 1081 | -function give_checkout_submit( $form_id ) { |
|
| 1081 | +function give_checkout_submit($form_id) { |
|
| 1082 | 1082 | ?> |
| 1083 | 1083 | <fieldset id="give_purchase_submit"> |
| 1084 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
| 1084 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
| 1085 | 1085 | |
| 1086 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
| 1086 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
| 1087 | 1087 | |
| 1088 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
| 1088 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
| 1089 | 1089 | |
| 1090 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
| 1090 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
| 1091 | 1091 | |
| 1092 | 1092 | </fieldset> |
| 1093 | 1093 | <?php |
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1096 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1097 | 1097 | |
| 1098 | 1098 | |
| 1099 | 1099 | /** |
@@ -1106,10 +1106,10 @@ discard block |
||
| 1106 | 1106 | * |
| 1107 | 1107 | * @return string |
| 1108 | 1108 | */ |
| 1109 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1109 | +function give_checkout_button_purchase($form_id) { |
|
| 1110 | 1110 | |
| 1111 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1112 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
| 1111 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1112 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
| 1113 | 1113 | |
| 1114 | 1114 | ob_start(); |
| 1115 | 1115 | |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | <span class="give-loading-animation"></span> |
| 1121 | 1121 | </div> |
| 1122 | 1122 | <?php |
| 1123 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1123 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | /** |
@@ -1134,11 +1134,11 @@ discard block |
||
| 1134 | 1134 | * |
| 1135 | 1135 | * @return void |
| 1136 | 1136 | */ |
| 1137 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1137 | +function give_agree_to_terms_js($form_id) { |
|
| 1138 | 1138 | |
| 1139 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1139 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1140 | 1140 | |
| 1141 | - if ( $form_option === 'yes' ) { |
|
| 1141 | + if ($form_option === 'yes') { |
|
| 1142 | 1142 | ?> |
| 1143 | 1143 | <script type="text/javascript"> |
| 1144 | 1144 | jQuery(document).ready(function ($) { |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | } |
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1157 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1158 | 1158 | |
| 1159 | 1159 | |
| 1160 | 1160 | /** |
@@ -1167,19 +1167,19 @@ discard block |
||
| 1167 | 1167 | * |
| 1168 | 1168 | * @return void |
| 1169 | 1169 | */ |
| 1170 | -function give_form_content( $form_id, $args ) { |
|
| 1170 | +function give_form_content($form_id, $args) { |
|
| 1171 | 1171 | |
| 1172 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1172 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1173 | 1173 | ? $args['show_content'] |
| 1174 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1174 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1175 | 1175 | |
| 1176 | - if ( $show_content !== 'none' ) { |
|
| 1176 | + if ($show_content !== 'none') { |
|
| 1177 | 1177 | //add action according to value |
| 1178 | - add_action( $show_content, 'give_form_display_content' ); |
|
| 1178 | + add_action($show_content, 'give_form_display_content'); |
|
| 1179 | 1179 | } |
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1182 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1183 | 1183 | |
| 1184 | 1184 | /** |
| 1185 | 1185 | * Show Give Goals |
@@ -1192,25 +1192,25 @@ discard block |
||
| 1192 | 1192 | * @return mixed |
| 1193 | 1193 | */ |
| 1194 | 1194 | |
| 1195 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1195 | +function give_show_goal_progress($form_id, $args) { |
|
| 1196 | 1196 | |
| 1197 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
| 1198 | - $form = new Give_Donate_Form( $form_id ); |
|
| 1197 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
| 1198 | + $form = new Give_Donate_Form($form_id); |
|
| 1199 | 1199 | $goal = $form->goal; |
| 1200 | - $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
| 1200 | + $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
| 1201 | 1201 | $income = $form->get_earnings(); |
| 1202 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
| 1203 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
| 1204 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
| 1202 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
| 1203 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
| 1204 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
| 1205 | 1205 | |
| 1206 | 1206 | //Sanity check - respect shortcode args |
| 1207 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
| 1207 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
| 1208 | 1208 | return false; |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | //Sanity check - ensure form has goal set to output |
| 1212 | - if ( empty( $form->ID ) |
|
| 1213 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
| 1212 | + if (empty($form->ID) |
|
| 1213 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
| 1214 | 1214 | || $goal_option !== 'yes' |
| 1215 | 1215 | || $goal == 0 |
| 1216 | 1216 | ) { |
@@ -1218,26 +1218,26 @@ discard block |
||
| 1218 | 1218 | return false; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
| 1221 | + $progress = round(($income / $goal) * 100, 2); |
|
| 1222 | 1222 | |
| 1223 | - if ( $income > $goal ) { |
|
| 1223 | + if ($income > $goal) { |
|
| 1224 | 1224 | $progress = 100; |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | $output = '<div class="give-goal-progress">'; |
| 1228 | 1228 | |
| 1229 | 1229 | //Goal Progress Text |
| 1230 | - if ( ! empty( $show_text ) ) { |
|
| 1230 | + if ( ! empty($show_text)) { |
|
| 1231 | 1231 | |
| 1232 | 1232 | $output .= '<div class="raised">'; |
| 1233 | 1233 | |
| 1234 | - if ( $goal_format !== 'percentage' ) { |
|
| 1234 | + if ($goal_format !== 'percentage') { |
|
| 1235 | 1235 | |
| 1236 | - $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>'; |
|
| 1236 | + $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>'; |
|
| 1237 | 1237 | |
| 1238 | - } elseif ( $goal_format == 'percentage' ) { |
|
| 1238 | + } elseif ($goal_format == 'percentage') { |
|
| 1239 | 1239 | |
| 1240 | - $output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>'; |
|
| 1240 | + $output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>'; |
|
| 1241 | 1241 | |
| 1242 | 1242 | } |
| 1243 | 1243 | |
@@ -1246,11 +1246,11 @@ discard block |
||
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | //Goal Progress Bar |
| 1249 | - if ( ! empty( $show_bar ) ) { |
|
| 1249 | + if ( ! empty($show_bar)) { |
|
| 1250 | 1250 | $output .= '<div class="give-progress-bar">'; |
| 1251 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
| 1252 | - if ( ! empty( $color ) ) { |
|
| 1253 | - $output .= 'background-color:' . $color; |
|
| 1251 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
| 1252 | + if ( ! empty($color)) { |
|
| 1253 | + $output .= 'background-color:'.$color; |
|
| 1254 | 1254 | } |
| 1255 | 1255 | $output .= '"></span>'; |
| 1256 | 1256 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1258,13 +1258,13 @@ discard block |
||
| 1258 | 1258 | |
| 1259 | 1259 | $output .= '</div><!-- /.goal-progress -->'; |
| 1260 | 1260 | |
| 1261 | - echo apply_filters( 'give_goal_output', $output ); |
|
| 1261 | + echo apply_filters('give_goal_output', $output); |
|
| 1262 | 1262 | |
| 1263 | 1263 | return false; |
| 1264 | 1264 | |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1267 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1268 | 1268 | |
| 1269 | 1269 | /** |
| 1270 | 1270 | * Renders Post Form Content |
@@ -1276,17 +1276,17 @@ discard block |
||
| 1276 | 1276 | * @return void |
| 1277 | 1277 | * @since 1.0 |
| 1278 | 1278 | */ |
| 1279 | -function give_form_display_content( $form_id ) { |
|
| 1279 | +function give_form_display_content($form_id) { |
|
| 1280 | 1280 | |
| 1281 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1281 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1282 | 1282 | |
| 1283 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
| 1284 | - $content = apply_filters( 'the_content', $content ); |
|
| 1283 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
| 1284 | + $content = apply_filters('the_content', $content); |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
| 1287 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
| 1288 | 1288 | |
| 1289 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1289 | + echo apply_filters('give_form_content_output', $output); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | 1292 | |
@@ -1299,16 +1299,16 @@ discard block |
||
| 1299 | 1299 | * |
| 1300 | 1300 | * @return void |
| 1301 | 1301 | */ |
| 1302 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1302 | +function give_checkout_hidden_fields($form_id) { |
|
| 1303 | 1303 | |
| 1304 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1305 | - if ( is_user_logged_in() ) { ?> |
|
| 1304 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1305 | + if (is_user_logged_in()) { ?> |
|
| 1306 | 1306 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1307 | 1307 | <?php } ?> |
| 1308 | 1308 | <input type="hidden" name="give_action" value="purchase"/> |
| 1309 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1309 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1310 | 1310 | <?php |
| 1311 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1311 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1312 | 1312 | |
| 1313 | 1313 | } |
| 1314 | 1314 | |
@@ -1323,20 +1323,20 @@ discard block |
||
| 1323 | 1323 | * |
| 1324 | 1324 | * @return string $content Filtered content |
| 1325 | 1325 | */ |
| 1326 | -function give_filter_success_page_content( $content ) { |
|
| 1326 | +function give_filter_success_page_content($content) { |
|
| 1327 | 1327 | |
| 1328 | 1328 | global $give_options; |
| 1329 | 1329 | |
| 1330 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1331 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1332 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1330 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1331 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1332 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1333 | 1333 | } |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | 1336 | return $content; |
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1339 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1340 | 1340 | |
| 1341 | 1341 | |
| 1342 | 1342 | /** |
@@ -1348,11 +1348,11 @@ discard block |
||
| 1348 | 1348 | |
| 1349 | 1349 | function give_test_mode_frontend_warning() { |
| 1350 | 1350 | |
| 1351 | - $test_mode = give_get_option( 'test_mode' ); |
|
| 1351 | + $test_mode = give_get_option('test_mode'); |
|
| 1352 | 1352 | |
| 1353 | - if ( $test_mode == 'on' ) { |
|
| 1354 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
| 1353 | + if ($test_mode == 'on') { |
|
| 1354 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
| 1355 | 1355 | } |
| 1356 | 1356 | } |
| 1357 | 1357 | |
| 1358 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1358 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | /** |
| 49 | 49 | * Main Give Class |
| 50 | 50 | * |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | * @return Give |
| 160 | 160 | */ |
| 161 | 161 | public static function instance() {
|
| 162 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 162 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 163 | 163 | self::$instance = new Give; |
| 164 | 164 | self::$instance->setup_constants(); |
| 165 | 165 | |
| 166 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 166 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 167 | 167 | |
| 168 | 168 | self::$instance->includes(); |
| 169 | 169 | self::$instance->roles = new Give_Roles(); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function __clone() {
|
| 198 | 198 | // Cloning instances of the class is forbidden |
| 199 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 199 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function __wakeup() {
|
| 210 | 210 | // Unserializing instances of the class is forbidden |
| 211 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 211 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -221,33 +221,33 @@ discard block |
||
| 221 | 221 | private function setup_constants() {
|
| 222 | 222 | |
| 223 | 223 | // Plugin version |
| 224 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 225 | - define( 'GIVE_VERSION', '1.4' ); |
|
| 224 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 225 | + define('GIVE_VERSION', '1.4');
|
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | // Plugin Folder Path |
| 229 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 230 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 229 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 230 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // Plugin Folder URL |
| 234 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 235 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 234 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 235 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Plugin Basename aka: "give/give.php" |
| 239 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 240 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 239 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 240 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Plugin Root File |
| 244 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 245 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 244 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 245 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // Make sure CAL_GREGORIAN is defined |
| 249 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 250 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 249 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 250 | + define('CAL_GREGORIAN', 1);
|
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
@@ -261,107 +261,107 @@ discard block |
||
| 261 | 261 | private function includes() {
|
| 262 | 262 | global $give_options; |
| 263 | 263 | |
| 264 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php'; |
|
| 264 | + require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php'; |
|
| 265 | 265 | $give_options = give_get_settings(); |
| 266 | 266 | |
| 267 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 268 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 269 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 270 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 271 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 272 | - |
|
| 273 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 274 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 275 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 276 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 277 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 278 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 279 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 285 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 286 | - |
|
| 287 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 288 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 289 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 290 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 291 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 292 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 293 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 294 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 295 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 296 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 297 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
| 298 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 299 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 300 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 301 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
| 302 | - |
|
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 304 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 305 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 306 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 307 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php'; |
|
| 308 | - |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 311 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 313 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 314 | - |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 319 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 320 | - |
|
| 321 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 322 | - |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 334 | - |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 337 | - |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 342 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 343 | - |
|
| 344 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 347 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 348 | - |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 350 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 358 | - |
|
| 359 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 267 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 268 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 269 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 270 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 271 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 272 | + |
|
| 273 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 274 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 275 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 276 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 277 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 278 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 279 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 285 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 286 | + |
|
| 287 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 288 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 289 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 290 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 291 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 292 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 293 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 294 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 295 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 296 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 297 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
| 298 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 299 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 300 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 301 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
| 302 | + |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 304 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 305 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 306 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 307 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php'; |
|
| 308 | + |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 311 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 313 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 314 | + |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 319 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 320 | + |
|
| 321 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 322 | + |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 334 | + |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 337 | + |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 342 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 343 | + |
|
| 344 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 347 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 348 | + |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 350 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 358 | + |
|
| 359 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 361 | 361 | |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 364 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 365 | 365 | |
| 366 | 366 | } |
| 367 | 367 | |
@@ -374,26 +374,26 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | public function load_textdomain() {
|
| 376 | 376 | // Set filter for Give's languages directory |
| 377 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 378 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 377 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 378 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 379 | 379 | |
| 380 | 380 | // Traditional WordPress plugin locale filter |
| 381 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 382 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 381 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 382 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 383 | 383 | |
| 384 | 384 | // Setup paths to current locale file |
| 385 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 386 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 385 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 386 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 387 | 387 | |
| 388 | - if ( file_exists( $mofile_global ) ) {
|
|
| 388 | + if (file_exists($mofile_global)) {
|
|
| 389 | 389 | // Look in global /wp-content/languages/give folder |
| 390 | - load_textdomain( 'give', $mofile_global ); |
|
| 391 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 390 | + load_textdomain('give', $mofile_global);
|
|
| 391 | + } elseif (file_exists($mofile_local)) {
|
|
| 392 | 392 | // Look in local location from filter `give_languages_directory` |
| 393 | - load_textdomain( 'give', $mofile_local ); |
|
| 393 | + load_textdomain('give', $mofile_local);
|
|
| 394 | 394 | } else {
|
| 395 | 395 | // Load the default language files packaged up w/ Give |
| 396 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 396 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | } |