@@ -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 | |
@@ -29,33 +29,33 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return void |
31 | 31 | */ |
32 | -function give_print_errors( $form_id ) { |
|
32 | +function give_print_errors($form_id) { |
|
33 | 33 | |
34 | 34 | $errors = give_get_errors(); |
35 | 35 | |
36 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0; |
|
36 | + $request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0; |
|
37 | 37 | |
38 | 38 | //Sanity checks first: Ensure that gateway returned errors display on the appropriate form |
39 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
39 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - if ( $errors ) { |
|
44 | - $classes = apply_filters( 'give_error_class', array( |
|
43 | + if ($errors) { |
|
44 | + $classes = apply_filters('give_error_class', array( |
|
45 | 45 | 'give_errors' |
46 | - ) ); |
|
47 | - echo '<div class="' . implode( ' ', $classes ) . '">'; |
|
46 | + )); |
|
47 | + echo '<div class="'.implode(' ', $classes).'">'; |
|
48 | 48 | // Loop error codes and display errors |
49 | - foreach ( $errors as $error_id => $error ) { |
|
50 | - echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . __( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>'; |
|
49 | + foreach ($errors as $error_id => $error) { |
|
50 | + echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.__('Error', 'give').'</strong>: '.$error.'</p></div>'; |
|
51 | 51 | } |
52 | 52 | echo '</div>'; |
53 | 53 | give_clear_errors(); |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -add_action( 'give_purchase_form_before_personal_info', 'give_print_errors' ); |
|
58 | -add_action( 'give_ajax_checkout_errors', 'give_print_errors' ); |
|
57 | +add_action('give_purchase_form_before_personal_info', 'give_print_errors'); |
|
58 | +add_action('give_ajax_checkout_errors', 'give_print_errors'); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Get Errors |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return mixed array if errors are present, false if none found |
69 | 69 | */ |
70 | 70 | function give_get_errors() { |
71 | - return Give()->session->get( 'give_errors' ); |
|
71 | + return Give()->session->get('give_errors'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return void |
86 | 86 | */ |
87 | -function give_set_error( $error_id, $error_message ) { |
|
87 | +function give_set_error($error_id, $error_message) { |
|
88 | 88 | $errors = give_get_errors(); |
89 | - if ( ! $errors ) { |
|
89 | + if ( ! $errors) { |
|
90 | 90 | $errors = array(); |
91 | 91 | } |
92 | - $errors[ $error_id ] = $error_message; |
|
93 | - Give()->session->set( 'give_errors', $errors ); |
|
92 | + $errors[$error_id] = $error_message; |
|
93 | + Give()->session->set('give_errors', $errors); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return void |
102 | 102 | */ |
103 | 103 | function give_clear_errors() { |
104 | - Give()->session->set( 'give_errors', null ); |
|
104 | + Give()->session->set('give_errors', null); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string |
116 | 116 | */ |
117 | -function give_unset_error( $error_id ) { |
|
117 | +function give_unset_error($error_id) { |
|
118 | 118 | $errors = give_get_errors(); |
119 | - if ( $errors ) { |
|
120 | - unset( $errors[ $error_id ] ); |
|
121 | - Give()->session->set( 'give_errors', $errors ); |
|
119 | + if ($errors) { |
|
120 | + unset($errors[$error_id]); |
|
121 | + Give()->session->set('give_errors', $errors); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | function _give_die_handler() { |
132 | - if ( defined( 'GIVE_UNIT_TESTS' ) ) { |
|
132 | + if (defined('GIVE_UNIT_TESTS')) { |
|
133 | 133 | return '_give_die_handler'; |
134 | 134 | } else { |
135 | 135 | die(); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * @since 1.0 |
145 | 145 | * @return void |
146 | 146 | */ |
147 | -function give_die( $message = '', $title = '', $status = 400 ) { |
|
148 | - add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 ); |
|
149 | - add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 ); |
|
150 | - wp_die( $message, $title, array( 'response' => $status ) ); |
|
147 | +function give_die($message = '', $title = '', $status = 400) { |
|
148 | + add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3); |
|
149 | + add_filter('wp_die_handler', '_give_die_handler', 10, 3); |
|
150 | + wp_die($message, $title, array('response' => $status)); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return string $error |
164 | 164 | */ |
165 | -function give_output_error( $message, $echo = true, $error_id = 'warning' ) { |
|
166 | - $error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error give_' . $error_id . '">' . $message . '</p></div>'; |
|
165 | +function give_output_error($message, $echo = true, $error_id = 'warning') { |
|
166 | + $error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error give_'.$error_id.'">'.$message.'</p></div>'; |
|
167 | 167 | |
168 | - if ( $echo ) { |
|
168 | + if ($echo) { |
|
169 | 169 | echo $error; |
170 | 170 | } else { |
171 | 171 | return $error; |
@@ -65,7 +65,7 @@ |
||
65 | 65 | * |
66 | 66 | * @since 1.0 |
67 | 67 | * @uses Give_Session::get() |
68 | - * @return mixed array if errors are present, false if none found |
|
68 | + * @return string array if errors are present, false if none found |
|
69 | 69 | */ |
70 | 70 | function give_get_errors() { |
71 | 71 | return Give()->session->get( 'give_errors' ); |
@@ -97,10 +97,10 @@ |
||
97 | 97 | |
98 | 98 | //Single Form settings varies compared to the Global default settings |
99 | 99 | if ( ! empty( $form_default ) && |
100 | - $form_id !== null && |
|
101 | - $default !== $form_default && |
|
102 | - $form_default !== 'global' && |
|
103 | - give_is_gateway_active( $form_default ) |
|
100 | + $form_id !== null && |
|
101 | + $default !== $form_default && |
|
102 | + $form_default !== 'global' && |
|
103 | + give_is_gateway_active( $form_default ) |
|
104 | 104 | ) { |
105 | 105 | $default = $form_default; |
106 | 106 | } |
@@ -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 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => __( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => __( 'PayPal', 'give' ), |
|
29 | - 'supports' => array( 'buy_now' ) |
|
27 | + 'admin_label' => __('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => __('PayPal', 'give'), |
|
29 | + 'supports' => array('buy_now') |
|
30 | 30 | ), |
31 | 31 | 'manual' => array( |
32 | - 'admin_label' => __( 'Test Payment', 'give' ), |
|
33 | - 'checkout_label' => __( 'Test Payment', 'give' ) |
|
32 | + 'admin_label' => __('Test Payment', 'give'), |
|
33 | + 'checkout_label' => __('Test Payment', 'give') |
|
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
37 | + return apply_filters('give_payment_gateways', $gateways); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | |
49 | 49 | $gateways = give_get_payment_gateways(); |
50 | 50 | |
51 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
51 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
52 | 52 | |
53 | 53 | $gateway_list = array(); |
54 | 54 | |
55 | - foreach ( $gateways as $key => $gateway ) { |
|
56 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
57 | - $gateway_list[ $key ] = $gateway; |
|
55 | + foreach ($gateways as $key => $gateway) { |
|
56 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
57 | + $gateway_list[$key] = $gateway; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Set order of payment gateway in list. |
62 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
62 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
63 | 63 | |
64 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list ); |
|
64 | + return apply_filters('give_enabled_payment_gateways', $gateway_list); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return boolean true if enabled, false otherwise |
75 | 75 | */ |
76 | -function give_is_gateway_active( $gateway ) { |
|
76 | +function give_is_gateway_active($gateway) { |
|
77 | 77 | $gateways = give_get_enabled_payment_gateways(); |
78 | 78 | |
79 | - $ret = array_key_exists( $gateway, $gateways ); |
|
79 | + $ret = array_key_exists($gateway, $gateways); |
|
80 | 80 | |
81 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
81 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -91,24 +91,24 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return string Gateway ID |
93 | 93 | */ |
94 | -function give_get_default_gateway( $form_id ) { |
|
94 | +function give_get_default_gateway($form_id) { |
|
95 | 95 | |
96 | 96 | global $give_options; |
97 | 97 | |
98 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | - $form_default = get_post_meta( $form_id, '_give_default_gateway', true ); |
|
98 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | + $form_default = get_post_meta($form_id, '_give_default_gateway', true); |
|
100 | 100 | |
101 | 101 | //Single Form settings varies compared to the Global default settings |
102 | - if ( ! empty( $form_default ) && |
|
102 | + if ( ! empty($form_default) && |
|
103 | 103 | $form_id !== null && |
104 | 104 | $default !== $form_default && |
105 | 105 | $form_default !== 'global' && |
106 | - give_is_gateway_active( $form_default ) |
|
106 | + give_is_gateway_active($form_default) |
|
107 | 107 | ) { |
108 | 108 | $default = $form_default; |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_default_gateway', $default ); |
|
111 | + return apply_filters('give_default_gateway', $default); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,18 +120,18 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string Gateway admin label |
122 | 122 | */ |
123 | -function give_get_gateway_admin_label( $gateway ) { |
|
123 | +function give_get_gateway_admin_label($gateway) { |
|
124 | 124 | $gateways = give_get_enabled_payment_gateways(); |
125 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
126 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
125 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
126 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
127 | 127 | |
128 | - if ( $gateway == 'manual' && $payment ) { |
|
129 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
130 | - $label = __( 'Test Donation', 'give' ); |
|
128 | + if ($gateway == 'manual' && $payment) { |
|
129 | + if (give_get_payment_amount($payment) == 0) { |
|
130 | + $label = __('Test Donation', 'give'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
134 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return string Checkout label for the gateway |
145 | 145 | */ |
146 | -function give_get_gateway_checkout_label( $gateway ) { |
|
146 | +function give_get_gateway_checkout_label($gateway) { |
|
147 | 147 | $gateways = give_get_enabled_payment_gateways(); |
148 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
148 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
149 | 149 | |
150 | - if ( $gateway == 'manual' ) { |
|
151 | - $label = __( 'Test Donation', 'give' ); |
|
150 | + if ($gateway == 'manual') { |
|
151 | + $label = __('Test Donation', 'give'); |
|
152 | 152 | } |
153 | 153 | |
154 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
154 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array Options the gateway supports |
165 | 165 | */ |
166 | -function give_get_gateway_supports( $gateway ) { |
|
166 | +function give_get_gateway_supports($gateway) { |
|
167 | 167 | $gateways = give_get_enabled_payment_gateways(); |
168 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
168 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
169 | 169 | |
170 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
170 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return bool |
181 | 181 | */ |
182 | -function give_gateway_supports_buy_now( $gateway ) { |
|
183 | - $supports = give_get_gateway_supports( $gateway ); |
|
184 | - $ret = in_array( 'buy_now', $supports ); |
|
182 | +function give_gateway_supports_buy_now($gateway) { |
|
183 | + $supports = give_get_gateway_supports($gateway); |
|
184 | + $ret = in_array('buy_now', $supports); |
|
185 | 185 | |
186 | - return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway ); |
|
186 | + return apply_filters('give_gateway_supports_buy_now', $ret, $gateway); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | $gateways = give_get_enabled_payment_gateways(); |
197 | 197 | $ret = false; |
198 | 198 | |
199 | - if ( $gateways ) { |
|
200 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
201 | - if ( give_gateway_supports_buy_now( $gateway_id ) ) { |
|
199 | + if ($gateways) { |
|
200 | + foreach ($gateways as $gateway_id => $gateway) { |
|
201 | + if (give_gateway_supports_buy_now($gateway_id)) { |
|
202 | 202 | $ret = true; |
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - return apply_filters( 'give_give_supports_buy_now', $ret ); |
|
208 | + return apply_filters('give_give_supports_buy_now', $ret); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return void |
220 | 220 | */ |
221 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
221 | +function give_send_to_gateway($gateway, $payment_data) { |
|
222 | 222 | |
223 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
223 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
224 | 224 | |
225 | 225 | // $gateway must match the ID used when registering the gateway |
226 | - do_action( 'give_gateway_' . $gateway, $payment_data ); |
|
226 | + do_action('give_gateway_'.$gateway, $payment_data); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -240,32 +240,32 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return string $enabled_gateway The slug of the gateway |
242 | 242 | */ |
243 | -function give_get_chosen_gateway( $form_id ) { |
|
243 | +function give_get_chosen_gateway($form_id) { |
|
244 | 244 | $gateways = give_get_enabled_payment_gateways(); |
245 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
246 | - if ( empty( $request_form_id ) ) { |
|
247 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
245 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
246 | + if (empty($request_form_id)) { |
|
247 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
248 | 248 | } |
249 | - $chosen = give_get_default_gateway( $form_id ); |
|
249 | + $chosen = give_get_default_gateway($form_id); |
|
250 | 250 | $enabled_gateway = ''; |
251 | 251 | |
252 | 252 | //Take into account request Form ID args |
253 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
253 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
254 | 254 | $chosen = $_REQUEST['payment-mode']; |
255 | 255 | } |
256 | 256 | |
257 | - if ( $chosen ) { |
|
258 | - $enabled_gateway = urldecode( $chosen ); |
|
259 | - } else if ( count( $gateways ) >= 1 && ! $chosen ) { |
|
260 | - foreach ( $gateways as $gateway_id => $gateway ): |
|
257 | + if ($chosen) { |
|
258 | + $enabled_gateway = urldecode($chosen); |
|
259 | + } else if (count($gateways) >= 1 && ! $chosen) { |
|
260 | + foreach ($gateways as $gateway_id => $gateway): |
|
261 | 261 | $enabled_gateway = $gateway_id; |
262 | 262 | endforeach; |
263 | 263 | } else { |
264 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
264 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
268 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
268 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return int ID of the new log entry |
284 | 284 | */ |
285 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
286 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
285 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
286 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return int |
298 | 298 | */ |
299 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
299 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
300 | 300 | |
301 | 301 | $ret = 0; |
302 | 302 | $args = array( |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | 'fields' => 'ids' |
309 | 309 | ); |
310 | 310 | |
311 | - $payments = new WP_Query( $args ); |
|
311 | + $payments = new WP_Query($args); |
|
312 | 312 | |
313 | - if ( $payments ) { |
|
313 | + if ($payments) { |
|
314 | 314 | $ret = $payments->post_count; |
315 | 315 | } |
316 | 316 | |
@@ -327,27 +327,27 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return array $gateways All the available gateways |
329 | 329 | */ |
330 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
330 | +function give_get_ordered_payment_gateways($gateways) { |
|
331 | 331 | |
332 | 332 | // Get gateways setting. |
333 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
333 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
334 | 334 | |
335 | 335 | // Return from here if we do not have gateways setting. |
336 | - if ( empty( $gateways_setting ) ) { |
|
336 | + if (empty($gateways_setting)) { |
|
337 | 337 | return $gateways; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Reverse array to order payment gateways. |
341 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
341 | + $gateways_setting = array_reverse($gateways_setting); |
|
342 | 342 | |
343 | 343 | // Reorder gateways array |
344 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
344 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
345 | 345 | |
346 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
347 | - unset( $gateways[ $gateway_key ] ); |
|
346 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
347 | + unset($gateways[$gateway_key]); |
|
348 | 348 | |
349 | - if(!empty($new_gateway_value)) { |
|
350 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
349 | + if ( ! empty($new_gateway_value)) { |
|
350 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
@@ -358,5 +358,5 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param array $gateways All the available gateways |
360 | 360 | */ |
361 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
361 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
362 | 362 | } |
@@ -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"; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @use give_get_price_thousand_separator Get thousand separator. |
164 | 164 | * |
165 | 165 | * @param string $amount formatted amount number. |
166 | - * @return float|string formatted amount number with large number names. |
|
166 | + * @return string formatted amount number with large number names. |
|
167 | 167 | */ |
168 | 168 | function give_human_format_large_amount( $amount ) { |
169 | 169 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param $field_args |
221 | 221 | * @param $field |
222 | 222 | * |
223 | - * @return bool |
|
223 | + * @return false|null |
|
224 | 224 | */ |
225 | 225 | function give_format_admin_multilevel_amount( $field_args, $field ) { |
226 | 226 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @param array $field_args |
382 | 382 | * @param object $field |
383 | 383 | * |
384 | - * @return mixed |
|
384 | + * @return string |
|
385 | 385 | */ |
386 | 386 | function give_sanitize_thousand_separator( $value, $field_args, $field ){ |
387 | 387 | return $value; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return mixed |
24 | 24 | */ |
25 | 25 | function give_get_price_decimals() { |
26 | - return apply_filters( 'give_sanitize_amount_decimals', 2 ); |
|
26 | + return apply_filters( 'give_sanitize_amount_decimals', 2 ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return mixed |
35 | 35 | */ |
36 | 36 | function give_get_price_thousand_separator() { |
37 | - return give_get_option( 'thousands_separator', ',' ); |
|
37 | + return give_get_option( 'thousands_separator', ',' ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | 47 | function give_get_price_decimal_separator() { |
48 | - return give_get_option( 'decimal_separator', '.' ); |
|
48 | + return give_get_option( 'decimal_separator', '.' ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -62,39 +62,39 @@ discard block |
||
62 | 62 | * @return string $amount Newly sanitized amount |
63 | 63 | */ |
64 | 64 | function give_sanitize_amount( $number, $trim_zeros = false ) { |
65 | - $thousand_separator = give_get_price_thousand_separator(); |
|
65 | + $thousand_separator = give_get_price_thousand_separator(); |
|
66 | 66 | |
67 | - $locale = localeconv(); |
|
68 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
67 | + $locale = localeconv(); |
|
68 | + $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
69 | 69 | |
70 | - // Remove locale from string |
|
71 | - if ( ! is_float( $number ) ) { |
|
72 | - $number = str_replace( $decimals, '.', $number ); |
|
73 | - } |
|
70 | + // Remove locale from string |
|
71 | + if ( ! is_float( $number ) ) { |
|
72 | + $number = str_replace( $decimals, '.', $number ); |
|
73 | + } |
|
74 | 74 | |
75 | - // Remove thousand amount formatting if amount has. |
|
76 | - // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
|
77 | - if( false !== strpos( $number, $thousand_separator ) ) { |
|
78 | - $number = str_replace( $thousand_separator, '', $number ); |
|
79 | - } |
|
75 | + // Remove thousand amount formatting if amount has. |
|
76 | + // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
|
77 | + if( false !== strpos( $number, $thousand_separator ) ) { |
|
78 | + $number = str_replace( $thousand_separator, '', $number ); |
|
79 | + } |
|
80 | 80 | |
81 | - // Remove non numeric entity before decimal separator. |
|
82 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
81 | + // Remove non numeric entity before decimal separator. |
|
82 | + $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
83 | 83 | |
84 | - $decimals = give_get_price_decimals(); |
|
85 | - $decimals = apply_filters( 'give_sanitize_amount_decimals', $decimals, $number ); |
|
84 | + $decimals = give_get_price_decimals(); |
|
85 | + $decimals = apply_filters( 'give_sanitize_amount_decimals', $decimals, $number ); |
|
86 | 86 | |
87 | - $number = number_format( floatval( $number ), $decimals, '.', '' ); |
|
87 | + $number = number_format( floatval( $number ), $decimals, '.', '' ); |
|
88 | 88 | |
89 | - // Reset negative amount to zero. |
|
89 | + // Reset negative amount to zero. |
|
90 | 90 | if ( 0 > $number ) { |
91 | 91 | $number = number_format( 0, 2, '.' ); |
92 | 92 | } |
93 | 93 | |
94 | - // Trim zeros. |
|
95 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
96 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
97 | - } |
|
94 | + // Trim zeros. |
|
95 | + if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
96 | + $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | return apply_filters( 'give_sanitize_amount', $number ); |
100 | 100 | } |
@@ -167,28 +167,28 @@ discard block |
||
167 | 167 | */ |
168 | 168 | function give_human_format_large_amount( $amount ) { |
169 | 169 | |
170 | - // Get thousand separator. |
|
171 | - $thousands_sep = give_get_price_thousand_separator(); |
|
170 | + // Get thousand separator. |
|
171 | + $thousands_sep = give_get_price_thousand_separator(); |
|
172 | 172 | |
173 | - // Sanitize amount. |
|
174 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
173 | + // Sanitize amount. |
|
174 | + $sanitize_amount = give_sanitize_amount( $amount ); |
|
175 | 175 | |
176 | - // Explode amount to calculate name of large numbers. |
|
176 | + // Explode amount to calculate name of large numbers. |
|
177 | 177 | $amount_array = explode( $thousands_sep, $amount ); |
178 | 178 | |
179 | - // Calculate amount parts count. |
|
180 | - $amount_count_parts = count( $amount_array ); |
|
179 | + // Calculate amount parts count. |
|
180 | + $amount_count_parts = count( $amount_array ); |
|
181 | 181 | |
182 | - // Calculate large number formatted amount. |
|
183 | - if ( 4 < $amount_count_parts ){ |
|
184 | - $sanitize_amount = sprintf( __( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
185 | - } elseif ( 3 < $amount_count_parts ){ |
|
186 | - $sanitize_amount = sprintf( __( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 )); |
|
187 | - } elseif ( 2 < $amount_count_parts ) { |
|
188 | - $sanitize_amount = sprintf( __( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) ); |
|
189 | - } |
|
182 | + // Calculate large number formatted amount. |
|
183 | + if ( 4 < $amount_count_parts ){ |
|
184 | + $sanitize_amount = sprintf( __( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
185 | + } elseif ( 3 < $amount_count_parts ){ |
|
186 | + $sanitize_amount = sprintf( __( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 )); |
|
187 | + } elseif ( 2 < $amount_count_parts ) { |
|
188 | + $sanitize_amount = sprintf( __( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) ); |
|
189 | + } |
|
190 | 190 | |
191 | - return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount ); |
|
191 | + return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | * @return string $amount Newly formatted amount or Price Not Available |
202 | 202 | */ |
203 | 203 | function give_format_decimal( $amount ){ |
204 | - $decimal_separator = give_get_price_decimal_separator(); |
|
205 | - $formatted_amount = give_sanitize_amount( $amount ); |
|
204 | + $decimal_separator = give_get_price_decimal_separator(); |
|
205 | + $formatted_amount = give_sanitize_amount( $amount ); |
|
206 | 206 | |
207 | - if( false !== strpos( $formatted_amount, '.' ) ) { |
|
208 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
209 | - } |
|
207 | + if( false !== strpos( $formatted_amount, '.' ) ) { |
|
208 | + $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
209 | + } |
|
210 | 210 | |
211 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
211 | + return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -384,5 +384,5 @@ discard block |
||
384 | 384 | * @return mixed |
385 | 385 | */ |
386 | 386 | function give_sanitize_thousand_separator( $value, $field_args, $field ){ |
387 | - return $value; |
|
387 | + return $value; |
|
388 | 388 | } |
389 | 389 | \ 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,7 +23,7 @@ discard block |
||
23 | 23 | * @return mixed |
24 | 24 | */ |
25 | 25 | function give_get_price_decimals() { |
26 | - return apply_filters( 'give_sanitize_amount_decimals', 2 ); |
|
26 | + return apply_filters('give_sanitize_amount_decimals', 2); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return mixed |
35 | 35 | */ |
36 | 36 | function give_get_price_thousand_separator() { |
37 | - return give_get_option( 'thousands_separator', ',' ); |
|
37 | + return give_get_option('thousands_separator', ','); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | 47 | function give_get_price_decimal_separator() { |
48 | - return give_get_option( 'decimal_separator', '.' ); |
|
48 | + return give_get_option('decimal_separator', '.'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -61,42 +61,42 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string $amount Newly sanitized amount |
63 | 63 | */ |
64 | -function give_sanitize_amount( $number, $trim_zeros = false ) { |
|
64 | +function give_sanitize_amount($number, $trim_zeros = false) { |
|
65 | 65 | $thousand_separator = give_get_price_thousand_separator(); |
66 | 66 | |
67 | 67 | $locale = localeconv(); |
68 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
68 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
69 | 69 | |
70 | 70 | // Remove locale from string |
71 | - if ( ! is_float( $number ) ) { |
|
72 | - $number = str_replace( $decimals, '.', $number ); |
|
71 | + if ( ! is_float($number)) { |
|
72 | + $number = str_replace($decimals, '.', $number); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Remove thousand amount formatting if amount has. |
76 | 76 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
77 | - if( false !== strpos( $number, $thousand_separator ) ) { |
|
78 | - $number = str_replace( $thousand_separator, '', $number ); |
|
77 | + if (false !== strpos($number, $thousand_separator)) { |
|
78 | + $number = str_replace($thousand_separator, '', $number); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // Remove non numeric entity before decimal separator. |
82 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
82 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
83 | 83 | |
84 | 84 | $decimals = give_get_price_decimals(); |
85 | - $decimals = apply_filters( 'give_sanitize_amount_decimals', $decimals, $number ); |
|
85 | + $decimals = apply_filters('give_sanitize_amount_decimals', $decimals, $number); |
|
86 | 86 | |
87 | - $number = number_format( floatval( $number ), $decimals, '.', '' ); |
|
87 | + $number = number_format(floatval($number), $decimals, '.', ''); |
|
88 | 88 | |
89 | 89 | // Reset negative amount to zero. |
90 | - if ( 0 > $number ) { |
|
91 | - $number = number_format( 0, 2, '.' ); |
|
90 | + if (0 > $number) { |
|
91 | + $number = number_format(0, 2, '.'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // Trim zeros. |
95 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
96 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
95 | + if ($trim_zeros && strstr($number, '.')) { |
|
96 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
97 | 97 | } |
98 | 98 | |
99 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
99 | + return apply_filters('give_sanitize_amount', $number); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -109,47 +109,47 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string $amount Newly formatted amount or Price Not Available |
111 | 111 | */ |
112 | -function give_format_amount( $amount, $decimals = true ) { |
|
112 | +function give_format_amount($amount, $decimals = true) { |
|
113 | 113 | |
114 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
115 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
114 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
115 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
116 | 116 | |
117 | 117 | // Format the amount |
118 | - if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) { |
|
119 | - $whole = substr( $amount, 0, $sep_found ); |
|
120 | - $part = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) ); |
|
121 | - $amount = $whole . '.' . $part; |
|
118 | + if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) { |
|
119 | + $whole = substr($amount, 0, $sep_found); |
|
120 | + $part = substr($amount, $sep_found + 1, (strlen($amount) - 1)); |
|
121 | + $amount = $whole.'.'.$part; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // Strip , from the amount (if set as the thousands separator) |
125 | - if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
126 | - $amount = str_replace( ',', '', $amount ); |
|
125 | + if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
126 | + $amount = str_replace(',', '', $amount); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // Strip . from the amount (if set as the thousands separator) AND , set to decimal separator |
130 | - if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
131 | - $amount = explode( '.', $amount ); |
|
132 | - $array_count = count( $amount ); |
|
133 | - if ( $decimals == true ) { |
|
134 | - unset( $amount[ $array_count - 1 ] ); |
|
130 | + if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
131 | + $amount = explode('.', $amount); |
|
132 | + $array_count = count($amount); |
|
133 | + if ($decimals == true) { |
|
134 | + unset($amount[$array_count - 1]); |
|
135 | 135 | } |
136 | - $amount = implode( '', $amount ); |
|
136 | + $amount = implode('', $amount); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | // Strip ' ' from the amount (if set as the thousands separator) |
140 | - if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
141 | - $amount = str_replace( ' ', '', $amount ); |
|
140 | + if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
141 | + $amount = str_replace(' ', '', $amount); |
|
142 | 142 | } |
143 | 143 | |
144 | - if ( empty( $amount ) ) { |
|
144 | + if (empty($amount)) { |
|
145 | 145 | $amount = 0; |
146 | 146 | } |
147 | 147 | |
148 | 148 | $decimals = give_get_price_decimals(); |
149 | 149 | |
150 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
150 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
151 | 151 | |
152 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
152 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -165,30 +165,30 @@ discard block |
||
165 | 165 | * @param string $amount formatted amount number. |
166 | 166 | * @return float|string formatted amount number with large number names. |
167 | 167 | */ |
168 | -function give_human_format_large_amount( $amount ) { |
|
168 | +function give_human_format_large_amount($amount) { |
|
169 | 169 | |
170 | 170 | // Get thousand separator. |
171 | 171 | $thousands_sep = give_get_price_thousand_separator(); |
172 | 172 | |
173 | 173 | // Sanitize amount. |
174 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
174 | + $sanitize_amount = give_sanitize_amount($amount); |
|
175 | 175 | |
176 | 176 | // Explode amount to calculate name of large numbers. |
177 | - $amount_array = explode( $thousands_sep, $amount ); |
|
177 | + $amount_array = explode($thousands_sep, $amount); |
|
178 | 178 | |
179 | 179 | // Calculate amount parts count. |
180 | - $amount_count_parts = count( $amount_array ); |
|
180 | + $amount_count_parts = count($amount_array); |
|
181 | 181 | |
182 | 182 | // Calculate large number formatted amount. |
183 | - if ( 4 < $amount_count_parts ){ |
|
184 | - $sanitize_amount = sprintf( __( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
185 | - } elseif ( 3 < $amount_count_parts ){ |
|
186 | - $sanitize_amount = sprintf( __( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 )); |
|
187 | - } elseif ( 2 < $amount_count_parts ) { |
|
188 | - $sanitize_amount = sprintf( __( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) ); |
|
183 | + if (4 < $amount_count_parts) { |
|
184 | + $sanitize_amount = sprintf(__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2)); |
|
185 | + } elseif (3 < $amount_count_parts) { |
|
186 | + $sanitize_amount = sprintf(__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
187 | + } elseif (2 < $amount_count_parts) { |
|
188 | + $sanitize_amount = sprintf(__('%s million', 'give'), round(($sanitize_amount / 1000000), 2)); |
|
189 | 189 | } |
190 | 190 | |
191 | - return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount ); |
|
191 | + return apply_filters('give_human_format_large_amount', $sanitize_amount, $amount); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -200,15 +200,15 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string $amount Newly formatted amount or Price Not Available |
202 | 202 | */ |
203 | -function give_format_decimal( $amount ){ |
|
203 | +function give_format_decimal($amount) { |
|
204 | 204 | $decimal_separator = give_get_price_decimal_separator(); |
205 | - $formatted_amount = give_sanitize_amount( $amount ); |
|
205 | + $formatted_amount = give_sanitize_amount($amount); |
|
206 | 206 | |
207 | - if( false !== strpos( $formatted_amount, '.' ) ) { |
|
208 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
207 | + if (false !== strpos($formatted_amount, '.')) { |
|
208 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
209 | 209 | } |
210 | 210 | |
211 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
211 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return bool |
224 | 224 | */ |
225 | -function give_format_admin_multilevel_amount( $field_args, $field ) { |
|
225 | +function give_format_admin_multilevel_amount($field_args, $field) { |
|
226 | 226 | |
227 | - if ( empty( $field->value ) ) { |
|
227 | + if (empty($field->value)) { |
|
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | - $field->value = give_format_decimal( $field->value ); |
|
231 | + $field->value = give_format_decimal($field->value); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -241,24 +241,24 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return mixed|string|void |
243 | 243 | */ |
244 | -function give_currency_filter( $price = '', $currency = '' ) { |
|
244 | +function give_currency_filter($price = '', $currency = '') { |
|
245 | 245 | |
246 | - if ( empty( $currency ) ) { |
|
246 | + if (empty($currency)) { |
|
247 | 247 | $currency = give_get_currency(); |
248 | 248 | } |
249 | 249 | |
250 | - $position = give_get_option( 'currency_position', 'before' ); |
|
250 | + $position = give_get_option('currency_position', 'before'); |
|
251 | 251 | |
252 | 252 | $negative = $price < 0; |
253 | 253 | |
254 | - if ( $negative ) { |
|
255 | - $price = substr( $price, 1 ); // Remove proceeding "-" - |
|
254 | + if ($negative) { |
|
255 | + $price = substr($price, 1); // Remove proceeding "-" - |
|
256 | 256 | } |
257 | 257 | |
258 | - $symbol = give_currency_symbol( $currency ); |
|
258 | + $symbol = give_currency_symbol($currency); |
|
259 | 259 | |
260 | - if ( $position == 'before' ): |
|
261 | - switch ( $currency ): |
|
260 | + if ($position == 'before'): |
|
261 | + switch ($currency): |
|
262 | 262 | case 'GBP' : |
263 | 263 | case 'BRL' : |
264 | 264 | case 'EUR' : |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | case 'MAD' : |
288 | 288 | case 'KRW' : |
289 | 289 | case 'ZAR' : |
290 | - $formatted = $symbol . $price; |
|
290 | + $formatted = $symbol.$price; |
|
291 | 291 | break; |
292 | 292 | case 'NOK' : |
293 | - $formatted = $symbol . ' ' . $price; |
|
293 | + $formatted = $symbol.' '.$price; |
|
294 | 294 | break; |
295 | 295 | default : |
296 | - $formatted = $currency . ' ' . $price; |
|
296 | + $formatted = $currency.' '.$price; |
|
297 | 297 | break; |
298 | 298 | endswitch; |
299 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_before', $formatted, $currency, $price ); |
|
299 | + $formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_before', $formatted, $currency, $price); |
|
300 | 300 | else : |
301 | - switch ( $currency ) : |
|
301 | + switch ($currency) : |
|
302 | 302 | case 'GBP' : |
303 | 303 | case 'BRL' : |
304 | 304 | case 'EUR' : |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | case 'MAD' : |
327 | 327 | case 'KRW' : |
328 | 328 | case 'ZAR' : |
329 | - $formatted = $price . $symbol; |
|
329 | + $formatted = $price.$symbol; |
|
330 | 330 | break; |
331 | 331 | default : |
332 | - $formatted = $price . ' ' . $currency; |
|
332 | + $formatted = $price.' '.$currency; |
|
333 | 333 | break; |
334 | 334 | endswitch; |
335 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_after', $formatted, $currency, $price ); |
|
335 | + $formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_after', $formatted, $currency, $price); |
|
336 | 336 | endif; |
337 | 337 | |
338 | - if ( $negative ) { |
|
338 | + if ($negative) { |
|
339 | 339 | // Prepend the mins sign before the currency sign |
340 | - $formatted = '-' . $formatted; |
|
340 | + $formatted = '-'.$formatted; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | return $formatted; |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return int $decimals |
354 | 354 | */ |
355 | -function give_currency_decimal_filter( $decimals = 2 ) { |
|
355 | +function give_currency_decimal_filter($decimals = 2) { |
|
356 | 356 | |
357 | 357 | $currency = give_get_currency(); |
358 | 358 | |
359 | - switch ( $currency ) { |
|
359 | + switch ($currency) { |
|
360 | 360 | case 'RIAL' : |
361 | 361 | case 'JPY' : |
362 | 362 | case 'TWD' : |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | break; |
367 | 367 | } |
368 | 368 | |
369 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
369 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
370 | 370 | } |
371 | 371 | |
372 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
373 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
372 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
373 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * Sanitize thousand separator |
@@ -383,6 +383,6 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return mixed |
385 | 385 | */ |
386 | -function give_sanitize_thousand_separator( $value, $field_args, $field ){ |
|
386 | +function give_sanitize_thousand_separator($value, $field_args, $field) { |
|
387 | 387 | return $value; |
388 | 388 | } |
389 | 389 | \ No newline at end of file |
@@ -115,8 +115,8 @@ |
||
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | 117 | $value = '<a href="' . |
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
118 | + admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records |
|
68 | 68 | 'ajax' => false // Does this table support ajax? |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return void |
83 | 83 | */ |
84 | - public function search_box( $text, $input_id ) { |
|
85 | - $input_id = $input_id . '-search-input'; |
|
84 | + public function search_box($text, $input_id) { |
|
85 | + $input_id = $input_id.'-search-input'; |
|
86 | 86 | |
87 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
88 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
87 | + if ( ! empty($_REQUEST['orderby'])) { |
|
88 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
89 | 89 | } |
90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
91 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
90 | + if ( ! empty($_REQUEST['order'])) { |
|
91 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <p class="search-box"> |
95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
97 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
97 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
98 | 98 | </p> |
99 | 99 | <?php |
100 | 100 | } |
@@ -110,42 +110,42 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | - $value = '<a href="' . |
|
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
117 | + $value = '<a href="'. |
|
118 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
119 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
123 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
123 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case 'date_created' : |
127 | - $value = date_i18n( get_option( 'date_format' ), strtotime( $item['date_created'] ) ); |
|
127 | + $value = date_i18n(get_option('date_format'), strtotime($item['date_created'])); |
|
128 | 128 | break; |
129 | 129 | |
130 | 130 | default: |
131 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
131 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
132 | 132 | break; |
133 | 133 | } |
134 | 134 | |
135 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
135 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | |
139 | - public function column_name( $item ) { |
|
140 | - $name = '#' . $item['id'] . ' '; |
|
141 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
142 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
139 | + public function column_name($item) { |
|
140 | + $name = '#'.$item['id'].' '; |
|
141 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
142 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
143 | 143 | $actions = array( |
144 | - 'view' => sprintf( '<a href="%1$s">%2$s</a>', $view_url, __( 'View Donor', 'give' ) ), |
|
145 | - 'delete' => sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), __( 'Delete', 'give' ) ) |
|
144 | + 'view' => sprintf('<a href="%1$s">%2$s</a>', $view_url, __('View Donor', 'give')), |
|
145 | + 'delete' => sprintf('<a href="%1$s">%2$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), __('Delete', 'give')) |
|
146 | 146 | ); |
147 | 147 | |
148 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
148 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function get_columns() { |
159 | 159 | $columns = array( |
160 | - 'name' => __( 'Name', 'give' ), |
|
161 | - 'email' => __( 'Email', 'give' ), |
|
162 | - 'num_purchases' => __( 'Donations', 'give' ), |
|
163 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
164 | - 'date_created' => __( 'Date Created', 'give' ) |
|
160 | + 'name' => __('Name', 'give'), |
|
161 | + 'email' => __('Email', 'give'), |
|
162 | + 'num_purchases' => __('Donations', 'give'), |
|
163 | + 'amount_spent' => __('Total Donated', 'give'), |
|
164 | + 'date_created' => __('Date Created', 'give') |
|
165 | 165 | ); |
166 | 166 | |
167 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
167 | + return apply_filters('give_report_customer_columns', $columns); |
|
168 | 168 | |
169 | 169 | } |
170 | 170 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function get_sortable_columns() { |
179 | 179 | return array( |
180 | - 'date_created' => array( 'date_created', true ), |
|
181 | - 'name' => array( 'name', true ), |
|
182 | - 'num_purchases' => array( 'purchase_count', false ), |
|
183 | - 'amount_spent' => array( 'purchase_value', false ), |
|
180 | + 'date_created' => array('date_created', true), |
|
181 | + 'name' => array('name', true), |
|
182 | + 'num_purchases' => array('purchase_count', false), |
|
183 | + 'amount_spent' => array('purchase_value', false), |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @since 1.0 |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function bulk_actions( $which = '' ) { |
|
194 | + public function bulk_actions($which = '') { |
|
195 | 195 | // These aren't really bulk actions but this outputs the markup in the right place |
196 | 196 | } |
197 | 197 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return int Current page number |
204 | 204 | */ |
205 | 205 | public function get_paged() { |
206 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
206 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return mixed string If search is present, false otherwise |
215 | 215 | */ |
216 | 216 | public function get_search() { |
217 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
217 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | |
232 | 232 | $data = array(); |
233 | 233 | $paged = $this->get_paged(); |
234 | - $offset = $this->per_page * ( $paged - 1 ); |
|
234 | + $offset = $this->per_page * ($paged - 1); |
|
235 | 235 | $search = $this->get_search(); |
236 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
237 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
236 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
237 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
238 | 238 | |
239 | 239 | $args = array( |
240 | 240 | 'number' => $this->per_page, |
@@ -243,21 +243,21 @@ discard block |
||
243 | 243 | 'orderby' => $orderby |
244 | 244 | ); |
245 | 245 | |
246 | - if ( is_email( $search ) ) { |
|
246 | + if (is_email($search)) { |
|
247 | 247 | $args['email'] = $search; |
248 | - } elseif ( is_numeric( $search ) ) { |
|
248 | + } elseif (is_numeric($search)) { |
|
249 | 249 | $args['id'] = $search; |
250 | 250 | } else { |
251 | 251 | $args['name'] = $search; |
252 | 252 | } |
253 | 253 | |
254 | - $customers = Give()->customers->get_customers( $args ); |
|
254 | + $customers = Give()->customers->get_customers($args); |
|
255 | 255 | |
256 | - if ( $customers ) { |
|
256 | + if ($customers) { |
|
257 | 257 | |
258 | - foreach ( $customers as $customer ) { |
|
258 | + foreach ($customers as $customer) { |
|
259 | 259 | |
260 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
260 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
261 | 261 | |
262 | 262 | $data[] = array( |
263 | 263 | 'id' => $customer->id, |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | $hidden = array(); // No hidden columns |
292 | 292 | $sortable = $this->get_sortable_columns(); |
293 | 293 | |
294 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
294 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
295 | 295 | |
296 | 296 | $this->items = $this->reports_data(); |
297 | 297 | |
298 | 298 | $this->total = give_count_total_customers(); |
299 | 299 | |
300 | - $this->set_pagination_args( array( |
|
300 | + $this->set_pagination_args(array( |
|
301 | 301 | 'total_items' => $this->total, |
302 | 302 | 'per_page' => $this->per_page, |
303 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
304 | - ) ); |
|
303 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
304 | + )); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | \ No newline at end of file |
@@ -71,9 +71,9 @@ |
||
71 | 71 | ) ); |
72 | 72 | |
73 | 73 | add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
74 | - 'read' => true, |
|
75 | - 'edit_posts' => false, |
|
76 | - 'delete_posts' => false |
|
74 | + 'read' => true, |
|
75 | + 'edit_posts' => false, |
|
76 | + 'delete_posts' => false |
|
77 | 77 | ) ); |
78 | 78 | |
79 | 79 | add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | |
31 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
31 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | public function add_roles() { |
42 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
42 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
43 | 43 | 'read' => true, |
44 | 44 | 'edit_posts' => true, |
45 | 45 | 'delete_posts' => true, |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | 'publish_posts' => true, |
69 | 69 | 'read_private_pages' => true, |
70 | 70 | 'read_private_posts' => true |
71 | - ) ); |
|
71 | + )); |
|
72 | 72 | |
73 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
73 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
74 | 74 | 'read' => true, |
75 | 75 | 'edit_posts' => false, |
76 | 76 | 'delete_posts' => false |
77 | - ) ); |
|
77 | + )); |
|
78 | 78 | |
79 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
79 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
80 | 80 | 'read' => true, |
81 | 81 | 'edit_posts' => false, |
82 | 82 | 'upload_files' => true, |
83 | 83 | 'delete_posts' => false |
84 | - ) ); |
|
84 | + )); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -96,38 +96,38 @@ discard block |
||
96 | 96 | public function add_caps() { |
97 | 97 | global $wp_roles; |
98 | 98 | |
99 | - if ( class_exists('WP_Roles') ) { |
|
100 | - if ( ! isset( $wp_roles ) ) { |
|
99 | + if (class_exists('WP_Roles')) { |
|
100 | + if ( ! isset($wp_roles)) { |
|
101 | 101 | $wp_roles = new WP_Roles(); |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - if ( is_object( $wp_roles ) ) { |
|
106 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
107 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
108 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
109 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
105 | + if (is_object($wp_roles)) { |
|
106 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
107 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
108 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
109 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
110 | 110 | |
111 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
112 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
113 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
114 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
111 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
112 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
113 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
114 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
115 | 115 | |
116 | 116 | // Add the main post type capabilities |
117 | 117 | $capabilities = $this->get_core_caps(); |
118 | - foreach ( $capabilities as $cap_group ) { |
|
119 | - foreach ( $cap_group as $cap ) { |
|
120 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
121 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
122 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
118 | + foreach ($capabilities as $cap_group) { |
|
119 | + foreach ($cap_group as $cap) { |
|
120 | + $wp_roles->add_cap('administrator', $cap); |
|
121 | + $wp_roles->add_cap('give_manager', $cap); |
|
122 | + $wp_roles->add_cap('give_worker', $cap); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
127 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
128 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
129 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
130 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
126 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
127 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
128 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
129 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
130 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | } |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | public function get_core_caps() { |
143 | 143 | $capabilities = array(); |
144 | 144 | |
145 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
145 | + $capability_types = array('give_form', 'give_payment'); |
|
146 | 146 | |
147 | - foreach ( $capability_types as $capability_type ) { |
|
148 | - $capabilities[ $capability_type ] = array( |
|
147 | + foreach ($capability_types as $capability_type) { |
|
148 | + $capabilities[$capability_type] = array( |
|
149 | 149 | // Post type |
150 | 150 | "edit_{$capability_type}", |
151 | 151 | "read_{$capability_type}", |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | * @since 1.0 |
183 | 183 | * @return array $caps |
184 | 184 | */ |
185 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
185 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
186 | 186 | |
187 | - switch( $cap ) { |
|
187 | + switch ($cap) { |
|
188 | 188 | |
189 | 189 | case 'view_give_forms_stats' : |
190 | 190 | |
191 | - if( empty( $args[0] ) ) { |
|
191 | + if (empty($args[0])) { |
|
192 | 192 | break; |
193 | 193 | } |
194 | 194 | |
195 | - $form = get_post( $args[0] ); |
|
196 | - if ( empty( $form ) ) { |
|
195 | + $form = get_post($args[0]); |
|
196 | + if (empty($form)) { |
|
197 | 197 | break; |
198 | 198 | } |
199 | 199 | |
200 | - if( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
200 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
201 | 201 | $caps = array(); |
202 | 202 | } |
203 | 203 | |
@@ -219,41 +219,41 @@ discard block |
||
219 | 219 | |
220 | 220 | global $wp_roles; |
221 | 221 | |
222 | - if ( class_exists( 'WP_Roles' ) ) { |
|
223 | - if ( ! isset( $wp_roles ) ) { |
|
222 | + if (class_exists('WP_Roles')) { |
|
223 | + if ( ! isset($wp_roles)) { |
|
224 | 224 | $wp_roles = new WP_Roles(); |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - if ( is_object( $wp_roles ) ) { |
|
228 | + if (is_object($wp_roles)) { |
|
229 | 229 | /** Give Manager Capabilities */ |
230 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
231 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
232 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
233 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
230 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
231 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
232 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
233 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
234 | 234 | |
235 | 235 | /** Site Administrator Capabilities */ |
236 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
237 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
238 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
239 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
236 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
237 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
238 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
239 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
240 | 240 | |
241 | 241 | /** Remove the Main Post Type Capabilities */ |
242 | 242 | $capabilities = $this->get_core_caps(); |
243 | 243 | |
244 | - foreach ( $capabilities as $cap_group ) { |
|
245 | - foreach ( $cap_group as $cap ) { |
|
246 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
247 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
248 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
244 | + foreach ($capabilities as $cap_group) { |
|
245 | + foreach ($cap_group as $cap) { |
|
246 | + $wp_roles->remove_cap('give_manager', $cap); |
|
247 | + $wp_roles->remove_cap('administrator', $cap); |
|
248 | + $wp_roles->remove_cap('give_worker', $cap); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | 252 | /** Give Accountant Capabilities */ |
253 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
254 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
255 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
256 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
253 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
254 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
255 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
256 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | } |
@@ -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 |
@@ -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 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | |
67 | 67 | function give_get_currencies() { |
68 | 68 | $currencies = array( |
69 | - 'USD' => __( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => __( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => __( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => __( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => __( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => __( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => __( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => __( 'Danish Krone (kr)', 'give' ), |
|
77 | - 'HKD' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => __( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => __( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => __( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => __( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => __( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => __( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => __( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => __( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => __( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => __( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => __( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => __( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => __( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => __( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => __( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => __( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => __( 'Russian Rubles (руб)', 'give' ) |
|
69 | + 'USD' => __('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => __('Euros (€)', 'give'), |
|
71 | + 'GBP' => __('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => __('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => __('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => __('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => __('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => __('Danish Krone (kr)', 'give'), |
|
77 | + 'HKD' => __('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => __('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => __('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => __('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => __('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => __('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => __('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => __('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => __('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => __('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => __('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => __('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => __('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => __('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => __('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => __('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => __('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => __('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => __('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => __('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => __('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => __('Russian Rubles (руб)', 'give') |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string The symbol to use for the currency |
115 | 115 | */ |
116 | -function give_currency_symbol( $currency = '' ) { |
|
116 | +function give_currency_symbol($currency = '') { |
|
117 | 117 | |
118 | - if ( empty( $currency ) ) { |
|
118 | + if (empty($currency)) { |
|
119 | 119 | $currency = give_get_currency(); |
120 | 120 | } |
121 | - switch ( $currency ) : |
|
121 | + switch ($currency) : |
|
122 | 122 | case 'GBP' : |
123 | 123 | $symbol = '£'; |
124 | 124 | break; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | endswitch; |
198 | 198 | |
199 | 199 | |
200 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
200 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function give_get_current_page_url() { |
211 | 211 | |
212 | - if ( is_front_page() ) { |
|
213 | - $current_url = home_url( '/' ); |
|
212 | + if (is_front_page()) { |
|
213 | + $current_url = home_url('/'); |
|
214 | 214 | } else { |
215 | - $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) ); |
|
215 | + $current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_SERVER['REQUEST_URI'])); |
|
216 | 216 | } |
217 | 217 | |
218 | - return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) ); |
|
218 | + return apply_filters('give_get_current_page_url', esc_url($current_url)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | */ |
237 | 237 | $gateways = give_get_enabled_payment_gateways(); |
238 | 238 | |
239 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
239 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
240 | 240 | $ret = true; |
241 | - } else if ( count( $gateways ) == 1 ) { |
|
241 | + } else if (count($gateways) == 1) { |
|
242 | 242 | $ret = false; |
243 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
243 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
244 | 244 | $ret = false; |
245 | 245 | } |
246 | 246 | |
247 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
247 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -256,26 +256,26 @@ discard block |
||
256 | 256 | function give_get_timezone_id() { |
257 | 257 | |
258 | 258 | // if site timezone string exists, return it |
259 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
259 | + if ($timezone = get_option('timezone_string')) { |
|
260 | 260 | return $timezone; |
261 | 261 | } |
262 | 262 | |
263 | 263 | // get UTC offset, if it isn't set return UTC |
264 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
264 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
265 | 265 | return 'UTC'; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // attempt to guess the timezone string from the UTC offset |
269 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
269 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
270 | 270 | |
271 | 271 | // last try, guess timezone string manually |
272 | - if ( $timezone === false ) { |
|
272 | + if ($timezone === false) { |
|
273 | 273 | |
274 | - $is_dst = date( 'I' ); |
|
274 | + $is_dst = date('I'); |
|
275 | 275 | |
276 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
277 | - foreach ( $abbr as $city ) { |
|
278 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
276 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
277 | + foreach ($abbr as $city) { |
|
278 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
279 | 279 | return $city['timezone_id']; |
280 | 280 | } |
281 | 281 | } |
@@ -299,17 +299,17 @@ discard block |
||
299 | 299 | |
300 | 300 | $ip = '127.0.0.1'; |
301 | 301 | |
302 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
302 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
303 | 303 | //check ip from share internet |
304 | 304 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
305 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
305 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
306 | 306 | //to check ip is pass from proxy |
307 | 307 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
308 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
308 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
309 | 309 | $ip = $_SERVER['REMOTE_ADDR']; |
310 | 310 | } |
311 | 311 | |
312 | - return apply_filters( 'give_get_ip', $ip ); |
|
312 | + return apply_filters('give_get_ip', $ip); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @uses Give()->session->set() |
326 | 326 | */ |
327 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
328 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
329 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
327 | +function give_set_purchase_session($purchase_data = array()) { |
|
328 | + Give()->session->set('give_purchase', $purchase_data); |
|
329 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @return mixed array | false |
341 | 341 | */ |
342 | 342 | function give_get_purchase_session() { |
343 | - return Give()->session->get( 'give_purchase' ); |
|
343 | + return Give()->session->get('give_purchase'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return string |
357 | 357 | */ |
358 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
358 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
359 | 359 | $summary = ''; |
360 | 360 | |
361 | - if ( $email ) { |
|
362 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
361 | + if ($email) { |
|
362 | + $summary .= $purchase_data['user_email'].' - '; |
|
363 | 363 | } |
364 | 364 | |
365 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
365 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
366 | 366 | |
367 | 367 | return $summary; |
368 | 368 | } |
@@ -379,31 +379,31 @@ discard block |
||
379 | 379 | function give_get_host() { |
380 | 380 | $host = false; |
381 | 381 | |
382 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
382 | + if (defined('WPE_APIKEY')) { |
|
383 | 383 | $host = 'WP Engine'; |
384 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
384 | + } elseif (defined('PAGELYBIN')) { |
|
385 | 385 | $host = 'Pagely'; |
386 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
386 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
387 | 387 | $host = 'ICDSoft'; |
388 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
388 | + } elseif (DB_HOST == 'mysqlv5') { |
|
389 | 389 | $host = 'NetworkSolutions'; |
390 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
390 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
391 | 391 | $host = 'iPage'; |
392 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
392 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
393 | 393 | $host = 'IPower'; |
394 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
394 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
395 | 395 | $host = 'MediaTemple Grid'; |
396 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
396 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
397 | 397 | $host = 'pair Networks'; |
398 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
398 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
399 | 399 | $host = 'Rackspace Cloud'; |
400 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
400 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
401 | 401 | $host = 'SysFix.eu Power Hosting'; |
402 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
402 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
403 | 403 | $host = 'Flywheel'; |
404 | 404 | } else { |
405 | 405 | // Adding a general fallback for data gathering |
406 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
406 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | return $host; |
@@ -419,67 +419,67 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool true if host matches, false if not |
421 | 421 | */ |
422 | -function give_is_host( $host = false ) { |
|
422 | +function give_is_host($host = false) { |
|
423 | 423 | |
424 | 424 | $return = false; |
425 | 425 | |
426 | - if ( $host ) { |
|
427 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
426 | + if ($host) { |
|
427 | + $host = str_replace(' ', '', strtolower($host)); |
|
428 | 428 | |
429 | - switch ( $host ) { |
|
429 | + switch ($host) { |
|
430 | 430 | case 'wpengine': |
431 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
431 | + if (defined('WPE_APIKEY')) { |
|
432 | 432 | $return = true; |
433 | 433 | } |
434 | 434 | break; |
435 | 435 | case 'pagely': |
436 | - if ( defined( 'PAGELYBIN' ) ) { |
|
436 | + if (defined('PAGELYBIN')) { |
|
437 | 437 | $return = true; |
438 | 438 | } |
439 | 439 | break; |
440 | 440 | case 'icdsoft': |
441 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
441 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
442 | 442 | $return = true; |
443 | 443 | } |
444 | 444 | break; |
445 | 445 | case 'networksolutions': |
446 | - if ( DB_HOST == 'mysqlv5' ) { |
|
446 | + if (DB_HOST == 'mysqlv5') { |
|
447 | 447 | $return = true; |
448 | 448 | } |
449 | 449 | break; |
450 | 450 | case 'ipage': |
451 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
451 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
452 | 452 | $return = true; |
453 | 453 | } |
454 | 454 | break; |
455 | 455 | case 'ipower': |
456 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
456 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
457 | 457 | $return = true; |
458 | 458 | } |
459 | 459 | break; |
460 | 460 | case 'mediatemplegrid': |
461 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
461 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
462 | 462 | $return = true; |
463 | 463 | } |
464 | 464 | break; |
465 | 465 | case 'pairnetworks': |
466 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
466 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
467 | 467 | $return = true; |
468 | 468 | } |
469 | 469 | break; |
470 | 470 | case 'rackspacecloud': |
471 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
471 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
472 | 472 | $return = true; |
473 | 473 | } |
474 | 474 | break; |
475 | 475 | case 'sysfix.eu': |
476 | 476 | case 'sysfix.eupowerhosting': |
477 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
477 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
478 | 478 | $return = true; |
479 | 479 | } |
480 | 480 | break; |
481 | 481 | case 'flywheel': |
482 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
482 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
483 | 483 | $return = true; |
484 | 484 | } |
485 | 485 | break; |
@@ -512,20 +512,20 @@ discard block |
||
512 | 512 | * @param string $replacement Optional. The function that should have been called |
513 | 513 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function |
514 | 514 | */ |
515 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
516 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
515 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
516 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
517 | 517 | |
518 | - $show_errors = current_user_can( 'manage_options' ); |
|
518 | + $show_errors = current_user_can('manage_options'); |
|
519 | 519 | |
520 | 520 | // Allow plugin to filter the output error trigger |
521 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
522 | - if ( ! is_null( $replacement ) ) { |
|
523 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
524 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
521 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
522 | + if ( ! is_null($replacement)) { |
|
523 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
524 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
525 | 525 | // Alternatively we could dump this to a file. |
526 | 526 | } else { |
527 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
528 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
527 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
528 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
529 | 529 | // Alternatively we could dump this to a file. |
530 | 530 | } |
531 | 531 | } |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | * @return string $post_id |
540 | 540 | */ |
541 | 541 | function give_get_admin_post_id() { |
542 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
543 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
542 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
543 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
544 | 544 | $post_id = $_POST['post_id']; |
545 | 545 | } |
546 | 546 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @return string Arg separator output |
555 | 555 | */ |
556 | 556 | function give_get_php_arg_separator_output() { |
557 | - return ini_get( 'arg_separator.output' ); |
|
557 | + return ini_get('arg_separator.output'); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -569,10 +569,10 @@ discard block |
||
569 | 569 | * |
570 | 570 | * @return string Short month name |
571 | 571 | */ |
572 | -function give_month_num_to_name( $n ) { |
|
573 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
572 | +function give_month_num_to_name($n) { |
|
573 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
574 | 574 | |
575 | - return date_i18n( "M", $timestamp ); |
|
575 | + return date_i18n("M", $timestamp); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -585,10 +585,10 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return bool Whether or not function is disabled. |
587 | 587 | */ |
588 | -function give_is_func_disabled( $function ) { |
|
589 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
588 | +function give_is_func_disabled($function) { |
|
589 | + $disabled = explode(',', ini_get('disable_functions')); |
|
590 | 590 | |
591 | - return in_array( $function, $disabled ); |
|
591 | + return in_array($function, $disabled); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | <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> |
605 | 605 | <div class="give-newsletter-confirmation"> |
606 | - <p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
606 | + <p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
607 | 607 | </div> |
608 | 608 | |
609 | 609 | <table class="form-table give-newsletter-form"> |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | * |
700 | 700 | * @return mixed |
701 | 701 | */ |
702 | -function give_svg_icons( $icon ) { |
|
702 | +function give_svg_icons($icon) { |
|
703 | 703 | |
704 | 704 | // Store your SVGs in an associative array |
705 | 705 | $svgs = array( |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | ); |
712 | 712 | |
713 | 713 | // Return the chosen icon's SVG string |
714 | - return $svgs[ $icon ]; |
|
714 | + return $svgs[$icon]; |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -723,15 +723,15 @@ discard block |
||
723 | 723 | * |
724 | 724 | * @return mixed |
725 | 725 | */ |
726 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
727 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
726 | +function modify_nav_menu_meta_box_object($post_type) { |
|
727 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
728 | 728 | $post_type->labels->name = 'Donation Forms'; |
729 | 729 | } |
730 | 730 | |
731 | 731 | return $post_type; |
732 | 732 | } |
733 | 733 | |
734 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
734 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
735 | 735 | |
736 | 736 | |
737 | 737 | /** |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | * @license http://opensource.org/licenses/MIT MIT |
745 | 745 | */ |
746 | 746 | |
747 | -if ( ! function_exists( 'array_column' ) ) { |
|
747 | +if ( ! function_exists('array_column')) { |
|
748 | 748 | /** |
749 | 749 | * Returns the values from a single column of the input array, identified by |
750 | 750 | * the $columnKey. |
@@ -763,56 +763,56 @@ discard block |
||
763 | 763 | * |
764 | 764 | * @return array |
765 | 765 | */ |
766 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
766 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
767 | 767 | // Using func_get_args() in order to check for proper number of |
768 | 768 | // parameters and trigger errors exactly as the built-in array_column() |
769 | 769 | // does in PHP 5.5. |
770 | 770 | $argc = func_num_args(); |
771 | 771 | $params = func_get_args(); |
772 | 772 | |
773 | - if ( $argc < 2 ) { |
|
774 | - trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING ); |
|
773 | + if ($argc < 2) { |
|
774 | + trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING); |
|
775 | 775 | |
776 | 776 | return null; |
777 | 777 | } |
778 | 778 | |
779 | - if ( ! is_array( $params[0] ) ) { |
|
779 | + if ( ! is_array($params[0])) { |
|
780 | 780 | trigger_error( |
781 | - 'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given', |
|
781 | + 'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given', |
|
782 | 782 | E_USER_WARNING |
783 | 783 | ); |
784 | 784 | |
785 | 785 | return null; |
786 | 786 | } |
787 | 787 | |
788 | - if ( ! is_int( $params[1] ) |
|
789 | - && ! is_float( $params[1] ) |
|
790 | - && ! is_string( $params[1] ) |
|
788 | + if ( ! is_int($params[1]) |
|
789 | + && ! is_float($params[1]) |
|
790 | + && ! is_string($params[1]) |
|
791 | 791 | && $params[1] !== null |
792 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
792 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
793 | 793 | ) { |
794 | - trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
|
794 | + trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
|
795 | 795 | |
796 | 796 | return false; |
797 | 797 | } |
798 | 798 | |
799 | - if ( isset( $params[2] ) |
|
800 | - && ! is_int( $params[2] ) |
|
801 | - && ! is_float( $params[2] ) |
|
802 | - && ! is_string( $params[2] ) |
|
803 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
799 | + if (isset($params[2]) |
|
800 | + && ! is_int($params[2]) |
|
801 | + && ! is_float($params[2]) |
|
802 | + && ! is_string($params[2]) |
|
803 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
804 | 804 | ) { |
805 | - trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
|
805 | + trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
|
806 | 806 | |
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
810 | 810 | $paramsInput = $params[0]; |
811 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
811 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
812 | 812 | |
813 | 813 | $paramsIndexKey = null; |
814 | - if ( isset( $params[2] ) ) { |
|
815 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
814 | + if (isset($params[2])) { |
|
815 | + if (is_float($params[2]) || is_int($params[2])) { |
|
816 | 816 | $paramsIndexKey = (int) $params[2]; |
817 | 817 | } else { |
818 | 818 | $paramsIndexKey = (string) $params[2]; |
@@ -821,26 +821,26 @@ discard block |
||
821 | 821 | |
822 | 822 | $resultArray = array(); |
823 | 823 | |
824 | - foreach ( $paramsInput as $row ) { |
|
824 | + foreach ($paramsInput as $row) { |
|
825 | 825 | $key = $value = null; |
826 | 826 | $keySet = $valueSet = false; |
827 | 827 | |
828 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
828 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
829 | 829 | $keySet = true; |
830 | - $key = (string) $row[ $paramsIndexKey ]; |
|
830 | + $key = (string) $row[$paramsIndexKey]; |
|
831 | 831 | } |
832 | 832 | |
833 | - if ( $paramsColumnKey === null ) { |
|
833 | + if ($paramsColumnKey === null) { |
|
834 | 834 | $valueSet = true; |
835 | 835 | $value = $row; |
836 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
836 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
837 | 837 | $valueSet = true; |
838 | - $value = $row[ $paramsColumnKey ]; |
|
838 | + $value = $row[$paramsColumnKey]; |
|
839 | 839 | } |
840 | 840 | |
841 | - if ( $valueSet ) { |
|
842 | - if ( $keySet ) { |
|
843 | - $resultArray[ $key ] = $value; |
|
841 | + if ($valueSet) { |
|
842 | + if ($keySet) { |
|
843 | + $resultArray[$key] = $value; |
|
844 | 844 | } else { |
845 | 845 | $resultArray[] = $value; |
846 | 846 | } |
@@ -862,40 +862,40 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @return bool Whether the receipt is visible or not. |
864 | 864 | */ |
865 | -function give_can_view_receipt( $payment_key = '' ) { |
|
865 | +function give_can_view_receipt($payment_key = '') { |
|
866 | 866 | |
867 | 867 | $return = false; |
868 | 868 | |
869 | - if ( empty( $payment_key ) ) { |
|
869 | + if (empty($payment_key)) { |
|
870 | 870 | return $return; |
871 | 871 | } |
872 | 872 | |
873 | 873 | global $give_receipt_args; |
874 | 874 | |
875 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
875 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
876 | 876 | |
877 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
877 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
878 | 878 | |
879 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
879 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
880 | 880 | |
881 | - if ( is_user_logged_in() ) { |
|
882 | - if ( $user_id === (int) get_current_user_id() ) { |
|
881 | + if (is_user_logged_in()) { |
|
882 | + if ($user_id === (int) get_current_user_id()) { |
|
883 | 883 | $return = true; |
884 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
884 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
885 | 885 | $return = true; |
886 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
886 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
887 | 887 | $return = true; |
888 | 888 | } |
889 | 889 | } |
890 | 890 | |
891 | 891 | $session = give_get_purchase_session(); |
892 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
893 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
892 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
893 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
894 | 894 | $return = true; |
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
898 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
898 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
899 | 899 | |
900 | 900 | } |
901 | 901 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @description: Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
906 | 906 | */ |
907 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
907 | +if ( ! function_exists('cal_days_in_month')) { |
|
908 | 908 | /** |
909 | 909 | * cal_days_in_month |
910 | 910 | * |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * |
915 | 915 | * @return bool|string |
916 | 916 | */ |
917 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
918 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
917 | + function cal_days_in_month($calendar, $month, $year) { |
|
918 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
919 | 919 | } |
920 | 920 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @since 1.0 |
339 | 339 | * @uses Give()->session->get() |
340 | - * @return mixed array | false |
|
340 | + * @return string array | false |
|
341 | 341 | */ |
342 | 342 | function give_get_purchase_session() { |
343 | 343 | return Give()->session->get( 'give_purchase' ); |
@@ -695,9 +695,9 @@ discard block |
||
695 | 695 | /** |
696 | 696 | * Create SVG library function |
697 | 697 | * |
698 | - * @param $icon |
|
698 | + * @param string $icon |
|
699 | 699 | * |
700 | - * @return mixed |
|
700 | + * @return string |
|
701 | 701 | */ |
702 | 702 | function give_svg_icons( $icon ) { |
703 | 703 | |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * |
755 | 755 | * @param array $input A multi-dimensional array (record set) from which to pull |
756 | 756 | * a column of values. |
757 | - * @param mixed $columnKey The column of values to return. This value may be the |
|
757 | + * @param string $columnKey The column of values to return. This value may be the |
|
758 | 758 | * integer key of the column you wish to retrieve, or it |
759 | 759 | * may be the string key name for an associative array. |
760 | 760 | * @param mixed $indexKey (Optional.) The column to use as the index/keys for |
@@ -908,11 +908,11 @@ discard block |
||
908 | 908 | /** |
909 | 909 | * cal_days_in_month |
910 | 910 | * |
911 | - * @param $calendar |
|
911 | + * @param integer $calendar |
|
912 | 912 | * @param $month |
913 | 913 | * @param $year |
914 | 914 | * |
915 | - * @return bool|string |
|
915 | + * @return string |
|
916 | 916 | */ |
917 | 917 | function cal_days_in_month( $calendar, $month, $year ) { |
918 | 918 | return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
@@ -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,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h2><?php _e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php _e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php _e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h2><?php _e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php _e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php _e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h2> |
32 | 32 | |
33 | - <p><?php _e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php _e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . __( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr__( 'Complete Transactions', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donations', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donations', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int Current page number |
100 | 100 | */ |
101 | 101 | public function get_paged() { |
102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @since 1.0 |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function bulk_actions( $which = '' ) { |
|
113 | + public function bulk_actions($which = '') { |
|
114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
115 | 115 | give_report_views(); |
116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param string $which |
125 | 125 | */ |
126 | - protected function display_tablenav( $which ) { |
|
126 | + protected function display_tablenav($which) { |
|
127 | 127 | |
128 | - if ( 'top' == $which ) { |
|
129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
128 | + if ('top' == $which) { |
|
129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
130 | 130 | } |
131 | 131 | ?> |
132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
133 | 133 | |
134 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
134 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Payment Methods Report', 'give'); ?></span></h3> |
|
135 | 135 | |
136 | 136 | <div class="alignright tablenav-right"> |
137 | 137 | <div class="actions bulkactions"> |
138 | - <?php $this->bulk_actions( $which ); ?> |
|
138 | + <?php $this->bulk_actions($which); ?> |
|
139 | 139 | </div> |
140 | 140 | <?php |
141 | - $this->extra_tablenav( $which ); |
|
142 | - $this->pagination( $which ); |
|
141 | + $this->extra_tablenav($which); |
|
142 | + $this->pagination($which); |
|
143 | 143 | ?> |
144 | 144 | </div> |
145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | $gateways = give_get_payment_gateways(); |
165 | 165 | $stats = new Give_Payment_Stats(); |
166 | 166 | |
167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
168 | 168 | |
169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
171 | 171 | |
172 | 172 | $reports_data[] = array( |
173 | 173 | 'ID' => $gateway_id, |
174 | 174 | 'label' => $gateway['admin_label'], |
175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $columns = $this->get_columns(); |
198 | 198 | $hidden = array(); // No hidden columns |
199 | 199 | $sortable = $this->get_sortable_columns(); |
200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
201 | 201 | $this->items = $this->reports_data(); |
202 | 202 | |
203 | 203 | } |