@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | 27 | |
28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
28 | + $give_payment = get_post_type_object('give_payment'); |
|
29 | 29 | |
30 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
32 | 32 | } else { |
33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
34 | 34 | $payments_table = new Give_Payment_History_Table(); |
35 | 35 | $payments_table->prepare_items(); |
36 | 36 | ?> |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_payments_page_top' ); |
|
47 | + do_action('give_payments_page_top'); |
|
48 | 48 | ?> |
49 | 49 | |
50 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
50 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
51 | 51 | <input type="hidden" name="post_type" value="give_forms" /> |
52 | 52 | <input type="hidden" name="page" value="give-payment-history" /> |
53 | 53 | <?php $payments_table->views() ?> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @since 1.7 |
63 | 63 | */ |
64 | - do_action( 'give_payments_page_bottom' ); |
|
64 | + do_action('give_payments_page_bottom'); |
|
65 | 65 | ?> |
66 | 66 | |
67 | 67 | </div> |
@@ -78,29 +78,29 @@ discard block |
||
78 | 78 | * @param $title |
79 | 79 | * @return string |
80 | 80 | */ |
81 | -function give_view_order_details_title( $admin_title, $title ) { |
|
81 | +function give_view_order_details_title($admin_title, $title) { |
|
82 | 82 | |
83 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
83 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
84 | 84 | return $admin_title; |
85 | 85 | } |
86 | 86 | |
87 | - if( ! isset( $_GET['give-action'] ) ) { |
|
87 | + if ( ! isset($_GET['give-action'])) { |
|
88 | 88 | return $admin_title; |
89 | 89 | } |
90 | 90 | |
91 | - switch( $_GET['give-action'] ) : |
|
91 | + switch ($_GET['give-action']) : |
|
92 | 92 | |
93 | 93 | case 'view-order-details' : |
94 | 94 | $title = sprintf( |
95 | 95 | /* translators: %s: admin title */ |
96 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
96 | + esc_html__('View Donation Details - %s', 'give'), |
|
97 | 97 | $admin_title |
98 | 98 | ); |
99 | 99 | break; |
100 | 100 | case 'edit-payment' : |
101 | 101 | $title = sprintf( |
102 | 102 | /* translators: %s: admin title */ |
103 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
103 | + esc_html__('Edit Donation - %s', 'give'), |
|
104 | 104 | $admin_title |
105 | 105 | ); |
106 | 106 | break; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | return $title; |
113 | 113 | } |
114 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
114 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * @param $context |
124 | 124 | * @return string |
125 | 125 | */ |
126 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
126 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
127 | 127 | |
128 | - $post = get_post( $post_id ); |
|
128 | + $post = get_post($post_id); |
|
129 | 129 | |
130 | - if( ! $post ) { |
|
130 | + if ( ! $post) { |
|
131 | 131 | return $url; |
132 | 132 | } |
133 | 133 | |
134 | - if( 'give_payment' != $post->post_type ) { |
|
134 | + if ('give_payment' != $post->post_type) { |
|
135 | 135 | return $url; |
136 | 136 | } |
137 | 137 | |
138 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
138 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
139 | 139 | |
140 | 140 | return $url; |
141 | 141 | } |
142 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
142 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -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_get_country() { |
25 | 25 | $give_options = give_get_settings(); |
26 | - $country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US'; |
|
26 | + $country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US'; |
|
27 | 27 | |
28 | - return apply_filters( 'give_give_country', $country ); |
|
28 | + return apply_filters('give_give_country', $country); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function give_get_state() { |
38 | 38 | $give_options = give_get_settings(); |
39 | - $state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false; |
|
39 | + $state = isset($give_options['base_state']) ? $give_options['base_state'] : false; |
|
40 | 40 | |
41 | - return apply_filters( 'give_give_state', $state ); |
|
41 | + return apply_filters('give_give_state', $state); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return mixed|void A list of states for the shop's base country |
52 | 52 | */ |
53 | -function give_get_states( $country = null ) { |
|
53 | +function give_get_states($country = null) { |
|
54 | 54 | |
55 | - if ( empty( $country ) ) { |
|
55 | + if (empty($country)) { |
|
56 | 56 | $country = give_get_country(); |
57 | 57 | } |
58 | 58 | |
59 | - switch ( $country ) : |
|
59 | + switch ($country) : |
|
60 | 60 | |
61 | 61 | case 'US' : |
62 | 62 | $states = give_get_states_list(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | endswitch; |
108 | 108 | |
109 | - return apply_filters( 'give_give_states', $states ); |
|
109 | + return apply_filters('give_give_states', $states); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,253 +119,253 @@ discard block |
||
119 | 119 | function give_get_country_list() { |
120 | 120 | $countries = array( |
121 | 121 | '' => '', |
122 | - 'US' => esc_html__( 'United States', 'give' ), |
|
123 | - 'CA' => esc_html__( 'Canada', 'give' ), |
|
124 | - 'GB' => esc_html__( 'United Kingdom', 'give' ), |
|
125 | - 'AF' => esc_html__( 'Afghanistan', 'give' ), |
|
126 | - 'AL' => esc_html__( 'Albania', 'give' ), |
|
127 | - 'DZ' => esc_html__( 'Algeria', 'give' ), |
|
128 | - 'AS' => esc_html__( 'American Samoa', 'give' ), |
|
129 | - 'AD' => esc_html__( 'Andorra', 'give' ), |
|
130 | - 'AO' => esc_html__( 'Angola', 'give' ), |
|
131 | - 'AI' => esc_html__( 'Anguilla', 'give' ), |
|
132 | - 'AQ' => esc_html__( 'Antarctica', 'give' ), |
|
133 | - 'AG' => esc_html__( 'Antigua and Barbuda', 'give' ), |
|
134 | - 'AR' => esc_html__( 'Argentina', 'give' ), |
|
135 | - 'AM' => esc_html__( 'Armenia', 'give' ), |
|
136 | - 'AW' => esc_html__( 'Aruba', 'give' ), |
|
137 | - 'AU' => esc_html__( 'Australia', 'give' ), |
|
138 | - 'AT' => esc_html__( 'Austria', 'give' ), |
|
139 | - 'AZ' => esc_html__( 'Azerbaijan', 'give' ), |
|
140 | - 'BS' => esc_html__( 'Bahamas', 'give'), |
|
141 | - 'BH' => esc_html__( 'Bahrain', 'give' ), |
|
142 | - 'BD' => esc_html__( 'Bangladesh', 'give' ), |
|
143 | - 'BB' => esc_html__( 'Barbados', 'give' ), |
|
144 | - 'BY' => esc_html__( 'Belarus', 'give' ), |
|
145 | - 'BE' => esc_html__( 'Belgium', 'give' ), |
|
146 | - 'BZ' => esc_html__( 'Belize', 'give' ), |
|
147 | - 'BJ' => esc_html__( 'Benin', 'give' ), |
|
148 | - 'BM' => esc_html__( 'Bermuda', 'give' ), |
|
149 | - 'BT' => esc_html__( 'Bhutan', 'give' ), |
|
150 | - 'BO' => esc_html__( 'Bolivia', 'give' ), |
|
151 | - 'BA' => esc_html__( 'Bosnia and Herzegovina', 'give' ), |
|
152 | - 'BW' => esc_html__( 'Botswana', 'give' ), |
|
153 | - 'BV' => esc_html__( 'Bouvet Island', 'give' ), |
|
154 | - 'BR' => esc_html__( 'Brazil', 'give' ), |
|
155 | - 'IO' => esc_html__( 'British Indian Ocean Territory', 'give' ), |
|
156 | - 'BN' => esc_html__( 'Brunei Darrussalam', 'give' ), |
|
157 | - 'BG' => esc_html__( 'Bulgaria', 'give' ), |
|
158 | - 'BF' => esc_html__( 'Burkina Faso', 'give' ), |
|
159 | - 'BI' => esc_html__( 'Burundi', 'give' ), |
|
160 | - 'KH' => esc_html__( 'Cambodia', 'give' ), |
|
161 | - 'CM' => esc_html__( 'Cameroon', 'give' ), |
|
162 | - 'CV' => esc_html__( 'Cape Verde', 'give' ), |
|
163 | - 'KY' => esc_html__( 'Cayman Islands', 'give' ), |
|
164 | - 'CF' => esc_html__( 'Central African Republic', 'give' ), |
|
165 | - 'TD' => esc_html__( 'Chad', 'give' ), |
|
166 | - 'CL' => esc_html__( 'Chile', 'give' ), |
|
167 | - 'CN' => esc_html__( 'China', 'give' ), |
|
168 | - 'CX' => esc_html__( 'Christmas Island', 'give' ), |
|
169 | - 'CC' => esc_html__( 'Cocos Islands', 'give' ), |
|
170 | - 'CO' => esc_html__( 'Colombia', 'give' ), |
|
171 | - 'KM' => esc_html__( 'Comoros', 'give' ), |
|
172 | - 'CD' => esc_html__( 'Congo, Democratic People\'s Republic', 'give' ), |
|
173 | - 'CG' => esc_html__( 'Congo, Republic of', 'give' ), |
|
174 | - 'CK' => esc_html__( 'Cook Islands', 'give' ), |
|
175 | - 'CR' => esc_html__( 'Costa Rica', 'give' ), |
|
176 | - 'CI' => esc_html__( 'Cote d\'Ivoire', 'give' ), |
|
177 | - 'HR' => esc_html__( 'Croatia/Hrvatska', 'give' ), |
|
178 | - 'CU' => esc_html__( 'Cuba', 'give' ), |
|
179 | - 'CY' => esc_html__( 'Cyprus Island', 'give' ), |
|
180 | - 'CZ' => esc_html__( 'Czech Republic', 'give' ), |
|
181 | - 'DK' => esc_html__( 'Denmark', 'give' ), |
|
182 | - 'DJ' => esc_html__( 'Djibouti', 'give' ), |
|
183 | - 'DM' => esc_html__( 'Dominica', 'give' ), |
|
184 | - 'DO' => esc_html__( 'Dominican Republic', 'give' ), |
|
185 | - 'TP' => esc_html__( 'East Timor', 'give' ), |
|
186 | - 'EC' => esc_html__( 'Ecuador', 'give' ), |
|
187 | - 'EG' => esc_html__( 'Egypt', 'give' ), |
|
188 | - 'GQ' => esc_html__( 'Equatorial Guinea', 'give' ), |
|
189 | - 'SV' => esc_html__( 'El Salvador', 'give' ), |
|
190 | - 'ER' => esc_html__( 'Eritrea', 'give' ), |
|
191 | - 'EE' => esc_html__( 'Estonia', 'give' ), |
|
192 | - 'ET' => esc_html__( 'Ethiopia', 'give' ), |
|
193 | - 'FK' => esc_html__( 'Falkland Islands', 'give' ), |
|
194 | - 'FO' => esc_html__( 'Faroe Islands', 'give' ), |
|
195 | - 'FJ' => esc_html__( 'Fiji', 'give' ), |
|
196 | - 'FI' => esc_html__( 'Finland', 'give' ), |
|
197 | - 'FR' => esc_html__( 'France', 'give' ), |
|
198 | - 'GF' => esc_html__( 'French Guiana', 'give' ), |
|
199 | - 'PF' => esc_html__( 'French Polynesia', 'give' ), |
|
200 | - 'TF' => esc_html__( 'French Southern Territories', 'give' ), |
|
201 | - 'GA' => esc_html__( 'Gabon', 'give' ), |
|
202 | - 'GM' => esc_html__( 'Gambia', 'give' ), |
|
203 | - 'GE' => esc_html__( 'Georgia', 'give' ), |
|
204 | - 'DE' => esc_html__( 'Germany', 'give' ), |
|
205 | - 'GR' => esc_html__( 'Greece', 'give' ), |
|
206 | - 'GH' => esc_html__( 'Ghana', 'give' ), |
|
207 | - 'GI' => esc_html__( 'Gibraltar', 'give' ), |
|
208 | - 'GL' => esc_html__( 'Greenland', 'give' ), |
|
209 | - 'GD' => esc_html__( 'Grenada', 'give' ), |
|
210 | - 'GP' => esc_html__( 'Guadeloupe', 'give' ), |
|
211 | - 'GU' => esc_html__( 'Guam', 'give' ), |
|
212 | - 'GT' => esc_html__( 'Guatemala', 'give' ), |
|
213 | - 'GG' => esc_html__( 'Guernsey', 'give' ), |
|
214 | - 'GN' => esc_html__( 'Guinea', 'give' ), |
|
215 | - 'GW' => esc_html__( 'Guinea-Bissau', 'give' ), |
|
216 | - 'GY' => esc_html__( 'Guyana', 'give' ), |
|
217 | - 'HT' => esc_html__( 'Haiti', 'give' ), |
|
218 | - 'HM' => esc_html__( 'Heard and McDonald Islands', 'give' ), |
|
219 | - 'VA' => esc_html__( 'Holy See (City Vatican State)', 'give' ), |
|
220 | - 'HN' => esc_html__( 'Honduras', 'give' ), |
|
221 | - 'HK' => esc_html__( 'Hong Kong', 'give' ), |
|
222 | - 'HU' => esc_html__( 'Hungary', 'give' ), |
|
223 | - 'IS' => esc_html__( 'Iceland', 'give' ), |
|
224 | - 'IN' => esc_html__( 'India', 'give' ), |
|
225 | - 'ID' => esc_html__( 'Indonesia', 'give' ), |
|
226 | - 'IR' => esc_html__( 'Iran', 'give' ), |
|
227 | - 'IQ' => esc_html__( 'Iraq', 'give' ), |
|
228 | - 'IE' => esc_html__( 'Ireland', 'give' ), |
|
229 | - 'IM' => esc_html__( 'Isle of Man', 'give' ), |
|
230 | - 'IL' => esc_html__( 'Israel', 'give' ), |
|
231 | - 'IT' => esc_html__( 'Italy', 'give' ), |
|
232 | - 'JM' => esc_html__( 'Jamaica', 'give' ), |
|
233 | - 'JP' => esc_html__( 'Japan', 'give' ), |
|
234 | - 'JE' => esc_html__( 'Jersey', 'give' ), |
|
235 | - 'JO' => esc_html__( 'Jordan', 'give' ), |
|
236 | - 'KZ' => esc_html__( 'Kazakhstan', 'give' ), |
|
237 | - 'KE' => esc_html__( 'Kenya', 'give' ), |
|
238 | - 'KI' => esc_html__( 'Kiribati', 'give' ), |
|
239 | - 'KW' => esc_html__( 'Kuwait', 'give' ), |
|
240 | - 'KG' => esc_html__( 'Kyrgyzstan', 'give' ), |
|
241 | - 'LA' => esc_html__( 'Lao People\'s Democratic Republic', 'give' ), |
|
242 | - 'LV' => esc_html__( 'Latvia', 'give' ), |
|
243 | - 'LB' => esc_html__( 'Lebanon', 'give' ), |
|
244 | - 'LS' => esc_html__( 'Lesotho', 'give' ), |
|
245 | - 'LR' => esc_html__( 'Liberia', 'give' ), |
|
246 | - 'LY' => esc_html__( 'Libyan Arab Jamahiriya', 'give' ), |
|
247 | - 'LI' => esc_html__( 'Liechtenstein', 'give' ), |
|
248 | - 'LT' => esc_html__( 'Lithuania', 'give' ), |
|
249 | - 'LU' => esc_html__( 'Luxembourg', 'give' ), |
|
250 | - 'MO' => esc_html__( 'Macau', 'give' ), |
|
251 | - 'MK' => esc_html__( 'Macedonia', 'give' ), |
|
252 | - 'MG' => esc_html__( 'Madagascar', 'give' ), |
|
253 | - 'MW' => esc_html__( 'Malawi', 'give' ), |
|
254 | - 'MY' => esc_html__( 'Malaysia', 'give' ), |
|
255 | - 'MV' => esc_html__( 'Maldives', 'give' ), |
|
256 | - 'ML' => esc_html__( 'Mali', 'give' ), |
|
257 | - 'MT' => esc_html__( 'Malta', 'give' ), |
|
258 | - 'MH' => esc_html__( 'Marshall Islands', 'give' ), |
|
259 | - 'MQ' => esc_html__( 'Martinique', 'give' ), |
|
260 | - 'MR' => esc_html__( 'Mauritania', 'give' ), |
|
261 | - 'MU' => esc_html__( 'Mauritius', 'give' ), |
|
262 | - 'YT' => esc_html__( 'Mayotte', 'give' ), |
|
263 | - 'MX' => esc_html__( 'Mexico', 'give' ), |
|
264 | - 'FM' => esc_html__( 'Micronesia', 'give' ), |
|
265 | - 'MD' => esc_html__( 'Moldova, Republic of', 'give' ), |
|
266 | - 'MC' => esc_html__( 'Monaco', 'give' ), |
|
267 | - 'MN' => esc_html__( 'Mongolia', 'give' ), |
|
268 | - 'ME' => esc_html__( 'Montenegro', 'give' ), |
|
269 | - 'MS' => esc_html__( 'Montserrat', 'give' ), |
|
270 | - 'MA' => esc_html__( 'Morocco', 'give' ), |
|
271 | - 'MZ' => esc_html__( 'Mozambique', 'give' ), |
|
272 | - 'MM' => esc_html__( 'Myanmar', 'give' ), |
|
273 | - 'NA' => esc_html__( 'Namibia', 'give' ), |
|
274 | - 'NR' => esc_html__( 'Nauru', 'give' ), |
|
275 | - 'NP' => esc_html__( 'Nepal', 'give' ), |
|
276 | - 'NL' => esc_html__( 'Netherlands', 'give' ), |
|
277 | - 'AN' => esc_html__( 'Netherlands Antilles', 'give' ), |
|
278 | - 'NC' => esc_html__( 'New Caledonia', 'give' ), |
|
279 | - 'NZ' => esc_html__( 'New Zealand', 'give' ), |
|
280 | - 'NI' => esc_html__( 'Nicaragua', 'give' ), |
|
281 | - 'NE' => esc_html__( 'Niger', 'give' ), |
|
282 | - 'NG' => esc_html__( 'Nigeria', 'give' ), |
|
283 | - 'NU' => esc_html__( 'Niue', 'give' ), |
|
284 | - 'NF' => esc_html__( 'Norfolk Island', 'give' ), |
|
285 | - 'KP' => esc_html__( 'North Korea', 'give' ), |
|
286 | - 'MP' => esc_html__( 'Northern Mariana Islands', 'give' ), |
|
287 | - 'NO' => esc_html__( 'Norway', 'give' ), |
|
288 | - 'OM' => esc_html__( 'Oman', 'give' ), |
|
289 | - 'PK' => esc_html__( 'Pakistan', 'give' ), |
|
290 | - 'PW' => esc_html__( 'Palau', 'give' ), |
|
291 | - 'PS' => esc_html__( 'Palestinian Territories', 'give' ), |
|
292 | - 'PA' => esc_html__( 'Panama', 'give' ), |
|
293 | - 'PG' => esc_html__( 'Papua New Guinea', 'give' ), |
|
294 | - 'PY' => esc_html__( 'Paraguay', 'give' ), |
|
295 | - 'PE' => esc_html__( 'Peru', 'give' ), |
|
296 | - 'PH' => esc_html__( 'Phillipines', 'give' ), |
|
297 | - 'PN' => esc_html__( 'Pitcairn Island', 'give' ), |
|
298 | - 'PL' => esc_html__( 'Poland', 'give' ), |
|
299 | - 'PT' => esc_html__( 'Portugal', 'give' ), |
|
300 | - 'PR' => esc_html__( 'Puerto Rico', 'give' ), |
|
301 | - 'QA' => esc_html__( 'Qatar', 'give' ), |
|
302 | - 'RE' => esc_html__( 'Reunion Island', 'give' ), |
|
303 | - 'RO' => esc_html__( 'Romania', 'give' ), |
|
304 | - 'RU' => esc_html__( 'Russian Federation', 'give' ), |
|
305 | - 'RW' => esc_html__( 'Rwanda', 'give' ), |
|
306 | - 'SH' => esc_html__( 'Saint Helena', 'give' ), |
|
307 | - 'KN' => esc_html__( 'Saint Kitts and Nevis', 'give' ), |
|
308 | - 'LC' => esc_html__( 'Saint Lucia', 'give' ), |
|
309 | - 'PM' => esc_html__( 'Saint Pierre and Miquelon', 'give' ), |
|
310 | - 'VC' => esc_html__( 'Saint Vincent and the Grenadines', 'give' ), |
|
311 | - 'SM' => esc_html__( 'San Marino', 'give' ), |
|
312 | - 'ST' => esc_html__( 'Sao Tome and Principe', 'give' ), |
|
313 | - 'SA' => esc_html__( 'Saudi Arabia', 'give' ), |
|
314 | - 'SN' => esc_html__( 'Senegal', 'give' ), |
|
315 | - 'RS' => esc_html__( 'Serbia', 'give' ), |
|
316 | - 'SC' => esc_html__( 'Seychelles', 'give' ), |
|
317 | - 'SL' => esc_html__( 'Sierra Leone', 'give' ), |
|
318 | - 'SG' => esc_html__( 'Singapore', 'give' ), |
|
319 | - 'SK' => esc_html__( 'Slovak Republic', 'give' ), |
|
320 | - 'SI' => esc_html__( 'Slovenia', 'give' ), |
|
321 | - 'SB' => esc_html__( 'Solomon Islands', 'give' ), |
|
322 | - 'SO' => esc_html__( 'Somalia', 'give' ), |
|
323 | - 'ZA' => esc_html__( 'South Africa', 'give' ), |
|
324 | - 'GS' => esc_html__( 'South Georgia', 'give' ), |
|
325 | - 'KR' => esc_html__( 'South Korea', 'give' ), |
|
326 | - 'ES' => esc_html__( 'Spain', 'give' ), |
|
327 | - 'LK' => esc_html__( 'Sri Lanka', 'give' ), |
|
328 | - 'SD' => esc_html__( 'Sudan', 'give' ), |
|
329 | - 'SR' => esc_html__( 'Suriname', 'give' ), |
|
330 | - 'SJ' => esc_html__( 'Svalbard and Jan Mayen Islands', 'give' ), |
|
331 | - 'SZ' => esc_html__( 'Swaziland', 'give' ), |
|
332 | - 'SE' => esc_html__( 'Sweden', 'give' ), |
|
333 | - 'CH' => esc_html__( 'Switzerland', 'give' ), |
|
334 | - 'SY' => esc_html__( 'Syrian Arab Republic', 'give' ), |
|
335 | - 'TW' => esc_html__( 'Taiwan', 'give' ), |
|
336 | - 'TJ' => esc_html__( 'Tajikistan', 'give' ), |
|
337 | - 'TZ' => esc_html__( 'Tanzania', 'give' ), |
|
338 | - 'TG' => esc_html__( 'Togo', 'give' ), |
|
339 | - 'TK' => esc_html__( 'Tokelau', 'give' ), |
|
340 | - 'TO' => esc_html__( 'Tonga', 'give' ), |
|
341 | - 'TH' => esc_html__( 'Thailand', 'give' ), |
|
342 | - 'TT' => esc_html__( 'Trinidad and Tobago', 'give' ), |
|
343 | - 'TN' => esc_html__( 'Tunisia', 'give' ), |
|
344 | - 'TR' => esc_html__( 'Turkey', 'give' ), |
|
345 | - 'TM' => esc_html__( 'Turkmenistan', 'give' ), |
|
346 | - 'TC' => esc_html__( 'Turks and Caicos Islands', 'give' ), |
|
347 | - 'TV' => esc_html__( 'Tuvalu', 'give' ), |
|
348 | - 'UG' => esc_html__( 'Uganda', 'give' ), |
|
349 | - 'UA' => esc_html__( 'Ukraine', 'give' ), |
|
350 | - 'AE' => esc_html__( 'United Arab Emirates', 'give' ), |
|
351 | - 'UY' => esc_html__( 'Uruguay', 'give' ), |
|
352 | - 'UM' => esc_html__( 'US Minor Outlying Islands', 'give' ), |
|
353 | - 'UZ' => esc_html__( 'Uzbekistan', 'give' ), |
|
354 | - 'VU' => esc_html__( 'Vanuatu', 'give' ), |
|
355 | - 'VE' => esc_html__( 'Venezuela', 'give' ), |
|
356 | - 'VN' => esc_html__( 'Vietnam', 'give' ), |
|
357 | - 'VG' => esc_html__( 'Virgin Islands (British)', 'give' ), |
|
358 | - 'VI' => esc_html__( 'Virgin Islands (USA)', 'give' ), |
|
359 | - 'WF' => esc_html__( 'Wallis and Futuna Islands', 'give' ), |
|
360 | - 'EH' => esc_html__( 'Western Sahara', 'give' ), |
|
361 | - 'WS' => esc_html__( 'Western Samoa', 'give' ), |
|
362 | - 'YE' => esc_html__( 'Yemen', 'give' ), |
|
363 | - 'YU' => esc_html__( 'Yugoslavia', 'give' ), |
|
364 | - 'ZM' => esc_html__( 'Zambia', 'give' ), |
|
365 | - 'ZW' => esc_html__( 'Zimbabwe', 'give' ) |
|
122 | + 'US' => esc_html__('United States', 'give'), |
|
123 | + 'CA' => esc_html__('Canada', 'give'), |
|
124 | + 'GB' => esc_html__('United Kingdom', 'give'), |
|
125 | + 'AF' => esc_html__('Afghanistan', 'give'), |
|
126 | + 'AL' => esc_html__('Albania', 'give'), |
|
127 | + 'DZ' => esc_html__('Algeria', 'give'), |
|
128 | + 'AS' => esc_html__('American Samoa', 'give'), |
|
129 | + 'AD' => esc_html__('Andorra', 'give'), |
|
130 | + 'AO' => esc_html__('Angola', 'give'), |
|
131 | + 'AI' => esc_html__('Anguilla', 'give'), |
|
132 | + 'AQ' => esc_html__('Antarctica', 'give'), |
|
133 | + 'AG' => esc_html__('Antigua and Barbuda', 'give'), |
|
134 | + 'AR' => esc_html__('Argentina', 'give'), |
|
135 | + 'AM' => esc_html__('Armenia', 'give'), |
|
136 | + 'AW' => esc_html__('Aruba', 'give'), |
|
137 | + 'AU' => esc_html__('Australia', 'give'), |
|
138 | + 'AT' => esc_html__('Austria', 'give'), |
|
139 | + 'AZ' => esc_html__('Azerbaijan', 'give'), |
|
140 | + 'BS' => esc_html__('Bahamas', 'give'), |
|
141 | + 'BH' => esc_html__('Bahrain', 'give'), |
|
142 | + 'BD' => esc_html__('Bangladesh', 'give'), |
|
143 | + 'BB' => esc_html__('Barbados', 'give'), |
|
144 | + 'BY' => esc_html__('Belarus', 'give'), |
|
145 | + 'BE' => esc_html__('Belgium', 'give'), |
|
146 | + 'BZ' => esc_html__('Belize', 'give'), |
|
147 | + 'BJ' => esc_html__('Benin', 'give'), |
|
148 | + 'BM' => esc_html__('Bermuda', 'give'), |
|
149 | + 'BT' => esc_html__('Bhutan', 'give'), |
|
150 | + 'BO' => esc_html__('Bolivia', 'give'), |
|
151 | + 'BA' => esc_html__('Bosnia and Herzegovina', 'give'), |
|
152 | + 'BW' => esc_html__('Botswana', 'give'), |
|
153 | + 'BV' => esc_html__('Bouvet Island', 'give'), |
|
154 | + 'BR' => esc_html__('Brazil', 'give'), |
|
155 | + 'IO' => esc_html__('British Indian Ocean Territory', 'give'), |
|
156 | + 'BN' => esc_html__('Brunei Darrussalam', 'give'), |
|
157 | + 'BG' => esc_html__('Bulgaria', 'give'), |
|
158 | + 'BF' => esc_html__('Burkina Faso', 'give'), |
|
159 | + 'BI' => esc_html__('Burundi', 'give'), |
|
160 | + 'KH' => esc_html__('Cambodia', 'give'), |
|
161 | + 'CM' => esc_html__('Cameroon', 'give'), |
|
162 | + 'CV' => esc_html__('Cape Verde', 'give'), |
|
163 | + 'KY' => esc_html__('Cayman Islands', 'give'), |
|
164 | + 'CF' => esc_html__('Central African Republic', 'give'), |
|
165 | + 'TD' => esc_html__('Chad', 'give'), |
|
166 | + 'CL' => esc_html__('Chile', 'give'), |
|
167 | + 'CN' => esc_html__('China', 'give'), |
|
168 | + 'CX' => esc_html__('Christmas Island', 'give'), |
|
169 | + 'CC' => esc_html__('Cocos Islands', 'give'), |
|
170 | + 'CO' => esc_html__('Colombia', 'give'), |
|
171 | + 'KM' => esc_html__('Comoros', 'give'), |
|
172 | + 'CD' => esc_html__('Congo, Democratic People\'s Republic', 'give'), |
|
173 | + 'CG' => esc_html__('Congo, Republic of', 'give'), |
|
174 | + 'CK' => esc_html__('Cook Islands', 'give'), |
|
175 | + 'CR' => esc_html__('Costa Rica', 'give'), |
|
176 | + 'CI' => esc_html__('Cote d\'Ivoire', 'give'), |
|
177 | + 'HR' => esc_html__('Croatia/Hrvatska', 'give'), |
|
178 | + 'CU' => esc_html__('Cuba', 'give'), |
|
179 | + 'CY' => esc_html__('Cyprus Island', 'give'), |
|
180 | + 'CZ' => esc_html__('Czech Republic', 'give'), |
|
181 | + 'DK' => esc_html__('Denmark', 'give'), |
|
182 | + 'DJ' => esc_html__('Djibouti', 'give'), |
|
183 | + 'DM' => esc_html__('Dominica', 'give'), |
|
184 | + 'DO' => esc_html__('Dominican Republic', 'give'), |
|
185 | + 'TP' => esc_html__('East Timor', 'give'), |
|
186 | + 'EC' => esc_html__('Ecuador', 'give'), |
|
187 | + 'EG' => esc_html__('Egypt', 'give'), |
|
188 | + 'GQ' => esc_html__('Equatorial Guinea', 'give'), |
|
189 | + 'SV' => esc_html__('El Salvador', 'give'), |
|
190 | + 'ER' => esc_html__('Eritrea', 'give'), |
|
191 | + 'EE' => esc_html__('Estonia', 'give'), |
|
192 | + 'ET' => esc_html__('Ethiopia', 'give'), |
|
193 | + 'FK' => esc_html__('Falkland Islands', 'give'), |
|
194 | + 'FO' => esc_html__('Faroe Islands', 'give'), |
|
195 | + 'FJ' => esc_html__('Fiji', 'give'), |
|
196 | + 'FI' => esc_html__('Finland', 'give'), |
|
197 | + 'FR' => esc_html__('France', 'give'), |
|
198 | + 'GF' => esc_html__('French Guiana', 'give'), |
|
199 | + 'PF' => esc_html__('French Polynesia', 'give'), |
|
200 | + 'TF' => esc_html__('French Southern Territories', 'give'), |
|
201 | + 'GA' => esc_html__('Gabon', 'give'), |
|
202 | + 'GM' => esc_html__('Gambia', 'give'), |
|
203 | + 'GE' => esc_html__('Georgia', 'give'), |
|
204 | + 'DE' => esc_html__('Germany', 'give'), |
|
205 | + 'GR' => esc_html__('Greece', 'give'), |
|
206 | + 'GH' => esc_html__('Ghana', 'give'), |
|
207 | + 'GI' => esc_html__('Gibraltar', 'give'), |
|
208 | + 'GL' => esc_html__('Greenland', 'give'), |
|
209 | + 'GD' => esc_html__('Grenada', 'give'), |
|
210 | + 'GP' => esc_html__('Guadeloupe', 'give'), |
|
211 | + 'GU' => esc_html__('Guam', 'give'), |
|
212 | + 'GT' => esc_html__('Guatemala', 'give'), |
|
213 | + 'GG' => esc_html__('Guernsey', 'give'), |
|
214 | + 'GN' => esc_html__('Guinea', 'give'), |
|
215 | + 'GW' => esc_html__('Guinea-Bissau', 'give'), |
|
216 | + 'GY' => esc_html__('Guyana', 'give'), |
|
217 | + 'HT' => esc_html__('Haiti', 'give'), |
|
218 | + 'HM' => esc_html__('Heard and McDonald Islands', 'give'), |
|
219 | + 'VA' => esc_html__('Holy See (City Vatican State)', 'give'), |
|
220 | + 'HN' => esc_html__('Honduras', 'give'), |
|
221 | + 'HK' => esc_html__('Hong Kong', 'give'), |
|
222 | + 'HU' => esc_html__('Hungary', 'give'), |
|
223 | + 'IS' => esc_html__('Iceland', 'give'), |
|
224 | + 'IN' => esc_html__('India', 'give'), |
|
225 | + 'ID' => esc_html__('Indonesia', 'give'), |
|
226 | + 'IR' => esc_html__('Iran', 'give'), |
|
227 | + 'IQ' => esc_html__('Iraq', 'give'), |
|
228 | + 'IE' => esc_html__('Ireland', 'give'), |
|
229 | + 'IM' => esc_html__('Isle of Man', 'give'), |
|
230 | + 'IL' => esc_html__('Israel', 'give'), |
|
231 | + 'IT' => esc_html__('Italy', 'give'), |
|
232 | + 'JM' => esc_html__('Jamaica', 'give'), |
|
233 | + 'JP' => esc_html__('Japan', 'give'), |
|
234 | + 'JE' => esc_html__('Jersey', 'give'), |
|
235 | + 'JO' => esc_html__('Jordan', 'give'), |
|
236 | + 'KZ' => esc_html__('Kazakhstan', 'give'), |
|
237 | + 'KE' => esc_html__('Kenya', 'give'), |
|
238 | + 'KI' => esc_html__('Kiribati', 'give'), |
|
239 | + 'KW' => esc_html__('Kuwait', 'give'), |
|
240 | + 'KG' => esc_html__('Kyrgyzstan', 'give'), |
|
241 | + 'LA' => esc_html__('Lao People\'s Democratic Republic', 'give'), |
|
242 | + 'LV' => esc_html__('Latvia', 'give'), |
|
243 | + 'LB' => esc_html__('Lebanon', 'give'), |
|
244 | + 'LS' => esc_html__('Lesotho', 'give'), |
|
245 | + 'LR' => esc_html__('Liberia', 'give'), |
|
246 | + 'LY' => esc_html__('Libyan Arab Jamahiriya', 'give'), |
|
247 | + 'LI' => esc_html__('Liechtenstein', 'give'), |
|
248 | + 'LT' => esc_html__('Lithuania', 'give'), |
|
249 | + 'LU' => esc_html__('Luxembourg', 'give'), |
|
250 | + 'MO' => esc_html__('Macau', 'give'), |
|
251 | + 'MK' => esc_html__('Macedonia', 'give'), |
|
252 | + 'MG' => esc_html__('Madagascar', 'give'), |
|
253 | + 'MW' => esc_html__('Malawi', 'give'), |
|
254 | + 'MY' => esc_html__('Malaysia', 'give'), |
|
255 | + 'MV' => esc_html__('Maldives', 'give'), |
|
256 | + 'ML' => esc_html__('Mali', 'give'), |
|
257 | + 'MT' => esc_html__('Malta', 'give'), |
|
258 | + 'MH' => esc_html__('Marshall Islands', 'give'), |
|
259 | + 'MQ' => esc_html__('Martinique', 'give'), |
|
260 | + 'MR' => esc_html__('Mauritania', 'give'), |
|
261 | + 'MU' => esc_html__('Mauritius', 'give'), |
|
262 | + 'YT' => esc_html__('Mayotte', 'give'), |
|
263 | + 'MX' => esc_html__('Mexico', 'give'), |
|
264 | + 'FM' => esc_html__('Micronesia', 'give'), |
|
265 | + 'MD' => esc_html__('Moldova, Republic of', 'give'), |
|
266 | + 'MC' => esc_html__('Monaco', 'give'), |
|
267 | + 'MN' => esc_html__('Mongolia', 'give'), |
|
268 | + 'ME' => esc_html__('Montenegro', 'give'), |
|
269 | + 'MS' => esc_html__('Montserrat', 'give'), |
|
270 | + 'MA' => esc_html__('Morocco', 'give'), |
|
271 | + 'MZ' => esc_html__('Mozambique', 'give'), |
|
272 | + 'MM' => esc_html__('Myanmar', 'give'), |
|
273 | + 'NA' => esc_html__('Namibia', 'give'), |
|
274 | + 'NR' => esc_html__('Nauru', 'give'), |
|
275 | + 'NP' => esc_html__('Nepal', 'give'), |
|
276 | + 'NL' => esc_html__('Netherlands', 'give'), |
|
277 | + 'AN' => esc_html__('Netherlands Antilles', 'give'), |
|
278 | + 'NC' => esc_html__('New Caledonia', 'give'), |
|
279 | + 'NZ' => esc_html__('New Zealand', 'give'), |
|
280 | + 'NI' => esc_html__('Nicaragua', 'give'), |
|
281 | + 'NE' => esc_html__('Niger', 'give'), |
|
282 | + 'NG' => esc_html__('Nigeria', 'give'), |
|
283 | + 'NU' => esc_html__('Niue', 'give'), |
|
284 | + 'NF' => esc_html__('Norfolk Island', 'give'), |
|
285 | + 'KP' => esc_html__('North Korea', 'give'), |
|
286 | + 'MP' => esc_html__('Northern Mariana Islands', 'give'), |
|
287 | + 'NO' => esc_html__('Norway', 'give'), |
|
288 | + 'OM' => esc_html__('Oman', 'give'), |
|
289 | + 'PK' => esc_html__('Pakistan', 'give'), |
|
290 | + 'PW' => esc_html__('Palau', 'give'), |
|
291 | + 'PS' => esc_html__('Palestinian Territories', 'give'), |
|
292 | + 'PA' => esc_html__('Panama', 'give'), |
|
293 | + 'PG' => esc_html__('Papua New Guinea', 'give'), |
|
294 | + 'PY' => esc_html__('Paraguay', 'give'), |
|
295 | + 'PE' => esc_html__('Peru', 'give'), |
|
296 | + 'PH' => esc_html__('Phillipines', 'give'), |
|
297 | + 'PN' => esc_html__('Pitcairn Island', 'give'), |
|
298 | + 'PL' => esc_html__('Poland', 'give'), |
|
299 | + 'PT' => esc_html__('Portugal', 'give'), |
|
300 | + 'PR' => esc_html__('Puerto Rico', 'give'), |
|
301 | + 'QA' => esc_html__('Qatar', 'give'), |
|
302 | + 'RE' => esc_html__('Reunion Island', 'give'), |
|
303 | + 'RO' => esc_html__('Romania', 'give'), |
|
304 | + 'RU' => esc_html__('Russian Federation', 'give'), |
|
305 | + 'RW' => esc_html__('Rwanda', 'give'), |
|
306 | + 'SH' => esc_html__('Saint Helena', 'give'), |
|
307 | + 'KN' => esc_html__('Saint Kitts and Nevis', 'give'), |
|
308 | + 'LC' => esc_html__('Saint Lucia', 'give'), |
|
309 | + 'PM' => esc_html__('Saint Pierre and Miquelon', 'give'), |
|
310 | + 'VC' => esc_html__('Saint Vincent and the Grenadines', 'give'), |
|
311 | + 'SM' => esc_html__('San Marino', 'give'), |
|
312 | + 'ST' => esc_html__('Sao Tome and Principe', 'give'), |
|
313 | + 'SA' => esc_html__('Saudi Arabia', 'give'), |
|
314 | + 'SN' => esc_html__('Senegal', 'give'), |
|
315 | + 'RS' => esc_html__('Serbia', 'give'), |
|
316 | + 'SC' => esc_html__('Seychelles', 'give'), |
|
317 | + 'SL' => esc_html__('Sierra Leone', 'give'), |
|
318 | + 'SG' => esc_html__('Singapore', 'give'), |
|
319 | + 'SK' => esc_html__('Slovak Republic', 'give'), |
|
320 | + 'SI' => esc_html__('Slovenia', 'give'), |
|
321 | + 'SB' => esc_html__('Solomon Islands', 'give'), |
|
322 | + 'SO' => esc_html__('Somalia', 'give'), |
|
323 | + 'ZA' => esc_html__('South Africa', 'give'), |
|
324 | + 'GS' => esc_html__('South Georgia', 'give'), |
|
325 | + 'KR' => esc_html__('South Korea', 'give'), |
|
326 | + 'ES' => esc_html__('Spain', 'give'), |
|
327 | + 'LK' => esc_html__('Sri Lanka', 'give'), |
|
328 | + 'SD' => esc_html__('Sudan', 'give'), |
|
329 | + 'SR' => esc_html__('Suriname', 'give'), |
|
330 | + 'SJ' => esc_html__('Svalbard and Jan Mayen Islands', 'give'), |
|
331 | + 'SZ' => esc_html__('Swaziland', 'give'), |
|
332 | + 'SE' => esc_html__('Sweden', 'give'), |
|
333 | + 'CH' => esc_html__('Switzerland', 'give'), |
|
334 | + 'SY' => esc_html__('Syrian Arab Republic', 'give'), |
|
335 | + 'TW' => esc_html__('Taiwan', 'give'), |
|
336 | + 'TJ' => esc_html__('Tajikistan', 'give'), |
|
337 | + 'TZ' => esc_html__('Tanzania', 'give'), |
|
338 | + 'TG' => esc_html__('Togo', 'give'), |
|
339 | + 'TK' => esc_html__('Tokelau', 'give'), |
|
340 | + 'TO' => esc_html__('Tonga', 'give'), |
|
341 | + 'TH' => esc_html__('Thailand', 'give'), |
|
342 | + 'TT' => esc_html__('Trinidad and Tobago', 'give'), |
|
343 | + 'TN' => esc_html__('Tunisia', 'give'), |
|
344 | + 'TR' => esc_html__('Turkey', 'give'), |
|
345 | + 'TM' => esc_html__('Turkmenistan', 'give'), |
|
346 | + 'TC' => esc_html__('Turks and Caicos Islands', 'give'), |
|
347 | + 'TV' => esc_html__('Tuvalu', 'give'), |
|
348 | + 'UG' => esc_html__('Uganda', 'give'), |
|
349 | + 'UA' => esc_html__('Ukraine', 'give'), |
|
350 | + 'AE' => esc_html__('United Arab Emirates', 'give'), |
|
351 | + 'UY' => esc_html__('Uruguay', 'give'), |
|
352 | + 'UM' => esc_html__('US Minor Outlying Islands', 'give'), |
|
353 | + 'UZ' => esc_html__('Uzbekistan', 'give'), |
|
354 | + 'VU' => esc_html__('Vanuatu', 'give'), |
|
355 | + 'VE' => esc_html__('Venezuela', 'give'), |
|
356 | + 'VN' => esc_html__('Vietnam', 'give'), |
|
357 | + 'VG' => esc_html__('Virgin Islands (British)', 'give'), |
|
358 | + 'VI' => esc_html__('Virgin Islands (USA)', 'give'), |
|
359 | + 'WF' => esc_html__('Wallis and Futuna Islands', 'give'), |
|
360 | + 'EH' => esc_html__('Western Sahara', 'give'), |
|
361 | + 'WS' => esc_html__('Western Samoa', 'give'), |
|
362 | + 'YE' => esc_html__('Yemen', 'give'), |
|
363 | + 'YU' => esc_html__('Yugoslavia', 'give'), |
|
364 | + 'ZM' => esc_html__('Zambia', 'give'), |
|
365 | + 'ZW' => esc_html__('Zimbabwe', 'give') |
|
366 | 366 | ); |
367 | 367 | |
368 | - return apply_filters( 'give_countries', $countries ); |
|
368 | + return apply_filters('give_countries', $countries); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | 'AP' => 'Armed Forces - Pacific' |
447 | 447 | ); |
448 | 448 | |
449 | - return apply_filters( 'give_us_states', $states ); |
|
449 | + return apply_filters('give_us_states', $states); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -459,22 +459,22 @@ discard block |
||
459 | 459 | function give_get_provinces_list() { |
460 | 460 | $provinces = array( |
461 | 461 | '' => '', |
462 | - 'AB' => esc_html__('Alberta', 'give' ), |
|
463 | - 'BC' => esc_html__('British Columbia', 'give' ), |
|
464 | - 'MB' => esc_html__('Manitoba', 'give' ), |
|
465 | - 'NB' => esc_html__('New Brunswick', 'give' ), |
|
466 | - 'NL' => esc_html__('Newfoundland and Labrador', 'give' ), |
|
467 | - 'NS' => esc_html__('Nova Scotia', 'give' ), |
|
468 | - 'NT' => esc_html__('Northwest Territories', 'give' ), |
|
469 | - 'NU' => esc_html__('Nunavut', 'give' ), |
|
470 | - 'ON' => esc_html__('Ontario', 'give' ), |
|
471 | - 'PE' => esc_html__('Prince Edward Island', 'give' ), |
|
472 | - 'QC' => esc_html__('Quebec', 'give' ), |
|
473 | - 'SK' => esc_html__('Saskatchewan', 'give' ), |
|
474 | - 'YT' => esc_html__('Yukon', 'give' ) |
|
462 | + 'AB' => esc_html__('Alberta', 'give'), |
|
463 | + 'BC' => esc_html__('British Columbia', 'give'), |
|
464 | + 'MB' => esc_html__('Manitoba', 'give'), |
|
465 | + 'NB' => esc_html__('New Brunswick', 'give'), |
|
466 | + 'NL' => esc_html__('Newfoundland and Labrador', 'give'), |
|
467 | + 'NS' => esc_html__('Nova Scotia', 'give'), |
|
468 | + 'NT' => esc_html__('Northwest Territories', 'give'), |
|
469 | + 'NU' => esc_html__('Nunavut', 'give'), |
|
470 | + 'ON' => esc_html__('Ontario', 'give'), |
|
471 | + 'PE' => esc_html__('Prince Edward Island', 'give'), |
|
472 | + 'QC' => esc_html__('Quebec', 'give'), |
|
473 | + 'SK' => esc_html__('Saskatchewan', 'give'), |
|
474 | + 'YT' => esc_html__('Yukon', 'give') |
|
475 | 475 | ); |
476 | 476 | |
477 | - return apply_filters( 'give_canada_provinces', $provinces ); |
|
477 | + return apply_filters('give_canada_provinces', $provinces); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | 'WA' => 'Western Australia' |
497 | 497 | ); |
498 | 498 | |
499 | - return apply_filters( 'give_australian_states', $states ); |
|
499 | + return apply_filters('give_australian_states', $states); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | 'TO' => 'Tocantins' |
538 | 538 | ); |
539 | 539 | |
540 | - return apply_filters( 'give_brazil_states', $states ); |
|
540 | + return apply_filters('give_brazil_states', $states); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | 'NEW TERRITORIES' => 'New Territories' |
555 | 555 | ); |
556 | 556 | |
557 | - return apply_filters( 'give_hong_kong_states', $states ); |
|
557 | + return apply_filters('give_hong_kong_states', $states); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | 'ZA' => 'Zala' |
589 | 589 | ); |
590 | 590 | |
591 | - return apply_filters( 'give_hungary_states', $states ); |
|
591 | + return apply_filters('give_hungary_states', $states); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | 'CN32' => 'Xinjiang / 新疆' |
635 | 635 | ); |
636 | 636 | |
637 | - return apply_filters( 'give_chinese_states', $states ); |
|
637 | + return apply_filters('give_chinese_states', $states); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | /** |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | 'WC' => 'West Coast' |
664 | 664 | ); |
665 | 665 | |
666 | - return apply_filters( 'give_new_zealand_states', $states ); |
|
666 | + return apply_filters('give_new_zealand_states', $states); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | 'PB' => 'Papua Barat' |
712 | 712 | ); |
713 | 713 | |
714 | - return apply_filters( 'give_indonesia_states', $states ); |
|
714 | + return apply_filters('give_indonesia_states', $states); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | 'PY' => 'Pondicherry (Puducherry)' |
762 | 762 | ); |
763 | 763 | |
764 | - return apply_filters( 'give_indian_states', $states ); |
|
764 | + return apply_filters('give_indian_states', $states); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | 'PJY' => 'W.P. Putrajaya' |
792 | 792 | ); |
793 | 793 | |
794 | - return apply_filters( 'give_malaysian_states', $states ); |
|
794 | + return apply_filters('give_malaysian_states', $states); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | 'WC' => 'Western Cape' |
815 | 815 | ); |
816 | 816 | |
817 | - return apply_filters( 'give_south_african_states', $states ); |
|
817 | + return apply_filters('give_south_african_states', $states); |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | /** |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | 'TH-35' => 'Yasothon (ยโสธร)' |
906 | 906 | ); |
907 | 907 | |
908 | - return apply_filters( 'give_thailand_states', $states ); |
|
908 | + return apply_filters('give_thailand_states', $states); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -917,59 +917,59 @@ discard block |
||
917 | 917 | function give_get_spain_states_list() { |
918 | 918 | $states = array( |
919 | 919 | '' => '', |
920 | - 'C' => esc_html__( 'A Coruña', 'give' ), |
|
921 | - 'VI' => esc_html__( 'Álava', 'give' ), |
|
922 | - 'AB' => esc_html__( 'Albacete', 'give' ), |
|
923 | - 'A' => esc_html__( 'Alicante', 'give' ), |
|
924 | - 'AL' => esc_html__( 'Almería', 'give' ), |
|
925 | - 'O' => esc_html__( 'Asturias', 'give' ), |
|
926 | - 'AV' => esc_html__( 'Ávila', 'give' ), |
|
927 | - 'BA' => esc_html__( 'Badajoz', 'give' ), |
|
928 | - 'PM' => esc_html__( 'Baleares', 'give' ), |
|
929 | - 'B' => esc_html__( 'Barcelona', 'give' ), |
|
930 | - 'BU' => esc_html__( 'Burgos', 'give' ), |
|
931 | - 'CC' => esc_html__( 'Cáceres', 'give' ), |
|
932 | - 'CA' => esc_html__( 'Cádiz', 'give' ), |
|
933 | - 'S' => esc_html__( 'Cantabria', 'give' ), |
|
934 | - 'CS' => esc_html__( 'Castellón', 'give' ), |
|
935 | - 'CE' => esc_html__( 'Ceuta', 'give' ), |
|
936 | - 'CR' => esc_html__( 'Ciudad Real', 'give' ), |
|
937 | - 'CO' => esc_html__( 'Córdoba', 'give' ), |
|
938 | - 'CU' => esc_html__( 'Cuenca', 'give' ), |
|
939 | - 'GI' => esc_html__( 'Girona', 'give' ), |
|
940 | - 'GR' => esc_html__( 'Granada', 'give' ), |
|
941 | - 'GU' => esc_html__( 'Guadalajara', 'give' ), |
|
942 | - 'SS' => esc_html__( 'Gipuzkoa', 'give' ), |
|
943 | - 'H' => esc_html__( 'Huelva', 'give' ), |
|
944 | - 'HU' => esc_html__( 'Huesca', 'give' ), |
|
945 | - 'J' => esc_html__( 'Jaén', 'give' ), |
|
946 | - 'LO' => esc_html__( 'La Rioja', 'give' ), |
|
947 | - 'GC' => esc_html__( 'Las Palmas', 'give' ), |
|
948 | - 'LE' => esc_html__( 'León', 'give' ), |
|
949 | - 'L' => esc_html__( 'Lleida', 'give' ), |
|
950 | - 'LU' => esc_html__( 'Lugo', 'give' ), |
|
951 | - 'M' => esc_html__( 'Madrid', 'give' ), |
|
952 | - 'MA' => esc_html__( 'Málaga', 'give' ), |
|
953 | - 'ML' => esc_html__( 'Melilla', 'give' ), |
|
954 | - 'MU' => esc_html__( 'Murcia', 'give' ), |
|
955 | - 'NA' => esc_html__( 'Navarra', 'give' ), |
|
956 | - 'OR' => esc_html__( 'Ourense', 'give' ), |
|
957 | - 'P' => esc_html__( 'Palencia', 'give' ), |
|
958 | - 'PO' => esc_html__( 'Pontevedra', 'give' ), |
|
959 | - 'SA' => esc_html__( 'Salamanca', 'give' ), |
|
960 | - 'TF' => esc_html__( 'Santa Cruz de Tenerife', 'give' ), |
|
961 | - 'SG' => esc_html__( 'Segovia', 'give' ), |
|
962 | - 'SE' => esc_html__( 'Sevilla', 'give' ), |
|
963 | - 'SO' => esc_html__( 'Soria', 'give' ), |
|
964 | - 'T' => esc_html__( 'Tarragona', 'give' ), |
|
965 | - 'TE' => esc_html__( 'Teruel', 'give' ), |
|
966 | - 'TO' => esc_html__( 'Toledo', 'give' ), |
|
967 | - 'V' => esc_html__( 'Valencia', 'give' ), |
|
968 | - 'VA' => esc_html__( 'Valladolid', 'give' ), |
|
969 | - 'BI' => esc_html__( 'Bizkaia', 'give' ), |
|
970 | - 'ZA' => esc_html__( 'Zamora', 'give' ), |
|
971 | - 'Z' => esc_html__( 'Zaragoza', 'give' ) |
|
920 | + 'C' => esc_html__('A Coruña', 'give'), |
|
921 | + 'VI' => esc_html__('Álava', 'give'), |
|
922 | + 'AB' => esc_html__('Albacete', 'give'), |
|
923 | + 'A' => esc_html__('Alicante', 'give'), |
|
924 | + 'AL' => esc_html__('Almería', 'give'), |
|
925 | + 'O' => esc_html__('Asturias', 'give'), |
|
926 | + 'AV' => esc_html__('Ávila', 'give'), |
|
927 | + 'BA' => esc_html__('Badajoz', 'give'), |
|
928 | + 'PM' => esc_html__('Baleares', 'give'), |
|
929 | + 'B' => esc_html__('Barcelona', 'give'), |
|
930 | + 'BU' => esc_html__('Burgos', 'give'), |
|
931 | + 'CC' => esc_html__('Cáceres', 'give'), |
|
932 | + 'CA' => esc_html__('Cádiz', 'give'), |
|
933 | + 'S' => esc_html__('Cantabria', 'give'), |
|
934 | + 'CS' => esc_html__('Castellón', 'give'), |
|
935 | + 'CE' => esc_html__('Ceuta', 'give'), |
|
936 | + 'CR' => esc_html__('Ciudad Real', 'give'), |
|
937 | + 'CO' => esc_html__('Córdoba', 'give'), |
|
938 | + 'CU' => esc_html__('Cuenca', 'give'), |
|
939 | + 'GI' => esc_html__('Girona', 'give'), |
|
940 | + 'GR' => esc_html__('Granada', 'give'), |
|
941 | + 'GU' => esc_html__('Guadalajara', 'give'), |
|
942 | + 'SS' => esc_html__('Gipuzkoa', 'give'), |
|
943 | + 'H' => esc_html__('Huelva', 'give'), |
|
944 | + 'HU' => esc_html__('Huesca', 'give'), |
|
945 | + 'J' => esc_html__('Jaén', 'give'), |
|
946 | + 'LO' => esc_html__('La Rioja', 'give'), |
|
947 | + 'GC' => esc_html__('Las Palmas', 'give'), |
|
948 | + 'LE' => esc_html__('León', 'give'), |
|
949 | + 'L' => esc_html__('Lleida', 'give'), |
|
950 | + 'LU' => esc_html__('Lugo', 'give'), |
|
951 | + 'M' => esc_html__('Madrid', 'give'), |
|
952 | + 'MA' => esc_html__('Málaga', 'give'), |
|
953 | + 'ML' => esc_html__('Melilla', 'give'), |
|
954 | + 'MU' => esc_html__('Murcia', 'give'), |
|
955 | + 'NA' => esc_html__('Navarra', 'give'), |
|
956 | + 'OR' => esc_html__('Ourense', 'give'), |
|
957 | + 'P' => esc_html__('Palencia', 'give'), |
|
958 | + 'PO' => esc_html__('Pontevedra', 'give'), |
|
959 | + 'SA' => esc_html__('Salamanca', 'give'), |
|
960 | + 'TF' => esc_html__('Santa Cruz de Tenerife', 'give'), |
|
961 | + 'SG' => esc_html__('Segovia', 'give'), |
|
962 | + 'SE' => esc_html__('Sevilla', 'give'), |
|
963 | + 'SO' => esc_html__('Soria', 'give'), |
|
964 | + 'T' => esc_html__('Tarragona', 'give'), |
|
965 | + 'TE' => esc_html__('Teruel', 'give'), |
|
966 | + 'TO' => esc_html__('Toledo', 'give'), |
|
967 | + 'V' => esc_html__('Valencia', 'give'), |
|
968 | + 'VA' => esc_html__('Valladolid', 'give'), |
|
969 | + 'BI' => esc_html__('Bizkaia', 'give'), |
|
970 | + 'ZA' => esc_html__('Zamora', 'give'), |
|
971 | + 'Z' => esc_html__('Zaragoza', 'give') |
|
972 | 972 | ); |
973 | 973 | |
974 | - return apply_filters( 'give_spain_states', $states ); |
|
974 | + return apply_filters('give_spain_states', $states); |
|
975 | 975 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | */ |
5 | 5 | $give_map_deprecated_actions = give_deprecated_actions(); |
6 | 6 | |
7 | -foreach ( $give_map_deprecated_actions as $new => $old ) { |
|
8 | - add_action( $new, 'give_deprecated_action_mapping', 10, 4 ); |
|
7 | +foreach ($give_map_deprecated_actions as $new => $old) { |
|
8 | + add_action($new, 'give_deprecated_action_mapping', 10, 4); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | /** |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return mixed|void |
61 | 61 | */ |
62 | -function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
62 | +function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
63 | 63 | $give_map_deprecated_actions = give_deprecated_actions(); |
64 | 64 | $action = current_filter(); |
65 | 65 | |
66 | - if ( isset( $give_map_deprecated_actions[ $action ] ) ) { |
|
67 | - if ( has_action( $give_map_deprecated_actions[ $action ] ) ) { |
|
68 | - do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 ); |
|
66 | + if (isset($give_map_deprecated_actions[$action])) { |
|
67 | + if (has_action($give_map_deprecated_actions[$action])) { |
|
68 | + do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3); |
|
69 | 69 | |
70 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
70 | + if ( ! defined('DOING_AJAX')) { |
|
71 | 71 | // translators: %s: action name. |
72 | 72 | _give_deprecated_function( |
73 | 73 | sprintf( |
74 | - __( 'The %s action' ), |
|
75 | - $give_map_deprecated_actions[ $action ] |
|
74 | + __('The %s action'), |
|
75 | + $give_map_deprecated_actions[$action] |
|
76 | 76 | ), |
77 | 77 | '1.7', |
78 | 78 | $action |
@@ -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,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a receipt while editing a donation. |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email. |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 ); |
|
36 | +add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Resend the Email Donation Receipt. (This can be done from the Donation History Page) |
@@ -44,29 +44,29 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -function give_resend_donation_receipt( $data ) { |
|
47 | +function give_resend_donation_receipt($data) { |
|
48 | 48 | |
49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
49 | + $purchase_id = absint($data['purchase_id']); |
|
50 | 50 | |
51 | - if ( empty( $purchase_id ) ) { |
|
51 | + if (empty($purchase_id)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
56 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
56 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
57 | 57 | } |
58 | 58 | |
59 | - give_email_donation_receipt( $purchase_id, false ); |
|
59 | + give_email_donation_receipt($purchase_id, false); |
|
60 | 60 | |
61 | - wp_redirect( add_query_arg( array( |
|
61 | + wp_redirect(add_query_arg(array( |
|
62 | 62 | 'give-message' => 'email_sent', |
63 | 63 | 'give-action' => false, |
64 | 64 | 'purchase_id' => false |
65 | - ) ) ); |
|
65 | + ))); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
80 | -function give_send_test_email( $data ) { |
|
81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
80 | +function give_send_test_email($data) { |
|
81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | give_email_test_donation_receipt(); |
87 | 87 | |
88 | 88 | // Remove the test email query arg. |
89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
89 | + wp_redirect(remove_query_arg('give_action')); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
93 | +add_action('give_send_test_email', 'give_send_test_email'); |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | * |
88 | - * @param $setting_tab |
|
88 | + * @param string $setting_tab |
|
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) : |
|
12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * This class loads the cmb2 settings. |
@@ -52,30 +52,30 @@ discard block |
||
52 | 52 | |
53 | 53 | // Get current tab. |
54 | 54 | $this->current_tab = give_get_current_setting_tab(); |
55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] ); |
|
55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']); |
|
56 | 56 | |
57 | 57 | // Tab ID. |
58 | 58 | $this->id = $this->current_tab; |
59 | 59 | |
60 | 60 | // Add addon tabs. |
61 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 ); |
|
61 | + add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); |
|
62 | 62 | |
63 | 63 | // Add save hook to addons. |
64 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 ); |
|
64 | + add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); |
|
65 | 65 | |
66 | 66 | // Add backward compatibility filters plugin settings. |
67 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' ); |
|
67 | + $setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); |
|
68 | 68 | |
69 | 69 | // Filter Payment Gateways settings. |
70 | - if ( in_array( $this->current_tab, $setting_tabs ) ) { |
|
71 | - add_filter( "give_get_settings_{$this->current_tab}", array( |
|
70 | + if (in_array($this->current_tab, $setting_tabs)) { |
|
71 | + add_filter("give_get_settings_{$this->current_tab}", array( |
|
72 | 72 | $this, |
73 | 73 | 'get_filtered_addon_settings', |
74 | - ), 999999, 1 ); |
|
75 | - add_filter( "give_get_sections_{$this->current_tab}", array( |
|
74 | + ), 999999, 1); |
|
75 | + add_filter("give_get_sections_{$this->current_tab}", array( |
|
76 | 76 | $this, |
77 | 77 | 'get_filtered_addon_sections', |
78 | - ), 999999, 1 ); |
|
78 | + ), 999999, 1); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - function set_default_setting_tab( $setting_tab ) { |
|
91 | + function set_default_setting_tab($setting_tab) { |
|
92 | 92 | $default_tab = ''; |
93 | 93 | |
94 | 94 | // Set default tab to first setting tab. |
95 | - if ( $sections = array_keys( $this->get_sections() ) ) { |
|
96 | - $default_tab = current( $sections ); |
|
95 | + if ($sections = array_keys($this->get_sections())) { |
|
96 | + $default_tab = current($sections); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $default_tab; |
@@ -108,29 +108,29 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return mixed |
110 | 110 | */ |
111 | - function add_addon_settings_page( $pages ) { |
|
111 | + function add_addon_settings_page($pages) { |
|
112 | 112 | // Previous setting page. |
113 | 113 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
114 | 114 | |
115 | 115 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
116 | - unset( $previous_pages['api'] ); |
|
117 | - unset( $previous_pages['system_info'] ); |
|
116 | + unset($previous_pages['api']); |
|
117 | + unset($previous_pages['system_info']); |
|
118 | 118 | |
119 | 119 | // Tab is not register. |
120 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) ); |
|
120 | + $pages_diff = array_keys(array_diff($previous_pages, $pages)); |
|
121 | 121 | |
122 | 122 | // Merge old settings with new settings. |
123 | - $pages = array_merge( $pages, $previous_pages ); |
|
123 | + $pages = array_merge($pages, $previous_pages); |
|
124 | 124 | |
125 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
125 | + if (in_array($this->current_tab, $pages_diff)) { |
|
126 | 126 | // Filter & actions. |
127 | - add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( |
|
127 | + add_filter("give_default_setting_tab_section_{$this->current_tab}", array( |
|
128 | 128 | $this, |
129 | 129 | 'set_default_setting_tab', |
130 | - ), 10 ); |
|
131 | - add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); |
|
132 | - add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); |
|
133 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
130 | + ), 10); |
|
131 | + add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); |
|
132 | + add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); |
|
133 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $pages; |
@@ -146,29 +146,29 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return mixed |
148 | 148 | */ |
149 | - function setup_addon_save_hook( $pages ) { |
|
149 | + function setup_addon_save_hook($pages) { |
|
150 | 150 | $page_ids = array(); |
151 | 151 | |
152 | - foreach ( $pages as $page ) { |
|
153 | - $page_ids = $page->add_settings_page( $page_ids ); |
|
152 | + foreach ($pages as $page) { |
|
153 | + $page_ids = $page->add_settings_page($page_ids); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Previous setting page. |
157 | 157 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
158 | 158 | |
159 | 159 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
160 | - unset( $previous_pages['api'] ); |
|
161 | - unset( $previous_pages['system_info'] ); |
|
160 | + unset($previous_pages['api']); |
|
161 | + unset($previous_pages['system_info']); |
|
162 | 162 | |
163 | 163 | // Tab is not register. |
164 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) ); |
|
164 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids)); |
|
165 | 165 | |
166 | 166 | // Merge old settings with new settings. |
167 | - $pages = array_merge( $page_ids, $previous_pages ); |
|
167 | + $pages = array_merge($page_ids, $previous_pages); |
|
168 | 168 | |
169 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
169 | + if (in_array($this->current_tab, $pages_diff)) { |
|
170 | 170 | // Filter & actions. |
171 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
171 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $pages; |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - function get_section_name( $field_name ) { |
|
186 | + function get_section_name($field_name) { |
|
187 | 187 | // Bailout. |
188 | - if ( empty( $field_name ) ) { |
|
188 | + if (empty($field_name)) { |
|
189 | 189 | return $field_name; |
190 | 190 | } |
191 | 191 | |
192 | - $section_name = explode( ' ', $field_name ); |
|
192 | + $section_name = explode(' ', $field_name); |
|
193 | 193 | |
194 | 194 | // Output. |
195 | - return strip_tags( implode( ' ', $section_name ) ); |
|
195 | + return strip_tags(implode(' ', $section_name)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function en_translation( $translation, $text ) { |
|
210 | + public function en_translation($translation, $text) { |
|
211 | 211 | return $text; |
212 | 212 | } |
213 | 213 | |
@@ -221,52 +221,52 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return mixed |
223 | 223 | */ |
224 | - function get_filtered_addon_sections( $sections = array() ) { |
|
224 | + function get_filtered_addon_sections($sections = array()) { |
|
225 | 225 | // New sections. |
226 | 226 | $new_sections = array(); |
227 | - $sections_ID = array_keys( $sections ); |
|
228 | - $setting_fields = $this->prev_settings->give_settings( $this->current_tab ); |
|
227 | + $sections_ID = array_keys($sections); |
|
228 | + $setting_fields = $this->prev_settings->give_settings($this->current_tab); |
|
229 | 229 | |
230 | 230 | // We need untranslated settings for backward compatibility. |
231 | - add_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 ); |
|
232 | - $en_setting_fields = $this->prev_settings->give_settings( $this->current_tab ); |
|
233 | - remove_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 ); |
|
231 | + add_filter('gettext', array($this, 'en_translation'), 10, 2); |
|
232 | + $en_setting_fields = $this->prev_settings->give_settings($this->current_tab); |
|
233 | + remove_filter('gettext', array($this, 'en_translation'), 10, 2); |
|
234 | 234 | |
235 | - if ( ! empty( $setting_fields ) && ! empty( $setting_fields['fields'] ) ) { |
|
235 | + if ( ! empty($setting_fields) && ! empty($setting_fields['fields'])) { |
|
236 | 236 | |
237 | - foreach ( $setting_fields['fields'] as $index => $field ) { |
|
237 | + foreach ($setting_fields['fields'] as $index => $field) { |
|
238 | 238 | // Collect new sections from addons. |
239 | - if ( 'give_title' !== $field['type'] ) { |
|
239 | + if ('give_title' !== $field['type']) { |
|
240 | 240 | continue; |
241 | 241 | } |
242 | 242 | |
243 | 243 | // Untranslated setting name. |
244 | - $en_setting_field_name = isset( $en_setting_fields['fields'][ $index ]['name'] ) ? $en_setting_fields['fields'][ $index ]['name'] : ''; |
|
244 | + $en_setting_field_name = isset($en_setting_fields['fields'][$index]['name']) ? $en_setting_fields['fields'][$index]['name'] : ''; |
|
245 | 245 | |
246 | 246 | // Section name. |
247 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : ''; |
|
248 | - $section_name = $this->get_section_name( $field['name'] ); |
|
247 | + $field['name'] = isset($field['name']) ? $field['name'] : ''; |
|
248 | + $section_name = $this->get_section_name($field['name']); |
|
249 | 249 | |
250 | 250 | // Check if section name exit and section title array is not empty. |
251 | - if ( ! empty( $sections ) && ! empty( $en_setting_field_name ) ) { |
|
251 | + if ( ! empty($sections) && ! empty($en_setting_field_name)) { |
|
252 | 252 | |
253 | 253 | // Bailout: Do not load section if it is already exist. |
254 | 254 | if ( |
255 | - in_array( sanitize_title( $en_setting_field_name ), $sections_ID ) // Check section id. |
|
256 | - || in_array( $section_name, $sections ) // Check section name. |
|
255 | + in_array(sanitize_title($en_setting_field_name), $sections_ID) // Check section id. |
|
256 | + || in_array($section_name, $sections) // Check section name. |
|
257 | 257 | ) { |
258 | 258 | continue; |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | 262 | // Collect new sections from addons. |
263 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name; |
|
263 | + $new_sections[sanitize_title($field['name'])] = $section_name; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Add new section. |
268 | - if ( ! empty( $new_sections ) ) { |
|
269 | - $sections = array_merge( $sections, $new_sections ); |
|
268 | + if ( ! empty($new_sections)) { |
|
269 | + $sections = array_merge($sections, $new_sections); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | // Output. |
@@ -284,19 +284,19 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return array |
286 | 286 | */ |
287 | - function get_filtered_addon_settings( $settings, $setting_fields = array() ) { |
|
287 | + function get_filtered_addon_settings($settings, $setting_fields = array()) { |
|
288 | 288 | global $wp_filter; |
289 | 289 | |
290 | 290 | $new_setting_fields = array(); |
291 | 291 | |
292 | - if ( ! empty( $settings ) ) { |
|
292 | + if ( ! empty($settings)) { |
|
293 | 293 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ). |
294 | - if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { |
|
295 | - foreach ( $settings as $setting ) { |
|
294 | + if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { |
|
295 | + foreach ($settings as $setting) { |
|
296 | 296 | $new_setting_fields[] = $setting; |
297 | 297 | |
298 | 298 | // We need setting only till first section end. |
299 | - if ( 'sectionend' === $setting['type'] ) { |
|
299 | + if ('sectionend' === $setting['type']) { |
|
300 | 300 | break; |
301 | 301 | } |
302 | 302 | } |
@@ -308,24 +308,24 @@ discard block |
||
308 | 308 | $prev_title_field_id = ''; |
309 | 309 | |
310 | 310 | // Create new setting fields. |
311 | - foreach ( $settings as $index => $field ) { |
|
311 | + foreach ($settings as $index => $field) { |
|
312 | 312 | |
313 | 313 | // Bailout: Must need field type to process. |
314 | - if ( ! isset( $field['type'] ) ) { |
|
314 | + if ( ! isset($field['type'])) { |
|
315 | 315 | continue; |
316 | 316 | } |
317 | 317 | |
318 | 318 | // Set wrapper class if any. |
319 | - if ( ! empty( $field['row_classes'] ) ) { |
|
319 | + if ( ! empty($field['row_classes'])) { |
|
320 | 320 | $field['wrapper_class'] = $field['row_classes']; |
321 | - unset( $field['row_classes'] ); |
|
321 | + unset($field['row_classes']); |
|
322 | 322 | } |
323 | 323 | |
324 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name']; |
|
325 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc']; |
|
324 | + $field['name'] = ! isset($field['name']) ? '' : $field['name']; |
|
325 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc']; |
|
326 | 326 | |
327 | 327 | // Modify cmb2 setting fields. |
328 | - switch ( $field['type'] ) { |
|
328 | + switch ($field['type']) { |
|
329 | 329 | case 'text' : |
330 | 330 | case 'file' : |
331 | 331 | $field['css'] = 'width:25em;'; |
@@ -349,18 +349,18 @@ discard block |
||
349 | 349 | $field['type'] = 'title'; |
350 | 350 | |
351 | 351 | // Since we are showing sections, so there now ned to show horizontal rules. |
352 | - if ( '<hr>' === $field['desc'] ) { |
|
352 | + if ('<hr>' === $field['desc']) { |
|
353 | 353 | $field['desc'] = ''; |
354 | 354 | } |
355 | 355 | |
356 | 356 | break; |
357 | 357 | } |
358 | 358 | |
359 | - if ( 'title' === $field['type'] ) { |
|
359 | + if ('title' === $field['type']) { |
|
360 | 360 | |
361 | 361 | // If we do not have first element as title then these field will be skip from frontend |
362 | 362 | // because there are not belong to any section, so put all abandon fields under first section. |
363 | - if ( $index && empty( $prev_title_field_id ) ) { |
|
363 | + if ($index && empty($prev_title_field_id)) { |
|
364 | 364 | array_unshift( |
365 | 365 | $new_setting_fields, |
366 | 366 | array( |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $prev_title_field_id = $field['id']; |
375 | 375 | |
376 | 376 | continue; |
377 | - } elseif ( $index ) { |
|
377 | + } elseif ($index) { |
|
378 | 378 | // Section end. |
379 | 379 | $new_setting_fields[] = array( |
380 | 380 | 'type' => 'sectionend', |
@@ -406,52 +406,52 @@ discard block |
||
406 | 406 | |
407 | 407 | // Check if setting page has title section or not. |
408 | 408 | // If setting page does not have title section then add title section to it and fix section end array id. |
409 | - if ( 'title' !== $new_setting_fields[0]['type'] ) { |
|
409 | + if ('title' !== $new_setting_fields[0]['type']) { |
|
410 | 410 | array_unshift( |
411 | 411 | $new_setting_fields, |
412 | 412 | array( |
413 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ), |
|
413 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''), |
|
414 | 414 | 'type' => 'title', |
415 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '', |
|
416 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ), |
|
415 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '', |
|
416 | + 'id' => (isset($settings['id']) ? $settings['id'] : ''), |
|
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | 420 | // Update id in section end array if does not contain. |
421 | - if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { |
|
422 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' ); |
|
421 | + if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { |
|
422 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : ''); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | 426 | // Return only section related settings. |
427 | - if ( $sections = $this->get_filtered_addon_sections() ) { |
|
428 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields ); |
|
427 | + if ($sections = $this->get_filtered_addon_sections()) { |
|
428 | + $new_setting_fields = $this->get_section_settings($new_setting_fields); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | // Third party plugin backward compatibility. |
432 | - $wp_filter_keys = array_keys( $wp_filter ); |
|
433 | - foreach ( $new_setting_fields as $index => $field ) { |
|
434 | - if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { |
|
432 | + $wp_filter_keys = array_keys($wp_filter); |
|
433 | + foreach ($new_setting_fields as $index => $field) { |
|
434 | + if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) { |
|
435 | 435 | continue; |
436 | 436 | } |
437 | 437 | |
438 | 438 | $cmb2_filter_name = "cmb2_render_{$field['type']}"; |
439 | 439 | |
440 | - if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) { |
|
440 | + if (in_array($cmb2_filter_name, $wp_filter_keys)) { |
|
441 | 441 | |
442 | - if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) { |
|
443 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks ); |
|
442 | + if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) { |
|
443 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks); |
|
444 | 444 | } else { |
445 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] ); |
|
445 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]); |
|
446 | 446 | } |
447 | 447 | |
448 | - if ( ! empty( $cmb2_filter_arr ) ) { |
|
448 | + if ( ! empty($cmb2_filter_arr)) { |
|
449 | 449 | // Note: function can be called either globally or with class object, it depends on how developer invoke it. |
450 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr ); |
|
451 | - add_action( "give_admin_field_{$field['type']}", array( |
|
450 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr); |
|
451 | + add_action("give_admin_field_{$field['type']}", array( |
|
452 | 452 | $this, |
453 | 453 | 'addon_setting_field', |
454 | - ), 10, 2 ); |
|
454 | + ), 10, 2); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
@@ -472,31 +472,31 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return array |
474 | 474 | */ |
475 | - function get_section_settings( $tab_settings ) { |
|
475 | + function get_section_settings($tab_settings) { |
|
476 | 476 | $current_section = give_get_current_setting_section(); |
477 | 477 | |
478 | 478 | // Note: If we are opening default tab for addon setting then it is possible that we will get empty string as current section |
479 | 479 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section |
480 | 480 | // This is hack to fix this. |
481 | - if ( empty( $current_section ) ) { |
|
482 | - $current_section = $this->set_default_setting_tab( $current_section ); |
|
481 | + if (empty($current_section)) { |
|
482 | + $current_section = $this->set_default_setting_tab($current_section); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | $section_start = false; |
486 | 486 | $section_end = false; |
487 | 487 | $section_only_setting_fields = array(); |
488 | 488 | |
489 | - foreach ( $tab_settings as $field ) { |
|
490 | - if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { |
|
489 | + foreach ($tab_settings as $field) { |
|
490 | + if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { |
|
491 | 491 | $section_start = true; |
492 | 492 | } |
493 | 493 | |
494 | - if ( ! $section_start || $section_end ) { |
|
494 | + if ( ! $section_start || $section_end) { |
|
495 | 495 | continue; |
496 | 496 | } |
497 | 497 | |
498 | - if ( $section_start && ! $section_end ) { |
|
499 | - if ( 'sectionend' == $field['type'] ) { |
|
498 | + if ($section_start && ! $section_end) { |
|
499 | + if ('sectionend' == $field['type']) { |
|
500 | 500 | $section_end = true; |
501 | 501 | } |
502 | 502 | $section_only_setting_fields[] = $field; |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | // Remove title from setting, prevent it from render in setting tab. |
507 | 507 | $section_only_setting_fields[0]['title'] = ''; |
508 | 508 | |
509 | - return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); |
|
509 | + return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -520,17 +520,17 @@ discard block |
||
520 | 520 | * |
521 | 521 | * @return void |
522 | 522 | */ |
523 | - function addon_setting_field( $field, $saved_value ) { |
|
523 | + function addon_setting_field($field, $saved_value) { |
|
524 | 524 | // Create object for cmb2 function callback backward compatibility. |
525 | 525 | // Note: Do not call any cmb2 function on these objects |
526 | - $field_obj = (object) array( 'args' => $field ); |
|
527 | - $field_type_obj = (object) array( 'field' => $field_obj ); |
|
526 | + $field_obj = (object) array('args' => $field); |
|
527 | + $field_type_obj = (object) array('field' => $field_obj); |
|
528 | 528 | |
529 | - switch ( $this->current_tab ) : |
|
529 | + switch ($this->current_tab) : |
|
530 | 530 | case 'licenses': |
531 | 531 | ?> |
532 | 532 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>"> |
533 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?> |
|
533 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?> |
|
534 | 534 | </div> |
535 | 535 | <?php break; |
536 | 536 | |
@@ -538,22 +538,22 @@ discard block |
||
538 | 538 | $colspan = 'colspan="2"'; |
539 | 539 | ?> |
540 | 540 | <tr valign="top"> |
541 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?> |
|
541 | + <?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> |
|
542 | 542 | <th scope="row" class="titledesc"> |
543 | 543 | <label |
544 | - for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label> |
|
544 | + for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label> |
|
545 | 545 | </th> |
546 | 546 | <?php $colspan = ''; ?> |
547 | 547 | <?php endif; ?> |
548 | 548 | <td class="give-forminp" <?php echo $colspan; ?>> |
549 | 549 | <?php |
550 | - if ( is_array( $field['func']['function'] ) ) { |
|
550 | + if (is_array($field['func']['function'])) { |
|
551 | 551 | $classname = $field['func']['function'][0]; |
552 | 552 | $function_name = $field['func']['function'][1]; |
553 | - $classname->$function_name( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
553 | + $classname->$function_name($field_obj, $saved_value, '', '', $field_type_obj); |
|
554 | 554 | } else { |
555 | 555 | $function_name = $field['func']['function']; |
556 | - $function_name( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
556 | + $function_name($field_obj, $saved_value, '', '', $field_type_obj); |
|
557 | 557 | } |
558 | 558 | ?> |
559 | 559 | </td> |
@@ -571,10 +571,10 @@ discard block |
||
571 | 571 | public function get_sections() { |
572 | 572 | $sections = array(); |
573 | 573 | |
574 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
575 | - foreach ( $setting_fields['fields'] as $field ) { |
|
576 | - if ( 'give_title' == $field['type'] ) { |
|
577 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] ); |
|
574 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
575 | + foreach ($setting_fields['fields'] as $field) { |
|
576 | + if ('give_title' == $field['type']) { |
|
577 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']); |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | } |
@@ -594,16 +594,16 @@ discard block |
||
594 | 594 | |
595 | 595 | $new_setting_fields = array(); |
596 | 596 | |
597 | - if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { |
|
598 | - if ( isset( $setting_fields['fields'] ) ) { |
|
597 | + if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { |
|
598 | + if (isset($setting_fields['fields'])) { |
|
599 | 599 | |
600 | 600 | $tab_data = array( |
601 | 601 | 'id' => $setting_fields['id'], |
602 | 602 | 'give_title' => $setting_fields['give_title'], |
603 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ), |
|
603 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''), |
|
604 | 604 | ); |
605 | 605 | |
606 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data ); |
|
606 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data); |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
@@ -620,24 +620,24 @@ discard block |
||
620 | 620 | $sections = $this->get_sections(); |
621 | 621 | |
622 | 622 | // Show section settings only if setting section exist. |
623 | - if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) { |
|
624 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
623 | + if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) { |
|
624 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
625 | 625 | $GLOBALS['give_hide_save_button'] = true; |
626 | 626 | |
627 | 627 | return; |
628 | 628 | } |
629 | 629 | |
630 | 630 | // Bailout. |
631 | - if ( empty( $sections ) ) { |
|
631 | + if (empty($sections)) { |
|
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | 635 | echo '<ul class="subsubsub">'; |
636 | 636 | |
637 | - $array_keys = array_keys( $sections ); |
|
637 | + $array_keys = array_keys($sections); |
|
638 | 638 | |
639 | - foreach ( $sections as $id => $label ) { |
|
640 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
639 | + foreach ($sections as $id => $label) { |
|
640 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | echo '</ul><br class="clear" /><hr>'; |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | public function output() { |
653 | 653 | $settings = $this->get_settings(); |
654 | 654 | |
655 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
655 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | public function save() { |
665 | 665 | $settings = $this->get_settings(); |
666 | 666 | |
667 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
667 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
668 | 668 | } |
669 | 669 | } |
670 | 670 | endif; |
@@ -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 | |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Templates |
38 | 38 | */ |
39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
39 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Content Wrappers |
43 | 43 | */ |
44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
44 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
45 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Entry Summary Classes |
49 | 49 | */ |
50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
50 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Sidebar |
54 | 54 | */ |
55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
55 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Single Forms Summary Box |
59 | 59 | */ |
60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
60 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
61 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string $classes List of space separated class names. |
75 | 75 | */ |
76 | - public function give_set_single_summary_classes( $classes ) { |
|
76 | + public function give_set_single_summary_classes($classes) { |
|
77 | 77 | |
78 | 78 | //Add full width class when feature image is disabled AND no widgets are present |
79 | - if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
79 | + if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
80 | 80 | $classes .= ' give-full-width'; |
81 | 81 | } |
82 | 82 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function give_output_sidebar_option() { |
98 | 98 | |
99 | 99 | //Add full width class when feature image is disabled AND no widgets are present |
100 | - if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
100 | + if (give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
101 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
102 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
103 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
104 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string $template |
125 | 125 | */ |
126 | - public static function template_loader( $template ) { |
|
127 | - $find = array( 'give.php' ); |
|
126 | + public static function template_loader($template) { |
|
127 | + $find = array('give.php'); |
|
128 | 128 | $file = ''; |
129 | 129 | |
130 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
130 | + if (is_single() && get_post_type() == 'give_forms') { |
|
131 | 131 | $file = 'single-give-form.php'; |
132 | 132 | $find[] = $file; |
133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
133 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( $file ) { |
|
137 | - $template = locate_template( array_unique( $find ) ); |
|
138 | - if ( ! $template ) { |
|
139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
136 | + if ($file) { |
|
137 | + $template = locate_template(array_unique($find)); |
|
138 | + if ( ! $template) { |
|
139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -1283,7 +1283,7 @@ |
||
1283 | 1283 | * |
1284 | 1284 | * @param $field |
1285 | 1285 | * |
1286 | - * @return string |
|
1286 | + * @return integer |
|
1287 | 1287 | */ |
1288 | 1288 | function _give_set_field_give_id_default_value( $field ) { |
1289 | 1289 | return 0; |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | type="radio" |
556 | 556 | style="' . esc_attr( $field['style'] ) . '" |
557 | 557 | ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
558 | - . give_get_custom_attributes( $field ) . ' |
|
558 | + . give_get_custom_attributes( $field ) . ' |
|
559 | 559 | /> ' . esc_html( $value ) . '</label> |
560 | 560 | </li>'; |
561 | 561 | } |
@@ -704,9 +704,9 @@ discard block |
||
704 | 704 | $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
705 | 705 | |
706 | 706 | echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
707 | - . '" target="_blank">' |
|
708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
709 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
707 | + . '" target="_blank">' |
|
708 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
709 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | default: |
77 | 77 | |
78 | 78 | if ( |
79 | - array_key_exists( 'callback', $field ) |
|
80 | - && ! empty( $field['callback'] ) |
|
79 | + array_key_exists('callback', $field) |
|
80 | + && ! empty($field['callback']) |
|
81 | 81 | ) { |
82 | 82 | $func_name = $field['callback']; |
83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.8 |
92 | 92 | */ |
93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
94 | 94 | |
95 | 95 | // Exit if not any function exist. |
96 | 96 | // Check if render callback exist or not. |
97 | - if ( empty( $func_name ) ) { |
|
97 | + if (empty($func_name)) { |
|
98 | 98 | return false; |
99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
100 | 100 | return false; |
101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return bool |
116 | 116 | */ |
117 | -function give_render_field( $field ) { |
|
117 | +function give_render_field($field) { |
|
118 | 118 | |
119 | 119 | // Check if render callback exist or not. |
120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
125 | - if ( empty( $field['class'] ) ) { |
|
125 | + if (empty($field['class'])) { |
|
126 | 126 | $field['class'] = ''; |
127 | 127 | } |
128 | 128 | |
129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
129 | + if (empty($field['attributes']['class'])) { |
|
130 | 130 | $field['attributes']['class'] = ''; |
131 | 131 | } |
132 | 132 | |
133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
134 | - unset( $field['class'] ); |
|
133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
134 | + unset($field['class']); |
|
135 | 135 | |
136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
137 | + if ( ! empty($field['row_classes'])) { |
|
138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
139 | - unset( $field['row_classes'] ); |
|
139 | + unset($field['row_classes']); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Set field params on basis of cmb2 field name. |
143 | - switch ( $field['type'] ) { |
|
143 | + switch ($field['type']) { |
|
144 | 144 | case 'radio_inline': |
145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
145 | + if (empty($field['wrapper_class'])) { |
|
146 | 146 | $field['wrapper_class'] = ''; |
147 | 147 | } |
148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | case 'text-small' : |
156 | 156 | case 'text_small' : |
157 | 157 | // CMB2 compatibility: Set field type to text. |
158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
159 | 159 | |
160 | 160 | // CMB2 compatibility: Set data type to price. |
161 | 161 | if ( |
162 | - empty( $field['data_type'] ) |
|
163 | - && ! empty( $field['attributes']['class'] ) |
|
162 | + empty($field['data_type']) |
|
163 | + && ! empty($field['attributes']['class']) |
|
164 | 164 | && ( |
165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
165 | + false !== strpos($field['attributes']['class'], 'money') |
|
166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
167 | 167 | ) |
168 | 168 | ) { |
169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | case 'give_default_radio_inline': |
183 | 183 | $field['type'] = 'radio'; |
184 | 184 | $field['options'] = array( |
185 | - 'default' => __( 'Default' ), |
|
185 | + 'default' => __('Default'), |
|
186 | 186 | ); |
187 | 187 | break; |
188 | 188 | } |
189 | 189 | |
190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
191 | 191 | // We encourage you to use description param. |
192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
192 | + $field['description'] = ( ! empty($field['description']) |
|
193 | 193 | ? $field['description'] |
194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
195 | 195 | |
196 | 196 | // Call render function. |
197 | - if ( is_array( $func_name ) ) { |
|
198 | - $func_name[0]->{$func_name[1]}( $field ); |
|
197 | + if (is_array($func_name)) { |
|
198 | + $func_name[0]->{$func_name[1]}($field); |
|
199 | 199 | } else { |
200 | - $func_name( $field ); |
|
200 | + $func_name($field); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
227 | 227 | * } |
228 | 228 | * @return void |
229 | 229 | */ |
230 | -function give_text_input( $field ) { |
|
230 | +function give_text_input($field) { |
|
231 | 231 | global $thepostid, $post; |
232 | 232 | |
233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
238 | 238 | $field['before_field'] = ''; |
239 | 239 | $field['after_field'] = ''; |
240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
241 | 241 | |
242 | - switch ( $data_type ) { |
|
242 | + switch ($data_type) { |
|
243 | 243 | case 'price' : |
244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
245 | 245 | |
246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
246 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
247 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'decimal' : |
251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
253 | 253 | break; |
254 | 254 | |
255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | ?> |
260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
262 | 262 | <?php echo $field['before_field']; ?> |
263 | 263 | <input |
264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
266 | + name="<?php echo give_get_field_name($field); ?>" |
|
267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
269 | + <?php echo give_get_custom_attributes($field); ?> |
|
270 | 270 | /> |
271 | 271 | <?php echo $field['after_field']; ?> |
272 | 272 | <?php |
273 | - echo give_get_field_description( $field ); |
|
273 | + echo give_get_field_description($field); |
|
274 | 274 | echo '</p>'; |
275 | 275 | } |
276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
292 | 292 | * } |
293 | 293 | * @return void |
294 | 294 | */ |
295 | -function give_hidden_input( $field ) { |
|
295 | +function give_hidden_input($field) { |
|
296 | 296 | global $thepostid, $post; |
297 | 297 | |
298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
300 | 300 | |
301 | 301 | // Custom attribute handling |
302 | 302 | $custom_attributes = array(); |
303 | 303 | |
304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
305 | 305 | |
306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | ?> |
311 | 311 | |
312 | 312 | <input |
313 | 313 | type="hidden" |
314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
314 | + name="<?php echo give_get_field_name($field); ?>" |
|
315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
317 | + <?php echo give_get_custom_attributes($field); ?> |
|
318 | 318 | /> |
319 | 319 | <?php |
320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
340 | 340 | * } |
341 | 341 | * @return void |
342 | 342 | */ |
343 | -function give_textarea_input( $field ) { |
|
343 | +function give_textarea_input($field) { |
|
344 | 344 | global $thepostid, $post; |
345 | 345 | |
346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
350 | 350 | |
351 | 351 | ?> |
352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
354 | 354 | <textarea |
355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
356 | + name="<?php echo give_get_field_name($field); ?>" |
|
357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
358 | 358 | rows="10" |
359 | 359 | cols="20" |
360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
360 | + <?php echo give_get_custom_attributes($field); ?> |
|
361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
362 | 362 | <?php |
363 | - echo give_get_field_description( $field ); |
|
363 | + echo give_get_field_description($field); |
|
364 | 364 | echo '</p>'; |
365 | 365 | } |
366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
384 | 384 | * } |
385 | 385 | * @return void |
386 | 386 | */ |
387 | -function give_wysiwyg( $field ) { |
|
387 | +function give_wysiwyg($field) { |
|
388 | 388 | global $thepostid, $post; |
389 | 389 | |
390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
394 | 394 | |
395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
396 | 396 | $editor_attributes = array( |
397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
398 | 398 | 'textarea_rows' => '10', |
399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
399 | + 'editor_css' => esc_attr($field['style']), |
|
400 | 400 | 'editor_class' => $field['attributes']['class'], |
401 | 401 | ); |
402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
403 | 403 | $field['value'], |
404 | 404 | $field['unique_field_id'], |
405 | 405 | $editor_attributes, |
406 | - ) ) ) . '"'; |
|
407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
406 | + ))).'"'; |
|
407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
408 | 408 | |
409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
410 | 410 | |
411 | 411 | wp_editor( |
412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $editor_attributes |
415 | 415 | ); |
416 | 416 | |
417 | - echo give_get_field_description( $field ); |
|
417 | + echo give_get_field_description($field); |
|
418 | 418 | echo '</div>'; |
419 | 419 | } |
420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
439 | 439 | * } |
440 | 440 | * @return void |
441 | 441 | */ |
442 | -function give_checkbox( $field ) { |
|
442 | +function give_checkbox($field) { |
|
443 | 443 | global $thepostid, $post; |
444 | 444 | |
445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
451 | 451 | ?> |
452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
454 | 454 | <input |
455 | 455 | type="checkbox" |
456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
457 | + name="<?php echo give_get_field_name($field); ?>" |
|
458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
461 | + <?php echo give_get_custom_attributes($field); ?> |
|
462 | 462 | /> |
463 | 463 | <?php |
464 | - echo give_get_field_description( $field ); |
|
464 | + echo give_get_field_description($field); |
|
465 | 465 | echo '</p>'; |
466 | 466 | } |
467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
487 | 487 | * } |
488 | 488 | * @return void |
489 | 489 | */ |
490 | -function give_select( $field ) { |
|
490 | +function give_select($field) { |
|
491 | 491 | global $thepostid, $post; |
492 | 492 | |
493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
498 | 498 | ?> |
499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
501 | 501 | <select |
502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
503 | + name="<?php echo give_get_field_name($field); ?>" |
|
504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
505 | + <?php echo give_get_custom_attributes($field); ?> |
|
506 | 506 | > |
507 | 507 | <?php |
508 | - foreach ( $field['options'] as $key => $value ) { |
|
509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
508 | + foreach ($field['options'] as $key => $value) { |
|
509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
510 | 510 | } |
511 | 511 | echo '</select>'; |
512 | - echo give_get_field_description( $field ); |
|
512 | + echo give_get_field_description($field); |
|
513 | 513 | echo '</p>'; |
514 | 514 | } |
515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
536 | 536 | * } |
537 | 537 | * @return void |
538 | 538 | */ |
539 | -function give_radio( $field ) { |
|
539 | +function give_radio($field) { |
|
540 | 540 | global $thepostid, $post; |
541 | 541 | |
542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
547 | 547 | |
548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
549 | 549 | |
550 | - foreach ( $field['options'] as $key => $value ) { |
|
550 | + foreach ($field['options'] as $key => $value) { |
|
551 | 551 | |
552 | 552 | echo '<li><label><input |
553 | - name="' . give_get_field_name( $field ) . '" |
|
554 | - value="' . esc_attr( $key ) . '" |
|
553 | + name="' . give_get_field_name($field).'" |
|
554 | + value="' . esc_attr($key).'" |
|
555 | 555 | type="radio" |
556 | - style="' . esc_attr( $field['style'] ) . '" |
|
557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
558 | - . give_get_custom_attributes( $field ) . ' |
|
559 | - /> ' . esc_html( $value ) . '</label> |
|
556 | + style="' . esc_attr($field['style']).'" |
|
557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
558 | + . give_get_custom_attributes($field).' |
|
559 | + /> ' . esc_html($value).'</label> |
|
560 | 560 | </li>'; |
561 | 561 | } |
562 | 562 | echo '</ul>'; |
563 | 563 | |
564 | - echo give_get_field_description( $field ); |
|
564 | + echo give_get_field_description($field); |
|
565 | 565 | echo '</fieldset>'; |
566 | 566 | } |
567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
585 | 585 | * } |
586 | 586 | * @return void |
587 | 587 | */ |
588 | -function give_colorpicker( $field ) { |
|
588 | +function give_colorpicker($field) { |
|
589 | 589 | global $thepostid, $post; |
590 | 590 | |
591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
596 | 596 | $field['type'] = 'text'; |
597 | 597 | ?> |
598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
600 | 600 | <input |
601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
603 | + name="<?php echo give_get_field_name($field); ?>" |
|
604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
605 | + <?php echo give_get_custom_attributes($field); ?> |
|
606 | 606 | /> |
607 | 607 | <?php |
608 | - echo give_get_field_description( $field ); |
|
608 | + echo give_get_field_description($field); |
|
609 | 609 | echo '</p>'; |
610 | 610 | } |
611 | 611 | |
@@ -617,33 +617,33 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @param array $field |
619 | 619 | */ |
620 | -function give_media( $field ) { |
|
620 | +function give_media($field) { |
|
621 | 621 | global $thepostid, $post; |
622 | 622 | |
623 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
624 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
625 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
626 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
627 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
623 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
624 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
625 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
626 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
627 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
628 | 628 | $field['type'] = 'text'; |
629 | 629 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
630 | 630 | |
631 | 631 | // Allow developer to save attachment ID or attachment url as metadata. |
632 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
632 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
633 | 633 | ?> |
634 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
635 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
634 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
635 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
636 | 636 | <input |
637 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
638 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
637 | + name="<?php echo give_get_field_name($field); ?>" |
|
638 | + id="<?php echo esc_attr($field['id']); ?>" |
|
639 | 639 | type="text" |
640 | 640 | value="<?php echo $field['value']; ?>" |
641 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
641 | + style="<?php echo esc_attr($field['style']); ?>" |
|
642 | 642 | data-fvalue="<?php echo $field['fvalue']; ?>" |
643 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
643 | + <?php echo give_get_custom_attributes($field); ?> |
|
644 | 644 | /> <input class="give-media-upload button" type="button" |
645 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
646 | - <?php echo give_get_field_description( $field ); ?> |
|
645 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
646 | + <?php echo give_get_field_description($field); ?> |
|
647 | 647 | </p> |
648 | 648 | <?php |
649 | 649 | } |
@@ -657,27 +657,27 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | -function give_default_gateway( $field ) { |
|
660 | +function give_default_gateway($field) { |
|
661 | 661 | global $thepostid, $post; |
662 | 662 | |
663 | 663 | // get all active payment gateways. |
664 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
664 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
665 | 665 | $field['options'] = array(); |
666 | 666 | |
667 | 667 | // Set field option value. |
668 | - if ( ! empty( $gateways ) ) { |
|
669 | - foreach ( $gateways as $key => $option ) { |
|
670 | - $field['options'][ $key ] = $option['admin_label']; |
|
668 | + if ( ! empty($gateways)) { |
|
669 | + foreach ($gateways as $key => $option) { |
|
670 | + $field['options'][$key] = $option['admin_label']; |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | 674 | // Add a field to the Give Form admin single post view of this field |
675 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
676 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
675 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
676 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | // Render select field. |
680 | - give_select( $field ); |
|
680 | + give_select($field); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
@@ -699,13 +699,13 @@ discard block |
||
699 | 699 | * @return void |
700 | 700 | */ |
701 | 701 | |
702 | -function give_docs_link( $field ) { |
|
703 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
704 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
702 | +function give_docs_link($field) { |
|
703 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
704 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
705 | 705 | |
706 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
706 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
707 | 707 | . '" target="_blank">' |
708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
708 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
709 | 709 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
710 | 710 | } |
711 | 711 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @return mixed |
723 | 723 | */ |
724 | -function give_get_field_value( $field, $postid ) { |
|
725 | - if ( isset( $field['attributes']['value'] ) ) { |
|
724 | +function give_get_field_value($field, $postid) { |
|
725 | + if (isset($field['attributes']['value'])) { |
|
726 | 726 | return $field['attributes']['value']; |
727 | 727 | } |
728 | 728 | |
729 | 729 | // Get value from db. |
730 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
730 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
731 | 731 | |
732 | 732 | /** |
733 | 733 | * Filter the field value before apply default value. |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @param mixed $field_value Field value. |
738 | 738 | */ |
739 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
739 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
740 | 740 | |
741 | 741 | // Set default value if no any data saved to db. |
742 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
742 | + if ( ! $field_value && isset($field['default'])) { |
|
743 | 743 | $field_value = $field['default']; |
744 | 744 | } |
745 | 745 | |
@@ -756,20 +756,20 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @return string |
758 | 758 | */ |
759 | -function give_get_field_description( $field ) { |
|
759 | +function give_get_field_description($field) { |
|
760 | 760 | $field_desc_html = ''; |
761 | 761 | $description = ''; |
762 | 762 | |
763 | 763 | // Check for both `description` and `desc`. |
764 | - if ( isset( $field['description'] ) ) { |
|
764 | + if (isset($field['description'])) { |
|
765 | 765 | $description = $field['description']; |
766 | - } elseif ( isset( $field['desc'] ) ) { |
|
766 | + } elseif (isset($field['desc'])) { |
|
767 | 767 | $description = $field['desc']; |
768 | 768 | } |
769 | 769 | |
770 | 770 | // Set if there is a description. |
771 | - if ( ! empty( $description ) ) { |
|
772 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
771 | + if ( ! empty($description)) { |
|
772 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | return $field_desc_html; |
@@ -785,18 +785,18 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @return string |
787 | 787 | */ |
788 | -function give_get_custom_attributes( $field ) { |
|
788 | +function give_get_custom_attributes($field) { |
|
789 | 789 | // Custom attribute handling |
790 | 790 | $custom_attributes = array(); |
791 | 791 | |
792 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
792 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
793 | 793 | |
794 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
795 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
794 | + foreach ($field['attributes'] as $attribute => $value) { |
|
795 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
799 | - return implode( ' ', $custom_attributes ); |
|
799 | + return implode(' ', $custom_attributes); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
@@ -812,8 +812,8 @@ discard block |
||
812 | 812 | * |
813 | 813 | * @return string |
814 | 814 | */ |
815 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
816 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
815 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
816 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
817 | 817 | |
818 | 818 | /** |
819 | 819 | * Filter the specific repeater field value |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @param string $field_id |
824 | 824 | */ |
825 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
825 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
826 | 826 | |
827 | 827 | /** |
828 | 828 | * Filter the repeater field value |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | * |
832 | 832 | * @param string $field_id |
833 | 833 | */ |
834 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
834 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
835 | 835 | |
836 | 836 | return $field_value; |
837 | 837 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * |
850 | 850 | * @return string |
851 | 851 | */ |
852 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
852 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
853 | 853 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
854 | 854 | |
855 | 855 | // Get field id. |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @param string $field_id |
864 | 864 | */ |
865 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
865 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
866 | 866 | |
867 | 867 | /** |
868 | 868 | * Filter the repeater field id |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | * |
872 | 872 | * @param string $field_id |
873 | 873 | */ |
874 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
874 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
875 | 875 | |
876 | 876 | return $field_id; |
877 | 877 | } |
@@ -886,8 +886,8 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @return string |
888 | 888 | */ |
889 | -function give_get_field_name( $field ) { |
|
890 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
889 | +function give_get_field_name($field) { |
|
890 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
891 | 891 | |
892 | 892 | /** |
893 | 893 | * Filter the field name. |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * |
897 | 897 | * @param string $field_name |
898 | 898 | */ |
899 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
899 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
900 | 900 | |
901 | 901 | return $field_name; |
902 | 902 | } |
@@ -913,39 +913,39 @@ discard block |
||
913 | 913 | * |
914 | 914 | * @return void |
915 | 915 | */ |
916 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
916 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
917 | 917 | global $thepostid, $post; |
918 | 918 | |
919 | 919 | // Bailout. |
920 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
920 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
921 | 921 | return; |
922 | 922 | } |
923 | 923 | |
924 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
925 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
924 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
925 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
926 | 926 | ?> |
927 | 927 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
928 | 928 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
929 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
929 | + <?php if ( ! empty($fields['name'])) : ?> |
|
930 | 930 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
931 | 931 | <?php endif; ?> |
932 | 932 | |
933 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
933 | + <?php if ( ! empty($fields['description'])) : ?> |
|
934 | 934 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
935 | 935 | <?php endif; ?> |
936 | 936 | |
937 | 937 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
938 | 938 | <?php |
939 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
940 | - $header_title = isset( $fields['options']['header_title'] ) |
|
939 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
940 | + $header_title = isset($fields['options']['header_title']) |
|
941 | 941 | ? $fields['options']['header_title'] |
942 | - : esc_attr__( 'Group', 'give' ); |
|
942 | + : esc_attr__('Group', 'give'); |
|
943 | 943 | |
944 | 944 | $add_default_donation_field = false; |
945 | 945 | |
946 | 946 | // Check if level is not created or we have to add default level. |
947 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
948 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
947 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
948 | + $repeater_field_values = array_values($repeater_field_values); |
|
949 | 949 | } else { |
950 | 950 | $fields_count = 1; |
951 | 951 | $add_default_donation_field = true; |
@@ -958,59 +958,59 @@ discard block |
||
958 | 958 | <div class="give-row-head give-move"> |
959 | 959 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
960 | 960 | </button> |
961 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
961 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
962 | 962 | <h2> |
963 | 963 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
964 | 964 | </h2> |
965 | 965 | </div> |
966 | 966 | <div class="give-row-body"> |
967 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
968 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
967 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
968 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
969 | 969 | continue; |
970 | 970 | } ?> |
971 | 971 | <?php |
972 | 972 | $field['repeat'] = true; |
973 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
974 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
973 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
974 | + $field['id'] = str_replace(array('[', ']'), array( |
|
975 | 975 | '_', |
976 | 976 | '', |
977 | - ), $field['repeatable_field_id'] ); |
|
977 | + ), $field['repeatable_field_id']); |
|
978 | 978 | ?> |
979 | - <?php give_render_field( $field ); ?> |
|
979 | + <?php give_render_field($field); ?> |
|
980 | 980 | <?php endforeach; ?> |
981 | 981 | </div> |
982 | 982 | </td> |
983 | 983 | </tr> |
984 | 984 | |
985 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
985 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
986 | 986 | <!--Stored repeater field group--> |
987 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
987 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
988 | 988 | <tr class="give-row"> |
989 | 989 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
990 | 990 | <div class="give-row-head give-move"> |
991 | 991 | <button type="button" class="handlediv button-link"> |
992 | 992 | <span class="toggle-indicator"></span></button> |
993 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
993 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
994 | 994 | </sapn> |
995 | 995 | <h2> |
996 | 996 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
997 | 997 | </h2> |
998 | 998 | </div> |
999 | 999 | <div class="give-row-body"> |
1000 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1001 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
1000 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1001 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
1002 | 1002 | continue; |
1003 | 1003 | } ?> |
1004 | 1004 | <?php |
1005 | 1005 | $field['repeat'] = true; |
1006 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
1007 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
1008 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1006 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
1007 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
1008 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1009 | 1009 | '_', |
1010 | 1010 | '', |
1011 | - ), $field['repeatable_field_id'] ); |
|
1011 | + ), $field['repeatable_field_id']); |
|
1012 | 1012 | ?> |
1013 | - <?php give_render_field( $field ); ?> |
|
1013 | + <?php give_render_field($field); ?> |
|
1014 | 1014 | <?php endforeach; ?> |
1015 | 1015 | </div> |
1016 | 1016 | </td> |
@@ -1018,14 +1018,14 @@ discard block |
||
1018 | 1018 | <?php endforeach; |
1019 | 1019 | ; ?> |
1020 | 1020 | |
1021 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1021 | + <?php elseif ($add_default_donation_field) : ?> |
|
1022 | 1022 | <!--Default repeater field group--> |
1023 | 1023 | <tr class="give-row"> |
1024 | 1024 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1025 | 1025 | <div class="give-row-head give-move"> |
1026 | 1026 | <button type="button" class="handlediv button-link"> |
1027 | 1027 | <span class="toggle-indicator"></span></button> |
1028 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1028 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1029 | 1029 | </sapn> |
1030 | 1030 | <h2> |
1031 | 1031 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1033,19 +1033,19 @@ discard block |
||
1033 | 1033 | </div> |
1034 | 1034 | <div class="give-row-body"> |
1035 | 1035 | <?php |
1036 | - foreach ( $fields['fields'] as $field ) : |
|
1037 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1036 | + foreach ($fields['fields'] as $field) : |
|
1037 | + if ( ! give_is_field_callback_exist($field)) { |
|
1038 | 1038 | continue; |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | $field['repeat'] = true; |
1042 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1043 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
1044 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1042 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1043 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
1044 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1045 | 1045 | '_', |
1046 | 1046 | '', |
1047 | - ), $field['repeatable_field_id'] ); |
|
1048 | - give_render_field( $field ); |
|
1047 | + ), $field['repeatable_field_id']); |
|
1048 | + give_render_field($field); |
|
1049 | 1049 | endforeach; |
1050 | 1050 | ?> |
1051 | 1051 | </div> |
@@ -1056,9 +1056,9 @@ discard block |
||
1056 | 1056 | <tfoot> |
1057 | 1057 | <tr> |
1058 | 1058 | <?php |
1059 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1059 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1060 | 1060 | ? $add_row_btn_title = $fields['options']['add_button'] |
1061 | - : esc_html__( 'Add Row', 'give' ); |
|
1061 | + : esc_html__('Add Row', 'give'); |
|
1062 | 1062 | ?> |
1063 | 1063 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1064 | 1064 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1088,10 +1088,10 @@ discard block |
||
1088 | 1088 | * |
1089 | 1089 | * @param string |
1090 | 1090 | */ |
1091 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1091 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1092 | 1092 | |
1093 | 1093 | // Get current tab. |
1094 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1094 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1095 | 1095 | |
1096 | 1096 | // Output. |
1097 | 1097 | return $current_tab; |
@@ -1115,10 +1115,10 @@ discard block |
||
1115 | 1115 | * |
1116 | 1116 | * @param string |
1117 | 1117 | */ |
1118 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1118 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1119 | 1119 | |
1120 | 1120 | // Get current section. |
1121 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1121 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1122 | 1122 | |
1123 | 1123 | // Output. |
1124 | 1124 | return $current_section; |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | */ |
1133 | 1133 | function give_get_current_setting_page() { |
1134 | 1134 | // Get current page. |
1135 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1135 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1136 | 1136 | |
1137 | 1137 | // Output. |
1138 | 1138 | return $setting_page; |
@@ -1152,13 +1152,13 @@ discard block |
||
1152 | 1152 | * |
1153 | 1153 | * @return string |
1154 | 1154 | */ |
1155 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1156 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1155 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1156 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1157 | 1157 | |
1158 | 1158 | if ( |
1159 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
1159 | + ! give_get_meta($postid, '_give_display_content', true) |
|
1160 | 1160 | && $show_content |
1161 | - && ( 'none' !== $show_content ) |
|
1161 | + && ('none' !== $show_content) |
|
1162 | 1162 | ) { |
1163 | 1163 | $field_value = 'enabled'; |
1164 | 1164 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | return $field_value; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1169 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1170 | 1170 | |
1171 | 1171 | |
1172 | 1172 | /** |
@@ -1183,12 +1183,12 @@ discard block |
||
1183 | 1183 | * |
1184 | 1184 | * @return string |
1185 | 1185 | */ |
1186 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1187 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1186 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1187 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1188 | 1188 | |
1189 | 1189 | if ( |
1190 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
1191 | - && ( 'none' !== $show_content ) |
|
1190 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
1191 | + && ('none' !== $show_content) |
|
1192 | 1192 | ) { |
1193 | 1193 | $field_value = $show_content; |
1194 | 1194 | } |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | return $field_value; |
1197 | 1197 | } |
1198 | 1198 | |
1199 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1199 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1200 | 1200 | |
1201 | 1201 | |
1202 | 1202 | /** |
@@ -1212,17 +1212,17 @@ discard block |
||
1212 | 1212 | * |
1213 | 1213 | * @return string |
1214 | 1214 | */ |
1215 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1216 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
1215 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1216 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
1217 | 1217 | |
1218 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1219 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1218 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1219 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | return $field_value; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1225 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1226 | 1226 | |
1227 | 1227 | |
1228 | 1228 | /** |
@@ -1239,17 +1239,17 @@ discard block |
||
1239 | 1239 | * |
1240 | 1240 | * @return string |
1241 | 1241 | */ |
1242 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1243 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1242 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1243 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1244 | 1244 | |
1245 | - if ( 'on' === $offline_donation ) { |
|
1245 | + if ('on' === $offline_donation) { |
|
1246 | 1246 | $field_value = 'enabled'; |
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | return $field_value; |
1250 | 1250 | } |
1251 | 1251 | |
1252 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1252 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1253 | 1253 | |
1254 | 1254 | |
1255 | 1255 | /** |
@@ -1265,17 +1265,17 @@ discard block |
||
1265 | 1265 | * |
1266 | 1266 | * @return string |
1267 | 1267 | */ |
1268 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1269 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
1268 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1269 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
1270 | 1270 | |
1271 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1272 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1271 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1272 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | return $field_value; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1278 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1279 | 1279 | |
1280 | 1280 | |
1281 | 1281 | /** |
@@ -1291,17 +1291,17 @@ discard block |
||
1291 | 1291 | * |
1292 | 1292 | * @return string |
1293 | 1293 | */ |
1294 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1295 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
1294 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1295 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
1296 | 1296 | |
1297 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1298 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1297 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1298 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | return $field_value; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1304 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1305 | 1305 | |
1306 | 1306 | /** |
1307 | 1307 | * Set value for Donation Goal --> close Form. |
@@ -1317,17 +1317,17 @@ discard block |
||
1317 | 1317 | * |
1318 | 1318 | * @return string |
1319 | 1319 | */ |
1320 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1321 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1320 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1321 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1322 | 1322 | |
1323 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1324 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1323 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1324 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | 1327 | return $field_value; |
1328 | 1328 | } |
1329 | 1329 | |
1330 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1330 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1331 | 1331 | |
1332 | 1332 | |
1333 | 1333 | /** |
@@ -1343,17 +1343,17 @@ discard block |
||
1343 | 1343 | * |
1344 | 1344 | * @return string |
1345 | 1345 | */ |
1346 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1347 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
1346 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1347 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
1348 | 1348 | |
1349 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1350 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1349 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1350 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1351 | 1351 | } |
1352 | 1352 | |
1353 | 1353 | return $field_value; |
1354 | 1354 | } |
1355 | 1355 | |
1356 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1356 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1357 | 1357 | |
1358 | 1358 | /** |
1359 | 1359 | * Set value for Offline Donations --> Offline Donations. |
@@ -1369,17 +1369,17 @@ discard block |
||
1369 | 1369 | * |
1370 | 1370 | * @return string |
1371 | 1371 | */ |
1372 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1373 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
1372 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1373 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
1374 | 1374 | |
1375 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1376 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1375 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1376 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | return $field_value; |
1380 | 1380 | } |
1381 | 1381 | |
1382 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1382 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1383 | 1383 | |
1384 | 1384 | |
1385 | 1385 | /** |
@@ -1394,14 +1394,14 @@ discard block |
||
1394 | 1394 | * |
1395 | 1395 | * @return mixed |
1396 | 1396 | */ |
1397 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1397 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1398 | 1398 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1399 | 1399 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1400 | 1400 | |
1401 | 1401 | return $field_id; |
1402 | 1402 | } |
1403 | 1403 | |
1404 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1404 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1405 | 1405 | |
1406 | 1406 | /** |
1407 | 1407 | * Set repeater field value for multi donation form. |
@@ -1415,13 +1415,13 @@ discard block |
||
1415 | 1415 | * |
1416 | 1416 | * @return mixed |
1417 | 1417 | */ |
1418 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1419 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1418 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1419 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1420 | 1420 | |
1421 | 1421 | return $field_value; |
1422 | 1422 | } |
1423 | 1423 | |
1424 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1424 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1425 | 1425 | |
1426 | 1426 | /** |
1427 | 1427 | * Set default value for _give_id field. |
@@ -1432,11 +1432,11 @@ discard block |
||
1432 | 1432 | * |
1433 | 1433 | * @return string |
1434 | 1434 | */ |
1435 | -function _give_set_field_give_id_default_value( $field ) { |
|
1435 | +function _give_set_field_give_id_default_value($field) { |
|
1436 | 1436 | return 0; |
1437 | 1437 | } |
1438 | 1438 | |
1439 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1439 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1440 | 1440 | |
1441 | 1441 | /** |
1442 | 1442 | * Set default value for _give_default field. |
@@ -1447,11 +1447,11 @@ discard block |
||
1447 | 1447 | * |
1448 | 1448 | * @return string |
1449 | 1449 | */ |
1450 | -function _give_set_field_give_default_default_value( $field ) { |
|
1450 | +function _give_set_field_give_default_default_value($field) { |
|
1451 | 1451 | return 'default'; |
1452 | 1452 | } |
1453 | 1453 | |
1454 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1454 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1455 | 1455 | |
1456 | 1456 | /** |
1457 | 1457 | * Set repeater field editor id for field type wysiwyg. |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1467 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1468 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1466 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1467 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1468 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1469 | 1469 | } |
1470 | 1470 | |
1471 | 1471 | return $field_name; |
1472 | 1472 | } |
1473 | 1473 | |
1474 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1474 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | /** |
114 | 114 | * Adds the "Donation Form" button above the TinyMCE Editor on add/edit screens. |
115 | 115 | * |
116 | - * @return string|bool |
|
116 | + * @return false|null |
|
117 | 117 | * |
118 | 118 | * @since 1.0 |
119 | 119 | */ |
@@ -138,8 +138,8 @@ |
||
138 | 138 | |
139 | 139 | // Only run in admin post/page creation and edit screens |
140 | 140 | if ( in_array( $screen->parent_file, $shortcode_button_pages ) |
141 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | - && ! empty( self::$shortcodes ) |
|
141 | + && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | + && ! empty( self::$shortcodes ) |
|
143 | 143 | ) { |
144 | 144 | |
145 | 145 | $shortcodes = array(); |
@@ -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 | |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | 35 | |
36 | - if ( is_admin() ) { |
|
37 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
36 | + if (is_admin()) { |
|
37 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
38 | 38 | |
39 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
40 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
41 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
39 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
40 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
41 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
42 | 42 | } |
43 | 43 | |
44 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
45 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
44 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
45 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.0 |
56 | 56 | */ |
57 | - public function mce_external_plugins( $plugin_array ) { |
|
57 | + public function mce_external_plugins($plugin_array) { |
|
58 | 58 | |
59 | - if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { |
|
59 | + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
63 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
64 | 64 | |
65 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
65 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
66 | 66 | |
67 | 67 | return $plugin_array; |
68 | 68 | } |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function admin_enqueue_assets() { |
78 | 78 | |
79 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
79 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
80 | 80 | |
81 | 81 | wp_enqueue_script( |
82 | 82 | 'give_shortcode', |
83 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
84 | - array( 'jquery' ), |
|
83 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
84 | + array('jquery'), |
|
85 | 85 | GIVE_VERSION, |
86 | 86 | true |
87 | 87 | ); |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function admin_localize_scripts() { |
98 | 98 | |
99 | - if ( ! empty( self::$shortcodes ) ) { |
|
99 | + if ( ! empty(self::$shortcodes)) { |
|
100 | 100 | |
101 | 101 | $variables = array(); |
102 | 102 | |
103 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
104 | - if ( ! empty( $values['required'] ) ) { |
|
105 | - $variables[ $shortcode ] = $values['required']; |
|
103 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
104 | + if ( ! empty($values['required'])) { |
|
105 | + $variables[$shortcode] = $values['required']; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
109 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -123,37 +123,37 @@ discard block |
||
123 | 123 | |
124 | 124 | // If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object. |
125 | 125 | // For example we are loading wp editor by ajax in repeater field. |
126 | - if ( ! ( $screen instanceof WP_Screen ) ) { |
|
126 | + if ( ! ($screen instanceof WP_Screen)) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array( |
|
130 | + $shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( |
|
131 | 131 | 'post.php', |
132 | 132 | 'page.php', |
133 | 133 | 'post-new.php', |
134 | 134 | 'post-edit.php', |
135 | 135 | 'edit.php', |
136 | 136 | 'edit.php?post_type=page', |
137 | - ) ); |
|
137 | + )); |
|
138 | 138 | |
139 | 139 | // Only run in admin post/page creation and edit screens |
140 | - if ( in_array( $screen->parent_file, $shortcode_button_pages ) |
|
141 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | - && ! empty( self::$shortcodes ) |
|
140 | + if (in_array($screen->parent_file, $shortcode_button_pages) |
|
141 | + && apply_filters('give_shortcode_button_condition', true) |
|
142 | + && ! empty(self::$shortcodes) |
|
143 | 143 | ) { |
144 | 144 | |
145 | 145 | $shortcodes = array(); |
146 | 146 | |
147 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
147 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Filters the condition for including the current shortcode |
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
154 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
155 | 155 | |
156 | - $shortcodes[ $shortcode ] = sprintf( |
|
156 | + $shortcodes[$shortcode] = sprintf( |
|
157 | 157 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>', |
158 | 158 | $shortcode, |
159 | 159 | $shortcode, |
@@ -162,37 +162,37 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! empty( $shortcodes ) ) { |
|
165 | + if ( ! empty($shortcodes)) { |
|
166 | 166 | |
167 | 167 | // check current WP version |
168 | - $img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) |
|
169 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
170 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
168 | + $img = (version_compare(get_bloginfo('version'), '3.5', '<')) |
|
169 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
170 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
171 | 171 | |
172 | - reset( $shortcodes ); |
|
172 | + reset($shortcodes); |
|
173 | 173 | |
174 | - if ( count( $shortcodes ) == 1 ) { |
|
174 | + if (count($shortcodes) == 1) { |
|
175 | 175 | |
176 | - $shortcode = key( $shortcodes ); |
|
176 | + $shortcode = key($shortcodes); |
|
177 | 177 | |
178 | 178 | printf( |
179 | 179 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
180 | 180 | $shortcode, |
181 | - sprintf( '%s %s %s', |
|
181 | + sprintf('%s %s %s', |
|
182 | 182 | $img, |
183 | - esc_html__( 'Insert', 'give' ), |
|
184 | - self::$shortcodes[ $shortcode ]['label'] |
|
183 | + esc_html__('Insert', 'give'), |
|
184 | + self::$shortcodes[$shortcode]['label'] |
|
185 | 185 | ) |
186 | 186 | ); |
187 | 187 | } else { |
188 | 188 | printf( |
189 | - '<div class="sc-wrap">' . |
|
190 | - '<button class="button sc-button">%s %s</button>' . |
|
191 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
189 | + '<div class="sc-wrap">'. |
|
190 | + '<button class="button sc-button">%s %s</button>'. |
|
191 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
192 | 192 | '</div>', |
193 | 193 | $img, |
194 | - esc_html__( 'Give Shortcodes', 'give' ), |
|
195 | - implode( '', array_values( $shortcodes ) ) |
|
194 | + esc_html__('Give Shortcodes', 'give'), |
|
195 | + implode('', array_values($shortcodes)) |
|
196 | 196 | ); |
197 | 197 | } |
198 | 198 | } |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function shortcode_ajax() { |
210 | 210 | |
211 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
211 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
212 | 212 | $response = false; |
213 | 213 | |
214 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
214 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
215 | 215 | |
216 | - $data = self::$shortcodes[ $shortcode ]; |
|
216 | + $data = self::$shortcodes[$shortcode]; |
|
217 | 217 | |
218 | - if ( ! empty( $data['errors'] ) ) { |
|
219 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); |
|
218 | + if ( ! empty($data['errors'])) { |
|
219 | + $data['btn_okay'] = array(esc_html__('Okay', 'give')); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $response = array( |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | ); |
229 | 229 | } else { |
230 | 230 | // todo: handle error |
231 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
231 | + error_log(print_r('AJAX error!', 1)); |
|
232 | 232 | } |
233 | 233 | |
234 | - wp_send_json( $response ); |
|
234 | + wp_send_json($response); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 |
@@ -464,7 +464,7 @@ |
||
464 | 464 | * |
465 | 465 | * @param WP_Post $payment |
466 | 466 | * |
467 | - * @return mixed |
|
467 | + * @return false|null |
|
468 | 468 | */ |
469 | 469 | function give_offline_payment_receipt_after( $payment ) { |
470 | 470 | // Get payment object. |
@@ -249,10 +249,10 @@ |
||
249 | 249 | $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | - '<a href="%1$s">%2$s</a>', |
|
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
252 | + '<a href="%1$s">%2$s</a>', |
|
253 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | + __( 'View Donation Details »', 'give' ) |
|
255 | + ) . "\n\n"; |
|
256 | 256 | |
257 | 257 | $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
258 | 258 | $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
110 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
111 | 111 | |
112 | 112 | // setup the payment details |
113 | 113 | $payment_data = array( |
114 | 114 | 'price' => $purchase_data['price'], |
115 | 115 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
116 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
117 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
117 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
118 | 118 | 'date' => $purchase_data['date'], |
119 | 119 | 'user_email' => $purchase_data['user_email'], |
120 | 120 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | // record the pending payment |
129 | - $payment = give_insert_payment( $payment_data ); |
|
129 | + $payment = give_insert_payment($payment_data); |
|
130 | 130 | |
131 | - if ( $payment ) { |
|
132 | - give_offline_send_admin_notice( $payment ); |
|
133 | - give_offline_send_donor_instructions( $payment ); |
|
131 | + if ($payment) { |
|
132 | + give_offline_send_admin_notice($payment); |
|
133 | + give_offline_send_donor_instructions($payment); |
|
134 | 134 | give_send_to_success_page(); |
135 | 135 | } else { |
136 | 136 | // if errors are present, send the user back to the donation form so they can be corrected |
137 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
137 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
142 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** |
@@ -152,59 +152,59 @@ discard block |
||
152 | 152 | * @since 1.0 |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
155 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
156 | 156 | |
157 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
158 | - $post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
157 | + $payment_data = give_get_payment_meta($payment_id); |
|
158 | + $post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
159 | 159 | |
160 | 160 | //Customize email content depending on whether the single form has been customized |
161 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
161 | + $email_content = give_get_option('global_offline_donation_email'); |
|
162 | 162 | |
163 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
164 | - $email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
163 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
164 | + $email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
165 | 165 | } |
166 | 166 | |
167 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
167 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Filters the from name. |
171 | 171 | * |
172 | 172 | * @since 1.7 |
173 | 173 | */ |
174 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
174 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
175 | 175 | |
176 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
176 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Filters the from email. |
180 | 180 | * |
181 | 181 | * @since 1.7 |
182 | 182 | */ |
183 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
183 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
184 | 184 | |
185 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
185 | + $to_email = give_get_payment_user_email($payment_id); |
|
186 | 186 | |
187 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
188 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
189 | - $subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
187 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
188 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
189 | + $subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
193 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
192 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
193 | + $subject = give_do_email_tags($subject, $payment_id); |
|
194 | 194 | |
195 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
196 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
195 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
196 | + $message = give_do_email_tags($email_content, $payment_id); |
|
197 | 197 | |
198 | 198 | $emails = Give()->emails; |
199 | 199 | |
200 | - $emails->__set( 'from_name', $from_name ); |
|
201 | - $emails->__set( 'from_email', $from_email ); |
|
202 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
200 | + $emails->__set('from_name', $from_name); |
|
201 | + $emails->__set('from_email', $from_email); |
|
202 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
203 | 203 | |
204 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
205 | - $emails->__set( 'headers', $headers ); |
|
204 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
205 | + $emails->__set('headers', $headers); |
|
206 | 206 | |
207 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
207 | + $emails->send($to_email, $subject, $message, $attachments); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,54 +221,54 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | * |
223 | 223 | */ |
224 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
224 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
225 | 225 | |
226 | 226 | /* Send an email notification to the admin */ |
227 | 227 | $admin_email = give_get_admin_notice_emails(); |
228 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
228 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
229 | 229 | |
230 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
231 | - $user_data = get_userdata( $user_info['id'] ); |
|
230 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
231 | + $user_data = get_userdata($user_info['id']); |
|
232 | 232 | $name = $user_data->display_name; |
233 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
234 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
233 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
234 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
235 | 235 | } else { |
236 | 236 | $name = $user_info['email']; |
237 | 237 | } |
238 | 238 | |
239 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
239 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
240 | 240 | |
241 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
241 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
242 | 242 | |
243 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
244 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
245 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
243 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
244 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
245 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
246 | 246 | |
247 | 247 | |
248 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
249 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
248 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
249 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | 252 | '<a href="%1$s">%2$s</a>', |
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
253 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
254 | + __('View Donation Details »', 'give') |
|
255 | + )."\n\n"; |
|
256 | 256 | |
257 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
258 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
257 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
258 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
259 | 259 | |
260 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
261 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
260 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
261 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
262 | 262 | |
263 | 263 | //Send Email |
264 | 264 | $emails = Give()->emails; |
265 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
265 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
266 | 266 | |
267 | - if ( ! empty( $admin_headers ) ) { |
|
268 | - $emails->__set( 'headers', $admin_headers ); |
|
267 | + if ( ! empty($admin_headers)) { |
|
268 | + $emails->__set('headers', $admin_headers); |
|
269 | 269 | } |
270 | 270 | |
271 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
271 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return array |
282 | 282 | */ |
283 | -function give_offline_add_settings( $settings ) { |
|
283 | +function give_offline_add_settings($settings) { |
|
284 | 284 | |
285 | 285 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
286 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
286 | + if (in_array('offline', give_get_option('gateways'))) { |
|
287 | 287 | return $settings; |
288 | 288 | } |
289 | 289 | |
290 | 290 | //Vars |
291 | 291 | $prefix = '_give_'; |
292 | 292 | |
293 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
293 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
294 | 294 | |
295 | 295 | //this gateway isn't active |
296 | - if ( ! $is_gateway_active ) { |
|
296 | + if ( ! $is_gateway_active) { |
|
297 | 297 | //return settings and bounce |
298 | 298 | return $settings; |
299 | 299 | } |
@@ -302,34 +302,34 @@ discard block |
||
302 | 302 | $check_settings = array( |
303 | 303 | |
304 | 304 | array( |
305 | - 'name' => __( 'Offline Donations', 'give' ), |
|
306 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
307 | - 'id' => $prefix . 'customize_offline_donations', |
|
305 | + 'name' => __('Offline Donations', 'give'), |
|
306 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
307 | + 'id' => $prefix.'customize_offline_donations', |
|
308 | 308 | 'type' => 'radio_inline', |
309 | 309 | 'default' => 'global', |
310 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
311 | - 'global' => __( 'Global Option', 'give' ), |
|
312 | - 'enabled' => __( 'Customize', 'give' ), |
|
313 | - 'disabled' => __( 'Disable', 'give' ), |
|
310 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
311 | + 'global' => __('Global Option', 'give'), |
|
312 | + 'enabled' => __('Customize', 'give'), |
|
313 | + 'disabled' => __('Disable', 'give'), |
|
314 | 314 | ) |
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Billing Fields', 'give' ), |
|
319 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
320 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
318 | + 'name' => __('Billing Fields', 'give'), |
|
319 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
320 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
321 | 321 | 'row_classes' => 'give-subfield', |
322 | 322 | 'type' => 'radio_inline', |
323 | 323 | 'default' => 'disabled', |
324 | 324 | 'options' => array( |
325 | - 'enabled' => __( 'Enabled', 'give' ), |
|
326 | - 'disabled' => __( 'Disabled', 'give' ), |
|
325 | + 'enabled' => __('Enabled', 'give'), |
|
326 | + 'disabled' => __('Disabled', 'give'), |
|
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | array( |
330 | - 'id' => $prefix . 'offline_checkout_notes', |
|
331 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
332 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
330 | + 'id' => $prefix.'offline_checkout_notes', |
|
331 | + 'name' => __('Donation Instructions', 'give'), |
|
332 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
333 | 333 | 'default' => give_get_default_offline_donation_content(), |
334 | 334 | 'type' => 'wysiwyg', |
335 | 335 | 'row_classes' => 'give-subfield', |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | ) |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'id' => $prefix . 'offline_donation_subject', |
|
342 | - 'name' => __( 'Email Subject', 'give' ), |
|
343 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
344 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
341 | + 'id' => $prefix.'offline_donation_subject', |
|
342 | + 'name' => __('Email Subject', 'give'), |
|
343 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
344 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
345 | 345 | 'row_classes' => 'give-subfield', |
346 | 346 | 'type' => 'text' |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'id' => $prefix . 'offline_donation_email', |
|
350 | - 'name' => __( 'Email Instructions', 'give' ), |
|
351 | - '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(), |
|
349 | + 'id' => $prefix.'offline_donation_email', |
|
350 | + 'name' => __('Email Instructions', 'give'), |
|
351 | + '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(), |
|
352 | 352 | 'default' => give_get_default_offline_donation_email_content(), |
353 | 353 | 'type' => 'wysiwyg', |
354 | 354 | 'row_classes' => 'give-subfield', |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | 'name' => 'offline_docs', |
361 | 361 | 'type' => 'docs_link', |
362 | 362 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
363 | - 'title' => __( 'Offline Donations', 'give' ), |
|
363 | + 'title' => __('Offline Donations', 'give'), |
|
364 | 364 | ), |
365 | 365 | ); |
366 | 366 | |
367 | - return array_merge( $settings, $check_settings ); |
|
367 | + return array_merge($settings, $check_settings); |
|
368 | 368 | } |
369 | 369 | |
370 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
370 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -379,32 +379,32 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | 383 | |
384 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
384 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - __( 'Make a check payable to "%s"', 'give' ), |
|
389 | + __('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
404 | 404 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
405 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
405 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
406 | 406 | |
407 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
407 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -417,34 +417,34 @@ discard block |
||
417 | 417 | */ |
418 | 418 | function give_get_default_offline_donation_email_content() { |
419 | 419 | |
420 | - $sitename = get_bloginfo( 'sitename' ); |
|
421 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
422 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
420 | + $sitename = get_bloginfo('sitename'); |
|
421 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
422 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
423 | 423 | $default_text .= '<ol>'; |
424 | 424 | $default_text .= '<li>'; |
425 | 425 | $default_text .= sprintf( |
426 | 426 | /* translators: %s: site name */ |
427 | - __( 'Make a check payable to "%s"', 'give' ), |
|
427 | + __('Make a check payable to "%s"', 'give'), |
|
428 | 428 | $sitename |
429 | 429 | ); |
430 | 430 | $default_text .= '</li>'; |
431 | 431 | $default_text .= '<li>'; |
432 | 432 | $default_text .= sprintf( |
433 | 433 | /* translators: %s: site name */ |
434 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
434 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
435 | 435 | $sitename |
436 | 436 | ); |
437 | 437 | $default_text .= '</li>'; |
438 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
438 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
439 | 439 | $default_text .= '</ol>'; |
440 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
440 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
441 | 441 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
442 | 442 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
443 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
444 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
445 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
443 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
444 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
445 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
446 | 446 | |
447 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
447 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
448 | 448 | |
449 | 449 | } |
450 | 450 | |
@@ -458,17 +458,17 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string |
460 | 460 | */ |
461 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
462 | - $payment = new Give_Payment( $id ); |
|
461 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
462 | + $payment = new Give_Payment($id); |
|
463 | 463 | |
464 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
464 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
465 | 465 | return $notice; |
466 | 466 | } |
467 | 467 | |
468 | - return give_output_error( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
468 | + return give_output_error(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
469 | 469 | } |
470 | 470 | |
471 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
471 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Add offline payment instruction on payment receipt. |
@@ -479,26 +479,26 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return mixed |
481 | 481 | */ |
482 | -function give_offline_payment_receipt_after( $payment ) { |
|
482 | +function give_offline_payment_receipt_after($payment) { |
|
483 | 483 | // Get payment object. |
484 | - $payment = new Give_Payment( $payment->ID ); |
|
484 | + $payment = new Give_Payment($payment->ID); |
|
485 | 485 | |
486 | 486 | // Bailout. |
487 | - if ( 'offline' !== $payment->gateway ) { |
|
487 | + if ('offline' !== $payment->gateway) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | |
491 | 491 | ?> |
492 | 492 | <tr> |
493 | - <td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td> |
|
493 | + <td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td> |
|
494 | 494 | <td> |
495 | - <?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?> |
|
495 | + <?php echo give_get_offline_payment_instruction($payment->form_id, true); ?> |
|
496 | 496 | </td> |
497 | 497 | </tr> |
498 | 498 | <?php |
499 | 499 | } |
500 | 500 | |
501 | -add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' ); |
|
501 | +add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after'); |
|
502 | 502 | |
503 | 503 | /** |
504 | 504 | * Get offline payment instructions. |
@@ -510,27 +510,27 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
513 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
514 | 514 | // Bailout. |
515 | - if ( ! $form_id ) { |
|
515 | + if ( ! $form_id) { |
|
516 | 516 | return ''; |
517 | 517 | } |
518 | 518 | |
519 | - $post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
520 | - $post_offline_instructions = give_get_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
521 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
519 | + $post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
520 | + $post_offline_instructions = give_get_meta($form_id, '_give_offline_checkout_notes', true); |
|
521 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
522 | 522 | $offline_instructions = $global_offline_instruction; |
523 | 523 | |
524 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
524 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
525 | 525 | $offline_instructions = $post_offline_instructions; |
526 | 526 | } |
527 | 527 | |
528 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
528 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
529 | 529 | |
530 | 530 | /* translators: %s: form settings url */ |
531 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
531 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
532 | 532 | |
533 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
533 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -544,24 +544,24 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return array |
546 | 546 | */ |
547 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
547 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
548 | 548 | if ( |
549 | 549 | // Show offline payment gateway if enable for new donation form. |
550 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
550 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
551 | 551 | && $form_id |
552 | - && ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
552 | + && ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array( |
|
553 | 553 | 'enabled', |
554 | 554 | 'global', |
555 | - ) ) |
|
555 | + )) |
|
556 | 556 | ) { |
557 | - unset( $gateway_list['offline'] ); |
|
557 | + unset($gateway_list['offline']); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | // Output. |
561 | 561 | return $gateway_list; |
562 | 562 | } |
563 | 563 | |
564 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
564 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Set default gateway to global default payment gateway |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return void |
577 | 577 | */ |
578 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
579 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
580 | - give_update_meta( $postid, '_give_default_gateway', 'global' ); |
|
578 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
579 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) { |
|
580 | + give_update_meta($postid, '_give_default_gateway', 'global'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
584 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |