@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -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 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -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 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -812,10 +812,10 @@ discard block |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | if ( ! is_int( $params[1] ) |
815 | - && ! is_float( $params[1] ) |
|
816 | - && ! is_string( $params[1] ) |
|
817 | - && $params[1] !== null |
|
818 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
815 | + && ! is_float( $params[1] ) |
|
816 | + && ! is_string( $params[1] ) |
|
817 | + && $params[1] !== null |
|
818 | + && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
819 | 819 | ) { |
820 | 820 | trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
821 | 821 | |
@@ -823,10 +823,10 @@ discard block |
||
823 | 823 | } |
824 | 824 | |
825 | 825 | if ( isset( $params[2] ) |
826 | - && ! is_int( $params[2] ) |
|
827 | - && ! is_float( $params[2] ) |
|
828 | - && ! is_string( $params[2] ) |
|
829 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
826 | + && ! is_int( $params[2] ) |
|
827 | + && ! is_float( $params[2] ) |
|
828 | + && ! is_string( $params[2] ) |
|
829 | + && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
830 | 830 | ) { |
831 | 831 | trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
832 | 832 |
@@ -1481,6 +1481,7 @@ discard block |
||
1481 | 1481 | * Check if Import donation is duplicate |
1482 | 1482 | * |
1483 | 1483 | * @since 1.8.13 |
1484 | + * @param Give_Donate_Form $form |
|
1484 | 1485 | */ |
1485 | 1486 | function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) { |
1486 | 1487 | $return = false; |
@@ -1566,7 +1567,6 @@ discard block |
||
1566 | 1567 | * Import CSV in DB |
1567 | 1568 | * |
1568 | 1569 | * @param int $file_id CSV id |
1569 | - * @param array $mapto Map csv to meta key. |
|
1570 | 1570 | * @param int $start Start from which csv line. |
1571 | 1571 | * @param int $end End from which csv line. |
1572 | 1572 | */ |
@@ -2055,7 +2055,7 @@ discard block |
||
2055 | 2055 | * @since 1.8.13 |
2056 | 2056 | * |
2057 | 2057 | * @param array $list List of objects or arrays |
2058 | - * @param int|string $field Field from the object to place instead of the entire object |
|
2058 | + * @param string $field Field from the object to place instead of the entire object |
|
2059 | 2059 | * @param int|string $index_key Optional. Field from the object to use as keys for the new array. |
2060 | 2060 | * Default null. |
2061 | 2061 | * |
@@ -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' => __( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => __( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => __( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => __( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => __( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => __( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => __( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => __( 'Danish Krone (kr.)', 'give' ), |
|
77 | - 'HKD' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => __( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => __( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => __( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => __( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => __( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => __( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => __( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => __( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => __( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => __( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => __( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => __( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => __( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => __( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => __( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => __( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => __( 'Russian Rubles (руб)', 'give' ), |
|
69 | + 'USD' => __('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => __('Euros (€)', 'give'), |
|
71 | + 'GBP' => __('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => __('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => __('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => __('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => __('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => __('Danish Krone (kr.)', 'give'), |
|
77 | + 'HKD' => __('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => __('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => __('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => __('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => __('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => __('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => __('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => __('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => __('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => __('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => __('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => __('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => __('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => __('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => __('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => __('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => __('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => __('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => __('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => __('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => __('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => __('Russian Rubles (руб)', 'give'), |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string The symbol to use for the currency |
117 | 117 | */ |
118 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
118 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
119 | 119 | |
120 | - if ( empty( $currency ) ) { |
|
120 | + if (empty($currency)) { |
|
121 | 121 | $currency = give_get_currency(); |
122 | 122 | } |
123 | - switch ( $currency ) : |
|
123 | + switch ($currency) : |
|
124 | 124 | case 'GBP' : |
125 | 125 | $symbol = '£'; |
126 | 126 | break; |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | break; |
199 | 199 | endswitch; |
200 | 200 | |
201 | - $symbol = ( ! $decode_currency ? $symbol : html_entity_decode( $symbol ) ); |
|
201 | + $symbol = ( ! $decode_currency ? $symbol : html_entity_decode($symbol)); |
|
202 | 202 | |
203 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
203 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return string |
215 | 215 | */ |
216 | -function give_get_currency_name( $currency_code ) { |
|
216 | +function give_get_currency_name($currency_code) { |
|
217 | 217 | $currency_name = ''; |
218 | 218 | $currency_names = give_get_currencies(); |
219 | 219 | |
220 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
221 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
222 | - $currency_name = trim( current( $currency_name ) ); |
|
220 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
221 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
222 | + $currency_name = trim(current($currency_name)); |
|
223 | 223 | } |
224 | 224 | |
225 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
225 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -236,21 +236,21 @@ discard block |
||
236 | 236 | |
237 | 237 | global $wp; |
238 | 238 | |
239 | - if ( get_option( 'permalink_structure' ) ) { |
|
240 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
239 | + if (get_option('permalink_structure')) { |
|
240 | + $base = trailingslashit(home_url($wp->request)); |
|
241 | 241 | } else { |
242 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
243 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
242 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
243 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | $scheme = is_ssl() ? 'https' : 'http'; |
247 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
247 | + $current_uri = set_url_scheme($base, $scheme); |
|
248 | 248 | |
249 | - if ( is_front_page() ) { |
|
250 | - $current_uri = home_url( '/' ); |
|
249 | + if (is_front_page()) { |
|
250 | + $current_uri = home_url('/'); |
|
251 | 251 | } |
252 | 252 | |
253 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
253 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
254 | 254 | |
255 | 255 | } |
256 | 256 | |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | */ |
273 | 273 | $gateways = give_get_enabled_payment_gateways(); |
274 | 274 | |
275 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
275 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
276 | 276 | $ret = true; |
277 | - } elseif ( count( $gateways ) == 1 ) { |
|
277 | + } elseif (count($gateways) == 1) { |
|
278 | 278 | $ret = false; |
279 | - } elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
279 | + } elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
280 | 280 | $ret = false; |
281 | 281 | } |
282 | 282 | |
283 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
283 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -292,26 +292,26 @@ discard block |
||
292 | 292 | function give_get_timezone_id() { |
293 | 293 | |
294 | 294 | // if site timezone string exists, return it. |
295 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
295 | + if ($timezone = get_option('timezone_string')) { |
|
296 | 296 | return $timezone; |
297 | 297 | } |
298 | 298 | |
299 | 299 | // get UTC offset, if it isn't set return UTC. |
300 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
300 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
301 | 301 | return 'UTC'; |
302 | 302 | } |
303 | 303 | |
304 | 304 | // attempt to guess the timezone string from the UTC offset. |
305 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
305 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
306 | 306 | |
307 | 307 | // last try, guess timezone string manually. |
308 | - if ( $timezone === false ) { |
|
308 | + if ($timezone === false) { |
|
309 | 309 | |
310 | - $is_dst = date( 'I' ); |
|
310 | + $is_dst = date('I'); |
|
311 | 311 | |
312 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
313 | - foreach ( $abbr as $city ) { |
|
314 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
312 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
313 | + foreach ($abbr as $city) { |
|
314 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
315 | 315 | return $city['timezone_id']; |
316 | 316 | } |
317 | 317 | } |
@@ -335,17 +335,17 @@ discard block |
||
335 | 335 | |
336 | 336 | $ip = '127.0.0.1'; |
337 | 337 | |
338 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
338 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
339 | 339 | // check ip from share internet |
340 | 340 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
341 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
341 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
342 | 342 | // to check ip is pass from proxy |
343 | 343 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
344 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
344 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
345 | 345 | $ip = $_SERVER['REMOTE_ADDR']; |
346 | 346 | } |
347 | 347 | |
348 | - return apply_filters( 'give_get_ip', $ip ); |
|
348 | + return apply_filters('give_get_ip', $ip); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @uses Give()->session->set() |
362 | 362 | */ |
363 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
364 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
365 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
363 | +function give_set_purchase_session($purchase_data = array()) { |
|
364 | + Give()->session->set('give_purchase', $purchase_data); |
|
365 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @return mixed array | false |
377 | 377 | */ |
378 | 378 | function give_get_purchase_session() { |
379 | - return Give()->session->get( 'give_purchase' ); |
|
379 | + return Give()->session->get('give_purchase'); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -392,37 +392,37 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @return string |
394 | 394 | */ |
395 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
395 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
396 | 396 | |
397 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
397 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
398 | 398 | |
399 | 399 | // Form title. |
400 | - $summary = ( -! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : __( 'Untitled donation form', 'give' ) ); |
|
400 | + $summary = ( -! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : __('Untitled donation form', 'give') ); |
|
401 | 401 | |
402 | 402 | // Form multilevel if applicable. |
403 | - if ( isset( $donation_data['post_data']['give-price-id'] ) ) { |
|
404 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
403 | + if (isset($donation_data['post_data']['give-price-id'])) { |
|
404 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | // Add Donor's name + email if requested. |
408 | - if ( $name_and_email ) { |
|
408 | + if ($name_and_email) { |
|
409 | 409 | |
410 | 410 | // First name |
411 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
412 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
411 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
412 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
413 | 413 | } |
414 | 414 | |
415 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
416 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
415 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
416 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
417 | 417 | } |
418 | 418 | |
419 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
419 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // Cut the length |
423 | - $summary = substr( $summary, 0, $length ); |
|
423 | + $summary = substr($summary, 0, $length); |
|
424 | 424 | |
425 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
425 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -437,31 +437,31 @@ discard block |
||
437 | 437 | function give_get_host() { |
438 | 438 | $host = false; |
439 | 439 | |
440 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
440 | + if (defined('WPE_APIKEY')) { |
|
441 | 441 | $host = 'WP Engine'; |
442 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
442 | + } elseif (defined('PAGELYBIN')) { |
|
443 | 443 | $host = 'Pagely'; |
444 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
444 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
445 | 445 | $host = 'ICDSoft'; |
446 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
446 | + } elseif (DB_HOST == 'mysqlv5') { |
|
447 | 447 | $host = 'NetworkSolutions'; |
448 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
448 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
449 | 449 | $host = 'iPage'; |
450 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
450 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
451 | 451 | $host = 'IPower'; |
452 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
452 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
453 | 453 | $host = 'MediaTemple Grid'; |
454 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
454 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
455 | 455 | $host = 'pair Networks'; |
456 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
456 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
457 | 457 | $host = 'Rackspace Cloud'; |
458 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
458 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
459 | 459 | $host = 'SysFix.eu Power Hosting'; |
460 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
460 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
461 | 461 | $host = 'Flywheel'; |
462 | 462 | } else { |
463 | 463 | // Adding a general fallback for data gathering |
464 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
464 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return $host; |
@@ -477,67 +477,67 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @return bool true if host matches, false if not |
479 | 479 | */ |
480 | -function give_is_host( $host = false ) { |
|
480 | +function give_is_host($host = false) { |
|
481 | 481 | |
482 | 482 | $return = false; |
483 | 483 | |
484 | - if ( $host ) { |
|
485 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
484 | + if ($host) { |
|
485 | + $host = str_replace(' ', '', strtolower($host)); |
|
486 | 486 | |
487 | - switch ( $host ) { |
|
487 | + switch ($host) { |
|
488 | 488 | case 'wpengine': |
489 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
489 | + if (defined('WPE_APIKEY')) { |
|
490 | 490 | $return = true; |
491 | 491 | } |
492 | 492 | break; |
493 | 493 | case 'pagely': |
494 | - if ( defined( 'PAGELYBIN' ) ) { |
|
494 | + if (defined('PAGELYBIN')) { |
|
495 | 495 | $return = true; |
496 | 496 | } |
497 | 497 | break; |
498 | 498 | case 'icdsoft': |
499 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
499 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
500 | 500 | $return = true; |
501 | 501 | } |
502 | 502 | break; |
503 | 503 | case 'networksolutions': |
504 | - if ( DB_HOST == 'mysqlv5' ) { |
|
504 | + if (DB_HOST == 'mysqlv5') { |
|
505 | 505 | $return = true; |
506 | 506 | } |
507 | 507 | break; |
508 | 508 | case 'ipage': |
509 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
509 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
510 | 510 | $return = true; |
511 | 511 | } |
512 | 512 | break; |
513 | 513 | case 'ipower': |
514 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
514 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
515 | 515 | $return = true; |
516 | 516 | } |
517 | 517 | break; |
518 | 518 | case 'mediatemplegrid': |
519 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
519 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
520 | 520 | $return = true; |
521 | 521 | } |
522 | 522 | break; |
523 | 523 | case 'pairnetworks': |
524 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
524 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
525 | 525 | $return = true; |
526 | 526 | } |
527 | 527 | break; |
528 | 528 | case 'rackspacecloud': |
529 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
529 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
530 | 530 | $return = true; |
531 | 531 | } |
532 | 532 | break; |
533 | 533 | case 'sysfix.eu': |
534 | 534 | case 'sysfix.eupowerhosting': |
535 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
535 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
536 | 536 | $return = true; |
537 | 537 | } |
538 | 538 | break; |
539 | 539 | case 'flywheel': |
540 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
540 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
541 | 541 | $return = true; |
542 | 542 | } |
543 | 543 | break; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param string $replacement Optional. The function that should have been called. |
571 | 571 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
572 | 572 | */ |
573 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
573 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
574 | 574 | |
575 | 575 | /** |
576 | 576 | * Fires while give deprecated function call occurs. |
@@ -583,19 +583,19 @@ discard block |
||
583 | 583 | * @param string $replacement Optional. The function that should have been called. |
584 | 584 | * @param string $version The plugin version that deprecated the function. |
585 | 585 | */ |
586 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
586 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
587 | 587 | |
588 | - $show_errors = current_user_can( 'manage_options' ); |
|
588 | + $show_errors = current_user_can('manage_options'); |
|
589 | 589 | |
590 | 590 | // Allow plugin to filter the output error trigger. |
591 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
592 | - if ( ! is_null( $replacement ) ) { |
|
593 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
594 | - 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. |
|
591 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
592 | + if ( ! is_null($replacement)) { |
|
593 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
594 | + 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. |
|
595 | 595 | // Alternatively we could dump this to a file. |
596 | 596 | } else { |
597 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
598 | - 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. |
|
597 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
598 | + 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. |
|
599 | 599 | // Alternatively we could dump this to a file. |
600 | 600 | } |
601 | 601 | } |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | * @return string $post_id |
610 | 610 | */ |
611 | 611 | function give_get_admin_post_id() { |
612 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
613 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
612 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
613 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
614 | 614 | $post_id = $_POST['post_id']; |
615 | 615 | } |
616 | 616 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * @return string Arg separator output |
625 | 625 | */ |
626 | 626 | function give_get_php_arg_separator_output() { |
627 | - return ini_get( 'arg_separator.output' ); |
|
627 | + return ini_get('arg_separator.output'); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | * |
640 | 640 | * @return string Short month name |
641 | 641 | */ |
642 | -function give_month_num_to_name( $n ) { |
|
643 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
642 | +function give_month_num_to_name($n) { |
|
643 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
644 | 644 | |
645 | - return date_i18n( 'M', $timestamp ); |
|
645 | + return date_i18n('M', $timestamp); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -655,10 +655,10 @@ discard block |
||
655 | 655 | * |
656 | 656 | * @return bool Whether or not function is disabled. |
657 | 657 | */ |
658 | -function give_is_func_disabled( $function ) { |
|
659 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
658 | +function give_is_func_disabled($function) { |
|
659 | + $disabled = explode(',', ini_get('disable_functions')); |
|
660 | 660 | |
661 | - return in_array( $function, $disabled ); |
|
661 | + return in_array($function, $disabled); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | function give_get_newsletter() { |
671 | 671 | ?> |
672 | 672 | |
673 | - <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> |
|
673 | + <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> |
|
674 | 674 | |
675 | 675 | <div class="give-newsletter-form-wrap"> |
676 | 676 | |
@@ -678,33 +678,33 @@ discard block |
||
678 | 678 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
679 | 679 | target="_blank" novalidate> |
680 | 680 | <div class="give-newsletter-confirmation"> |
681 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
681 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
682 | 682 | </div> |
683 | 683 | |
684 | 684 | <table class="form-table give-newsletter-form"> |
685 | 685 | <tr valign="middle"> |
686 | 686 | <td> |
687 | 687 | <label for="mce-EMAIL" |
688 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
688 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
689 | 689 | <input type="email" name="EMAIL" id="mce-EMAIL" |
690 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
690 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
691 | 691 | class="required email" value=""> |
692 | 692 | </td> |
693 | 693 | <td> |
694 | 694 | <label for="mce-FNAME" |
695 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
695 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
696 | 696 | <input type="text" name="FNAME" id="mce-FNAME" |
697 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
697 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
698 | 698 | </td> |
699 | 699 | <td> |
700 | 700 | <label for="mce-LNAME" |
701 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
701 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
702 | 702 | <input type="text" name="LNAME" id="mce-LNAME" |
703 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
703 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
704 | 704 | </td> |
705 | 705 | <td> |
706 | 706 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
707 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
707 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
708 | 708 | </td> |
709 | 709 | </tr> |
710 | 710 | </table> |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @return string |
758 | 758 | */ |
759 | -function give_svg_icons( $icon ) { |
|
759 | +function give_svg_icons($icon) { |
|
760 | 760 | |
761 | 761 | // Store your SVGs in an associative array |
762 | 762 | $svgs = array( |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | ); |
769 | 769 | |
770 | 770 | // Return the chosen icon's SVG string |
771 | - return $svgs[ $icon ]; |
|
771 | + return $svgs[$icon]; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | /** |
@@ -780,15 +780,15 @@ discard block |
||
780 | 780 | * |
781 | 781 | * @return mixed |
782 | 782 | */ |
783 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
784 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
785 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
783 | +function modify_nav_menu_meta_box_object($post_type) { |
|
784 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
785 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | return $post_type; |
789 | 789 | } |
790 | 790 | |
791 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
791 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
792 | 792 | |
793 | 793 | /** |
794 | 794 | * Enable 'Donation Form' meta enabled by default on Menu page. |
@@ -798,22 +798,22 @@ discard block |
||
798 | 798 | function give_nav_donation_metabox_enabled() { |
799 | 799 | |
800 | 800 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
801 | - if ( ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) || ! is_admin() ) { |
|
801 | + if (( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus')) || ! is_admin()) { |
|
802 | 802 | return false; |
803 | 803 | } |
804 | 804 | |
805 | 805 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
806 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
806 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
810 | 810 | // Exclude 'Donation Form' value from hidden meta box's list. |
811 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
811 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
812 | 812 | |
813 | 813 | // Get current user ID. |
814 | 814 | $user = wp_get_current_user(); |
815 | 815 | |
816 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
816 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /** |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * @license https://opensource.org/licenses/MIT MIT |
828 | 828 | */ |
829 | 829 | |
830 | -if ( ! function_exists( 'array_column' ) ) { |
|
830 | +if ( ! function_exists('array_column')) { |
|
831 | 831 | /** |
832 | 832 | * Returns the values from a single column of the input array, identified by |
833 | 833 | * the $columnKey. |
@@ -846,53 +846,53 @@ discard block |
||
846 | 846 | * |
847 | 847 | * @return array |
848 | 848 | */ |
849 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
849 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
850 | 850 | // Using func_get_args() in order to check for proper number of |
851 | 851 | // parameters and trigger errors exactly as the built-in array_column() |
852 | 852 | // does in PHP 5.5. |
853 | 853 | $argc = func_num_args(); |
854 | 854 | $params = func_get_args(); |
855 | 855 | |
856 | - if ( $argc < 2 ) { |
|
857 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
856 | + if ($argc < 2) { |
|
857 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
858 | 858 | |
859 | 859 | return null; |
860 | 860 | } |
861 | 861 | |
862 | - if ( ! is_array( $params[0] ) ) { |
|
863 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
862 | + if ( ! is_array($params[0])) { |
|
863 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
864 | 864 | |
865 | 865 | return null; |
866 | 866 | } |
867 | 867 | |
868 | - if ( ! is_int( $params[1] ) |
|
869 | - && ! is_float( $params[1] ) |
|
870 | - && ! is_string( $params[1] ) |
|
868 | + if ( ! is_int($params[1]) |
|
869 | + && ! is_float($params[1]) |
|
870 | + && ! is_string($params[1]) |
|
871 | 871 | && $params[1] !== null |
872 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
872 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
873 | 873 | ) { |
874 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
874 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
875 | 875 | |
876 | 876 | return false; |
877 | 877 | } |
878 | 878 | |
879 | - if ( isset( $params[2] ) |
|
880 | - && ! is_int( $params[2] ) |
|
881 | - && ! is_float( $params[2] ) |
|
882 | - && ! is_string( $params[2] ) |
|
883 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
879 | + if (isset($params[2]) |
|
880 | + && ! is_int($params[2]) |
|
881 | + && ! is_float($params[2]) |
|
882 | + && ! is_string($params[2]) |
|
883 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
884 | 884 | ) { |
885 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
885 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
886 | 886 | |
887 | 887 | return false; |
888 | 888 | } |
889 | 889 | |
890 | 890 | $paramsInput = $params[0]; |
891 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
891 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
892 | 892 | |
893 | 893 | $paramsIndexKey = null; |
894 | - if ( isset( $params[2] ) ) { |
|
895 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
894 | + if (isset($params[2])) { |
|
895 | + if (is_float($params[2]) || is_int($params[2])) { |
|
896 | 896 | $paramsIndexKey = (int) $params[2]; |
897 | 897 | } else { |
898 | 898 | $paramsIndexKey = (string) $params[2]; |
@@ -901,26 +901,26 @@ discard block |
||
901 | 901 | |
902 | 902 | $resultArray = array(); |
903 | 903 | |
904 | - foreach ( $paramsInput as $row ) { |
|
904 | + foreach ($paramsInput as $row) { |
|
905 | 905 | $key = $value = null; |
906 | 906 | $keySet = $valueSet = false; |
907 | 907 | |
908 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
908 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
909 | 909 | $keySet = true; |
910 | - $key = (string) $row[ $paramsIndexKey ]; |
|
910 | + $key = (string) $row[$paramsIndexKey]; |
|
911 | 911 | } |
912 | 912 | |
913 | - if ( $paramsColumnKey === null ) { |
|
913 | + if ($paramsColumnKey === null) { |
|
914 | 914 | $valueSet = true; |
915 | 915 | $value = $row; |
916 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
916 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
917 | 917 | $valueSet = true; |
918 | - $value = $row[ $paramsColumnKey ]; |
|
918 | + $value = $row[$paramsColumnKey]; |
|
919 | 919 | } |
920 | 920 | |
921 | - if ( $valueSet ) { |
|
922 | - if ( $keySet ) { |
|
923 | - $resultArray[ $key ] = $value; |
|
921 | + if ($valueSet) { |
|
922 | + if ($keySet) { |
|
923 | + $resultArray[$key] = $value; |
|
924 | 924 | } else { |
925 | 925 | $resultArray[] = $value; |
926 | 926 | } |
@@ -940,40 +940,40 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return bool Whether the receipt is visible or not. |
942 | 942 | */ |
943 | -function give_can_view_receipt( $payment_key = '' ) { |
|
943 | +function give_can_view_receipt($payment_key = '') { |
|
944 | 944 | |
945 | 945 | $return = false; |
946 | 946 | |
947 | - if ( empty( $payment_key ) ) { |
|
947 | + if (empty($payment_key)) { |
|
948 | 948 | return $return; |
949 | 949 | } |
950 | 950 | |
951 | 951 | global $give_receipt_args; |
952 | 952 | |
953 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
953 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
954 | 954 | |
955 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
955 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
956 | 956 | |
957 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
957 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
958 | 958 | |
959 | - if ( is_user_logged_in() ) { |
|
960 | - if ( $user_id === (int) get_current_user_id() ) { |
|
959 | + if (is_user_logged_in()) { |
|
960 | + if ($user_id === (int) get_current_user_id()) { |
|
961 | 961 | $return = true; |
962 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
962 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
963 | 963 | $return = true; |
964 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
964 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
965 | 965 | $return = true; |
966 | 966 | } |
967 | 967 | } |
968 | 968 | |
969 | 969 | $session = give_get_purchase_session(); |
970 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
971 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
970 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
971 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
972 | 972 | $return = true; |
973 | 973 | } |
974 | 974 | } |
975 | 975 | |
976 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
976 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
977 | 977 | |
978 | 978 | } |
979 | 979 | |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | * |
983 | 983 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
984 | 984 | */ |
985 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
985 | +if ( ! function_exists('cal_days_in_month')) { |
|
986 | 986 | /** |
987 | 987 | * cal_days_in_month |
988 | 988 | * |
@@ -992,8 +992,8 @@ discard block |
||
992 | 992 | * |
993 | 993 | * @return bool|string |
994 | 994 | */ |
995 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
996 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
995 | + function cal_days_in_month($calendar, $month, $year) { |
|
996 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
997 | 997 | } |
998 | 998 | } |
999 | 999 | |
@@ -1012,42 +1012,42 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | function give_get_plugins() { |
1014 | 1014 | $plugins = get_plugins(); |
1015 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
1015 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
1016 | 1016 | |
1017 | - if ( is_multisite() ) { |
|
1018 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
1019 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
1017 | + if (is_multisite()) { |
|
1018 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
1019 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
1022 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
1023 | 1023 | // Is plugin active? |
1024 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
1025 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
1024 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
1025 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
1026 | 1026 | } else { |
1027 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
1027 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
1030 | + $dirname = strtolower(dirname($plugin_path)); |
|
1031 | 1031 | |
1032 | 1032 | // Is plugin a Give add-on by WordImpress? |
1033 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
1033 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
1034 | 1034 | // Plugin is a Give-addon. |
1035 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
1035 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
1036 | 1036 | |
1037 | 1037 | // Get license info from database. |
1038 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); |
|
1039 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; |
|
1040 | - $license_active = get_option( $db_option ); |
|
1038 | + $plugin_name = str_replace('Give - ', '', $plugin_data['Name']); |
|
1039 | + $db_option = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; |
|
1040 | + $license_active = get_option($db_option); |
|
1041 | 1041 | |
1042 | 1042 | // Does a valid license exist? |
1043 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
1044 | - $plugins[ $plugin_path ]['License'] = true; |
|
1043 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
1044 | + $plugins[$plugin_path]['License'] = true; |
|
1045 | 1045 | } else { |
1046 | - $plugins[ $plugin_path ]['License'] = false; |
|
1046 | + $plugins[$plugin_path]['License'] = false; |
|
1047 | 1047 | } |
1048 | 1048 | } else { |
1049 | 1049 | // Plugin is not a Give add-on. |
1050 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
1050 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | |
@@ -1064,16 +1064,16 @@ discard block |
||
1064 | 1064 | * |
1065 | 1065 | * @return bool |
1066 | 1066 | */ |
1067 | -function give_is_terms_enabled( $form_id ) { |
|
1068 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1067 | +function give_is_terms_enabled($form_id) { |
|
1068 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1069 | 1069 | |
1070 | 1070 | if ( |
1071 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1072 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1071 | + give_is_setting_enabled($form_option, 'global') |
|
1072 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1073 | 1073 | ) { |
1074 | 1074 | return true; |
1075 | 1075 | |
1076 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1076 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1077 | 1077 | return true; |
1078 | 1078 | |
1079 | 1079 | } else { |
@@ -1097,9 +1097,9 @@ discard block |
||
1097 | 1097 | * |
1098 | 1098 | * @return WP_Error|bool |
1099 | 1099 | */ |
1100 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1100 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1101 | 1101 | // Delete all cache. |
1102 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1102 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * Fire the action when donation stats delete. |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | * @param string|array $date_range |
1110 | 1110 | * @param array $args |
1111 | 1111 | */ |
1112 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1112 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1113 | 1113 | |
1114 | 1114 | return $status; |
1115 | 1115 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | * |
1128 | 1128 | * @return mixed |
1129 | 1129 | */ |
1130 | -function give_get_meta( $id, $meta_key, $single = false, $default = false ) { |
|
1130 | +function give_get_meta($id, $meta_key, $single = false, $default = false) { |
|
1131 | 1131 | /** |
1132 | 1132 | * Filter the meta value |
1133 | 1133 | * |
@@ -1135,14 +1135,14 @@ discard block |
||
1135 | 1135 | */ |
1136 | 1136 | $meta_value = apply_filters( |
1137 | 1137 | 'give_get_meta', |
1138 | - get_post_meta( $id, $meta_key, $single ), |
|
1138 | + get_post_meta($id, $meta_key, $single), |
|
1139 | 1139 | $id, |
1140 | 1140 | $meta_key, |
1141 | 1141 | $default |
1142 | 1142 | ); |
1143 | 1143 | |
1144 | 1144 | if ( |
1145 | - ( empty( $meta_key ) || empty( $meta_value ) ) |
|
1145 | + (empty($meta_key) || empty($meta_value)) |
|
1146 | 1146 | && $default |
1147 | 1147 | ) { |
1148 | 1148 | $meta_value = $default; |
@@ -1163,15 +1163,15 @@ discard block |
||
1163 | 1163 | * |
1164 | 1164 | * @return mixed |
1165 | 1165 | */ |
1166 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1167 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1166 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1167 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1168 | 1168 | |
1169 | 1169 | /** |
1170 | 1170 | * Filter the meta value update status |
1171 | 1171 | * |
1172 | 1172 | * @since 1.8.8 |
1173 | 1173 | */ |
1174 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1174 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | /** |
@@ -1185,15 +1185,15 @@ discard block |
||
1185 | 1185 | * |
1186 | 1186 | * @return mixed |
1187 | 1187 | */ |
1188 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1189 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1188 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1189 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1190 | 1190 | |
1191 | 1191 | /** |
1192 | 1192 | * Filter the meta value delete status |
1193 | 1193 | * |
1194 | 1194 | * @since 1.8.8 |
1195 | 1195 | */ |
1196 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1196 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | /** |
@@ -1205,15 +1205,15 @@ discard block |
||
1205 | 1205 | * |
1206 | 1206 | * @return bool If the action has been added to the completed actions array |
1207 | 1207 | */ |
1208 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1208 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1209 | 1209 | |
1210 | - if ( empty( $upgrade_action ) ) { |
|
1210 | + if (empty($upgrade_action)) { |
|
1211 | 1211 | return false; |
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | $completed_upgrades = give_get_completed_upgrades(); |
1215 | 1215 | |
1216 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1216 | + return in_array($upgrade_action, $completed_upgrades); |
|
1217 | 1217 | |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1225,8 +1225,8 @@ discard block |
||
1225 | 1225 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1226 | 1226 | */ |
1227 | 1227 | function give_maybe_resume_upgrade() { |
1228 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1229 | - if ( empty( $doing_upgrade ) ) { |
|
1228 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1229 | + if (empty($doing_upgrade)) { |
|
1230 | 1230 | return false; |
1231 | 1231 | } |
1232 | 1232 | |
@@ -1242,9 +1242,9 @@ discard block |
||
1242 | 1242 | * |
1243 | 1243 | * @return bool If the function was successfully added |
1244 | 1244 | */ |
1245 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1245 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1246 | 1246 | |
1247 | - if ( empty( $upgrade_action ) ) { |
|
1247 | + if (empty($upgrade_action)) { |
|
1248 | 1248 | return false; |
1249 | 1249 | } |
1250 | 1250 | |
@@ -1252,16 +1252,16 @@ discard block |
||
1252 | 1252 | $completed_upgrades[] = $upgrade_action; |
1253 | 1253 | |
1254 | 1254 | // Remove any blanks, and only show uniques. |
1255 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1255 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1256 | 1256 | |
1257 | 1257 | /** |
1258 | 1258 | * Fire the action when any upgrade set to complete. |
1259 | 1259 | * |
1260 | 1260 | * @since 1.8.12 |
1261 | 1261 | */ |
1262 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1262 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1263 | 1263 | |
1264 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
1264 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | /** |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | * @return array The array of completed upgrades |
1272 | 1272 | */ |
1273 | 1273 | function give_get_completed_upgrades() { |
1274 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1274 | + return (array) get_option('give_completed_upgrades'); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | |
@@ -1284,15 +1284,15 @@ discard block |
||
1284 | 1284 | * |
1285 | 1285 | * @return string URL |
1286 | 1286 | */ |
1287 | -function give_import_page_url( $parameter = array() ) { |
|
1287 | +function give_import_page_url($parameter = array()) { |
|
1288 | 1288 | $defalut_query_arg = array( |
1289 | 1289 | 'post_type' => 'give_forms', |
1290 | 1290 | 'page' => 'give-tools', |
1291 | 1291 | 'tab' => 'import', |
1292 | 1292 | ); |
1293 | - $import_query_arg = wp_parse_args( $parameter, $defalut_query_arg ); |
|
1293 | + $import_query_arg = wp_parse_args($parameter, $defalut_query_arg); |
|
1294 | 1294 | |
1295 | - return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) ); |
|
1295 | + return add_query_arg($import_query_arg, admin_url('edit.php')); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | /** |
@@ -1305,24 +1305,24 @@ discard block |
||
1305 | 1305 | * @param array $main_key First row from the CSV |
1306 | 1306 | * @param array $import_setting Contain the global variable. |
1307 | 1307 | */ |
1308 | -function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) { |
|
1309 | - $data = array_combine( $raw_key, $row_data ); |
|
1308 | +function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) { |
|
1309 | + $data = array_combine($raw_key, $row_data); |
|
1310 | 1310 | $price_id = false; |
1311 | 1311 | $customer_id = 0; |
1312 | - $import_setting['create_user'] = ( isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1 ); |
|
1312 | + $import_setting['create_user'] = (isset($import_setting['create_user']) ? $import_setting['create_user'] : 1); |
|
1313 | 1313 | |
1314 | - $data = (array) apply_filters( 'give_save_import_donation_to_db', $data ); |
|
1314 | + $data = (array) apply_filters('give_save_import_donation_to_db', $data); |
|
1315 | 1315 | |
1316 | - if ( ! strpos( $data['amount'], '.' ) ) { |
|
1317 | - $data['amount'] = $data['amount'] . '.00'; |
|
1316 | + if ( ! strpos($data['amount'], '.')) { |
|
1317 | + $data['amount'] = $data['amount'].'.00'; |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | // Here come the login function. |
1321 | - $donor_data = give_import_get_user_from_csv( $data, $import_setting ); |
|
1322 | - if ( ! empty( $donor_data->id ) ) { |
|
1323 | - if ( ! empty( $donor_data->user_id ) ) { |
|
1321 | + $donor_data = give_import_get_user_from_csv($data, $import_setting); |
|
1322 | + if ( ! empty($donor_data->id)) { |
|
1323 | + if ( ! empty($donor_data->user_id)) { |
|
1324 | 1324 | $customer_id = $donor_data->user_id; |
1325 | - } elseif ( ! empty( $data['user_id'] ) ) { |
|
1325 | + } elseif ( ! empty($data['user_id'])) { |
|
1326 | 1326 | $customer_id = $data['user_id']; |
1327 | 1327 | } |
1328 | 1328 | } else { |
@@ -1330,95 +1330,95 @@ discard block |
||
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | // get form data or register a form data. |
1333 | - $form = give_import_get_form_data_from_csv( $data, $import_setting ); |
|
1334 | - if ( false == $form ) { |
|
1333 | + $form = give_import_get_form_data_from_csv($data, $import_setting); |
|
1334 | + if (false == $form) { |
|
1335 | 1335 | return false; |
1336 | 1336 | } else { |
1337 | - $price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false; |
|
1337 | + $price_id = ( ! empty($form->price_id)) ? $form->price_id : false; |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
1341 | 1341 | $address = array( |
1342 | - 'line1' => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ), |
|
1343 | - 'line2' => ( ! empty( $data['line1'] ) ? give_clean( $data['line2'] ) : '' ), |
|
1344 | - 'city' => ( ! empty( $data['line1'] ) ? give_clean( $data['city'] ) : '' ), |
|
1345 | - 'zip' => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ), |
|
1346 | - 'state' => ( ! empty( $data['state'] ) ? give_clean( $data['state'] ) : '' ), |
|
1347 | - 'country' => ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' ), |
|
1342 | + 'line1' => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''), |
|
1343 | + 'line2' => ( ! empty($data['line1']) ? give_clean($data['line2']) : ''), |
|
1344 | + 'city' => ( ! empty($data['line1']) ? give_clean($data['city']) : ''), |
|
1345 | + 'zip' => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''), |
|
1346 | + 'state' => ( ! empty($data['state']) ? give_clean($data['state']) : ''), |
|
1347 | + 'country' => ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : ''), |
|
1348 | 1348 | ); |
1349 | 1349 | |
1350 | 1350 | //Create payment_data array |
1351 | 1351 | $payment_data = array( |
1352 | 1352 | 'donor_id' => $donor_data->id, |
1353 | 1353 | 'price' => $data['amount'], |
1354 | - 'status' => ( ! empty( $data['post_status'] ) ? $data['post_status'] : 'publish' ), |
|
1354 | + 'status' => ( ! empty($data['post_status']) ? $data['post_status'] : 'publish'), |
|
1355 | 1355 | 'currency' => give_get_currency(), |
1356 | 1356 | 'user_info' => array( |
1357 | 1357 | 'id' => $customer_id, |
1358 | - 'email' => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ), |
|
1359 | - 'first_name' => ( ! empty( $data['first_name'] ) ? $data['first_name'] : ( ! empty( $customer_id ) && ( $first_name = get_user_meta( $customer_id, 'first_name', true ) ) ? $first_name : $donor_data->name ) ), |
|
1360 | - 'last_name' => ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ! empty( $customer_id ) && ( $last_name = get_user_meta( $customer_id, 'last_name', true ) ) ? $last_name : $donor_data->name ) ), |
|
1358 | + 'email' => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)), |
|
1359 | + 'first_name' => ( ! empty($data['first_name']) ? $data['first_name'] : ( ! empty($customer_id) && ($first_name = get_user_meta($customer_id, 'first_name', true)) ? $first_name : $donor_data->name)), |
|
1360 | + 'last_name' => ( ! empty($data['last_name']) ? $data['last_name'] : ( ! empty($customer_id) && ($last_name = get_user_meta($customer_id, 'last_name', true)) ? $last_name : $donor_data->name)), |
|
1361 | 1361 | 'address' => $address, |
1362 | 1362 | ), |
1363 | - 'gateway' => ( ! empty( $data['gateway'] ) && 'offline' != strtolower( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ), |
|
1364 | - 'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : $form->get_name() ), |
|
1363 | + 'gateway' => ( ! empty($data['gateway']) && 'offline' != strtolower($data['gateway']) ? strtolower($data['gateway']) : 'manual'), |
|
1364 | + 'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : $form->get_name()), |
|
1365 | 1365 | 'give_form_id' => (string) $form->get_ID(), |
1366 | 1366 | 'give_price_id' => $price_id, |
1367 | - 'purchase_key' => strtolower( md5( uniqid() ) ), |
|
1367 | + 'purchase_key' => strtolower(md5(uniqid())), |
|
1368 | 1368 | 'user_email' => $data['email'], |
1369 | - 'post_date' => ( ! empty( $data['post_date'] ) ? mysql2date( 'Y-m-d H:i:s', $data['post_date'] ) : current_time( 'mysql' ) ), |
|
1370 | - 'mode' => ( ! empty( $data['mode'] ) ? ( 'true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ), |
|
1369 | + 'post_date' => ( ! empty($data['post_date']) ? mysql2date('Y-m-d H:i:s', $data['post_date']) : current_time('mysql')), |
|
1370 | + 'mode' => ( ! empty($data['mode']) ? ('true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))), |
|
1371 | 1371 | ); |
1372 | 1372 | |
1373 | - $payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form ); |
|
1373 | + $payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form); |
|
1374 | 1374 | |
1375 | 1375 | // Get the report |
1376 | 1376 | $report = give_import_donation_report(); |
1377 | 1377 | |
1378 | 1378 | // Check for duplicate code. |
1379 | - if ( true === give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) ) { |
|
1380 | - $report['duplicate_donation'] = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 ); |
|
1379 | + if (true === give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data)) { |
|
1380 | + $report['duplicate_donation'] = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1); |
|
1381 | 1381 | } else { |
1382 | - add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 ); |
|
1383 | - add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 ); |
|
1384 | - add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 ); |
|
1385 | - add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 ); |
|
1386 | - $payment = give_insert_payment( $payment_data ); |
|
1387 | - remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 ); |
|
1388 | - remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 ); |
|
1389 | - remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 ); |
|
1390 | - remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 ); |
|
1382 | + add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1); |
|
1383 | + add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2); |
|
1384 | + add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3); |
|
1385 | + add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2); |
|
1386 | + $payment = give_insert_payment($payment_data); |
|
1387 | + remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1); |
|
1388 | + remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11); |
|
1389 | + remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11); |
|
1390 | + remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11); |
|
1391 | 1391 | |
1392 | - if ( $payment ) { |
|
1392 | + if ($payment) { |
|
1393 | 1393 | |
1394 | - $report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 ); |
|
1394 | + $report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1); |
|
1395 | 1395 | |
1396 | - update_post_meta( $payment, '_give_payment_import', true ); |
|
1396 | + update_post_meta($payment, '_give_payment_import', true); |
|
1397 | 1397 | |
1398 | - if ( ! empty( $import_setting['csv'] ) ) { |
|
1399 | - update_post_meta( $payment, '_give_payment_import_id', $import_setting['csv'] ); |
|
1398 | + if ( ! empty($import_setting['csv'])) { |
|
1399 | + update_post_meta($payment, '_give_payment_import_id', $import_setting['csv']); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | // Insert Notes. |
1403 | - if ( ! empty( $data['notes'] ) ) { |
|
1404 | - give_insert_payment_note( $payment, $data['notes'] ); |
|
1403 | + if ( ! empty($data['notes'])) { |
|
1404 | + give_insert_payment_note($payment, $data['notes']); |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | - $meta_exists = array_keys( $raw_key, 'post_meta' ); |
|
1408 | - if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) { |
|
1409 | - foreach ( $meta_exists as $meta_exist ) { |
|
1410 | - if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) { |
|
1411 | - update_post_meta( $payment, $main_key[ $meta_exist ], $row_data[ $meta_exist ] ); |
|
1407 | + $meta_exists = array_keys($raw_key, 'post_meta'); |
|
1408 | + if ( ! empty($main_key) && ! empty($meta_exists)) { |
|
1409 | + foreach ($meta_exists as $meta_exist) { |
|
1410 | + if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) { |
|
1411 | + update_post_meta($payment, $main_key[$meta_exist], $row_data[$meta_exist]); |
|
1412 | 1412 | } |
1413 | 1413 | } |
1414 | 1414 | } |
1415 | 1415 | } else { |
1416 | - $report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 ); |
|
1416 | + $report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1); |
|
1417 | 1417 | } |
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | // update the report |
1421 | - give_import_donation_report_update( $report ); |
|
1421 | + give_import_donation_report_update($report); |
|
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | /** |
@@ -1432,12 +1432,12 @@ discard block |
||
1432 | 1432 | * |
1433 | 1433 | * @return Give_Donor |
1434 | 1434 | */ |
1435 | -function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) { |
|
1435 | +function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) { |
|
1436 | 1436 | $old_donor = $donor; |
1437 | - if ( ! empty( $payment_data['donor_id'] ) ) { |
|
1438 | - $donor_id = absint( $payment_data['donor_id'] ); |
|
1439 | - $donor = new Give_Donor( $donor_id ); |
|
1440 | - if ( ! empty( $donor->id ) ) { |
|
1437 | + if ( ! empty($payment_data['donor_id'])) { |
|
1438 | + $donor_id = absint($payment_data['donor_id']); |
|
1439 | + $donor = new Give_Donor($donor_id); |
|
1440 | + if ( ! empty($donor->id)) { |
|
1441 | 1441 | return $donor; |
1442 | 1442 | } |
1443 | 1443 | } |
@@ -1450,12 +1450,12 @@ discard block |
||
1450 | 1450 | * |
1451 | 1451 | * @since 1.8.13 |
1452 | 1452 | */ |
1453 | -function give_import_donation_insert_payment( $payment_id, $payment_data ) { |
|
1453 | +function give_import_donation_insert_payment($payment_id, $payment_data) { |
|
1454 | 1454 | // Update Give Customers purchase_count |
1455 | - if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) { |
|
1456 | - $donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true ); |
|
1457 | - if ( ! empty( $donor_id ) ) { |
|
1458 | - $donor = new Give_Donor( $donor_id ); |
|
1455 | + if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) { |
|
1456 | + $donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true); |
|
1457 | + if ( ! empty($donor_id)) { |
|
1458 | + $donor = new Give_Donor($donor_id); |
|
1459 | 1459 | $donor->increase_purchase_count(); |
1460 | 1460 | } |
1461 | 1461 | } |
@@ -1466,8 +1466,8 @@ discard block |
||
1466 | 1466 | * |
1467 | 1467 | * @since 8.1.13 |
1468 | 1468 | */ |
1469 | -function give_donation_import_give_insert_payment_args( $args, $payment_data ) { |
|
1470 | - if ( ! empty( $payment_data['user_info']['id'] ) ) { |
|
1469 | +function give_donation_import_give_insert_payment_args($args, $payment_data) { |
|
1470 | + if ( ! empty($payment_data['user_info']['id'])) { |
|
1471 | 1471 | $args['post_author'] = (int) $payment_data['user_info']['id']; |
1472 | 1472 | } |
1473 | 1473 | |
@@ -1479,11 +1479,11 @@ discard block |
||
1479 | 1479 | * |
1480 | 1480 | * @since 1.8.13 |
1481 | 1481 | */ |
1482 | -function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) { |
|
1482 | +function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) { |
|
1483 | 1483 | $return = false; |
1484 | - if ( ! empty( $data['post_date'] ) ) { |
|
1485 | - $post_date = mysql2date( 'Y-m-d-H-i-s', $data['post_date'] ); |
|
1486 | - $post_date = explode( '-', $post_date ); |
|
1484 | + if ( ! empty($data['post_date'])) { |
|
1485 | + $post_date = mysql2date('Y-m-d-H-i-s', $data['post_date']); |
|
1486 | + $post_date = explode('-', $post_date); |
|
1487 | 1487 | $args = array( |
1488 | 1488 | 'post_type' => 'give_payment', |
1489 | 1489 | 'cache_results' => false, |
@@ -1504,7 +1504,7 @@ discard block |
||
1504 | 1504 | 'meta_query' => array( |
1505 | 1505 | array( |
1506 | 1506 | 'key' => '_give_payment_total', |
1507 | - 'value' => preg_replace( '/[\$,]/', '', $payment_data['price'] ), |
|
1507 | + 'value' => preg_replace('/[\$,]/', '', $payment_data['price']), |
|
1508 | 1508 | 'compare' => 'LIKE', |
1509 | 1509 | ), |
1510 | 1510 | array( |
@@ -1521,9 +1521,9 @@ discard block |
||
1521 | 1521 | ), |
1522 | 1522 | ); |
1523 | 1523 | |
1524 | - $payments = new Give_Payments_Query( $args ); |
|
1524 | + $payments = new Give_Payments_Query($args); |
|
1525 | 1525 | $donations = $payments->get_payments(); |
1526 | - if ( ! empty( $donations ) ) { |
|
1526 | + if ( ! empty($donations)) { |
|
1527 | 1527 | return true; |
1528 | 1528 | } |
1529 | 1529 | } |
@@ -1540,9 +1540,9 @@ discard block |
||
1540 | 1540 | * |
1541 | 1541 | * @return void |
1542 | 1542 | */ |
1543 | -function give_donation_import_insert_default_payment_note( $payment_id ) { |
|
1543 | +function give_donation_import_insert_default_payment_note($payment_id) { |
|
1544 | 1544 | $current_user = wp_get_current_user(); |
1545 | - give_insert_payment_note( $payment_id, esc_html( wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) ) ); |
|
1545 | + give_insert_payment_note($payment_id, esc_html(wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email))); |
|
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | * |
1556 | 1556 | * @return bool |
1557 | 1557 | */ |
1558 | -function give_log_user_in_on_register_callback( $value ) { |
|
1558 | +function give_log_user_in_on_register_callback($value) { |
|
1559 | 1559 | return false; |
1560 | 1560 | } |
1561 | 1561 | |
@@ -1567,18 +1567,18 @@ discard block |
||
1567 | 1567 | * @param int $start Start from which csv line. |
1568 | 1568 | * @param int $end End from which csv line. |
1569 | 1569 | */ |
1570 | -function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = ',' ) { |
|
1570 | +function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = ',') { |
|
1571 | 1571 | $raw_data = array(); |
1572 | - $file_dir = get_attached_file( $file_id ); |
|
1572 | + $file_dir = get_attached_file($file_id); |
|
1573 | 1573 | $count = 0; |
1574 | - if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) { |
|
1575 | - while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) { |
|
1576 | - if ( $count >= $start && $count <= $end ) { |
|
1574 | + if (false !== ($handle = fopen($file_dir, 'r'))) { |
|
1575 | + while (false !== ($row = fgetcsv($handle, 0, $delimiter))) { |
|
1576 | + if ($count >= $start && $count <= $end) { |
|
1577 | 1577 | $raw_data[] = $row; |
1578 | 1578 | } |
1579 | - $count ++; |
|
1579 | + $count++; |
|
1580 | 1580 | } |
1581 | - fclose( $handle ); |
|
1581 | + fclose($handle); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | return $raw_data; |
@@ -1598,9 +1598,9 @@ discard block |
||
1598 | 1598 | * |
1599 | 1599 | * @return array |
1600 | 1600 | */ |
1601 | - return (array) apply_filters( 'give_import_default_options', array( |
|
1602 | - '' => __( 'Do not import', 'give' ), |
|
1603 | - ) ); |
|
1601 | + return (array) apply_filters('give_import_default_options', array( |
|
1602 | + '' => __('Do not import', 'give'), |
|
1603 | + )); |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | /** |
@@ -1616,26 +1616,26 @@ discard block |
||
1616 | 1616 | * |
1617 | 1617 | * @return array |
1618 | 1618 | */ |
1619 | - return (array) apply_filters( 'give_import_donations_options', array( |
|
1620 | - '' => __( 'Do not import', 'give' ), |
|
1621 | - 'id' => __( 'Donation ID', 'give' ), |
|
1622 | - 'amount' => __( 'Donation Amount', 'give' ), |
|
1623 | - 'post_date' => __( 'Donation Date', 'give' ), |
|
1624 | - 'first_name' => __( 'Donor First Name', 'give' ), |
|
1625 | - 'last_name' => __( 'Donor Last Name', 'give' ), |
|
1626 | - 'line1' => __( 'Address 1', 'give' ), |
|
1627 | - 'line2' => __( 'Address 2', 'give' ), |
|
1628 | - 'city' => __( 'City', 'give' ), |
|
1629 | - 'state' => __( 'State', 'give' ), |
|
1630 | - 'country' => __( 'Country', 'give' ), |
|
1631 | - 'zip' => __( 'Zip', 'give' ), |
|
1632 | - 'email' => __( 'Donor Email', 'give' ), |
|
1633 | - 'post_status' => __( 'Donation Status', 'give' ), |
|
1634 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
1635 | - 'notes' => __( 'Notes', 'give' ), |
|
1636 | - 'mode' => __( 'Test Mode', 'give' ), |
|
1637 | - 'post_meta' => __( 'Import as Meta', 'give' ), |
|
1638 | - ) ); |
|
1619 | + return (array) apply_filters('give_import_donations_options', array( |
|
1620 | + '' => __('Do not import', 'give'), |
|
1621 | + 'id' => __('Donation ID', 'give'), |
|
1622 | + 'amount' => __('Donation Amount', 'give'), |
|
1623 | + 'post_date' => __('Donation Date', 'give'), |
|
1624 | + 'first_name' => __('Donor First Name', 'give'), |
|
1625 | + 'last_name' => __('Donor Last Name', 'give'), |
|
1626 | + 'line1' => __('Address 1', 'give'), |
|
1627 | + 'line2' => __('Address 2', 'give'), |
|
1628 | + 'city' => __('City', 'give'), |
|
1629 | + 'state' => __('State', 'give'), |
|
1630 | + 'country' => __('Country', 'give'), |
|
1631 | + 'zip' => __('Zip', 'give'), |
|
1632 | + 'email' => __('Donor Email', 'give'), |
|
1633 | + 'post_status' => __('Donation Status', 'give'), |
|
1634 | + 'gateway' => __('Payment Method', 'give'), |
|
1635 | + 'notes' => __('Notes', 'give'), |
|
1636 | + 'mode' => __('Test Mode', 'give'), |
|
1637 | + 'post_meta' => __('Import as Meta', 'give'), |
|
1638 | + )); |
|
1639 | 1639 | } |
1640 | 1640 | |
1641 | 1641 | /** |
@@ -1651,10 +1651,10 @@ discard block |
||
1651 | 1651 | * |
1652 | 1652 | * @return array |
1653 | 1653 | */ |
1654 | - return (array) apply_filters( 'give_import_donor_options', array( |
|
1655 | - 'donor_id' => __( 'Donor ID', 'give' ), |
|
1656 | - 'user_id' => __( 'User ID', 'give' ), |
|
1657 | - ) ); |
|
1654 | + return (array) apply_filters('give_import_donor_options', array( |
|
1655 | + 'donor_id' => __('Donor ID', 'give'), |
|
1656 | + 'user_id' => __('User ID', 'give'), |
|
1657 | + )); |
|
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | /** |
@@ -1670,12 +1670,12 @@ discard block |
||
1670 | 1670 | * |
1671 | 1671 | * @return array |
1672 | 1672 | */ |
1673 | - return (array) apply_filters( 'give_import_donation_form_options', array( |
|
1674 | - 'form_id' => __( 'Donation Form ID', 'give' ), |
|
1675 | - 'form_title' => __( 'Donation Form', 'give' ), |
|
1676 | - 'form_level' => __( 'Donation Level', 'give' ), |
|
1677 | - 'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ), |
|
1678 | - ) ); |
|
1673 | + return (array) apply_filters('give_import_donation_form_options', array( |
|
1674 | + 'form_id' => __('Donation Form ID', 'give'), |
|
1675 | + 'form_title' => __('Donation Form', 'give'), |
|
1676 | + 'form_level' => __('Donation Level', 'give'), |
|
1677 | + 'form_custom_amount_text' => __('Custom Amount Text', 'give'), |
|
1678 | + )); |
|
1679 | 1679 | } |
1680 | 1680 | |
1681 | 1681 | /** |
@@ -1687,30 +1687,30 @@ discard block |
||
1687 | 1687 | * |
1688 | 1688 | * @return bool|false|WP_User |
1689 | 1689 | */ |
1690 | -function give_import_get_user_from_csv( $data, $import_setting = array() ) { |
|
1690 | +function give_import_get_user_from_csv($data, $import_setting = array()) { |
|
1691 | 1691 | $report = give_import_donation_report(); |
1692 | 1692 | $donor_data = false; |
1693 | 1693 | $customer_id = false; |
1694 | 1694 | |
1695 | 1695 | // check if donor id is not empty |
1696 | - if ( ! empty( $data['donor_id'] ) ) { |
|
1697 | - $donor_data = new Give_Donor( (int) $data['donor_id'] ); |
|
1698 | - if ( ! empty( $donor_data->id ) ) { |
|
1699 | - $report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 ); |
|
1696 | + if ( ! empty($data['donor_id'])) { |
|
1697 | + $donor_data = new Give_Donor((int) $data['donor_id']); |
|
1698 | + if ( ! empty($donor_data->id)) { |
|
1699 | + $report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1); |
|
1700 | 1700 | } |
1701 | 1701 | } |
1702 | 1702 | |
1703 | - if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) { |
|
1703 | + if (empty($donor_data->id) && ! empty($data['user_id'])) { |
|
1704 | 1704 | $user_id = (int) $data['user_id']; |
1705 | - $donor_data = new Give_Donor( $user_id, true ); |
|
1705 | + $donor_data = new Give_Donor($user_id, true); |
|
1706 | 1706 | |
1707 | 1707 | |
1708 | - if ( empty( $donor_data->id ) ) { |
|
1709 | - $donor_data = get_user_by( 'id', $user_id ); |
|
1710 | - if ( ! empty( $donor_data->ID ) ) { |
|
1711 | - $first_name = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $donor_data->user_nicename ); |
|
1712 | - $last_name = ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ( $lastname = get_user_meta( $donor_data->ID, 'last_name', true ) ) ? $lastname : '' ) ); |
|
1713 | - $name = $first_name . ' ' . $last_name; |
|
1708 | + if (empty($donor_data->id)) { |
|
1709 | + $donor_data = get_user_by('id', $user_id); |
|
1710 | + if ( ! empty($donor_data->ID)) { |
|
1711 | + $first_name = ( ! empty($data['first_name']) ? $data['first_name'] : $donor_data->user_nicename); |
|
1712 | + $last_name = ( ! empty($data['last_name']) ? $data['last_name'] : (($lastname = get_user_meta($donor_data->ID, 'last_name', true)) ? $lastname : '')); |
|
1713 | + $name = $first_name.' '.$last_name; |
|
1714 | 1714 | $user_email = $donor_data->user_email; |
1715 | 1715 | $donor_args = array( |
1716 | 1716 | 'name' => $name, |
@@ -1719,44 +1719,44 @@ discard block |
||
1719 | 1719 | ); |
1720 | 1720 | |
1721 | 1721 | $donor_data = new Give_Donor(); |
1722 | - $donor_data->create( $donor_args ); |
|
1722 | + $donor_data->create($donor_args); |
|
1723 | 1723 | |
1724 | 1724 | // Adding notes that donor is being imported from CSV. |
1725 | 1725 | $current_user = wp_get_current_user(); |
1726 | - $donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) ); |
|
1726 | + $donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email))); |
|
1727 | 1727 | |
1728 | 1728 | // Add is used to ensure duplicate emails are not added |
1729 | - if ( $user_email != $data['email'] && ! empty( $data['email'] ) ) { |
|
1730 | - $donor_data->add_meta( 'additional_email', $data['email'] ); |
|
1729 | + if ($user_email != $data['email'] && ! empty($data['email'])) { |
|
1730 | + $donor_data->add_meta('additional_email', $data['email']); |
|
1731 | 1731 | } |
1732 | 1732 | |
1733 | - $report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 ); |
|
1733 | + $report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1); |
|
1734 | 1734 | } else { |
1735 | 1735 | } |
1736 | 1736 | } else { |
1737 | 1737 | // Add is used to ensure duplicate emails are not added |
1738 | - if ( $donor_data->email != $data['email'] ) { |
|
1739 | - $donor_data->add_meta( 'additional_email', ( ! empty( $data['email'] ) ? $data['email'] : $donor_data->email ) ); |
|
1738 | + if ($donor_data->email != $data['email']) { |
|
1739 | + $donor_data->add_meta('additional_email', ( ! empty($data['email']) ? $data['email'] : $donor_data->email)); |
|
1740 | 1740 | } |
1741 | - $report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 ); |
|
1741 | + $report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1); |
|
1742 | 1742 | } |
1743 | 1743 | } |
1744 | 1744 | |
1745 | - if ( empty( $donor_data->id ) && ! empty( $data['email'] ) ) { |
|
1745 | + if (empty($donor_data->id) && ! empty($data['email'])) { |
|
1746 | 1746 | |
1747 | - $donor_data = new Give_Donor( $data['email'] ); |
|
1748 | - if ( empty( $donor_data->id ) ) { |
|
1749 | - $donor_data = get_user_by( 'email', $data['email'] ); |
|
1747 | + $donor_data = new Give_Donor($data['email']); |
|
1748 | + if (empty($donor_data->id)) { |
|
1749 | + $donor_data = get_user_by('email', $data['email']); |
|
1750 | 1750 | |
1751 | - if ( empty( $donor_data->ID ) && ! empty( $data['first_name'] ) && ! empty( $data['last_name'] ) && isset( $import_setting['create_user'] ) && 1 === absint( $import_setting['create_user'] ) ) { |
|
1752 | - $give_role = (array) give_get_option( 'donor_default_user_role', get_option( 'default_role', ( ( $give_donor = wp_roles()->is_role( 'give_donor' ) ) && ! empty( $give_donor ) ? 'give_donor' : 'subscriber' ) ) ); |
|
1751 | + if (empty($donor_data->ID) && ! empty($data['first_name']) && ! empty($data['last_name']) && isset($import_setting['create_user']) && 1 === absint($import_setting['create_user'])) { |
|
1752 | + $give_role = (array) give_get_option('donor_default_user_role', get_option('default_role', (($give_donor = wp_roles()->is_role('give_donor')) && ! empty($give_donor) ? 'give_donor' : 'subscriber'))); |
|
1753 | 1753 | $donor_args = array( |
1754 | 1754 | 'user_login' => $data['email'], |
1755 | 1755 | 'user_email' => $data['email'], |
1756 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
1756 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
1757 | 1757 | 'user_first' => $data['first_name'], |
1758 | 1758 | 'user_last' => $data['last_name'], |
1759 | - 'user_pass' => wp_generate_password( 8, true ), |
|
1759 | + 'user_pass' => wp_generate_password(8, true), |
|
1760 | 1760 | 'role' => $give_role, |
1761 | 1761 | ); |
1762 | 1762 | |
@@ -1765,56 +1765,56 @@ discard block |
||
1765 | 1765 | * |
1766 | 1766 | * @since 1.8.13 |
1767 | 1767 | */ |
1768 | - $donor_args = (array) apply_filters( 'give_import_insert_user_args', $donor_args, $data, $import_setting ); |
|
1768 | + $donor_args = (array) apply_filters('give_import_insert_user_args', $donor_args, $data, $import_setting); |
|
1769 | 1769 | |
1770 | 1770 | // This action was added to remove the login when using the give register function. |
1771 | - add_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 ); |
|
1772 | - $customer_id = give_register_and_login_new_user( $donor_args ); |
|
1773 | - remove_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 ); |
|
1771 | + add_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11); |
|
1772 | + $customer_id = give_register_and_login_new_user($donor_args); |
|
1773 | + remove_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11); |
|
1774 | 1774 | |
1775 | - update_user_meta( $customer_id, '_give_payment_import', true ); |
|
1776 | - $donor_data = new Give_Donor( $customer_id, true ); |
|
1775 | + update_user_meta($customer_id, '_give_payment_import', true); |
|
1776 | + $donor_data = new Give_Donor($customer_id, true); |
|
1777 | 1777 | } else { |
1778 | - $customer_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false ); |
|
1778 | + $customer_id = ( ! empty($donor_data->ID) ? $donor_data->ID : false); |
|
1779 | 1779 | } |
1780 | 1780 | |
1781 | - if ( ! empty( $customer_id ) || ( isset( $import_setting['create_user'] ) && 0 === absint( $import_setting['create_user'] ) ) ) { |
|
1782 | - $donor_data = new Give_Donor( $customer_id, true ); |
|
1781 | + if ( ! empty($customer_id) || (isset($import_setting['create_user']) && 0 === absint($import_setting['create_user']))) { |
|
1782 | + $donor_data = new Give_Donor($customer_id, true); |
|
1783 | 1783 | |
1784 | - if ( empty( $donor_data->id ) ) { |
|
1784 | + if (empty($donor_data->id)) { |
|
1785 | 1785 | |
1786 | - if ( ! empty( $data['form_id'] ) ) { |
|
1787 | - $form = new Give_Donate_Form( $data['form_id'] ); |
|
1786 | + if ( ! empty($data['form_id'])) { |
|
1787 | + $form = new Give_Donate_Form($data['form_id']); |
|
1788 | 1788 | } |
1789 | 1789 | |
1790 | - $payment_title = ( isset( $data['form_title'] ) ? $data['form_title'] : ( isset( $form ) ? $form->get_name() : esc_html__( 'New Form', 'give' ) ) ); |
|
1790 | + $payment_title = (isset($data['form_title']) ? $data['form_title'] : (isset($form) ? $form->get_name() : esc_html__('New Form', 'give'))); |
|
1791 | 1791 | $donor_args = array( |
1792 | - 'name' => ! is_email( $payment_title ) ? $data['first_name'] . ' ' . $data['last_name'] : '', |
|
1792 | + 'name' => ! is_email($payment_title) ? $data['first_name'].' '.$data['last_name'] : '', |
|
1793 | 1793 | 'email' => $data['email'], |
1794 | 1794 | ); |
1795 | 1795 | |
1796 | - if ( ! empty( $customer_id ) ) { |
|
1796 | + if ( ! empty($customer_id)) { |
|
1797 | 1797 | $donor_args['user_id'] = $customer_id; |
1798 | 1798 | } |
1799 | 1799 | |
1800 | - $donor_data->create( $donor_args ); |
|
1800 | + $donor_data->create($donor_args); |
|
1801 | 1801 | |
1802 | 1802 | // Adding notes that donor is being imported from CSV. |
1803 | 1803 | $current_user = wp_get_current_user(); |
1804 | - $donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) ); |
|
1804 | + $donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email))); |
|
1805 | 1805 | |
1806 | - $report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 ); |
|
1806 | + $report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1); |
|
1807 | 1807 | } else { |
1808 | - $report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 ); |
|
1808 | + $report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1); |
|
1809 | 1809 | } |
1810 | 1810 | } |
1811 | 1811 | } else { |
1812 | - $report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 ); |
|
1812 | + $report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1); |
|
1813 | 1813 | } |
1814 | 1814 | } |
1815 | 1815 | |
1816 | 1816 | // update the report |
1817 | - give_import_donation_report_update( $report ); |
|
1817 | + give_import_donation_report_update($report); |
|
1818 | 1818 | |
1819 | 1819 | return $donor_data; |
1820 | 1820 | } |
@@ -1828,7 +1828,7 @@ discard block |
||
1828 | 1828 | * |
1829 | 1829 | * @return array|bool|Give_Donate_Form|int|null|WP_Post |
1830 | 1830 | */ |
1831 | -function give_import_get_form_data_from_csv( $data, $import_setting = array() ) { |
|
1831 | +function give_import_get_form_data_from_csv($data, $import_setting = array()) { |
|
1832 | 1832 | $new_form = false; |
1833 | 1833 | |
1834 | 1834 | // Get the import report |
@@ -1837,58 +1837,58 @@ discard block |
||
1837 | 1837 | $form = false; |
1838 | 1838 | $meta = array(); |
1839 | 1839 | |
1840 | - if ( ! empty( $data['form_id'] ) ) { |
|
1841 | - $form = new Give_Donate_Form( $data['form_id'] ); |
|
1840 | + if ( ! empty($data['form_id'])) { |
|
1841 | + $form = new Give_Donate_Form($data['form_id']); |
|
1842 | 1842 | // Add support to older php version. |
1843 | 1843 | $form_id = $form->get_ID(); |
1844 | - if ( empty( $form_id ) ) { |
|
1845 | - $report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 ); |
|
1844 | + if (empty($form_id)) { |
|
1845 | + $report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1); |
|
1846 | 1846 | $form = false; |
1847 | 1847 | } |
1848 | 1848 | } |
1849 | 1849 | |
1850 | - if ( false === $form && ! empty( $data['form_title'] ) ) { |
|
1851 | - $form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' ); |
|
1850 | + if (false === $form && ! empty($data['form_title'])) { |
|
1851 | + $form = get_page_by_title($data['form_title'], OBJECT, 'give_forms'); |
|
1852 | 1852 | |
1853 | - if ( ! empty( $form->ID ) ) { |
|
1853 | + if ( ! empty($form->ID)) { |
|
1854 | 1854 | |
1855 | - $report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 ); |
|
1855 | + $report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1); |
|
1856 | 1856 | |
1857 | - $form = new Give_Donate_Form( $form->ID ); |
|
1857 | + $form = new Give_Donate_Form($form->ID); |
|
1858 | 1858 | } else { |
1859 | 1859 | $form = new Give_Donate_Form(); |
1860 | 1860 | $args = array( |
1861 | 1861 | 'post_title' => $data['form_title'], |
1862 | 1862 | 'post_status' => 'publish', |
1863 | 1863 | ); |
1864 | - $form = $form->create( $args ); |
|
1865 | - $report['create_form'] = ( ! empty( $report['create_form'] ) ? ( absint( $report['create_form'] ) + 1 ) : 1 ); |
|
1864 | + $form = $form->create($args); |
|
1865 | + $report['create_form'] = ( ! empty($report['create_form']) ? (absint($report['create_form']) + 1) : 1); |
|
1866 | 1866 | $new_form = true; |
1867 | 1867 | |
1868 | 1868 | } |
1869 | 1869 | |
1870 | - $form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' ); |
|
1871 | - $form = new Give_Donate_Form( $form->ID ); |
|
1870 | + $form = get_page_by_title($data['form_title'], OBJECT, 'give_forms'); |
|
1871 | + $form = new Give_Donate_Form($form->ID); |
|
1872 | 1872 | } |
1873 | 1873 | |
1874 | - if ( ! empty( $form ) && $form->get_ID() ) { |
|
1875 | - if ( ! empty( $data['form_level'] ) && 'custom' != (string) strtolower( $data['form_level'] ) ) { |
|
1874 | + if ( ! empty($form) && $form->get_ID()) { |
|
1875 | + if ( ! empty($data['form_level']) && 'custom' != (string) strtolower($data['form_level'])) { |
|
1876 | 1876 | $prices = (array) $form->get_prices(); |
1877 | 1877 | $price_text = array(); |
1878 | - foreach ( $prices as $key => $price ) { |
|
1879 | - if ( isset( $price['_give_id']['level_id'] ) ) { |
|
1880 | - $price_text[ $price['_give_id']['level_id'] ] = ( ! empty( $price['_give_text'] ) ? $price['_give_text'] : '' ); |
|
1878 | + foreach ($prices as $key => $price) { |
|
1879 | + if (isset($price['_give_id']['level_id'])) { |
|
1880 | + $price_text[$price['_give_id']['level_id']] = ( ! empty($price['_give_text']) ? $price['_give_text'] : ''); |
|
1881 | 1881 | } |
1882 | 1882 | } |
1883 | 1883 | |
1884 | - if ( ! in_array( $data['form_level'], $price_text ) ) { |
|
1884 | + if ( ! in_array($data['form_level'], $price_text)) { |
|
1885 | 1885 | |
1886 | 1886 | // For generating unquiet level id. |
1887 | 1887 | $count = 1; |
1888 | - $new_level = count( $prices ) + $count; |
|
1889 | - while ( array_key_exists( $new_level, $price_text ) ) { |
|
1890 | - $count ++; |
|
1891 | - $new_level = count( $prices ) + $count; |
|
1888 | + $new_level = count($prices) + $count; |
|
1889 | + while (array_key_exists($new_level, $price_text)) { |
|
1890 | + $count++; |
|
1891 | + $new_level = count($prices) + $count; |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | $multi_level_donations = array( |
@@ -1896,45 +1896,45 @@ discard block |
||
1896 | 1896 | '_give_id' => array( |
1897 | 1897 | 'level_id' => $new_level, |
1898 | 1898 | ), |
1899 | - '_give_amount' => give_sanitize_amount_for_db( $data['amount'] ), |
|
1899 | + '_give_amount' => give_sanitize_amount_for_db($data['amount']), |
|
1900 | 1900 | '_give_text' => $data['form_level'], |
1901 | 1901 | ), |
1902 | 1902 | ); |
1903 | 1903 | |
1904 | - $price_text[ $new_level ] = $data['form_level']; |
|
1904 | + $price_text[$new_level] = $data['form_level']; |
|
1905 | 1905 | |
1906 | - if ( ! empty( $prices ) && is_array( $prices ) && ! empty( $prices[0] ) ) { |
|
1907 | - $prices = wp_parse_args( $multi_level_donations, $prices ); |
|
1906 | + if ( ! empty($prices) && is_array($prices) && ! empty($prices[0])) { |
|
1907 | + $prices = wp_parse_args($multi_level_donations, $prices); |
|
1908 | 1908 | } else { |
1909 | 1909 | $multi_level_donations[0]['_give_default'] = 'default'; |
1910 | 1910 | $prices = $multi_level_donations; |
1911 | 1911 | } |
1912 | 1912 | } |
1913 | - $form->price_id = array_search( $data['form_level'], $price_text ); |
|
1913 | + $form->price_id = array_search($data['form_level'], $price_text); |
|
1914 | 1914 | |
1915 | - $donation_levels_amounts = wp_list_pluck( $prices, '_give_amount' ); |
|
1916 | - $min_amount = min( $donation_levels_amounts ); |
|
1917 | - $max_amount = max( $donation_levels_amounts ); |
|
1915 | + $donation_levels_amounts = wp_list_pluck($prices, '_give_amount'); |
|
1916 | + $min_amount = min($donation_levels_amounts); |
|
1917 | + $max_amount = max($donation_levels_amounts); |
|
1918 | 1918 | |
1919 | 1919 | $meta = array( |
1920 | 1920 | '_give_levels_minimum_amount' => $min_amount, |
1921 | 1921 | '_give_levels_maximum_amount' => $max_amount, |
1922 | 1922 | '_give_price_option' => 'multi', |
1923 | - '_give_donation_levels' => array_values( $prices ), |
|
1923 | + '_give_donation_levels' => array_values($prices), |
|
1924 | 1924 | ); |
1925 | 1925 | } else { |
1926 | 1926 | $form->price_id = 'custom'; |
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | $defaults = array( |
1930 | - '_give_set_price' => give_sanitize_amount_for_db( $data['amount'] ), |
|
1930 | + '_give_set_price' => give_sanitize_amount_for_db($data['amount']), |
|
1931 | 1931 | '_give_price_option' => 'set', |
1932 | 1932 | ); |
1933 | 1933 | |
1934 | 1934 | // If new form is created. |
1935 | - if ( ! empty( $new_form ) ) { |
|
1935 | + if ( ! empty($new_form)) { |
|
1936 | 1936 | $new_form = array( |
1937 | - '_give_custom_amount_text' => ( ! empty( $data['form_custom_amount_text'] ) ? $data['form_custom_amount_text'] : 'Custom' ), |
|
1937 | + '_give_custom_amount_text' => ( ! empty($data['form_custom_amount_text']) ? $data['form_custom_amount_text'] : 'Custom'), |
|
1938 | 1938 | '_give_logged_in_only' => 'enabled', |
1939 | 1939 | '_give_custom_amount' => 'enabled', |
1940 | 1940 | '_give_payment_import' => true, |
@@ -1945,18 +1945,18 @@ discard block |
||
1945 | 1945 | '_give_default_gateway' => 'global', |
1946 | 1946 | '_give_show_register_form' => 'both', |
1947 | 1947 | ); |
1948 | - $defaults = wp_parse_args( $defaults, $new_form ); |
|
1948 | + $defaults = wp_parse_args($defaults, $new_form); |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | - $meta = wp_parse_args( $meta, $defaults ); |
|
1951 | + $meta = wp_parse_args($meta, $defaults); |
|
1952 | 1952 | |
1953 | - foreach ( $meta as $key => $value ) { |
|
1954 | - give_update_meta( $form->get_ID(), $key, $value ); |
|
1953 | + foreach ($meta as $key => $value) { |
|
1954 | + give_update_meta($form->get_ID(), $key, $value); |
|
1955 | 1955 | } |
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | // update the report |
1959 | - give_import_donation_report_update( $report ); |
|
1959 | + give_import_donation_report_update($report); |
|
1960 | 1960 | |
1961 | 1961 | return $form; |
1962 | 1962 | } |
@@ -1969,19 +1969,19 @@ discard block |
||
1969 | 1969 | * @param \WP_Query |
1970 | 1970 | * |
1971 | 1971 | */ |
1972 | -function give_remove_pages_from_search( $query ) { |
|
1973 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1974 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1975 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1976 | - $args = apply_filters( 'give_remove_pages_from_search', array( |
|
1972 | +function give_remove_pages_from_search($query) { |
|
1973 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1974 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1975 | + $success_page = give_get_option('success_page', 0); |
|
1976 | + $args = apply_filters('give_remove_pages_from_search', array( |
|
1977 | 1977 | $transaction_failed, |
1978 | 1978 | $success_page |
1979 | - ), $query ); |
|
1980 | - $query->set( 'post__not_in', $args ); |
|
1979 | + ), $query); |
|
1980 | + $query->set('post__not_in', $args); |
|
1981 | 1981 | } |
1982 | 1982 | } |
1983 | 1983 | |
1984 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1984 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1985 | 1985 | |
1986 | 1986 | /** |
1987 | 1987 | * Inserts a new key/value before a key in the array. |
@@ -1997,14 +1997,14 @@ discard block |
||
1997 | 1997 | * |
1998 | 1998 | * @see array_insert_before() |
1999 | 1999 | */ |
2000 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
2001 | - if ( array_key_exists( $key, $array ) ) { |
|
2000 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
2001 | + if (array_key_exists($key, $array)) { |
|
2002 | 2002 | $new = array(); |
2003 | - foreach ( $array as $k => $value ) { |
|
2004 | - if ( $k === $key ) { |
|
2005 | - $new[ $new_key ] = $new_value; |
|
2003 | + foreach ($array as $k => $value) { |
|
2004 | + if ($k === $key) { |
|
2005 | + $new[$new_key] = $new_value; |
|
2006 | 2006 | } |
2007 | - $new[ $k ] = $value; |
|
2007 | + $new[$k] = $value; |
|
2008 | 2008 | } |
2009 | 2009 | |
2010 | 2010 | return $new; |
@@ -2027,13 +2027,13 @@ discard block |
||
2027 | 2027 | * |
2028 | 2028 | * @see array_insert_before() |
2029 | 2029 | */ |
2030 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
2031 | - if ( array_key_exists( $key, $array ) ) { |
|
2030 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
2031 | + if (array_key_exists($key, $array)) { |
|
2032 | 2032 | $new = array(); |
2033 | - foreach ( $array as $k => $value ) { |
|
2034 | - $new[ $k ] = $value; |
|
2035 | - if ( $k === $key ) { |
|
2036 | - $new[ $new_key ] = $new_value; |
|
2033 | + foreach ($array as $k => $value) { |
|
2034 | + $new[$k] = $value; |
|
2035 | + if ($k === $key) { |
|
2036 | + $new[$new_key] = $new_value; |
|
2037 | 2037 | } |
2038 | 2038 | } |
2039 | 2039 | |
@@ -2060,21 +2060,21 @@ discard block |
||
2060 | 2060 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
2061 | 2061 | * `$list` will be preserved in the results. |
2062 | 2062 | */ |
2063 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
2063 | +function give_list_pluck($list, $field, $index_key = null) { |
|
2064 | 2064 | |
2065 | - if ( ! $index_key ) { |
|
2065 | + if ( ! $index_key) { |
|
2066 | 2066 | /* |
2067 | 2067 | * This is simple. Could at some point wrap array_column() |
2068 | 2068 | * if we knew we had an array of arrays. |
2069 | 2069 | */ |
2070 | - foreach ( $list as $key => $value ) { |
|
2071 | - if ( is_object( $value ) ) { |
|
2072 | - if ( isset( $value->$field ) ) { |
|
2073 | - $list[ $key ] = $value->$field; |
|
2070 | + foreach ($list as $key => $value) { |
|
2071 | + if (is_object($value)) { |
|
2072 | + if (isset($value->$field)) { |
|
2073 | + $list[$key] = $value->$field; |
|
2074 | 2074 | } |
2075 | 2075 | } else { |
2076 | - if ( isset( $value[ $field ] ) ) { |
|
2077 | - $list[ $key ] = $value[ $field ]; |
|
2076 | + if (isset($value[$field])) { |
|
2077 | + $list[$key] = $value[$field]; |
|
2078 | 2078 | } |
2079 | 2079 | } |
2080 | 2080 | } |
@@ -2087,18 +2087,18 @@ discard block |
||
2087 | 2087 | * to the end of the stack. This is how array_column() behaves. |
2088 | 2088 | */ |
2089 | 2089 | $newlist = array(); |
2090 | - foreach ( $list as $value ) { |
|
2091 | - if ( is_object( $value ) ) { |
|
2092 | - if ( isset( $value->$index_key ) ) { |
|
2093 | - $newlist[ $value->$index_key ] = $value->$field; |
|
2090 | + foreach ($list as $value) { |
|
2091 | + if (is_object($value)) { |
|
2092 | + if (isset($value->$index_key)) { |
|
2093 | + $newlist[$value->$index_key] = $value->$field; |
|
2094 | 2094 | } else { |
2095 | 2095 | $newlist[] = $value->$field; |
2096 | 2096 | } |
2097 | 2097 | } else { |
2098 | - if ( isset( $value[ $index_key ] ) ) { |
|
2099 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
2098 | + if (isset($value[$index_key])) { |
|
2099 | + $newlist[$value[$index_key]] = $value[$field]; |
|
2100 | 2100 | } else { |
2101 | - $newlist[] = $value[ $field ]; |
|
2101 | + $newlist[] = $value[$field]; |
|
2102 | 2102 | } |
2103 | 2103 | } |
2104 | 2104 | } |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | * @since 1.8.13 |
2115 | 2115 | */ |
2116 | 2116 | function give_import_donation_report() { |
2117 | - return get_option( 'give_import_donation_report', array() ); |
|
2117 | + return get_option('give_import_donation_report', array()); |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | |
@@ -2123,8 +2123,8 @@ discard block |
||
2123 | 2123 | * |
2124 | 2124 | * @since 1.8.13 |
2125 | 2125 | */ |
2126 | -function give_import_donation_report_update( $value = array() ) { |
|
2127 | - update_option( 'give_import_donation_report', $value ); |
|
2126 | +function give_import_donation_report_update($value = array()) { |
|
2127 | + update_option('give_import_donation_report', $value); |
|
2128 | 2128 | } |
2129 | 2129 | |
2130 | 2130 | |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | * @since 1.8.13 |
2135 | 2135 | */ |
2136 | 2136 | function give_import_donation_report_reset() { |
2137 | - update_option( 'give_import_donation_report', array() ); |
|
2137 | + update_option('give_import_donation_report', array()); |
|
2138 | 2138 | } |
2139 | 2139 | |
2140 | 2140 | |
@@ -2151,8 +2151,8 @@ discard block |
||
2151 | 2151 | * |
2152 | 2152 | * @return int|false Meta ID on success, false on failure. |
2153 | 2153 | */ |
2154 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
2155 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
2154 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
2155 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
2156 | 2156 | } |
2157 | 2157 | |
2158 | 2158 | /** |
@@ -2170,8 +2170,8 @@ discard block |
||
2170 | 2170 | * |
2171 | 2171 | * @return bool True on success, false on failure. |
2172 | 2172 | */ |
2173 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
2174 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
2173 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
2174 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
2175 | 2175 | } |
2176 | 2176 | |
2177 | 2177 | /** |
@@ -2186,8 +2186,8 @@ discard block |
||
2186 | 2186 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
2187 | 2187 | * is true. |
2188 | 2188 | */ |
2189 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
2190 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
2189 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
2190 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
2191 | 2191 | } |
2192 | 2192 | |
2193 | 2193 | /** |
@@ -2204,8 +2204,8 @@ discard block |
||
2204 | 2204 | * |
2205 | 2205 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
2206 | 2206 | */ |
2207 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
2208 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
2207 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
2208 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
2209 | 2209 | } |
2210 | 2210 | |
2211 | 2211 | /* |
@@ -2215,55 +2215,55 @@ discard block |
||
2215 | 2215 | * |
2216 | 2216 | * @param int $form_id Form id of which recalculation needs to be done. |
2217 | 2217 | */ |
2218 | -function give_recount_form_income_donation( $form_id = false ) { |
|
2218 | +function give_recount_form_income_donation($form_id = false) { |
|
2219 | 2219 | // Check if form id is not empty. |
2220 | - if ( ! empty( $form_id ) ) { |
|
2220 | + if ( ! empty($form_id)) { |
|
2221 | 2221 | /** |
2222 | 2222 | * Filter to modify payment status. |
2223 | 2223 | * |
2224 | 2224 | * @since 1.8.13 |
2225 | 2225 | */ |
2226 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
2226 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
2227 | 2227 | |
2228 | 2228 | /** |
2229 | 2229 | * Filter to modify args of payment query before recalculating the form total |
2230 | 2230 | * |
2231 | 2231 | * @since 1.8.13 |
2232 | 2232 | */ |
2233 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
2233 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
2234 | 2234 | 'give_forms' => $form_id, |
2235 | 2235 | 'status' => $accepted_statuses, |
2236 | - 'posts_per_page' => - 1, |
|
2236 | + 'posts_per_page' => -1, |
|
2237 | 2237 | 'fields' => 'ids', |
2238 | - ) ); |
|
2238 | + )); |
|
2239 | 2239 | |
2240 | 2240 | $totals = array( |
2241 | 2241 | 'sales' => 0, |
2242 | 2242 | 'earnings' => 0, |
2243 | 2243 | ); |
2244 | 2244 | |
2245 | - $payments = new Give_Payments_Query( $args ); |
|
2245 | + $payments = new Give_Payments_Query($args); |
|
2246 | 2246 | $payments = $payments->get_payments(); |
2247 | 2247 | |
2248 | - if ( $payments ) { |
|
2249 | - foreach ( $payments as $payment ) { |
|
2248 | + if ($payments) { |
|
2249 | + foreach ($payments as $payment) { |
|
2250 | 2250 | //Ensure acceptible status only |
2251 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
2251 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
2252 | 2252 | continue; |
2253 | 2253 | } |
2254 | 2254 | |
2255 | 2255 | //Ensure only payments for this form are counted |
2256 | - if ( $payment->form_id != $form_id ) { |
|
2256 | + if ($payment->form_id != $form_id) { |
|
2257 | 2257 | continue; |
2258 | 2258 | } |
2259 | 2259 | |
2260 | - $totals['sales'] ++; |
|
2260 | + $totals['sales']++; |
|
2261 | 2261 | $totals['earnings'] += $payment->total; |
2262 | 2262 | |
2263 | 2263 | } |
2264 | 2264 | } |
2265 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
2266 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
2265 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
2266 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
2267 | 2267 | } |
2268 | 2268 | } |
2269 | 2269 | |
@@ -2294,7 +2294,7 @@ discard block |
||
2294 | 2294 | ); |
2295 | 2295 | |
2296 | 2296 | // Check for Zero Based Currency. |
2297 | - if ( in_array( give_get_currency(), $zero_based_currency ) ) { |
|
2297 | + if (in_array(give_get_currency(), $zero_based_currency)) { |
|
2298 | 2298 | return true; |
2299 | 2299 | } |
2300 | 2300 |
@@ -10,7 +10,7 @@ |
||
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 |
@@ -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 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX. |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | - if ( isset( $_POST['give_payment_mode'] ) ) { |
|
41 | + if (isset($_POST['give_payment_mode'])) { |
|
42 | 42 | /** |
43 | 43 | * Fire to render donation form. |
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_donation_form', $_POST['give_form_id'] ); |
|
47 | + do_action('give_donation_form', $_POST['give_form_id']); |
|
48 | 48 | |
49 | 49 | exit(); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
54 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
53 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
54 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Sets an error within the donation form if no gateways are enabled. |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | function give_no_gateway_error() { |
64 | 64 | $gateways = give_get_enabled_payment_gateways(); |
65 | 65 | |
66 | - if ( empty( $gateways ) ) { |
|
67 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
66 | + if (empty($gateways)) { |
|
67 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
68 | 68 | } else { |
69 | - give_unset_error( 'no_gateways' ); |
|
69 | + give_unset_error('no_gateways'); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | -add_action( 'init', 'give_no_gateway_error' ); |
|
73 | +add_action('init', 'give_no_gateway_error'); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Page' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Page. |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | // Get current setting page. |
63 | 63 | $this->current_setting_page = give_get_current_setting_page(); |
64 | 64 | |
65 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
66 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
67 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections' ) ); |
|
68 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
69 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
65 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
66 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
67 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array($this, 'output_sections')); |
|
68 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
69 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - function set_default_setting_tab( $setting_tab ) { |
|
81 | + function set_default_setting_tab($setting_tab) { |
|
82 | 82 | return $this->default_tab; |
83 | 83 | } |
84 | 84 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return array |
93 | 93 | */ |
94 | - public function add_settings_page( $pages ) { |
|
95 | - $pages[ $this->id ] = $this->label; |
|
94 | + public function add_settings_page($pages) { |
|
95 | + $pages[$this->id] = $this->label; |
|
96 | 96 | |
97 | 97 | return $pages; |
98 | 98 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param array $settings |
113 | 113 | */ |
114 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
114 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
115 | 115 | |
116 | 116 | // Output. |
117 | 117 | return $settings; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return array |
125 | 125 | */ |
126 | 126 | public function get_sections() { |
127 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
127 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -141,29 +141,29 @@ discard block |
||
141 | 141 | $sections = $this->get_sections(); |
142 | 142 | |
143 | 143 | // Show section settings only if setting section exist. |
144 | - if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) { |
|
145 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
144 | + if ($current_section && ! in_array($current_section, array_keys($sections))) { |
|
145 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
146 | 146 | $GLOBALS['give_hide_save_button'] = true; |
147 | 147 | |
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Bailout. |
152 | - if ( empty( $sections ) ) { |
|
152 | + if (empty($sections)) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - if ( is_null( $this->current_setting_page ) ) { |
|
156 | + if (is_null($this->current_setting_page)) { |
|
157 | 157 | $this->current_setting_page = give_get_current_setting_page(); |
158 | 158 | } |
159 | 159 | |
160 | 160 | echo '<ul class="subsubsub">'; |
161 | 161 | |
162 | 162 | // Get section keys. |
163 | - $array_keys = array_keys( $sections ); |
|
163 | + $array_keys = array_keys($sections); |
|
164 | 164 | |
165 | - foreach ( $sections as $id => $label ) { |
|
166 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
165 | + foreach ($sections as $id => $label) { |
|
166 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | echo '</ul><br class="clear" /><hr>'; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function output() { |
179 | 179 | $settings = $this->get_settings(); |
180 | 180 | |
181 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
181 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | $settings = $this->get_settings(); |
192 | 192 | $current_section = give_get_current_setting_section(); |
193 | 193 | |
194 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
194 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Trigger Action |
198 | 198 | * |
199 | 199 | * @since 1.8 |
200 | 200 | */ |
201 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
201 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function __construct() { |
89 | 89 | |
90 | - if ( 'none' === $this->get_template() ) { |
|
90 | + if ('none' === $this->get_template()) { |
|
91 | 91 | $this->html = false; |
92 | 92 | } |
93 | 93 | |
94 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
95 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
94 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
95 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param $key |
105 | 105 | * @param $value |
106 | 106 | */ |
107 | - public function __set( $key, $value ) { |
|
107 | + public function __set($key, $value) { |
|
108 | 108 | $this->$key = $value; |
109 | 109 | } |
110 | 110 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | 116 | public function get_from_name() { |
117 | - if ( ! $this->from_name ) { |
|
118 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
117 | + if ( ! $this->from_name) { |
|
118 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
119 | 119 | } |
120 | 120 | |
121 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
121 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | 129 | public function get_from_address() { |
130 | - if ( ! $this->from_address ) { |
|
131 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
130 | + if ( ! $this->from_address) { |
|
131 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
134 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | * @since 1.0 |
141 | 141 | */ |
142 | 142 | public function get_content_type() { |
143 | - if ( ! $this->content_type && $this->html ) { |
|
144 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
145 | - } else if ( ! $this->html ) { |
|
143 | + if ( ! $this->content_type && $this->html) { |
|
144 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
145 | + } else if ( ! $this->html) { |
|
146 | 146 | $this->content_type = 'text/plain'; |
147 | 147 | } |
148 | 148 | |
149 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
149 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * @since 1.0 |
156 | 156 | */ |
157 | 157 | public function get_headers() { |
158 | - if ( ! $this->headers ) { |
|
158 | + if ( ! $this->headers) { |
|
159 | 159 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
160 | 160 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
161 | 161 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
162 | 162 | } |
163 | 163 | |
164 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
164 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function get_templates() { |
173 | 173 | $templates = array( |
174 | - 'default' => esc_html__( 'Default Template', 'give' ), |
|
175 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) |
|
174 | + 'default' => esc_html__('Default Template', 'give'), |
|
175 | + 'none' => esc_html__('No template, plain text only', 'give') |
|
176 | 176 | ); |
177 | 177 | |
178 | - return apply_filters( 'give_email_templates', $templates ); |
|
178 | + return apply_filters('give_email_templates', $templates); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @since 1.0 |
185 | 185 | */ |
186 | 186 | public function get_template() { |
187 | - if ( ! $this->template ) { |
|
188 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
187 | + if ( ! $this->template) { |
|
188 | + $this->template = give_get_option('email_template', 'default'); |
|
189 | 189 | } |
190 | 190 | |
191 | - return apply_filters( 'give_email_template', $this->template ); |
|
191 | + return apply_filters('give_email_template', $this->template); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @since 1.0 |
198 | 198 | */ |
199 | 199 | public function get_heading() { |
200 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
200 | + return apply_filters('give_email_heading', $this->heading); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function parse_tags( $content ) { |
|
210 | + public function parse_tags($content) { |
|
211 | 211 | return $content; |
212 | 212 | } |
213 | 213 | |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function build_email( $message ) { |
|
223 | + public function build_email($message) { |
|
224 | 224 | |
225 | - if ( false === $this->html ) { |
|
226 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
225 | + if (false === $this->html) { |
|
226 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
227 | 227 | } |
228 | 228 | |
229 | - $message = $this->text_to_html( $message ); |
|
229 | + $message = $this->text_to_html($message); |
|
230 | 230 | |
231 | 231 | $template = $this->get_template(); |
232 | 232 | |
233 | 233 | ob_start(); |
234 | 234 | |
235 | - give_get_template_part( 'emails/header', $template, true ); |
|
235 | + give_get_template_part('emails/header', $template, true); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires in the email head. |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param Give_Emails $this The email object. |
243 | 243 | */ |
244 | - do_action( 'give_email_header', $this ); |
|
244 | + do_action('give_email_header', $this); |
|
245 | 245 | |
246 | - if ( has_action( 'give_email_template_' . $template ) ) { |
|
246 | + if (has_action('give_email_template_'.$template)) { |
|
247 | 247 | /** |
248 | 248 | * Fires in a specific email template. |
249 | 249 | * |
250 | 250 | * @since 1.0 |
251 | 251 | */ |
252 | - do_action( "give_email_template_{$template}" ); |
|
252 | + do_action("give_email_template_{$template}"); |
|
253 | 253 | } else { |
254 | - give_get_template_part( 'emails/body', $template, true ); |
|
254 | + give_get_template_part('emails/body', $template, true); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @param Give_Emails $this The email object. |
263 | 263 | */ |
264 | - do_action( 'give_email_body', $this ); |
|
264 | + do_action('give_email_body', $this); |
|
265 | 265 | |
266 | - give_get_template_part( 'emails/footer', $template, true ); |
|
266 | + give_get_template_part('emails/footer', $template, true); |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Fires in the email footer. |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @param Give_Emails $this The email object. |
274 | 274 | */ |
275 | - do_action( 'give_email_footer', $this ); |
|
275 | + do_action('give_email_footer', $this); |
|
276 | 276 | |
277 | 277 | $body = ob_get_clean(); |
278 | - $message = str_replace( '{email}', $message, $body ); |
|
278 | + $message = str_replace('{email}', $message, $body); |
|
279 | 279 | |
280 | - return apply_filters( 'give_email_message', $message, $this ); |
|
280 | + return apply_filters('give_email_message', $message, $this); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return bool |
292 | 292 | */ |
293 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
293 | + public function send($to, $subject, $message, $attachments = '') { |
|
294 | 294 | |
295 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
296 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
295 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
296 | + _doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
297 | 297 | |
298 | 298 | return false; |
299 | 299 | } |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @param Give_Emails $this The email object. |
307 | 307 | */ |
308 | - do_action( 'give_email_send_before', $this ); |
|
308 | + do_action('give_email_send_before', $this); |
|
309 | 309 | |
310 | - $subject = $this->parse_tags( $subject ); |
|
311 | - $message = $this->parse_tags( $message ); |
|
310 | + $subject = $this->parse_tags($subject); |
|
311 | + $message = $this->parse_tags($message); |
|
312 | 312 | |
313 | - $message = $this->build_email( $message ); |
|
313 | + $message = $this->build_email($message); |
|
314 | 314 | |
315 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
315 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
316 | 316 | |
317 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
317 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Fires after sending an email. |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param Give_Emails $this The email object. |
325 | 325 | */ |
326 | - do_action( 'give_email_send_after', $this ); |
|
326 | + do_action('give_email_send_after', $this); |
|
327 | 327 | |
328 | 328 | return $sent; |
329 | 329 | |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * @since 1.0 |
336 | 336 | */ |
337 | 337 | public function send_before() { |
338 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
339 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
340 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
338 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
339 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
340 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @since 1.0 |
347 | 347 | */ |
348 | 348 | public function send_after() { |
349 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
350 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
351 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
349 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
350 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
351 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
352 | 352 | |
353 | 353 | // Reset heading to an empty string |
354 | 354 | $this->heading = ''; |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @since 1.0 |
361 | 361 | */ |
362 | - public function text_to_html( $message ) { |
|
362 | + public function text_to_html($message) { |
|
363 | 363 | |
364 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
365 | - $message = wpautop( $message ); |
|
364 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
365 | + $message = wpautop($message); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | return $message; |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | 'disabled' => __( 'Disabled', 'give' ), |
87 | 87 | ) |
88 | 88 | ), |
89 | - array( |
|
90 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
91 | - 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
92 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
93 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
94 | - 'type' => 'give_docs_link', |
|
95 | - ), |
|
89 | + array( |
|
90 | + 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
91 | + 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
92 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
93 | + 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
94 | + 'type' => 'give_docs_link', |
|
95 | + ), |
|
96 | 96 | array( |
97 | 97 | 'type' => 'sectionend', |
98 | 98 | 'id' => 'give_title_gateway_settings_2', |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | 'textarea_rows' => 6, |
146 | 146 | ) |
147 | 147 | ), |
148 | - array( |
|
149 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
150 | - 'id' => 'offline_gateway_settings_docs_link', |
|
151 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
152 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
153 | - 'type' => 'give_docs_link', |
|
154 | - ), |
|
148 | + array( |
|
149 | + 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
150 | + 'id' => 'offline_gateway_settings_docs_link', |
|
151 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
152 | + 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
153 | + 'type' => 'give_docs_link', |
|
154 | + ), |
|
155 | 155 | array( |
156 | 156 | 'type' => 'sectionend', |
157 | 157 | 'id' => 'give_title_gateway_settings_3', |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | 'id' => 'default_gateway', |
190 | 190 | 'type' => 'default_gateway' |
191 | 191 | ), |
192 | - array( |
|
193 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
194 | - 'id' => 'gateway_settings_docs_link', |
|
195 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
196 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
197 | - 'type' => 'give_docs_link', |
|
198 | - ), |
|
192 | + array( |
|
193 | + 'name' => __( 'Gateways Docs Link', 'give' ), |
|
194 | + 'id' => 'gateway_settings_docs_link', |
|
195 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
196 | + 'title' => __( 'Gateway Settings', 'give' ), |
|
197 | + 'type' => 'give_docs_link', |
|
198 | + ), |
|
199 | 199 | array( |
200 | 200 | 'id' => 'give_title_gateway_settings_1', |
201 | 201 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Gateways. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'gateways'; |
30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'gateways-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'paypal-standard': |
49 | 49 | $settings = array( |
50 | 50 | // Section 2: PayPal Standard. |
@@ -53,55 +53,55 @@ discard block |
||
53 | 53 | 'id' => 'give_title_gateway_settings_2', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'PayPal Email', 'give' ), |
|
57 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
56 | + 'name' => __('PayPal Email', 'give'), |
|
57 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
58 | 58 | 'id' => 'paypal_email', |
59 | 59 | 'type' => 'email', |
60 | 60 | ), |
61 | 61 | array( |
62 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
63 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
62 | + 'name' => __('PayPal Page Style', 'give'), |
|
63 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
64 | 64 | 'id' => 'paypal_page_style', |
65 | 65 | 'type' => 'text', |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
69 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
68 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
69 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
70 | 70 | 'id' => 'paypal_button_type', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'options' => array( |
73 | - 'donation' => __( 'Donation', 'give' ), |
|
74 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
73 | + 'donation' => __('Donation', 'give'), |
|
74 | + 'standard' => __('Standard Transaction', 'give') |
|
75 | 75 | ), |
76 | 76 | 'default' => 'donation', |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => __( 'Billing Details', 'give' ), |
|
80 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
79 | + 'name' => __('Billing Details', 'give'), |
|
80 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
81 | 81 | 'id' => 'paypal_standard_billing_details', |
82 | 82 | 'type' => 'radio_inline', |
83 | 83 | 'default' => 'disabled', |
84 | 84 | 'options' => array( |
85 | - 'enabled' => __( 'Enabled', 'give' ), |
|
86 | - 'disabled' => __( 'Disabled', 'give' ), |
|
85 | + 'enabled' => __('Enabled', 'give'), |
|
86 | + 'disabled' => __('Disabled', 'give'), |
|
87 | 87 | ) |
88 | 88 | ), |
89 | 89 | array( |
90 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
91 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
90 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
91 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
92 | 92 | 'id' => 'paypal_verification', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ) |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
101 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
102 | 102 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
103 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
104 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
103 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
104 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
105 | 105 | 'type' => 'give_docs_link', |
106 | 106 | ), |
107 | 107 | array( |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | 'id' => 'give_title_gateway_settings_3', |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
123 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
122 | + 'name' => __('Collect Billing Details', 'give'), |
|
123 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
124 | 124 | 'id' => 'give_offline_donation_enable_billing_fields', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'disabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ) |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give') |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
134 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
133 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
134 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
135 | 135 | 'id' => 'global_offline_donation_content', |
136 | 136 | 'default' => give_get_default_offline_donation_content(), |
137 | 137 | 'type' => 'wysiwyg', |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | ) |
141 | 141 | ), |
142 | 142 | array( |
143 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
144 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
143 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
144 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
145 | 145 | 'id' => 'offline_donation_subject', |
146 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
146 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
147 | 147 | 'type' => 'text' |
148 | 148 | ), |
149 | 149 | array( |
150 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
151 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
150 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
151 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
152 | 152 | 'id' => 'global_offline_donation_email', |
153 | 153 | 'default' => give_get_default_offline_donation_email_content(), |
154 | 154 | 'type' => 'wysiwyg', |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | ) |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
160 | + 'name' => __('Offline Donations Settings Docs Link', 'give'), |
|
161 | 161 | 'id' => 'offline_gateway_settings_docs_link', |
162 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
163 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
162 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'), |
|
163 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
164 | 164 | 'type' => 'give_docs_link', |
165 | 165 | ), |
166 | 166 | array( |
@@ -178,33 +178,33 @@ discard block |
||
178 | 178 | 'type' => 'title' |
179 | 179 | ), |
180 | 180 | array( |
181 | - 'name' => __( 'Test Mode', 'give' ), |
|
182 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
181 | + 'name' => __('Test Mode', 'give'), |
|
182 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
183 | 183 | 'id' => 'test_mode', |
184 | 184 | 'type' => 'radio_inline', |
185 | 185 | 'default' => 'disabled', |
186 | 186 | 'options' => array( |
187 | - 'enabled' => __( 'Enabled', 'give' ), |
|
188 | - 'disabled' => __( 'Disabled', 'give' ), |
|
187 | + 'enabled' => __('Enabled', 'give'), |
|
188 | + 'disabled' => __('Disabled', 'give'), |
|
189 | 189 | ) |
190 | 190 | ), |
191 | 191 | array( |
192 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
193 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
192 | + 'name' => __('Enabled Gateways', 'give'), |
|
193 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
194 | 194 | 'id' => 'gateways', |
195 | 195 | 'type' => 'enabled_gateways' |
196 | 196 | ), |
197 | 197 | array( |
198 | - 'name' => __( 'Default Gateway', 'give' ), |
|
199 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
198 | + 'name' => __('Default Gateway', 'give'), |
|
199 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
200 | 200 | 'id' => 'default_gateway', |
201 | 201 | 'type' => 'default_gateway' |
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
204 | + 'name' => __('Gateways Docs Link', 'give'), |
|
205 | 205 | 'id' => 'gateway_settings_docs_link', |
206 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
207 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
206 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
207 | + 'title' => __('Gateway Settings', 'give'), |
|
208 | 208 | 'type' => 'give_docs_link', |
209 | 209 | ), |
210 | 210 | array( |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * Filter the payment gateways settings. |
220 | 220 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
221 | 221 | */ |
222 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
222 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Filter the settings. |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @param array $settings |
230 | 230 | */ |
231 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
231 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
232 | 232 | |
233 | 233 | // Output. |
234 | 234 | return $settings; |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function get_sections() { |
244 | 244 | $sections = array( |
245 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
246 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
247 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
245 | + 'gateways-settings' => __('Gateways', 'give'), |
|
246 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
247 | + 'offline-donations' => __('Offline Donations', 'give') |
|
248 | 248 | ); |
249 | 249 | |
250 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
250 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 |