@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,27 +25,27 @@ discard block |
||
25 | 25 | function give_test_ajax_works() { |
26 | 26 | |
27 | 27 | // Check if the Airplane Mode plugin is installed |
28 | - if ( class_exists( 'Airplane_Mode_Core' ) ) { |
|
28 | + if (class_exists('Airplane_Mode_Core')) { |
|
29 | 29 | |
30 | 30 | $airplane = Airplane_Mode_Core::getInstance(); |
31 | 31 | |
32 | - if ( method_exists( $airplane, 'enabled' ) ) { |
|
32 | + if (method_exists($airplane, 'enabled')) { |
|
33 | 33 | |
34 | - if ( $airplane->enabled() ) { |
|
34 | + if ($airplane->enabled()) { |
|
35 | 35 | return true; |
36 | 36 | } |
37 | 37 | |
38 | 38 | } else { |
39 | 39 | |
40 | - if ( $airplane->check_status() == 'on' ) { |
|
40 | + if ($airplane->check_status() == 'on') { |
|
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - add_filter( 'block_local_requests', '__return_false' ); |
|
46 | + add_filter('block_local_requests', '__return_false'); |
|
47 | 47 | |
48 | - if ( get_transient( '_give_ajax_works' ) ) { |
|
48 | + if (get_transient('_give_ajax_works')) { |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
@@ -57,35 +57,35 @@ discard block |
||
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | |
60 | - $ajax = wp_remote_post( give_get_ajax_url(), $params ); |
|
60 | + $ajax = wp_remote_post(give_get_ajax_url(), $params); |
|
61 | 61 | $works = true; |
62 | 62 | |
63 | - if ( is_wp_error( $ajax ) ) { |
|
63 | + if (is_wp_error($ajax)) { |
|
64 | 64 | |
65 | 65 | $works = false; |
66 | 66 | |
67 | 67 | } else { |
68 | 68 | |
69 | - if ( empty( $ajax['response'] ) ) { |
|
69 | + if (empty($ajax['response'])) { |
|
70 | 70 | $works = false; |
71 | 71 | } |
72 | 72 | |
73 | - if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) { |
|
73 | + if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) { |
|
74 | 74 | $works = false; |
75 | 75 | } |
76 | 76 | |
77 | - if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) { |
|
77 | + if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) { |
|
78 | 78 | $works = false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) { |
|
81 | + if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) { |
|
82 | 82 | $works = false; |
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | - if ( $works ) { |
|
88 | - set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS ); |
|
87 | + if ($works) { |
|
88 | + set_transient('_give_ajax_works', '1', DAY_IN_SECONDS); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $works; |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | */ |
101 | 101 | function give_get_ajax_url() { |
102 | - $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
102 | + $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
103 | 103 | |
104 | 104 | $current_url = give_get_current_page_url(); |
105 | - $ajax_url = admin_url( 'admin-ajax.php', $scheme ); |
|
105 | + $ajax_url = admin_url('admin-ajax.php', $scheme); |
|
106 | 106 | |
107 | - if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) { |
|
108 | - $ajax_url = preg_replace( '/^http/', 'https', $ajax_url ); |
|
107 | + if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) { |
|
108 | + $ajax_url = preg_replace('/^http/', 'https', $ajax_url); |
|
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_ajax_url', $ajax_url ); |
|
111 | + return apply_filters('give_ajax_url', $ajax_url); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | * @return void |
119 | 119 | */ |
120 | 120 | function give_load_checkout_login_fields() { |
121 | - do_action( 'give_purchase_form_login_fields' ); |
|
121 | + do_action('give_purchase_form_login_fields'); |
|
122 | 122 | give_die(); |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' ); |
|
125 | +add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Load Checkout Fields |
@@ -131,22 +131,22 @@ discard block |
||
131 | 131 | * @return void |
132 | 132 | */ |
133 | 133 | function give_load_checkout_fields() { |
134 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : ''; |
|
134 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : ''; |
|
135 | 135 | |
136 | 136 | ob_start(); |
137 | 137 | |
138 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
138 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
139 | 139 | |
140 | 140 | $fields = ob_get_clean(); |
141 | 141 | |
142 | - wp_send_json( array( |
|
143 | - 'fields' => wp_json_encode( $fields ), |
|
144 | - 'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ), |
|
145 | - ) ); |
|
142 | + wp_send_json(array( |
|
143 | + 'fields' => wp_json_encode($fields), |
|
144 | + 'submit' => wp_json_encode(give_checkout_button_purchase($form_id)), |
|
145 | + )); |
|
146 | 146 | } |
147 | 147 | |
148 | -add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' ); |
|
149 | -add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' ); |
|
148 | +add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields'); |
|
149 | +add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Get Form Title via AJAX (used only in WordPress Admin) |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * @return void |
156 | 156 | */ |
157 | 157 | function give_ajax_get_form_title() { |
158 | - if ( isset( $_POST['form_id'] ) ) { |
|
159 | - $title = get_the_title( $_POST['form_id'] ); |
|
160 | - if ( $title ) { |
|
158 | + if (isset($_POST['form_id'])) { |
|
159 | + $title = get_the_title($_POST['form_id']); |
|
160 | + if ($title) { |
|
161 | 161 | echo $title; |
162 | 162 | } else { |
163 | 163 | echo 'fail'; |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | give_die(); |
167 | 167 | } |
168 | 168 | |
169 | -add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' ); |
|
170 | -add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' ); |
|
169 | +add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title'); |
|
170 | +add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title'); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Retrieve a states drop down |
@@ -177,23 +177,23 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function give_ajax_get_states_field() { |
179 | 179 | |
180 | - if ( empty( $_POST['country'] ) ) { |
|
180 | + if (empty($_POST['country'])) { |
|
181 | 181 | $_POST['country'] = give_get_country(); |
182 | 182 | } |
183 | - $states = give_get_states( $_POST['country'] ); |
|
183 | + $states = give_get_states($_POST['country']); |
|
184 | 184 | |
185 | - if ( ! empty( $states ) ) { |
|
185 | + if ( ! empty($states)) { |
|
186 | 186 | |
187 | 187 | $args = array( |
188 | 188 | 'name' => $_POST['field_name'], |
189 | 189 | 'id' => $_POST['field_name'], |
190 | - 'class' => $_POST['field_name'] . ' give-select', |
|
191 | - 'options' => give_get_states( $_POST['country'] ), |
|
190 | + 'class' => $_POST['field_name'].' give-select', |
|
191 | + 'options' => give_get_states($_POST['country']), |
|
192 | 192 | 'show_option_all' => false, |
193 | 193 | 'show_option_none' => false |
194 | 194 | ); |
195 | 195 | |
196 | - $response = Give()->html->select( $args ); |
|
196 | + $response = Give()->html->select($args); |
|
197 | 197 | |
198 | 198 | } else { |
199 | 199 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | give_die(); |
206 | 206 | } |
207 | 207 | |
208 | -add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' ); |
|
209 | -add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' ); |
|
208 | +add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field'); |
|
209 | +add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field'); |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Retrieve a states drop down |
@@ -217,17 +217,17 @@ discard block |
||
217 | 217 | function give_ajax_form_search() { |
218 | 218 | global $wpdb; |
219 | 219 | |
220 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
220 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
221 | 221 | $results = array(); |
222 | - if ( current_user_can( 'edit_give_forms' ) ) { |
|
223 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
222 | + if (current_user_can('edit_give_forms')) { |
|
223 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
224 | 224 | } else { |
225 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
225 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
226 | 226 | } |
227 | 227 | |
228 | - if ( $items ) { |
|
228 | + if ($items) { |
|
229 | 229 | |
230 | - foreach ( $items as $item ) { |
|
230 | + foreach ($items as $item) { |
|
231 | 231 | |
232 | 232 | $results[] = array( |
233 | 233 | 'id' => $item->ID, |
@@ -239,18 +239,18 @@ discard block |
||
239 | 239 | |
240 | 240 | $items[] = array( |
241 | 241 | 'id' => 0, |
242 | - 'name' => __( 'No results found', 'give' ) |
|
242 | + 'name' => __('No results found', 'give') |
|
243 | 243 | ); |
244 | 244 | |
245 | 245 | } |
246 | 246 | |
247 | - echo json_encode( $results ); |
|
247 | + echo json_encode($results); |
|
248 | 248 | |
249 | 249 | give_die(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' ); |
|
253 | -add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' ); |
|
252 | +add_action('wp_ajax_give_form_search', 'give_ajax_form_search'); |
|
253 | +add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search'); |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Search the donors database via Ajax |
@@ -261,21 +261,21 @@ discard block |
||
261 | 261 | function give_ajax_donor_search() { |
262 | 262 | global $wpdb; |
263 | 263 | |
264 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
264 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
265 | 265 | $results = array(); |
266 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
266 | + if ( ! current_user_can('view_give_reports')) { |
|
267 | 267 | $donors = array(); |
268 | 268 | } else { |
269 | - $donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" ); |
|
269 | + $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50"); |
|
270 | 270 | } |
271 | 271 | |
272 | - if ( $donors ) { |
|
272 | + if ($donors) { |
|
273 | 273 | |
274 | - foreach ( $donors as $donor ) { |
|
274 | + foreach ($donors as $donor) { |
|
275 | 275 | |
276 | 276 | $results[] = array( |
277 | 277 | 'id' => $donor->id, |
278 | - 'name' => $donor->name . '(' . $donor->email . ')' |
|
278 | + 'name' => $donor->name.'('.$donor->email.')' |
|
279 | 279 | ); |
280 | 280 | } |
281 | 281 | |
@@ -283,17 +283,17 @@ discard block |
||
283 | 283 | |
284 | 284 | $donors[] = array( |
285 | 285 | 'id' => 0, |
286 | - 'name' => __( 'No results found', 'give' ) |
|
286 | + 'name' => __('No results found', 'give') |
|
287 | 287 | ); |
288 | 288 | |
289 | 289 | } |
290 | 290 | |
291 | - echo json_encode( $results ); |
|
291 | + echo json_encode($results); |
|
292 | 292 | |
293 | 293 | give_die(); |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' ); |
|
296 | +add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search'); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | /** |
@@ -304,30 +304,30 @@ discard block |
||
304 | 304 | */ |
305 | 305 | function give_ajax_search_users() { |
306 | 306 | |
307 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
307 | + if (current_user_can('manage_give_settings')) { |
|
308 | 308 | |
309 | - $search_query = trim( $_POST['user_name'] ); |
|
309 | + $search_query = trim($_POST['user_name']); |
|
310 | 310 | |
311 | - $found_users = get_users( array( |
|
311 | + $found_users = get_users(array( |
|
312 | 312 | 'number' => 9999, |
313 | - 'search' => $search_query . '*' |
|
313 | + 'search' => $search_query.'*' |
|
314 | 314 | ) |
315 | 315 | ); |
316 | 316 | |
317 | 317 | $user_list = '<ul>'; |
318 | - if ( $found_users ) { |
|
319 | - foreach ( $found_users as $user ) { |
|
320 | - $user_list .= '<li><a href="#" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>'; |
|
318 | + if ($found_users) { |
|
319 | + foreach ($found_users as $user) { |
|
320 | + $user_list .= '<li><a href="#" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>'; |
|
321 | 321 | } |
322 | 322 | } else { |
323 | - $user_list .= '<li>' . __( 'No users found', 'give' ) . '</li>'; |
|
323 | + $user_list .= '<li>'.__('No users found', 'give').'</li>'; |
|
324 | 324 | } |
325 | 325 | $user_list .= '</ul>'; |
326 | 326 | |
327 | - echo json_encode( array( 'results' => $user_list ) ); |
|
327 | + echo json_encode(array('results' => $user_list)); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | die(); |
331 | 331 | } |
332 | 332 | |
333 | -add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' ); |
|
334 | 333 | \ No newline at end of file |
334 | +add_action('wp_ajax_give_search_users', 'give_ajax_search_users'); |
|
335 | 335 | \ 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,56 +23,56 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string $purchase_form |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_product', $form->ID ) ) { |
|
57 | + if ('publish' !== $form->post_status && ! current_user_can('edit_product', $form->ID)) { |
|
58 | 58 | return false; // Product not published or user doesn't have permission to view drafts |
59 | 59 | } |
60 | 60 | |
61 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
61 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
62 | 62 | ? $args['display_style'] |
63 | - : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
63 | + : get_post_meta($form->ID, '_give_payment_display', true); |
|
64 | 64 | |
65 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
65 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
66 | 66 | ? ' float-labels-enabled' |
67 | 67 | : ''; |
68 | 68 | |
69 | 69 | |
70 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
70 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
71 | 71 | 'give-form-wrap', |
72 | - 'give-display-' . $display_option |
|
73 | - ), $form->ID, $args ); |
|
72 | + 'give-display-'.$display_option |
|
73 | + ), $form->ID, $args); |
|
74 | 74 | |
75 | - $form_classes = implode( ' ', $form_classes_array ); |
|
75 | + $form_classes = implode(' ', $form_classes_array); |
|
76 | 76 | |
77 | 77 | ob_start(); |
78 | 78 | |
@@ -84,35 +84,35 @@ discard block |
||
84 | 84 | * @param int $form ->ID The current form ID |
85 | 85 | * @param array $args An array of form args |
86 | 86 | */ |
87 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
87 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
88 | 88 | |
89 | 89 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_classes; ?>"> |
90 | 90 | |
91 | 91 | <?php |
92 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
92 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
93 | 93 | |
94 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
94 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
95 | 95 | |
96 | 96 | } ?> |
97 | 97 | |
98 | - <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
98 | + <?php do_action('give_pre_form', $form->ID, $args); ?> |
|
99 | 99 | |
100 | - <form id="give-form-<?php echo $form_id; ?>" class="give-form give-form-<?php echo absint( $form->ID ); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
100 | + <form id="give-form-<?php echo $form_id; ?>" class="give-form give-form-<?php echo absint($form->ID); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
101 | 101 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
102 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
103 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
104 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
105 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price( $form->ID ); ?>"/> |
|
102 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
103 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
104 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
105 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price($form->ID); ?>"/> |
|
106 | 106 | <?php |
107 | 107 | |
108 | 108 | //Price ID hidden field for variable (mult-level) donation forms |
109 | - if ( give_has_variable_prices( $form_id ) ) { |
|
109 | + if (give_has_variable_prices($form_id)) { |
|
110 | 110 | //get default selected price ID |
111 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
111 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
112 | 112 | $price_id = 0; |
113 | 113 | //loop through prices |
114 | - foreach ( $prices as $price ) { |
|
115 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
114 | + foreach ($prices as $price) { |
|
115 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
116 | 116 | $price_id = $price['_give_id']['level_id']; |
117 | 117 | }; |
118 | 118 | } |
@@ -120,19 +120,19 @@ discard block |
||
120 | 120 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
121 | 121 | <?php } |
122 | 122 | |
123 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
123 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
124 | 124 | |
125 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
125 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
126 | 126 | |
127 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
127 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
128 | 128 | |
129 | 129 | ?> |
130 | 130 | |
131 | 131 | </form> |
132 | 132 | |
133 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
133 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
134 | 134 | |
135 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
135 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
136 | 136 | <?php |
137 | 137 | |
138 | 138 | /** |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | * @param int $form ->ID The current form ID |
144 | 144 | * @param array $args An array of form args |
145 | 145 | */ |
146 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
146 | + do_action('give_post_form_output', $form->ID, $args); |
|
147 | 147 | |
148 | 148 | $final_output = ob_get_clean(); |
149 | 149 | |
150 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
150 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -167,43 +167,43 @@ discard block |
||
167 | 167 | * @global $give_options Array of all the Give options |
168 | 168 | * @return string |
169 | 169 | */ |
170 | -function give_show_purchase_form( $form_id ) { |
|
170 | +function give_show_purchase_form($form_id) { |
|
171 | 171 | |
172 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
172 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
173 | 173 | |
174 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
174 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
175 | 175 | $form_id = $_POST['give_form_id']; |
176 | 176 | } |
177 | 177 | |
178 | - do_action( 'give_purchase_form_top', $form_id ); |
|
178 | + do_action('give_purchase_form_top', $form_id); |
|
179 | 179 | |
180 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
180 | + if (give_can_checkout() && isset($form_id)) { |
|
181 | 181 | |
182 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
182 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
183 | 183 | |
184 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
184 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
185 | 185 | |
186 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
186 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
187 | 187 | |
188 | 188 | // Load the credit card form and allow gateways to load their own if they wish |
189 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
190 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
189 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
190 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
191 | 191 | } else { |
192 | - do_action( 'give_cc_form', $form_id ); |
|
192 | + do_action('give_cc_form', $form_id); |
|
193 | 193 | } |
194 | 194 | |
195 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
195 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
196 | 196 | |
197 | 197 | } else { |
198 | 198 | // Can't checkout |
199 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
199 | + do_action('give_purchase_form_no_access', $form_id); |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
203 | + do_action('give_purchase_form_bottom', $form_id); |
|
204 | 204 | } |
205 | 205 | |
206 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
206 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
207 | 207 | |
208 | 208 | /** |
209 | 209 | * |
@@ -215,26 +215,26 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return void |
217 | 217 | */ |
218 | -function give_show_register_login_fields( $form_id ) { |
|
218 | +function give_show_register_login_fields($form_id) { |
|
219 | 219 | |
220 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
220 | + $show_register_form = give_show_login_register_option($form_id); |
|
221 | 221 | |
222 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
222 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
223 | 223 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
224 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
224 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
225 | 225 | </div> |
226 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
226 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
227 | 227 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
228 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
228 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php endif; ?> |
231 | 231 | |
232 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
233 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
232 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
233 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
237 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Donation Amount Field |
@@ -248,37 +248,37 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return void |
250 | 250 | */ |
251 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
251 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
252 | 252 | |
253 | 253 | global $give_options; |
254 | 254 | |
255 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
256 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
257 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
258 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
259 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
260 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
261 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
255 | + $variable_pricing = give_has_variable_prices($form_id); |
|
256 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
257 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
258 | + $symbol = give_currency_symbol(give_get_currency()); |
|
259 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
260 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
261 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
262 | 262 | |
263 | - do_action( 'give_before_donation_levels', $form_id ); |
|
263 | + do_action('give_before_donation_levels', $form_id); |
|
264 | 264 | |
265 | 265 | //Set Price, No Custom Amount Allowed means hidden price field |
266 | - if ( $allow_custom_amount == 'no' ) { |
|
266 | + if ($allow_custom_amount == 'no') { |
|
267 | 267 | ?> |
268 | 268 | |
269 | - <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
269 | + <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
270 | 270 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
271 | 271 | value="<?php echo $default_amount; ?>" required> |
272 | 272 | <p class="set-price give-donation-amount form-row-wide"> |
273 | - <?php if ( $currency_position == 'before' ) { |
|
273 | + <?php if ($currency_position == 'before') { |
|
274 | 274 | echo $currency_output; |
275 | 275 | } ?> |
276 | 276 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
277 | - <?php if ( $currency_position == 'after' ) { |
|
277 | + <?php if ($currency_position == 'after') { |
|
278 | 278 | echo $currency_output; |
279 | 279 | } ?> |
280 | 280 | <span class="give-loading-text give-updating-price-loader"> |
281 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
281 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
282 | 282 | </span> |
283 | 283 | </p> |
284 | 284 | <?php |
@@ -287,37 +287,37 @@ discard block |
||
287 | 287 | ?> |
288 | 288 | <div class="give-total-wrap"> |
289 | 289 | <div class="give-donation-amount form-row-wide"> |
290 | - <?php if ( $currency_position == 'before' ) { |
|
290 | + <?php if ($currency_position == 'before') { |
|
291 | 291 | echo $currency_output; |
292 | 292 | } ?> |
293 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
293 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
294 | 294 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
295 | - <?php if ( $currency_position == 'after' ) { |
|
295 | + <?php if ($currency_position == 'after') { |
|
296 | 296 | echo $currency_output; |
297 | 297 | } ?> |
298 | 298 | <span class="give-loading-text give-updating-price-loader"> |
299 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
299 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
300 | 300 | </span> |
301 | 301 | </div> |
302 | 302 | </div> |
303 | 303 | <?php } |
304 | 304 | |
305 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
305 | + do_action('give_after_donation_amount', $form_id, $args); |
|
306 | 306 | |
307 | 307 | //Custom Amount Text |
308 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
308 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
309 | 309 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
310 | 310 | <?php } |
311 | 311 | |
312 | 312 | //Output Variable Pricing Levels |
313 | - if ( $variable_pricing ) { |
|
314 | - give_output_levels( $form_id ); |
|
313 | + if ($variable_pricing) { |
|
314 | + give_output_levels($form_id); |
|
315 | 315 | } |
316 | 316 | |
317 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
317 | + do_action('give_after_donation_levels', $form_id, $args); |
|
318 | 318 | } |
319 | 319 | |
320 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
320 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
321 | 321 | |
322 | 322 | |
323 | 323 | /** |
@@ -329,32 +329,32 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return string |
331 | 331 | */ |
332 | -function give_output_levels( $form_id ) { |
|
332 | +function give_output_levels($form_id) { |
|
333 | 333 | |
334 | 334 | //Get variable pricing |
335 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
336 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
337 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
338 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
339 | - if ( empty( $custom_amount_text ) ) { |
|
340 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
335 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
336 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
337 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
338 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
339 | + if (empty($custom_amount_text)) { |
|
340 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | $output = ''; |
344 | 344 | $counter = 0; |
345 | 345 | |
346 | - switch ( $display_style ) { |
|
346 | + switch ($display_style) { |
|
347 | 347 | case 'buttons': |
348 | 348 | |
349 | 349 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
350 | 350 | |
351 | - foreach ( $prices as $price ) { |
|
352 | - $counter ++; |
|
353 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
354 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
351 | + foreach ($prices as $price) { |
|
352 | + $counter++; |
|
353 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
354 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
355 | 355 | |
356 | 356 | $output .= '<li>'; |
357 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
357 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
358 | 358 | $output .= $level_text; |
359 | 359 | $output .= '</button>'; |
360 | 360 | $output .= '</li>'; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | //Custom Amount |
365 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
365 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
366 | 366 | $output .= '<li>'; |
367 | 367 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
368 | 368 | $output .= $custom_amount_text; |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | |
379 | 379 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
380 | 380 | |
381 | - foreach ( $prices as $price ) { |
|
382 | - $counter ++; |
|
383 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
384 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
381 | + foreach ($prices as $price) { |
|
382 | + $counter++; |
|
383 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
384 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
385 | 385 | |
386 | 386 | $output .= '<li>'; |
387 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
388 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
387 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
388 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
389 | 389 | $output .= '</li>'; |
390 | 390 | |
391 | 391 | } |
392 | 392 | |
393 | 393 | //Custom Amount |
394 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
394 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
395 | 395 | $output .= '<li>'; |
396 | 396 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
397 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
397 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
398 | 398 | $output .= '</li>'; |
399 | 399 | } |
400 | 400 | |
@@ -404,23 +404,23 @@ discard block |
||
404 | 404 | |
405 | 405 | case 'dropdown': |
406 | 406 | |
407 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
408 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
407 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>'; |
|
408 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
409 | 409 | |
410 | 410 | //first loop through prices |
411 | - foreach ( $prices as $price ) { |
|
412 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
413 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id, $form_id, $price ); |
|
411 | + foreach ($prices as $price) { |
|
412 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
413 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id, $form_id, $price); |
|
414 | 414 | |
415 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
415 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
416 | 416 | $output .= $level_text; |
417 | 417 | $output .= '</option>'; |
418 | 418 | |
419 | 419 | } |
420 | 420 | |
421 | 421 | //Custom Amount |
422 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
423 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
422 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
423 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | $output .= '</select>'; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | break; |
429 | 429 | } |
430 | 430 | |
431 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
431 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -440,26 +440,26 @@ discard block |
||
440 | 440 | * @param array $args |
441 | 441 | * |
442 | 442 | */ |
443 | -function give_display_checkout_button( $form_id, $args ) { |
|
443 | +function give_display_checkout_button($form_id, $args) { |
|
444 | 444 | |
445 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
445 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
446 | 446 | ? $args['display_style'] |
447 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
447 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
448 | 448 | |
449 | 449 | //no btn for onpage |
450 | - if ( $display_option === 'onpage' ) { |
|
450 | + if ($display_option === 'onpage') { |
|
451 | 451 | return; |
452 | 452 | } |
453 | 453 | |
454 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
455 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
454 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
455 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
456 | 456 | |
457 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
457 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
458 | 458 | |
459 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
459 | + echo apply_filters('give_display_checkout_button', $output); |
|
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
462 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -470,71 +470,71 @@ discard block |
||
470 | 470 | * |
471 | 471 | * @return void |
472 | 472 | */ |
473 | -function give_user_info_fields( $form_id ) { |
|
473 | +function give_user_info_fields($form_id) { |
|
474 | 474 | |
475 | - if ( is_user_logged_in() ) : |
|
476 | - $user_data = get_userdata( get_current_user_id() ); |
|
475 | + if (is_user_logged_in()) : |
|
476 | + $user_data = get_userdata(get_current_user_id()); |
|
477 | 477 | endif; |
478 | 478 | |
479 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
479 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
480 | 480 | ?> |
481 | 481 | <fieldset id="give_checkout_user_info"> |
482 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
482 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
483 | 483 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
484 | 484 | <label class="give-label" for="give-first"> |
485 | - <?php _e( 'First Name', 'give' ); ?> |
|
486 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
485 | + <?php _e('First Name', 'give'); ?> |
|
486 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
487 | 487 | <span class="give-required-indicator">*</span> |
488 | 488 | <?php } ?> |
489 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
489 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
490 | 490 | </label> |
491 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
491 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
492 | 492 | echo ' required '; |
493 | 493 | } ?>/> |
494 | 494 | </p> |
495 | 495 | |
496 | 496 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
497 | 497 | <label class="give-label" for="give-last"> |
498 | - <?php _e( 'Last Name', 'give' ); ?> |
|
499 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
498 | + <?php _e('Last Name', 'give'); ?> |
|
499 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
500 | 500 | <span class="give-required-indicator">*</span> |
501 | 501 | <?php } ?> |
502 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
502 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
503 | 503 | </label> |
504 | 504 | |
505 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
505 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
506 | 506 | echo ' required'; |
507 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
507 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
508 | 508 | echo ' required '; |
509 | 509 | } ?> /> |
510 | 510 | </p> |
511 | 511 | |
512 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
512 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
513 | 513 | <p id="give-email-wrap" class="form-row form-row-wide"> |
514 | 514 | <label class="give-label" for="give-email"> |
515 | - <?php _e( 'Email Address', 'give' ); ?> |
|
516 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
515 | + <?php _e('Email Address', 'give'); ?> |
|
516 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
517 | 517 | <span class="give-required-indicator">*</span> |
518 | 518 | <?php } ?> |
519 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
519 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
520 | 520 | </label> |
521 | 521 | |
522 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
522 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
523 | 523 | echo ' required '; |
524 | 524 | } ?>/> |
525 | 525 | |
526 | 526 | </p> |
527 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
527 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
528 | 528 | |
529 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
529 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
530 | 530 | </fieldset> |
531 | 531 | <?php |
532 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
532 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
533 | 533 | |
534 | 534 | } |
535 | 535 | |
536 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
537 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
536 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
537 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
538 | 538 | |
539 | 539 | /** |
540 | 540 | * Renders the credit card info form. |
@@ -545,73 +545,73 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @return void |
547 | 547 | */ |
548 | -function give_get_cc_form( $form_id ) { |
|
548 | +function give_get_cc_form($form_id) { |
|
549 | 549 | |
550 | 550 | ob_start(); |
551 | 551 | |
552 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
552 | + do_action('give_before_cc_fields', $form_id); ?> |
|
553 | 553 | |
554 | 554 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
555 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
556 | - <?php if ( is_ssl() ) : ?> |
|
555 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
556 | + <?php if (is_ssl()) : ?> |
|
557 | 557 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
558 | 558 | <span class="give-icon padlock"></span> |
559 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
559 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
560 | 560 | </div> |
561 | 561 | <?php endif; ?> |
562 | 562 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
563 | 563 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
564 | - <?php _e( 'Card Number', 'give' ); ?> |
|
564 | + <?php _e('Card Number', 'give'); ?> |
|
565 | 565 | <span class="give-required-indicator">*</span> |
566 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
566 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
567 | 567 | <span class="card-type"></span> |
568 | 568 | </label> |
569 | 569 | |
570 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/> |
|
570 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/> |
|
571 | 571 | </p> |
572 | 572 | |
573 | 573 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
574 | 574 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
575 | - <?php _e( 'CVC', 'give' ); ?> |
|
575 | + <?php _e('CVC', 'give'); ?> |
|
576 | 576 | <span class="give-required-indicator">*</span> |
577 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
577 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
578 | 578 | </label> |
579 | 579 | |
580 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/> |
|
580 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/> |
|
581 | 581 | </p> |
582 | 582 | |
583 | 583 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
584 | 584 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
585 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
585 | + <?php _e('Name on the Card', 'give'); ?> |
|
586 | 586 | <span class="give-required-indicator">*</span> |
587 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
587 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
588 | 588 | </label> |
589 | 589 | |
590 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/> |
|
590 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/> |
|
591 | 591 | </p> |
592 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
592 | + <?php do_action('give_before_cc_expiration'); ?> |
|
593 | 593 | <p class="card-expiration form-row form-row-one-third"> |
594 | 594 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
595 | - <?php _e( 'Expiration', 'give' ); ?> |
|
595 | + <?php _e('Expiration', 'give'); ?> |
|
596 | 596 | <span class="give-required-indicator">*</span> |
597 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
597 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
598 | 598 | </label> |
599 | 599 | |
600 | 600 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
601 | 601 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
602 | 602 | |
603 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/> |
|
603 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/> |
|
604 | 604 | </p> |
605 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
605 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
606 | 606 | |
607 | 607 | </fieldset> |
608 | 608 | <?php |
609 | - do_action( 'give_after_cc_fields', $form_id ); |
|
609 | + do_action('give_after_cc_fields', $form_id); |
|
610 | 610 | |
611 | 611 | echo ob_get_clean(); |
612 | 612 | } |
613 | 613 | |
614 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
614 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Outputs the default credit card address fields |
@@ -622,110 +622,110 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return void |
624 | 624 | */ |
625 | -function give_default_cc_address_fields( $form_id ) { |
|
625 | +function give_default_cc_address_fields($form_id) { |
|
626 | 626 | |
627 | 627 | $logged_in = is_user_logged_in(); |
628 | 628 | |
629 | - if ( $logged_in ) { |
|
630 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
629 | + if ($logged_in) { |
|
630 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
631 | 631 | } |
632 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
633 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
634 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
635 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
632 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
633 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
634 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
635 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
636 | 636 | ob_start(); ?> |
637 | 637 | <fieldset id="give_cc_address" class="cc-address"> |
638 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
639 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
638 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
639 | + <?php do_action('give_cc_billing_top'); ?> |
|
640 | 640 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
641 | 641 | <label for="card_address" class="give-label"> |
642 | - <?php _e( 'Address', 'give' ); ?> |
|
642 | + <?php _e('Address', 'give'); ?> |
|
643 | 643 | <?php |
644 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
644 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
645 | 645 | <span class="give-required-indicator">*</span> |
646 | 646 | <?php } ?> |
647 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
647 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
648 | 648 | </label> |
649 | 649 | |
650 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
650 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
651 | 651 | echo ' required'; |
652 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
652 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
653 | 653 | echo ' required '; |
654 | 654 | } ?>/> |
655 | 655 | </p> |
656 | 656 | |
657 | 657 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
658 | 658 | <label for="card_address_2" class="give-label"> |
659 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
660 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
659 | + <?php _e('Address Line 2', 'give'); ?> |
|
660 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
661 | 661 | <span class="give-required-indicator">*</span> |
662 | 662 | <?php } ?> |
663 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
663 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
664 | 664 | </label> |
665 | 665 | |
666 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
666 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
667 | 667 | echo ' required'; |
668 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
668 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
669 | 669 | echo ' required '; |
670 | 670 | } ?>/> |
671 | 671 | </p> |
672 | 672 | |
673 | 673 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
674 | 674 | <label for="card_city" class="give-label"> |
675 | - <?php _e( 'City', 'give' ); ?> |
|
676 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
675 | + <?php _e('City', 'give'); ?> |
|
676 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
677 | 677 | <span class="give-required-indicator">*</span> |
678 | 678 | <?php } ?> |
679 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
679 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
680 | 680 | </label> |
681 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
681 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
682 | 682 | echo ' required'; |
683 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
683 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
684 | 684 | echo ' required '; |
685 | 685 | } ?>/> |
686 | 686 | </p> |
687 | 687 | |
688 | 688 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
689 | 689 | <label for="card_zip" class="give-label"> |
690 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
691 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
690 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
691 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
692 | 692 | <span class="give-required-indicator">*</span> |
693 | 693 | <?php } ?> |
694 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
694 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
695 | 695 | </label> |
696 | 696 | |
697 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
697 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
698 | 698 | echo ' required'; |
699 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
699 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
700 | 700 | echo ' required '; |
701 | 701 | } ?>/> |
702 | 702 | </p> |
703 | 703 | |
704 | 704 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
705 | 705 | <label for="billing_country" class="give-label"> |
706 | - <?php _e( 'Country', 'give' ); ?> |
|
707 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
706 | + <?php _e('Country', 'give'); ?> |
|
707 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
708 | 708 | <span class="give-required-indicator">*</span> |
709 | 709 | <?php } ?> |
710 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
710 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
711 | 711 | </label> |
712 | 712 | |
713 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
713 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
714 | 714 | echo ' required'; |
715 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
715 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
716 | 716 | echo ' required '; |
717 | 717 | } ?>> |
718 | 718 | <?php |
719 | 719 | |
720 | 720 | $selected_country = give_get_country(); |
721 | 721 | |
722 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
722 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
723 | 723 | $selected_country = $user_address['country']; |
724 | 724 | } |
725 | 725 | |
726 | 726 | $countries = give_get_country_list(); |
727 | - foreach ( $countries as $country_code => $country ) { |
|
728 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
727 | + foreach ($countries as $country_code => $country) { |
|
728 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
729 | 729 | } |
730 | 730 | ?> |
731 | 731 | </select> |
@@ -733,44 +733,44 @@ discard block |
||
733 | 733 | |
734 | 734 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
735 | 735 | <label for="card_state" class="give-label"> |
736 | - <?php _e( 'State / Province', 'give' ); ?> |
|
737 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
736 | + <?php _e('State / Province', 'give'); ?> |
|
737 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
738 | 738 | <span class="give-required-indicator">*</span> |
739 | 739 | <?php } ?> |
740 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
740 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
741 | 741 | </label> |
742 | 742 | |
743 | 743 | <?php |
744 | 744 | $selected_state = give_get_state(); |
745 | - $states = give_get_states( $selected_country ); |
|
745 | + $states = give_get_states($selected_country); |
|
746 | 746 | |
747 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
747 | + if ($logged_in && ! empty($user_address['state'])) { |
|
748 | 748 | $selected_state = $user_address['state']; |
749 | 749 | } |
750 | 750 | |
751 | - if ( ! empty( $states ) ) : ?> |
|
752 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
751 | + if ( ! empty($states)) : ?> |
|
752 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
753 | 753 | echo ' required'; |
754 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
754 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
755 | 755 | echo ' required '; |
756 | 756 | } ?>> |
757 | 757 | <?php |
758 | - foreach ( $states as $state_code => $state ) { |
|
759 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
758 | + foreach ($states as $state_code => $state) { |
|
759 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
760 | 760 | } |
761 | 761 | ?> |
762 | 762 | </select> |
763 | 763 | <?php else : ?> |
764 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
764 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
765 | 765 | <?php endif; ?> |
766 | 766 | </p> |
767 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
767 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
768 | 768 | </fieldset> |
769 | 769 | <?php |
770 | 770 | echo ob_get_clean(); |
771 | 771 | } |
772 | 772 | |
773 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
773 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
774 | 774 | |
775 | 775 | |
776 | 776 | /** |
@@ -782,93 +782,93 @@ discard block |
||
782 | 782 | * |
783 | 783 | * @return string |
784 | 784 | */ |
785 | -function give_get_register_fields( $form_id ) { |
|
785 | +function give_get_register_fields($form_id) { |
|
786 | 786 | |
787 | 787 | global $user_ID; |
788 | 788 | |
789 | - if ( is_user_logged_in() ) { |
|
790 | - $user_data = get_userdata( $user_ID ); |
|
789 | + if (is_user_logged_in()) { |
|
790 | + $user_data = get_userdata($user_ID); |
|
791 | 791 | } |
792 | 792 | |
793 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
793 | + $show_register_form = give_show_login_register_option($form_id); |
|
794 | 794 | |
795 | 795 | ob_start(); ?> |
796 | 796 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
797 | 797 | |
798 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
798 | + <?php if ($show_register_form == 'both') { ?> |
|
799 | 799 | <div class="give-login-account-wrap"> |
800 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
801 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
800 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
801 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
802 | 802 | </p> |
803 | 803 | <p class="give-loading-text"> |
804 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
804 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
805 | 805 | </div> |
806 | 806 | <?php } ?> |
807 | 807 | |
808 | - <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
808 | + <?php do_action('give_register_fields_before', $form_id); ?> |
|
809 | 809 | |
810 | 810 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
811 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
812 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
813 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
811 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
812 | + if ( ! give_logged_in_only($form_id)) { |
|
813 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
814 | 814 | } ?></legend> |
815 | - <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
815 | + <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
816 | 816 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
817 | 817 | <label for="give-user-login-<?php echo $form_id; ?>"> |
818 | - <?php _e( 'Username', 'give' ); ?> |
|
819 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
818 | + <?php _e('Username', 'give'); ?> |
|
819 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
820 | 820 | <span class="give-required-indicator">*</span> |
821 | 821 | <?php } ?> |
822 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
822 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
823 | 823 | </label> |
824 | 824 | |
825 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
825 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
826 | 826 | echo 'required '; |
827 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
827 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
828 | 828 | </div> |
829 | 829 | |
830 | 830 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
831 | 831 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
832 | - <?php _e( 'Password', 'give' ); ?> |
|
833 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
832 | + <?php _e('Password', 'give'); ?> |
|
833 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
834 | 834 | <span class="give-required-indicator">*</span> |
835 | 835 | <?php } ?> |
836 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
836 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
837 | 837 | </label> |
838 | 838 | |
839 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
839 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
840 | 840 | echo 'required '; |
841 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
841 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
842 | 842 | </div> |
843 | 843 | |
844 | 844 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
845 | 845 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
846 | - <?php _e( 'Confirm PW', 'give' ); ?> |
|
847 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
846 | + <?php _e('Confirm PW', 'give'); ?> |
|
847 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
848 | 848 | <span class="give-required-indicator">*</span> |
849 | 849 | <?php } ?> |
850 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
850 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
851 | 851 | </label> |
852 | 852 | |
853 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
853 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
854 | 854 | echo 'required '; |
855 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
855 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
856 | 856 | </div> |
857 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
857 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
858 | 858 | </fieldset> |
859 | 859 | |
860 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
860 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
861 | 861 | |
862 | 862 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
863 | 863 | |
864 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
864 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
865 | 865 | |
866 | 866 | </fieldset> |
867 | 867 | <?php |
868 | 868 | echo ob_get_clean(); |
869 | 869 | } |
870 | 870 | |
871 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
871 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
872 | 872 | |
873 | 873 | /** |
874 | 874 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -881,73 +881,73 @@ discard block |
||
881 | 881 | * |
882 | 882 | * @return string |
883 | 883 | */ |
884 | -function give_get_login_fields( $form_id ) { |
|
884 | +function give_get_login_fields($form_id) { |
|
885 | 885 | |
886 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
887 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
886 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
887 | + $show_register_form = give_show_login_register_option($form_id); |
|
888 | 888 | |
889 | 889 | ob_start(); |
890 | 890 | ?> |
891 | 891 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
892 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
893 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
894 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
892 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
893 | + if ( ! give_logged_in_only($form_id)) { |
|
894 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
895 | 895 | } ?> |
896 | 896 | </legend> |
897 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
897 | + <?php if ($show_register_form == 'both') { ?> |
|
898 | 898 | <p class="give-new-account-link"> |
899 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
900 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
901 | - <?php _e( 'Register', 'give' ); |
|
902 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
903 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
899 | + <?php _e('Need to create an account?', 'give'); ?> |
|
900 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
901 | + <?php _e('Register', 'give'); |
|
902 | + if ( ! give_logged_in_only($form_id)) { |
|
903 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
904 | 904 | } ?> |
905 | 905 | </a> |
906 | 906 | </p> |
907 | 907 | <p class="give-loading-text"> |
908 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
908 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
909 | 909 | <?php } ?> |
910 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
910 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
911 | 911 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
912 | 912 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
913 | - <?php _e( 'Username', 'give' ); ?> |
|
914 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
913 | + <?php _e('Username', 'give'); ?> |
|
914 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
915 | 915 | <span class="give-required-indicator">*</span> |
916 | 916 | <?php } ?> |
917 | 917 | </label> |
918 | 918 | |
919 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
919 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
920 | 920 | echo 'required '; |
921 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
921 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
922 | 922 | </div> |
923 | 923 | |
924 | 924 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
925 | 925 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
926 | - <?php _e( 'Password', 'give' ); ?> |
|
927 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
926 | + <?php _e('Password', 'give'); ?> |
|
927 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
928 | 928 | <span class="give-required-indicator">*</span> |
929 | 929 | <?php } ?> |
930 | 930 | </label> |
931 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
931 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
932 | 932 | echo 'required '; |
933 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
933 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
934 | 934 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
935 | 935 | </div> |
936 | 936 | |
937 | 937 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
938 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
939 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
940 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
938 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
939 | + <?php if ($show_register_form !== 'login') { ?> |
|
940 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
941 | 941 | <?php } ?> |
942 | 942 | <span class="give-loading-animation"></span> |
943 | 943 | </div> |
944 | - <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
944 | + <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
945 | 945 | </fieldset><!--end #give-login-fields--> |
946 | 946 | <?php |
947 | 947 | echo ob_get_clean(); |
948 | 948 | } |
949 | 949 | |
950 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
950 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
951 | 951 | |
952 | 952 | /** |
953 | 953 | * Payment Mode Select |
@@ -963,49 +963,49 @@ discard block |
||
963 | 963 | * |
964 | 964 | * @return void |
965 | 965 | */ |
966 | -function give_payment_mode_select( $form_id ) { |
|
966 | +function give_payment_mode_select($form_id) { |
|
967 | 967 | |
968 | 968 | $gateways = give_get_enabled_payment_gateways(); |
969 | 969 | |
970 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
970 | + do_action('give_payment_mode_top', $form_id); ?> |
|
971 | 971 | |
972 | 972 | <fieldset id="give-payment-mode-select"> |
973 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
973 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
974 | 974 | <div id="give-payment-mode-wrap"> |
975 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
976 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
975 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
976 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
977 | 977 | </legend> |
978 | 978 | <?php |
979 | 979 | |
980 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
980 | + do_action('give_payment_mode_before_gateways') ?> |
|
981 | 981 | |
982 | 982 | <ul id="give-gateway-radio-list"> |
983 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
984 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
983 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
984 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
985 | 985 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
986 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
987 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
986 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
987 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
988 | 988 | echo '</label></li>'; |
989 | 989 | endforeach; ?> |
990 | 990 | </ul> |
991 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
991 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
992 | 992 | </div> |
993 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
993 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
994 | 994 | </fieldset> |
995 | 995 | |
996 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
996 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
997 | 997 | |
998 | 998 | <div id="give_purchase_form_wrap"> |
999 | 999 | |
1000 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
1000 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
1001 | 1001 | |
1002 | 1002 | </div><!-- the checkout fields are loaded into this--> |
1003 | 1003 | |
1004 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
1004 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
1005 | 1005 | |
1006 | 1006 | } |
1007 | 1007 | |
1008 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1008 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1009 | 1009 | |
1010 | 1010 | |
1011 | 1011 | /** |
@@ -1020,35 +1020,35 @@ discard block |
||
1020 | 1020 | * |
1021 | 1021 | * @return void |
1022 | 1022 | */ |
1023 | -function give_terms_agreement( $form_id ) { |
|
1023 | +function give_terms_agreement($form_id) { |
|
1024 | 1024 | |
1025 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1026 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1027 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1025 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1026 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1027 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1028 | 1028 | |
1029 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1029 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1030 | 1030 | <fieldset id="give_terms_agreement"> |
1031 | 1031 | <div id="give_terms" style="display:none;"> |
1032 | 1032 | <?php |
1033 | - do_action( 'give_before_terms' ); |
|
1034 | - echo wpautop( stripslashes( $terms ) ); |
|
1035 | - do_action( 'give_after_terms' ); |
|
1033 | + do_action('give_before_terms'); |
|
1034 | + echo wpautop(stripslashes($terms)); |
|
1035 | + do_action('give_after_terms'); |
|
1036 | 1036 | ?> |
1037 | 1037 | </div> |
1038 | 1038 | <div id="give_show_terms"> |
1039 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
1040 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
1039 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
1040 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
1041 | 1041 | </div> |
1042 | 1042 | |
1043 | 1043 | <label |
1044 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
1044 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
1045 | 1045 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1046 | 1046 | </fieldset> |
1047 | 1047 | <?php |
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | |
1051 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1051 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1052 | 1052 | |
1053 | 1053 | /** |
1054 | 1054 | * Checkout Final Total |
@@ -1060,27 +1060,27 @@ discard block |
||
1060 | 1060 | * @since 1.0 |
1061 | 1061 | * @return void |
1062 | 1062 | */ |
1063 | -function give_checkout_final_total( $form_id ) { |
|
1063 | +function give_checkout_final_total($form_id) { |
|
1064 | 1064 | |
1065 | - if ( isset( $_POST['give_total'] ) ) { |
|
1066 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1065 | + if (isset($_POST['give_total'])) { |
|
1066 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1067 | 1067 | } else { |
1068 | 1068 | //default total |
1069 | - $total = give_get_default_form_amount( $form_id ); |
|
1069 | + $total = give_get_default_form_amount($form_id); |
|
1070 | 1070 | } |
1071 | 1071 | //Only proceed if give_total available |
1072 | - if ( empty( $total ) ) { |
|
1072 | + if (empty($total)) { |
|
1073 | 1073 | return; |
1074 | 1074 | } |
1075 | 1075 | ?> |
1076 | 1076 | <p id="give-final-total-wrap" class="form-wrap "> |
1077 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
1078 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1077 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
1078 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1079 | 1079 | </p> |
1080 | 1080 | <?php |
1081 | 1081 | } |
1082 | 1082 | |
1083 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1083 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1084 | 1084 | |
1085 | 1085 | |
1086 | 1086 | /** |
@@ -1092,22 +1092,22 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return void |
1094 | 1094 | */ |
1095 | -function give_checkout_submit( $form_id ) { |
|
1095 | +function give_checkout_submit($form_id) { |
|
1096 | 1096 | ?> |
1097 | 1097 | <fieldset id="give_purchase_submit"> |
1098 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1098 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1099 | 1099 | |
1100 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1100 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1101 | 1101 | |
1102 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1102 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1103 | 1103 | |
1104 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1104 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1105 | 1105 | |
1106 | 1106 | </fieldset> |
1107 | 1107 | <?php |
1108 | 1108 | } |
1109 | 1109 | |
1110 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1110 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1111 | 1111 | |
1112 | 1112 | |
1113 | 1113 | /** |
@@ -1120,10 +1120,10 @@ discard block |
||
1120 | 1120 | * |
1121 | 1121 | * @return string |
1122 | 1122 | */ |
1123 | -function give_checkout_button_purchase( $form_id ) { |
|
1123 | +function give_checkout_button_purchase($form_id) { |
|
1124 | 1124 | |
1125 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1126 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
1125 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1126 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
1127 | 1127 | |
1128 | 1128 | ob_start(); |
1129 | 1129 | |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | <span class="give-loading-animation"></span> |
1135 | 1135 | </div> |
1136 | 1136 | <?php |
1137 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1137 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | /** |
@@ -1147,11 +1147,11 @@ discard block |
||
1147 | 1147 | * |
1148 | 1148 | * @return void |
1149 | 1149 | */ |
1150 | -function give_agree_to_terms_js( $form_id ) { |
|
1150 | +function give_agree_to_terms_js($form_id) { |
|
1151 | 1151 | |
1152 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1152 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1153 | 1153 | |
1154 | - if ( $form_option === 'yes' ) { |
|
1154 | + if ($form_option === 'yes') { |
|
1155 | 1155 | ?> |
1156 | 1156 | <script type="text/javascript"> |
1157 | 1157 | jQuery(document).ready(function ($) { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | } |
1169 | 1169 | |
1170 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1170 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1171 | 1171 | |
1172 | 1172 | |
1173 | 1173 | /** |
@@ -1180,19 +1180,19 @@ discard block |
||
1180 | 1180 | * |
1181 | 1181 | * @return void |
1182 | 1182 | */ |
1183 | -function give_form_content( $form_id, $args ) { |
|
1183 | +function give_form_content($form_id, $args) { |
|
1184 | 1184 | |
1185 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1185 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1186 | 1186 | ? $args['show_content'] |
1187 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1187 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1188 | 1188 | |
1189 | - if ( $show_content !== 'none' ) { |
|
1189 | + if ($show_content !== 'none') { |
|
1190 | 1190 | //add action according to value |
1191 | - add_action( $show_content, 'give_form_display_content' ); |
|
1191 | + add_action($show_content, 'give_form_display_content'); |
|
1192 | 1192 | } |
1193 | 1193 | } |
1194 | 1194 | |
1195 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1195 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1196 | 1196 | |
1197 | 1197 | /** |
1198 | 1198 | * Show Give Goals |
@@ -1205,25 +1205,25 @@ discard block |
||
1205 | 1205 | * @return mixed |
1206 | 1206 | */ |
1207 | 1207 | |
1208 | -function give_show_goal_progress( $form_id, $args ) { |
|
1208 | +function give_show_goal_progress($form_id, $args) { |
|
1209 | 1209 | |
1210 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
1211 | - $form = new Give_Donate_Form( $form_id ); |
|
1210 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
1211 | + $form = new Give_Donate_Form($form_id); |
|
1212 | 1212 | $goal = $form->goal; |
1213 | - $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
1213 | + $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
1214 | 1214 | $income = $form->get_earnings(); |
1215 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
1216 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1217 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1215 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
1216 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1217 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1218 | 1218 | |
1219 | 1219 | //Sanity check - respect shortcode args |
1220 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
1220 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
1221 | 1221 | return false; |
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | //Sanity check - ensure form has goal set to output |
1225 | - if ( empty( $form->ID ) |
|
1226 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
1225 | + if (empty($form->ID) |
|
1226 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
1227 | 1227 | || $goal_option !== 'yes' |
1228 | 1228 | || $goal == 0 |
1229 | 1229 | ) { |
@@ -1231,26 +1231,26 @@ discard block |
||
1231 | 1231 | return false; |
1232 | 1232 | } |
1233 | 1233 | |
1234 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
1234 | + $progress = round(($income / $goal) * 100, 2); |
|
1235 | 1235 | |
1236 | - if ( $income > $goal ) { |
|
1236 | + if ($income > $goal) { |
|
1237 | 1237 | $progress = 100; |
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | $output = '<div class="give-goal-progress">'; |
1241 | 1241 | |
1242 | 1242 | //Goal Progress Text |
1243 | - if ( ! empty( $show_text ) ) { |
|
1243 | + if ( ! empty($show_text)) { |
|
1244 | 1244 | |
1245 | 1245 | $output .= '<div class="raised">'; |
1246 | 1246 | |
1247 | - if ( $goal_format !== 'percentage' ) { |
|
1247 | + if ($goal_format !== 'percentage') { |
|
1248 | 1248 | |
1249 | - $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>'; |
|
1249 | + $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>'; |
|
1250 | 1250 | |
1251 | - } elseif ( $goal_format == 'percentage' ) { |
|
1251 | + } elseif ($goal_format == 'percentage') { |
|
1252 | 1252 | |
1253 | - $output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>'; |
|
1253 | + $output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>'; |
|
1254 | 1254 | |
1255 | 1255 | } |
1256 | 1256 | |
@@ -1259,11 +1259,11 @@ discard block |
||
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | //Goal Progress Bar |
1262 | - if ( ! empty( $show_bar ) ) { |
|
1262 | + if ( ! empty($show_bar)) { |
|
1263 | 1263 | $output .= '<div class="give-progress-bar">'; |
1264 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
1265 | - if ( ! empty( $color ) ) { |
|
1266 | - $output .= 'background-color:' . $color; |
|
1264 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
1265 | + if ( ! empty($color)) { |
|
1266 | + $output .= 'background-color:'.$color; |
|
1267 | 1267 | } |
1268 | 1268 | $output .= '"></span>'; |
1269 | 1269 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1271,13 +1271,13 @@ discard block |
||
1271 | 1271 | |
1272 | 1272 | $output .= '</div><!-- /.goal-progress -->'; |
1273 | 1273 | |
1274 | - echo apply_filters( 'give_goal_output', $output ); |
|
1274 | + echo apply_filters('give_goal_output', $output); |
|
1275 | 1275 | |
1276 | 1276 | return false; |
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
1280 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1280 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1281 | 1281 | |
1282 | 1282 | /** |
1283 | 1283 | * Renders Post Form Content |
@@ -1289,17 +1289,17 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | * @since 1.0 |
1291 | 1291 | */ |
1292 | -function give_form_display_content( $form_id ) { |
|
1292 | +function give_form_display_content($form_id) { |
|
1293 | 1293 | |
1294 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1294 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1295 | 1295 | |
1296 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1297 | - $content = apply_filters( 'the_content', $content ); |
|
1296 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1297 | + $content = apply_filters('the_content', $content); |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1300 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1301 | 1301 | |
1302 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1302 | + echo apply_filters('give_form_content_output', $output); |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | |
@@ -1312,16 +1312,16 @@ discard block |
||
1312 | 1312 | * |
1313 | 1313 | * @return void |
1314 | 1314 | */ |
1315 | -function give_checkout_hidden_fields( $form_id ) { |
|
1315 | +function give_checkout_hidden_fields($form_id) { |
|
1316 | 1316 | |
1317 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1318 | - if ( is_user_logged_in() ) { ?> |
|
1317 | + do_action('give_hidden_fields_before', $form_id); |
|
1318 | + if (is_user_logged_in()) { ?> |
|
1319 | 1319 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1320 | 1320 | <?php } ?> |
1321 | 1321 | <input type="hidden" name="give_action" value="purchase"/> |
1322 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1322 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1323 | 1323 | <?php |
1324 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1324 | + do_action('give_hidden_fields_after', $form_id); |
|
1325 | 1325 | |
1326 | 1326 | } |
1327 | 1327 | |
@@ -1336,20 +1336,20 @@ discard block |
||
1336 | 1336 | * |
1337 | 1337 | * @return string $content Filtered content |
1338 | 1338 | */ |
1339 | -function give_filter_success_page_content( $content ) { |
|
1339 | +function give_filter_success_page_content($content) { |
|
1340 | 1340 | |
1341 | 1341 | global $give_options; |
1342 | 1342 | |
1343 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1344 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1345 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1343 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1344 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1345 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1346 | 1346 | } |
1347 | 1347 | } |
1348 | 1348 | |
1349 | 1349 | return $content; |
1350 | 1350 | } |
1351 | 1351 | |
1352 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1352 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1353 | 1353 | |
1354 | 1354 | |
1355 | 1355 | /** |
@@ -1361,14 +1361,14 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | function give_test_mode_frontend_warning() { |
1363 | 1363 | |
1364 | - $test_mode = give_get_option( 'test_mode' ); |
|
1364 | + $test_mode = give_get_option('test_mode'); |
|
1365 | 1365 | |
1366 | - if ( $test_mode == 'on' ) { |
|
1367 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
1366 | + if ($test_mode == 'on') { |
|
1367 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
1368 | 1368 | } |
1369 | 1369 | } |
1370 | 1370 | |
1371 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1371 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1372 | 1372 | |
1373 | 1373 | |
1374 | 1374 | /** |
@@ -1378,21 +1378,21 @@ discard block |
||
1378 | 1378 | * @since 1.4.1 |
1379 | 1379 | */ |
1380 | 1380 | |
1381 | -function give_members_only_form( $final_output, $args ) { |
|
1381 | +function give_members_only_form($final_output, $args) { |
|
1382 | 1382 | |
1383 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1383 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1384 | 1384 | |
1385 | 1385 | //Sanity Check: Must have form_id & not be logged in |
1386 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1386 | + if (empty($form_id) || is_user_logged_in()) { |
|
1387 | 1387 | return $final_output; |
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | //Logged in only and Register / Login set to none |
1391 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1391 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1392 | 1392 | |
1393 | - $final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false ); |
|
1393 | + $final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false); |
|
1394 | 1394 | |
1395 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1395 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1396 | 1396 | |
1397 | 1397 | } |
1398 | 1398 | |
@@ -1400,4 +1400,4 @@ discard block |
||
1400 | 1400 | |
1401 | 1401 | } |
1402 | 1402 | |
1403 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1404 | 1403 | \ No newline at end of file |
1404 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
1405 | 1405 | \ 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,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | global $typenow; |
25 | 25 | |
26 | - if ( $typenow != 'give_forms' && $typenow != 'give_campaigns' ) { |
|
26 | + if ($typenow != 'give_forms' && $typenow != 'give_campaigns') { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return int|false |
42 | 42 | */ |
43 | -function get_form_id_from_args( $args ) { |
|
43 | +function get_form_id_from_args($args) { |
|
44 | 44 | |
45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
46 | 46 | |
47 | - return intval( $args['form_id'] ); |
|
47 | + return intval($args['form_id']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | -function give_is_float_labels_enabled( $args ) { |
|
62 | +function give_is_float_labels_enabled($args) { |
|
63 | 63 | |
64 | 64 | $float_labels = ''; |
65 | 65 | |
66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
66 | + if ( ! empty($args['float_labels'])) { |
|
67 | 67 | $float_labels = $args['float_labels']; |
68 | 68 | } |
69 | 69 | |
70 | - if ( empty( $float_labels ) ) { |
|
71 | - $float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
70 | + if (empty($float_labels)) { |
|
71 | + $float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $float_labels ) ) { |
|
75 | - $float_labels = give_get_option( 'enable_floatlabels' ) ? 'enabled' : 'disabled'; |
|
74 | + if (empty($float_labels)) { |
|
75 | + $float_labels = give_get_option('enable_floatlabels') ? 'enabled' : 'disabled'; |
|
76 | 76 | } |
77 | 77 | |
78 | - return ( $float_labels == 'enabled' ) ? true : false; |
|
78 | + return ($float_labels == 'enabled') ? true : false; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $can_checkout = true; |
92 | 92 | |
93 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
93 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | function give_get_success_page_uri() { |
104 | 104 | global $give_options; |
105 | 105 | |
106 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
106 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
107 | 107 | |
108 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
108 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function give_is_success_page() { |
118 | 118 | global $give_options; |
119 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
119 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
120 | 120 | |
121 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
121 | + return apply_filters('give_is_success_page', $is_success_page); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | * @since 1.0 |
133 | 133 | * @return void |
134 | 134 | */ |
135 | -function give_send_to_success_page( $query_string = null ) { |
|
135 | +function give_send_to_success_page($query_string = null) { |
|
136 | 136 | |
137 | 137 | $redirect = give_get_success_page_uri(); |
138 | 138 | |
139 | - if ( $query_string ) { |
|
139 | + if ($query_string) { |
|
140 | 140 | $redirect .= $query_string; |
141 | 141 | } |
142 | 142 | |
143 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
143 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
144 | 144 | |
145 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
145 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
146 | 146 | give_die(); |
147 | 147 | } |
148 | 148 | |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | * @since 1.0 |
160 | 160 | * @return Void |
161 | 161 | */ |
162 | -function give_send_back_to_checkout( $args = array() ) { |
|
162 | +function give_send_back_to_checkout($args = array()) { |
|
163 | 163 | |
164 | - $redirect = ( isset( $_POST['give-current-url'] ) ) ? $_POST['give-current-url'] : ''; |
|
165 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : 0; |
|
164 | + $redirect = (isset($_POST['give-current-url'])) ? $_POST['give-current-url'] : ''; |
|
165 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : 0; |
|
166 | 166 | |
167 | 167 | $defaults = array( |
168 | 168 | 'form-id' => (int) $form_id |
169 | 169 | ); |
170 | 170 | |
171 | 171 | // Check for backward compatibility |
172 | - if ( is_string( $args ) ) { |
|
173 | - $args = str_replace( '?', '', $args ); |
|
172 | + if (is_string($args)) { |
|
173 | + $args = str_replace('?', '', $args); |
|
174 | 174 | } |
175 | 175 | |
176 | - $args = wp_parse_args( $args, $defaults ); |
|
176 | + $args = wp_parse_args($args, $defaults); |
|
177 | 177 | |
178 | - $redirect = add_query_arg( $args, $redirect ) . '#give-form-' . $form_id . '-wrap'; |
|
178 | + $redirect = add_query_arg($args, $redirect).'#give-form-'.$form_id.'-wrap'; |
|
179 | 179 | |
180 | - wp_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
180 | + wp_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
181 | 181 | give_die(); |
182 | 182 | } |
183 | 183 | |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | * @since 1.0 |
193 | 193 | * @return string |
194 | 194 | */ |
195 | -function give_get_success_page_url( $query_string = null ) { |
|
195 | +function give_get_success_page_url($query_string = null) { |
|
196 | 196 | global $give_options; |
197 | 197 | |
198 | - $success_page = get_permalink( $give_options['success_page'] ); |
|
199 | - if ( $query_string ) { |
|
198 | + $success_page = get_permalink($give_options['success_page']); |
|
199 | + if ($query_string) { |
|
200 | 200 | $success_page .= $query_string; |
201 | 201 | } |
202 | 202 | |
203 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
203 | + return apply_filters('give_success_page_url', $success_page); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return mixed|void Full URL to the Transaction Failed page, if present, home page if it doesn't exist |
215 | 215 | */ |
216 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
216 | +function give_get_failed_transaction_uri($extras = false) { |
|
217 | 217 | global $give_options; |
218 | 218 | |
219 | - $uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url(); |
|
220 | - if ( $extras ) { |
|
219 | + $uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
220 | + if ($extras) { |
|
221 | 221 | $uri .= $extras; |
222 | 222 | } |
223 | 223 | |
224 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
224 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | */ |
233 | 233 | function give_is_failed_transaction_page() { |
234 | 234 | global $give_options; |
235 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
235 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
236 | 236 | |
237 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
237 | + return apply_filters('give_is_failure_page', $ret); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | */ |
247 | 247 | function give_listen_for_failed_payments() { |
248 | 248 | |
249 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
249 | + $failed_page = give_get_option('failure_page', 0); |
|
250 | 250 | |
251 | - if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) { |
|
251 | + if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) { |
|
252 | 252 | |
253 | - $payment_id = absint( $_GET['payment-id'] ); |
|
254 | - give_update_payment_status( $payment_id, 'failed' ); |
|
253 | + $payment_id = absint($_GET['payment-id']); |
|
254 | + give_update_payment_status($payment_id, 'failed'); |
|
255 | 255 | |
256 | 256 | } |
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
260 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
261 | 261 | |
262 | 262 | |
263 | 263 | /** |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return bool |
272 | 272 | */ |
273 | -function give_field_is_required( $field = '', $form_id ) { |
|
273 | +function give_field_is_required($field = '', $form_id) { |
|
274 | 274 | |
275 | - $required_fields = give_purchase_form_required_fields( $form_id ); |
|
275 | + $required_fields = give_purchase_form_required_fields($form_id); |
|
276 | 276 | |
277 | - return array_key_exists( $field, $required_fields ); |
|
277 | + return array_key_exists($field, $required_fields); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | * @return array |
285 | 285 | */ |
286 | 286 | function give_get_banned_emails() { |
287 | - $emails = array_map( 'trim', give_get_option( 'banned_emails', array() ) ); |
|
287 | + $emails = array_map('trim', give_get_option('banned_emails', array())); |
|
288 | 288 | |
289 | - return apply_filters( 'give_get_banned_emails', $emails ); |
|
289 | + return apply_filters('give_get_banned_emails', $emails); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -295,15 +295,15 @@ discard block |
||
295 | 295 | * @since 2.0 |
296 | 296 | * @return bool |
297 | 297 | */ |
298 | -function give_is_email_banned( $email = '' ) { |
|
298 | +function give_is_email_banned($email = '') { |
|
299 | 299 | |
300 | - if ( empty( $email ) ) { |
|
300 | + if (empty($email)) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | |
304 | - $ret = in_array( trim( $email ), give_get_banned_emails() ); |
|
304 | + $ret = in_array(trim($email), give_get_banned_emails()); |
|
305 | 305 | |
306 | - return apply_filters( 'give_is_email_banned', $ret, $email ); |
|
306 | + return apply_filters('give_is_email_banned', $ret, $email); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | * @return bool True if enforce SSL is enabled, false otherwise |
314 | 314 | */ |
315 | 315 | function give_is_ssl_enforced() { |
316 | - $ssl_enforced = give_get_option( 'enforce_ssl', false ); |
|
316 | + $ssl_enforced = give_get_option('enforce_ssl', false); |
|
317 | 317 | |
318 | - return (bool) apply_filters( 'give_is_ssl_enforced', $ssl_enforced ); |
|
318 | + return (bool) apply_filters('give_is_ssl_enforced', $ssl_enforced); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -326,17 +326,17 @@ discard block |
||
326 | 326 | * @return void |
327 | 327 | */ |
328 | 328 | function give_enforced_ssl_redirect_handler() { |
329 | - if ( ! give_is_ssl_enforced() || is_admin() || is_ssl() ) { |
|
329 | + if ( ! give_is_ssl_enforced() || is_admin() || is_ssl()) { |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | |
333 | - if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) { |
|
333 | + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { |
|
334 | 334 | return; |
335 | 335 | } |
336 | 336 | |
337 | - $uri = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
337 | + $uri = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
338 | 338 | |
339 | - wp_safe_redirect( $uri ); |
|
339 | + wp_safe_redirect($uri); |
|
340 | 340 | exit; |
341 | 341 | } |
342 | 342 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @return void |
350 | 350 | */ |
351 | 351 | function give_enforced_ssl_asset_handler() { |
352 | - if ( ! give_is_ssl_enforced() || is_admin() ) { |
|
352 | + if ( ! give_is_ssl_enforced() || is_admin()) { |
|
353 | 353 | return; |
354 | 354 | } |
355 | 355 | |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | 'site_url' |
368 | 368 | ); |
369 | 369 | |
370 | - $filters = apply_filters( 'give_enforced_ssl_asset_filters', $filters ); |
|
370 | + $filters = apply_filters('give_enforced_ssl_asset_filters', $filters); |
|
371 | 371 | |
372 | - foreach ( $filters as $filter ) { |
|
373 | - add_filter( $filter, 'give_enforced_ssl_asset_filter', 1 ); |
|
372 | + foreach ($filters as $filter) { |
|
373 | + add_filter($filter, 'give_enforced_ssl_asset_filter', 1); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @return mixed |
387 | 387 | */ |
388 | -function give_enforced_ssl_asset_filter( $content ) { |
|
388 | +function give_enforced_ssl_asset_filter($content) { |
|
389 | 389 | |
390 | - if ( is_array( $content ) ) { |
|
390 | + if (is_array($content)) { |
|
391 | 391 | |
392 | - $content = array_map( 'give_enforced_ssl_asset_filter', $content ); |
|
392 | + $content = array_map('give_enforced_ssl_asset_filter', $content); |
|
393 | 393 | |
394 | 394 | } else { |
395 | 395 | |
@@ -436,14 +436,14 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @return void |
438 | 438 | */ |
439 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { |
|
439 | +function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) { |
|
440 | 440 | global $give_logs; |
441 | 441 | |
442 | 442 | $log_data = array( |
443 | 443 | 'post_parent' => $give_form_id, |
444 | 444 | 'log_type' => 'sale', |
445 | - 'post_date' => isset( $sale_date ) ? $sale_date : null, |
|
446 | - 'post_date_gmt' => isset( $sale_date ) ? $sale_date : null |
|
445 | + 'post_date' => isset($sale_date) ? $sale_date : null, |
|
446 | + 'post_date_gmt' => isset($sale_date) ? $sale_date : null |
|
447 | 447 | ); |
448 | 448 | |
449 | 449 | $log_meta = array( |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | 'price_id' => (int) $price_id |
452 | 452 | ); |
453 | 453 | |
454 | - $give_logs->insert_log( $log_data, $log_meta ); |
|
454 | + $give_logs->insert_log($log_data, $log_meta); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @return bool|int |
466 | 466 | */ |
467 | -function give_increase_purchase_count( $give_form_id = 0 ) { |
|
468 | - $form = new Give_Donate_Form( $give_form_id ); |
|
467 | +function give_increase_purchase_count($give_form_id = 0) { |
|
468 | + $form = new Give_Donate_Form($give_form_id); |
|
469 | 469 | |
470 | 470 | return $form->increase_sales(); |
471 | 471 | } |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return bool|int |
481 | 481 | */ |
482 | -function give_decrease_purchase_count( $give_form_id = 0 ) { |
|
483 | - $form = new Give_Donate_Form( $give_form_id ); |
|
482 | +function give_decrease_purchase_count($give_form_id = 0) { |
|
483 | + $form = new Give_Donate_Form($give_form_id); |
|
484 | 484 | |
485 | 485 | return $form->decrease_sales(); |
486 | 486 | } |
@@ -495,10 +495,10 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return bool|int |
497 | 497 | */ |
498 | -function give_increase_earnings( $give_form_id = 0, $amount ) { |
|
499 | - $form = new Give_Donate_Form( $give_form_id ); |
|
498 | +function give_increase_earnings($give_form_id = 0, $amount) { |
|
499 | + $form = new Give_Donate_Form($give_form_id); |
|
500 | 500 | |
501 | - return $form->increase_earnings( $amount ); |
|
501 | + return $form->increase_earnings($amount); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
@@ -511,10 +511,10 @@ discard block |
||
511 | 511 | * |
512 | 512 | * @return bool|int |
513 | 513 | */ |
514 | -function give_decrease_earnings( $give_form_id = 0, $amount ) { |
|
515 | - $form = new Give_Donate_Form( $give_form_id ); |
|
514 | +function give_decrease_earnings($give_form_id = 0, $amount) { |
|
515 | + $form = new Give_Donate_Form($give_form_id); |
|
516 | 516 | |
517 | - return $form->decrease_earnings( $amount ); |
|
517 | + return $form->decrease_earnings($amount); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | * |
528 | 528 | * @return int $earnings Earnings for a certain form |
529 | 529 | */ |
530 | -function give_get_form_earnings_stats( $give_form_id = 0 ) { |
|
531 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
530 | +function give_get_form_earnings_stats($give_form_id = 0) { |
|
531 | + $give_form = new Give_Donate_Form($give_form_id); |
|
532 | 532 | |
533 | 533 | return $give_form->earnings; |
534 | 534 | } |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @return int $sales Amount of sales for a certain form |
545 | 545 | */ |
546 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
547 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
546 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
547 | + $give_form = new Give_Donate_Form($give_form_id); |
|
548 | 548 | |
549 | 549 | return $give_form->sales; |
550 | 550 | } |
@@ -559,16 +559,16 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @return float $sales Average monthly sales |
561 | 561 | */ |
562 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
563 | - $sales = give_get_form_sales_stats( $form_id ); |
|
564 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
562 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
563 | + $sales = give_get_form_sales_stats($form_id); |
|
564 | + $release_date = get_post_field('post_date', $form_id); |
|
565 | 565 | |
566 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
566 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
567 | 567 | |
568 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
568 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
569 | 569 | |
570 | - if ( $months > 0 ) { |
|
571 | - $sales = ( $sales / $months ); |
|
570 | + if ($months > 0) { |
|
571 | + $sales = ($sales / $months); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | return $sales; |
@@ -584,16 +584,16 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @return float $earnings Average monthly earnings |
586 | 586 | */ |
587 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
588 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
589 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
587 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
588 | + $earnings = give_get_form_earnings_stats($form_id); |
|
589 | + $release_date = get_post_field('post_date', $form_id); |
|
590 | 590 | |
591 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
591 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
592 | 592 | |
593 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
593 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
594 | 594 | |
595 | - if ( $months > 0 ) { |
|
596 | - $earnings = ( $earnings / $months ); |
|
595 | + if ($months > 0) { |
|
596 | + $earnings = ($earnings / $months); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | return $earnings < 0 ? 0 : $earnings; |
@@ -613,21 +613,21 @@ discard block |
||
613 | 613 | * |
614 | 614 | * @return string $price_name Name of the price option |
615 | 615 | */ |
616 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) { |
|
616 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) { |
|
617 | 617 | |
618 | - $prices = give_get_variable_prices( $form_id ); |
|
618 | + $prices = give_get_variable_prices($form_id); |
|
619 | 619 | $price_name = ''; |
620 | 620 | |
621 | - foreach ( $prices as $price ) { |
|
621 | + foreach ($prices as $price) { |
|
622 | 622 | |
623 | - if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) { |
|
624 | - $price_name = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
623 | + if (intval($price['_give_id']['level_id']) == intval($price_id)) { |
|
624 | + $price_name = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | } |
628 | 628 | |
629 | 629 | |
630 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
630 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | |
@@ -640,14 +640,14 @@ discard block |
||
640 | 640 | * |
641 | 641 | * @return string $range A fully formatted price range |
642 | 642 | */ |
643 | -function give_price_range( $form_id = 0 ) { |
|
644 | - $low = give_get_lowest_price_option( $form_id ); |
|
645 | - $high = give_get_highest_price_option( $form_id ); |
|
646 | - $range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>'; |
|
643 | +function give_price_range($form_id = 0) { |
|
644 | + $low = give_get_lowest_price_option($form_id); |
|
645 | + $high = give_get_highest_price_option($form_id); |
|
646 | + $range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>'; |
|
647 | 647 | $range .= '<span class="give_price_range_sep"> – </span>'; |
648 | - $range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>'; |
|
648 | + $range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>'; |
|
649 | 649 | |
650 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
650 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | |
@@ -660,43 +660,43 @@ discard block |
||
660 | 660 | * |
661 | 661 | * @return float Amount of the lowest price |
662 | 662 | */ |
663 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
664 | - if ( empty( $form_id ) ) { |
|
663 | +function give_get_lowest_price_option($form_id = 0) { |
|
664 | + if (empty($form_id)) { |
|
665 | 665 | $form_id = get_the_ID(); |
666 | 666 | } |
667 | 667 | |
668 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
669 | - return give_get_form_price( $form_id ); |
|
668 | + if ( ! give_has_variable_prices($form_id)) { |
|
669 | + return give_get_form_price($form_id); |
|
670 | 670 | } |
671 | 671 | |
672 | - $prices = give_get_variable_prices( $form_id ); |
|
672 | + $prices = give_get_variable_prices($form_id); |
|
673 | 673 | |
674 | 674 | $low = 0.00; |
675 | 675 | |
676 | - if ( ! empty( $prices ) ) { |
|
676 | + if ( ! empty($prices)) { |
|
677 | 677 | |
678 | - foreach ( $prices as $key => $price ) { |
|
678 | + foreach ($prices as $key => $price) { |
|
679 | 679 | |
680 | - if ( empty( $price['_give_amount'] ) ) { |
|
680 | + if (empty($price['_give_amount'])) { |
|
681 | 681 | continue; |
682 | 682 | } |
683 | 683 | |
684 | - if ( ! isset( $min ) ) { |
|
684 | + if ( ! isset($min)) { |
|
685 | 685 | $min = $price['_give_amount']; |
686 | 686 | } else { |
687 | - $min = min( $min, give_sanitize_amount( $price['_give_amount'] ) ); |
|
687 | + $min = min($min, give_sanitize_amount($price['_give_amount'])); |
|
688 | 688 | } |
689 | 689 | |
690 | - if ( $price['_give_amount'] == $min ) { |
|
690 | + if ($price['_give_amount'] == $min) { |
|
691 | 691 | $min_id = $key; |
692 | 692 | } |
693 | 693 | } |
694 | 694 | |
695 | - $low = $prices[ $min_id ]['_give_amount']; |
|
695 | + $low = $prices[$min_id]['_give_amount']; |
|
696 | 696 | |
697 | 697 | } |
698 | 698 | |
699 | - return give_sanitize_amount( $low ); |
|
699 | + return give_sanitize_amount($low); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
@@ -708,41 +708,41 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return float Amount of the highest price |
710 | 710 | */ |
711 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
711 | +function give_get_highest_price_option($form_id = 0) { |
|
712 | 712 | |
713 | - if ( empty( $form_id ) ) { |
|
713 | + if (empty($form_id)) { |
|
714 | 714 | $form_id = get_the_ID(); |
715 | 715 | } |
716 | 716 | |
717 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
718 | - return give_get_form_price( $form_id ); |
|
717 | + if ( ! give_has_variable_prices($form_id)) { |
|
718 | + return give_get_form_price($form_id); |
|
719 | 719 | } |
720 | 720 | |
721 | - $prices = give_get_variable_prices( $form_id ); |
|
721 | + $prices = give_get_variable_prices($form_id); |
|
722 | 722 | |
723 | 723 | $high = 0.00; |
724 | 724 | |
725 | - if ( ! empty( $prices ) ) { |
|
725 | + if ( ! empty($prices)) { |
|
726 | 726 | |
727 | 727 | $max = 0; |
728 | 728 | |
729 | - foreach ( $prices as $key => $price ) { |
|
730 | - if ( empty( $price['_give_amount'] ) ) { |
|
729 | + foreach ($prices as $key => $price) { |
|
730 | + if (empty($price['_give_amount'])) { |
|
731 | 731 | continue; |
732 | 732 | } |
733 | - $give_amount = give_sanitize_amount( $price['_give_amount'] ); |
|
733 | + $give_amount = give_sanitize_amount($price['_give_amount']); |
|
734 | 734 | |
735 | - $max = max( $max, $give_amount ); |
|
735 | + $max = max($max, $give_amount); |
|
736 | 736 | |
737 | - if ( $give_amount == $max ) { |
|
737 | + if ($give_amount == $max) { |
|
738 | 738 | $max_id = $key; |
739 | 739 | } |
740 | 740 | } |
741 | 741 | |
742 | - $high = $prices[ $max_id ]['_give_amount']; |
|
742 | + $high = $prices[$max_id]['_give_amount']; |
|
743 | 743 | } |
744 | 744 | |
745 | - return give_sanitize_amount( $high ); |
|
745 | + return give_sanitize_amount($high); |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | /** |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | * |
755 | 755 | * @return mixed string|int Price of the form |
756 | 756 | */ |
757 | -function give_get_form_price( $form_id = 0 ) { |
|
757 | +function give_get_form_price($form_id = 0) { |
|
758 | 758 | |
759 | - if ( empty( $form_id ) ) { |
|
759 | + if (empty($form_id)) { |
|
760 | 760 | return false; |
761 | 761 | } |
762 | 762 | |
763 | - $form = new Give_Donate_Form( $form_id ); |
|
763 | + $form = new Give_Donate_Form($form_id); |
|
764 | 764 | |
765 | - return $form->__get( 'price' ); |
|
765 | + return $form->__get('price'); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -774,15 +774,15 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @return mixed string|int Minimum price of the form |
776 | 776 | */ |
777 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
777 | +function give_get_form_minimum_price($form_id = 0) { |
|
778 | 778 | |
779 | - if ( empty( $form_id ) ) { |
|
779 | + if (empty($form_id)) { |
|
780 | 780 | return false; |
781 | 781 | } |
782 | 782 | |
783 | - $form = new Give_Donate_Form( $form_id ); |
|
783 | + $form = new Give_Donate_Form($form_id); |
|
784 | 784 | |
785 | - return $form->__get( 'minimum_price' ); |
|
785 | + return $form->__get('minimum_price'); |
|
786 | 786 | |
787 | 787 | } |
788 | 788 | |
@@ -797,52 +797,52 @@ discard block |
||
797 | 797 | * |
798 | 798 | * @return int $formatted_price |
799 | 799 | */ |
800 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
800 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
801 | 801 | |
802 | - if ( empty( $form_id ) ) { |
|
802 | + if (empty($form_id)) { |
|
803 | 803 | $form_id = get_the_ID(); |
804 | 804 | } |
805 | 805 | |
806 | - if ( give_has_variable_prices( $form_id ) ) { |
|
806 | + if (give_has_variable_prices($form_id)) { |
|
807 | 807 | |
808 | - $prices = give_get_variable_prices( $form_id ); |
|
808 | + $prices = give_get_variable_prices($form_id); |
|
809 | 809 | |
810 | - if ( false !== $price_id ) { |
|
810 | + if (false !== $price_id) { |
|
811 | 811 | |
812 | 812 | //loop through multi-prices to see which is default |
813 | - foreach ( $prices as $price ) { |
|
813 | + foreach ($prices as $price) { |
|
814 | 814 | //this is the default price |
815 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
815 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
816 | 816 | $price = (float) $price['_give_amount']; |
817 | 817 | }; |
818 | 818 | } |
819 | 819 | |
820 | 820 | } else { |
821 | 821 | |
822 | - $price = give_get_lowest_price_option( $form_id ); |
|
822 | + $price = give_get_lowest_price_option($form_id); |
|
823 | 823 | } |
824 | 824 | |
825 | - $price = give_sanitize_amount( $price ); |
|
825 | + $price = give_sanitize_amount($price); |
|
826 | 826 | |
827 | 827 | } else { |
828 | 828 | |
829 | - $price = give_get_form_price( $form_id ); |
|
829 | + $price = give_get_form_price($form_id); |
|
830 | 830 | |
831 | 831 | } |
832 | 832 | |
833 | - $price = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id ); |
|
834 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
835 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
833 | + $price = apply_filters('give_form_price', give_sanitize_amount($price), $form_id); |
|
834 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
835 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
836 | 836 | |
837 | - if ( $echo ) { |
|
837 | + if ($echo) { |
|
838 | 838 | echo $formatted_price; |
839 | 839 | } else { |
840 | 840 | return $formatted_price; |
841 | 841 | } |
842 | 842 | } |
843 | 843 | |
844 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
845 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
844 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
845 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
846 | 846 | |
847 | 847 | |
848 | 848 | /** |
@@ -856,18 +856,18 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @return float $amount Amount of the price option |
858 | 858 | */ |
859 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
860 | - $prices = give_get_variable_prices( $form_id ); |
|
859 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
860 | + $prices = give_get_variable_prices($form_id); |
|
861 | 861 | |
862 | 862 | $amount = 0.00; |
863 | 863 | |
864 | - foreach ( $prices as $price ) { |
|
865 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] === $price_id ) { |
|
866 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
864 | + foreach ($prices as $price) { |
|
865 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] === $price_id) { |
|
866 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
867 | 867 | }; |
868 | 868 | } |
869 | 869 | |
870 | - return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id ); |
|
870 | + return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | /** |
@@ -879,13 +879,13 @@ discard block |
||
879 | 879 | * |
880 | 880 | * @return mixed string|int Goal of the form |
881 | 881 | */ |
882 | -function give_get_form_goal( $form_id = 0 ) { |
|
882 | +function give_get_form_goal($form_id = 0) { |
|
883 | 883 | |
884 | - if ( empty( $form_id ) ) { |
|
884 | + if (empty($form_id)) { |
|
885 | 885 | return false; |
886 | 886 | } |
887 | 887 | |
888 | - $form = new Give_Donate_Form( $form_id ); |
|
888 | + $form = new Give_Donate_Form($form_id); |
|
889 | 889 | |
890 | 890 | return $form->goal; |
891 | 891 | |
@@ -901,27 +901,27 @@ discard block |
||
901 | 901 | * |
902 | 902 | * @return string $formatted_goal |
903 | 903 | */ |
904 | -function give_goal( $form_id = 0, $echo = true ) { |
|
904 | +function give_goal($form_id = 0, $echo = true) { |
|
905 | 905 | |
906 | - if ( empty( $form_id ) ) { |
|
906 | + if (empty($form_id)) { |
|
907 | 907 | $form_id = get_the_ID(); |
908 | 908 | } |
909 | 909 | |
910 | - $goal = give_get_form_goal( $form_id ); |
|
910 | + $goal = give_get_form_goal($form_id); |
|
911 | 911 | |
912 | - $goal = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id ); |
|
913 | - $formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>'; |
|
914 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
912 | + $goal = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id); |
|
913 | + $formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>'; |
|
914 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
915 | 915 | |
916 | - if ( $echo ) { |
|
916 | + if ($echo) { |
|
917 | 917 | echo $formatted_goal; |
918 | 918 | } else { |
919 | 919 | return $formatted_goal; |
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
923 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
924 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
923 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
924 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
925 | 925 | |
926 | 926 | |
927 | 927 | /** |
@@ -931,13 +931,13 @@ discard block |
||
931 | 931 | * @global $give_options |
932 | 932 | * @return bool $ret Whether or not the logged_in_only setting is set |
933 | 933 | */ |
934 | -function give_logged_in_only( $form_id ) { |
|
934 | +function give_logged_in_only($form_id) { |
|
935 | 935 | |
936 | - $form_option = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
936 | + $form_option = get_post_meta($form_id, '_give_logged_in_only', true); |
|
937 | 937 | |
938 | - $ret = ! empty( $form_option ) ? $form_option : false; |
|
938 | + $ret = ! empty($form_option) ? $form_option : false; |
|
939 | 939 | |
940 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
940 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
941 | 941 | |
942 | 942 | } |
943 | 943 | |
@@ -949,10 +949,10 @@ discard block |
||
949 | 949 | * |
950 | 950 | * @param $form_id |
951 | 951 | */ |
952 | -function give_show_login_register_option( $form_id ) { |
|
952 | +function give_show_login_register_option($form_id) { |
|
953 | 953 | |
954 | - $show_register_form = get_post_meta( $form_id, '_give_show_register_form', true ); |
|
954 | + $show_register_form = get_post_meta($form_id, '_give_show_register_form', true); |
|
955 | 955 | |
956 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id); |
|
956 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
957 | 957 | |
958 | 958 | } |
959 | 959 | \ 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 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | function give_is_test_mode() { |
25 | 25 | global $give_options; |
26 | 26 | |
27 | - $ret = ! empty( $give_options['test_mode'] ); |
|
27 | + $ret = ! empty($give_options['test_mode']); |
|
28 | 28 | |
29 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
29 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function give_get_currency() { |
39 | 39 | global $give_options; |
40 | - $currency = isset( $give_options['currency'] ) ? $give_options['currency'] : 'USD'; |
|
40 | + $currency = isset($give_options['currency']) ? $give_options['currency'] : 'USD'; |
|
41 | 41 | |
42 | - return apply_filters( 'give_currency', $currency ); |
|
42 | + return apply_filters('give_currency', $currency); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function give_get_currency_position() { |
53 | 53 | global $give_options; |
54 | - $currency_pos = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
54 | + $currency_pos = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
55 | 55 | |
56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
56 | + return apply_filters('give_currency_position', $currency_pos); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -65,36 +65,36 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function give_get_currencies() { |
67 | 67 | $currencies = array( |
68 | - 'USD' => __( 'US Dollars ($)', 'give' ), |
|
69 | - 'EUR' => __( 'Euros (€)', 'give' ), |
|
70 | - 'GBP' => __( 'Pounds Sterling (£)', 'give' ), |
|
71 | - 'AUD' => __( 'Australian Dollars ($)', 'give' ), |
|
72 | - 'BRL' => __( 'Brazilian Real (R$)', 'give' ), |
|
73 | - 'CAD' => __( 'Canadian Dollars ($)', 'give' ), |
|
74 | - 'CZK' => __( 'Czech Koruna (Kč)', 'give' ), |
|
75 | - 'DKK' => __( 'Danish Krone (kr)', 'give' ), |
|
76 | - 'HKD' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
77 | - 'HUF' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
78 | - 'ILS' => __( 'Israeli Shekel (₪)', 'give' ), |
|
79 | - 'JPY' => __( 'Japanese Yen (¥)', 'give' ), |
|
80 | - 'MYR' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
81 | - 'MXN' => __( 'Mexican Peso ($)', 'give' ), |
|
82 | - 'NZD' => __( 'New Zealand Dollar ($)', 'give' ), |
|
83 | - 'NOK' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
84 | - 'PHP' => __( 'Philippine Pesos (₱)', 'give' ), |
|
85 | - 'PLN' => __( 'Polish Zloty (zł)', 'give' ), |
|
86 | - 'SGD' => __( 'Singapore Dollar ($)', 'give' ), |
|
87 | - 'SEK' => __( 'Swedish Krona (kr)', 'give' ), |
|
88 | - 'CHF' => __( 'Swiss Franc (CHF)', 'give' ), |
|
89 | - 'TWD' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
90 | - 'THB' => __( 'Thai Baht (฿)', 'give' ), |
|
91 | - 'INR' => __( 'Indian Rupee (₹)', 'give' ), |
|
92 | - 'TRY' => __( 'Turkish Lira (₺)', 'give' ), |
|
93 | - 'RIAL' => __( 'Iranian Rial (﷼)', 'give' ), |
|
94 | - 'RUB' => __( 'Russian Rubles (руб)', 'give' ) |
|
68 | + 'USD' => __('US Dollars ($)', 'give'), |
|
69 | + 'EUR' => __('Euros (€)', 'give'), |
|
70 | + 'GBP' => __('Pounds Sterling (£)', 'give'), |
|
71 | + 'AUD' => __('Australian Dollars ($)', 'give'), |
|
72 | + 'BRL' => __('Brazilian Real (R$)', 'give'), |
|
73 | + 'CAD' => __('Canadian Dollars ($)', 'give'), |
|
74 | + 'CZK' => __('Czech Koruna (Kč)', 'give'), |
|
75 | + 'DKK' => __('Danish Krone (kr)', 'give'), |
|
76 | + 'HKD' => __('Hong Kong Dollar ($)', 'give'), |
|
77 | + 'HUF' => __('Hungarian Forint (Ft)', 'give'), |
|
78 | + 'ILS' => __('Israeli Shekel (₪)', 'give'), |
|
79 | + 'JPY' => __('Japanese Yen (¥)', 'give'), |
|
80 | + 'MYR' => __('Malaysian Ringgits (RM)', 'give'), |
|
81 | + 'MXN' => __('Mexican Peso ($)', 'give'), |
|
82 | + 'NZD' => __('New Zealand Dollar ($)', 'give'), |
|
83 | + 'NOK' => __('Norwegian Krone (Kr.)', 'give'), |
|
84 | + 'PHP' => __('Philippine Pesos (₱)', 'give'), |
|
85 | + 'PLN' => __('Polish Zloty (zł)', 'give'), |
|
86 | + 'SGD' => __('Singapore Dollar ($)', 'give'), |
|
87 | + 'SEK' => __('Swedish Krona (kr)', 'give'), |
|
88 | + 'CHF' => __('Swiss Franc (CHF)', 'give'), |
|
89 | + 'TWD' => __('Taiwan New Dollars (NT$)', 'give'), |
|
90 | + 'THB' => __('Thai Baht (฿)', 'give'), |
|
91 | + 'INR' => __('Indian Rupee (₹)', 'give'), |
|
92 | + 'TRY' => __('Turkish Lira (₺)', 'give'), |
|
93 | + 'RIAL' => __('Iranian Rial (﷼)', 'give'), |
|
94 | + 'RUB' => __('Russian Rubles (руб)', 'give') |
|
95 | 95 | ); |
96 | 96 | |
97 | - return apply_filters( 'give_currencies', $currencies ); |
|
97 | + return apply_filters('give_currencies', $currencies); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string The symbol to use for the currency |
111 | 111 | */ |
112 | -function give_currency_symbol( $currency = '' ) { |
|
112 | +function give_currency_symbol($currency = '') { |
|
113 | 113 | |
114 | - if ( empty( $currency ) ) { |
|
114 | + if (empty($currency)) { |
|
115 | 115 | $currency = give_get_currency(); |
116 | 116 | } |
117 | - switch ( $currency ) : |
|
117 | + switch ($currency) : |
|
118 | 118 | case 'GBP' : |
119 | 119 | $symbol = '£'; |
120 | 120 | break; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | break; |
184 | 184 | endswitch; |
185 | 185 | |
186 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
186 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function give_get_current_page_url() { |
197 | 197 | |
198 | - if ( is_front_page() ) { |
|
199 | - $current_url = home_url( '/' ); |
|
198 | + if (is_front_page()) { |
|
199 | + $current_url = home_url('/'); |
|
200 | 200 | } else { |
201 | - $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
201 | + $current_url = (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
202 | 202 | } |
203 | 203 | |
204 | - return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) ); |
|
204 | + return apply_filters('give_get_current_page_url', esc_url($current_url)); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | */ |
223 | 223 | $gateways = give_get_enabled_payment_gateways(); |
224 | 224 | |
225 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
225 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
226 | 226 | $ret = true; |
227 | - } else if ( count( $gateways ) == 1 ) { |
|
227 | + } else if (count($gateways) == 1) { |
|
228 | 228 | $ret = false; |
229 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
229 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
230 | 230 | $ret = false; |
231 | 231 | } |
232 | 232 | |
233 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
233 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | function give_get_timezone_id() { |
243 | 243 | |
244 | 244 | // if site timezone string exists, return it |
245 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
245 | + if ($timezone = get_option('timezone_string')) { |
|
246 | 246 | return $timezone; |
247 | 247 | } |
248 | 248 | |
249 | 249 | // get UTC offset, if it isn't set return UTC |
250 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
250 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
251 | 251 | return 'UTC'; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // attempt to guess the timezone string from the UTC offset |
255 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
255 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
256 | 256 | |
257 | 257 | // last try, guess timezone string manually |
258 | - if ( $timezone === false ) { |
|
258 | + if ($timezone === false) { |
|
259 | 259 | |
260 | - $is_dst = date( 'I' ); |
|
260 | + $is_dst = date('I'); |
|
261 | 261 | |
262 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
263 | - foreach ( $abbr as $city ) { |
|
264 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
262 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
263 | + foreach ($abbr as $city) { |
|
264 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
265 | 265 | return $city['timezone_id']; |
266 | 266 | } |
267 | 267 | } |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | |
286 | 286 | $ip = '127.0.0.1'; |
287 | 287 | |
288 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
288 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
289 | 289 | //check ip from share internet |
290 | 290 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
291 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
291 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
292 | 292 | //to check ip is pass from proxy |
293 | 293 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
294 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
294 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
295 | 295 | $ip = $_SERVER['REMOTE_ADDR']; |
296 | 296 | } |
297 | 297 | |
298 | - return apply_filters( 'give_get_ip', $ip ); |
|
298 | + return apply_filters('give_get_ip', $ip); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @uses Give()->session->set() |
312 | 312 | */ |
313 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
314 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
313 | +function give_set_purchase_session($purchase_data = array()) { |
|
314 | + Give()->session->set('give_purchase', $purchase_data); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @return mixed array | false |
326 | 326 | */ |
327 | 327 | function give_get_purchase_session() { |
328 | - return Give()->session->get( 'give_purchase' ); |
|
328 | + return Give()->session->get('give_purchase'); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return string |
342 | 342 | */ |
343 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
343 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
344 | 344 | $summary = ''; |
345 | 345 | |
346 | - if ( $email ) { |
|
347 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
346 | + if ($email) { |
|
347 | + $summary .= $purchase_data['user_email'].' - '; |
|
348 | 348 | } |
349 | 349 | |
350 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
350 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
351 | 351 | |
352 | 352 | return $summary; |
353 | 353 | } |
@@ -364,31 +364,31 @@ discard block |
||
364 | 364 | function give_get_host() { |
365 | 365 | $host = false; |
366 | 366 | |
367 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
367 | + if (defined('WPE_APIKEY')) { |
|
368 | 368 | $host = 'WP Engine'; |
369 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
369 | + } elseif (defined('PAGELYBIN')) { |
|
370 | 370 | $host = 'Pagely'; |
371 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
371 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
372 | 372 | $host = 'ICDSoft'; |
373 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
373 | + } elseif (DB_HOST == 'mysqlv5') { |
|
374 | 374 | $host = 'NetworkSolutions'; |
375 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
375 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
376 | 376 | $host = 'iPage'; |
377 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
377 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
378 | 378 | $host = 'IPower'; |
379 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
379 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
380 | 380 | $host = 'MediaTemple Grid'; |
381 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
381 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
382 | 382 | $host = 'pair Networks'; |
383 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
383 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
384 | 384 | $host = 'Rackspace Cloud'; |
385 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
385 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
386 | 386 | $host = 'SysFix.eu Power Hosting'; |
387 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
387 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
388 | 388 | $host = 'Flywheel'; |
389 | 389 | } else { |
390 | 390 | // Adding a general fallback for data gathering |
391 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
391 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | return $host; |
@@ -404,67 +404,67 @@ discard block |
||
404 | 404 | * |
405 | 405 | * @return bool true if host matches, false if not |
406 | 406 | */ |
407 | -function give_is_host( $host = false ) { |
|
407 | +function give_is_host($host = false) { |
|
408 | 408 | |
409 | 409 | $return = false; |
410 | 410 | |
411 | - if ( $host ) { |
|
412 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
411 | + if ($host) { |
|
412 | + $host = str_replace(' ', '', strtolower($host)); |
|
413 | 413 | |
414 | - switch ( $host ) { |
|
414 | + switch ($host) { |
|
415 | 415 | case 'wpengine': |
416 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
416 | + if (defined('WPE_APIKEY')) { |
|
417 | 417 | $return = true; |
418 | 418 | } |
419 | 419 | break; |
420 | 420 | case 'pagely': |
421 | - if ( defined( 'PAGELYBIN' ) ) { |
|
421 | + if (defined('PAGELYBIN')) { |
|
422 | 422 | $return = true; |
423 | 423 | } |
424 | 424 | break; |
425 | 425 | case 'icdsoft': |
426 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
426 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
427 | 427 | $return = true; |
428 | 428 | } |
429 | 429 | break; |
430 | 430 | case 'networksolutions': |
431 | - if ( DB_HOST == 'mysqlv5' ) { |
|
431 | + if (DB_HOST == 'mysqlv5') { |
|
432 | 432 | $return = true; |
433 | 433 | } |
434 | 434 | break; |
435 | 435 | case 'ipage': |
436 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
436 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
437 | 437 | $return = true; |
438 | 438 | } |
439 | 439 | break; |
440 | 440 | case 'ipower': |
441 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
441 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
442 | 442 | $return = true; |
443 | 443 | } |
444 | 444 | break; |
445 | 445 | case 'mediatemplegrid': |
446 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
446 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
447 | 447 | $return = true; |
448 | 448 | } |
449 | 449 | break; |
450 | 450 | case 'pairnetworks': |
451 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
451 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
452 | 452 | $return = true; |
453 | 453 | } |
454 | 454 | break; |
455 | 455 | case 'rackspacecloud': |
456 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
456 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
457 | 457 | $return = true; |
458 | 458 | } |
459 | 459 | break; |
460 | 460 | case 'sysfix.eu': |
461 | 461 | case 'sysfix.eupowerhosting': |
462 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
462 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
463 | 463 | $return = true; |
464 | 464 | } |
465 | 465 | break; |
466 | 466 | case 'flywheel': |
467 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
467 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
468 | 468 | $return = true; |
469 | 469 | } |
470 | 470 | break; |
@@ -497,20 +497,20 @@ discard block |
||
497 | 497 | * @param string $replacement Optional. The function that should have been called |
498 | 498 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function |
499 | 499 | */ |
500 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
501 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
500 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
501 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
502 | 502 | |
503 | - $show_errors = current_user_can( 'manage_options' ); |
|
503 | + $show_errors = current_user_can('manage_options'); |
|
504 | 504 | |
505 | 505 | // Allow plugin to filter the output error trigger |
506 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
507 | - if ( ! is_null( $replacement ) ) { |
|
508 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
509 | - 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. |
|
506 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
507 | + if ( ! is_null($replacement)) { |
|
508 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
509 | + 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. |
|
510 | 510 | // Alternatively we could dump this to a file. |
511 | 511 | } else { |
512 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
513 | - 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. |
|
512 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
513 | + 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. |
|
514 | 514 | // Alternatively we could dump this to a file. |
515 | 515 | } |
516 | 516 | } |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * @return string $post_id |
525 | 525 | */ |
526 | 526 | function give_get_admin_post_id() { |
527 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
528 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
527 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
528 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
529 | 529 | $post_id = $_POST['post_id']; |
530 | 530 | } |
531 | 531 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @return string Arg separator output |
540 | 540 | */ |
541 | 541 | function give_get_php_arg_separator_output() { |
542 | - return ini_get( 'arg_separator.output' ); |
|
542 | + return ini_get('arg_separator.output'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -554,10 +554,10 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @return string Short month name |
556 | 556 | */ |
557 | -function give_month_num_to_name( $n ) { |
|
558 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
557 | +function give_month_num_to_name($n) { |
|
558 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
559 | 559 | |
560 | - return date_i18n( "M", $timestamp ); |
|
560 | + return date_i18n("M", $timestamp); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -570,10 +570,10 @@ discard block |
||
570 | 570 | * |
571 | 571 | * @return bool Whether or not function is disabled. |
572 | 572 | */ |
573 | -function give_is_func_disabled( $function ) { |
|
574 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
573 | +function give_is_func_disabled($function) { |
|
574 | + $disabled = explode(',', ini_get('disable_functions')); |
|
575 | 575 | |
576 | - return in_array( $function, $disabled ); |
|
576 | + return in_array($function, $disabled); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | |
589 | 589 | <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> |
590 | 590 | <div class="give-newsletter-confirmation"> |
591 | - <p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
591 | + <p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
592 | 592 | </div> |
593 | 593 | |
594 | 594 | <table class="form-table give-newsletter-form"> |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * |
685 | 685 | * @return mixed |
686 | 686 | */ |
687 | -function give_svg_icons( $icon ) { |
|
687 | +function give_svg_icons($icon) { |
|
688 | 688 | |
689 | 689 | // Store your SVGs in an associative array |
690 | 690 | $svgs = array( |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | ); |
697 | 697 | |
698 | 698 | // Return the chosen icon's SVG string |
699 | - return $svgs[ $icon ]; |
|
699 | + return $svgs[$icon]; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
@@ -708,15 +708,15 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return mixed |
710 | 710 | */ |
711 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
712 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
711 | +function modify_nav_menu_meta_box_object($post_type) { |
|
712 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
713 | 713 | $post_type->labels->name = 'Donation Forms'; |
714 | 714 | } |
715 | 715 | |
716 | 716 | return $post_type; |
717 | 717 | } |
718 | 718 | |
719 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
719 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
720 | 720 | |
721 | 721 | |
722 | 722 | /** |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | * @license http://opensource.org/licenses/MIT MIT |
730 | 730 | */ |
731 | 731 | |
732 | -if ( ! function_exists( 'array_column' ) ) { |
|
732 | +if ( ! function_exists('array_column')) { |
|
733 | 733 | /** |
734 | 734 | * Returns the values from a single column of the input array, identified by |
735 | 735 | * the $columnKey. |
@@ -748,56 +748,56 @@ discard block |
||
748 | 748 | * |
749 | 749 | * @return array |
750 | 750 | */ |
751 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
751 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
752 | 752 | // Using func_get_args() in order to check for proper number of |
753 | 753 | // parameters and trigger errors exactly as the built-in array_column() |
754 | 754 | // does in PHP 5.5. |
755 | 755 | $argc = func_num_args(); |
756 | 756 | $params = func_get_args(); |
757 | 757 | |
758 | - if ( $argc < 2 ) { |
|
759 | - trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING ); |
|
758 | + if ($argc < 2) { |
|
759 | + trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING); |
|
760 | 760 | |
761 | 761 | return null; |
762 | 762 | } |
763 | 763 | |
764 | - if ( ! is_array( $params[0] ) ) { |
|
764 | + if ( ! is_array($params[0])) { |
|
765 | 765 | trigger_error( |
766 | - 'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given', |
|
766 | + 'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given', |
|
767 | 767 | E_USER_WARNING |
768 | 768 | ); |
769 | 769 | |
770 | 770 | return null; |
771 | 771 | } |
772 | 772 | |
773 | - if ( ! is_int( $params[1] ) |
|
774 | - && ! is_float( $params[1] ) |
|
775 | - && ! is_string( $params[1] ) |
|
773 | + if ( ! is_int($params[1]) |
|
774 | + && ! is_float($params[1]) |
|
775 | + && ! is_string($params[1]) |
|
776 | 776 | && $params[1] !== null |
777 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
777 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
778 | 778 | ) { |
779 | - trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
|
779 | + trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
|
780 | 780 | |
781 | 781 | return false; |
782 | 782 | } |
783 | 783 | |
784 | - if ( isset( $params[2] ) |
|
785 | - && ! is_int( $params[2] ) |
|
786 | - && ! is_float( $params[2] ) |
|
787 | - && ! is_string( $params[2] ) |
|
788 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
784 | + if (isset($params[2]) |
|
785 | + && ! is_int($params[2]) |
|
786 | + && ! is_float($params[2]) |
|
787 | + && ! is_string($params[2]) |
|
788 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
789 | 789 | ) { |
790 | - trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
|
790 | + trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
|
791 | 791 | |
792 | 792 | return false; |
793 | 793 | } |
794 | 794 | |
795 | 795 | $paramsInput = $params[0]; |
796 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
796 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
797 | 797 | |
798 | 798 | $paramsIndexKey = null; |
799 | - if ( isset( $params[2] ) ) { |
|
800 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
799 | + if (isset($params[2])) { |
|
800 | + if (is_float($params[2]) || is_int($params[2])) { |
|
801 | 801 | $paramsIndexKey = (int) $params[2]; |
802 | 802 | } else { |
803 | 803 | $paramsIndexKey = (string) $params[2]; |
@@ -806,26 +806,26 @@ discard block |
||
806 | 806 | |
807 | 807 | $resultArray = array(); |
808 | 808 | |
809 | - foreach ( $paramsInput as $row ) { |
|
809 | + foreach ($paramsInput as $row) { |
|
810 | 810 | $key = $value = null; |
811 | 811 | $keySet = $valueSet = false; |
812 | 812 | |
813 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
813 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
814 | 814 | $keySet = true; |
815 | - $key = (string) $row[ $paramsIndexKey ]; |
|
815 | + $key = (string) $row[$paramsIndexKey]; |
|
816 | 816 | } |
817 | 817 | |
818 | - if ( $paramsColumnKey === null ) { |
|
818 | + if ($paramsColumnKey === null) { |
|
819 | 819 | $valueSet = true; |
820 | 820 | $value = $row; |
821 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
821 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
822 | 822 | $valueSet = true; |
823 | - $value = $row[ $paramsColumnKey ]; |
|
823 | + $value = $row[$paramsColumnKey]; |
|
824 | 824 | } |
825 | 825 | |
826 | - if ( $valueSet ) { |
|
827 | - if ( $keySet ) { |
|
828 | - $resultArray[ $key ] = $value; |
|
826 | + if ($valueSet) { |
|
827 | + if ($keySet) { |
|
828 | + $resultArray[$key] = $value; |
|
829 | 829 | } else { |
830 | 830 | $resultArray[] = $value; |
831 | 831 | } |
@@ -847,39 +847,39 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @return bool Whether the receipt is visible or not. |
849 | 849 | */ |
850 | -function give_can_view_receipt( $payment_key = '' ) { |
|
850 | +function give_can_view_receipt($payment_key = '') { |
|
851 | 851 | |
852 | 852 | $return = false; |
853 | 853 | |
854 | - if ( empty( $payment_key ) ) { |
|
854 | + if (empty($payment_key)) { |
|
855 | 855 | return $return; |
856 | 856 | } |
857 | 857 | |
858 | 858 | global $give_receipt_args; |
859 | 859 | |
860 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
860 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
861 | 861 | |
862 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
862 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
863 | 863 | |
864 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
864 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
865 | 865 | |
866 | - if ( is_user_logged_in() ) { |
|
867 | - if ( $user_id === (int) get_current_user_id() ) { |
|
866 | + if (is_user_logged_in()) { |
|
867 | + if ($user_id === (int) get_current_user_id()) { |
|
868 | 868 | $return = true; |
869 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
869 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
870 | 870 | $return = true; |
871 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
871 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
872 | 872 | $return = true; |
873 | 873 | } |
874 | 874 | } |
875 | 875 | |
876 | 876 | $session = give_get_purchase_session(); |
877 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
878 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
877 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
878 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
879 | 879 | $return = true; |
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
883 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
883 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
884 | 884 | |
885 | 885 | } |
886 | 886 | \ No newline at end of file |