@@ -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,10 +25,10 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return string Login form |
| 27 | 27 | */ |
| 28 | -function give_login_form( $redirect = '' ) { |
|
| 28 | +function give_login_form($redirect = '') { |
|
| 29 | 29 | global $give_options, $give_login_redirect; |
| 30 | 30 | |
| 31 | - if ( empty( $redirect ) ) { |
|
| 31 | + if (empty($redirect)) { |
|
| 32 | 32 | $redirect = give_get_current_page_url(); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | ob_start(); |
| 38 | 38 | |
| 39 | - give_get_template_part( 'shortcode', 'login' ); |
|
| 39 | + give_get_template_part('shortcode', 'login'); |
|
| 40 | 40 | |
| 41 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
| 41 | + return apply_filters('give_login_form', ob_get_clean()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return string Register form |
| 54 | 54 | */ |
| 55 | -function give_register_form( $redirect = '' ) { |
|
| 55 | +function give_register_form($redirect = '') { |
|
| 56 | 56 | global $give_options, $give_register_redirect; |
| 57 | 57 | |
| 58 | - if ( empty( $redirect ) ) { |
|
| 58 | + if (empty($redirect)) { |
|
| 59 | 59 | $redirect = give_get_current_page_url(); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | ob_start(); |
| 65 | 65 | |
| 66 | - if ( ! is_user_logged_in() ) { |
|
| 67 | - give_get_template_part( 'shortcode', 'register' ); |
|
| 66 | + if ( ! is_user_logged_in()) { |
|
| 67 | + give_get_template_part('shortcode', 'register'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
| 70 | + return apply_filters('give_register_form', ob_get_clean()); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -79,34 +79,34 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | -function give_process_login_form( $data ) { |
|
| 83 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
| 84 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
| 85 | - if ( ! $user_data ) { |
|
| 86 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
| 82 | +function give_process_login_form($data) { |
|
| 83 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
| 84 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
| 85 | + if ( ! $user_data) { |
|
| 86 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
| 87 | 87 | } |
| 88 | - if ( $user_data ) { |
|
| 88 | + if ($user_data) { |
|
| 89 | 89 | $user_ID = $user_data->ID; |
| 90 | 90 | $user_email = $user_data->user_email; |
| 91 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
| 92 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
| 91 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
| 92 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
| 93 | 93 | } else { |
| 94 | - give_set_error( 'password_incorrect', __( 'The password you entered is incorrect', 'give' ) ); |
|
| 94 | + give_set_error('password_incorrect', __('The password you entered is incorrect', 'give')); |
|
| 95 | 95 | } |
| 96 | 96 | } else { |
| 97 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) ); |
|
| 97 | + give_set_error('username_incorrect', __('The username you entered does not exist', 'give')); |
|
| 98 | 98 | } |
| 99 | 99 | // Check for errors and redirect if none present |
| 100 | 100 | $errors = give_get_errors(); |
| 101 | - if ( ! $errors ) { |
|
| 102 | - $redirect = apply_filters( 'give_login_redirect', $data['give_redirect'], $user_ID ); |
|
| 103 | - wp_redirect( $redirect ); |
|
| 101 | + if ( ! $errors) { |
|
| 102 | + $redirect = apply_filters('give_login_redirect', $data['give_redirect'], $user_ID); |
|
| 103 | + wp_redirect($redirect); |
|
| 104 | 104 | give_die(); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
| 109 | +add_action('give_user_login', 'give_process_login_form'); |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Log User In |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return void |
| 121 | 121 | */ |
| 122 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
| 123 | - if ( $user_id < 1 ) { |
|
| 122 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
| 123 | + if ($user_id < 1) { |
|
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - wp_set_auth_cookie( $user_id ); |
|
| 128 | - wp_set_current_user( $user_id, $user_login ); |
|
| 129 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
| 130 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
| 127 | + wp_set_auth_cookie($user_id); |
|
| 128 | + wp_set_current_user($user_id, $user_login); |
|
| 129 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
| 130 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -140,70 +140,70 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | -function give_process_register_form( $data ) { |
|
| 143 | +function give_process_register_form($data) { |
|
| 144 | 144 | |
| 145 | - if ( is_user_logged_in() ) { |
|
| 145 | + if (is_user_logged_in()) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
| 149 | + if (empty($_POST['give_register_submit'])) { |
|
| 150 | 150 | return; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - do_action( 'give_pre_process_register_form' ); |
|
| 153 | + do_action('give_pre_process_register_form'); |
|
| 154 | 154 | |
| 155 | - if ( empty( $data['give_user_login'] ) ) { |
|
| 156 | - give_set_error( 'empty_username', __( 'Invalid username', 'give' ) ); |
|
| 155 | + if (empty($data['give_user_login'])) { |
|
| 156 | + give_set_error('empty_username', __('Invalid username', 'give')); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
| 160 | - give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) ); |
|
| 159 | + if (username_exists($data['give_user_login'])) { |
|
| 160 | + give_set_error('username_unavailable', __('Username already taken', 'give')); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
| 164 | - give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) ); |
|
| 163 | + if ( ! validate_username($data['give_user_login'])) { |
|
| 164 | + give_set_error('username_invalid', __('Invalid username', 'give')); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
| 168 | - give_set_error( 'email_unavailable', __( 'Email address already taken', 'give' ) ); |
|
| 167 | + if (email_exists($data['give_user_email'])) { |
|
| 168 | + give_set_error('email_unavailable', __('Email address already taken', 'give')); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
| 172 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
| 171 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
| 172 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
| 176 | - give_set_error( 'payment_email_invalid', __( 'Invalid payment email', 'give' ) ); |
|
| 175 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
| 176 | + give_set_error('payment_email_invalid', __('Invalid payment email', 'give')); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
| 180 | - give_set_error( 'empty_password', __( 'Please enter a password', 'give' ) ); |
|
| 179 | + if (empty($_POST['give_user_pass'])) { |
|
| 180 | + give_set_error('empty_password', __('Please enter a password', 'give')); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
| 184 | - give_set_error( 'password_mismatch', __( 'Passwords do not match', 'give' ) ); |
|
| 183 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
| 184 | + give_set_error('password_mismatch', __('Passwords do not match', 'give')); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - do_action( 'give_process_register_form' ); |
|
| 187 | + do_action('give_process_register_form'); |
|
| 188 | 188 | |
| 189 | 189 | // Check for errors and redirect if none present |
| 190 | 190 | $errors = give_get_errors(); |
| 191 | 191 | |
| 192 | - if ( empty( $errors ) ) { |
|
| 192 | + if (empty($errors)) { |
|
| 193 | 193 | |
| 194 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
| 194 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
| 195 | 195 | |
| 196 | - give_register_and_login_new_user( array( |
|
| 196 | + give_register_and_login_new_user(array( |
|
| 197 | 197 | 'user_login' => $data['give_user_login'], |
| 198 | 198 | 'user_pass' => $data['give_user_pass'], |
| 199 | 199 | 'user_email' => $data['give_user_email'], |
| 200 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
| 201 | - 'role' => get_option( 'default_role' ) |
|
| 202 | - ) ); |
|
| 200 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
| 201 | + 'role' => get_option('default_role') |
|
| 202 | + )); |
|
| 203 | 203 | |
| 204 | - wp_redirect( $redirect ); |
|
| 204 | + wp_redirect($redirect); |
|
| 205 | 205 | give_die(); |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
| 210 | 209 | \ No newline at end of file |
| 210 | +add_action('give_user_register', 'give_process_register_form'); |
|
| 211 | 211 | \ No newline at end of file |
@@ -142,8 +142,10 @@ |
||
| 142 | 142 | |
| 143 | 143 | if ( is_front_page() ) : |
| 144 | 144 | $page_url = home_url(); |
| 145 | - else : |
|
| 145 | + else { |
|
| 146 | + : |
|
| 146 | 147 | $page_url = 'http'; |
| 148 | + } |
|
| 147 | 149 | |
| 148 | 150 | if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) { |
| 149 | 151 | $page_url .= "s"; |
@@ -727,10 +727,10 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | if ( ! is_int( $params[1] ) |
| 730 | - && ! is_float( $params[1] ) |
|
| 731 | - && ! is_string( $params[1] ) |
|
| 732 | - && $params[1] !== null |
|
| 733 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 730 | + && ! is_float( $params[1] ) |
|
| 731 | + && ! is_string( $params[1] ) |
|
| 732 | + && $params[1] !== null |
|
| 733 | + && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 734 | 734 | ) { |
| 735 | 735 | trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
| 736 | 736 | |
@@ -738,10 +738,10 @@ discard block |
||
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | if ( isset( $params[2] ) |
| 741 | - && ! is_int( $params[2] ) |
|
| 742 | - && ! is_float( $params[2] ) |
|
| 743 | - && ! is_string( $params[2] ) |
|
| 744 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 741 | + && ! is_int( $params[2] ) |
|
| 742 | + && ! is_float( $params[2] ) |
|
| 743 | + && ! is_string( $params[2] ) |
|
| 744 | + && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 745 | 745 | ) { |
| 746 | 746 | trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
| 747 | 747 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.0 |
| 341 | 341 | * @uses Give()->session->get() |
| 342 | - * @return mixed array | false |
|
| 342 | + * @return string array | false |
|
| 343 | 343 | */ |
| 344 | 344 | function give_get_purchase_session() { |
| 345 | 345 | return Give()->session->get( 'give_purchase' ); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * Returns the webhost this site is using if possible |
| 377 | 377 | * |
| 378 | 378 | * @since 1.0 |
| 379 | - * @return mixed string $host if detected, false otherwise |
|
| 379 | + * @return string string $host if detected, false otherwise |
|
| 380 | 380 | */ |
| 381 | 381 | function give_get_host() { |
| 382 | 382 | $host = false; |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * |
| 548 | 548 | * @since 1.0 |
| 549 | 549 | * |
| 550 | - * @param unknown $n |
|
| 550 | + * @param integer $n |
|
| 551 | 551 | * |
| 552 | 552 | * @return string Short month name |
| 553 | 553 | */ |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | /** |
| 678 | 678 | * Create SVG library function |
| 679 | 679 | * |
| 680 | - * @param $icon |
|
| 680 | + * @param string $icon |
|
| 681 | 681 | * |
| 682 | - * @return mixed |
|
| 682 | + * @return string |
|
| 683 | 683 | */ |
| 684 | 684 | function give_svg_icons( $icon ) { |
| 685 | 685 | |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | * |
| 737 | 737 | * @param array $input A multi-dimensional array (record set) from which to pull |
| 738 | 738 | * a column of values. |
| 739 | - * @param mixed $columnKey The column of values to return. This value may be the |
|
| 739 | + * @param string $columnKey The column of values to return. This value may be the |
|
| 740 | 740 | * integer key of the column you wish to retrieve, or it |
| 741 | 741 | * may be the string key name for an associative array. |
| 742 | 742 | * @param mixed $indexKey (Optional.) The column to use as the index/keys for |
@@ -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,25 +195,25 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function give_get_current_page_url() { |
| 197 | 197 | |
| 198 | - if ( is_front_page() ) : |
|
| 198 | + if (is_front_page()) : |
|
| 199 | 199 | $page_url = home_url(); |
| 200 | 200 | else : |
| 201 | 201 | $page_url = 'http'; |
| 202 | 202 | |
| 203 | - if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) { |
|
| 203 | + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { |
|
| 204 | 204 | $page_url .= "s"; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | $page_url .= "://"; |
| 208 | 208 | |
| 209 | - if ( isset( $_SERVER["SERVER_PORT"] ) && $_SERVER["SERVER_PORT"] != "80" ) { |
|
| 210 | - $page_url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; |
|
| 209 | + if (isset($_SERVER["SERVER_PORT"]) && $_SERVER["SERVER_PORT"] != "80") { |
|
| 210 | + $page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; |
|
| 211 | 211 | } else { |
| 212 | - $page_url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
|
| 212 | + $page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; |
|
| 213 | 213 | } |
| 214 | 214 | endif; |
| 215 | 215 | |
| 216 | - return apply_filters( 'give_get_current_page_url', esc_url( $page_url ) ); |
|
| 216 | + return apply_filters('give_get_current_page_url', esc_url($page_url)); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | $gateways = give_get_enabled_payment_gateways(); |
| 236 | 236 | |
| 237 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
| 237 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
| 238 | 238 | $ret = true; |
| 239 | - } else if ( count( $gateways ) == 1 ) { |
|
| 239 | + } else if (count($gateways) == 1) { |
|
| 240 | 240 | $ret = false; |
| 241 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
| 241 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
| 242 | 242 | $ret = false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
| 245 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | global $give_options; |
| 259 | 259 | |
| 260 | - $ret = ! empty( $give_options['logged_in_only'] ); |
|
| 260 | + $ret = ! empty($give_options['logged_in_only']); |
|
| 261 | 261 | |
| 262 | - return (bool) apply_filters( 'give_logged_in_only', $ret ); |
|
| 262 | + return (bool) apply_filters('give_logged_in_only', $ret); |
|
| 263 | 263 | |
| 264 | 264 | } |
| 265 | 265 | |
@@ -273,26 +273,26 @@ discard block |
||
| 273 | 273 | function give_get_timezone_id() { |
| 274 | 274 | |
| 275 | 275 | // if site timezone string exists, return it |
| 276 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
| 276 | + if ($timezone = get_option('timezone_string')) { |
|
| 277 | 277 | return $timezone; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // get UTC offset, if it isn't set return UTC |
| 281 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
| 281 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
| 282 | 282 | return 'UTC'; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // attempt to guess the timezone string from the UTC offset |
| 286 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
| 286 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
| 287 | 287 | |
| 288 | 288 | // last try, guess timezone string manually |
| 289 | - if ( $timezone === false ) { |
|
| 289 | + if ($timezone === false) { |
|
| 290 | 290 | |
| 291 | - $is_dst = date( 'I' ); |
|
| 291 | + $is_dst = date('I'); |
|
| 292 | 292 | |
| 293 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
| 294 | - foreach ( $abbr as $city ) { |
|
| 295 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
| 293 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
| 294 | + foreach ($abbr as $city) { |
|
| 295 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
| 296 | 296 | return $city['timezone_id']; |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -316,17 +316,17 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | $ip = '127.0.0.1'; |
| 318 | 318 | |
| 319 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
| 319 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
| 320 | 320 | //check ip from share internet |
| 321 | 321 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
| 322 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
| 322 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
| 323 | 323 | //to check ip is pass from proxy |
| 324 | 324 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 325 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
| 325 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
| 326 | 326 | $ip = $_SERVER['REMOTE_ADDR']; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - return apply_filters( 'give_get_ip', $ip ); |
|
| 329 | + return apply_filters('give_get_ip', $ip); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | * |
| 342 | 342 | * @uses Give()->session->set() |
| 343 | 343 | */ |
| 344 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
| 345 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
| 344 | +function give_set_purchase_session($purchase_data = array()) { |
|
| 345 | + Give()->session->set('give_purchase', $purchase_data); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * @return mixed array | false |
| 357 | 357 | */ |
| 358 | 358 | function give_get_purchase_session() { |
| 359 | - return Give()->session->get( 'give_purchase' ); |
|
| 359 | + return Give()->session->get('give_purchase'); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
@@ -371,14 +371,14 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @return string |
| 373 | 373 | */ |
| 374 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
| 374 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
| 375 | 375 | $summary = ''; |
| 376 | 376 | |
| 377 | - if ( $email ) { |
|
| 378 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
| 377 | + if ($email) { |
|
| 378 | + $summary .= $purchase_data['user_email'].' - '; |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
| 381 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
| 382 | 382 | |
| 383 | 383 | return $summary; |
| 384 | 384 | } |
@@ -395,31 +395,31 @@ discard block |
||
| 395 | 395 | function give_get_host() { |
| 396 | 396 | $host = false; |
| 397 | 397 | |
| 398 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 398 | + if (defined('WPE_APIKEY')) { |
|
| 399 | 399 | $host = 'WP Engine'; |
| 400 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
| 400 | + } elseif (defined('PAGELYBIN')) { |
|
| 401 | 401 | $host = 'Pagely'; |
| 402 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
| 402 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
| 403 | 403 | $host = 'ICDSoft'; |
| 404 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
| 404 | + } elseif (DB_HOST == 'mysqlv5') { |
|
| 405 | 405 | $host = 'NetworkSolutions'; |
| 406 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
| 406 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
| 407 | 407 | $host = 'iPage'; |
| 408 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
| 408 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
| 409 | 409 | $host = 'IPower'; |
| 410 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
| 410 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
| 411 | 411 | $host = 'MediaTemple Grid'; |
| 412 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
| 412 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
| 413 | 413 | $host = 'pair Networks'; |
| 414 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
| 414 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
| 415 | 415 | $host = 'Rackspace Cloud'; |
| 416 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
| 416 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
| 417 | 417 | $host = 'SysFix.eu Power Hosting'; |
| 418 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
| 418 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
| 419 | 419 | $host = 'Flywheel'; |
| 420 | 420 | } else { |
| 421 | 421 | // Adding a general fallback for data gathering |
| 422 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
| 422 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | return $host; |
@@ -435,67 +435,67 @@ discard block |
||
| 435 | 435 | * |
| 436 | 436 | * @return bool true if host matches, false if not |
| 437 | 437 | */ |
| 438 | -function give_is_host( $host = false ) { |
|
| 438 | +function give_is_host($host = false) { |
|
| 439 | 439 | |
| 440 | 440 | $return = false; |
| 441 | 441 | |
| 442 | - if ( $host ) { |
|
| 443 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
| 442 | + if ($host) { |
|
| 443 | + $host = str_replace(' ', '', strtolower($host)); |
|
| 444 | 444 | |
| 445 | - switch ( $host ) { |
|
| 445 | + switch ($host) { |
|
| 446 | 446 | case 'wpengine': |
| 447 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 447 | + if (defined('WPE_APIKEY')) { |
|
| 448 | 448 | $return = true; |
| 449 | 449 | } |
| 450 | 450 | break; |
| 451 | 451 | case 'pagely': |
| 452 | - if ( defined( 'PAGELYBIN' ) ) { |
|
| 452 | + if (defined('PAGELYBIN')) { |
|
| 453 | 453 | $return = true; |
| 454 | 454 | } |
| 455 | 455 | break; |
| 456 | 456 | case 'icdsoft': |
| 457 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
| 457 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
| 458 | 458 | $return = true; |
| 459 | 459 | } |
| 460 | 460 | break; |
| 461 | 461 | case 'networksolutions': |
| 462 | - if ( DB_HOST == 'mysqlv5' ) { |
|
| 462 | + if (DB_HOST == 'mysqlv5') { |
|
| 463 | 463 | $return = true; |
| 464 | 464 | } |
| 465 | 465 | break; |
| 466 | 466 | case 'ipage': |
| 467 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
| 467 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
| 468 | 468 | $return = true; |
| 469 | 469 | } |
| 470 | 470 | break; |
| 471 | 471 | case 'ipower': |
| 472 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
| 472 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
| 473 | 473 | $return = true; |
| 474 | 474 | } |
| 475 | 475 | break; |
| 476 | 476 | case 'mediatemplegrid': |
| 477 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
| 477 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
| 478 | 478 | $return = true; |
| 479 | 479 | } |
| 480 | 480 | break; |
| 481 | 481 | case 'pairnetworks': |
| 482 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
| 482 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
| 483 | 483 | $return = true; |
| 484 | 484 | } |
| 485 | 485 | break; |
| 486 | 486 | case 'rackspacecloud': |
| 487 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
| 487 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
| 488 | 488 | $return = true; |
| 489 | 489 | } |
| 490 | 490 | break; |
| 491 | 491 | case 'sysfix.eu': |
| 492 | 492 | case 'sysfix.eupowerhosting': |
| 493 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
| 493 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
| 494 | 494 | $return = true; |
| 495 | 495 | } |
| 496 | 496 | break; |
| 497 | 497 | case 'flywheel': |
| 498 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
| 498 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
| 499 | 499 | $return = true; |
| 500 | 500 | } |
| 501 | 501 | break; |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | * @return string $post_id |
| 517 | 517 | */ |
| 518 | 518 | function give_get_admin_post_id() { |
| 519 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
| 520 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
| 519 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
| 520 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
| 521 | 521 | $post_id = $_POST['post_id']; |
| 522 | 522 | } |
| 523 | 523 | |
@@ -535,11 +535,11 @@ discard block |
||
| 535 | 535 | * |
| 536 | 536 | * @return bool $ret True if guest checkout is enabled, false otherwise |
| 537 | 537 | */ |
| 538 | -function give_no_guest_checkout( $form_id ) { |
|
| 538 | +function give_no_guest_checkout($form_id) { |
|
| 539 | 539 | |
| 540 | - $ret = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
| 540 | + $ret = get_post_meta($form_id, '_give_logged_in_only', true); |
|
| 541 | 541 | |
| 542 | - return (bool) apply_filters( 'give_no_guest_checkout', $ret ); |
|
| 542 | + return (bool) apply_filters('give_no_guest_checkout', $ret); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * @return string Arg separator output |
| 551 | 551 | */ |
| 552 | 552 | function give_get_php_arg_separator_output() { |
| 553 | - return ini_get( 'arg_separator.output' ); |
|
| 553 | + return ini_get('arg_separator.output'); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | |
@@ -565,10 +565,10 @@ discard block |
||
| 565 | 565 | * |
| 566 | 566 | * @return string Short month name |
| 567 | 567 | */ |
| 568 | -function give_month_num_to_name( $n ) { |
|
| 569 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
| 568 | +function give_month_num_to_name($n) { |
|
| 569 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
| 570 | 570 | |
| 571 | - return date_i18n( "M", $timestamp ); |
|
| 571 | + return date_i18n("M", $timestamp); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
@@ -581,10 +581,10 @@ discard block |
||
| 581 | 581 | * |
| 582 | 582 | * @return bool Whether or not function is disabled. |
| 583 | 583 | */ |
| 584 | -function give_is_func_disabled( $function ) { |
|
| 585 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
| 584 | +function give_is_func_disabled($function) { |
|
| 585 | + $disabled = explode(',', ini_get('disable_functions')); |
|
| 586 | 586 | |
| 587 | - return in_array( $function, $disabled ); |
|
| 587 | + return in_array($function, $disabled); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | <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> |
| 601 | 601 | <div class="give-newsletter-confirmation"> |
| 602 | - <p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
| 602 | + <p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
| 603 | 603 | </div> |
| 604 | 604 | |
| 605 | 605 | <table class="form-table give-newsletter-form"> |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | * |
| 696 | 696 | * @return mixed |
| 697 | 697 | */ |
| 698 | -function give_svg_icons( $icon ) { |
|
| 698 | +function give_svg_icons($icon) { |
|
| 699 | 699 | |
| 700 | 700 | // Store your SVGs in an associative array |
| 701 | 701 | $svgs = array( |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | ); |
| 708 | 708 | |
| 709 | 709 | // Return the chosen icon's SVG string |
| 710 | - return $svgs[ $icon ]; |
|
| 710 | + return $svgs[$icon]; |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /** |
@@ -719,15 +719,15 @@ discard block |
||
| 719 | 719 | * |
| 720 | 720 | * @return mixed |
| 721 | 721 | */ |
| 722 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
| 723 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
| 722 | +function modify_nav_menu_meta_box_object($post_type) { |
|
| 723 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
| 724 | 724 | $post_type->labels->name = 'Donation Forms'; |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | return $post_type; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
| 730 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
| 731 | 731 | |
| 732 | 732 | |
| 733 | 733 | /** |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | * @license http://opensource.org/licenses/MIT MIT |
| 741 | 741 | */ |
| 742 | 742 | |
| 743 | -if ( ! function_exists( 'array_column' ) ) { |
|
| 743 | +if ( ! function_exists('array_column')) { |
|
| 744 | 744 | /** |
| 745 | 745 | * Returns the values from a single column of the input array, identified by |
| 746 | 746 | * the $columnKey. |
@@ -759,56 +759,56 @@ discard block |
||
| 759 | 759 | * |
| 760 | 760 | * @return array |
| 761 | 761 | */ |
| 762 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
| 762 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
| 763 | 763 | // Using func_get_args() in order to check for proper number of |
| 764 | 764 | // parameters and trigger errors exactly as the built-in array_column() |
| 765 | 765 | // does in PHP 5.5. |
| 766 | 766 | $argc = func_num_args(); |
| 767 | 767 | $params = func_get_args(); |
| 768 | 768 | |
| 769 | - if ( $argc < 2 ) { |
|
| 770 | - trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING ); |
|
| 769 | + if ($argc < 2) { |
|
| 770 | + trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING); |
|
| 771 | 771 | |
| 772 | 772 | return null; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - if ( ! is_array( $params[0] ) ) { |
|
| 775 | + if ( ! is_array($params[0])) { |
|
| 776 | 776 | trigger_error( |
| 777 | - 'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given', |
|
| 777 | + 'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given', |
|
| 778 | 778 | E_USER_WARNING |
| 779 | 779 | ); |
| 780 | 780 | |
| 781 | 781 | return null; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | - if ( ! is_int( $params[1] ) |
|
| 785 | - && ! is_float( $params[1] ) |
|
| 786 | - && ! is_string( $params[1] ) |
|
| 784 | + if ( ! is_int($params[1]) |
|
| 785 | + && ! is_float($params[1]) |
|
| 786 | + && ! is_string($params[1]) |
|
| 787 | 787 | && $params[1] !== null |
| 788 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 788 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
| 789 | 789 | ) { |
| 790 | - trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
|
| 790 | + trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
|
| 791 | 791 | |
| 792 | 792 | return false; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - if ( isset( $params[2] ) |
|
| 796 | - && ! is_int( $params[2] ) |
|
| 797 | - && ! is_float( $params[2] ) |
|
| 798 | - && ! is_string( $params[2] ) |
|
| 799 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 795 | + if (isset($params[2]) |
|
| 796 | + && ! is_int($params[2]) |
|
| 797 | + && ! is_float($params[2]) |
|
| 798 | + && ! is_string($params[2]) |
|
| 799 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
| 800 | 800 | ) { |
| 801 | - trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
|
| 801 | + trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
|
| 802 | 802 | |
| 803 | 803 | return false; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | $paramsInput = $params[0]; |
| 807 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
| 807 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
| 808 | 808 | |
| 809 | 809 | $paramsIndexKey = null; |
| 810 | - if ( isset( $params[2] ) ) { |
|
| 811 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
| 810 | + if (isset($params[2])) { |
|
| 811 | + if (is_float($params[2]) || is_int($params[2])) { |
|
| 812 | 812 | $paramsIndexKey = (int) $params[2]; |
| 813 | 813 | } else { |
| 814 | 814 | $paramsIndexKey = (string) $params[2]; |
@@ -817,26 +817,26 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | $resultArray = array(); |
| 819 | 819 | |
| 820 | - foreach ( $paramsInput as $row ) { |
|
| 820 | + foreach ($paramsInput as $row) { |
|
| 821 | 821 | $key = $value = null; |
| 822 | 822 | $keySet = $valueSet = false; |
| 823 | 823 | |
| 824 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
| 824 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
| 825 | 825 | $keySet = true; |
| 826 | - $key = (string) $row[ $paramsIndexKey ]; |
|
| 826 | + $key = (string) $row[$paramsIndexKey]; |
|
| 827 | 827 | } |
| 828 | 828 | |
| 829 | - if ( $paramsColumnKey === null ) { |
|
| 829 | + if ($paramsColumnKey === null) { |
|
| 830 | 830 | $valueSet = true; |
| 831 | 831 | $value = $row; |
| 832 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
| 832 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
| 833 | 833 | $valueSet = true; |
| 834 | - $value = $row[ $paramsColumnKey ]; |
|
| 834 | + $value = $row[$paramsColumnKey]; |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ( $valueSet ) { |
|
| 838 | - if ( $keySet ) { |
|
| 839 | - $resultArray[ $key ] = $value; |
|
| 837 | + if ($valueSet) { |
|
| 838 | + if ($keySet) { |
|
| 839 | + $resultArray[$key] = $value; |
|
| 840 | 840 | } else { |
| 841 | 841 | $resultArray[] = $value; |
| 842 | 842 | } |
@@ -858,39 +858,39 @@ discard block |
||
| 858 | 858 | * |
| 859 | 859 | * @return bool Whether the receipt is visible or not. |
| 860 | 860 | */ |
| 861 | -function give_can_view_receipt( $payment_key = '' ) { |
|
| 861 | +function give_can_view_receipt($payment_key = '') { |
|
| 862 | 862 | |
| 863 | 863 | $return = false; |
| 864 | 864 | |
| 865 | - if ( empty( $payment_key ) ) { |
|
| 865 | + if (empty($payment_key)) { |
|
| 866 | 866 | return $return; |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | global $give_receipt_args; |
| 870 | 870 | |
| 871 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
| 871 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
| 872 | 872 | |
| 873 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
| 873 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
| 874 | 874 | |
| 875 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
| 875 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
| 876 | 876 | |
| 877 | - if ( is_user_logged_in() ) { |
|
| 878 | - if ( $user_id === (int) get_current_user_id() ) { |
|
| 877 | + if (is_user_logged_in()) { |
|
| 878 | + if ($user_id === (int) get_current_user_id()) { |
|
| 879 | 879 | $return = true; |
| 880 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
| 880 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
| 881 | 881 | $return = true; |
| 882 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
| 882 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
| 883 | 883 | $return = true; |
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | $session = give_get_purchase_session(); |
| 888 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
| 889 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
| 888 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
| 889 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
| 890 | 890 | $return = true; |
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
| 894 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
| 895 | 895 | |
| 896 | 896 | } |
| 897 | 897 | \ 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 | |
@@ -50,50 +50,50 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | |
| 52 | 52 | // https://gist.github.com/justinph/5197810 |
| 53 | - function validate_gravatar( $id_or_email ) { |
|
| 53 | + function validate_gravatar($id_or_email) { |
|
| 54 | 54 | //id or email code borrowed from wp-includes/pluggable.php |
| 55 | 55 | $email = ''; |
| 56 | - if ( is_numeric( $id_or_email ) ) { |
|
| 56 | + if (is_numeric($id_or_email)) { |
|
| 57 | 57 | $id = (int) $id_or_email; |
| 58 | - $user = get_userdata( $id ); |
|
| 59 | - if ( $user ) { |
|
| 58 | + $user = get_userdata($id); |
|
| 59 | + if ($user) { |
|
| 60 | 60 | $email = $user->user_email; |
| 61 | 61 | } |
| 62 | - } elseif ( is_object( $id_or_email ) ) { |
|
| 62 | + } elseif (is_object($id_or_email)) { |
|
| 63 | 63 | // No avatar for pingbacks or trackbacks |
| 64 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
| 65 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
| 64 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
| 65 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
| 69 | + if ( ! empty($id_or_email->user_id)) { |
|
| 70 | 70 | $id = (int) $id_or_email->user_id; |
| 71 | - $user = get_userdata( $id ); |
|
| 72 | - if ( $user ) { |
|
| 71 | + $user = get_userdata($id); |
|
| 72 | + if ($user) { |
|
| 73 | 73 | $email = $user->user_email; |
| 74 | 74 | } |
| 75 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
| 75 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
| 76 | 76 | $email = $id_or_email->comment_author_email; |
| 77 | 77 | } |
| 78 | 78 | } else { |
| 79 | 79 | $email = $id_or_email; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
| 83 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
| 82 | + $hashkey = md5(strtolower(trim($email))); |
|
| 83 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
| 84 | 84 | |
| 85 | - $data = wp_cache_get( $hashkey ); |
|
| 86 | - if ( false === $data ) { |
|
| 87 | - $response = wp_remote_head( $uri ); |
|
| 88 | - if ( is_wp_error( $response ) ) { |
|
| 85 | + $data = wp_cache_get($hashkey); |
|
| 86 | + if (false === $data) { |
|
| 87 | + $response = wp_remote_head($uri); |
|
| 88 | + if (is_wp_error($response)) { |
|
| 89 | 89 | $data = 'not200'; |
| 90 | 90 | } else { |
| 91 | 91 | $data = $response['response']['code']; |
| 92 | 92 | } |
| 93 | - wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
| 93 | + wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5); |
|
| 94 | 94 | |
| 95 | 95 | } |
| 96 | - if ( $data == '200' ) { |
|
| 96 | + if ($data == '200') { |
|
| 97 | 97 | return true; |
| 98 | 98 | } else { |
| 99 | 99 | return false; |
@@ -108,17 +108,17 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @param int $form_id |
| 110 | 110 | */ |
| 111 | - function get_log_ids( $form_id = '' ) { |
|
| 111 | + function get_log_ids($form_id = '') { |
|
| 112 | 112 | |
| 113 | 113 | // get Give_Logging class |
| 114 | 114 | global $give_logs; |
| 115 | 115 | |
| 116 | 116 | // get log for this form |
| 117 | - $logs = $give_logs->get_logs( $form_id ); |
|
| 117 | + $logs = $give_logs->get_logs($form_id); |
|
| 118 | 118 | |
| 119 | - if ( $logs ) { |
|
| 119 | + if ($logs) { |
|
| 120 | 120 | // make an array with all the donor IDs |
| 121 | - foreach ( $logs as $log ) { |
|
| 121 | + foreach ($logs as $log) { |
|
| 122 | 122 | $log_ids[] = $log->ID; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -135,49 +135,49 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @since 1.0 |
| 137 | 137 | */ |
| 138 | - function get_payment_ids( $form_id = '' ) { |
|
| 138 | + function get_payment_ids($form_id = '') { |
|
| 139 | 139 | |
| 140 | 140 | global $give_options; |
| 141 | 141 | |
| 142 | - $log_ids = $this->get_log_ids( $form_id ); |
|
| 142 | + $log_ids = $this->get_log_ids($form_id); |
|
| 143 | 143 | |
| 144 | - if ( $log_ids ) { |
|
| 144 | + if ($log_ids) { |
|
| 145 | 145 | |
| 146 | 146 | $payment_ids = array(); |
| 147 | 147 | |
| 148 | - foreach ( $log_ids as $id ) { |
|
| 148 | + foreach ($log_ids as $id) { |
|
| 149 | 149 | // get the payment ID for each corresponding log ID |
| 150 | - $payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true ); |
|
| 150 | + $payment_ids[] = get_post_meta($id, '_give_log_payment_id', true); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // remove donors who have purchased more than once so we can have unique avatars |
| 154 | 154 | $unique_emails = array(); |
| 155 | 155 | |
| 156 | - foreach ( $payment_ids as $key => $id ) { |
|
| 156 | + foreach ($payment_ids as $key => $id) { |
|
| 157 | 157 | |
| 158 | - $email = get_post_meta( $id, '_give_payment_user_email', true ); |
|
| 158 | + $email = get_post_meta($id, '_give_payment_user_email', true); |
|
| 159 | 159 | |
| 160 | - if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) { |
|
| 161 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
| 160 | + if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) { |
|
| 161 | + if ( ! $this->validate_gravatar($email)) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true ); |
|
| 166 | + $unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true); |
|
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // strip duplicate emails |
| 171 | - $unique_emails = array_unique( $unique_emails ); |
|
| 171 | + $unique_emails = array_unique($unique_emails); |
|
| 172 | 172 | |
| 173 | 173 | // convert the unique IDs back into simple array |
| 174 | - foreach ( $unique_emails as $id => $email ) { |
|
| 174 | + foreach ($unique_emails as $id => $email) { |
|
| 175 | 175 | $unique_ids[] = $id; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // randomize the payment IDs if enabled |
| 179 | - if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) { |
|
| 180 | - shuffle( $unique_ids ); |
|
| 179 | + if (isset($give_options['give_donators_gravatars_random_gravatars'])) { |
|
| 180 | + shuffle($unique_ids); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // return our unique IDs |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @since 1.0 |
| 195 | 195 | */ |
| 196 | - function gravatars( $form_id = false, $title = '' ) { |
|
| 196 | + function gravatars($form_id = false, $title = '') { |
|
| 197 | 197 | |
| 198 | 198 | // unique $payment_ids |
| 199 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
| 199 | + $payment_ids = $this->get_payment_ids($form_id); |
|
| 200 | 200 | |
| 201 | 201 | // var_dump( $payment_ids ); |
| 202 | 202 | // var_dump( $this->get_log_ids( get_the_ID() ) ); |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | global $give_options; |
| 205 | 205 | |
| 206 | 206 | // return if no ID |
| 207 | - if ( ! $form_id ) { |
|
| 207 | + if ( ! $form_id) { |
|
| 208 | 208 | return; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // minimum amount of purchases before showing gravatars |
| 212 | 212 | // if the number of items in array is not greater or equal to the number specified, then exit |
| 213 | - if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) { |
|
| 214 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) { |
|
| 213 | + if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) { |
|
| 214 | + if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) { |
|
| 215 | 215 | return; |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -222,51 +222,51 @@ discard block |
||
| 222 | 222 | echo '<div id="give-purchase-gravatars">'; |
| 223 | 223 | |
| 224 | 224 | |
| 225 | - if ( isset ( $title ) ) { |
|
| 225 | + if (isset ($title)) { |
|
| 226 | 226 | |
| 227 | - if ( $title ) { |
|
| 228 | - echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
| 229 | - } elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) { |
|
| 230 | - echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donators_gravatars_heading'] ) . '</h2>' ); |
|
| 227 | + if ($title) { |
|
| 228 | + echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
| 229 | + } elseif (isset($give_options['give_donators_gravatars_heading'])) { |
|
| 230 | + echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donators_gravatars_heading']).'</h2>'); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | } |
| 234 | 234 | echo '<ul class="give-purchase-gravatars-list">'; |
| 235 | 235 | $i = 0; |
| 236 | 236 | |
| 237 | - if ( $payment_ids ) { |
|
| 238 | - foreach ( $payment_ids as $id ) { |
|
| 237 | + if ($payment_ids) { |
|
| 238 | + foreach ($payment_ids as $id) { |
|
| 239 | 239 | |
| 240 | 240 | // Give saves a blank option even when the control is turned off, hence the extra check |
| 241 | - if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) { |
|
| 241 | + if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) { |
|
| 242 | 242 | continue; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // get the payment meta |
| 246 | - $payment_meta = get_post_meta( $id, '_give_payment_meta', true ); |
|
| 246 | + $payment_meta = get_post_meta($id, '_give_payment_meta', true); |
|
| 247 | 247 | |
| 248 | 248 | // unserialize the payment meta |
| 249 | - $user_info = maybe_unserialize( $payment_meta['user_info'] ); |
|
| 249 | + $user_info = maybe_unserialize($payment_meta['user_info']); |
|
| 250 | 250 | |
| 251 | 251 | // get donor's first name |
| 252 | 252 | $name = $user_info['first_name']; |
| 253 | 253 | |
| 254 | 254 | // get donor's email |
| 255 | - $email = get_post_meta( $id, '_give_payment_user_email', true ); |
|
| 255 | + $email = get_post_meta($id, '_give_payment_user_email', true); |
|
| 256 | 256 | |
| 257 | 257 | // set gravatar size and provide filter |
| 258 | - $size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : ''; |
|
| 258 | + $size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : ''; |
|
| 259 | 259 | |
| 260 | 260 | // default image |
| 261 | - $default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false ); |
|
| 261 | + $default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false); |
|
| 262 | 262 | |
| 263 | 263 | // assemble output |
| 264 | 264 | $output .= '<li>'; |
| 265 | 265 | |
| 266 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
| 266 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
| 267 | 267 | $output .= '</li>'; |
| 268 | 268 | |
| 269 | - $i ++; |
|
| 269 | + $i++; |
|
| 270 | 270 | |
| 271 | 271 | } // end foreach |
| 272 | 272 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | echo '</ul>'; |
| 276 | 276 | echo '</div>'; |
| 277 | 277 | |
| 278 | - return apply_filters( 'give_donators_gravatars', ob_get_clean() ); |
|
| 278 | + return apply_filters('give_donators_gravatars', ob_get_clean()); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @since 1.0 |
| 285 | 285 | */ |
| 286 | 286 | function register_widget() { |
| 287 | - register_widget( 'Give_Donators_Gravatars_Widget' ); |
|
| 287 | + register_widget('Give_Donators_Gravatars_Widget'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -293,19 +293,19 @@ discard block |
||
| 293 | 293 | * @since 1.0 |
| 294 | 294 | * @todo set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars |
| 295 | 295 | */ |
| 296 | - function shortcode( $atts, $content = null ) { |
|
| 296 | + function shortcode($atts, $content = null) { |
|
| 297 | 297 | |
| 298 | - $atts = shortcode_atts( array( |
|
| 298 | + $atts = shortcode_atts(array( |
|
| 299 | 299 | 'id' => '', |
| 300 | 300 | 'title' => '' |
| 301 | - ), $atts, 'give_donators_gravatars' ); |
|
| 301 | + ), $atts, 'give_donators_gravatars'); |
|
| 302 | 302 | |
| 303 | 303 | // if no ID is passed on single give_forms pages, get the correct ID |
| 304 | - if ( is_singular( 'give_forms' ) ) { |
|
| 304 | + if (is_singular('give_forms')) { |
|
| 305 | 305 | $id = get_the_ID(); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
| 308 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
| 309 | 309 | |
| 310 | 310 | return $content; |
| 311 | 311 | |
@@ -316,56 +316,56 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * @since 1.0 |
| 318 | 318 | */ |
| 319 | - function settings( $settings ) { |
|
| 319 | + function settings($settings) { |
|
| 320 | 320 | |
| 321 | 321 | $give_gravatar_settings = array( |
| 322 | 322 | array( |
| 323 | - 'name' => __( 'Donator Gravatars', 'give' ), |
|
| 323 | + 'name' => __('Donator Gravatars', 'give'), |
|
| 324 | 324 | 'desc' => '<hr>', |
| 325 | 325 | 'id' => 'give_title', |
| 326 | 326 | 'type' => 'give_title' |
| 327 | 327 | ), |
| 328 | 328 | array( |
| 329 | - 'name' => __( 'Heading', 'give' ), |
|
| 330 | - 'desc' => __( 'The heading to display above the Gravatars', 'give' ), |
|
| 329 | + 'name' => __('Heading', 'give'), |
|
| 330 | + 'desc' => __('The heading to display above the Gravatars', 'give'), |
|
| 331 | 331 | 'type' => 'text', |
| 332 | 332 | 'id' => 'give_donators_gravatars_heading' |
| 333 | 333 | ), |
| 334 | 334 | array( |
| 335 | - 'name' => __( 'Gravatar Size', 'give' ), |
|
| 336 | - 'desc' => __( 'The size of each Gravatar in pixels (512px maximum)', 'give' ), |
|
| 335 | + 'name' => __('Gravatar Size', 'give'), |
|
| 336 | + 'desc' => __('The size of each Gravatar in pixels (512px maximum)', 'give'), |
|
| 337 | 337 | 'type' => 'text_small', |
| 338 | 338 | 'id' => 'give_donators_gravatars_gravatar_size', |
| 339 | 339 | 'default' => '64' |
| 340 | 340 | ), |
| 341 | 341 | array( |
| 342 | - 'name' => __( 'Minimum Unique Purchases Required', 'give' ), |
|
| 343 | - 'desc' => sprintf( __( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ), |
|
| 342 | + 'name' => __('Minimum Unique Purchases Required', 'give'), |
|
| 343 | + 'desc' => sprintf(__('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())), |
|
| 344 | 344 | 'type' => 'text_small', |
| 345 | 345 | 'id' => 'give_donators_gravatars_min_purchases_required', |
| 346 | 346 | ), |
| 347 | 347 | array( |
| 348 | - 'name' => __( 'Maximum Gravatars To Show', 'give' ), |
|
| 349 | - 'desc' => __( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
| 348 | + 'name' => __('Maximum Gravatars To Show', 'give'), |
|
| 349 | + 'desc' => __('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
| 350 | 350 | 'type' => 'text', |
| 351 | 351 | 'id' => 'give_donators_gravatars_maximum_number', |
| 352 | 352 | 'default' => '20', |
| 353 | 353 | ), |
| 354 | 354 | array( |
| 355 | - 'name' => __( 'Gravatar Visibility', 'give' ), |
|
| 356 | - 'desc' => __( 'Only show donators with a Gravatar account', 'give' ), |
|
| 355 | + 'name' => __('Gravatar Visibility', 'give'), |
|
| 356 | + 'desc' => __('Only show donators with a Gravatar account', 'give'), |
|
| 357 | 357 | 'id' => 'give_donators_gravatars_has_gravatar_account', |
| 358 | 358 | 'type' => 'checkbox', |
| 359 | 359 | ), |
| 360 | 360 | array( |
| 361 | - 'name' => __( 'Randomize Gravatars', 'give' ), |
|
| 362 | - 'desc' => __( 'Randomize the Gravatars', 'give' ), |
|
| 361 | + 'name' => __('Randomize Gravatars', 'give'), |
|
| 362 | + 'desc' => __('Randomize the Gravatars', 'give'), |
|
| 363 | 363 | 'id' => 'give_donators_gravatars_random_gravatars', |
| 364 | 364 | 'type' => 'checkbox', |
| 365 | 365 | ), |
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | - return array_merge( $settings, $give_gravatar_settings ); |
|
| 368 | + return array_merge($settings, $give_gravatar_settings); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | } |
@@ -383,12 +383,12 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function give_donators_gravatars_widget() { |
| 385 | 385 | |
| 386 | - $give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null; |
|
| 386 | + $give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null; |
|
| 387 | 387 | |
| 388 | 388 | // widget settings |
| 389 | 389 | $widget_ops = array( |
| 390 | 390 | 'classname' => 'give-donators-gravatars', |
| 391 | - 'description' => sprintf( __( 'Displays gravatars of people who have donated using your your %s. Will only show on the single %s page.', 'give' ), $give_label_singular, $give_label_singular ) |
|
| 391 | + 'description' => sprintf(__('Displays gravatars of people who have donated using your your %s. Will only show on the single %s page.', 'give'), $give_label_singular, $give_label_singular) |
|
| 392 | 392 | ); |
| 393 | 393 | |
| 394 | 394 | // widget control settings |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | // create the widget |
| 402 | 402 | $this->WP_Widget( |
| 403 | 403 | 'give_donators_gravatars_widget', |
| 404 | - __( 'Give Donators Gravatars', 'give' ), |
|
| 404 | + __('Give Donators Gravatars', 'give'), |
|
| 405 | 405 | $widget_ops, |
| 406 | 406 | $control_ops |
| 407 | 407 | ); |
@@ -412,29 +412,29 @@ discard block |
||
| 412 | 412 | /* |
| 413 | 413 | * Outputs the content of the widget |
| 414 | 414 | */ |
| 415 | - function widget( $args, $instance ) { |
|
| 415 | + function widget($args, $instance) { |
|
| 416 | 416 | global $give_options; |
| 417 | 417 | |
| 418 | - extract( $args ); |
|
| 418 | + extract($args); |
|
| 419 | 419 | |
| 420 | - if ( ! is_singular( 'give_forms' ) ) { |
|
| 420 | + if ( ! is_singular('give_forms')) { |
|
| 421 | 421 | return; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | // Variables from widget settings |
| 425 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
| 425 | + $title = apply_filters('widget_title', $instance['title']); |
|
| 426 | 426 | |
| 427 | 427 | // Used by themes. Opens the widget |
| 428 | 428 | echo $before_widget; |
| 429 | 429 | |
| 430 | 430 | // Display the widget title |
| 431 | - if ( $title ) { |
|
| 432 | - echo $before_title . $title . $after_title; |
|
| 431 | + if ($title) { |
|
| 432 | + echo $before_title.$title.$after_title; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $gravatars = new Give_Donators_Gravatars(); |
| 436 | 436 | |
| 437 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
| 437 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
| 438 | 438 | |
| 439 | 439 | // Used by themes. Closes the widget |
| 440 | 440 | echo $after_widget; |
@@ -444,11 +444,11 @@ discard block |
||
| 444 | 444 | /* |
| 445 | 445 | * Update function. Processes widget options to be saved |
| 446 | 446 | */ |
| 447 | - function update( $new_instance, $old_instance ) { |
|
| 447 | + function update($new_instance, $old_instance) { |
|
| 448 | 448 | |
| 449 | 449 | $instance = $old_instance; |
| 450 | 450 | |
| 451 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 451 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 452 | 452 | |
| 453 | 453 | return $instance; |
| 454 | 454 | |
@@ -457,19 +457,19 @@ discard block |
||
| 457 | 457 | /* |
| 458 | 458 | * Form function. Displays the actual form on the widget page |
| 459 | 459 | */ |
| 460 | - function form( $instance ) { |
|
| 460 | + function form($instance) { |
|
| 461 | 461 | |
| 462 | 462 | // Set up some default widget settings. |
| 463 | 463 | $defaults = array( |
| 464 | 464 | 'title' => '', |
| 465 | 465 | ); |
| 466 | 466 | |
| 467 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
| 467 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
| 468 | 468 | |
| 469 | 469 | <!-- Title --> |
| 470 | 470 | <p> |
| 471 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ) ?></label> |
|
| 472 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
| 471 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give') ?></label> |
|
| 472 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
| 473 | 473 | </p> |
| 474 | 474 | |
| 475 | 475 | |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
| 52 | 52 | */ |
| 53 | - public function __construct( $args = array() ) { |
|
| 53 | + public function __construct($args = array()) { |
|
| 54 | 54 | $defaults = array( |
| 55 | 55 | 'output' => 'payments', // Use 'posts' to get standard post objects |
| 56 | - 'post_type' => array( 'give_payment' ), |
|
| 56 | + 'post_type' => array('give_payment'), |
|
| 57 | 57 | 'start_date' => false, |
| 58 | 58 | 'end_date' => false, |
| 59 | 59 | 'number' => 20, |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 'give_forms' => null |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - $this->args = wp_parse_args( $args, $defaults ); |
|
| 76 | + $this->args = wp_parse_args($args, $defaults); |
|
| 77 | 77 | |
| 78 | 78 | $this->init(); |
| 79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | * @access public |
| 85 | 85 | * @since 1.0 |
| 86 | 86 | */ |
| 87 | - public function __set( $query_var, $value ) { |
|
| 88 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
| 89 | - $this->args[ $query_var ][] = $value; |
|
| 87 | + public function __set($query_var, $value) { |
|
| 88 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
| 89 | + $this->args[$query_var][] = $value; |
|
| 90 | 90 | } else { |
| 91 | - $this->args[ $query_var ] = $value; |
|
| 91 | + $this->args[$query_var] = $value; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | * @access public |
| 99 | 99 | * @since 1.0 |
| 100 | 100 | */ |
| 101 | - public function __unset( $query_var ) { |
|
| 102 | - unset( $this->args[ $query_var ] ); |
|
| 101 | + public function __unset($query_var) { |
|
| 102 | + unset($this->args[$query_var]); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -111,19 +111,19 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function init() { |
| 113 | 113 | |
| 114 | - add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) ); |
|
| 115 | - add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) ); |
|
| 116 | - |
|
| 117 | - add_action( 'give_pre_get_payments', array( $this, 'orderby' ) ); |
|
| 118 | - add_action( 'give_pre_get_payments', array( $this, 'status' ) ); |
|
| 119 | - add_action( 'give_pre_get_payments', array( $this, 'month' ) ); |
|
| 120 | - add_action( 'give_pre_get_payments', array( $this, 'per_page' ) ); |
|
| 121 | - add_action( 'give_pre_get_payments', array( $this, 'page' ) ); |
|
| 122 | - add_action( 'give_pre_get_payments', array( $this, 'user' ) ); |
|
| 123 | - add_action( 'give_pre_get_payments', array( $this, 'search' ) ); |
|
| 124 | - add_action( 'give_pre_get_payments', array( $this, 'mode' ) ); |
|
| 125 | - add_action( 'give_pre_get_payments', array( $this, 'children' ) ); |
|
| 126 | - add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) ); |
|
| 114 | + add_action('give_pre_get_payments', array($this, 'date_filter_pre')); |
|
| 115 | + add_action('give_post_get_payments', array($this, 'date_filter_post')); |
|
| 116 | + |
|
| 117 | + add_action('give_pre_get_payments', array($this, 'orderby')); |
|
| 118 | + add_action('give_pre_get_payments', array($this, 'status')); |
|
| 119 | + add_action('give_pre_get_payments', array($this, 'month')); |
|
| 120 | + add_action('give_pre_get_payments', array($this, 'per_page')); |
|
| 121 | + add_action('give_pre_get_payments', array($this, 'page')); |
|
| 122 | + add_action('give_pre_get_payments', array($this, 'user')); |
|
| 123 | + add_action('give_pre_get_payments', array($this, 'search')); |
|
| 124 | + add_action('give_pre_get_payments', array($this, 'mode')); |
|
| 125 | + add_action('give_pre_get_payments', array($this, 'children')); |
|
| 126 | + add_action('give_pre_get_payments', array($this, 'give_forms')); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -139,16 +139,16 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function get_payments() { |
| 141 | 141 | |
| 142 | - do_action( 'give_pre_get_payments', $this ); |
|
| 142 | + do_action('give_pre_get_payments', $this); |
|
| 143 | 143 | |
| 144 | - $query = new WP_Query( $this->args ); |
|
| 144 | + $query = new WP_Query($this->args); |
|
| 145 | 145 | |
| 146 | - if ( 'payments' != $this->args['output'] ) { |
|
| 146 | + if ('payments' != $this->args['output']) { |
|
| 147 | 147 | return $query->posts; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( $query->have_posts() ) { |
|
| 151 | - while ( $query->have_posts() ) { |
|
| 150 | + if ($query->have_posts()) { |
|
| 151 | + while ($query->have_posts()) { |
|
| 152 | 152 | $query->the_post(); |
| 153 | 153 | |
| 154 | 154 | $details = new stdClass; |
@@ -158,23 +158,23 @@ discard block |
||
| 158 | 158 | $details->ID = $payment_id; |
| 159 | 159 | $details->date = get_post()->post_date; |
| 160 | 160 | $details->post_status = get_post()->post_status; |
| 161 | - $details->total = give_get_payment_amount( $payment_id ); |
|
| 162 | - $details->fees = give_get_payment_fees( $payment_id ); |
|
| 163 | - $details->key = give_get_payment_key( $payment_id ); |
|
| 164 | - $details->gateway = give_get_payment_gateway( $payment_id ); |
|
| 165 | - $details->user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 166 | - |
|
| 167 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 168 | - $details->payment_number = give_get_payment_number( $payment_id ); |
|
| 161 | + $details->total = give_get_payment_amount($payment_id); |
|
| 162 | + $details->fees = give_get_payment_fees($payment_id); |
|
| 163 | + $details->key = give_get_payment_key($payment_id); |
|
| 164 | + $details->gateway = give_get_payment_gateway($payment_id); |
|
| 165 | + $details->user_info = give_get_payment_meta_user_info($payment_id); |
|
| 166 | + |
|
| 167 | + if (give_get_option('enable_sequential')) { |
|
| 168 | + $details->payment_number = give_get_payment_number($payment_id); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $this->payments[] = apply_filters( 'give_payment', $details, $payment_id, $this ); |
|
| 171 | + $this->payments[] = apply_filters('give_payment', $details, $payment_id, $this); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | wp_reset_postdata(); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - do_action( 'give_post_get_payments', $this ); |
|
| 177 | + do_action('give_post_get_payments', $this); |
|
| 178 | 178 | |
| 179 | 179 | return $this->payments; |
| 180 | 180 | } |
@@ -187,13 +187,13 @@ discard block |
||
| 187 | 187 | * @return void |
| 188 | 188 | */ |
| 189 | 189 | public function date_filter_pre() { |
| 190 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
| 190 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
| 191 | 191 | return; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
| 194 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
| 195 | 195 | |
| 196 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
| 196 | + add_filter('posts_where', array($this, 'payments_where')); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | * @return void |
| 206 | 206 | */ |
| 207 | 207 | public function date_filter_post() { |
| 208 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
| 208 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
| 209 | 209 | return; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
| 212 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | * @return void |
| 221 | 221 | */ |
| 222 | 222 | public function status() { |
| 223 | - if ( ! isset ( $this->args['status'] ) ) { |
|
| 223 | + if ( ! isset ($this->args['status'])) { |
|
| 224 | 224 | return; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $this->__set( 'post_status', $this->args['status'] ); |
|
| 228 | - $this->__unset( 'status' ); |
|
| 227 | + $this->__set('post_status', $this->args['status']); |
|
| 228 | + $this->__unset('status'); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | * @return void |
| 237 | 237 | */ |
| 238 | 238 | public function page() { |
| 239 | - if ( ! isset ( $this->args['page'] ) ) { |
|
| 239 | + if ( ! isset ($this->args['page'])) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $this->__set( 'paged', $this->args['page'] ); |
|
| 244 | - $this->__unset( 'page' ); |
|
| 243 | + $this->__set('paged', $this->args['page']); |
|
| 244 | + $this->__unset('page'); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -253,17 +253,17 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function per_page() { |
| 255 | 255 | |
| 256 | - if ( ! isset( $this->args['number'] ) ) { |
|
| 256 | + if ( ! isset($this->args['number'])) { |
|
| 257 | 257 | return; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if ( $this->args['number'] == - 1 ) { |
|
| 261 | - $this->__set( 'nopaging', true ); |
|
| 260 | + if ($this->args['number'] == - 1) { |
|
| 261 | + $this->__set('nopaging', true); |
|
| 262 | 262 | } else { |
| 263 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
| 263 | + $this->__set('posts_per_page', $this->args['number']); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - $this->__unset( 'number' ); |
|
| 266 | + $this->__unset('number'); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | * @return void |
| 275 | 275 | */ |
| 276 | 276 | public function month() { |
| 277 | - if ( ! isset ( $this->args['month'] ) ) { |
|
| 277 | + if ( ! isset ($this->args['month'])) { |
|
| 278 | 278 | return; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
| 282 | - $this->__unset( 'month' ); |
|
| 281 | + $this->__set('monthnum', $this->args['month']); |
|
| 282 | + $this->__unset('month'); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | * @return void |
| 291 | 291 | */ |
| 292 | 292 | public function orderby() { |
| 293 | - switch ( $this->args['orderby'] ) { |
|
| 293 | + switch ($this->args['orderby']) { |
|
| 294 | 294 | case 'amount' : |
| 295 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
| 296 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
| 295 | + $this->__set('orderby', 'meta_value_num'); |
|
| 296 | + $this->__set('meta_key', '_give_payment_total'); |
|
| 297 | 297 | break; |
| 298 | 298 | default : |
| 299 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
| 299 | + $this->__set('orderby', $this->args['orderby']); |
|
| 300 | 300 | break; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -309,20 +309,20 @@ discard block |
||
| 309 | 309 | * @return void |
| 310 | 310 | */ |
| 311 | 311 | public function user() { |
| 312 | - if ( is_null( $this->args['user'] ) ) { |
|
| 312 | + if (is_null($this->args['user'])) { |
|
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - if ( is_numeric( $this->args['user'] ) ) { |
|
| 316 | + if (is_numeric($this->args['user'])) { |
|
| 317 | 317 | $user_key = '_give_payment_user_id'; |
| 318 | 318 | } else { |
| 319 | 319 | $user_key = '_give_payment_user_email'; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - $this->__set( 'meta_query', array( |
|
| 322 | + $this->__set('meta_query', array( |
|
| 323 | 323 | 'key' => $user_key, |
| 324 | 324 | 'value' => $this->args['user'] |
| 325 | - ) ); |
|
| 325 | + )); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
@@ -334,33 +334,33 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function search() { |
| 336 | 336 | |
| 337 | - if ( ! isset( $this->args['s'] ) ) { |
|
| 337 | + if ( ! isset($this->args['s'])) { |
|
| 338 | 338 | return; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - $search = trim( $this->args['s'] ); |
|
| 341 | + $search = trim($this->args['s']); |
|
| 342 | 342 | |
| 343 | - if ( empty( $search ) ) { |
|
| 343 | + if (empty($search)) { |
|
| 344 | 344 | return; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
| 348 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
| 347 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
| 348 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
| 349 | 349 | |
| 350 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
| 350 | + if ( ! empty($this->args['search_in_notes'])) { |
|
| 351 | 351 | |
| 352 | - $notes = give_get_payment_notes( 0, $search ); |
|
| 352 | + $notes = give_get_payment_notes(0, $search); |
|
| 353 | 353 | |
| 354 | - if ( ! empty( $notes ) ) { |
|
| 354 | + if ( ! empty($notes)) { |
|
| 355 | 355 | |
| 356 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
| 356 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
| 357 | 357 | |
| 358 | - $this->__set( 'post__in', $payment_ids ); |
|
| 358 | + $this->__set('post__in', $payment_ids); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $this->__unset( 's' ); |
|
| 361 | + $this->__unset('s'); |
|
| 362 | 362 | |
| 363 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
| 363 | + } elseif ($is_email || strlen($search) == 32) { |
|
| 364 | 364 | |
| 365 | 365 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
| 366 | 366 | $search_meta = array( |
@@ -369,19 +369,19 @@ discard block |
||
| 369 | 369 | 'compare' => 'LIKE' |
| 370 | 370 | ); |
| 371 | 371 | |
| 372 | - $this->__set( 'meta_query', $search_meta ); |
|
| 373 | - $this->__unset( 's' ); |
|
| 372 | + $this->__set('meta_query', $search_meta); |
|
| 373 | + $this->__unset('s'); |
|
| 374 | 374 | |
| 375 | - } elseif ( $is_user ) { |
|
| 375 | + } elseif ($is_user) { |
|
| 376 | 376 | |
| 377 | 377 | $search_meta = array( |
| 378 | 378 | 'key' => '_give_payment_user_id', |
| 379 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ) |
|
| 379 | + 'value' => trim(str_replace('user:', '', strtolower($search))) |
|
| 380 | 380 | ); |
| 381 | 381 | |
| 382 | - $this->__set( 'meta_query', $search_meta ); |
|
| 382 | + $this->__set('meta_query', $search_meta); |
|
| 383 | 383 | |
| 384 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 384 | + if (give_get_option('enable_sequential')) { |
|
| 385 | 385 | |
| 386 | 386 | $search_meta = array( |
| 387 | 387 | 'key' => '_give_payment_number', |
@@ -389,19 +389,19 @@ discard block |
||
| 389 | 389 | 'compare' => 'LIKE' |
| 390 | 390 | ); |
| 391 | 391 | |
| 392 | - $this->__set( 'meta_query', $search_meta ); |
|
| 392 | + $this->__set('meta_query', $search_meta); |
|
| 393 | 393 | |
| 394 | 394 | $this->args['meta_query']['relation'] = 'OR'; |
| 395 | 395 | |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $this->__unset( 's' ); |
|
| 398 | + $this->__unset('s'); |
|
| 399 | 399 | |
| 400 | 400 | } elseif ( |
| 401 | - give_get_option( 'enable_sequential' ) && |
|
| 401 | + give_get_option('enable_sequential') && |
|
| 402 | 402 | ( |
| 403 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
| 404 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
| 403 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
| 404 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
| 405 | 405 | ) |
| 406 | 406 | ) { |
| 407 | 407 | |
@@ -411,28 +411,28 @@ discard block |
||
| 411 | 411 | 'compare' => 'LIKE' |
| 412 | 412 | ); |
| 413 | 413 | |
| 414 | - $this->__set( 'meta_query', $search_meta ); |
|
| 415 | - $this->__unset( 's' ); |
|
| 414 | + $this->__set('meta_query', $search_meta); |
|
| 415 | + $this->__unset('s'); |
|
| 416 | 416 | |
| 417 | - } elseif ( is_numeric( $search ) ) { |
|
| 417 | + } elseif (is_numeric($search)) { |
|
| 418 | 418 | |
| 419 | - $post = get_post( $search ); |
|
| 419 | + $post = get_post($search); |
|
| 420 | 420 | |
| 421 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
| 421 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
| 422 | 422 | |
| 423 | 423 | $arr = array(); |
| 424 | 424 | $arr[] = $search; |
| 425 | - $this->__set( 'post__in', $arr ); |
|
| 426 | - $this->__unset( 's' ); |
|
| 425 | + $this->__set('post__in', $arr); |
|
| 426 | + $this->__unset('s'); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
| 429 | + } elseif ('#' == substr($search, 0, 1)) { |
|
| 430 | 430 | |
| 431 | - $this->__set( 'give_forms', str_replace( '#', '', $search ) ); |
|
| 432 | - $this->__unset( 's' ); |
|
| 431 | + $this->__set('give_forms', str_replace('#', '', $search)); |
|
| 432 | + $this->__unset('s'); |
|
| 433 | 433 | |
| 434 | 434 | } else { |
| 435 | - $this->__set( 's', $search ); |
|
| 435 | + $this->__set('s', $search); |
|
| 436 | 436 | |
| 437 | 437 | } |
| 438 | 438 | |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | * @return void |
| 447 | 447 | */ |
| 448 | 448 | public function mode() { |
| 449 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
| 450 | - $this->__unset( 'mode' ); |
|
| 449 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
| 450 | + $this->__unset('mode'); |
|
| 451 | 451 | |
| 452 | 452 | return; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - $this->__set( 'meta_query', array( |
|
| 455 | + $this->__set('meta_query', array( |
|
| 456 | 456 | 'key' => '_give_payment_mode', |
| 457 | 457 | 'value' => $this->args['mode'] |
| 458 | - ) ); |
|
| 458 | + )); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @return void |
| 467 | 467 | */ |
| 468 | 468 | public function children() { |
| 469 | - if ( empty( $this->args['children'] ) ) { |
|
| 470 | - $this->__set( 'post_parent', 0 ); |
|
| 469 | + if (empty($this->args['children'])) { |
|
| 470 | + $this->__set('post_parent', 0); |
|
| 471 | 471 | } |
| 472 | - $this->__unset( 'children' ); |
|
| 472 | + $this->__unset('children'); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | public function give_forms() { |
| 483 | 483 | |
| 484 | - if ( empty( $this->args['give_forms'] ) ) { |
|
| 484 | + if (empty($this->args['give_forms'])) { |
|
| 485 | 485 | return; |
| 486 | 486 | } |
| 487 | 487 | |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $args = array( |
| 491 | 491 | // 'post_id' => $this->args['give_forms'], |
| 492 | 492 | 'log_type' => 'sale', |
| 493 | - 'post_status' => array( 'publish' ), |
|
| 493 | + 'post_status' => array('publish'), |
|
| 494 | 494 | 'nopaging' => true, |
| 495 | 495 | 'no_found_rows' => true, |
| 496 | 496 | 'update_post_term_cache' => false, |
@@ -499,31 +499,31 @@ discard block |
||
| 499 | 499 | 'fields' => 'ids' |
| 500 | 500 | ); |
| 501 | 501 | |
| 502 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
| 503 | - unset( $args['post_parent'] ); |
|
| 502 | + if (is_array($this->args['give_forms'])) { |
|
| 503 | + unset($args['post_parent']); |
|
| 504 | 504 | $args['post_parent__in'] = $this->args['give_forms']; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - $sales = $give_logs->get_connected_logs( $args ); |
|
| 507 | + $sales = $give_logs->get_connected_logs($args); |
|
| 508 | 508 | |
| 509 | - if ( ! empty( $sales ) ) { |
|
| 509 | + if ( ! empty($sales)) { |
|
| 510 | 510 | |
| 511 | 511 | $payments = array(); |
| 512 | 512 | |
| 513 | - foreach ( $sales as $sale ) { |
|
| 514 | - $payments[] = get_post_meta( $sale, '_give_log_payment_id', true ); |
|
| 513 | + foreach ($sales as $sale) { |
|
| 514 | + $payments[] = get_post_meta($sale, '_give_log_payment_id', true); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - $this->__set( 'post__in', $payments ); |
|
| 517 | + $this->__set('post__in', $payments); |
|
| 518 | 518 | |
| 519 | 519 | } else { |
| 520 | 520 | |
| 521 | 521 | // Set post_parent to something crazy so it doesn't find anything |
| 522 | - $this->__set( 'post_parent', 999999999999999 ); |
|
| 522 | + $this->__set('post_parent', 999999999999999); |
|
| 523 | 523 | |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $this->__unset( 'give_forms' ); |
|
| 526 | + $this->__unset('give_forms'); |
|
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | } |
@@ -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,40 +23,40 @@ discard block |
||
| 23 | 23 | function give_setup_post_types() { |
| 24 | 24 | |
| 25 | 25 | /** Give Forms Post Type */ |
| 26 | - $give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false; |
|
| 26 | + $give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false; |
|
| 27 | 27 | |
| 28 | - $give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false; |
|
| 28 | + $give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false; |
|
| 29 | 29 | |
| 30 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
| 30 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
| 31 | 31 | //support for old 'GIVE_FORMS_SLUG' constant |
| 32 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
| 32 | + if (defined('GIVE_FORMS_SLUG')) { |
|
| 33 | 33 | $give_forms_slug = GIVE_FORMS_SLUG; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
| 36 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
| 37 | 37 | 'slug' => $give_forms_slug, |
| 38 | 38 | 'with_front' => false |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
| 42 | - 'name' => __( 'Donation %2$s', 'give' ), |
|
| 41 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
| 42 | + 'name' => __('Donation %2$s', 'give'), |
|
| 43 | 43 | 'singular_name' => '%1$s', |
| 44 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
| 45 | - 'add_new_item' => __( 'Add New Donation %1$s', 'give' ), |
|
| 46 | - 'edit_item' => __( 'Edit Donation %1$s', 'give' ), |
|
| 47 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
| 48 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
| 49 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
| 50 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
| 51 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
| 52 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
| 44 | + 'add_new' => __('Add %1$s', 'give'), |
|
| 45 | + 'add_new_item' => __('Add New Donation %1$s', 'give'), |
|
| 46 | + 'edit_item' => __('Edit Donation %1$s', 'give'), |
|
| 47 | + 'new_item' => __('New %1$s', 'give'), |
|
| 48 | + 'all_items' => __('All %2$s', 'give'), |
|
| 49 | + 'view_item' => __('View %1$s', 'give'), |
|
| 50 | + 'search_items' => __('Search %2$s', 'give'), |
|
| 51 | + 'not_found' => __('No %2$s found', 'give'), |
|
| 52 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
| 53 | 53 | 'parent_item_colon' => '', |
| 54 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
| 55 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ) |
|
| 56 | - ) ); |
|
| 54 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
| 55 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')) |
|
| 56 | + )); |
|
| 57 | 57 | |
| 58 | - foreach ( $give_forms_labels as $key => $value ) { |
|
| 59 | - $give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
| 58 | + foreach ($give_forms_labels as $key => $value) { |
|
| 59 | + $give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //Default give_forms supports |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | //Has the user disabled the excerpt |
| 72 | - if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) { |
|
| 73 | - unset( $give_form_supports[2] ); |
|
| 72 | + if (give_get_option('disable_forms_excerpt') === 'on') { |
|
| 73 | + unset($give_form_supports[2]); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | //Has user disabled the featured image? |
| 77 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
| 78 | - unset( $give_form_supports[1] ); |
|
| 79 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
| 77 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
| 78 | + unset($give_form_supports[1]); |
|
| 79 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $give_forms_args = array( |
@@ -92,36 +92,36 @@ discard block |
||
| 92 | 92 | 'has_archive' => $give_forms_archives, |
| 93 | 93 | 'menu_icon' => 'dashicons-give', |
| 94 | 94 | 'hierarchical' => false, |
| 95 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
| 95 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
| 96 | 96 | ); |
| 97 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
| 97 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | /** Give Campaigns Post Type */ |
| 101 | - $give_campaigns_archives = defined( 'GIVE_DISABLE_CAMPAIGNS_ARCHIVE' ) && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true; |
|
| 102 | - $give_campaigns_slug = defined( 'GIVE_CAMPAIGNS_SLUG' ) ? GIVE_CAMPAIGNS_SLUG : 'campaigns'; |
|
| 103 | - $give_campaigns_rewrite = defined( 'GIVE_DISABLE_CAMPAIGNS_REWRITE' ) && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array( |
|
| 101 | + $give_campaigns_archives = defined('GIVE_DISABLE_CAMPAIGNS_ARCHIVE') && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true; |
|
| 102 | + $give_campaigns_slug = defined('GIVE_CAMPAIGNS_SLUG') ? GIVE_CAMPAIGNS_SLUG : 'campaigns'; |
|
| 103 | + $give_campaigns_rewrite = defined('GIVE_DISABLE_CAMPAIGNS_REWRITE') && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array( |
|
| 104 | 104 | 'slug' => $give_campaigns_slug, |
| 105 | 105 | 'with_front' => false |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $give_campaigns_labels = apply_filters( 'give_campaign_labels', array( |
|
| 108 | + $give_campaigns_labels = apply_filters('give_campaign_labels', array( |
|
| 109 | 109 | 'name' => '%2$s', |
| 110 | 110 | 'singular_name' => '%1$s', |
| 111 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
| 112 | - 'add_new_item' => __( 'Add New %1$s', 'give' ), |
|
| 113 | - 'edit_item' => __( 'Edit %1$s', 'give' ), |
|
| 114 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
| 115 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
| 116 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
| 117 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
| 118 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
| 119 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
| 111 | + 'add_new' => __('Add %1$s', 'give'), |
|
| 112 | + 'add_new_item' => __('Add New %1$s', 'give'), |
|
| 113 | + 'edit_item' => __('Edit %1$s', 'give'), |
|
| 114 | + 'new_item' => __('New %1$s', 'give'), |
|
| 115 | + 'all_items' => __('All %2$s', 'give'), |
|
| 116 | + 'view_item' => __('View %1$s', 'give'), |
|
| 117 | + 'search_items' => __('Search %2$s', 'give'), |
|
| 118 | + 'not_found' => __('No %2$s found', 'give'), |
|
| 119 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
| 120 | 120 | 'parent_item_colon' => '', |
| 121 | - ) ); |
|
| 121 | + )); |
|
| 122 | 122 | |
| 123 | - foreach ( $give_campaigns_labels as $key => $value ) { |
|
| 124 | - $give_campaigns_labels[ $key ] = sprintf( $value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural() ); |
|
| 123 | + foreach ($give_campaigns_labels as $key => $value) { |
|
| 124 | + $give_campaigns_labels[$key] = sprintf($value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural()); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $give_campaigns_args = array( |
@@ -136,48 +136,48 @@ discard block |
||
| 136 | 136 | 'capability_type' => 'give_campaigns', |
| 137 | 137 | 'has_archive' => $give_campaigns_archives, |
| 138 | 138 | 'hierarchical' => false, |
| 139 | - 'supports' => apply_filters( 'give_campaigns_supports', array( |
|
| 139 | + 'supports' => apply_filters('give_campaigns_supports', array( |
|
| 140 | 140 | 'title', |
| 141 | 141 | 'thumbnail', |
| 142 | 142 | 'excerpt', |
| 143 | 143 | 'revisions', |
| 144 | 144 | 'author' |
| 145 | - ) ), |
|
| 145 | + )), |
|
| 146 | 146 | ); |
| 147 | 147 | // register_post_type( 'give_campaigns', apply_filters( 'give_campaigns_post_type_args', $give_campaigns_args ) ); |
| 148 | 148 | |
| 149 | 149 | /** Payment Post Type */ |
| 150 | 150 | $payment_labels = array( |
| 151 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
| 152 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
| 153 | - 'add_new' => __( 'Add New', 'give' ), |
|
| 154 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
| 155 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
| 156 | - 'new_item' => __( 'New Donation', 'give' ), |
|
| 157 | - 'all_items' => __( 'All Donations', 'give' ), |
|
| 158 | - 'view_item' => __( 'View Donation', 'give' ), |
|
| 159 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
| 160 | - 'not_found' => __( 'No Donations found', 'give' ), |
|
| 161 | - 'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ), |
|
| 151 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
| 152 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
| 153 | + 'add_new' => __('Add New', 'give'), |
|
| 154 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
| 155 | + 'edit_item' => __('Edit Donation', 'give'), |
|
| 156 | + 'new_item' => __('New Donation', 'give'), |
|
| 157 | + 'all_items' => __('All Donations', 'give'), |
|
| 158 | + 'view_item' => __('View Donation', 'give'), |
|
| 159 | + 'search_items' => __('Search Donations', 'give'), |
|
| 160 | + 'not_found' => __('No Donations found', 'give'), |
|
| 161 | + 'not_found_in_trash' => __('No Donations found in Trash', 'give'), |
|
| 162 | 162 | 'parent_item_colon' => '', |
| 163 | - 'menu_name' => __( 'Transactions', 'give' ) |
|
| 163 | + 'menu_name' => __('Transactions', 'give') |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | 166 | $payment_args = array( |
| 167 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
| 167 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
| 168 | 168 | 'public' => false, |
| 169 | 169 | 'query_var' => false, |
| 170 | 170 | 'rewrite' => false, |
| 171 | 171 | 'map_meta_cap' => true, |
| 172 | 172 | 'capability_type' => 'give_payment', |
| 173 | - 'supports' => array( 'title' ), |
|
| 173 | + 'supports' => array('title'), |
|
| 174 | 174 | 'can_export' => true |
| 175 | 175 | ); |
| 176 | - register_post_type( 'give_payment', $payment_args ); |
|
| 176 | + register_post_type('give_payment', $payment_args); |
|
| 177 | 177 | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
| 180 | +add_action('init', 'give_setup_post_types', 1); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -190,30 +190,30 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | function give_setup_taxonomies() { |
| 192 | 192 | |
| 193 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
| 193 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
| 194 | 194 | |
| 195 | 195 | /** Categories */ |
| 196 | 196 | $category_labels = array( |
| 197 | - 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
| 198 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
| 199 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
| 200 | - 'all_items' => __( 'All Categories', 'give' ), |
|
| 201 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
| 202 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
| 203 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
| 204 | - 'update_item' => __( 'Update Category', 'give' ), |
|
| 205 | - 'add_new_item' => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ), |
|
| 206 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
| 207 | - 'menu_name' => __( 'Categories', 'give' ), |
|
| 197 | + 'name' => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
| 198 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
| 199 | + 'search_items' => __('Search Categories', 'give'), |
|
| 200 | + 'all_items' => __('All Categories', 'give'), |
|
| 201 | + 'parent_item' => __('Parent Category', 'give'), |
|
| 202 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
| 203 | + 'edit_item' => __('Edit Category', 'give'), |
|
| 204 | + 'update_item' => __('Update Category', 'give'), |
|
| 205 | + 'add_new_item' => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()), |
|
| 206 | + 'new_item_name' => __('New Category Name', 'give'), |
|
| 207 | + 'menu_name' => __('Categories', 'give'), |
|
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
| 210 | + $category_args = apply_filters('give_forms_category_args', array( |
|
| 211 | 211 | 'hierarchical' => true, |
| 212 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
| 212 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
| 213 | 213 | 'show_ui' => true, |
| 214 | 214 | 'query_var' => 'give_forms_category', |
| 215 | 215 | 'rewrite' => array( |
| 216 | - 'slug' => $slug . '/category', |
|
| 216 | + 'slug' => $slug.'/category', |
|
| 217 | 217 | 'with_front' => false, |
| 218 | 218 | 'hierarchical' => true |
| 219 | 219 | ), |
@@ -227,34 +227,34 @@ discard block |
||
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | 229 | //Does the user want categories? |
| 230 | - if ( give_get_option( 'enable_categories' ) == 'on' ) { |
|
| 231 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
| 232 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
| 230 | + if (give_get_option('enable_categories') == 'on') { |
|
| 231 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
| 232 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | /** Tags */ |
| 237 | 237 | $tag_labels = array( |
| 238 | - 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
| 239 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
| 240 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
| 241 | - 'all_items' => __( 'All Tags', 'give' ), |
|
| 242 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
| 243 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
| 244 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
| 245 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
| 246 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
| 247 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
| 248 | - 'menu_name' => __( 'Tags', 'give' ), |
|
| 249 | - 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'give' ), give_get_forms_label_singular() ), |
|
| 238 | + 'name' => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
| 239 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
| 240 | + 'search_items' => __('Search Tags', 'give'), |
|
| 241 | + 'all_items' => __('All Tags', 'give'), |
|
| 242 | + 'parent_item' => __('Parent Tag', 'give'), |
|
| 243 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
| 244 | + 'edit_item' => __('Edit Tag', 'give'), |
|
| 245 | + 'update_item' => __('Update Tag', 'give'), |
|
| 246 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
| 247 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
| 248 | + 'menu_name' => __('Tags', 'give'), |
|
| 249 | + 'choose_from_most_used' => sprintf(__('Choose from most used %s tags', 'give'), give_get_forms_label_singular()), |
|
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
| 252 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
| 253 | 253 | 'hierarchical' => false, |
| 254 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
| 254 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
| 255 | 255 | 'show_ui' => true, |
| 256 | 256 | 'query_var' => 'give_forms_tag', |
| 257 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
| 257 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
| 258 | 258 | 'capabilities' => array( |
| 259 | 259 | 'manage_terms' => 'manage_give_forms_terms', |
| 260 | 260 | 'edit_terms' => 'edit_give_forms_terms', |
@@ -265,15 +265,15 @@ discard block |
||
| 265 | 265 | ) |
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | - if ( give_get_option( 'enable_tags' ) == 'on' ) { |
|
| 269 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
| 270 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
| 268 | + if (give_get_option('enable_tags') == 'on') { |
|
| 269 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
| 270 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
| 276 | +add_action('init', 'give_setup_taxonomies', 0); |
|
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function give_get_default_form_labels() { |
| 286 | 286 | $defaults = array( |
| 287 | - 'singular' => __( 'Form', 'give' ), |
|
| 288 | - 'plural' => __( 'Forms', 'give' ) |
|
| 287 | + 'singular' => __('Form', 'give'), |
|
| 288 | + 'plural' => __('Forms', 'give') |
|
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
| 291 | + return apply_filters('give_default_form_name', $defaults); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | function give_get_default_campaign_labels() { |
| 301 | 301 | $defaults = array( |
| 302 | - 'singular' => __( 'Campaign', 'give' ), |
|
| 303 | - 'plural' => __( 'Campaigns', 'give' ) |
|
| 302 | + 'singular' => __('Campaign', 'give'), |
|
| 303 | + 'plural' => __('Campaigns', 'give') |
|
| 304 | 304 | ); |
| 305 | 305 | |
| 306 | - return apply_filters( 'give_default_campaign_name', $defaults ); |
|
| 306 | + return apply_filters('give_default_campaign_name', $defaults); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string $defaults['singular'] Singular label |
| 317 | 317 | */ |
| 318 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
| 318 | +function give_get_forms_label_singular($lowercase = false) { |
|
| 319 | 319 | $defaults = give_get_default_form_labels(); |
| 320 | 320 | |
| 321 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
| 321 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | * @since 1.0 |
| 328 | 328 | * @return string $defaults['plural'] Plural label |
| 329 | 329 | */ |
| 330 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
| 330 | +function give_get_forms_label_plural($lowercase = false) { |
|
| 331 | 331 | $defaults = give_get_default_form_labels(); |
| 332 | 332 | |
| 333 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
| 333 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -342,10 +342,10 @@ discard block |
||
| 342 | 342 | * |
| 343 | 343 | * @return string $defaults['singular'] Singular label |
| 344 | 344 | */ |
| 345 | -function give_get_campaigns_label_singular( $lowercase = false ) { |
|
| 345 | +function give_get_campaigns_label_singular($lowercase = false) { |
|
| 346 | 346 | $defaults = give_get_default_campaign_labels(); |
| 347 | 347 | |
| 348 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
| 348 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | * @since 1.0 |
| 355 | 355 | * @return string $defaults['plural'] Plural label |
| 356 | 356 | */ |
| 357 | -function give_get_campaigns_label_plural( $lowercase = false ) { |
|
| 357 | +function give_get_campaigns_label_plural($lowercase = false) { |
|
| 358 | 358 | $defaults = give_get_default_campaign_labels(); |
| 359 | 359 | |
| 360 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
| 360 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -369,26 +369,26 @@ discard block |
||
| 369 | 369 | * |
| 370 | 370 | * @return string $title New placeholder text |
| 371 | 371 | */ |
| 372 | -function give_change_default_title( $title ) { |
|
| 372 | +function give_change_default_title($title) { |
|
| 373 | 373 | // If a frontend plugin uses this filter (check extensions before changing this function) |
| 374 | - if ( ! is_admin() ) { |
|
| 374 | + if ( ! is_admin()) { |
|
| 375 | 375 | $label = give_get_forms_label_singular(); |
| 376 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
| 376 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
| 377 | 377 | |
| 378 | 378 | return $title; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | $screen = get_current_screen(); |
| 382 | 382 | |
| 383 | - if ( 'give_forms' == $screen->post_type ) { |
|
| 383 | + if ('give_forms' == $screen->post_type) { |
|
| 384 | 384 | $label = give_get_forms_label_singular(); |
| 385 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
| 385 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | return $title; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
| 391 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | 394 | * Registers Custom Post Statuses which are used by the Payments |
@@ -398,42 +398,42 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | function give_register_post_type_statuses() { |
| 400 | 400 | // Payment Statuses |
| 401 | - register_post_status( 'refunded', array( |
|
| 402 | - 'label' => _x( 'Refunded', 'Refunded payment status', 'give' ), |
|
| 401 | + register_post_status('refunded', array( |
|
| 402 | + 'label' => _x('Refunded', 'Refunded payment status', 'give'), |
|
| 403 | 403 | 'public' => true, |
| 404 | 404 | 'exclude_from_search' => false, |
| 405 | 405 | 'show_in_admin_all_list' => true, |
| 406 | 406 | 'show_in_admin_status_list' => true, |
| 407 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ) |
|
| 408 | - ) ); |
|
| 409 | - register_post_status( 'failed', array( |
|
| 410 | - 'label' => _x( 'Failed', 'Failed payment status', 'give' ), |
|
| 407 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give') |
|
| 408 | + )); |
|
| 409 | + register_post_status('failed', array( |
|
| 410 | + 'label' => _x('Failed', 'Failed payment status', 'give'), |
|
| 411 | 411 | 'public' => true, |
| 412 | 412 | 'exclude_from_search' => false, |
| 413 | 413 | 'show_in_admin_all_list' => true, |
| 414 | 414 | 'show_in_admin_status_list' => true, |
| 415 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ) |
|
| 416 | - ) ); |
|
| 417 | - register_post_status( 'revoked', array( |
|
| 418 | - 'label' => _x( 'Revoked', 'Revoked payment status', 'give' ), |
|
| 415 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give') |
|
| 416 | + )); |
|
| 417 | + register_post_status('revoked', array( |
|
| 418 | + 'label' => _x('Revoked', 'Revoked payment status', 'give'), |
|
| 419 | 419 | 'public' => true, |
| 420 | 420 | 'exclude_from_search' => false, |
| 421 | 421 | 'show_in_admin_all_list' => true, |
| 422 | 422 | 'show_in_admin_status_list' => true, |
| 423 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ) |
|
| 424 | - ) ); |
|
| 425 | - register_post_status( 'abandoned', array( |
|
| 426 | - 'label' => _x( 'Abandoned', 'Abandoned payment status', 'give' ), |
|
| 423 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give') |
|
| 424 | + )); |
|
| 425 | + register_post_status('abandoned', array( |
|
| 426 | + 'label' => _x('Abandoned', 'Abandoned payment status', 'give'), |
|
| 427 | 427 | 'public' => true, |
| 428 | 428 | 'exclude_from_search' => false, |
| 429 | 429 | 'show_in_admin_all_list' => true, |
| 430 | 430 | 'show_in_admin_status_list' => true, |
| 431 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ) |
|
| 432 | - ) ); |
|
| 431 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give') |
|
| 432 | + )); |
|
| 433 | 433 | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
| 436 | +add_action('init', 'give_register_post_type_statuses'); |
|
| 437 | 437 | |
| 438 | 438 | /** |
| 439 | 439 | * Updated Messages |
@@ -446,45 +446,45 @@ discard block |
||
| 446 | 446 | * |
| 447 | 447 | * @return array $messages New post updated messages |
| 448 | 448 | */ |
| 449 | -function give_updated_messages( $messages ) { |
|
| 449 | +function give_updated_messages($messages) { |
|
| 450 | 450 | global $post, $post_ID; |
| 451 | 451 | |
| 452 | - $url1 = '<a href="' . get_permalink( $post_ID ) . '">'; |
|
| 452 | + $url1 = '<a href="'.get_permalink($post_ID).'">'; |
|
| 453 | 453 | $url2 = give_get_forms_label_singular(); |
| 454 | 454 | $url3 = '</a>'; |
| 455 | 455 | |
| 456 | 456 | $messages['give_forms'] = array( |
| 457 | - 1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 458 | - 4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 459 | - 6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 460 | - 7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 461 | - 8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ) |
|
| 457 | + 1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 458 | + 4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 459 | + 6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 460 | + 7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 461 | + 8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3) |
|
| 462 | 462 | ); |
| 463 | 463 | |
| 464 | 464 | return $messages; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
| 467 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
| 468 | 468 | |
| 469 | 469 | |
| 470 | 470 | /** |
| 471 | 471 | * Setup Post Type Images |
| 472 | 472 | */ |
| 473 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
| 474 | -add_action( 'after_setup_theme', 'give_add_image_sizes', 10 ); |
|
| 473 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
| 474 | +add_action('after_setup_theme', 'give_add_image_sizes', 10); |
|
| 475 | 475 | |
| 476 | 476 | /** |
| 477 | 477 | * Ensure post thumbnail support is turned on |
| 478 | 478 | */ |
| 479 | 479 | function give_add_thumbnail_support() { |
| 480 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
| 480 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
| 481 | 481 | return; |
| 482 | 482 | } |
| 483 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
| 484 | - add_theme_support( 'post-thumbnails' ); |
|
| 483 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
| 484 | + add_theme_support('post-thumbnails'); |
|
| 485 | 485 | } |
| 486 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
| 487 | - add_post_type_support( 'give_campaigns', 'thumbnail' ); |
|
| 486 | + add_post_type_support('give_forms', 'thumbnail'); |
|
| 487 | + add_post_type_support('give_campaigns', 'thumbnail'); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | /** |
@@ -493,11 +493,11 @@ discard block |
||
| 493 | 493 | * @since 1.0 |
| 494 | 494 | */ |
| 495 | 495 | function give_add_image_sizes() { |
| 496 | - $give_form_thumbnail = give_get_image_size( 'give_form_thumbnail' ); |
|
| 497 | - $give_form_single = give_get_image_size( 'give_form_single' ); |
|
| 496 | + $give_form_thumbnail = give_get_image_size('give_form_thumbnail'); |
|
| 497 | + $give_form_single = give_get_image_size('give_form_single'); |
|
| 498 | 498 | |
| 499 | - add_image_size( 'give_form_thumbnail', $give_form_thumbnail['width'], $give_form_thumbnail['height'], $give_form_thumbnail['crop'] ); |
|
| 500 | - add_image_size( 'give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop'] ); |
|
| 499 | + add_image_size('give_form_thumbnail', $give_form_thumbnail['width'], $give_form_thumbnail['height'], $give_form_thumbnail['crop']); |
|
| 500 | + add_image_size('give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop']); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -509,19 +509,19 @@ discard block |
||
| 509 | 509 | function give_widgets_init() { |
| 510 | 510 | |
| 511 | 511 | //Single Give Forms (disabled if single turned off in settings) |
| 512 | - if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) { |
|
| 512 | + if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') { |
|
| 513 | 513 | |
| 514 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
| 515 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
| 514 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
| 515 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
| 516 | 516 | 'id' => 'give-forms-sidebar', |
| 517 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
| 517 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
| 518 | 518 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
| 519 | 519 | 'after_widget' => '</div>', |
| 520 | 520 | 'before_title' => '<h3 class="widgettitle widget-title">', |
| 521 | 521 | 'after_title' => '</h3>', |
| 522 | - ) ) ); |
|
| 522 | + ))); |
|
| 523 | 523 | |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
| 528 | 527 | \ No newline at end of file |
| 528 | +add_action('widgets_init', 'give_widgets_init', 999); |
|
| 529 | 529 | \ 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 | |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return bool true if has variable prices, false otherwise |
| 25 | 25 | */ |
| 26 | -function give_has_variable_prices( $form_id = 0 ) { |
|
| 26 | +function give_has_variable_prices($form_id = 0) { |
|
| 27 | 27 | |
| 28 | - if ( empty( $form_id ) ) { |
|
| 28 | + if (empty($form_id)) { |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $form = new Give_Donate_Form( $form_id ); |
|
| 32 | + $form = new Give_Donate_Form($form_id); |
|
| 33 | 33 | |
| 34 | 34 | return $form->has_variable_prices(); |
| 35 | 35 | } |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return array Variable prices |
| 46 | 46 | */ |
| 47 | -function give_get_variable_prices( $form_id = 0 ) { |
|
| 47 | +function give_get_variable_prices($form_id = 0) { |
|
| 48 | 48 | |
| 49 | - if ( empty( $form_id ) ) { |
|
| 49 | + if (empty($form_id)) { |
|
| 50 | 50 | return false; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $form = new Give_Donate_Form( $form_id ); |
|
| 53 | + $form = new Give_Donate_Form($form_id); |
|
| 54 | 54 | |
| 55 | 55 | return $form->prices; |
| 56 | 56 | |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return string $default_price |
| 69 | 69 | */ |
| 70 | -function give_get_default_multilevel_amount( $form_id ) { |
|
| 70 | +function give_get_default_multilevel_amount($form_id) { |
|
| 71 | 71 | $default_price = '1.00'; |
| 72 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 72 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 73 | 73 | |
| 74 | - foreach ( $prices as $price ) { |
|
| 74 | + foreach ($prices as $price) { |
|
| 75 | 75 | |
| 76 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 76 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 77 | 77 | $default_price = $price['_give_amount']; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | * @return string $default_price |
| 95 | 95 | * @since 1.0 |
| 96 | 96 | */ |
| 97 | -function give_get_default_form_amount( $form_id ) { |
|
| 97 | +function give_get_default_form_amount($form_id) { |
|
| 98 | 98 | |
| 99 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 99 | + if (give_has_variable_prices($form_id)) { |
|
| 100 | 100 | |
| 101 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
| 101 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
| 102 | 102 | |
| 103 | 103 | } else { |
| 104 | 104 | |
| 105 | - $default_amount = get_post_meta( $form_id, '_give_set_price', true ); |
|
| 105 | + $default_amount = get_post_meta($form_id, '_give_set_price', true); |
|
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Price Functions |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Functions |
|
| 7 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * Price Functions |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Functions |
|
| 7 | + * @copyright Copyright (c) 2015, 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' ) ) { |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | //validate display_style and float_labels value |
| 81 | 81 | if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
| 82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
| 82 | + || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
| 83 | 83 | ) { |
| 84 | 84 | |
| 85 | 85 | $atts[ $key ] = ''; |
@@ -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,17 +24,17 @@ discard block |
||
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | 26 | function give_donation_history() { |
| 27 | - if ( is_user_logged_in() ) { |
|
| 27 | + if (is_user_logged_in()) { |
|
| 28 | 28 | ob_start(); |
| 29 | - give_get_template_part( 'history', 'donations' ); |
|
| 29 | + give_get_template_part('history', 'donations'); |
|
| 30 | 30 | |
| 31 | 31 | return ob_get_clean(); |
| 32 | 32 | } else { |
| 33 | - echo apply_filters( 'give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>' . __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ) . '</p></div>' ); |
|
| 33 | + echo apply_filters('give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>'.__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give').'</p></div>'); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
| 37 | +add_shortcode('donation_history', 'give_donation_history'); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Donation Form Shortcode |
@@ -48,53 +48,53 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | -function give_form_shortcode( $atts, $content = null ) { |
|
| 52 | - $atts = shortcode_atts( array( |
|
| 51 | +function give_form_shortcode($atts, $content = null) { |
|
| 52 | + $atts = shortcode_atts(array( |
|
| 53 | 53 | 'id' => '', |
| 54 | 54 | 'show_title' => true, |
| 55 | 55 | 'show_goal' => true, |
| 56 | 56 | 'show_content' => '', |
| 57 | 57 | 'float_labels' => '', |
| 58 | 58 | 'display_style' => '', |
| 59 | - ), $atts, 'give_form' ); |
|
| 59 | + ), $atts, 'give_form'); |
|
| 60 | 60 | |
| 61 | - foreach ( $atts as $key => $value ) { |
|
| 61 | + foreach ($atts as $key => $value) { |
|
| 62 | 62 | //convert shortcode_atts values to booleans |
| 63 | - if ( $key == 'show_title' ) { |
|
| 64 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
| 65 | - } elseif ( $key == 'show_goal' ) { |
|
| 66 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
| 63 | + if ($key == 'show_title') { |
|
| 64 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
| 65 | + } elseif ($key == 'show_goal') { |
|
| 66 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | //validate show_content value |
| 70 | - if ( $key == 'show_content' ) { |
|
| 71 | - if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) { |
|
| 72 | - $atts[ $key ] = ''; |
|
| 73 | - } else if ( $value == 'above' ) { |
|
| 74 | - $atts[ $key ] = 'give_pre_form'; |
|
| 75 | - } else if ( $value == 'below' ) { |
|
| 76 | - $atts[ $key ] = 'give_post_form'; |
|
| 70 | + if ($key == 'show_content') { |
|
| 71 | + if ( ! in_array($value, array('none', 'above', 'below'))) { |
|
| 72 | + $atts[$key] = ''; |
|
| 73 | + } else if ($value == 'above') { |
|
| 74 | + $atts[$key] = 'give_pre_form'; |
|
| 75 | + } else if ($value == 'below') { |
|
| 76 | + $atts[$key] = 'give_post_form'; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | //validate display_style and float_labels value |
| 81 | - if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
|
| 82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
| 81 | + if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal'))) |
|
| 82 | + || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled'))) |
|
| 83 | 83 | ) { |
| 84 | 84 | |
| 85 | - $atts[ $key ] = ''; |
|
| 85 | + $atts[$key] = ''; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | //get the Give Form |
| 90 | 90 | ob_start(); |
| 91 | - give_get_donation_form( $atts ); |
|
| 91 | + give_get_donation_form($atts); |
|
| 92 | 92 | $final_output = ob_get_clean(); |
| 93 | 93 | |
| 94 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
| 94 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
| 97 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Donation Form Goal Shortcode |
@@ -108,37 +108,37 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | -function give_goal_shortcode( $atts, $content = null ) { |
|
| 112 | - $atts = shortcode_atts( array( |
|
| 111 | +function give_goal_shortcode($atts, $content = null) { |
|
| 112 | + $atts = shortcode_atts(array( |
|
| 113 | 113 | 'id' => '', |
| 114 | 114 | 'show_text' => true, |
| 115 | 115 | 'show_bar' => true, |
| 116 | - ), $atts, 'give_goal' ); |
|
| 116 | + ), $atts, 'give_goal'); |
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | //get the Give Form |
| 120 | 120 | ob_start(); |
| 121 | 121 | |
| 122 | 122 | //Sanity check 1: ensure there is an ID Provided |
| 123 | - if ( empty( $atts['id'] ) ) { |
|
| 124 | - give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true ); |
|
| 123 | + if (empty($atts['id'])) { |
|
| 124 | + give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //Sanity check 2: Check that this form even has Goals enabled |
| 128 | - $goal_option = get_post_meta( $atts['id'], '_give_goal_option', true ); |
|
| 129 | - if ( empty( $goal_option ) || $goal_option !== 'yes' ) { |
|
| 130 | - give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true ); |
|
| 128 | + $goal_option = get_post_meta($atts['id'], '_give_goal_option', true); |
|
| 129 | + if (empty($goal_option) || $goal_option !== 'yes') { |
|
| 130 | + give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true); |
|
| 131 | 131 | } else { |
| 132 | 132 | //Passed all sanity checks: output Goal |
| 133 | - give_show_goal_progress( $atts['id'], $atts ); |
|
| 133 | + give_show_goal_progress($atts['id'], $atts); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $final_output = ob_get_clean(); |
| 137 | 137 | |
| 138 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
| 138 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
| 141 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | * @uses give_login_form() |
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | -function give_login_form_shortcode( $atts, $content = null ) { |
|
| 159 | - extract( shortcode_atts( array( |
|
| 158 | +function give_login_form_shortcode($atts, $content = null) { |
|
| 159 | + extract(shortcode_atts(array( |
|
| 160 | 160 | 'redirect' => '', |
| 161 | - ), $atts, 'give_login' ) |
|
| 161 | + ), $atts, 'give_login') |
|
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | - return give_login_form( $redirect ); |
|
| 164 | + return give_login_form($redirect); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
| 167 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * Register Shortcode |
@@ -179,16 +179,16 @@ discard block |
||
| 179 | 179 | * @uses give_register_form() |
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | -function give_register_form_shortcode( $atts, $content = null ) { |
|
| 183 | - extract( shortcode_atts( array( |
|
| 182 | +function give_register_form_shortcode($atts, $content = null) { |
|
| 183 | + extract(shortcode_atts(array( |
|
| 184 | 184 | 'redirect' => '', |
| 185 | - ), $atts, 'give_register' ) |
|
| 185 | + ), $atts, 'give_register') |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | - return give_register_form( $redirect ); |
|
| 188 | + return give_register_form($redirect); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
| 191 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -203,48 +203,48 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return string |
| 205 | 205 | */ |
| 206 | -function give_receipt_shortcode( $atts, $content = null ) { |
|
| 206 | +function give_receipt_shortcode($atts, $content = null) { |
|
| 207 | 207 | |
| 208 | 208 | global $give_receipt_args; |
| 209 | 209 | |
| 210 | - $give_receipt_args = shortcode_atts( array( |
|
| 211 | - 'error' => __( 'Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give' ), |
|
| 210 | + $give_receipt_args = shortcode_atts(array( |
|
| 211 | + 'error' => __('Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give'), |
|
| 212 | 212 | 'price' => true, |
| 213 | 213 | 'date' => true, |
| 214 | 214 | 'payment_key' => false, |
| 215 | 215 | 'payment_method' => true, |
| 216 | 216 | 'payment_id' => true |
| 217 | - ), $atts, 'give_receipt' ); |
|
| 217 | + ), $atts, 'give_receipt'); |
|
| 218 | 218 | |
| 219 | 219 | //set $session var |
| 220 | 220 | $session = give_get_purchase_session(); |
| 221 | 221 | |
| 222 | 222 | //set payment key var |
| 223 | - if ( isset( $_GET['payment_key'] ) ) { |
|
| 224 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
| 225 | - } elseif ( $session ) { |
|
| 223 | + if (isset($_GET['payment_key'])) { |
|
| 224 | + $payment_key = urldecode($_GET['payment_key']); |
|
| 225 | + } elseif ($session) { |
|
| 226 | 226 | $payment_key = $session['purchase_key']; |
| 227 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
| 227 | + } elseif ($give_receipt_args['payment_key']) { |
|
| 228 | 228 | $payment_key = $give_receipt_args['payment_key']; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // No key found |
| 232 | - if ( ! isset( $payment_key ) ) { |
|
| 233 | - return '<div class="give_errors"><p class="give_error">' . $give_receipt_args['error'] . '</p></div>'; |
|
| 232 | + if ( ! isset($payment_key)) { |
|
| 233 | + return '<div class="give_errors"><p class="give_error">'.$give_receipt_args['error'].'</p></div>'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
| 237 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
| 236 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
| 237 | + $user_can_view = give_can_view_receipt($payment_key); |
|
| 238 | 238 | |
| 239 | 239 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt |
| 240 | - if ( ! $user_can_view && ! empty( $payment_key ) && ! is_user_logged_in() && ! give_is_guest_payment( $payment_id ) ) { |
|
| 240 | + if ( ! $user_can_view && ! empty($payment_key) && ! is_user_logged_in() && ! give_is_guest_payment($payment_id)) { |
|
| 241 | 241 | global $give_login_redirect; |
| 242 | 242 | $give_login_redirect = give_get_current_page_url(); |
| 243 | 243 | |
| 244 | 244 | ob_start(); |
| 245 | - echo '<div class="give_errors"><p class="give_error">' . __( 'You must be logged in to view this payment receipt.', 'give' ) . '</p></div>'; |
|
| 245 | + echo '<div class="give_errors"><p class="give_error">'.__('You must be logged in to view this payment receipt.', 'give').'</p></div>'; |
|
| 246 | 246 | |
| 247 | - give_get_template_part( 'shortcode', 'login' ); |
|
| 247 | + give_get_template_part('shortcode', 'login'); |
|
| 248 | 248 | |
| 249 | 249 | $login_form = ob_get_clean(); |
| 250 | 250 | |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | |
| 265 | 265 | |
| 266 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
| 267 | - return '<p class="edd-alert edd-alert-error">' . $give_receipt_args['error'] . '</p>'; |
|
| 266 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
| 267 | + return '<p class="edd-alert edd-alert-error">'.$give_receipt_args['error'].'</p>'; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | ob_start(); |
| 271 | 271 | |
| 272 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
| 272 | + give_get_template_part('shortcode', 'receipt'); |
|
| 273 | 273 | |
| 274 | 274 | $display = ob_get_clean(); |
| 275 | 275 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
| 281 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | 284 | * Profile Editor Shortcode |
@@ -298,18 +298,18 @@ discard block |
||
| 298 | 298 | * |
| 299 | 299 | * @return string Output generated from the profile editor |
| 300 | 300 | */ |
| 301 | -function give_profile_editor_shortcode( $atts, $content = null ) { |
|
| 301 | +function give_profile_editor_shortcode($atts, $content = null) { |
|
| 302 | 302 | |
| 303 | 303 | ob_start(); |
| 304 | 304 | |
| 305 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
| 305 | + give_get_template_part('shortcode', 'profile-editor'); |
|
| 306 | 306 | |
| 307 | 307 | $display = ob_get_clean(); |
| 308 | 308 | |
| 309 | 309 | return $display; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
| 312 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | 315 | * Process Profile Updater Form |
@@ -322,30 +322,30 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return false |
| 324 | 324 | */ |
| 325 | -function give_process_profile_editor_updates( $data ) { |
|
| 325 | +function give_process_profile_editor_updates($data) { |
|
| 326 | 326 | // Profile field change request |
| 327 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
| 327 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
| 328 | 328 | return false; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | // Nonce security |
| 332 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
| 332 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
| 333 | 333 | return false; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | $user_id = get_current_user_id(); |
| 337 | - $old_user_data = get_userdata( $user_id ); |
|
| 338 | - |
|
| 339 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
| 340 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
| 341 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
| 342 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
| 343 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
| 344 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
| 345 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
| 346 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
| 347 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
| 348 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
| 337 | + $old_user_data = get_userdata($user_id); |
|
| 338 | + |
|
| 339 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
| 340 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
| 341 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
| 342 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
| 343 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
| 344 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
| 345 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
| 346 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
| 347 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
| 348 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
| 349 | 349 | |
| 350 | 350 | $userdata = array( |
| 351 | 351 | 'ID' => $user_id, |
@@ -365,45 +365,45 @@ discard block |
||
| 365 | 365 | 'country' => $country |
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
| 368 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
| 369 | 369 | |
| 370 | 370 | // New password |
| 371 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
| 372 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
| 373 | - give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
| 371 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
| 372 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
| 373 | + give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give')); |
|
| 374 | 374 | } else { |
| 375 | 375 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Make sure the new email doesn't belong to another user |
| 380 | - if ( $email != $old_user_data->user_email ) { |
|
| 381 | - if ( email_exists( $email ) ) { |
|
| 382 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
| 380 | + if ($email != $old_user_data->user_email) { |
|
| 381 | + if (email_exists($email)) { |
|
| 382 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | // Check for errors |
| 387 | 387 | $errors = give_get_errors(); |
| 388 | 388 | |
| 389 | - if ( $errors ) { |
|
| 389 | + if ($errors) { |
|
| 390 | 390 | // Send back to the profile editor if there are errors |
| 391 | - wp_redirect( $data['give_redirect'] ); |
|
| 391 | + wp_redirect($data['give_redirect']); |
|
| 392 | 392 | give_die(); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // Update the user |
| 396 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
| 397 | - $updated = wp_update_user( $userdata ); |
|
| 396 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
| 397 | + $updated = wp_update_user($userdata); |
|
| 398 | 398 | |
| 399 | - if ( $updated ) { |
|
| 400 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
| 401 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
| 399 | + if ($updated) { |
|
| 400 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
| 401 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
| 402 | 402 | give_die(); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | return false; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
| 408 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
|
| 409 | 409 | |
@@ -10,83 +10,83 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load Give file |
| 18 | -include_once( 'give.php' ); |
|
| 18 | +include_once('give.php'); |
|
| 19 | 19 | |
| 20 | 20 | global $wpdb, $wp_roles; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | -if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
| 23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
| 24 | 24 | |
| 25 | 25 | // Delete All the Custom Post Types |
| 26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type', ); |
|
| 27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
| 28 | - foreach ( $give_post_types as $post_type ) { |
|
| 26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type',); |
|
| 27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
| 28 | + foreach ($give_post_types as $post_type) { |
|
| 29 | 29 | |
| 30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
| 31 | - $items = get_posts( array( |
|
| 30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
| 31 | + $items = get_posts(array( |
|
| 32 | 32 | 'post_type' => $post_type, |
| 33 | 33 | 'post_status' => 'any', |
| 34 | - 'numberposts' => - 1, |
|
| 34 | + 'numberposts' => -1, |
|
| 35 | 35 | 'fields' => 'ids' |
| 36 | - ) ); |
|
| 36 | + )); |
|
| 37 | 37 | |
| 38 | - if ( $items ) { |
|
| 39 | - foreach ( $items as $item ) { |
|
| 40 | - wp_delete_post( $item, true ); |
|
| 38 | + if ($items) { |
|
| 39 | + foreach ($items as $item) { |
|
| 40 | + wp_delete_post($item, true); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Delete All the Terms & Taxonomies |
| 46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
| 46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
| 47 | 47 | |
| 48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
| 48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
| 49 | 49 | |
| 50 | 50 | // Delete Terms |
| 51 | - if ( $terms ) { |
|
| 52 | - foreach ( $terms as $term ) { |
|
| 53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
| 54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
| 51 | + if ($terms) { |
|
| 52 | + foreach ($terms as $term) { |
|
| 53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
| 54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Delete Taxonomies |
| 59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
| 59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Delete the Plugin Pages |
| 63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
| 64 | - foreach ( $give_created_pages as $p ) { |
|
| 65 | - $page = give_get_option( $p, false ); |
|
| 66 | - if ( $page ) { |
|
| 67 | - wp_delete_post( $page, true ); |
|
| 63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
| 64 | + foreach ($give_created_pages as $p) { |
|
| 65 | + $page = give_get_option($p, false); |
|
| 66 | + if ($page) { |
|
| 67 | + wp_delete_post($page, true); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Delete all the Plugin Options |
| 72 | - delete_option( 'give_settings' ); |
|
| 73 | - delete_option( 'give_version' ); |
|
| 72 | + delete_option('give_settings'); |
|
| 73 | + delete_option('give_version'); |
|
| 74 | 74 | |
| 75 | 75 | // Delete Capabilities |
| 76 | 76 | Give()->roles->remove_caps(); |
| 77 | 77 | |
| 78 | 78 | // Delete the Roles |
| 79 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
| 80 | - foreach ( $give_roles as $role ) { |
|
| 81 | - remove_role( $role ); |
|
| 79 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
| 80 | + foreach ($give_roles as $role) { |
|
| 81 | + remove_role($role); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Remove all database tables |
| 85 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_donors" ); |
|
| 86 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customers" ); |
|
| 85 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_donors"); |
|
| 86 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customers"); |
|
| 87 | 87 | |
| 88 | 88 | // Cleanup Cron Events |
| 89 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
| 90 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
| 91 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
| 89 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
| 90 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
| 91 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
| 92 | 92 | } |
@@ -142,8 +142,10 @@ |
||
| 142 | 142 | |
| 143 | 143 | if ( is_front_page() ) : |
| 144 | 144 | $page_url = home_url(); |
| 145 | - else : |
|
| 145 | + else { |
|
| 146 | + : |
|
| 146 | 147 | $page_url = 'http'; |
| 148 | + } |
|
| 147 | 149 | |
| 148 | 150 | if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) { |
| 149 | 151 | $page_url .= "s"; |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | * @param $field_args |
| 120 | 120 | * @param $field |
| 121 | 121 | * |
| 122 | - * @return bool |
|
| 122 | + * @return false|null |
|
| 123 | 123 | */ |
| 124 | 124 | function give_format_admin_multilevel_amount( $field_args, $field ) { |
| 125 | 125 | |
@@ -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,37 +25,37 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return string $amount Newly sanitized amount |
| 27 | 27 | */ |
| 28 | -function give_sanitize_amount( $amount ) { |
|
| 28 | +function give_sanitize_amount($amount) { |
|
| 29 | 29 | $is_negative = false; |
| 30 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
| 31 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
| 30 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
| 31 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
| 32 | 32 | |
| 33 | 33 | // Sanitize the amount |
| 34 | - if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) { |
|
| 35 | - if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 36 | - $amount = str_replace( $thousands_sep, '', $amount ); |
|
| 37 | - } elseif ( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) { |
|
| 38 | - $amount = str_replace( '.', '', $amount ); |
|
| 34 | + if ($decimal_sep == ',' && false !== ($found = strpos($amount, $decimal_sep))) { |
|
| 35 | + if (($thousands_sep == '.' || $thousands_sep == ' ') && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 36 | + $amount = str_replace($thousands_sep, '', $amount); |
|
| 37 | + } elseif (empty($thousands_sep) && false !== ($found = strpos($amount, '.'))) { |
|
| 38 | + $amount = str_replace('.', '', $amount); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $amount = str_replace( $decimal_sep, '.', $amount ); |
|
| 42 | - } elseif ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 43 | - $amount = str_replace( $thousands_sep, '', $amount ); |
|
| 41 | + $amount = str_replace($decimal_sep, '.', $amount); |
|
| 42 | + } elseif ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 43 | + $amount = str_replace($thousands_sep, '', $amount); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ( $amount < 0 ) { |
|
| 46 | + if ($amount < 0) { |
|
| 47 | 47 | $is_negative = true; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $amount = preg_replace( '/[^0-9\.]/', '', $amount ); |
|
| 51 | - $decimals = apply_filters( 'give_sanitize_amount_decimals', 2, $amount ); |
|
| 52 | - $amount = number_format( (double) $amount, $decimals, '.', '' ); |
|
| 50 | + $amount = preg_replace('/[^0-9\.]/', '', $amount); |
|
| 51 | + $decimals = apply_filters('give_sanitize_amount_decimals', 2, $amount); |
|
| 52 | + $amount = number_format((double) $amount, $decimals, '.', ''); |
|
| 53 | 53 | |
| 54 | - if ( $is_negative ) { |
|
| 54 | + if ($is_negative) { |
|
| 55 | 55 | $amount *= - 1; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - return apply_filters( 'give_sanitize_amount', $amount ); |
|
| 58 | + return apply_filters('give_sanitize_amount', $amount); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -68,47 +68,47 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return string $amount Newly formatted amount or Price Not Available |
| 70 | 70 | */ |
| 71 | -function give_format_amount( $amount, $decimals = true ) { |
|
| 71 | +function give_format_amount($amount, $decimals = true) { |
|
| 72 | 72 | |
| 73 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
| 74 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
| 73 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
| 74 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
| 75 | 75 | |
| 76 | 76 | // Format the amount |
| 77 | - if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) { |
|
| 78 | - $whole = substr( $amount, 0, $sep_found ); |
|
| 79 | - $part = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) ); |
|
| 80 | - $amount = $whole . '.' . $part; |
|
| 77 | + if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) { |
|
| 78 | + $whole = substr($amount, 0, $sep_found); |
|
| 79 | + $part = substr($amount, $sep_found + 1, (strlen($amount) - 1)); |
|
| 80 | + $amount = $whole.'.'.$part; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Strip , from the amount (if set as the thousands separator) |
| 84 | - if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 85 | - $amount = str_replace( ',', '', $amount ); |
|
| 84 | + if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 85 | + $amount = str_replace(',', '', $amount); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Strip . from the amount (if set as the thousands separator) AND , set to decimal separator |
| 89 | - if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 90 | - $amount = explode( '.', $amount ); |
|
| 91 | - $array_count = count( $amount ); |
|
| 92 | - if ( $decimals == true ) { |
|
| 93 | - unset( $amount[ $array_count - 1 ] ); |
|
| 89 | + if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 90 | + $amount = explode('.', $amount); |
|
| 91 | + $array_count = count($amount); |
|
| 92 | + if ($decimals == true) { |
|
| 93 | + unset($amount[$array_count - 1]); |
|
| 94 | 94 | } |
| 95 | - $amount = implode( '', $amount ); |
|
| 95 | + $amount = implode('', $amount); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // Strip ' ' from the amount (if set as the thousands separator) |
| 99 | - if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 100 | - $amount = str_replace( ' ', '', $amount ); |
|
| 99 | + if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 100 | + $amount = str_replace(' ', '', $amount); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if ( empty( $amount ) ) { |
|
| 103 | + if (empty($amount)) { |
|
| 104 | 104 | $amount = 0; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $decimals = apply_filters( 'give_format_amount_decimals', $decimals ? 2 : 0, $amount ); |
|
| 107 | + $decimals = apply_filters('give_format_amount_decimals', $decimals ? 2 : 0, $amount); |
|
| 108 | 108 | |
| 109 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
| 109 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
| 110 | 110 | |
| 111 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
| 111 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return bool |
| 123 | 123 | */ |
| 124 | -function give_format_admin_multilevel_amount( $field_args, $field ) { |
|
| 124 | +function give_format_admin_multilevel_amount($field_args, $field) { |
|
| 125 | 125 | |
| 126 | - if ( empty( $field->value ) ) { |
|
| 126 | + if (empty($field->value)) { |
|
| 127 | 127 | return false; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $field->value = give_format_amount( $field->value ); |
|
| 130 | + $field->value = give_format_amount($field->value); |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
@@ -141,24 +141,24 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @return mixed|string|void |
| 143 | 143 | */ |
| 144 | -function give_currency_filter( $price = '', $currency = '' ) { |
|
| 144 | +function give_currency_filter($price = '', $currency = '') { |
|
| 145 | 145 | |
| 146 | - if ( empty( $currency ) ) { |
|
| 146 | + if (empty($currency)) { |
|
| 147 | 147 | $currency = give_get_currency(); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $position = give_get_option( 'currency_position', 'before' ); |
|
| 150 | + $position = give_get_option('currency_position', 'before'); |
|
| 151 | 151 | |
| 152 | 152 | $negative = $price < 0; |
| 153 | 153 | |
| 154 | - if ( $negative ) { |
|
| 155 | - $price = substr( $price, 1 ); // Remove proceeding "-" - |
|
| 154 | + if ($negative) { |
|
| 155 | + $price = substr($price, 1); // Remove proceeding "-" - |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $symbol = give_currency_symbol( $currency ); |
|
| 158 | + $symbol = give_currency_symbol($currency); |
|
| 159 | 159 | |
| 160 | - if ( $position == 'before' ): |
|
| 161 | - switch ( $currency ): |
|
| 160 | + if ($position == 'before'): |
|
| 161 | + switch ($currency): |
|
| 162 | 162 | case 'GBP' : |
| 163 | 163 | case 'BRL' : |
| 164 | 164 | case 'EUR' : |
@@ -184,18 +184,18 @@ discard block |
||
| 184 | 184 | case 'DKK' : |
| 185 | 185 | case 'HUF' : |
| 186 | 186 | case 'ILS' : |
| 187 | - $formatted = $symbol . $price; |
|
| 187 | + $formatted = $symbol.$price; |
|
| 188 | 188 | break; |
| 189 | 189 | case 'NOK' : |
| 190 | - $formatted = $symbol . ' ' . $price; |
|
| 190 | + $formatted = $symbol.' '.$price; |
|
| 191 | 191 | break; |
| 192 | 192 | default : |
| 193 | - $formatted = $currency . ' ' . $price; |
|
| 193 | + $formatted = $currency.' '.$price; |
|
| 194 | 194 | break; |
| 195 | 195 | endswitch; |
| 196 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_before', $formatted, $currency, $price ); |
|
| 196 | + $formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_before', $formatted, $currency, $price); |
|
| 197 | 197 | else : |
| 198 | - switch ( $currency ) : |
|
| 198 | + switch ($currency) : |
|
| 199 | 199 | case 'GBP' : |
| 200 | 200 | case 'BRL' : |
| 201 | 201 | case 'EUR' : |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | case 'HUF' : |
| 221 | 221 | case 'MYR' : |
| 222 | 222 | case 'ILS' : |
| 223 | - $formatted = $price . $symbol; |
|
| 223 | + $formatted = $price.$symbol; |
|
| 224 | 224 | break; |
| 225 | 225 | default : |
| 226 | - $formatted = $price . ' ' . $currency; |
|
| 226 | + $formatted = $price.' '.$currency; |
|
| 227 | 227 | break; |
| 228 | 228 | endswitch; |
| 229 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_after', $formatted, $currency, $price ); |
|
| 229 | + $formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_after', $formatted, $currency, $price); |
|
| 230 | 230 | endif; |
| 231 | 231 | |
| 232 | - if ( $negative ) { |
|
| 232 | + if ($negative) { |
|
| 233 | 233 | // Prepend the mins sign before the currency sign |
| 234 | - $formatted = '-' . $formatted; |
|
| 234 | + $formatted = '-'.$formatted; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | return $formatted; |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | * |
| 247 | 247 | * @return int $decimals |
| 248 | 248 | */ |
| 249 | -function give_currency_decimal_filter( $decimals = 2 ) { |
|
| 249 | +function give_currency_decimal_filter($decimals = 2) { |
|
| 250 | 250 | |
| 251 | 251 | $currency = give_get_currency(); |
| 252 | 252 | |
| 253 | - switch ( $currency ) { |
|
| 253 | + switch ($currency) { |
|
| 254 | 254 | case 'RIAL' : |
| 255 | 255 | case 'JPY' : |
| 256 | 256 | case 'TWD' : |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | break; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
| 263 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 267 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 268 | 266 | \ No newline at end of file |
| 267 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 268 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
| 269 | 269 | \ No newline at end of file |