@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return mixed |
24 | 24 | */ |
25 | 25 | function give_get_price_decimals() { |
26 | - return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) ); |
|
26 | + return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0)); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return mixed |
35 | 35 | */ |
36 | 36 | function give_get_price_thousand_separator() { |
37 | - return give_get_option( 'thousands_separator', ',' ); |
|
37 | + return give_get_option('thousands_separator', ','); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | 47 | function give_get_price_decimal_separator() { |
48 | - return give_get_option( 'decimal_separator', '.' ); |
|
48 | + return give_get_option('decimal_separator', '.'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -61,67 +61,67 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string $amount Newly sanitized amount |
63 | 63 | */ |
64 | -function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
64 | +function give_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
65 | 65 | |
66 | 66 | // Bailout. |
67 | - if ( empty( $number ) ) { |
|
67 | + if (empty($number)) { |
|
68 | 68 | return $number; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Remove slash from amount. |
72 | 72 | // If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number. |
73 | 73 | // To prevent notices and warning remove slash from amount/number. |
74 | - $number = wp_unslash( $number ); |
|
74 | + $number = wp_unslash($number); |
|
75 | 75 | |
76 | 76 | $thousand_separator = give_get_price_thousand_separator(); |
77 | 77 | |
78 | 78 | $locale = localeconv(); |
79 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
79 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
80 | 80 | |
81 | 81 | // Remove locale from string |
82 | - if ( ! is_float( $number ) ) { |
|
83 | - $number = str_replace( $decimals, '.', $number ); |
|
82 | + if ( ! is_float($number)) { |
|
83 | + $number = str_replace($decimals, '.', $number); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Remove thousand amount formatting if amount has. |
87 | 87 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
88 | 88 | // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
89 | - if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
90 | - $number = str_replace( $thousand_separator, '', $number ); |
|
91 | - } elseif ( in_array( $thousand_separator, $decimals ) ) { |
|
92 | - $number = preg_replace( '/\.(?=.*\.)/', '', $number ); |
|
89 | + if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) { |
|
90 | + $number = str_replace($thousand_separator, '', $number); |
|
91 | + } elseif (in_array($thousand_separator, $decimals)) { |
|
92 | + $number = preg_replace('/\.(?=.*\.)/', '', $number); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Remove non numeric entity before decimal separator. |
96 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
96 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
97 | 97 | $default_dp = give_get_price_decimals(); |
98 | 98 | |
99 | 99 | // Reset negative amount to zero. |
100 | - if ( 0 > $number ) { |
|
101 | - $number = number_format( 0, $default_dp, '.' ); |
|
100 | + if (0 > $number) { |
|
101 | + $number = number_format(0, $default_dp, '.'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // If number does not have decimal then add number of decimals to it. |
105 | 105 | if ( |
106 | - false === strpos( $number, '.' ) |
|
107 | - || ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) ) |
|
106 | + false === strpos($number, '.') |
|
107 | + || ($default_dp > strlen(substr($number, strpos($number, '.') + 1))) |
|
108 | 108 | ) { |
109 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
109 | + $number = number_format($number, $default_dp, '.', ''); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Format number by custom number of decimals. |
113 | - if ( false !== $dp ) { |
|
114 | - $dp = intval( is_bool( $dp ) ? $default_dp : $dp ); |
|
115 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
116 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
113 | + if (false !== $dp) { |
|
114 | + $dp = intval(is_bool($dp) ? $default_dp : $dp); |
|
115 | + $dp = apply_filters('give_sanitize_amount_decimals', $dp, $number); |
|
116 | + $number = number_format(floatval($number), $dp, '.', ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // Trim zeros. |
120 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
121 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
120 | + if ($trim_zeros && strstr($number, '.')) { |
|
121 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
122 | 122 | } |
123 | 123 | |
124 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
124 | + return apply_filters('give_sanitize_amount', $number); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return string $amount Newly formatted amount or Price Not Available |
136 | 136 | */ |
137 | -function give_format_amount( $amount, $decimals = true ) { |
|
138 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
139 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
137 | +function give_format_amount($amount, $decimals = true) { |
|
138 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
139 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
140 | 140 | |
141 | - if ( empty( $amount ) ) { |
|
141 | + if (empty($amount)) { |
|
142 | 142 | $amount = 0; |
143 | 143 | } else { |
144 | 144 | // Sanitize amount before formatting. |
145 | - $amount = give_sanitize_amount( $amount ); |
|
145 | + $amount = give_sanitize_amount($amount); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | $decimals = $decimals ? give_get_price_decimals() : 0; |
149 | 149 | |
150 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
150 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
151 | 151 | |
152 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
152 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -166,33 +166,33 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return float|string formatted amount number with large number names. |
168 | 168 | */ |
169 | -function give_human_format_large_amount( $amount ) { |
|
169 | +function give_human_format_large_amount($amount) { |
|
170 | 170 | |
171 | 171 | // Get thousand separator. |
172 | 172 | $thousands_sep = give_get_price_thousand_separator(); |
173 | 173 | |
174 | 174 | // Sanitize amount. |
175 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
175 | + $sanitize_amount = give_sanitize_amount($amount); |
|
176 | 176 | |
177 | 177 | // Explode amount to calculate name of large numbers. |
178 | - $amount_array = explode( $thousands_sep, $amount ); |
|
178 | + $amount_array = explode($thousands_sep, $amount); |
|
179 | 179 | |
180 | 180 | // Calculate amount parts count. |
181 | - $amount_count_parts = count( $amount_array ); |
|
181 | + $amount_count_parts = count($amount_array); |
|
182 | 182 | |
183 | 183 | // Human format amount (default). |
184 | 184 | $human_format_amount = $amount; |
185 | 185 | |
186 | 186 | // Calculate large number formatted amount. |
187 | - if ( 4 < $amount_count_parts ) { |
|
188 | - $human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
189 | - } elseif ( 3 < $amount_count_parts ) { |
|
190 | - $human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) ); |
|
191 | - } elseif ( 2 < $amount_count_parts ) { |
|
192 | - $human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) ); |
|
187 | + if (4 < $amount_count_parts) { |
|
188 | + $human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2)); |
|
189 | + } elseif (3 < $amount_count_parts) { |
|
190 | + $human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
191 | + } elseif (2 < $amount_count_parts) { |
|
192 | + $human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2)); |
|
193 | 193 | } |
194 | 194 | |
195 | - return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount ); |
|
195 | + return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return string $amount Newly formatted amount or Price Not Available |
207 | 207 | */ |
208 | -function give_format_decimal( $amount, $dp = false ) { |
|
208 | +function give_format_decimal($amount, $dp = false) { |
|
209 | 209 | $decimal_separator = give_get_price_decimal_separator(); |
210 | - $formatted_amount = give_sanitize_amount( $amount, $dp ); |
|
210 | + $formatted_amount = give_sanitize_amount($amount, $dp); |
|
211 | 211 | |
212 | - if ( false !== strpos( $formatted_amount, '.' ) ) { |
|
213 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
212 | + if (false !== strpos($formatted_amount, '.')) { |
|
213 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
214 | 214 | } |
215 | 215 | |
216 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
216 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -226,24 +226,24 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return mixed|string |
228 | 228 | */ |
229 | -function give_currency_filter( $price = '', $currency = '' ) { |
|
229 | +function give_currency_filter($price = '', $currency = '') { |
|
230 | 230 | |
231 | - if ( empty( $currency ) ) { |
|
231 | + if (empty($currency)) { |
|
232 | 232 | $currency = give_get_currency(); |
233 | 233 | } |
234 | 234 | |
235 | - $position = give_get_option( 'currency_position', 'before' ); |
|
235 | + $position = give_get_option('currency_position', 'before'); |
|
236 | 236 | |
237 | 237 | $negative = $price < 0; |
238 | 238 | |
239 | - if ( $negative ) { |
|
239 | + if ($negative) { |
|
240 | 240 | // Remove proceeding "-". |
241 | - $price = substr( $price, 1 ); |
|
241 | + $price = substr($price, 1); |
|
242 | 242 | } |
243 | 243 | |
244 | - $symbol = give_currency_symbol( $currency ); |
|
244 | + $symbol = give_currency_symbol($currency); |
|
245 | 245 | |
246 | - switch ( $currency ) : |
|
246 | + switch ($currency) : |
|
247 | 247 | case 'GBP' : |
248 | 248 | case 'BRL' : |
249 | 249 | case 'EUR' : |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | case 'MAD' : |
273 | 273 | case 'KRW' : |
274 | 274 | case 'ZAR' : |
275 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
275 | + $formatted = ('before' === $position ? $symbol.$price : $price.$symbol); |
|
276 | 276 | break; |
277 | 277 | case 'NOK' : |
278 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
278 | + $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol); |
|
279 | 279 | break; |
280 | 280 | default : |
281 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
281 | + $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency); |
|
282 | 282 | break; |
283 | 283 | endswitch; |
284 | 284 | |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | * and if currency is USD and currency position is after then |
294 | 294 | * filter name will be give_usd_currency_filter_after |
295 | 295 | */ |
296 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
296 | + $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price); |
|
297 | 297 | |
298 | - if ( $negative ) { |
|
298 | + if ($negative) { |
|
299 | 299 | // Prepend the minus sign before the currency sign. |
300 | - $formatted = '-' . $formatted; |
|
300 | + $formatted = '-'.$formatted; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | return $formatted; |
@@ -313,21 +313,21 @@ discard block |
||
313 | 313 | */ |
314 | 314 | function give_currency_decimal_filter() { |
315 | 315 | |
316 | - remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
316 | + remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
317 | 317 | |
318 | 318 | // Set default number of decimals. |
319 | 319 | $decimals = give_get_price_decimals(); |
320 | 320 | |
321 | - add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
321 | + add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
322 | 322 | |
323 | 323 | // Get number of decimals with backward compatibility ( version < 1.6 ) |
324 | - if ( 1 <= func_num_args() ) { |
|
325 | - $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
324 | + if (1 <= func_num_args()) { |
|
325 | + $decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0))); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | $currency = give_get_currency(); |
329 | 329 | |
330 | - switch ( $currency ) { |
|
330 | + switch ($currency) { |
|
331 | 331 | case 'RIAL' : |
332 | 332 | case 'JPY' : |
333 | 333 | case 'TWD' : |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | break; |
338 | 338 | } |
339 | 339 | |
340 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
340 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
341 | 341 | } |
342 | 342 | |
343 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
344 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
343 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
344 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | /** |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return string Date format string |
355 | 355 | */ |
356 | -function give_date_format( $date_context = '' ) { |
|
356 | +function give_date_format($date_context = '') { |
|
357 | 357 | /** |
358 | 358 | * Filter the date context |
359 | 359 | * |
@@ -374,19 +374,19 @@ discard block |
||
374 | 374 | * |
375 | 375 | * } |
376 | 376 | */ |
377 | - $date_format_contexts = apply_filters( 'give_date_format_contexts', array() ); |
|
377 | + $date_format_contexts = apply_filters('give_date_format_contexts', array()); |
|
378 | 378 | |
379 | 379 | // Set date format to default date format. |
380 | - $date_format = get_option( 'date_format' ); |
|
380 | + $date_format = get_option('date_format'); |
|
381 | 381 | |
382 | 382 | // Update date format if we have non empty date format context array and non empty date format string for that context. |
383 | - if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) { |
|
384 | - $date_format = ! empty( $date_format_contexts[ $date_context ] ) |
|
385 | - ? $date_format_contexts[ $date_context ] |
|
383 | + if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) { |
|
384 | + $date_format = ! empty($date_format_contexts[$date_context]) |
|
385 | + ? $date_format_contexts[$date_context] |
|
386 | 386 | : $date_format; |
387 | 387 | } |
388 | 388 | |
389 | - return apply_filters( 'give_date_format', $date_format ); |
|
389 | + return apply_filters('give_date_format', $date_format); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string |
401 | 401 | */ |
402 | -function give_get_cache_key( $action, $query_args ) { |
|
402 | +function give_get_cache_key($action, $query_args) { |
|
403 | 403 | // Bailout. |
404 | - if ( ! is_array( $query_args ) || empty( $query_args ) ) { |
|
404 | + if ( ! is_array($query_args) || empty($query_args)) { |
|
405 | 405 | return ''; |
406 | 406 | } |
407 | 407 | |
408 | - return "give_cache_{$action}_" . substr( md5( serialize( $query_args ) ), 0, 15 ); |
|
408 | + return "give_cache_{$action}_".substr(md5(serialize($query_args)), 0, 15); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -418,11 +418,11 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return string|array |
420 | 420 | */ |
421 | -function give_clean( $var ) { |
|
422 | - if ( is_array( $var ) ) { |
|
423 | - return array_map( 'give_clean', $var ); |
|
421 | +function give_clean($var) { |
|
422 | + if (is_array($var)) { |
|
423 | + return array_map('give_clean', $var); |
|
424 | 424 | } else { |
425 | - return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; |
|
425 | + return is_scalar($var) ? sanitize_text_field($var) : $var; |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * |
436 | 436 | * @return int |
437 | 437 | */ |
438 | -function give_let_to_num( $size ) { |
|
439 | - $l = substr( $size, - 1 ); |
|
440 | - $ret = substr( $size, 0, - 1 ); |
|
441 | - switch ( strtoupper( $l ) ) { |
|
438 | +function give_let_to_num($size) { |
|
439 | + $l = substr($size, - 1); |
|
440 | + $ret = substr($size, 0, - 1); |
|
441 | + switch (strtoupper($l)) { |
|
442 | 442 | case 'P': |
443 | 443 | $ret *= 1024; |
444 | 444 | case 'T': |
@@ -463,17 +463,17 @@ discard block |
||
463 | 463 | * @param int $action |
464 | 464 | * @param array $wp_die_args |
465 | 465 | */ |
466 | -function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) { |
|
466 | +function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) { |
|
467 | 467 | |
468 | 468 | $default_wp_die_args = array( |
469 | - 'message' => esc_html__( 'Nonce verification has failed.', 'give' ), |
|
470 | - 'title' => esc_html__( 'Error', 'give' ), |
|
471 | - 'args' => array( 'response' => 403 ), |
|
469 | + 'message' => esc_html__('Nonce verification has failed.', 'give'), |
|
470 | + 'title' => esc_html__('Error', 'give'), |
|
471 | + 'args' => array('response' => 403), |
|
472 | 472 | ); |
473 | 473 | |
474 | - $wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args ); |
|
474 | + $wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args); |
|
475 | 475 | |
476 | - if ( ! wp_verify_nonce( $nonce, $action ) ) { |
|
476 | + if ( ! wp_verify_nonce($nonce, $action)) { |
|
477 | 477 | wp_die( |
478 | 478 | $wp_die_args['message'], |
479 | 479 | $wp_die_args['title'], |
@@ -495,23 +495,23 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return mixed |
497 | 497 | */ |
498 | -function give_check_variable( $variable, $conditional = '', $default = false ) { |
|
498 | +function give_check_variable($variable, $conditional = '', $default = false) { |
|
499 | 499 | |
500 | - switch ( $conditional ) { |
|
500 | + switch ($conditional) { |
|
501 | 501 | case 'isset_empty': |
502 | - $variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default; |
|
502 | + $variable = (isset($variable) && ! empty($variable)) ? $variable : $default; |
|
503 | 503 | break; |
504 | 504 | |
505 | 505 | case 'empty': |
506 | - $variable = ! empty( $variable ) ? $variable : $default; |
|
506 | + $variable = ! empty($variable) ? $variable : $default; |
|
507 | 507 | break; |
508 | 508 | |
509 | 509 | case 'null': |
510 | - $variable = ! is_null( $variable ) ? $variable : $default; |
|
510 | + $variable = ! is_null($variable) ? $variable : $default; |
|
511 | 511 | break; |
512 | 512 | |
513 | 513 | default: |
514 | - $variable = isset( $variable ) ? $variable : $default; |
|
514 | + $variable = isset($variable) ? $variable : $default; |
|
515 | 515 | |
516 | 516 | } |
517 | 517 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function give_get_currency() { |
39 | 39 | |
40 | - $currency = give_get_option( 'currency', 'USD' ); |
|
40 | + $currency = give_get_option('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 | |
54 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
54 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
55 | 55 | |
56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
56 | + return apply_filters('give_currency_position', $currency_pos); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | |
67 | 67 | function give_get_currencies() { |
68 | 68 | $currencies = array( |
69 | - 'USD' => esc_html__( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => esc_html__( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => esc_html__( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => esc_html__( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => esc_html__( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => esc_html__( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => esc_html__( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => esc_html__( 'Danish Krone (kr)', 'give' ), |
|
77 | - 'HKD' => esc_html__( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => esc_html__( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => esc_html__( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => esc_html__( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => esc_html__( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => esc_html__( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => esc_html__( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => esc_html__( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => esc_html__( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => esc_html__( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => esc_html__( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => esc_html__( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => esc_html__( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => esc_html__( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => esc_html__( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => esc_html__( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => esc_html__( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => esc_html__( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => esc_html__( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => esc_html__( 'Russian Rubles (руб)', 'give' ) |
|
69 | + 'USD' => esc_html__('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => esc_html__('Euros (€)', 'give'), |
|
71 | + 'GBP' => esc_html__('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => esc_html__('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => esc_html__('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => esc_html__('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => esc_html__('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => esc_html__('Danish Krone (kr)', 'give'), |
|
77 | + 'HKD' => esc_html__('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => esc_html__('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => esc_html__('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => esc_html__('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => esc_html__('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => esc_html__('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => esc_html__('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => esc_html__('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => esc_html__('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => esc_html__('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => esc_html__('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => esc_html__('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => esc_html__('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => esc_html__('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => esc_html__('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => esc_html__('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => esc_html__('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => esc_html__('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => esc_html__('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => esc_html__('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => esc_html__('Russian Rubles (руб)', 'give') |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string The symbol to use for the currency |
116 | 116 | */ |
117 | -function give_currency_symbol( $currency = '' ) { |
|
117 | +function give_currency_symbol($currency = '') { |
|
118 | 118 | |
119 | - if ( empty( $currency ) ) { |
|
119 | + if (empty($currency)) { |
|
120 | 120 | $currency = give_get_currency(); |
121 | 121 | } |
122 | - switch ( $currency ) : |
|
122 | + switch ($currency) : |
|
123 | 123 | case 'GBP' : |
124 | 124 | $symbol = '£'; |
125 | 125 | break; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | endswitch; |
199 | 199 | |
200 | 200 | |
201 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
201 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -212,21 +212,21 @@ discard block |
||
212 | 212 | |
213 | 213 | global $wp; |
214 | 214 | |
215 | - if ( get_option( 'permalink_structure' ) ) { |
|
216 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
215 | + if (get_option('permalink_structure')) { |
|
216 | + $base = trailingslashit(home_url($wp->request)); |
|
217 | 217 | } else { |
218 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
219 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
218 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
219 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $scheme = is_ssl() ? 'https' : 'http'; |
223 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
223 | + $current_uri = set_url_scheme($base, $scheme); |
|
224 | 224 | |
225 | - if ( is_front_page() ) { |
|
226 | - $current_uri = home_url( '/' ); |
|
225 | + if (is_front_page()) { |
|
226 | + $current_uri = home_url('/'); |
|
227 | 227 | } |
228 | 228 | |
229 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
229 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
230 | 230 | |
231 | 231 | } |
232 | 232 | |
@@ -248,15 +248,15 @@ discard block |
||
248 | 248 | */ |
249 | 249 | $gateways = give_get_enabled_payment_gateways(); |
250 | 250 | |
251 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
251 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
252 | 252 | $ret = true; |
253 | - } else if ( count( $gateways ) == 1 ) { |
|
253 | + } else if (count($gateways) == 1) { |
|
254 | 254 | $ret = false; |
255 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
255 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
256 | 256 | $ret = false; |
257 | 257 | } |
258 | 258 | |
259 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
259 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -268,26 +268,26 @@ discard block |
||
268 | 268 | function give_get_timezone_id() { |
269 | 269 | |
270 | 270 | // if site timezone string exists, return it |
271 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
271 | + if ($timezone = get_option('timezone_string')) { |
|
272 | 272 | return $timezone; |
273 | 273 | } |
274 | 274 | |
275 | 275 | // get UTC offset, if it isn't set return UTC |
276 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
276 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
277 | 277 | return 'UTC'; |
278 | 278 | } |
279 | 279 | |
280 | 280 | // attempt to guess the timezone string from the UTC offset |
281 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
281 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
282 | 282 | |
283 | 283 | // last try, guess timezone string manually |
284 | - if ( $timezone === false ) { |
|
284 | + if ($timezone === false) { |
|
285 | 285 | |
286 | - $is_dst = date( 'I' ); |
|
286 | + $is_dst = date('I'); |
|
287 | 287 | |
288 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
289 | - foreach ( $abbr as $city ) { |
|
290 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
288 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
289 | + foreach ($abbr as $city) { |
|
290 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
291 | 291 | return $city['timezone_id']; |
292 | 292 | } |
293 | 293 | } |
@@ -311,17 +311,17 @@ discard block |
||
311 | 311 | |
312 | 312 | $ip = '127.0.0.1'; |
313 | 313 | |
314 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
314 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
315 | 315 | //check ip from share internet |
316 | 316 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
317 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
317 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
318 | 318 | //to check ip is pass from proxy |
319 | 319 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
320 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
320 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
321 | 321 | $ip = $_SERVER['REMOTE_ADDR']; |
322 | 322 | } |
323 | 323 | |
324 | - return apply_filters( 'give_get_ip', $ip ); |
|
324 | + return apply_filters('give_get_ip', $ip); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @uses Give()->session->set() |
338 | 338 | */ |
339 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
340 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
341 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
339 | +function give_set_purchase_session($purchase_data = array()) { |
|
340 | + Give()->session->set('give_purchase', $purchase_data); |
|
341 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @return mixed array | false |
353 | 353 | */ |
354 | 354 | function give_get_purchase_session() { |
355 | - return Give()->session->get( 'give_purchase' ); |
|
355 | + return Give()->session->get('give_purchase'); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -367,14 +367,14 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return string |
369 | 369 | */ |
370 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
370 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
371 | 371 | $summary = ''; |
372 | 372 | |
373 | - if ( $email ) { |
|
374 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
373 | + if ($email) { |
|
374 | + $summary .= $purchase_data['user_email'].' - '; |
|
375 | 375 | } |
376 | 376 | |
377 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
377 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
378 | 378 | |
379 | 379 | return $summary; |
380 | 380 | } |
@@ -391,31 +391,31 @@ discard block |
||
391 | 391 | function give_get_host() { |
392 | 392 | $host = false; |
393 | 393 | |
394 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
394 | + if (defined('WPE_APIKEY')) { |
|
395 | 395 | $host = 'WP Engine'; |
396 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
396 | + } elseif (defined('PAGELYBIN')) { |
|
397 | 397 | $host = 'Pagely'; |
398 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
398 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
399 | 399 | $host = 'ICDSoft'; |
400 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
400 | + } elseif (DB_HOST == 'mysqlv5') { |
|
401 | 401 | $host = 'NetworkSolutions'; |
402 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
402 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
403 | 403 | $host = 'iPage'; |
404 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
404 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
405 | 405 | $host = 'IPower'; |
406 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
406 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
407 | 407 | $host = 'MediaTemple Grid'; |
408 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
408 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
409 | 409 | $host = 'pair Networks'; |
410 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
410 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
411 | 411 | $host = 'Rackspace Cloud'; |
412 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
412 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
413 | 413 | $host = 'SysFix.eu Power Hosting'; |
414 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
414 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
415 | 415 | $host = 'Flywheel'; |
416 | 416 | } else { |
417 | 417 | // Adding a general fallback for data gathering |
418 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
418 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | return $host; |
@@ -431,67 +431,67 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @return bool true if host matches, false if not |
433 | 433 | */ |
434 | -function give_is_host( $host = false ) { |
|
434 | +function give_is_host($host = false) { |
|
435 | 435 | |
436 | 436 | $return = false; |
437 | 437 | |
438 | - if ( $host ) { |
|
439 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
438 | + if ($host) { |
|
439 | + $host = str_replace(' ', '', strtolower($host)); |
|
440 | 440 | |
441 | - switch ( $host ) { |
|
441 | + switch ($host) { |
|
442 | 442 | case 'wpengine': |
443 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
443 | + if (defined('WPE_APIKEY')) { |
|
444 | 444 | $return = true; |
445 | 445 | } |
446 | 446 | break; |
447 | 447 | case 'pagely': |
448 | - if ( defined( 'PAGELYBIN' ) ) { |
|
448 | + if (defined('PAGELYBIN')) { |
|
449 | 449 | $return = true; |
450 | 450 | } |
451 | 451 | break; |
452 | 452 | case 'icdsoft': |
453 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
453 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
454 | 454 | $return = true; |
455 | 455 | } |
456 | 456 | break; |
457 | 457 | case 'networksolutions': |
458 | - if ( DB_HOST == 'mysqlv5' ) { |
|
458 | + if (DB_HOST == 'mysqlv5') { |
|
459 | 459 | $return = true; |
460 | 460 | } |
461 | 461 | break; |
462 | 462 | case 'ipage': |
463 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
463 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
464 | 464 | $return = true; |
465 | 465 | } |
466 | 466 | break; |
467 | 467 | case 'ipower': |
468 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
468 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
469 | 469 | $return = true; |
470 | 470 | } |
471 | 471 | break; |
472 | 472 | case 'mediatemplegrid': |
473 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
473 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
474 | 474 | $return = true; |
475 | 475 | } |
476 | 476 | break; |
477 | 477 | case 'pairnetworks': |
478 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
478 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
479 | 479 | $return = true; |
480 | 480 | } |
481 | 481 | break; |
482 | 482 | case 'rackspacecloud': |
483 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
483 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
484 | 484 | $return = true; |
485 | 485 | } |
486 | 486 | break; |
487 | 487 | case 'sysfix.eu': |
488 | 488 | case 'sysfix.eupowerhosting': |
489 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
489 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
490 | 490 | $return = true; |
491 | 491 | } |
492 | 492 | break; |
493 | 493 | case 'flywheel': |
494 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
494 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
495 | 495 | $return = true; |
496 | 496 | } |
497 | 497 | break; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | * @param string $replacement Optional. The function that should have been called. |
525 | 525 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
526 | 526 | */ |
527 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
527 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
528 | 528 | |
529 | 529 | /** |
530 | 530 | * Fires while give deprecated function call occurs. |
@@ -537,19 +537,19 @@ discard block |
||
537 | 537 | * @param string $replacement Optional. The function that should have been called. |
538 | 538 | * @param string $version The plugin version that deprecated the function. |
539 | 539 | */ |
540 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
540 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
541 | 541 | |
542 | - $show_errors = current_user_can( 'manage_options' ); |
|
542 | + $show_errors = current_user_can('manage_options'); |
|
543 | 543 | |
544 | 544 | // Allow plugin to filter the output error trigger |
545 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
546 | - if ( ! is_null( $replacement ) ) { |
|
547 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
548 | - 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. |
|
545 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
546 | + if ( ! is_null($replacement)) { |
|
547 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
548 | + 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. |
|
549 | 549 | // Alternatively we could dump this to a file. |
550 | 550 | } else { |
551 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
552 | - 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. |
|
551 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
552 | + 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. |
|
553 | 553 | // Alternatively we could dump this to a file. |
554 | 554 | } |
555 | 555 | } |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * @return string $post_id |
564 | 564 | */ |
565 | 565 | function give_get_admin_post_id() { |
566 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
567 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
566 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
567 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
568 | 568 | $post_id = $_POST['post_id']; |
569 | 569 | } |
570 | 570 | |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * @return string Arg separator output |
579 | 579 | */ |
580 | 580 | function give_get_php_arg_separator_output() { |
581 | - return ini_get( 'arg_separator.output' ); |
|
581 | + return ini_get('arg_separator.output'); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | |
@@ -593,10 +593,10 @@ discard block |
||
593 | 593 | * |
594 | 594 | * @return string Short month name |
595 | 595 | */ |
596 | -function give_month_num_to_name( $n ) { |
|
597 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
596 | +function give_month_num_to_name($n) { |
|
597 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
598 | 598 | |
599 | - return date_i18n( "M", $timestamp ); |
|
599 | + return date_i18n("M", $timestamp); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @return bool Whether or not function is disabled. |
611 | 611 | */ |
612 | -function give_is_func_disabled( $function ) { |
|
613 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
612 | +function give_is_func_disabled($function) { |
|
613 | + $disabled = explode(',', ini_get('disable_functions')); |
|
614 | 614 | |
615 | - return in_array( $function, $disabled ); |
|
615 | + return in_array($function, $disabled); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | */ |
624 | 624 | function give_get_newsletter() { ?> |
625 | 625 | |
626 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
626 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
627 | 627 | |
628 | 628 | <div class="give-newsletter-form-wrap"> |
629 | 629 | |
@@ -631,33 +631,33 @@ discard block |
||
631 | 631 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
632 | 632 | target="_blank" novalidate> |
633 | 633 | <div class="give-newsletter-confirmation"> |
634 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
634 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
635 | 635 | </div> |
636 | 636 | |
637 | 637 | <table class="form-table give-newsletter-form"> |
638 | 638 | <tr valign="middle"> |
639 | 639 | <td> |
640 | 640 | <label for="mce-EMAIL" |
641 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
641 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
642 | 642 | <input type="email" name="EMAIL" id="mce-EMAIL" |
643 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
643 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
644 | 644 | class="required email" value=""> |
645 | 645 | </td> |
646 | 646 | <td> |
647 | 647 | <label for="mce-FNAME" |
648 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
648 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
649 | 649 | <input type="text" name="FNAME" id="mce-FNAME" |
650 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
650 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
651 | 651 | </td> |
652 | 652 | <td> |
653 | 653 | <label for="mce-LNAME" |
654 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
654 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
655 | 655 | <input type="text" name="LNAME" id="mce-LNAME" |
656 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
656 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
657 | 657 | </td> |
658 | 658 | <td> |
659 | 659 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
660 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
660 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
661 | 661 | </td> |
662 | 662 | </tr> |
663 | 663 | </table> |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
721 | 721 | printf( |
722 | 722 | /* translators: %s: Give twitter user @givewp */ |
723 | - esc_html_e( 'Follow %s', 'give' ), |
|
723 | + esc_html_e('Follow %s', 'give'), |
|
724 | 724 | '@givewp' |
725 | 725 | ); |
726 | 726 | ?></a> |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return string |
751 | 751 | */ |
752 | -function give_svg_icons( $icon ) { |
|
752 | +function give_svg_icons($icon) { |
|
753 | 753 | |
754 | 754 | // Store your SVGs in an associative array |
755 | 755 | $svgs = array( |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | ); |
762 | 762 | |
763 | 763 | // Return the chosen icon's SVG string |
764 | - return $svgs[ $icon ]; |
|
764 | + return $svgs[$icon]; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -773,15 +773,15 @@ discard block |
||
773 | 773 | * |
774 | 774 | * @return mixed |
775 | 775 | */ |
776 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
777 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
778 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
776 | +function modify_nav_menu_meta_box_object($post_type) { |
|
777 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
778 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | return $post_type; |
782 | 782 | } |
783 | 783 | |
784 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
784 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
785 | 785 | |
786 | 786 | |
787 | 787 | /** |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * @license https://opensource.org/licenses/MIT MIT |
796 | 796 | */ |
797 | 797 | |
798 | -if ( ! function_exists( 'array_column' ) ) { |
|
798 | +if ( ! function_exists('array_column')) { |
|
799 | 799 | /** |
800 | 800 | * Returns the values from a single column of the input array, identified by |
801 | 801 | * the $columnKey. |
@@ -814,53 +814,53 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return array |
816 | 816 | */ |
817 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
817 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
818 | 818 | // Using func_get_args() in order to check for proper number of |
819 | 819 | // parameters and trigger errors exactly as the built-in array_column() |
820 | 820 | // does in PHP 5.5. |
821 | 821 | $argc = func_num_args(); |
822 | 822 | $params = func_get_args(); |
823 | 823 | |
824 | - if ( $argc < 2 ) { |
|
825 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
824 | + if ($argc < 2) { |
|
825 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
826 | 826 | |
827 | 827 | return null; |
828 | 828 | } |
829 | 829 | |
830 | - if ( ! is_array( $params[0] ) ) { |
|
831 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
830 | + if ( ! is_array($params[0])) { |
|
831 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
832 | 832 | |
833 | 833 | return null; |
834 | 834 | } |
835 | 835 | |
836 | - if ( ! is_int( $params[1] ) |
|
837 | - && ! is_float( $params[1] ) |
|
838 | - && ! is_string( $params[1] ) |
|
836 | + if ( ! is_int($params[1]) |
|
837 | + && ! is_float($params[1]) |
|
838 | + && ! is_string($params[1]) |
|
839 | 839 | && $params[1] !== null |
840 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
840 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
841 | 841 | ) { |
842 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
842 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
843 | 843 | |
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | |
847 | - if ( isset( $params[2] ) |
|
848 | - && ! is_int( $params[2] ) |
|
849 | - && ! is_float( $params[2] ) |
|
850 | - && ! is_string( $params[2] ) |
|
851 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
847 | + if (isset($params[2]) |
|
848 | + && ! is_int($params[2]) |
|
849 | + && ! is_float($params[2]) |
|
850 | + && ! is_string($params[2]) |
|
851 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
852 | 852 | ) { |
853 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
853 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
854 | 854 | |
855 | 855 | return false; |
856 | 856 | } |
857 | 857 | |
858 | 858 | $paramsInput = $params[0]; |
859 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
859 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
860 | 860 | |
861 | 861 | $paramsIndexKey = null; |
862 | - if ( isset( $params[2] ) ) { |
|
863 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
862 | + if (isset($params[2])) { |
|
863 | + if (is_float($params[2]) || is_int($params[2])) { |
|
864 | 864 | $paramsIndexKey = (int) $params[2]; |
865 | 865 | } else { |
866 | 866 | $paramsIndexKey = (string) $params[2]; |
@@ -869,26 +869,26 @@ discard block |
||
869 | 869 | |
870 | 870 | $resultArray = array(); |
871 | 871 | |
872 | - foreach ( $paramsInput as $row ) { |
|
872 | + foreach ($paramsInput as $row) { |
|
873 | 873 | $key = $value = null; |
874 | 874 | $keySet = $valueSet = false; |
875 | 875 | |
876 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
876 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
877 | 877 | $keySet = true; |
878 | - $key = (string) $row[ $paramsIndexKey ]; |
|
878 | + $key = (string) $row[$paramsIndexKey]; |
|
879 | 879 | } |
880 | 880 | |
881 | - if ( $paramsColumnKey === null ) { |
|
881 | + if ($paramsColumnKey === null) { |
|
882 | 882 | $valueSet = true; |
883 | 883 | $value = $row; |
884 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
884 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
885 | 885 | $valueSet = true; |
886 | - $value = $row[ $paramsColumnKey ]; |
|
886 | + $value = $row[$paramsColumnKey]; |
|
887 | 887 | } |
888 | 888 | |
889 | - if ( $valueSet ) { |
|
890 | - if ( $keySet ) { |
|
891 | - $resultArray[ $key ] = $value; |
|
889 | + if ($valueSet) { |
|
890 | + if ($keySet) { |
|
891 | + $resultArray[$key] = $value; |
|
892 | 892 | } else { |
893 | 893 | $resultArray[] = $value; |
894 | 894 | } |
@@ -910,40 +910,40 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @return bool Whether the receipt is visible or not. |
912 | 912 | */ |
913 | -function give_can_view_receipt( $payment_key = '' ) { |
|
913 | +function give_can_view_receipt($payment_key = '') { |
|
914 | 914 | |
915 | 915 | $return = false; |
916 | 916 | |
917 | - if ( empty( $payment_key ) ) { |
|
917 | + if (empty($payment_key)) { |
|
918 | 918 | return $return; |
919 | 919 | } |
920 | 920 | |
921 | 921 | global $give_receipt_args; |
922 | 922 | |
923 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
923 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
924 | 924 | |
925 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
925 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
926 | 926 | |
927 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
927 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
928 | 928 | |
929 | - if ( is_user_logged_in() ) { |
|
930 | - if ( $user_id === (int) get_current_user_id() ) { |
|
929 | + if (is_user_logged_in()) { |
|
930 | + if ($user_id === (int) get_current_user_id()) { |
|
931 | 931 | $return = true; |
932 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
932 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
933 | 933 | $return = true; |
934 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
934 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
935 | 935 | $return = true; |
936 | 936 | } |
937 | 937 | } |
938 | 938 | |
939 | 939 | $session = give_get_purchase_session(); |
940 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
941 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
940 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
941 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
942 | 942 | $return = true; |
943 | 943 | } |
944 | 944 | } |
945 | 945 | |
946 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
946 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
947 | 947 | |
948 | 948 | } |
949 | 949 | |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | * |
953 | 953 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
954 | 954 | */ |
955 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
955 | +if ( ! function_exists('cal_days_in_month')) { |
|
956 | 956 | /** |
957 | 957 | * cal_days_in_month |
958 | 958 | * |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | * |
963 | 963 | * @return bool|string |
964 | 964 | */ |
965 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
966 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
965 | + function cal_days_in_month($calendar, $month, $year) { |
|
966 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | |
@@ -982,42 +982,42 @@ discard block |
||
982 | 982 | */ |
983 | 983 | function give_get_plugins() { |
984 | 984 | $plugins = get_plugins(); |
985 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
985 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
986 | 986 | |
987 | - if ( is_multisite() ) { |
|
988 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
989 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
987 | + if (is_multisite()) { |
|
988 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
989 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
990 | 990 | } |
991 | 991 | |
992 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
992 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
993 | 993 | // Is plugin active? |
994 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
995 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
994 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
995 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
996 | 996 | } else { |
997 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
997 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
998 | 998 | } |
999 | 999 | |
1000 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
1000 | + $dirname = strtolower(dirname($plugin_path)); |
|
1001 | 1001 | |
1002 | 1002 | // Is plugin a Give add-on by WordImpress? |
1003 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
1003 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
1004 | 1004 | // Plugin is a Give-addon. |
1005 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
1005 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
1006 | 1006 | |
1007 | 1007 | // Get license info from database. |
1008 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); |
|
1009 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; |
|
1010 | - $license_active = get_option( $db_option ); |
|
1008 | + $plugin_name = str_replace('Give - ', '', $plugin_data['Name']); |
|
1009 | + $db_option = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; |
|
1010 | + $license_active = get_option($db_option); |
|
1011 | 1011 | |
1012 | 1012 | // Does a valid license exist? |
1013 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
1014 | - $plugins[ $plugin_path ]['License'] = true; |
|
1013 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
1014 | + $plugins[$plugin_path]['License'] = true; |
|
1015 | 1015 | } else { |
1016 | - $plugins[ $plugin_path ]['License'] = false; |
|
1016 | + $plugins[$plugin_path]['License'] = false; |
|
1017 | 1017 | } |
1018 | 1018 | } else { |
1019 | 1019 | // Plugin is not a Give add-on. |
1020 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
1020 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | |
@@ -1034,16 +1034,16 @@ discard block |
||
1034 | 1034 | * |
1035 | 1035 | * @return bool |
1036 | 1036 | */ |
1037 | -function give_is_terms_enabled( $form_id ) { |
|
1038 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1037 | +function give_is_terms_enabled($form_id) { |
|
1038 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1039 | 1039 | |
1040 | 1040 | if ( |
1041 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1042 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1041 | + give_is_setting_enabled($form_option, 'global') |
|
1042 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1043 | 1043 | ) { |
1044 | 1044 | return true; |
1045 | 1045 | |
1046 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1046 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1047 | 1047 | return true; |
1048 | 1048 | |
1049 | 1049 | } else { |
@@ -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,50 +23,50 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation 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 = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = 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 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
58 | 58 | if ( |
59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
60 | - || ( 'trash' === $form->post_status ) |
|
59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
60 | + || ('trash' === $form->post_status) |
|
61 | 61 | ) { |
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
65 | 65 | //Get the form wrap CSS classes. |
66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
67 | 67 | |
68 | 68 | //Get the <form> tag wrap CSS classes. |
69 | - $form_classes = $form->get_form_classes( $args ); |
|
69 | + $form_classes = $form->get_form_classes($args); |
|
70 | 70 | |
71 | 71 | ob_start(); |
72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * @param int $form_id The form ID. |
79 | 79 | * @param array $args An array of form arguments. |
80 | 80 | */ |
81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
82 | 82 | |
83 | 83 | ?> |
84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
85 | 85 | |
86 | - <?php if ( $form->is_close_donation_form() ) { |
|
86 | + <?php if ($form->is_close_donation_form()) { |
|
87 | 87 | |
88 | 88 | // Get Goal thank you message. |
89 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
89 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
91 | 91 | |
92 | 92 | // Print thank you message. |
93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
94 | 94 | |
95 | 95 | } else { |
96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * 1. if show_title params set to true |
99 | 99 | * 2. if admin set form display_style to button |
100 | 100 | */ |
101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
102 | 102 | if ( |
103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
104 | - && ! doing_action( 'give_single_form_summary' ) |
|
103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
104 | + && ! doing_action('give_single_form_summary') |
|
105 | 105 | ) { |
106 | 106 | echo $form_title; |
107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
114 | 114 | * @param int $form_id The form ID. |
115 | 115 | * @param array $args An array of form arguments. |
116 | 116 | */ |
117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
117 | + do_action('give_pre_form', $form->ID, $args); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
124 | 124 | <input type="hidden" name="give-current-url" |
125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
126 | 126 | <input type="hidden" name="give-form-url" |
127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
128 | 128 | <input type="hidden" name="give-form-minimum" |
129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
130 | 130 | |
131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | <?php |
139 | 139 | |
140 | 140 | // Price ID hidden field for variable (mult-level) donation forms. |
141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
141 | + if (give_has_variable_prices($form_id)) { |
|
142 | 142 | // Get default selected price ID. |
143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
144 | 144 | $price_id = 0; |
145 | 145 | //loop through prices. |
146 | - foreach ( $prices as $price ) { |
|
147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
146 | + foreach ($prices as $price) { |
|
147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
148 | 148 | $price_id = $price['_give_id']['level_id']; |
149 | 149 | }; |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param int $form_id The form ID. |
161 | 161 | * @param array $args An array of form arguments. |
162 | 162 | */ |
163 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
163 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Fires while outputing donation form, for payment gatways fields. |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param int $form_id The form ID. |
171 | 171 | * @param array $args An array of form arguments. |
172 | 172 | */ |
173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Fires while outputing donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param int $form_id The form ID. |
181 | 181 | * @param array $args An array of form arguments. |
182 | 182 | */ |
183 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
183 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
184 | 184 | |
185 | 185 | ?> |
186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * @param int $form_id The form ID. |
195 | 195 | * @param array $args An array of form arguments. |
196 | 196 | */ |
197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
197 | + do_action('give_post_form', $form->ID, $args); |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | |
202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
203 | 203 | <?php |
204 | 204 | |
205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * @param int $form_id The form ID. |
211 | 211 | * @param array $args An array of form arguments. |
212 | 212 | */ |
213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
213 | + do_action('give_post_form_output', $form->ID, $args); |
|
214 | 214 | |
215 | 215 | $final_output = ob_get_clean(); |
216 | 216 | |
217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return string |
233 | 233 | */ |
234 | -function give_show_purchase_form( $form_id ) { |
|
234 | +function give_show_purchase_form($form_id) { |
|
235 | 235 | |
236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
237 | 237 | |
238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
239 | 239 | $form_id = $_POST['give_form_id']; |
240 | 240 | } |
241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @since 1.7 |
246 | 246 | */ |
247 | - do_action( 'give_donation_form_top', $form_id ); |
|
247 | + do_action('give_donation_form_top', $form_id); |
|
248 | 248 | |
249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
249 | + if (give_can_checkout() && isset($form_id)) { |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Fires while displaying donation form, before registration login. |
253 | 253 | * |
254 | 254 | * @since 1.7 |
255 | 255 | */ |
256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Fire when register/login form fields render. |
260 | 260 | * |
261 | 261 | * @since 1.7 |
262 | 262 | */ |
263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Fire when credit card form fields render. |
267 | 267 | * |
268 | 268 | * @since 1.7 |
269 | 269 | */ |
270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
271 | 271 | |
272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
274 | 274 | /** |
275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param int $form_id The form ID. |
280 | 280 | */ |
281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
282 | 282 | } else { |
283 | 283 | /** |
284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @param int $form_id The form ID. |
289 | 289 | */ |
290 | - do_action( 'give_cc_form', $form_id ); |
|
290 | + do_action('give_cc_form', $form_id); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @since 1.7 |
297 | 297 | */ |
298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
299 | 299 | |
300 | 300 | } else { |
301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @since 1.7 |
305 | 305 | */ |
306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
306 | + do_action('give_donation_form_no_access', $form_id); |
|
307 | 307 | |
308 | 308 | } |
309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @since 1.7 |
314 | 314 | */ |
315 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
315 | + do_action('give_donation_form_bottom', $form_id); |
|
316 | 316 | } |
317 | 317 | |
318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return void |
328 | 328 | */ |
329 | -function give_show_register_login_fields( $form_id ) { |
|
329 | +function give_show_register_login_fields($form_id) { |
|
330 | 330 | |
331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
331 | + $show_register_form = give_show_login_register_option($form_id); |
|
332 | 332 | |
333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
334 | 334 | ?> |
335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @since 1.7 |
341 | 341 | */ |
342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
342 | + do_action('give_donation_form_register_fields', $form_id); |
|
343 | 343 | ?> |
344 | 344 | </div> |
345 | 345 | <?php |
346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
347 | 347 | ?> |
348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @since 1.7 |
354 | 354 | */ |
355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
355 | + do_action('give_donation_form_login_fields', $form_id); |
|
356 | 356 | ?> |
357 | 357 | </div> |
358 | 358 | <?php |
359 | 359 | endif; |
360 | 360 | |
361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
362 | 362 | /** |
363 | 363 | * Fire when user info render. |
364 | 364 | * |
365 | 365 | * @since 1.7 |
366 | 366 | */ |
367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return void |
385 | 385 | */ |
386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
387 | 387 | |
388 | 388 | $give_options = give_get_settings(); |
389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
390 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
395 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
390 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
395 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
402 | 402 | * @param int $form_id The form ID. |
403 | 403 | * @param array $args An array of form arguments. |
404 | 404 | */ |
405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
406 | 406 | |
407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
409 | 409 | ?> |
410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
414 | - <?php if ( $currency_position == 'before' ) { |
|
414 | + <?php if ($currency_position == 'before') { |
|
415 | 415 | echo $currency_output; |
416 | 416 | } ?> |
417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
418 | - <?php if ( $currency_position == 'after' ) { |
|
418 | + <?php if ($currency_position == 'after') { |
|
419 | 419 | echo $currency_output; |
420 | 420 | } ?> |
421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | ?> |
426 | 426 | <div class="give-total-wrap"> |
427 | 427 | <div class="give-donation-amount form-row-wide"> |
428 | - <?php if ( $currency_position == 'before' ) { |
|
428 | + <?php if ($currency_position == 'before') { |
|
429 | 429 | echo $currency_output; |
430 | 430 | } ?> |
431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
434 | - <?php if ( $currency_position == 'after' ) { |
|
434 | + <?php if ($currency_position == 'after') { |
|
435 | 435 | echo $currency_output; |
436 | 436 | } ?> |
437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * @param int $form_id The form ID. |
447 | 447 | * @param array $args An array of form arguments. |
448 | 448 | */ |
449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
450 | 450 | |
451 | 451 | //Custom Amount Text |
452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
454 | 454 | <?php } |
455 | 455 | |
456 | 456 | //Output Variable Pricing Levels. |
457 | - if ( $variable_pricing ) { |
|
458 | - give_output_levels( $form_id ); |
|
457 | + if ($variable_pricing) { |
|
458 | + give_output_levels($form_id); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | * @param int $form_id The form ID. |
467 | 467 | * @param array $args An array of form arguments. |
468 | 468 | */ |
469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
470 | 470 | } |
471 | 471 | |
472 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
472 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
473 | 473 | |
474 | 474 | /** |
475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,30 +480,30 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @return string Donation levels. |
482 | 482 | */ |
483 | -function give_output_levels( $form_id ) { |
|
483 | +function give_output_levels($form_id) { |
|
484 | 484 | |
485 | 485 | //Get variable pricing. |
486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
487 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
488 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
489 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
490 | - if ( empty( $custom_amount_text ) ) { |
|
491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
487 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
488 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
489 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
490 | + if (empty($custom_amount_text)) { |
|
491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
492 | 492 | } |
493 | 493 | |
494 | - $output = ''; |
|
494 | + $output = ''; |
|
495 | 495 | |
496 | - switch ( $display_style ) { |
|
496 | + switch ($display_style) { |
|
497 | 497 | case 'buttons': |
498 | 498 | |
499 | 499 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
500 | 500 | |
501 | - foreach ( $prices as $price ) { |
|
502 | - $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 ); |
|
503 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
501 | + foreach ($prices as $price) { |
|
502 | + $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); |
|
503 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
504 | 504 | |
505 | 505 | $output .= '<li>'; |
506 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
506 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
507 | 507 | $output .= $level_text; |
508 | 508 | $output .= '</button>'; |
509 | 509 | $output .= '</li>'; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | } |
512 | 512 | |
513 | 513 | //Custom Amount. |
514 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
514 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
515 | 515 | $output .= '<li>'; |
516 | 516 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
517 | 517 | $output .= $custom_amount_text; |
@@ -527,22 +527,22 @@ discard block |
||
527 | 527 | |
528 | 528 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
529 | 529 | |
530 | - foreach ( $prices as $price ) { |
|
531 | - $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 ); |
|
532 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
530 | + foreach ($prices as $price) { |
|
531 | + $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); |
|
532 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
533 | 533 | |
534 | 534 | $output .= '<li>'; |
535 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
536 | - $output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>'; |
|
535 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
536 | + $output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>'; |
|
537 | 537 | $output .= '</li>'; |
538 | 538 | |
539 | 539 | } |
540 | 540 | |
541 | 541 | //Custom Amount. |
542 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
542 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
543 | 543 | $output .= '<li>'; |
544 | 544 | $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">'; |
545 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
545 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
546 | 546 | $output .= '</li>'; |
547 | 547 | } |
548 | 548 | |
@@ -552,23 +552,23 @@ discard block |
||
552 | 552 | |
553 | 553 | case 'dropdown': |
554 | 554 | |
555 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
556 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
555 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
556 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
557 | 557 | |
558 | 558 | //first loop through prices. |
559 | - foreach ( $prices as $price ) { |
|
560 | - $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 ); |
|
561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
559 | + foreach ($prices as $price) { |
|
560 | + $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); |
|
561 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
562 | 562 | |
563 | - $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'] ) . '">'; |
|
563 | + $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']).'">'; |
|
564 | 564 | $output .= $level_text; |
565 | 565 | $output .= '</option>'; |
566 | 566 | |
567 | 567 | } |
568 | 568 | |
569 | 569 | //Custom Amount. |
570 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
571 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
570 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
571 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | $output .= '</select>'; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | break; |
577 | 577 | } |
578 | 578 | |
579 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
579 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -591,27 +591,27 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @return string Checkout button. |
593 | 593 | */ |
594 | -function give_display_checkout_button( $form_id, $args ) { |
|
594 | +function give_display_checkout_button($form_id, $args) { |
|
595 | 595 | |
596 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
596 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
597 | 597 | ? $args['display_style'] |
598 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
598 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
599 | 599 | |
600 | - if ( 'button' === $display_option ) { |
|
600 | + if ('button' === $display_option) { |
|
601 | 601 | $display_option = 'modal'; |
602 | - } elseif ( $display_option === 'onpage' ) { |
|
602 | + } elseif ($display_option === 'onpage') { |
|
603 | 603 | return ''; |
604 | 604 | } |
605 | 605 | |
606 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
607 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
606 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
607 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
608 | 608 | |
609 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
609 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
610 | 610 | |
611 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
611 | + echo apply_filters('give_display_checkout_button', $output); |
|
612 | 612 | } |
613 | 613 | |
614 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
614 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -622,57 +622,57 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return void |
624 | 624 | */ |
625 | -function give_user_info_fields( $form_id ) { |
|
625 | +function give_user_info_fields($form_id) { |
|
626 | 626 | // Get user info. |
627 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
627 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
628 | 628 | |
629 | 629 | /** |
630 | 630 | * Fire before user personal information fields |
631 | 631 | * |
632 | 632 | * @since 1.7 |
633 | 633 | */ |
634 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
634 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
635 | 635 | ?> |
636 | 636 | <fieldset id="give_checkout_user_info"> |
637 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
637 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
638 | 638 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
639 | 639 | <label class="give-label" for="give-first"> |
640 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
641 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
640 | + <?php esc_html_e('First Name', 'give'); ?> |
|
641 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
642 | 642 | <span class="give-required-indicator">*</span> |
643 | 643 | <?php endif ?> |
644 | 644 | <span class="give-tooltip give-icon give-icon-question" |
645 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
645 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
646 | 646 | </label> |
647 | 647 | <input |
648 | 648 | class="give-input required" |
649 | 649 | type="text" |
650 | 650 | name="give_first" |
651 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
651 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
652 | 652 | id="give-first" |
653 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
654 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
653 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
654 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
655 | 655 | /> |
656 | 656 | </p> |
657 | 657 | |
658 | 658 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
659 | 659 | <label class="give-label" for="give-last"> |
660 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
661 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
660 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
661 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
662 | 662 | <span class="give-required-indicator">*</span> |
663 | 663 | <?php endif ?> |
664 | 664 | <span class="give-tooltip give-icon give-icon-question" |
665 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
665 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
666 | 666 | </label> |
667 | 667 | |
668 | 668 | <input |
669 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
669 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
670 | 670 | type="text" |
671 | 671 | name="give_last" |
672 | 672 | id="give-last" |
673 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
674 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
675 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
673 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
674 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
675 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
676 | 676 | /> |
677 | 677 | </p> |
678 | 678 | |
@@ -682,26 +682,26 @@ discard block |
||
682 | 682 | * |
683 | 683 | * @since 1.7 |
684 | 684 | */ |
685 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
685 | + do_action('give_donation_form_before_email', $form_id); |
|
686 | 686 | ?> |
687 | 687 | <p id="give-email-wrap" class="form-row form-row-wide"> |
688 | 688 | <label class="give-label" for="give-email"> |
689 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
690 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
689 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
690 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
691 | 691 | <span class="give-required-indicator">*</span> |
692 | 692 | <?php } ?> |
693 | 693 | <span class="give-tooltip give-icon give-icon-question" |
694 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
694 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
695 | 695 | </label> |
696 | 696 | |
697 | 697 | <input |
698 | 698 | class="give-input required" |
699 | 699 | type="email" |
700 | 700 | name="give_email" |
701 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
701 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
702 | 702 | id="give-email" |
703 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
704 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
703 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
704 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
705 | 705 | /> |
706 | 706 | |
707 | 707 | </p> |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | * |
712 | 712 | * @since 1.7 |
713 | 713 | */ |
714 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
714 | + do_action('give_donation_form_after_email', $form_id); |
|
715 | 715 | |
716 | 716 | /** |
717 | 717 | * Fire after personal email field |
718 | 718 | * |
719 | 719 | * @since 1.7 |
720 | 720 | */ |
721 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
721 | + do_action('give_donation_form_user_info', $form_id); |
|
722 | 722 | ?> |
723 | 723 | </fieldset> |
724 | 724 | <?php |
@@ -727,11 +727,11 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @since 1.7 |
729 | 729 | */ |
730 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
730 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
731 | 731 | } |
732 | 732 | |
733 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
733 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
734 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
735 | 735 | |
736 | 736 | /** |
737 | 737 | * Renders the credit card info form. |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return void |
744 | 744 | */ |
745 | -function give_get_cc_form( $form_id ) { |
|
745 | +function give_get_cc_form($form_id) { |
|
746 | 746 | |
747 | 747 | ob_start(); |
748 | 748 | |
@@ -753,53 +753,53 @@ discard block |
||
753 | 753 | * |
754 | 754 | * @param int $form_id The form ID. |
755 | 755 | */ |
756 | - do_action( 'give_before_cc_fields', $form_id ); |
|
756 | + do_action('give_before_cc_fields', $form_id); |
|
757 | 757 | ?> |
758 | 758 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
759 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
760 | - <?php if ( is_ssl() ) : ?> |
|
759 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
760 | + <?php if (is_ssl()) : ?> |
|
761 | 761 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
762 | 762 | <span class="give-icon padlock"></span> |
763 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
763 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
764 | 764 | </div> |
765 | 765 | <?php endif; ?> |
766 | 766 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
767 | 767 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
768 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
768 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
769 | 769 | <span class="give-required-indicator">*</span> |
770 | 770 | <span class="give-tooltip give-icon give-icon-question" |
771 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
771 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
772 | 772 | <span class="card-type"></span> |
773 | 773 | </label> |
774 | 774 | |
775 | 775 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
776 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
776 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
777 | 777 | required aria-required="true"/> |
778 | 778 | </p> |
779 | 779 | |
780 | 780 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
781 | 781 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
782 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
782 | + <?php esc_html_e('CVC', 'give'); ?> |
|
783 | 783 | <span class="give-required-indicator">*</span> |
784 | 784 | <span class="give-tooltip give-icon give-icon-question" |
785 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
785 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
786 | 786 | </label> |
787 | 787 | |
788 | 788 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
789 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
789 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
790 | 790 | required aria-required="true"/> |
791 | 791 | </p> |
792 | 792 | |
793 | 793 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
794 | 794 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
795 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
795 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
796 | 796 | <span class="give-required-indicator">*</span> |
797 | 797 | <span class="give-tooltip give-icon give-icon-question" |
798 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
798 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
799 | 799 | </label> |
800 | 800 | |
801 | 801 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
802 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
802 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
803 | 803 | required aria-required="true"/> |
804 | 804 | </p> |
805 | 805 | <?php |
@@ -810,14 +810,14 @@ discard block |
||
810 | 810 | * |
811 | 811 | * @param int $form_id The form ID. |
812 | 812 | */ |
813 | - do_action( 'give_before_cc_expiration' ); |
|
813 | + do_action('give_before_cc_expiration'); |
|
814 | 814 | ?> |
815 | 815 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
816 | 816 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
817 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
817 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
818 | 818 | <span class="give-required-indicator">*</span> |
819 | 819 | <span class="give-tooltip give-icon give-icon-question" |
820 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
820 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
821 | 821 | </label> |
822 | 822 | |
823 | 823 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | class="card-expiry-year"/> |
827 | 827 | |
828 | 828 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
829 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
829 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
830 | 830 | required aria-required="true"/> |
831 | 831 | </p> |
832 | 832 | <?php |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @param int $form_id The form ID. |
839 | 839 | */ |
840 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
840 | + do_action('give_after_cc_expiration', $form_id); |
|
841 | 841 | ?> |
842 | 842 | </fieldset> |
843 | 843 | <?php |
@@ -848,12 +848,12 @@ discard block |
||
848 | 848 | * |
849 | 849 | * @param int $form_id The form ID. |
850 | 850 | */ |
851 | - do_action( 'give_after_cc_fields', $form_id ); |
|
851 | + do_action('give_after_cc_fields', $form_id); |
|
852 | 852 | |
853 | 853 | echo ob_get_clean(); |
854 | 854 | } |
855 | 855 | |
856 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
856 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
857 | 857 | |
858 | 858 | /** |
859 | 859 | * Outputs the default credit card address fields. |
@@ -864,24 +864,24 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return void |
866 | 866 | */ |
867 | -function give_default_cc_address_fields( $form_id ) { |
|
867 | +function give_default_cc_address_fields($form_id) { |
|
868 | 868 | // Get user info. |
869 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
869 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
870 | 870 | |
871 | 871 | $logged_in = is_user_logged_in(); |
872 | 872 | |
873 | - if ( $logged_in ) { |
|
874 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
873 | + if ($logged_in) { |
|
874 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
875 | 875 | } |
876 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
877 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
878 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
879 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
876 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
877 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
878 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
879 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
880 | 880 | |
881 | 881 | ob_start(); |
882 | 882 | ?> |
883 | 883 | <fieldset id="give_cc_address" class="cc-address"> |
884 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
884 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
885 | 885 | <?php |
886 | 886 | /** |
887 | 887 | * Fires while rendering credit card billing form, before address fields. |
@@ -890,79 +890,79 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @param int $form_id The form ID. |
892 | 892 | */ |
893 | - do_action( 'give_cc_billing_top' ); |
|
893 | + do_action('give_cc_billing_top'); |
|
894 | 894 | ?> |
895 | 895 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
896 | 896 | <label for="card_address" class="give-label"> |
897 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
897 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
898 | 898 | <?php |
899 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
899 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
900 | 900 | <span class="give-required-indicator">*</span> |
901 | 901 | <?php endif; ?> |
902 | 902 | <span class="give-tooltip give-icon give-icon-question" |
903 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
903 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
904 | 904 | </label> |
905 | 905 | |
906 | 906 | <input |
907 | 907 | type="text" |
908 | 908 | id="card_address" |
909 | 909 | name="card_address" |
910 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
911 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
912 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
913 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
910 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
911 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
912 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
913 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
914 | 914 | /> |
915 | 915 | </p> |
916 | 916 | |
917 | 917 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
918 | 918 | <label for="card_address_2" class="give-label"> |
919 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
920 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
919 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
920 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
921 | 921 | <span class="give-required-indicator">*</span> |
922 | 922 | <?php endif; ?> |
923 | 923 | <span class="give-tooltip give-icon give-icon-question" |
924 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
924 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
925 | 925 | </label> |
926 | 926 | |
927 | 927 | <input |
928 | 928 | type="text" |
929 | 929 | id="card_address_2" |
930 | 930 | name="card_address_2" |
931 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
932 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
933 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
934 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
931 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
932 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
933 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
934 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
935 | 935 | /> |
936 | 936 | </p> |
937 | 937 | |
938 | 938 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
939 | 939 | <label for="card_city" class="give-label"> |
940 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
941 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
940 | + <?php esc_html_e('City', 'give'); ?> |
|
941 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
942 | 942 | <span class="give-required-indicator">*</span> |
943 | 943 | <?php endif; ?> |
944 | 944 | <span class="give-tooltip give-icon give-icon-question" |
945 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
945 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
946 | 946 | </label> |
947 | 947 | <input |
948 | 948 | type="text" |
949 | 949 | id="card_city" |
950 | 950 | name="card_city" |
951 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
952 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
953 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
954 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
951 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
952 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
953 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
954 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
955 | 955 | /> |
956 | 956 | </p> |
957 | 957 | |
958 | 958 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
959 | 959 | <label for="card_zip" class="give-label"> |
960 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
961 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
960 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
961 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
962 | 962 | <span class="give-required-indicator">*</span> |
963 | 963 | <?php endif; ?> |
964 | 964 | <span class="give-tooltip give-icon give-icon-question" |
965 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
965 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
966 | 966 | </label> |
967 | 967 | |
968 | 968 | <input |
@@ -970,40 +970,40 @@ discard block |
||
970 | 970 | size="4" |
971 | 971 | id="card_zip" |
972 | 972 | name="card_zip" |
973 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
974 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
975 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
976 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
973 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
974 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
975 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
976 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
977 | 977 | /> |
978 | 978 | </p> |
979 | 979 | |
980 | 980 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
981 | 981 | <label for="billing_country" class="give-label"> |
982 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
983 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
982 | + <?php esc_html_e('Country', 'give'); ?> |
|
983 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
984 | 984 | <span class="give-required-indicator">*</span> |
985 | 985 | <?php endif; ?> |
986 | 986 | <span class="give-tooltip give-icon give-icon-question" |
987 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
987 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
988 | 988 | </label> |
989 | 989 | |
990 | 990 | <select |
991 | 991 | name="billing_country" |
992 | 992 | id="billing_country" |
993 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
994 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
993 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
994 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
995 | 995 | > |
996 | 996 | <?php |
997 | 997 | |
998 | 998 | $selected_country = give_get_country(); |
999 | 999 | |
1000 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1000 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1001 | 1001 | $selected_country = $give_user_info['billing_country']; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | $countries = give_get_country_list(); |
1005 | - foreach ( $countries as $country_code => $country ) { |
|
1006 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1005 | + foreach ($countries as $country_code => $country) { |
|
1006 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1007 | 1007 | } |
1008 | 1008 | ?> |
1009 | 1009 | </select> |
@@ -1011,37 +1011,37 @@ discard block |
||
1011 | 1011 | |
1012 | 1012 | <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive"> |
1013 | 1013 | <label for="card_state" class="give-label"> |
1014 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
1015 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
1014 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
1015 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
1016 | 1016 | <span class="give-required-indicator">*</span> |
1017 | 1017 | <?php endif; ?> |
1018 | 1018 | <span class="give-tooltip give-icon give-icon-question" |
1019 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
1019 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
1020 | 1020 | </label> |
1021 | 1021 | |
1022 | 1022 | <?php |
1023 | 1023 | $selected_state = give_get_state(); |
1024 | - $states = give_get_states( $selected_country ); |
|
1024 | + $states = give_get_states($selected_country); |
|
1025 | 1025 | |
1026 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
1026 | + if ( ! empty($give_user_info['card_state'])) { |
|
1027 | 1027 | $selected_state = $give_user_info['card_state']; |
1028 | 1028 | } |
1029 | 1029 | |
1030 | - if ( ! empty( $states ) ) : ?> |
|
1030 | + if ( ! empty($states)) : ?> |
|
1031 | 1031 | <select |
1032 | 1032 | name="card_state" |
1033 | 1033 | id="card_state" |
1034 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1035 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1034 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1035 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1036 | 1036 | <?php |
1037 | - foreach ( $states as $state_code => $state ) { |
|
1038 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1037 | + foreach ($states as $state_code => $state) { |
|
1038 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1039 | 1039 | } |
1040 | 1040 | ?> |
1041 | 1041 | </select> |
1042 | 1042 | <?php else : ?> |
1043 | 1043 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1044 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
1044 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
1045 | 1045 | <?php endif; ?> |
1046 | 1046 | </p> |
1047 | 1047 | <?php |
@@ -1052,14 +1052,14 @@ discard block |
||
1052 | 1052 | * |
1053 | 1053 | * @param int $form_id The form ID. |
1054 | 1054 | */ |
1055 | - do_action( 'give_cc_billing_bottom' ); |
|
1055 | + do_action('give_cc_billing_bottom'); |
|
1056 | 1056 | ?> |
1057 | 1057 | </fieldset> |
1058 | 1058 | <?php |
1059 | 1059 | echo ob_get_clean(); |
1060 | 1060 | } |
1061 | 1061 | |
1062 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1062 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1063 | 1063 | |
1064 | 1064 | |
1065 | 1065 | /** |
@@ -1072,24 +1072,24 @@ discard block |
||
1072 | 1072 | * |
1073 | 1073 | * @return string |
1074 | 1074 | */ |
1075 | -function give_get_register_fields( $form_id ) { |
|
1075 | +function give_get_register_fields($form_id) { |
|
1076 | 1076 | |
1077 | 1077 | global $user_ID; |
1078 | 1078 | |
1079 | - if ( is_user_logged_in() ) { |
|
1080 | - $user_data = get_userdata( $user_ID ); |
|
1079 | + if (is_user_logged_in()) { |
|
1080 | + $user_data = get_userdata($user_ID); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1083 | + $show_register_form = give_show_login_register_option($form_id); |
|
1084 | 1084 | |
1085 | 1085 | ob_start(); ?> |
1086 | 1086 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1087 | 1087 | |
1088 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1088 | + <?php if ($show_register_form == 'both') { ?> |
|
1089 | 1089 | <div class="give-login-account-wrap"> |
1090 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1091 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1092 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1090 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1091 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1092 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1093 | 1093 | </p> |
1094 | 1094 | <p class="give-loading-text"> |
1095 | 1095 | <span class="give-loading-animation"></span> |
@@ -1105,15 +1105,15 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @param int $form_id The form ID. |
1107 | 1107 | */ |
1108 | - do_action( 'give_register_fields_before', $form_id ); |
|
1108 | + do_action('give_register_fields_before', $form_id); |
|
1109 | 1109 | ?> |
1110 | 1110 | |
1111 | 1111 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1112 | 1112 | <legend> |
1113 | 1113 | <?php |
1114 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1115 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1116 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1114 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1115 | + if ( ! give_logged_in_only($form_id)) { |
|
1116 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1117 | 1117 | } |
1118 | 1118 | ?> |
1119 | 1119 | </legend> |
@@ -1125,54 +1125,54 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @param int $form_id The form ID. |
1127 | 1127 | */ |
1128 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1128 | + do_action('give_register_account_fields_before', $form_id); |
|
1129 | 1129 | ?> |
1130 | 1130 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
1131 | 1131 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
1132 | 1132 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1133 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1134 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1133 | + <?php esc_html_e('Username', 'give'); ?> |
|
1134 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1135 | 1135 | <span class="give-required-indicator">*</span> |
1136 | 1136 | <?php } ?> |
1137 | 1137 | <span class="give-tooltip give-icon give-icon-question" |
1138 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1138 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1139 | 1139 | </label> |
1140 | 1140 | |
1141 | 1141 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
1142 | 1142 | type="text" |
1143 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1143 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1144 | 1144 | </div> |
1145 | 1145 | |
1146 | 1146 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1147 | 1147 | class="form-row form-row-one-third form-row-responsive"> |
1148 | 1148 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1149 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1150 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1149 | + <?php esc_html_e('Password', 'give'); ?> |
|
1150 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1151 | 1151 | <span class="give-required-indicator">*</span> |
1152 | 1152 | <?php } ?> |
1153 | 1153 | <span class="give-tooltip give-icon give-icon-question" |
1154 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1154 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1155 | 1155 | </label> |
1156 | 1156 | |
1157 | 1157 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
1158 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
1159 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1158 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
1159 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1160 | 1160 | </div> |
1161 | 1161 | |
1162 | 1162 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
1163 | 1163 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
1164 | 1164 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1165 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1166 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1165 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1166 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1167 | 1167 | <span class="give-required-indicator">*</span> |
1168 | 1168 | <?php } ?> |
1169 | 1169 | <span class="give-tooltip give-icon give-icon-question" |
1170 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1170 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1171 | 1171 | </label> |
1172 | 1172 | |
1173 | 1173 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
1174 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
1175 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1174 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
1175 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1176 | 1176 | </div> |
1177 | 1177 | <?php |
1178 | 1178 | /** |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * |
1183 | 1183 | * @param int $form_id The form ID. |
1184 | 1184 | */ |
1185 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1185 | + do_action('give_register_account_fields_after', $form_id); |
|
1186 | 1186 | ?> |
1187 | 1187 | </fieldset> |
1188 | 1188 | |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | * |
1195 | 1195 | * @param int $form_id The form ID. |
1196 | 1196 | */ |
1197 | - do_action( 'give_register_fields_after', $form_id ); |
|
1197 | + do_action('give_register_fields_after', $form_id); |
|
1198 | 1198 | ?> |
1199 | 1199 | |
1200 | 1200 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | * |
1206 | 1206 | * @since 1.7 |
1207 | 1207 | */ |
1208 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1208 | + do_action('give_donation_form_user_info', $form_id); |
|
1209 | 1209 | ?> |
1210 | 1210 | |
1211 | 1211 | </fieldset> |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | echo ob_get_clean(); |
1214 | 1214 | } |
1215 | 1215 | |
1216 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1216 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1217 | 1217 | |
1218 | 1218 | /** |
1219 | 1219 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1226,27 +1226,27 @@ discard block |
||
1226 | 1226 | * |
1227 | 1227 | * @return string |
1228 | 1228 | */ |
1229 | -function give_get_login_fields( $form_id ) { |
|
1229 | +function give_get_login_fields($form_id) { |
|
1230 | 1230 | |
1231 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1232 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1231 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1232 | + $show_register_form = give_show_login_register_option($form_id); |
|
1233 | 1233 | |
1234 | 1234 | ob_start(); |
1235 | 1235 | ?> |
1236 | 1236 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1237 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1238 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1239 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1237 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1238 | + if ( ! give_logged_in_only($form_id)) { |
|
1239 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1240 | 1240 | } ?> |
1241 | 1241 | </legend> |
1242 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1242 | + <?php if ($show_register_form == 'both') { ?> |
|
1243 | 1243 | <p class="give-new-account-link"> |
1244 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1245 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1244 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1245 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1246 | 1246 | data-action="give_checkout_register"> |
1247 | - <?php esc_html_e( 'Register', 'give' ); |
|
1248 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1249 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
1247 | + <?php esc_html_e('Register', 'give'); |
|
1248 | + if ( ! give_logged_in_only($form_id)) { |
|
1249 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
1250 | 1250 | } ?> |
1251 | 1251 | </a> |
1252 | 1252 | </p> |
@@ -1262,49 +1262,49 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @param int $form_id The form ID. |
1264 | 1264 | */ |
1265 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1265 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1266 | 1266 | ?> |
1267 | 1267 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
1268 | 1268 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1269 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1270 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1269 | + <?php esc_html_e('Username', 'give'); ?> |
|
1270 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1271 | 1271 | <span class="give-required-indicator">*</span> |
1272 | 1272 | <?php } ?> |
1273 | 1273 | </label> |
1274 | 1274 | |
1275 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1275 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1276 | 1276 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1277 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1277 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1278 | 1278 | </div> |
1279 | 1279 | |
1280 | 1280 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1281 | 1281 | class="give_login_password form-row form-row-last form-row-responsive"> |
1282 | 1282 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1283 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1284 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1283 | + <?php esc_html_e('Password', 'give'); ?> |
|
1284 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1285 | 1285 | <span class="give-required-indicator">*</span> |
1286 | 1286 | <?php } ?> |
1287 | 1287 | </label> |
1288 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1288 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1289 | 1289 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1290 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1290 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1291 | 1291 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1292 | 1292 | </div> |
1293 | 1293 | |
1294 | 1294 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1295 | 1295 | <span class="give-forgot-password "> |
1296 | 1296 | <a href="<?php echo wp_lostpassword_url() ?>" |
1297 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1297 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1298 | 1298 | </span> |
1299 | 1299 | </div> |
1300 | 1300 | |
1301 | 1301 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1302 | 1302 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1303 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1304 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1303 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1304 | + <?php if ($show_register_form !== 'login') { ?> |
|
1305 | 1305 | <input type="button" data-action="give_cancel_login" |
1306 | 1306 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1307 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1307 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1308 | 1308 | <?php } ?> |
1309 | 1309 | <span class="give-loading-animation"></span> |
1310 | 1310 | </div> |
@@ -1316,14 +1316,14 @@ discard block |
||
1316 | 1316 | * |
1317 | 1317 | * @param int $form_id The form ID. |
1318 | 1318 | */ |
1319 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1319 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1320 | 1320 | ?> |
1321 | 1321 | </fieldset><!--end #give-login-fields--> |
1322 | 1322 | <?php |
1323 | 1323 | echo ob_get_clean(); |
1324 | 1324 | } |
1325 | 1325 | |
1326 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1326 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1327 | 1327 | |
1328 | 1328 | /** |
1329 | 1329 | * Payment Mode Select. |
@@ -1339,9 +1339,9 @@ discard block |
||
1339 | 1339 | * |
1340 | 1340 | * @return void |
1341 | 1341 | */ |
1342 | -function give_payment_mode_select( $form_id ) { |
|
1342 | +function give_payment_mode_select($form_id) { |
|
1343 | 1343 | |
1344 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1344 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1345 | 1345 | |
1346 | 1346 | /** |
1347 | 1347 | * Fires while selecting payment gateways, before the fields. |
@@ -1350,10 +1350,10 @@ discard block |
||
1350 | 1350 | * |
1351 | 1351 | * @param int $form_id The form ID. |
1352 | 1352 | */ |
1353 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1353 | + do_action('give_payment_mode_top', $form_id); |
|
1354 | 1354 | ?> |
1355 | 1355 | |
1356 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1356 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1357 | 1357 | echo 'style="display: none;"'; |
1358 | 1358 | } ?>> |
1359 | 1359 | <?php |
@@ -1364,10 +1364,10 @@ discard block |
||
1364 | 1364 | * |
1365 | 1365 | * @param int $form_id The form ID. |
1366 | 1366 | */ |
1367 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1367 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1368 | 1368 | ?> |
1369 | 1369 | <legend |
1370 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1370 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1371 | 1371 | <span class="give-loading-text"><span |
1372 | 1372 | class="give-loading-animation"></span> |
1373 | 1373 | </span> |
@@ -1380,26 +1380,26 @@ discard block |
||
1380 | 1380 | * |
1381 | 1381 | * @since 1.7 |
1382 | 1382 | */ |
1383 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1383 | + do_action('give_payment_mode_before_gateways') |
|
1384 | 1384 | ?> |
1385 | 1385 | <ul id="give-gateway-radio-list"> |
1386 | 1386 | <?php |
1387 | 1387 | /** |
1388 | 1388 | * Loop through the active payment gateways. |
1389 | 1389 | */ |
1390 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1390 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1391 | 1391 | |
1392 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1392 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1393 | 1393 | //Determine the default gateway. |
1394 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1394 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1395 | 1395 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
1396 | 1396 | <li<?php echo $checked_class ?>> |
1397 | 1397 | <input type="radio" name="payment-mode" class="give-gateway" |
1398 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1399 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1400 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1398 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1399 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1400 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1401 | 1401 | class="give-gateway-option" |
1402 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
1402 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
1403 | 1403 | </li> |
1404 | 1404 | <?php |
1405 | 1405 | endforeach; |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | * |
1412 | 1412 | * @since 1.7 |
1413 | 1413 | */ |
1414 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1414 | + do_action('give_payment_mode_after_gateways'); |
|
1415 | 1415 | ?> |
1416 | 1416 | </div> |
1417 | 1417 | <?php |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | * |
1423 | 1423 | * @param int $form_id The form ID. |
1424 | 1424 | */ |
1425 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1425 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1426 | 1426 | ?> |
1427 | 1427 | </fieldset> |
1428 | 1428 | |
@@ -1434,7 +1434,7 @@ discard block |
||
1434 | 1434 | * |
1435 | 1435 | * @param int $form_id The form ID. |
1436 | 1436 | */ |
1437 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1437 | + do_action('give_payment_mode_bottom', $form_id); |
|
1438 | 1438 | ?> |
1439 | 1439 | |
1440 | 1440 | <div id="give_purchase_form_wrap"> |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | * |
1446 | 1446 | * @since 1.7 |
1447 | 1447 | */ |
1448 | - do_action( 'give_donation_form', $form_id ); |
|
1448 | + do_action('give_donation_form', $form_id); |
|
1449 | 1449 | ?> |
1450 | 1450 | |
1451 | 1451 | </div> |
@@ -1456,10 +1456,10 @@ discard block |
||
1456 | 1456 | * |
1457 | 1457 | * @since 1.7 |
1458 | 1458 | */ |
1459 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1459 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1462 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1463 | 1463 | |
1464 | 1464 | /** |
1465 | 1465 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1472,31 +1472,31 @@ discard block |
||
1472 | 1472 | * |
1473 | 1473 | * @return bool |
1474 | 1474 | */ |
1475 | -function give_terms_agreement( $form_id ) { |
|
1476 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1475 | +function give_terms_agreement($form_id) { |
|
1476 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1477 | 1477 | |
1478 | 1478 | // Bailout if per form and global term and conditions is not setup. |
1479 | 1479 | if ( |
1480 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1481 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1480 | + give_is_setting_enabled($form_option, 'global') |
|
1481 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1482 | 1482 | ) { |
1483 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1484 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
1485 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
1483 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1484 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
1485 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
1486 | 1486 | |
1487 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1488 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
1489 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1490 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
1487 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1488 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
1489 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1490 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
1491 | 1491 | |
1492 | 1492 | } else { |
1493 | 1493 | return false; |
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | // Bailout: Check if term and conditions text is empty or not. |
1497 | - if ( empty( $terms ) ) { |
|
1498 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
1499 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
1497 | + if (empty($terms)) { |
|
1498 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
1499 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
1500 | 1500 | } |
1501 | 1501 | |
1502 | 1502 | return false; |
@@ -1504,7 +1504,7 @@ discard block |
||
1504 | 1504 | |
1505 | 1505 | ?> |
1506 | 1506 | <fieldset id="give_terms_agreement"> |
1507 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1507 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1508 | 1508 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1509 | 1509 | <?php |
1510 | 1510 | /** |
@@ -1512,22 +1512,22 @@ discard block |
||
1512 | 1512 | * |
1513 | 1513 | * @since 1.0 |
1514 | 1514 | */ |
1515 | - do_action( 'give_before_terms' ); |
|
1515 | + do_action('give_before_terms'); |
|
1516 | 1516 | |
1517 | - echo wpautop( stripslashes( $terms ) ); |
|
1517 | + echo wpautop(stripslashes($terms)); |
|
1518 | 1518 | /** |
1519 | 1519 | * Fires while rendering terms of agreement, after the fields. |
1520 | 1520 | * |
1521 | 1521 | * @since 1.0 |
1522 | 1522 | */ |
1523 | - do_action( 'give_after_terms' ); |
|
1523 | + do_action('give_after_terms'); |
|
1524 | 1524 | ?> |
1525 | 1525 | </div> |
1526 | 1526 | <div id="give_show_terms"> |
1527 | 1527 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1528 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1528 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1529 | 1529 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1530 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1530 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1531 | 1531 | </div> |
1532 | 1532 | |
1533 | 1533 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | <?php |
1539 | 1539 | } |
1540 | 1540 | |
1541 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1541 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1542 | 1542 | |
1543 | 1543 | /** |
1544 | 1544 | * Checkout Final Total. |
@@ -1551,29 +1551,29 @@ discard block |
||
1551 | 1551 | * |
1552 | 1552 | * @return void |
1553 | 1553 | */ |
1554 | -function give_checkout_final_total( $form_id ) { |
|
1554 | +function give_checkout_final_total($form_id) { |
|
1555 | 1555 | |
1556 | - if ( isset( $_POST['give_total'] ) ) { |
|
1557 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1556 | + if (isset($_POST['give_total'])) { |
|
1557 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1558 | 1558 | } else { |
1559 | 1559 | //default total. |
1560 | - $total = give_get_default_form_amount( $form_id ); |
|
1560 | + $total = give_get_default_form_amount($form_id); |
|
1561 | 1561 | } |
1562 | 1562 | //Only proceed if give_total available. |
1563 | - if ( empty( $total ) ) { |
|
1563 | + if (empty($total)) { |
|
1564 | 1564 | return; |
1565 | 1565 | } |
1566 | 1566 | ?> |
1567 | 1567 | <p id="give-final-total-wrap" class="form-wrap "> |
1568 | 1568 | <span |
1569 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1569 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1570 | 1570 | <span class="give-final-total-amount" |
1571 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1571 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1572 | 1572 | </p> |
1573 | 1573 | <?php |
1574 | 1574 | } |
1575 | 1575 | |
1576 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1576 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1577 | 1577 | |
1578 | 1578 | /** |
1579 | 1579 | * Renders the Checkout Submit section. |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | * |
1585 | 1585 | * @return void |
1586 | 1586 | */ |
1587 | -function give_checkout_submit( $form_id ) { |
|
1587 | +function give_checkout_submit($form_id) { |
|
1588 | 1588 | ?> |
1589 | 1589 | <fieldset id="give_purchase_submit"> |
1590 | 1590 | <?php |
@@ -1593,24 +1593,24 @@ discard block |
||
1593 | 1593 | * |
1594 | 1594 | * @since 1.7 |
1595 | 1595 | */ |
1596 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1596 | + do_action('give_donation_form_before_submit', $form_id); |
|
1597 | 1597 | |
1598 | - give_checkout_hidden_fields( $form_id ); |
|
1598 | + give_checkout_hidden_fields($form_id); |
|
1599 | 1599 | |
1600 | - echo give_checkout_button_purchase( $form_id ); |
|
1600 | + echo give_checkout_button_purchase($form_id); |
|
1601 | 1601 | |
1602 | 1602 | /** |
1603 | 1603 | * Fire after donation form submit. |
1604 | 1604 | * |
1605 | 1605 | * @since 1.7 |
1606 | 1606 | */ |
1607 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1607 | + do_action('give_donation_form_after_submit', $form_id); |
|
1608 | 1608 | ?> |
1609 | 1609 | </fieldset> |
1610 | 1610 | <?php |
1611 | 1611 | } |
1612 | 1612 | |
1613 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1613 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1614 | 1614 | |
1615 | 1615 | /** |
1616 | 1616 | * Give Checkout Button. |
@@ -1623,10 +1623,10 @@ discard block |
||
1623 | 1623 | * |
1624 | 1624 | * @return string |
1625 | 1625 | */ |
1626 | -function give_checkout_button_purchase( $form_id ) { |
|
1626 | +function give_checkout_button_purchase($form_id) { |
|
1627 | 1627 | |
1628 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1629 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1628 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1629 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1630 | 1630 | ob_start(); ?> |
1631 | 1631 | <div class="give-submit-button-wrap give-clearfix"> |
1632 | 1632 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | <span class="give-loading-animation"></span> |
1635 | 1635 | </div> |
1636 | 1636 | <?php |
1637 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1637 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1638 | 1638 | } |
1639 | 1639 | |
1640 | 1640 | /** |
@@ -1649,17 +1649,17 @@ discard block |
||
1649 | 1649 | * |
1650 | 1650 | * @return mixed |
1651 | 1651 | */ |
1652 | -function give_show_goal_progress( $form_id, $args ) { |
|
1652 | +function give_show_goal_progress($form_id, $args) { |
|
1653 | 1653 | |
1654 | 1654 | ob_start(); |
1655 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1655 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1656 | 1656 | |
1657 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1657 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1658 | 1658 | |
1659 | 1659 | return true; |
1660 | 1660 | } |
1661 | 1661 | |
1662 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1662 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1663 | 1663 | |
1664 | 1664 | |
1665 | 1665 | /** |
@@ -1672,10 +1672,10 @@ discard block |
||
1672 | 1672 | * |
1673 | 1673 | * @return mixed|string |
1674 | 1674 | */ |
1675 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1675 | +function give_get_form_content_placement($form_id, $args) { |
|
1676 | 1676 | $show_content = ''; |
1677 | 1677 | |
1678 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1678 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1679 | 1679 | // Content positions. |
1680 | 1680 | $content_placement = array( |
1681 | 1681 | 'above' => 'give_pre_form', |
@@ -1683,18 +1683,18 @@ discard block |
||
1683 | 1683 | ); |
1684 | 1684 | |
1685 | 1685 | // Check if content position already decoded. |
1686 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1686 | + if (in_array($args['show_content'], $content_placement)) { |
|
1687 | 1687 | return $args['show_content']; |
1688 | 1688 | } |
1689 | 1689 | |
1690 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1690 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1691 | 1691 | |
1692 | - } elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1693 | - $show_content = get_post_meta( $form_id, '_give_content_placement', true ); |
|
1692 | + } elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) { |
|
1693 | + $show_content = get_post_meta($form_id, '_give_content_placement', true); |
|
1694 | 1694 | |
1695 | - } elseif ( 'none' !== get_post_meta( $form_id, '_give_content_option', true ) ) { |
|
1695 | + } elseif ('none' !== get_post_meta($form_id, '_give_content_option', true)) { |
|
1696 | 1696 | // Backward compatibility for _give_content_option for v18. |
1697 | - $show_content = get_post_meta( $form_id, '_give_content_option', true ); |
|
1697 | + $show_content = get_post_meta($form_id, '_give_content_option', true); |
|
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | return $show_content; |
@@ -1710,20 +1710,20 @@ discard block |
||
1710 | 1710 | * |
1711 | 1711 | * @return void|bool |
1712 | 1712 | */ |
1713 | -function give_form_content( $form_id, $args ) { |
|
1713 | +function give_form_content($form_id, $args) { |
|
1714 | 1714 | |
1715 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1715 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1716 | 1716 | |
1717 | 1717 | // Bailout. |
1718 | - if ( empty( $show_content ) ) { |
|
1718 | + if (empty($show_content)) { |
|
1719 | 1719 | return false; |
1720 | 1720 | } |
1721 | 1721 | |
1722 | 1722 | // Add action according to value. |
1723 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1723 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1724 | 1724 | } |
1725 | 1725 | |
1726 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1726 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1727 | 1727 | |
1728 | 1728 | /** |
1729 | 1729 | * Renders Post Form Content. |
@@ -1737,22 +1737,22 @@ discard block |
||
1737 | 1737 | * |
1738 | 1738 | * @return void |
1739 | 1739 | */ |
1740 | -function give_form_display_content( $form_id, $args ) { |
|
1740 | +function give_form_display_content($form_id, $args) { |
|
1741 | 1741 | |
1742 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1743 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1742 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1743 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1744 | 1744 | |
1745 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1746 | - $content = apply_filters( 'the_content', $content ); |
|
1745 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1746 | + $content = apply_filters('the_content', $content); |
|
1747 | 1747 | } |
1748 | 1748 | |
1749 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
1749 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
1750 | 1750 | |
1751 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1751 | + echo apply_filters('give_form_content_output', $output); |
|
1752 | 1752 | |
1753 | 1753 | //remove action to prevent content output on addition forms on page. |
1754 | 1754 | //@see: https://github.com/WordImpress/Give/issues/634. |
1755 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1755 | + remove_action($show_content, 'give_form_display_content'); |
|
1756 | 1756 | } |
1757 | 1757 | |
1758 | 1758 | /** |
@@ -1764,7 +1764,7 @@ discard block |
||
1764 | 1764 | * |
1765 | 1765 | * @return void |
1766 | 1766 | */ |
1767 | -function give_checkout_hidden_fields( $form_id ) { |
|
1767 | +function give_checkout_hidden_fields($form_id) { |
|
1768 | 1768 | |
1769 | 1769 | /** |
1770 | 1770 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1773,13 +1773,13 @@ discard block |
||
1773 | 1773 | * |
1774 | 1774 | * @param int $form_id The form ID. |
1775 | 1775 | */ |
1776 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1776 | + do_action('give_hidden_fields_before', $form_id); |
|
1777 | 1777 | |
1778 | - if ( is_user_logged_in() ) { ?> |
|
1778 | + if (is_user_logged_in()) { ?> |
|
1779 | 1779 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1780 | 1780 | <?php } ?> |
1781 | 1781 | <input type="hidden" name="give_action" value="purchase"/> |
1782 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1782 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1783 | 1783 | <?php |
1784 | 1784 | /** |
1785 | 1785 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1788,7 +1788,7 @@ discard block |
||
1788 | 1788 | * |
1789 | 1789 | * @param int $form_id The form ID. |
1790 | 1790 | */ |
1791 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1791 | + do_action('give_hidden_fields_after', $form_id); |
|
1792 | 1792 | |
1793 | 1793 | } |
1794 | 1794 | |
@@ -1803,20 +1803,20 @@ discard block |
||
1803 | 1803 | * |
1804 | 1804 | * @return string $content Filtered content. |
1805 | 1805 | */ |
1806 | -function give_filter_success_page_content( $content ) { |
|
1806 | +function give_filter_success_page_content($content) { |
|
1807 | 1807 | |
1808 | 1808 | $give_options = give_get_settings(); |
1809 | 1809 | |
1810 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1811 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1812 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1810 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1811 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1812 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1813 | 1813 | } |
1814 | 1814 | } |
1815 | 1815 | |
1816 | 1816 | return $content; |
1817 | 1817 | } |
1818 | 1818 | |
1819 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1819 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1820 | 1820 | |
1821 | 1821 | /** |
1822 | 1822 | * Test Mode Frontend Warning. |
@@ -1827,12 +1827,12 @@ discard block |
||
1827 | 1827 | */ |
1828 | 1828 | function give_test_mode_frontend_warning() { |
1829 | 1829 | |
1830 | - if ( give_is_test_mode() ) { |
|
1831 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
1830 | + if (give_is_test_mode()) { |
|
1831 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
1832 | 1832 | } |
1833 | 1833 | } |
1834 | 1834 | |
1835 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1835 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1836 | 1836 | |
1837 | 1837 | /** |
1838 | 1838 | * Members-only Form. |
@@ -1846,21 +1846,21 @@ discard block |
||
1846 | 1846 | * |
1847 | 1847 | * @return string |
1848 | 1848 | */ |
1849 | -function give_members_only_form( $final_output, $args ) { |
|
1849 | +function give_members_only_form($final_output, $args) { |
|
1850 | 1850 | |
1851 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1851 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1852 | 1852 | |
1853 | 1853 | //Sanity Check: Must have form_id & not be logged in. |
1854 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1854 | + if (empty($form_id) || is_user_logged_in()) { |
|
1855 | 1855 | return $final_output; |
1856 | 1856 | } |
1857 | 1857 | |
1858 | 1858 | //Logged in only and Register / Login set to none. |
1859 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1859 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1860 | 1860 | |
1861 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1861 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1862 | 1862 | |
1863 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1863 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1864 | 1864 | |
1865 | 1865 | } |
1866 | 1866 | |
@@ -1868,4 +1868,4 @@ discard block |
||
1868 | 1868 | |
1869 | 1869 | } |
1870 | 1870 | |
1871 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1871 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function __clone() { |
234 | 234 | // Cloning instances of the class is forbidden |
235 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
235 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function __wakeup() { |
247 | 247 | // Unserializing instances of the class is forbidden. |
248 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
248 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | private function setup_constants() { |
260 | 260 | |
261 | 261 | // Plugin version |
262 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
263 | - define( 'GIVE_VERSION', '1.8.6' ); |
|
262 | + if ( ! defined('GIVE_VERSION')) { |
|
263 | + define('GIVE_VERSION', '1.8.6'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | // Plugin Folder Path |
267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
267 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | // Plugin Folder URL |
272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
272 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // Plugin Basename aka: "give/give.php" |
277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // Plugin Root File |
282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
282 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
283 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | // Make sure CAL_GREGORIAN is defined |
287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
288 | - define( 'CAL_GREGORIAN', 1 ); |
|
287 | + if ( ! defined('CAL_GREGORIAN')) { |
|
288 | + define('CAL_GREGORIAN', 1); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,122 +300,122 @@ discard block |
||
300 | 300 | private function includes() { |
301 | 301 | global $give_options; |
302 | 302 | |
303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
305 | 305 | $give_options = give_get_settings(); |
306 | 306 | |
307 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
314 | - |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
329 | - |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
347 | - |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
353 | - |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
359 | - |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
362 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
365 | - |
|
366 | - if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
314 | + |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
329 | + |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
347 | + |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
353 | + |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
359 | + |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
362 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
365 | + |
|
366 | + if (defined('WP_CLI') && WP_CLI) { |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
368 | 368 | } |
369 | 369 | |
370 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
371 | - |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
377 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
384 | - |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
387 | - |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
394 | - |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
402 | - |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
412 | - |
|
413 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
370 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
371 | + |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
377 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
384 | + |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
387 | + |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
394 | + |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
402 | + |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
412 | + |
|
413 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
415 | 415 | |
416 | 416 | } |
417 | 417 | |
418 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
419 | 419 | |
420 | 420 | } |
421 | 421 | |
@@ -429,26 +429,26 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function load_textdomain() { |
431 | 431 | // Set filter for Give's languages directory |
432 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
433 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
432 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
433 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
434 | 434 | |
435 | 435 | // Traditional WordPress plugin locale filter |
436 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
437 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
436 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
437 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
438 | 438 | |
439 | 439 | // Setup paths to current locale file |
440 | - $mofile_local = $give_lang_dir . $mofile; |
|
441 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
440 | + $mofile_local = $give_lang_dir.$mofile; |
|
441 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
442 | 442 | |
443 | - if ( file_exists( $mofile_global ) ) { |
|
443 | + if (file_exists($mofile_global)) { |
|
444 | 444 | // Look in global /wp-content/languages/give folder |
445 | - load_textdomain( 'give', $mofile_global ); |
|
446 | - } elseif ( file_exists( $mofile_local ) ) { |
|
445 | + load_textdomain('give', $mofile_global); |
|
446 | + } elseif (file_exists($mofile_local)) { |
|
447 | 447 | // Look in local location from filter `give_languages_directory` |
448 | - load_textdomain( 'give', $mofile_local ); |
|
448 | + load_textdomain('give', $mofile_local); |
|
449 | 449 | } else { |
450 | 450 | // Load the default language files packaged up w/ Give |
451 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
451 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
452 | 452 | } |
453 | 453 | } |
454 | 454 |