@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | |
65 | 65 | // Maintain active tab query parameter after save. |
66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function get_settings() { |
89 | 89 | $post_id = give_get_admin_post_id(); |
90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
91 | 91 | |
92 | 92 | // Start with an underscore to hide fields from custom fields list |
93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Repeatable Field Groups |
98 | 98 | */ |
99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
100 | 100 | 'id' => 'form_field_options', |
101 | - 'title' => __( 'Donation Options', 'give' ), |
|
101 | + 'title' => __('Donation Options', 'give'), |
|
102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
104 | 104 | // Donation Option. |
105 | 105 | array( |
106 | - 'name' => __( 'Donation Option', 'give' ), |
|
107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
108 | - 'id' => $prefix . 'price_option', |
|
106 | + 'name' => __('Donation Option', 'give'), |
|
107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
108 | + 'id' => $prefix.'price_option', |
|
109 | 109 | 'type' => 'radio_inline', |
110 | 110 | 'default' => 'multi', |
111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
113 | - 'set' => __( 'Set Donation', 'give' ), |
|
114 | - ) ), |
|
111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
113 | + 'set' => __('Set Donation', 'give'), |
|
114 | + )), |
|
115 | 115 | ), |
116 | 116 | array( |
117 | - 'name' => __( 'Set Donation', 'give' ), |
|
118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
119 | - 'id' => $prefix . 'set_price', |
|
117 | + 'name' => __('Set Donation', 'give'), |
|
118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
119 | + 'id' => $prefix.'set_price', |
|
120 | 120 | 'type' => 'text_small', |
121 | 121 | 'data_type' => 'price', |
122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | ), |
127 | 127 | // Display Style. |
128 | 128 | array( |
129 | - 'name' => __( 'Display Style', 'give' ), |
|
130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
131 | - 'id' => $prefix . 'display_style', |
|
129 | + 'name' => __('Display Style', 'give'), |
|
130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
131 | + 'id' => $prefix.'display_style', |
|
132 | 132 | 'type' => 'radio_inline', |
133 | 133 | 'default' => 'buttons', |
134 | 134 | 'options' => array( |
135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
136 | - 'radios' => __( 'Radios', 'give' ), |
|
137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
135 | + 'buttons' => __('Buttons', 'give'), |
|
136 | + 'radios' => __('Radios', 'give'), |
|
137 | + 'dropdown' => __('Dropdown', 'give'), |
|
138 | 138 | ), |
139 | 139 | 'wrapper_class' => 'give-hidden', |
140 | 140 | ), |
141 | 141 | // Custom Amount. |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'disabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Donation Limit', 'give' ), |
|
155 | - 'description' => __( 'Set the minimum and maximum amount for all gateways.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_range', |
|
154 | + 'name' => __('Donation Limit', 'give'), |
|
155 | + 'description' => __('Set the minimum and maximum amount for all gateways.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_range', |
|
157 | 157 | 'type' => 'donation_limit', |
158 | 158 | 'wrapper_class' => 'give-hidden', |
159 | 159 | 'data_type' => 'price', |
@@ -162,43 +162,43 @@ discard block |
||
162 | 162 | 'class' => 'give-money-field', |
163 | 163 | ), |
164 | 164 | 'options' => array( |
165 | - 'display_label' => __( 'Donation Limits: ', 'give' ), |
|
166 | - 'minimum' => give_format_decimal( '1.00', false, false ), |
|
167 | - 'maximum' => give_format_decimal( '999999.99', false, false ), |
|
165 | + 'display_label' => __('Donation Limits: ', 'give'), |
|
166 | + 'minimum' => give_format_decimal('1.00', false, false), |
|
167 | + 'maximum' => give_format_decimal('999999.99', false, false), |
|
168 | 168 | ), |
169 | 169 | ), |
170 | 170 | array( |
171 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
172 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
173 | - 'id' => $prefix . 'custom_amount_text', |
|
171 | + 'name' => __('Custom Amount Text', 'give'), |
|
172 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
173 | + 'id' => $prefix.'custom_amount_text', |
|
174 | 174 | 'type' => 'text_medium', |
175 | 175 | 'attributes' => array( |
176 | 176 | 'rows' => 3, |
177 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
177 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
178 | 178 | ), |
179 | 179 | 'wrapper_class' => 'give-hidden', |
180 | 180 | ), |
181 | 181 | // Donation Levels. |
182 | 182 | array( |
183 | - 'id' => $prefix . 'donation_levels', |
|
183 | + 'id' => $prefix.'donation_levels', |
|
184 | 184 | 'type' => 'group', |
185 | 185 | 'options' => array( |
186 | - 'add_button' => __( 'Add Level', 'give' ), |
|
187 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
186 | + 'add_button' => __('Add Level', 'give'), |
|
187 | + 'header_title' => __('Donation Level', 'give'), |
|
188 | 188 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
189 | 189 | ), |
190 | 190 | 'wrapper_class' => 'give-hidden', |
191 | 191 | // Fields array works the same, except id's only need to be unique for this group. |
192 | 192 | // Prefix is not needed. |
193 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
193 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
194 | 194 | array( |
195 | - 'name' => __( 'ID', 'give' ), |
|
196 | - 'id' => $prefix . 'id', |
|
195 | + 'name' => __('ID', 'give'), |
|
196 | + 'id' => $prefix.'id', |
|
197 | 197 | 'type' => 'levels_id', |
198 | 198 | ), |
199 | 199 | array( |
200 | - 'name' => __( 'Amount', 'give' ), |
|
201 | - 'id' => $prefix . 'amount', |
|
200 | + 'name' => __('Amount', 'give'), |
|
201 | + 'id' => $prefix.'amount', |
|
202 | 202 | 'type' => 'text_small', |
203 | 203 | 'data_type' => 'price', |
204 | 204 | 'attributes' => array( |
@@ -207,95 +207,95 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | array( |
210 | - 'name' => __( 'Text', 'give' ), |
|
211 | - 'id' => $prefix . 'text', |
|
210 | + 'name' => __('Text', 'give'), |
|
211 | + 'id' => $prefix.'text', |
|
212 | 212 | 'type' => 'text', |
213 | 213 | 'attributes' => array( |
214 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
214 | + 'placeholder' => __('Donation Level', 'give'), |
|
215 | 215 | 'class' => 'give-multilevel-text-field', |
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => __( 'Default', 'give' ), |
|
220 | - 'id' => $prefix . 'default', |
|
219 | + 'name' => __('Default', 'give'), |
|
220 | + 'id' => $prefix.'default', |
|
221 | 221 | 'type' => 'give_default_radio_inline', |
222 | 222 | ), |
223 | - ) ), |
|
223 | + )), |
|
224 | 224 | ), |
225 | 225 | array( |
226 | 226 | 'name' => 'donation_options_docs', |
227 | 227 | 'type' => 'docs_link', |
228 | 228 | 'url' => 'http://docs.givewp.com/form-donation-options', |
229 | - 'title' => __( 'Donation Options', 'give' ), |
|
229 | + 'title' => __('Donation Options', 'give'), |
|
230 | 230 | ), |
231 | 231 | ), |
232 | 232 | $post_id |
233 | 233 | ), |
234 | - ) ), |
|
234 | + )), |
|
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Display Options |
238 | 238 | */ |
239 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
239 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
240 | 240 | 'id' => 'form_display_options', |
241 | - 'title' => __( 'Form Display', 'give' ), |
|
241 | + 'title' => __('Form Display', 'give'), |
|
242 | 242 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
243 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
243 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
244 | 244 | array( |
245 | - 'name' => __( 'Display Options', 'give' ), |
|
246 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
247 | - 'id' => $prefix . 'payment_display', |
|
245 | + 'name' => __('Display Options', 'give'), |
|
246 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
247 | + 'id' => $prefix.'payment_display', |
|
248 | 248 | 'type' => 'radio_inline', |
249 | 249 | 'options' => array( |
250 | - 'onpage' => __( 'All Fields', 'give' ), |
|
251 | - 'modal' => __( 'Modal', 'give' ), |
|
252 | - 'reveal' => __( 'Reveal', 'give' ), |
|
253 | - 'button' => __( 'Button', 'give' ), |
|
250 | + 'onpage' => __('All Fields', 'give'), |
|
251 | + 'modal' => __('Modal', 'give'), |
|
252 | + 'reveal' => __('Reveal', 'give'), |
|
253 | + 'button' => __('Button', 'give'), |
|
254 | 254 | ), |
255 | 255 | 'default' => 'onpage', |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'id' => $prefix . 'reveal_label', |
|
259 | - 'name' => __( 'Continue Button', 'give' ), |
|
260 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
258 | + 'id' => $prefix.'reveal_label', |
|
259 | + 'name' => __('Continue Button', 'give'), |
|
260 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
261 | 261 | 'type' => 'text_small', |
262 | 262 | 'attributes' => array( |
263 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
263 | + 'placeholder' => __('Donate Now', 'give'), |
|
264 | 264 | ), |
265 | 265 | 'wrapper_class' => 'give-hidden', |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Name Title Prefix', 'give' ), |
|
284 | - 'desc' => __( 'Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give' ), |
|
285 | - 'id' => $prefix . 'name_title_prefix', |
|
283 | + 'name' => __('Name Title Prefix', 'give'), |
|
284 | + 'desc' => __('Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give'), |
|
285 | + 'id' => $prefix.'name_title_prefix', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'options' => array( |
288 | - 'global' => __( 'Global Option', 'give' ), |
|
289 | - 'required' => __( 'Required', 'give' ), |
|
290 | - 'optional' => __( 'Optional', 'give' ), |
|
291 | - 'disabled' => __( 'Disabled', 'give' ), |
|
288 | + 'global' => __('Global Option', 'give'), |
|
289 | + 'required' => __('Required', 'give'), |
|
290 | + 'optional' => __('Optional', 'give'), |
|
291 | + 'disabled' => __('Disabled', 'give'), |
|
292 | 292 | ), |
293 | 293 | 'default' => 'global', |
294 | 294 | ), |
295 | 295 | array( |
296 | - 'name' => __( 'Title Prefixes', 'give' ), |
|
297 | - 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
|
298 | - 'id' => $prefix . 'title_prefixes', |
|
296 | + 'name' => __('Title Prefixes', 'give'), |
|
297 | + 'desc' => __('Add or remove salutations from the dropdown using the field above.', 'give'), |
|
298 | + 'id' => $prefix.'title_prefixes', |
|
299 | 299 | 'type' => 'chosen', |
300 | 300 | 'data_type' => 'multiselect', |
301 | 301 | 'style' => 'width: 100%', |
@@ -303,77 +303,77 @@ discard block |
||
303 | 303 | 'options' => give_get_default_title_prefixes(), |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => __( 'Company Donations', 'give' ), |
|
307 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
|
308 | - 'id' => $prefix . 'company_field', |
|
306 | + 'name' => __('Company Donations', 'give'), |
|
307 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name?', 'give'), |
|
308 | + 'id' => $prefix.'company_field', |
|
309 | 309 | 'type' => 'radio_inline', |
310 | 310 | 'default' => 'global', |
311 | 311 | 'options' => array( |
312 | - 'global' => __( 'Global Option', 'give' ), |
|
313 | - 'required' => __( 'Required', 'give' ), |
|
314 | - 'optional' => __( 'Optional', 'give' ), |
|
315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
312 | + 'global' => __('Global Option', 'give'), |
|
313 | + 'required' => __('Required', 'give'), |
|
314 | + 'optional' => __('Optional', 'give'), |
|
315 | + 'disabled' => __('Disabled', 'give'), |
|
316 | 316 | |
317 | 317 | ), |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Anonymous Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
|
320 | + 'name' => __('Anonymous Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give'), |
|
322 | 322 | 'id' => "{$prefix}anonymous_donation", |
323 | 323 | 'type' => 'radio_inline', |
324 | 324 | 'default' => 'global', |
325 | 325 | 'options' => array( |
326 | - 'global' => __( 'Global Option', 'give' ), |
|
327 | - 'enabled' => __( 'Enabled', 'give' ), |
|
328 | - 'disabled' => __( 'Disabled', 'give' ), |
|
326 | + 'global' => __('Global Option', 'give'), |
|
327 | + 'enabled' => __('Enabled', 'give'), |
|
328 | + 'disabled' => __('Disabled', 'give'), |
|
329 | 329 | ), |
330 | 330 | ), |
331 | 331 | array( |
332 | - 'name' => __( 'Donor Comment', 'give' ), |
|
333 | - 'desc' => __( 'Would you like donors to give option to add his/her thought while donaitng.', 'give' ), |
|
332 | + 'name' => __('Donor Comment', 'give'), |
|
333 | + 'desc' => __('Would you like donors to give option to add his/her thought while donaitng.', 'give'), |
|
334 | 334 | 'id' => "{$prefix}donor_comment", |
335 | 335 | 'type' => 'radio_inline', |
336 | 336 | 'default' => 'global', |
337 | 337 | 'options' => array( |
338 | - 'global' => __( 'Global Option', 'give' ), |
|
339 | - 'enabled' => __( 'Enabled', 'give' ), |
|
340 | - 'disabled' => __( 'Disabled', 'give' ), |
|
338 | + 'global' => __('Global Option', 'give'), |
|
339 | + 'enabled' => __('Enabled', 'give'), |
|
340 | + 'disabled' => __('Disabled', 'give'), |
|
341 | 341 | ), |
342 | 342 | ), |
343 | 343 | array( |
344 | - 'name' => __( 'Guest Donations', 'give' ), |
|
345 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
346 | - 'id' => $prefix . 'logged_in_only', |
|
344 | + 'name' => __('Guest Donations', 'give'), |
|
345 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
346 | + 'id' => $prefix.'logged_in_only', |
|
347 | 347 | 'type' => 'radio_inline', |
348 | 348 | 'default' => 'enabled', |
349 | 349 | 'options' => array( |
350 | - 'enabled' => __( 'Enabled', 'give' ), |
|
351 | - 'disabled' => __( 'Disabled', 'give' ), |
|
350 | + 'enabled' => __('Enabled', 'give'), |
|
351 | + 'disabled' => __('Disabled', 'give'), |
|
352 | 352 | ), |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => __( 'Registration', 'give' ), |
|
356 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
357 | - 'id' => $prefix . 'show_register_form', |
|
355 | + 'name' => __('Registration', 'give'), |
|
356 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
357 | + 'id' => $prefix.'show_register_form', |
|
358 | 358 | 'type' => 'radio', |
359 | 359 | 'options' => array( |
360 | - 'none' => __( 'None', 'give' ), |
|
361 | - 'registration' => __( 'Registration', 'give' ), |
|
362 | - 'login' => __( 'Login', 'give' ), |
|
363 | - 'both' => __( 'Registration + Login', 'give' ), |
|
360 | + 'none' => __('None', 'give'), |
|
361 | + 'registration' => __('Registration', 'give'), |
|
362 | + 'login' => __('Login', 'give'), |
|
363 | + 'both' => __('Registration + Login', 'give'), |
|
364 | 364 | ), |
365 | 365 | 'default' => 'none', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Floating Labels', 'give' ), |
|
368 | + 'name' => __('Floating Labels', 'give'), |
|
369 | 369 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
370 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
371 | - 'id' => $prefix . 'form_floating_labels', |
|
370 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
371 | + 'id' => $prefix.'form_floating_labels', |
|
372 | 372 | 'type' => 'radio_inline', |
373 | 373 | 'options' => array( |
374 | - 'global' => __( 'Global Option', 'give' ), |
|
375 | - 'enabled' => __( 'Enabled', 'give' ), |
|
376 | - 'disabled' => __( 'Disabled', 'give' ), |
|
374 | + 'global' => __('Global Option', 'give'), |
|
375 | + 'enabled' => __('Enabled', 'give'), |
|
376 | + 'disabled' => __('Disabled', 'give'), |
|
377 | 377 | ), |
378 | 378 | 'default' => 'global', |
379 | 379 | ), |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | 'name' => 'form_display_docs', |
382 | 382 | 'type' => 'docs_link', |
383 | 383 | 'url' => 'http://docs.givewp.com/form-display-options', |
384 | - 'title' => __( 'Form Display', 'give' ), |
|
384 | + 'title' => __('Form Display', 'give'), |
|
385 | 385 | ), |
386 | 386 | ), |
387 | 387 | $post_id |
@@ -392,42 +392,42 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * Donation Goals |
394 | 394 | */ |
395 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
395 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
396 | 396 | 'id' => 'donation_goal_options', |
397 | - 'title' => __( 'Donation Goal', 'give' ), |
|
397 | + 'title' => __('Donation Goal', 'give'), |
|
398 | 398 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
399 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
399 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
400 | 400 | // Goals |
401 | 401 | array( |
402 | - 'name' => __( 'Donation Goal', 'give' ), |
|
403 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
404 | - 'id' => $prefix . 'goal_option', |
|
402 | + 'name' => __('Donation Goal', 'give'), |
|
403 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
404 | + 'id' => $prefix.'goal_option', |
|
405 | 405 | 'type' => 'radio_inline', |
406 | 406 | 'default' => 'disabled', |
407 | 407 | 'options' => array( |
408 | - 'enabled' => __( 'Enabled', 'give' ), |
|
409 | - 'disabled' => __( 'Disabled', 'give' ), |
|
408 | + 'enabled' => __('Enabled', 'give'), |
|
409 | + 'disabled' => __('Disabled', 'give'), |
|
410 | 410 | ), |
411 | 411 | ), |
412 | 412 | |
413 | 413 | array( |
414 | - 'name' => __( 'Goal Format', 'give' ), |
|
415 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ), |
|
416 | - 'id' => $prefix . 'goal_format', |
|
414 | + 'name' => __('Goal Format', 'give'), |
|
415 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give'), |
|
416 | + 'id' => $prefix.'goal_format', |
|
417 | 417 | 'type' => 'donation_form_goal', |
418 | 418 | 'default' => 'amount', |
419 | 419 | 'options' => array( |
420 | - 'amount' => __( 'Amount Raised', 'give' ), |
|
421 | - 'percentage' => __( 'Percentage Raised', 'give' ), |
|
422 | - 'donation' => __( 'Number of Donations', 'give' ), |
|
423 | - 'donors' => __( 'Number of Donors', 'give' ), |
|
420 | + 'amount' => __('Amount Raised', 'give'), |
|
421 | + 'percentage' => __('Percentage Raised', 'give'), |
|
422 | + 'donation' => __('Number of Donations', 'give'), |
|
423 | + 'donors' => __('Number of Donors', 'give'), |
|
424 | 424 | ), |
425 | 425 | ), |
426 | 426 | |
427 | 427 | array( |
428 | - 'name' => __( 'Goal Amount', 'give' ), |
|
429 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
430 | - 'id' => $prefix . 'set_goal', |
|
428 | + 'name' => __('Goal Amount', 'give'), |
|
429 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
430 | + 'id' => $prefix.'set_goal', |
|
431 | 431 | 'type' => 'text_small', |
432 | 432 | 'data_type' => 'price', |
433 | 433 | 'attributes' => array( |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | 'wrapper_class' => 'give-hidden', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'id' => $prefix . 'number_of_donation_goal', |
|
441 | - 'name' => __( 'Donation Goal', 'give' ), |
|
442 | - 'desc' => __( 'Set the total number of donations as a goal.', 'give' ), |
|
440 | + 'id' => $prefix.'number_of_donation_goal', |
|
441 | + 'name' => __('Donation Goal', 'give'), |
|
442 | + 'desc' => __('Set the total number of donations as a goal.', 'give'), |
|
443 | 443 | 'type' => 'number', |
444 | 444 | 'default' => 1, |
445 | 445 | 'attributes' => array( |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | ), |
448 | 448 | ), |
449 | 449 | array( |
450 | - 'id' => $prefix . 'number_of_donor_goal', |
|
451 | - 'name' => __( 'Donor Goal', 'give' ), |
|
452 | - 'desc' => __( 'Set the total number of donors as a goal.', 'give' ), |
|
450 | + 'id' => $prefix.'number_of_donor_goal', |
|
451 | + 'name' => __('Donor Goal', 'give'), |
|
452 | + 'desc' => __('Set the total number of donors as a goal.', 'give'), |
|
453 | 453 | 'type' => 'number', |
454 | 454 | 'default' => 1, |
455 | 455 | 'attributes' => array( |
@@ -457,85 +457,85 @@ discard block |
||
457 | 457 | ), |
458 | 458 | ), |
459 | 459 | array( |
460 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
461 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
462 | - 'id' => $prefix . 'goal_color', |
|
460 | + 'name' => __('Progress Bar Color', 'give'), |
|
461 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
462 | + 'id' => $prefix.'goal_color', |
|
463 | 463 | 'type' => 'colorpicker', |
464 | 464 | 'default' => '#2bc253', |
465 | 465 | 'wrapper_class' => 'give-hidden', |
466 | 466 | ), |
467 | 467 | |
468 | 468 | array( |
469 | - 'name' => __( 'Close Form', 'give' ), |
|
470 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
471 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
469 | + 'name' => __('Close Form', 'give'), |
|
470 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
471 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
472 | 472 | 'type' => 'radio_inline', |
473 | 473 | 'default' => 'disabled', |
474 | 474 | 'options' => array( |
475 | - 'enabled' => __( 'Enabled', 'give' ), |
|
476 | - 'disabled' => __( 'Disabled', 'give' ), |
|
475 | + 'enabled' => __('Enabled', 'give'), |
|
476 | + 'disabled' => __('Disabled', 'give'), |
|
477 | 477 | ), |
478 | 478 | 'wrapper_class' => 'give-hidden', |
479 | 479 | ), |
480 | 480 | array( |
481 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
482 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
483 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
481 | + 'name' => __('Goal Achieved Message', 'give'), |
|
482 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
483 | + 'id' => $prefix.'form_goal_achieved_message', |
|
484 | 484 | 'type' => 'wysiwyg', |
485 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
485 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
486 | 486 | 'wrapper_class' => 'give-hidden', |
487 | 487 | ), |
488 | 488 | array( |
489 | 489 | 'name' => 'donation_goal_docs', |
490 | 490 | 'type' => 'docs_link', |
491 | 491 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
492 | - 'title' => __( 'Donation Goal', 'give' ), |
|
492 | + 'title' => __('Donation Goal', 'give'), |
|
493 | 493 | ), |
494 | 494 | ), |
495 | 495 | $post_id |
496 | 496 | ), |
497 | - ) ), |
|
497 | + )), |
|
498 | 498 | |
499 | 499 | /** |
500 | 500 | * Content Field |
501 | 501 | */ |
502 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
502 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
503 | 503 | 'id' => 'form_content_options', |
504 | - 'title' => __( 'Form Content', 'give' ), |
|
504 | + 'title' => __('Form Content', 'give'), |
|
505 | 505 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
506 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
506 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
507 | 507 | |
508 | 508 | // Donation content. |
509 | 509 | array( |
510 | - 'name' => __( 'Display Content', 'give' ), |
|
511 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
512 | - 'id' => $prefix . 'display_content', |
|
510 | + 'name' => __('Display Content', 'give'), |
|
511 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
512 | + 'id' => $prefix.'display_content', |
|
513 | 513 | 'type' => 'radio_inline', |
514 | 514 | 'options' => array( |
515 | - 'enabled' => __( 'Enabled', 'give' ), |
|
516 | - 'disabled' => __( 'Disabled', 'give' ), |
|
515 | + 'enabled' => __('Enabled', 'give'), |
|
516 | + 'disabled' => __('Disabled', 'give'), |
|
517 | 517 | ), |
518 | 518 | 'default' => 'disabled', |
519 | 519 | ), |
520 | 520 | |
521 | 521 | // Content placement. |
522 | 522 | array( |
523 | - 'name' => __( 'Content Placement', 'give' ), |
|
524 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
525 | - 'id' => $prefix . 'content_placement', |
|
523 | + 'name' => __('Content Placement', 'give'), |
|
524 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
525 | + 'id' => $prefix.'content_placement', |
|
526 | 526 | 'type' => 'radio_inline', |
527 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
528 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
529 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
527 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
528 | + 'give_pre_form' => __('Above fields', 'give'), |
|
529 | + 'give_post_form' => __('Below fields', 'give'), |
|
530 | 530 | ) |
531 | 531 | ), |
532 | 532 | 'default' => 'give_pre_form', |
533 | 533 | 'wrapper_class' => 'give-hidden', |
534 | 534 | ), |
535 | 535 | array( |
536 | - 'name' => __( 'Content', 'give' ), |
|
537 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
538 | - 'id' => $prefix . 'form_content', |
|
536 | + 'name' => __('Content', 'give'), |
|
537 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
538 | + 'id' => $prefix.'form_content', |
|
539 | 539 | 'type' => 'wysiwyg', |
540 | 540 | 'wrapper_class' => 'give-hidden', |
541 | 541 | ), |
@@ -543,51 +543,51 @@ discard block |
||
543 | 543 | 'name' => 'form_content_docs', |
544 | 544 | 'type' => 'docs_link', |
545 | 545 | 'url' => 'http://docs.givewp.com/form-content', |
546 | - 'title' => __( 'Form Content', 'give' ), |
|
546 | + 'title' => __('Form Content', 'give'), |
|
547 | 547 | ), |
548 | 548 | ), |
549 | 549 | $post_id |
550 | 550 | ), |
551 | - ) ), |
|
551 | + )), |
|
552 | 552 | |
553 | 553 | /** |
554 | 554 | * Terms & Conditions |
555 | 555 | */ |
556 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
556 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
557 | 557 | 'id' => 'form_terms_options', |
558 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
558 | + 'title' => __('Terms & Conditions', 'give'), |
|
559 | 559 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
560 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
560 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
561 | 561 | // Donation Option |
562 | 562 | array( |
563 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
564 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
565 | - 'id' => $prefix . 'terms_option', |
|
563 | + 'name' => __('Terms and Conditions', 'give'), |
|
564 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
565 | + 'id' => $prefix.'terms_option', |
|
566 | 566 | 'type' => 'radio_inline', |
567 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
568 | - 'global' => __( 'Global Option', 'give' ), |
|
569 | - 'enabled' => __( 'Customize', 'give' ), |
|
570 | - 'disabled' => __( 'Disable', 'give' ), |
|
567 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
568 | + 'global' => __('Global Option', 'give'), |
|
569 | + 'enabled' => __('Customize', 'give'), |
|
570 | + 'disabled' => __('Disable', 'give'), |
|
571 | 571 | ) |
572 | 572 | ), |
573 | 573 | 'default' => 'global', |
574 | 574 | ), |
575 | 575 | array( |
576 | - 'id' => $prefix . 'agree_label', |
|
577 | - 'name' => __( 'Agreement Label', 'give' ), |
|
578 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
576 | + 'id' => $prefix.'agree_label', |
|
577 | + 'name' => __('Agreement Label', 'give'), |
|
578 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
579 | 579 | 'type' => 'textarea', |
580 | 580 | 'attributes' => array( |
581 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
581 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
582 | 582 | 'rows' => 1 |
583 | 583 | ), |
584 | 584 | 'wrapper_class' => 'give-hidden', |
585 | 585 | ), |
586 | 586 | array( |
587 | - 'id' => $prefix . 'agree_text', |
|
588 | - 'name' => __( 'Agreement Text', 'give' ), |
|
589 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
590 | - 'default' => give_get_option( 'agreement_text' ), |
|
587 | + 'id' => $prefix.'agree_text', |
|
588 | + 'name' => __('Agreement Text', 'give'), |
|
589 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
590 | + 'default' => give_get_option('agreement_text'), |
|
591 | 591 | 'type' => 'wysiwyg', |
592 | 592 | 'wrapper_class' => 'give-hidden', |
593 | 593 | ), |
@@ -595,18 +595,18 @@ discard block |
||
595 | 595 | 'name' => 'terms_docs', |
596 | 596 | 'type' => 'docs_link', |
597 | 597 | 'url' => 'http://docs.givewp.com/form-terms', |
598 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
598 | + 'title' => __('Terms and Conditions', 'give'), |
|
599 | 599 | ), |
600 | 600 | ), |
601 | 601 | $post_id |
602 | 602 | ), |
603 | - ) ), |
|
603 | + )), |
|
604 | 604 | ); |
605 | 605 | |
606 | 606 | /** |
607 | 607 | * Filter the metabox tabbed panel settings. |
608 | 608 | */ |
609 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
609 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
610 | 610 | |
611 | 611 | // Output. |
612 | 612 | return $settings; |
@@ -623,19 +623,19 @@ discard block |
||
623 | 623 | add_meta_box( |
624 | 624 | $this->get_metabox_ID(), |
625 | 625 | $this->get_metabox_label(), |
626 | - array( $this, 'output' ), |
|
627 | - array( 'give_forms' ), |
|
626 | + array($this, 'output'), |
|
627 | + array('give_forms'), |
|
628 | 628 | 'normal', |
629 | 629 | 'high' |
630 | 630 | ); |
631 | 631 | |
632 | 632 | // Show Goal Metabox only if goal is enabled. |
633 | - if ( give_is_setting_enabled( give_get_meta( give_get_admin_post_id(), '_give_goal_option', true ) ) ) { |
|
633 | + if (give_is_setting_enabled(give_get_meta(give_get_admin_post_id(), '_give_goal_option', true))) { |
|
634 | 634 | add_meta_box( |
635 | 635 | 'give-form-goal-stats', |
636 | - __( 'Goal Statistics', 'give' ), |
|
637 | - array( $this, 'output_goal' ), |
|
638 | - array( 'give_forms' ), |
|
636 | + __('Goal Statistics', 'give'), |
|
637 | + array($this, 'output_goal'), |
|
638 | + array('give_forms'), |
|
639 | 639 | 'side', |
640 | 640 | 'low' |
641 | 641 | ); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | function enqueue_script() { |
655 | 655 | global $post; |
656 | 656 | |
657 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
657 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
658 | 658 | |
659 | 659 | } |
660 | 660 | } |
@@ -692,32 +692,32 @@ discard block |
||
692 | 692 | public function get_tabs() { |
693 | 693 | $tabs = array(); |
694 | 694 | |
695 | - if ( ! empty( $this->settings ) ) { |
|
696 | - foreach ( $this->settings as $setting ) { |
|
697 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
695 | + if ( ! empty($this->settings)) { |
|
696 | + foreach ($this->settings as $setting) { |
|
697 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
698 | 698 | continue; |
699 | 699 | } |
700 | 700 | $tab = array( |
701 | 701 | 'id' => $setting['id'], |
702 | 702 | 'label' => $setting['title'], |
703 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
703 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
704 | 704 | ); |
705 | 705 | |
706 | - if ( $this->has_sub_tab( $setting ) ) { |
|
707 | - if ( empty( $setting['sub-fields'] ) ) { |
|
706 | + if ($this->has_sub_tab($setting)) { |
|
707 | + if (empty($setting['sub-fields'])) { |
|
708 | 708 | $tab = array(); |
709 | 709 | } else { |
710 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
710 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
711 | 711 | $tab['sub-fields'][] = array( |
712 | 712 | 'id' => $sub_fields['id'], |
713 | 713 | 'label' => $sub_fields['title'], |
714 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
714 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
715 | 715 | ); |
716 | 716 | } |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
720 | - if ( ! empty( $tab ) ) { |
|
720 | + if ( ! empty($tab)) { |
|
721 | 721 | $tabs[] = $tab; |
722 | 722 | } |
723 | 723 | } |
@@ -735,35 +735,35 @@ discard block |
||
735 | 735 | */ |
736 | 736 | public function output() { |
737 | 737 | // Bailout. |
738 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
739 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
740 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
738 | + if ($form_data_tabs = $this->get_tabs()) : |
|
739 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
740 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
741 | 741 | ?> |
742 | 742 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
743 | 743 | <div class="give-metabox-panel-wrap"> |
744 | 744 | <ul class="give-form-data-tabs give-metabox-tabs"> |
745 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
745 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
746 | 746 | <?php |
747 | 747 | // Determine if current tab is active. |
748 | 748 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
749 | 749 | ?> |
750 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
750 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
751 | 751 | <a href="#<?php echo $form_data_tab['id']; ?>" |
752 | 752 | data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
753 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
753 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
754 | 754 | <?php echo $form_data_tab['icon-html']; ?> |
755 | 755 | <?php else : ?> |
756 | 756 | <span class="give-icon give-icon-default"></span> |
757 | 757 | <?php endif; ?> |
758 | 758 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
759 | 759 | </a> |
760 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
760 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
761 | 761 | <ul class="give-metabox-sub-tabs give-hidden"> |
762 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
762 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
763 | 763 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
764 | 764 | <a href="#<?php echo $sub_tab['id']; ?>" |
765 | 765 | data-tab-id="<?php echo $sub_tab['id']; ?>"> |
766 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
766 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
767 | 767 | <?php echo $sub_tab['icon-html']; ?> |
768 | 768 | <?php else : ?> |
769 | 769 | <span class="give-icon give-icon-default"></span> |
@@ -778,30 +778,30 @@ discard block |
||
778 | 778 | <?php endforeach; ?> |
779 | 779 | </ul> |
780 | 780 | |
781 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
782 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
781 | + <?php foreach ($this->settings as $setting) : ?> |
|
782 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
783 | 783 | <?php |
784 | 784 | // Determine if current panel is active. |
785 | 785 | $is_active = $active_tab === $setting['id'] ? true : false; |
786 | 786 | ?> |
787 | 787 | <div id="<?php echo $setting['id']; ?>" |
788 | - class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
789 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
790 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
791 | - <?php give_render_field( $field ); ?> |
|
788 | + class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
789 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
790 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
791 | + <?php give_render_field($field); ?> |
|
792 | 792 | <?php endforeach; ?> |
793 | 793 | <?php endif; ?> |
794 | 794 | </div> |
795 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
795 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
796 | 796 | |
797 | 797 | |
798 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
799 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
800 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
798 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
799 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
800 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
801 | 801 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
802 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
803 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
804 | - <?php give_render_field( $sub_field ); ?> |
|
802 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
803 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
804 | + <?php give_render_field($sub_field); ?> |
|
805 | 805 | <?php endforeach; ?> |
806 | 806 | <?php endif; ?> |
807 | 807 | </div> |
@@ -824,9 +824,9 @@ discard block |
||
824 | 824 | * |
825 | 825 | * @return void |
826 | 826 | */ |
827 | - public function output_goal( $post ) { |
|
827 | + public function output_goal($post) { |
|
828 | 828 | |
829 | - echo give_admin_form_goal_stats( $post->ID ); |
|
829 | + echo give_admin_form_goal_stats($post->ID); |
|
830 | 830 | |
831 | 831 | } |
832 | 832 | |
@@ -839,9 +839,9 @@ discard block |
||
839 | 839 | * |
840 | 840 | * @return bool |
841 | 841 | */ |
842 | - private function has_sub_tab( $field_setting ) { |
|
842 | + private function has_sub_tab($field_setting) { |
|
843 | 843 | $has_sub_tab = false; |
844 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
844 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
845 | 845 | $has_sub_tab = true; |
846 | 846 | } |
847 | 847 | |
@@ -856,13 +856,13 @@ discard block |
||
856 | 856 | * @return array |
857 | 857 | */ |
858 | 858 | function cmb2_metabox_settings() { |
859 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
859 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
860 | 860 | $give_forms_settings = $all_cmb2_settings; |
861 | 861 | |
862 | 862 | // Filter settings: Use only give forms related settings. |
863 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
864 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
865 | - unset( $give_forms_settings[ $index ] ); |
|
863 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
864 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
865 | + unset($give_forms_settings[$index]); |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
@@ -880,100 +880,100 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @return void |
882 | 882 | */ |
883 | - public function save( $post_id, $post ) { |
|
883 | + public function save($post_id, $post) { |
|
884 | 884 | |
885 | 885 | // $post_id and $post are required. |
886 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
886 | + if (empty($post_id) || empty($post)) { |
|
887 | 887 | return; |
888 | 888 | } |
889 | 889 | |
890 | 890 | // Don't save meta boxes for revisions or autosaves. |
891 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
891 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
892 | 892 | return; |
893 | 893 | } |
894 | 894 | |
895 | 895 | // Check the nonce. |
896 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
896 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
897 | 897 | return; |
898 | 898 | } |
899 | 899 | |
900 | 900 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
901 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
901 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
902 | 902 | return; |
903 | 903 | } |
904 | 904 | |
905 | 905 | // Check user has permission to edit. |
906 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
906 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
907 | 907 | return; |
908 | 908 | } |
909 | 909 | |
910 | 910 | // Fire action before saving form meta. |
911 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
911 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
912 | 912 | |
913 | 913 | /** |
914 | 914 | * Filter the meta key to save. |
915 | 915 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
916 | 916 | */ |
917 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
917 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
918 | 918 | |
919 | 919 | // Save form meta data. |
920 | - if ( ! empty( $form_meta_keys ) ) { |
|
921 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
920 | + if ( ! empty($form_meta_keys)) { |
|
921 | + foreach ($form_meta_keys as $form_meta_key) { |
|
922 | 922 | |
923 | 923 | // Set default value for checkbox fields. |
924 | 924 | if ( |
925 | - ! isset( $_POST[ $form_meta_key ] ) && |
|
926 | - in_array( $this->get_field_type( $form_meta_key ), array( 'checkbox', 'chosen' ) ) |
|
925 | + ! isset($_POST[$form_meta_key]) && |
|
926 | + in_array($this->get_field_type($form_meta_key), array('checkbox', 'chosen')) |
|
927 | 927 | ) { |
928 | - $_POST[ $form_meta_key ] = ''; |
|
928 | + $_POST[$form_meta_key] = ''; |
|
929 | 929 | } |
930 | 930 | |
931 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
932 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
933 | - if ( ! empty( $setting_field['type'] ) ) { |
|
934 | - switch ( $setting_field['type'] ) { |
|
931 | + if (isset($_POST[$form_meta_key])) { |
|
932 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
933 | + if ( ! empty($setting_field['type'])) { |
|
934 | + switch ($setting_field['type']) { |
|
935 | 935 | case 'textarea': |
936 | 936 | case 'wysiwyg': |
937 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
937 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
938 | 938 | break; |
939 | 939 | |
940 | 940 | case 'donation_limit' : |
941 | - $form_meta_value = $_POST[ $form_meta_key ]; |
|
941 | + $form_meta_value = $_POST[$form_meta_key]; |
|
942 | 942 | break; |
943 | 943 | |
944 | 944 | case 'group': |
945 | 945 | $form_meta_value = array(); |
946 | 946 | |
947 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
947 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
948 | 948 | |
949 | 949 | // Do not save template input field values. |
950 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
950 | + if ('{{row-count-placeholder}}' === $index) { |
|
951 | 951 | continue; |
952 | 952 | } |
953 | 953 | |
954 | 954 | $group_meta_value = array(); |
955 | - foreach ( $group as $field_id => $field_value ) { |
|
956 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
955 | + foreach ($group as $field_id => $field_value) { |
|
956 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
957 | 957 | case 'wysiwyg': |
958 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
958 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
959 | 959 | break; |
960 | 960 | |
961 | 961 | default: |
962 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
962 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - if ( ! empty( $group_meta_value ) ) { |
|
967 | - $form_meta_value[ $index ] = $group_meta_value; |
|
966 | + if ( ! empty($group_meta_value)) { |
|
967 | + $form_meta_value[$index] = $group_meta_value; |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
971 | 971 | // Arrange repeater field keys in order. |
972 | - $form_meta_value = array_values( $form_meta_value ); |
|
972 | + $form_meta_value = array_values($form_meta_value); |
|
973 | 973 | break; |
974 | 974 | |
975 | 975 | default: |
976 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
976 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
977 | 977 | }// End switch(). |
978 | 978 | |
979 | 979 | /** |
@@ -983,38 +983,38 @@ discard block |
||
983 | 983 | */ |
984 | 984 | $form_meta_value = apply_filters( |
985 | 985 | 'give_pre_save_form_meta_value', |
986 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
986 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
987 | 987 | $form_meta_key, |
988 | 988 | $this, |
989 | 989 | $post_id |
990 | 990 | ); |
991 | 991 | |
992 | 992 | // Range slider. |
993 | - if ( 'donation_limit' === $setting_field['type'] ) { |
|
993 | + if ('donation_limit' === $setting_field['type']) { |
|
994 | 994 | |
995 | 995 | // Sanitize amount for db. |
996 | - $form_meta_value = array_map( 'give_sanitize_amount_for_db', $form_meta_value ); |
|
996 | + $form_meta_value = array_map('give_sanitize_amount_for_db', $form_meta_value); |
|
997 | 997 | |
998 | 998 | // Store it to form meta. |
999 | - give_update_meta( $post_id, $form_meta_key . '_minimum', $form_meta_value['minimum'] ); |
|
1000 | - give_update_meta( $post_id, $form_meta_key . '_maximum', $form_meta_value['maximum'] ); |
|
999 | + give_update_meta($post_id, $form_meta_key.'_minimum', $form_meta_value['minimum']); |
|
1000 | + give_update_meta($post_id, $form_meta_key.'_maximum', $form_meta_value['maximum']); |
|
1001 | 1001 | } else { |
1002 | 1002 | // Save data. |
1003 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
1003 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // Verify and delete form meta based on the form status. |
1007 | - give_set_form_closed_status( $post_id ); |
|
1007 | + give_set_form_closed_status($post_id); |
|
1008 | 1008 | |
1009 | 1009 | // Fire after saving form meta key. |
1010 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
1010 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
1011 | 1011 | }// End if(). |
1012 | 1012 | }// End if(). |
1013 | 1013 | }// End foreach(). |
1014 | 1014 | }// End if(). |
1015 | 1015 | |
1016 | 1016 | // Fire action after saving form meta. |
1017 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
1017 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | |
@@ -1027,10 +1027,10 @@ discard block |
||
1027 | 1027 | * |
1028 | 1028 | * @return string |
1029 | 1029 | */ |
1030 | - private function get_field_id( $field ) { |
|
1030 | + private function get_field_id($field) { |
|
1031 | 1031 | $field_id = ''; |
1032 | 1032 | |
1033 | - if ( array_key_exists( 'id', $field ) ) { |
|
1033 | + if (array_key_exists('id', $field)) { |
|
1034 | 1034 | $field_id = $field['id']; |
1035 | 1035 | |
1036 | 1036 | } |
@@ -1047,16 +1047,16 @@ discard block |
||
1047 | 1047 | * |
1048 | 1048 | * @return array |
1049 | 1049 | */ |
1050 | - private function get_fields_id( $setting ) { |
|
1050 | + private function get_fields_id($setting) { |
|
1051 | 1051 | $meta_keys = array(); |
1052 | 1052 | |
1053 | 1053 | if ( |
1054 | - ! empty( $setting ) |
|
1055 | - && array_key_exists( 'fields', $setting ) |
|
1056 | - && ! empty( $setting['fields'] ) |
|
1054 | + ! empty($setting) |
|
1055 | + && array_key_exists('fields', $setting) |
|
1056 | + && ! empty($setting['fields']) |
|
1057 | 1057 | ) { |
1058 | - foreach ( $setting['fields'] as $field ) { |
|
1059 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1058 | + foreach ($setting['fields'] as $field) { |
|
1059 | + if ($field_id = $this->get_field_id($field)) { |
|
1060 | 1060 | $meta_keys[] = $field_id; |
1061 | 1061 | } |
1062 | 1062 | } |
@@ -1074,14 +1074,14 @@ discard block |
||
1074 | 1074 | * |
1075 | 1075 | * @return array |
1076 | 1076 | */ |
1077 | - private function get_sub_fields_id( $setting ) { |
|
1077 | + private function get_sub_fields_id($setting) { |
|
1078 | 1078 | $meta_keys = array(); |
1079 | 1079 | |
1080 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
1081 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1082 | - if ( ! empty( $fields['fields'] ) ) { |
|
1083 | - foreach ( $fields['fields'] as $field ) { |
|
1084 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1080 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
1081 | + foreach ($setting['sub-fields'] as $fields) { |
|
1082 | + if ( ! empty($fields['fields'])) { |
|
1083 | + foreach ($fields['fields'] as $field) { |
|
1084 | + if ($field_id = $this->get_field_id($field)) { |
|
1085 | 1085 | $meta_keys[] = $field_id; |
1086 | 1086 | } |
1087 | 1087 | } |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | private function get_meta_keys_from_settings() { |
1104 | 1104 | $meta_keys = array(); |
1105 | 1105 | |
1106 | - foreach ( $this->settings as $setting ) { |
|
1107 | - $meta_key = $this->get_fields_id( $setting ); |
|
1106 | + foreach ($this->settings as $setting) { |
|
1107 | + $meta_key = $this->get_fields_id($setting); |
|
1108 | 1108 | |
1109 | - if ( $this->has_sub_tab( $setting ) ) { |
|
1110 | - $meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) ); |
|
1109 | + if ($this->has_sub_tab($setting)) { |
|
1110 | + $meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting)); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
1113 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | return $meta_keys; |
@@ -1127,10 +1127,10 @@ discard block |
||
1127 | 1127 | * |
1128 | 1128 | * @return string |
1129 | 1129 | */ |
1130 | - function get_field_type( $field_id, $group_id = '' ) { |
|
1131 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
1130 | + function get_field_type($field_id, $group_id = '') { |
|
1131 | + $field = $this->get_setting_field($field_id, $group_id); |
|
1132 | 1132 | |
1133 | - $type = array_key_exists( 'type', $field ) |
|
1133 | + $type = array_key_exists('type', $field) |
|
1134 | 1134 | ? $field['type'] |
1135 | 1135 | : ''; |
1136 | 1136 | |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | * |
1149 | 1149 | * @return array |
1150 | 1150 | */ |
1151 | - private function get_field( $setting, $field_id ) { |
|
1151 | + private function get_field($setting, $field_id) { |
|
1152 | 1152 | $setting_field = array(); |
1153 | 1153 | |
1154 | - if ( ! empty( $setting['fields'] ) ) { |
|
1155 | - foreach ( $setting['fields'] as $field ) { |
|
1156 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1154 | + if ( ! empty($setting['fields'])) { |
|
1155 | + foreach ($setting['fields'] as $field) { |
|
1156 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1157 | 1157 | $setting_field = $field; |
1158 | 1158 | break; |
1159 | 1159 | } |
@@ -1173,12 +1173,12 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @return array |
1175 | 1175 | */ |
1176 | - private function get_sub_field( $setting, $field_id ) { |
|
1176 | + private function get_sub_field($setting, $field_id) { |
|
1177 | 1177 | $setting_field = array(); |
1178 | 1178 | |
1179 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1180 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1181 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1179 | + if ( ! empty($setting['sub-fields'])) { |
|
1180 | + foreach ($setting['sub-fields'] as $fields) { |
|
1181 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1182 | 1182 | $setting_field = $field; |
1183 | 1183 | break; |
1184 | 1184 | } |
@@ -1198,17 +1198,17 @@ discard block |
||
1198 | 1198 | * |
1199 | 1199 | * @return array |
1200 | 1200 | */ |
1201 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1201 | + function get_setting_field($field_id, $group_id = '') { |
|
1202 | 1202 | $setting_field = array(); |
1203 | 1203 | |
1204 | 1204 | $_field_id = $field_id; |
1205 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1205 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1206 | 1206 | |
1207 | - if ( ! empty( $this->settings ) ) { |
|
1208 | - foreach ( $this->settings as $setting ) { |
|
1207 | + if ( ! empty($this->settings)) { |
|
1208 | + foreach ($this->settings as $setting) { |
|
1209 | 1209 | if ( |
1210 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1211 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1210 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1211 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1212 | 1212 | ) { |
1213 | 1213 | break; |
1214 | 1214 | } |
@@ -1216,9 +1216,9 @@ discard block |
||
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Get field from group. |
1219 | - if ( ! empty( $group_id ) ) { |
|
1220 | - foreach ( $setting_field['fields'] as $field ) { |
|
1221 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1219 | + if ( ! empty($group_id)) { |
|
1220 | + foreach ($setting_field['fields'] as $field) { |
|
1221 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1222 | 1222 | $setting_field = $field; |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1237,14 +1237,14 @@ discard block |
||
1237 | 1237 | * |
1238 | 1238 | * @return mixed |
1239 | 1239 | */ |
1240 | - function add_offline_donations_setting_tab( $settings ) { |
|
1241 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1242 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1240 | + function add_offline_donations_setting_tab($settings) { |
|
1241 | + if (give_is_gateway_active('offline')) { |
|
1242 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1243 | 1243 | 'id' => 'offline_donations_options', |
1244 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1244 | + 'title' => __('Offline Donations', 'give'), |
|
1245 | 1245 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1246 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1247 | - ) ); |
|
1246 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1247 | + )); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | return $settings; |
@@ -1262,41 +1262,37 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @return mixed |
1264 | 1264 | */ |
1265 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1266 | - switch ( $setting_field['type'] ) { |
|
1265 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1266 | + switch ($setting_field['type']) { |
|
1267 | 1267 | case 'group': |
1268 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1269 | - foreach ( $setting_field['fields'] as $field ) { |
|
1270 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1268 | + if ( ! empty($setting_field['fields'])) { |
|
1269 | + foreach ($setting_field['fields'] as $field) { |
|
1270 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1271 | 1271 | continue; |
1272 | 1272 | } |
1273 | 1273 | |
1274 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1275 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1274 | + foreach ($meta_value as $index => $meta_data) { |
|
1275 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1276 | 1276 | continue; |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ? |
|
1280 | - give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) : |
|
1281 | - ( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ? |
|
1282 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1283 | - 0 ); |
|
1279 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ? |
|
1280 | + give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ? |
|
1281 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1284 | 1282 | } |
1285 | 1283 | } |
1286 | 1284 | } |
1287 | 1285 | break; |
1288 | 1286 | |
1289 | 1287 | default: |
1290 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1288 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1291 | 1289 | $meta_value = $meta_value ? |
1292 | - give_sanitize_amount_for_db( $meta_value ) : |
|
1293 | - ( in_array( $setting_field['id'], array( |
|
1290 | + give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array( |
|
1294 | 1291 | '_give_set_price', |
1295 | 1292 | '_give_custom_amount_minimum', |
1296 | 1293 | '_give_set_goal' |
1297 | - ) ) ? |
|
1298 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1299 | - 0 ); |
|
1294 | + )) ? |
|
1295 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1300 | 1296 | } |
1301 | 1297 | } |
1302 | 1298 | |
@@ -1314,12 +1310,12 @@ discard block |
||
1314 | 1310 | * |
1315 | 1311 | * @return string The URL after redirect. |
1316 | 1312 | */ |
1317 | - public function maintain_active_tab( $location, $post_id ) { |
|
1313 | + public function maintain_active_tab($location, $post_id) { |
|
1318 | 1314 | if ( |
1319 | - 'give_forms' === get_post_type( $post_id ) && |
|
1320 | - ! empty( $_POST['give_form_active_tab'] ) |
|
1315 | + 'give_forms' === get_post_type($post_id) && |
|
1316 | + ! empty($_POST['give_form_active_tab']) |
|
1321 | 1317 | ) { |
1322 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
1318 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
1323 | 1319 | } |
1324 | 1320 | |
1325 | 1321 | return $location; |
@@ -752,9 +752,12 @@ discard block |
||
752 | 752 | data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
753 | 753 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
754 | 754 | <?php echo $form_data_tab['icon-html']; ?> |
755 | - <?php else : ?> |
|
755 | + <?php else { |
|
756 | + : ?> |
|
756 | 757 | <span class="give-icon give-icon-default"></span> |
757 | - <?php endif; ?> |
|
758 | + <?php endif; |
|
759 | +} |
|
760 | +?> |
|
758 | 761 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
759 | 762 | </a> |
760 | 763 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -765,9 +768,12 @@ discard block |
||
765 | 768 | data-tab-id="<?php echo $sub_tab['id']; ?>"> |
766 | 769 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
767 | 770 | <?php echo $sub_tab['icon-html']; ?> |
768 | - <?php else : ?> |
|
771 | + <?php else { |
|
772 | + : ?> |
|
769 | 773 | <span class="give-icon give-icon-default"></span> |
770 | - <?php endif; ?> |
|
774 | + <?php endif; |
|
775 | +} |
|
776 | +?> |
|
771 | 777 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
772 | 778 | </a> |
773 | 779 | </li> |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = __( 'Display Options', 'give' ); |
|
30 | + $this->label = __('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,65 +53,65 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => __('Default Give Styles', 'give'), |
|
57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
67 | + 'name' => __('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
70 | 70 | 'a' => array( |
71 | 71 | 'href' => array(), |
72 | 72 | 'target' => array(), |
73 | 73 | ), |
74 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
74 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
75 | 75 | 'id' => 'floatlabels', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'default' => 'disabled', |
78 | 78 | 'options' => array( |
79 | - 'enabled' => __( 'Enabled', 'give' ), |
|
80 | - 'disabled' => __( 'Disabled', 'give' ), |
|
79 | + 'enabled' => __('Enabled', 'give'), |
|
80 | + 'disabled' => __('Disabled', 'give'), |
|
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
84 | + 'name' => __('Welcome Screen', 'give'), |
|
85 | 85 | /* translators: %s: about page URL */ |
86 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( |
|
86 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array( |
|
87 | 87 | 'a' => array( |
88 | 88 | 'href' => array(), |
89 | 89 | 'target' => array(), |
90 | 90 | ), |
91 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
91 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
92 | 92 | 'id' => 'welcome', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Name Title Prefix', 'give' ), |
|
102 | - 'desc' => __( 'Do you want a Name Title Prefix field to appear before First Name?', 'give' ), |
|
101 | + 'name' => __('Name Title Prefix', 'give'), |
|
102 | + 'desc' => __('Do you want a Name Title Prefix field to appear before First Name?', 'give'), |
|
103 | 103 | 'id' => 'name_title_prefix', |
104 | 104 | 'type' => 'radio_inline', |
105 | 105 | 'default' => 'disabled', |
106 | 106 | 'options' => array( |
107 | - 'disabled' => __( 'Disabled', 'give' ), |
|
108 | - 'required' => __( 'Required', 'give' ), |
|
109 | - 'optional' => __( 'Optional', 'give' ), |
|
107 | + 'disabled' => __('Disabled', 'give'), |
|
108 | + 'required' => __('Required', 'give'), |
|
109 | + 'optional' => __('Optional', 'give'), |
|
110 | 110 | ), |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Title Prefixes', 'give' ), |
|
114 | - 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
|
113 | + 'name' => __('Title Prefixes', 'give'), |
|
114 | + 'desc' => __('Add or remove salutations from the dropdown using the field above.', 'give'), |
|
115 | 115 | 'id' => 'title_prefixes', |
116 | 116 | 'type' => 'chosen', |
117 | 117 | 'data_type' => 'multiselect', |
@@ -120,44 +120,44 @@ discard block |
||
120 | 120 | 'options' => give_get_default_title_prefixes(), |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Company Field', 'give' ), |
|
124 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name fields on all donation forms? You can enable this option per form as well.', 'give' ), |
|
123 | + 'name' => __('Company Field', 'give'), |
|
124 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name fields on all donation forms? You can enable this option per form as well.', 'give'), |
|
125 | 125 | 'id' => 'company_field', |
126 | 126 | 'type' => 'radio_inline', |
127 | 127 | 'default' => 'disabled', |
128 | 128 | 'options' => array( |
129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
130 | - 'required' => __( 'Required', 'give' ), |
|
131 | - 'optional' => __( 'Optional', 'give' ), |
|
129 | + 'disabled' => __('Disabled', 'give'), |
|
130 | + 'required' => __('Required', 'give'), |
|
131 | + 'optional' => __('Optional', 'give'), |
|
132 | 132 | ), |
133 | 133 | ), |
134 | 134 | array( |
135 | - 'name' => __( 'Anonymous Donations', 'give' ), |
|
136 | - 'desc' => __( 'Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
|
135 | + 'name' => __('Anonymous Donations', 'give'), |
|
136 | + 'desc' => __('Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give'), |
|
137 | 137 | 'id' => 'anonymous_donation', |
138 | 138 | 'type' => 'radio_inline', |
139 | 139 | 'default' => 'disabled', |
140 | 140 | 'options' => array( |
141 | - 'enabled' => __( 'Enabled', 'give' ), |
|
142 | - 'disabled' => __( 'Disabled', 'give' ), |
|
141 | + 'enabled' => __('Enabled', 'give'), |
|
142 | + 'disabled' => __('Disabled', 'give'), |
|
143 | 143 | ), |
144 | 144 | ), |
145 | 145 | array( |
146 | - 'name' => __( 'Donor Comment', 'give' ), |
|
147 | - 'desc' => __( 'Do you want to provide donors the ability to add a note to his/her donation? The note will display publicly on the donor wall if they do not select to give anonymously.', 'give' ), |
|
146 | + 'name' => __('Donor Comment', 'give'), |
|
147 | + 'desc' => __('Do you want to provide donors the ability to add a note to his/her donation? The note will display publicly on the donor wall if they do not select to give anonymously.', 'give'), |
|
148 | 148 | 'id' => 'donor_comment', |
149 | 149 | 'type' => 'radio_inline', |
150 | 150 | 'default' => 'disabled', |
151 | 151 | 'options' => array( |
152 | - 'enabled' => __( 'Enabled', 'give' ), |
|
153 | - 'disabled' => __( 'Disabled', 'give' ), |
|
152 | + 'enabled' => __('Enabled', 'give'), |
|
153 | + 'disabled' => __('Disabled', 'give'), |
|
154 | 154 | ), |
155 | 155 | ), |
156 | 156 | array( |
157 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
157 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
158 | 158 | 'id' => 'display_settings_docs_link', |
159 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
160 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
159 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
160 | + 'title' => __('Display Options Settings', 'give'), |
|
161 | 161 | 'type' => 'give_docs_link', |
162 | 162 | ), |
163 | 163 | array( |
@@ -174,78 +174,78 @@ discard block |
||
174 | 174 | 'type' => 'title', |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => __( 'Form Single Views', 'give' ), |
|
178 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
177 | + 'name' => __('Form Single Views', 'give'), |
|
178 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
179 | 179 | 'id' => 'forms_singular', |
180 | 180 | 'type' => 'radio_inline', |
181 | 181 | 'default' => 'enabled', |
182 | 182 | 'options' => array( |
183 | - 'enabled' => __( 'Enabled', 'give' ), |
|
184 | - 'disabled' => __( 'Disabled', 'give' ), |
|
183 | + 'enabled' => __('Enabled', 'give'), |
|
184 | + 'disabled' => __('Disabled', 'give'), |
|
185 | 185 | ), |
186 | 186 | ), |
187 | 187 | array( |
188 | - 'name' => __( 'Form Archives', 'give' ), |
|
189 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( |
|
188 | + 'name' => __('Form Archives', 'give'), |
|
189 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array( |
|
190 | 190 | 'a' => array( |
191 | 191 | 'href' => array(), |
192 | 192 | 'target' => array(), |
193 | 193 | ), |
194 | - ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
194 | + )), esc_url(admin_url('options-permalink.php'))), |
|
195 | 195 | 'id' => 'forms_archives', |
196 | 196 | 'type' => 'radio_inline', |
197 | 197 | 'default' => 'enabled', |
198 | 198 | 'options' => array( |
199 | - 'enabled' => __( 'Enabled', 'give' ), |
|
200 | - 'disabled' => __( 'Disabled', 'give' ), |
|
199 | + 'enabled' => __('Enabled', 'give'), |
|
200 | + 'disabled' => __('Disabled', 'give'), |
|
201 | 201 | ), |
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
205 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
204 | + 'name' => __('Form Excerpts', 'give'), |
|
205 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
206 | 206 | 'id' => 'forms_excerpt', |
207 | 207 | 'type' => 'radio_inline', |
208 | 208 | 'default' => 'enabled', |
209 | 209 | 'options' => array( |
210 | - 'enabled' => __( 'Enabled', 'give' ), |
|
211 | - 'disabled' => __( 'Disabled', 'give' ), |
|
210 | + 'enabled' => __('Enabled', 'give'), |
|
211 | + 'disabled' => __('Disabled', 'give'), |
|
212 | 212 | ), |
213 | 213 | ), |
214 | 214 | array( |
215 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
216 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
215 | + 'name' => __('Form Featured Image', 'give'), |
|
216 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
217 | 217 | 'id' => 'form_featured_img', |
218 | 218 | 'type' => 'radio_inline', |
219 | 219 | 'default' => 'enabled', |
220 | 220 | 'options' => array( |
221 | - 'enabled' => __( 'Enabled', 'give' ), |
|
222 | - 'disabled' => __( 'Disabled', 'give' ), |
|
221 | + 'enabled' => __('Enabled', 'give'), |
|
222 | + 'disabled' => __('Disabled', 'give'), |
|
223 | 223 | ), |
224 | 224 | ), |
225 | 225 | array( |
226 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
227 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
226 | + 'name' => __('Featured Image Size', 'give'), |
|
227 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
228 | 228 | 'id' => 'featured_image_size', |
229 | 229 | 'type' => 'select', |
230 | 230 | 'default' => 'large', |
231 | 231 | 'options' => give_get_featured_image_sizes(), |
232 | 232 | ), |
233 | 233 | array( |
234 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
235 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
234 | + 'name' => __('Single Form Sidebar', 'give'), |
|
235 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
236 | 236 | 'id' => 'form_sidebar', |
237 | 237 | 'type' => 'radio_inline', |
238 | 238 | 'default' => 'enabled', |
239 | 239 | 'options' => array( |
240 | - 'enabled' => __( 'Enabled', 'give' ), |
|
241 | - 'disabled' => __( 'Disabled', 'give' ), |
|
240 | + 'enabled' => __('Enabled', 'give'), |
|
241 | + 'disabled' => __('Disabled', 'give'), |
|
242 | 242 | ), |
243 | 243 | ), |
244 | 244 | array( |
245 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
245 | + 'name' => __('Post Types Docs Link', 'give'), |
|
246 | 246 | 'id' => 'post_types_settings_docs_link', |
247 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
248 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
247 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
248 | + 'title' => __('Post Types Settings', 'give'), |
|
249 | 249 | 'type' => 'give_docs_link', |
250 | 250 | ), |
251 | 251 | array( |
@@ -262,32 +262,32 @@ discard block |
||
262 | 262 | 'type' => 'title', |
263 | 263 | ), |
264 | 264 | array( |
265 | - 'name' => __( 'Form Categories', 'give' ), |
|
266 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
265 | + 'name' => __('Form Categories', 'give'), |
|
266 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
267 | 267 | 'id' => 'categories', |
268 | 268 | 'type' => 'radio_inline', |
269 | 269 | 'default' => 'disabled', |
270 | 270 | 'options' => array( |
271 | - 'enabled' => __( 'Enabled', 'give' ), |
|
272 | - 'disabled' => __( 'Disabled', 'give' ), |
|
271 | + 'enabled' => __('Enabled', 'give'), |
|
272 | + 'disabled' => __('Disabled', 'give'), |
|
273 | 273 | ), |
274 | 274 | ), |
275 | 275 | array( |
276 | - 'name' => __( 'Form Tags', 'give' ), |
|
277 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
276 | + 'name' => __('Form Tags', 'give'), |
|
277 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
278 | 278 | 'id' => 'tags', |
279 | 279 | 'type' => 'radio_inline', |
280 | 280 | 'default' => 'disabled', |
281 | 281 | 'options' => array( |
282 | - 'enabled' => __( 'Enabled', 'give' ), |
|
283 | - 'disabled' => __( 'Disabled', 'give' ), |
|
282 | + 'enabled' => __('Enabled', 'give'), |
|
283 | + 'disabled' => __('Disabled', 'give'), |
|
284 | 284 | ), |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
287 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
288 | 288 | 'id' => 'taxonomies_settings_docs_link', |
289 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
290 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
289 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
290 | + 'title' => __('Taxonomies Settings', 'give'), |
|
291 | 291 | 'type' => 'give_docs_link', |
292 | 292 | ), |
293 | 293 | array( |
@@ -304,37 +304,37 @@ discard block |
||
304 | 304 | 'type' => 'title', |
305 | 305 | ), |
306 | 306 | array( |
307 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
308 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
307 | + 'name' => __('Terms and Conditions', 'give'), |
|
308 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
309 | 309 | 'id' => 'terms', |
310 | 310 | 'type' => 'radio_inline', |
311 | 311 | 'default' => 'disabled', |
312 | 312 | 'options' => array( |
313 | - 'enabled' => __( 'Enabled', 'give' ), |
|
314 | - 'disabled' => __( 'Disabled', 'give' ), |
|
313 | + 'enabled' => __('Enabled', 'give'), |
|
314 | + 'disabled' => __('Disabled', 'give'), |
|
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
319 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
318 | + 'name' => __('Agree to Terms Label', 'give'), |
|
319 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
320 | 320 | 'id' => 'agree_to_terms_label', |
321 | 321 | 'attributes' => array( |
322 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
322 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
323 | 323 | 'rows' => 1 |
324 | 324 | ), |
325 | 325 | 'type' => 'textarea', |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'name' => __( 'Agreement Text', 'give' ), |
|
329 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
328 | + 'name' => __('Agreement Text', 'give'), |
|
329 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
330 | 330 | 'id' => 'agreement_text', |
331 | 331 | 'type' => 'wysiwyg', |
332 | 332 | ), |
333 | 333 | array( |
334 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
334 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
335 | 335 | 'id' => 'terms_settings_docs_link', |
336 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
337 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
336 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
337 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
338 | 338 | 'type' => 'give_docs_link', |
339 | 339 | ), |
340 | 340 | array( |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * Filter the display options settings. |
350 | 350 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
351 | 351 | */ |
352 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
352 | + $settings = apply_filters('give_settings_display', $settings); |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Filter the settings. |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param array $settings |
360 | 360 | */ |
361 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
361 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
362 | 362 | |
363 | 363 | // Output. |
364 | 364 | return $settings; |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function get_sections() { |
374 | 374 | $sections = array( |
375 | - 'display-settings' => __( 'Display', 'give' ), |
|
376 | - 'post-types' => __( 'Post Types', 'give' ), |
|
377 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
378 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ), |
|
375 | + 'display-settings' => __('Display', 'give'), |
|
376 | + 'post-types' => __('Post Types', 'give'), |
|
377 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
378 | + 'term-and-conditions' => __('Terms and Conditions', 'give'), |
|
379 | 379 | ); |
380 | 380 | |
381 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
381 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | - add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) ); |
|
36 | + add_action('give_admin_field_email_notification', array($this, 'email_notification_setting')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $settings = array(); |
47 | 47 | $current_section = give_get_current_setting_section(); |
48 | 48 | |
49 | - switch ( $current_section ) { |
|
49 | + switch ($current_section) { |
|
50 | 50 | case 'email-settings' : |
51 | 51 | $settings = array( |
52 | 52 | |
53 | 53 | // Section 1: Email Notification Listing. |
54 | 54 | array( |
55 | - 'desc' => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ), |
|
55 | + 'desc' => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'), |
|
56 | 56 | 'type' => 'title', |
57 | 57 | 'id' => 'give_email_notification_settings', |
58 | 58 | 'table_html' => false, |
@@ -67,42 +67,42 @@ discard block |
||
67 | 67 | |
68 | 68 | // Section 2: Email Sender Setting |
69 | 69 | array( |
70 | - 'title' => __( 'Email Sender Options', 'give' ), |
|
70 | + 'title' => __('Email Sender Options', 'give'), |
|
71 | 71 | 'id' => 'give_title_email_settings_1', |
72 | 72 | 'type' => 'title', |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'email_template', |
76 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
77 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
76 | + 'name' => esc_html__('Email Template', 'give'), |
|
77 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
78 | 78 | 'type' => 'select', |
79 | 79 | 'options' => give_get_email_templates(), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'id' => 'email_logo', |
83 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
84 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
83 | + 'name' => esc_html__('Logo', 'give'), |
|
84 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
85 | 85 | 'type' => 'file', |
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'from_name', |
89 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
90 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
91 | - 'default' => get_bloginfo( 'name' ), |
|
89 | + 'name' => esc_html__('From Name', 'give'), |
|
90 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
91 | + 'default' => get_bloginfo('name'), |
|
92 | 92 | 'type' => 'text', |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'id' => 'from_email', |
96 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
97 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
98 | - 'default' => get_bloginfo( 'admin_email' ), |
|
96 | + 'name' => esc_html__('From Email', 'give'), |
|
97 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
98 | + 'default' => get_bloginfo('admin_email'), |
|
99 | 99 | 'type' => 'text', |
100 | 100 | ), |
101 | 101 | array( |
102 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
102 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
103 | 103 | 'id' => 'donation_notification_settings_docs_link', |
104 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
105 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
104 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
105 | + 'title' => __('Donation Notification Settings', 'give'), |
|
106 | 106 | 'type' => 'give_docs_link', |
107 | 107 | ), |
108 | 108 | array( |
@@ -120,19 +120,19 @@ discard block |
||
120 | 120 | 'type' => 'title' |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Admin Email Address', 'give' ), |
|
123 | + 'name' => __('Admin Email Address', 'give'), |
|
124 | 124 | 'id' => "contact_admin_email", |
125 | - 'desc' => sprintf( '%1$s <code>{admin_email}</code> %2$s', __( 'By default, the', 'give' ), __( 'tag will use your WordPress admin email. If you would like to customize this address you can do so in the field above.', 'give' ) ), |
|
125 | + 'desc' => sprintf('%1$s <code>{admin_email}</code> %2$s', __('By default, the', 'give'), __('tag will use your WordPress admin email. If you would like to customize this address you can do so in the field above.', 'give')), |
|
126 | 126 | 'type' => 'text', |
127 | 127 | 'default' => give_email_admin_email(), |
128 | 128 | |
129 | 129 | ), |
130 | 130 | array( |
131 | - 'name' => __( 'Offline Mailing Address', 'give' ), |
|
131 | + 'name' => __('Offline Mailing Address', 'give'), |
|
132 | 132 | 'id' => "contact_offline_mailing_address", |
133 | - 'desc' => sprintf( '%1$s <code>{offline_mailing_address}</code> %2$s', __( 'Set the mailing address to where you would like your donors to send their offline donations. This will customize the', 'give' ), __( 'email tag for the Offline Donations payment gateway.', 'give' ) ), |
|
133 | + 'desc' => sprintf('%1$s <code>{offline_mailing_address}</code> %2$s', __('Set the mailing address to where you would like your donors to send their offline donations. This will customize the', 'give'), __('email tag for the Offline Donations payment gateway.', 'give')), |
|
134 | 134 | 'type' => 'wysiwyg', |
135 | - 'default' => ' <em>' . get_bloginfo( 'sitename' ) . '</em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', |
|
135 | + 'default' => ' <em>'.get_bloginfo('sitename').'</em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', |
|
136 | 136 | ), |
137 | 137 | array( |
138 | 138 | 'id' => 'give_title_general_settings_4', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Filter the emails settings. |
148 | 148 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
149 | 149 | */ |
150 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
150 | + $settings = apply_filters('give_settings_emails', $settings); |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Filter the settings. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param array $settings |
158 | 158 | */ |
159 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
159 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
160 | 160 | |
161 | 161 | // Output. |
162 | 162 | return $settings; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_sections() { |
172 | 172 | $sections = array( |
173 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
174 | - 'contact' => esc_html__( 'Contact Information', 'give' ), |
|
173 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
174 | + 'contact' => esc_html__('Contact Information', 'give'), |
|
175 | 175 | ); |
176 | 176 | |
177 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
177 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function email_notification_setting() { |
187 | 187 | // Load email notification table. |
188 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php'; |
|
188 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php'; |
|
189 | 189 | |
190 | 190 | // Init table. |
191 | 191 | $email_notifications_table = new Give_Email_Notification_Table(); |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | */ |
206 | 206 | public function output() { |
207 | - if ( $this->enable_save ) { |
|
208 | - $GLOBALS['give_hide_save_button'] = apply_filters( 'give_hide_save_button_on_email_admin_setting_page', false ); |
|
207 | + if ($this->enable_save) { |
|
208 | + $GLOBALS['give_hide_save_button'] = apply_filters('give_hide_save_button_on_email_admin_setting_page', false); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $settings = $this->get_settings(); |
212 | 212 | |
213 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
213 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly. |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = __( 'General', 'give' ); |
|
30 | + $this->label = __('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_save_settings_give_settings', array( $this, '__give_change_donation_stating_number' ), 10, 3 ); |
|
36 | - add_action( 'give_admin_field_give_sequential_donation_code_preview', array( $this, '__render_give_sequential_donation_code_preview' ), 10, 3 ); |
|
37 | - add_action( 'give_admin_field_give_unlock_all_settings', array( $this, '__render_give_unlock_all_settings' ), 10, 3 ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_save_settings_give_settings', array($this, '__give_change_donation_stating_number'), 10, 3); |
|
36 | + add_action('give_admin_field_give_sequential_donation_code_preview', array($this, '__render_give_sequential_donation_code_preview'), 10, 3); |
|
37 | + add_action('give_admin_field_give_unlock_all_settings', array($this, '__render_give_unlock_all_settings'), 10, 3); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | parent::__construct(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $settings = array(); |
51 | 51 | $current_section = give_get_current_setting_section(); |
52 | 52 | |
53 | - switch ( $current_section ) { |
|
53 | + switch ($current_section) { |
|
54 | 54 | case 'access-control': |
55 | 55 | $settings = array( |
56 | 56 | // Section 3: Access control. |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'id' => 'session_lifetime', |
63 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
64 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
63 | + 'name' => __('Session Lifetime', 'give'), |
|
64 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
65 | 65 | 'type' => 'select', |
66 | 66 | 'options' => array( |
67 | - '86400' => __( '24 Hours', 'give' ), |
|
68 | - '172800' => __( '48 Hours', 'give' ), |
|
69 | - '259200' => __( '72 Hours', 'give' ), |
|
70 | - '604800' => __( '1 Week', 'give' ), |
|
67 | + '86400' => __('24 Hours', 'give'), |
|
68 | + '172800' => __('48 Hours', 'give'), |
|
69 | + '259200' => __('72 Hours', 'give'), |
|
70 | + '604800' => __('1 Week', 'give'), |
|
71 | 71 | ), |
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'id' => 'limit_display_donations', |
75 | - 'name' => __( 'Limit Donations Displayed', 'give' ), |
|
76 | - 'desc' => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ), |
|
75 | + 'name' => __('Limit Donations Displayed', 'give'), |
|
76 | + 'desc' => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'), |
|
77 | 77 | 'default' => '1', |
78 | 78 | 'type' => 'number', |
79 | 79 | 'css' => 'width:50px;', |
@@ -83,47 +83,47 @@ discard block |
||
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | array( |
86 | - 'name' => __( 'Email Access', 'give' ), |
|
87 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
86 | + 'name' => __('Email Access', 'give'), |
|
87 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
88 | 88 | 'id' => 'email_access', |
89 | 89 | 'type' => 'radio_inline', |
90 | 90 | 'default' => 'disabled', |
91 | 91 | 'options' => array( |
92 | - 'enabled' => __( 'Enabled', 'give' ), |
|
93 | - 'disabled' => __( 'Disabled', 'give' ), |
|
92 | + 'enabled' => __('Enabled', 'give'), |
|
93 | + 'disabled' => __('Disabled', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | - 'name' => __( 'Enable reCAPTCHA', 'give' ), |
|
98 | - 'desc' => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ), |
|
97 | + 'name' => __('Enable reCAPTCHA', 'give'), |
|
98 | + 'desc' => __('Would you like to enable the reCAPTCHA feature?', 'give'), |
|
99 | 99 | 'id' => 'enable_recaptcha', |
100 | 100 | 'type' => 'radio_inline', |
101 | 101 | 'default' => 'disabled', |
102 | 102 | 'options' => array( |
103 | - 'enabled' => __( 'Enabled', 'give' ), |
|
104 | - 'disabled' => __( 'Disabled', 'give' ), |
|
103 | + 'enabled' => __('Enabled', 'give'), |
|
104 | + 'disabled' => __('Disabled', 'give'), |
|
105 | 105 | ), |
106 | 106 | ), |
107 | 107 | array( |
108 | 108 | 'id' => 'recaptcha_key', |
109 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
109 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
110 | 110 | /* translators: %s: https://www.google.com/recaptcha/ */ |
111 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
111 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
112 | 112 | 'default' => '', |
113 | 113 | 'type' => 'text', |
114 | 114 | ), |
115 | 115 | array( |
116 | 116 | 'id' => 'recaptcha_secret', |
117 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
118 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
117 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
118 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
119 | 119 | 'default' => '', |
120 | 120 | 'type' => 'text', |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Access Control Docs Link', 'give' ), |
|
123 | + 'name' => __('Access Control Docs Link', 'give'), |
|
124 | 124 | 'id' => 'access_control_docs_link', |
125 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
126 | - 'title' => __( 'Access Control', 'give' ), |
|
125 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
126 | + 'title' => __('Access Control', 'give'), |
|
127 | 127 | 'type' => 'give_docs_link', |
128 | 128 | ), |
129 | 129 | array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'currency-settings' : |
137 | - $currency_position_before = __( 'Before - %s‎10', 'give' ); |
|
138 | - $currency_position_after = __( 'After - 10%s‏', 'give' ); |
|
137 | + $currency_position_before = __('Before - %s‎10', 'give'); |
|
138 | + $currency_position_after = __('After - 10%s‏', 'give'); |
|
139 | 139 | |
140 | 140 | $settings = array( |
141 | 141 | // Section 2: Currency |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | 'id' => 'give_title_general_settings_2', |
145 | 145 | ), |
146 | 146 | array( |
147 | - 'name' => __( 'Currency Settings', 'give' ), |
|
147 | + 'name' => __('Currency Settings', 'give'), |
|
148 | 148 | 'desc' => '', |
149 | 149 | 'type' => 'give_title', |
150 | 150 | 'id' => 'give_title_general_settings_2', |
151 | 151 | ), |
152 | 152 | array( |
153 | - 'name' => __( 'Currency', 'give' ), |
|
154 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
153 | + 'name' => __('Currency', 'give'), |
|
154 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
155 | 155 | 'id' => 'currency', |
156 | 156 | 'class' => 'give-select-chosen', |
157 | 157 | 'type' => 'select', |
@@ -159,51 +159,51 @@ discard block |
||
159 | 159 | 'default' => 'USD', |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Currency Position', 'give' ), |
|
163 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
162 | + 'name' => __('Currency Position', 'give'), |
|
163 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
164 | 164 | 'id' => 'currency_position', |
165 | 165 | 'type' => 'select', |
166 | 166 | 'options' => array( |
167 | 167 | /* translators: %s: currency symbol */ |
168 | - 'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ), |
|
168 | + 'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())), |
|
169 | 169 | /* translators: %s: currency symbol */ |
170 | - 'after' => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ), |
|
170 | + 'after' => sprintf($currency_position_after, give_currency_symbol(give_get_currency())), |
|
171 | 171 | ), |
172 | 172 | 'default' => 'before', |
173 | 173 | 'attributes' => array( |
174 | - 'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ), |
|
175 | - 'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ), |
|
174 | + 'data-before-template' => sprintf($currency_position_before, '{currency_pos}'), |
|
175 | + 'data-after-template' => sprintf($currency_position_after, '{currency_pos}'), |
|
176 | 176 | ), |
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
180 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
179 | + 'name' => __('Thousands Separator', 'give'), |
|
180 | + 'desc' => __('The symbol (typically , or .) to separate thousands.', 'give'), |
|
181 | 181 | 'id' => 'thousands_separator', |
182 | 182 | 'type' => 'text', |
183 | 183 | 'default' => ',', |
184 | 184 | 'css' => 'width:12em;', |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
188 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
187 | + 'name' => __('Decimal Separator', 'give'), |
|
188 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
189 | 189 | 'id' => 'decimal_separator', |
190 | 190 | 'type' => 'text', |
191 | 191 | 'default' => '.', |
192 | 192 | 'css' => 'width:12em;', |
193 | 193 | ), |
194 | 194 | array( |
195 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
196 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
195 | + 'name' => __('Number of Decimals', 'give'), |
|
196 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
197 | 197 | 'id' => 'number_decimals', |
198 | 198 | 'type' => 'text', |
199 | 199 | 'default' => 2, |
200 | 200 | 'css' => 'width:12em;', |
201 | 201 | ), |
202 | 202 | array( |
203 | - 'name' => __( 'Currency Options Docs Link', 'give' ), |
|
203 | + 'name' => __('Currency Options Docs Link', 'give'), |
|
204 | 204 | 'id' => 'currency_settings_docs_link', |
205 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
206 | - 'title' => __( 'Currency Settings', 'give' ), |
|
205 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
206 | + 'title' => __('Currency Settings', 'give'), |
|
207 | 207 | 'type' => 'give_docs_link', |
208 | 208 | ), |
209 | 209 | array( |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | $countries = give_get_country(); |
220 | 220 | |
221 | 221 | // get the list of the states of which default country is selected. |
222 | - $states = give_get_states( $countries ); |
|
222 | + $states = give_get_states($countries); |
|
223 | 223 | |
224 | 224 | // Get the country list that does not have any states init. |
225 | 225 | $no_states_country = give_no_states_country_list(); |
226 | 226 | |
227 | 227 | $states_label = give_get_states_label(); |
228 | 228 | $country = give_get_country(); |
229 | - $label = __( 'State', 'give' ); |
|
229 | + $label = __('State', 'give'); |
|
230 | 230 | // Check if $country code exists in the array key for states label. |
231 | - if ( array_key_exists( $country, $states_label ) ) { |
|
232 | - $label = $states_label[ $country ]; |
|
231 | + if (array_key_exists($country, $states_label)) { |
|
232 | + $label = $states_label[$country]; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -240,58 +240,58 @@ discard block |
||
240 | 240 | 'id' => 'give_title_general_settings_1', |
241 | 241 | ), |
242 | 242 | array( |
243 | - 'name' => __( 'General Settings', 'give' ), |
|
243 | + 'name' => __('General Settings', 'give'), |
|
244 | 244 | 'desc' => '', |
245 | 245 | 'type' => 'give_title', |
246 | 246 | 'id' => 'give_title_general_settings_1', |
247 | 247 | ), |
248 | 248 | array( |
249 | - 'name' => __( 'Success Page', 'give' ), |
|
249 | + 'name' => __('Success Page', 'give'), |
|
250 | 250 | /* translators: %s: [give_receipt] */ |
251 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
251 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
252 | 252 | 'id' => 'success_page', |
253 | 253 | 'class' => 'give-select give-select-chosen', |
254 | 254 | 'type' => 'select', |
255 | - 'options' => give_cmb2_get_post_options( array( |
|
255 | + 'options' => give_cmb2_get_post_options(array( |
|
256 | 256 | 'post_type' => 'page', |
257 | 257 | 'numberposts' => 30, |
258 | - ) ), |
|
258 | + )), |
|
259 | 259 | 'attributes' => array( |
260 | 260 | 'data-search-type' => 'pages' |
261 | 261 | ) |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
265 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
264 | + 'name' => __('Failed Donation Page', 'give'), |
|
265 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
266 | 266 | 'class' => 'give-select give-select-chosen', |
267 | 267 | 'id' => 'failure_page', |
268 | 268 | 'type' => 'select', |
269 | - 'options' => give_cmb2_get_post_options( array( |
|
269 | + 'options' => give_cmb2_get_post_options(array( |
|
270 | 270 | 'post_type' => 'page', |
271 | 271 | 'numberposts' => 30, |
272 | - ) ), |
|
272 | + )), |
|
273 | 273 | 'attributes' => array( |
274 | 274 | 'data-search-type' => 'pages' |
275 | 275 | ) |
276 | 276 | ), |
277 | 277 | array( |
278 | - 'name' => __( 'Donation History Page', 'give' ), |
|
278 | + 'name' => __('Donation History Page', 'give'), |
|
279 | 279 | /* translators: %s: [donation_history] */ |
280 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
280 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
281 | 281 | 'id' => 'history_page', |
282 | 282 | 'class' => 'give-select give-select-chosen', |
283 | 283 | 'type' => 'select', |
284 | - 'options' => give_cmb2_get_post_options( array( |
|
284 | + 'options' => give_cmb2_get_post_options(array( |
|
285 | 285 | 'post_type' => 'page', |
286 | 286 | 'numberposts' => 30, |
287 | - ) ), |
|
287 | + )), |
|
288 | 288 | 'attributes' => array( |
289 | 289 | 'data-search-type' => 'pages' |
290 | 290 | ) |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => __( 'Base Country', 'give' ), |
|
294 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
293 | + 'name' => __('Base Country', 'give'), |
|
294 | + 'desc' => __('The country your site operates from.', 'give'), |
|
295 | 295 | 'id' => 'base_country', |
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => give_get_country_list(), |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | * @since 1.8.14 |
308 | 308 | */ |
309 | 309 | array( |
310 | - 'wrapper_class' => ( array_key_exists( $countries, $no_states_country ) ? 'give-hidden' : '' ), |
|
311 | - 'name' => __( 'Base State/Province', 'give' ), |
|
312 | - 'desc' => __( 'The state/province your site operates from.', 'give' ), |
|
310 | + 'wrapper_class' => (array_key_exists($countries, $no_states_country) ? 'give-hidden' : ''), |
|
311 | + 'name' => __('Base State/Province', 'give'), |
|
312 | + 'desc' => __('The state/province your site operates from.', 'give'), |
|
313 | 313 | 'id' => 'base_state', |
314 | - 'type' => ( empty( $states ) ? 'text' : 'select' ), |
|
315 | - 'class' => ( empty( $states ) ? '' : 'give-select give-select-chosen' ), |
|
314 | + 'type' => (empty($states) ? 'text' : 'select'), |
|
315 | + 'class' => (empty($states) ? '' : 'give-select give-select-chosen'), |
|
316 | 316 | 'options' => $states, |
317 | 317 | 'attributes' => array( |
318 | 318 | 'data-search-type' => 'no_ajax', |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | ), |
321 | 321 | ), |
322 | 322 | array( |
323 | - 'name' => __( 'General Options Docs Link', 'give' ), |
|
323 | + 'name' => __('General Options Docs Link', 'give'), |
|
324 | 324 | 'id' => 'general_options_docs_link', |
325 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
326 | - 'title' => __( 'General Options', 'give' ), |
|
325 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
326 | + 'title' => __('General Options', 'give'), |
|
327 | 327 | 'type' => 'give_docs_link', |
328 | 328 | ), |
329 | 329 | array( |
@@ -343,48 +343,48 @@ discard block |
||
343 | 343 | 'type' => 'title' |
344 | 344 | ), |
345 | 345 | array( |
346 | - 'name' => __( 'Sequential Ordering', 'give' ), |
|
346 | + 'name' => __('Sequential Ordering', 'give'), |
|
347 | 347 | 'id' => "{$current_section}_status", |
348 | - 'desc' => __( 'Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give' ), |
|
348 | + 'desc' => __('Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give'), |
|
349 | 349 | 'type' => 'radio_inline', |
350 | 350 | 'default' => 'disabled', |
351 | 351 | 'options' => array( |
352 | - 'enabled' => __( 'Enabled', 'give' ), |
|
353 | - 'disabled' => __( 'Disabled', 'give' ) |
|
352 | + 'enabled' => __('Enabled', 'give'), |
|
353 | + 'disabled' => __('Disabled', 'give') |
|
354 | 354 | ) |
355 | 355 | ), |
356 | 356 | array( |
357 | - 'name' => __( 'Next Donation Number', 'give' ), |
|
357 | + 'name' => __('Next Donation Number', 'give'), |
|
358 | 358 | 'id' => "{$current_section}_number", |
359 | 359 | 'desc' => sprintf( |
360 | - __( 'The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
361 | - '<code>' . Give()->seq_donation_number->get_next_number() . '</code>' |
|
360 | + __('The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give'), |
|
361 | + '<code>'.Give()->seq_donation_number->get_next_number().'</code>' |
|
362 | 362 | ), |
363 | 363 | 'type' => 'number', |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => __( 'Number Prefix', 'give' ), |
|
366 | + 'name' => __('Number Prefix', 'give'), |
|
367 | 367 | 'id' => "{$current_section}_number_prefix", |
368 | 368 | 'desc' => sprintf( |
369 | - __( 'The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
369 | + __('The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
370 | 370 | '<code>-</code>' |
371 | 371 | ), |
372 | 372 | 'type' => 'text', |
373 | 373 | ), |
374 | 374 | array( |
375 | - 'name' => __( 'Number Suffix', 'give' ), |
|
375 | + 'name' => __('Number Suffix', 'give'), |
|
376 | 376 | 'id' => "{$current_section}_number_suffix", |
377 | 377 | 'desc' => sprintf( |
378 | - __( 'The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
378 | + __('The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
379 | 379 | '<code>-</code>' |
380 | 380 | ), |
381 | 381 | 'type' => 'text', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => __( 'Number Padding', 'give' ), |
|
384 | + 'name' => __('Number Padding', 'give'), |
|
385 | 385 | 'id' => "{$current_section}_number_padding", |
386 | 386 | 'desc' => sprintf( |
387 | - __( 'The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give' ), |
|
387 | + __('The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give'), |
|
388 | 388 | '<code>4</code>', |
389 | 389 | '<code>1</code>', |
390 | 390 | '<code>0001</code>' |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | 'default' => '0', |
394 | 394 | ), |
395 | 395 | array( |
396 | - 'name' => __( 'Donation ID Preview', 'give' ), |
|
396 | + 'name' => __('Donation ID Preview', 'give'), |
|
397 | 397 | 'id' => "{$current_section}_preview", |
398 | 398 | 'type' => 'give_sequential_donation_code_preview', |
399 | - 'desc' => __( 'A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give' ), |
|
399 | + 'desc' => __('A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give'), |
|
400 | 400 | ), |
401 | 401 | array( |
402 | - 'name' => __( 'Sequential Ordering Docs Link', 'give' ), |
|
402 | + 'name' => __('Sequential Ordering Docs Link', 'give'), |
|
403 | 403 | 'id' => "{$current_section}_doc link", |
404 | - 'url' => esc_url( 'http://docs.givewp.com/settings-sequential-ordering' ), |
|
405 | - 'title' => __( 'Sequential Ordering', 'give' ), |
|
404 | + 'url' => esc_url('http://docs.givewp.com/settings-sequential-ordering'), |
|
405 | + 'title' => __('Sequential Ordering', 'give'), |
|
406 | 406 | 'type' => 'give_docs_link', |
407 | 407 | ), |
408 | 408 | array( |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * Filter the general settings. |
417 | 417 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
418 | 418 | */ |
419 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
419 | + $settings = apply_filters('give_settings_general', $settings); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Filter the settings. |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @param array $settings |
427 | 427 | */ |
428 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
428 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
429 | 429 | |
430 | 430 | // Output. |
431 | 431 | return $settings; |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function get_sections() { |
441 | 441 | $sections = array( |
442 | - 'general-settings' => __( 'General', 'give' ), |
|
443 | - 'currency-settings' => __( 'Currency', 'give' ), |
|
444 | - 'access-control' => __( 'Access Control', 'give' ), |
|
445 | - 'sequential-ordering' => __( 'Sequential Ordering', 'give' ), |
|
442 | + 'general-settings' => __('General', 'give'), |
|
443 | + 'currency-settings' => __('Currency', 'give'), |
|
444 | + 'access-control' => __('Access Control', 'give'), |
|
445 | + 'sequential-ordering' => __('Sequential Ordering', 'give'), |
|
446 | 446 | ); |
447 | 447 | |
448 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
448 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -461,23 +461,23 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return bool |
463 | 463 | */ |
464 | - public function __give_change_donation_stating_number( $update_options, $option_name, $old_options ) { |
|
465 | - if ( ! isset( $_POST['sequential-ordering_number'] ) ) { |
|
464 | + public function __give_change_donation_stating_number($update_options, $option_name, $old_options) { |
|
465 | + if ( ! isset($_POST['sequential-ordering_number'])) { |
|
466 | 466 | return false; |
467 | 467 | } |
468 | 468 | |
469 | - if ( ( $next_number = Give()->seq_donation_number->get_next_number() ) > $update_options['sequential-ordering_number'] ) { |
|
470 | - give_update_option( 'sequential-ordering_number', $next_number ); |
|
469 | + if (($next_number = Give()->seq_donation_number->get_next_number()) > $update_options['sequential-ordering_number']) { |
|
470 | + give_update_option('sequential-ordering_number', $next_number); |
|
471 | 471 | |
472 | 472 | Give_Admin_Settings::add_error( |
473 | 473 | 'give-invalid-sequential-starting-number', |
474 | 474 | sprintf( |
475 | - __( 'Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
475 | + __('Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give'), |
|
476 | 476 | $next_number |
477 | 477 | ) |
478 | 478 | ); |
479 | - } elseif ( $update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number'] ) { |
|
480 | - update_option( '_give_reset_sequential_number', 1, false ); |
|
479 | + } elseif ($update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number']) { |
|
480 | + update_option('_give_reset_sequential_number', 1, false); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | return true; |
@@ -492,16 +492,16 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param $field |
494 | 494 | */ |
495 | - public function __render_give_sequential_donation_code_preview( $field ) { |
|
495 | + public function __render_give_sequential_donation_code_preview($field) { |
|
496 | 496 | ?> |
497 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
497 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
498 | 498 | <th scope="row" class="titledesc"> |
499 | 499 | <label |
500 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
500 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
501 | 501 | </th> |
502 | 502 | <td class="give-forminp"> |
503 | - <input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled> |
|
504 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
503 | + <input id="<?php echo esc_attr($field['id']); ?>" class="give-input-field" type="text" disabled> |
|
504 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
505 | 505 | </td> |
506 | 506 | </tr> |
507 | 507 | <?php |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | * |
517 | 517 | * @param $field |
518 | 518 | */ |
519 | - public function __render_give_unlock_all_settings( $field ) { |
|
519 | + public function __render_give_unlock_all_settings($field) { |
|
520 | 520 | ?> |
521 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
521 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
522 | 522 | <th scope="row" class="titledesc"> |
523 | 523 | <label |
524 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
524 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
525 | 525 | </th> |
526 | 526 | <td class="give-forminp"> |
527 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
528 | - <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __( 'Unlock all settings', 'give' ); ?></a> |
|
527 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
528 | + <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __('Unlock all settings', 'give'); ?></a> |
|
529 | 529 | </td> |
530 | 530 | </tr> |
531 | 531 | <?php |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = __( 'Advanced', 'give' ); |
|
30 | + $this->label = __('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_admin_field_remove_cache_button', array( $this, 'render_remove_cache_button' ), 10, 1 ); |
|
36 | - add_action( 'give_save_settings_give_settings', array( $this, 'validate_settngs' ) ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_admin_field_remove_cache_button', array($this, 'render_remove_cache_button'), 10, 1); |
|
36 | + add_action('give_save_settings_give_settings', array($this, 'validate_settngs')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | parent::__construct(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $current_section = give_get_current_setting_section(); |
52 | 52 | |
53 | - switch ( $current_section ) { |
|
53 | + switch ($current_section) { |
|
54 | 54 | case 'advanced-options': |
55 | 55 | $settings = array( |
56 | 56 | array( |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | 'type' => 'title', |
59 | 59 | ), |
60 | 60 | array( |
61 | - 'name' => __( 'Remove Data on Uninstall', 'give' ), |
|
62 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
61 | + 'name' => __('Remove Data on Uninstall', 'give'), |
|
62 | + 'desc' => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
63 | 63 | 'id' => 'uninstall_on_delete', |
64 | 64 | 'type' => 'radio_inline', |
65 | 65 | 'default' => 'disabled', |
66 | 66 | 'options' => array( |
67 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
68 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
67 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
68 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
69 | 69 | ), |
70 | 70 | ), |
71 | 71 | array( |
72 | - 'name' => __( 'Default User Role', 'give' ), |
|
73 | - 'desc' => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ), |
|
72 | + 'name' => __('Default User Role', 'give'), |
|
73 | + 'desc' => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'), |
|
74 | 74 | 'id' => 'donor_default_user_role', |
75 | 75 | 'type' => 'select', |
76 | 76 | 'default' => 'give_donor', |
@@ -78,51 +78,51 @@ discard block |
||
78 | 78 | ), |
79 | 79 | array( |
80 | 80 | /* translators: %s: the_content */ |
81 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
81 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
82 | 82 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
83 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
83 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
84 | 84 | 'id' => 'the_content_filter', |
85 | 85 | 'default' => 'enabled', |
86 | 86 | 'type' => 'radio_inline', |
87 | 87 | 'options' => array( |
88 | - 'enabled' => __( 'Enabled', 'give' ), |
|
89 | - 'disabled' => __( 'Disabled', 'give' ), |
|
88 | + 'enabled' => __('Enabled', 'give'), |
|
89 | + 'disabled' => __('Disabled', 'give'), |
|
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | array( |
93 | - 'name' => __( 'Script Loading Location', 'give' ), |
|
94 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
93 | + 'name' => __('Script Loading Location', 'give'), |
|
94 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
95 | 95 | 'id' => 'scripts_footer', |
96 | 96 | 'type' => 'radio_inline', |
97 | 97 | 'default' => 'disabled', |
98 | 98 | 'options' => array( |
99 | - 'disabled' => __( 'Head', 'give' ), |
|
100 | - 'enabled' => __( 'Footer', 'give' ), |
|
99 | + 'disabled' => __('Head', 'give'), |
|
100 | + 'enabled' => __('Footer', 'give'), |
|
101 | 101 | ), |
102 | 102 | ), |
103 | 103 | array( |
104 | - 'name' => __( 'Akismet SPAM Protection', 'give' ), |
|
105 | - 'desc' => __( 'Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give' ), |
|
104 | + 'name' => __('Akismet SPAM Protection', 'give'), |
|
105 | + 'desc' => __('Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give'), |
|
106 | 106 | 'id' => 'akismet_spam_protection', |
107 | 107 | 'type' => 'radio_inline', |
108 | - 'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled', |
|
108 | + 'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled', |
|
109 | 109 | 'options' => array( |
110 | - 'enabled' => __( 'Enabled', 'give' ), |
|
111 | - 'disabled' => __( 'Disabled', 'give' ), |
|
110 | + 'enabled' => __('Enabled', 'give'), |
|
111 | + 'disabled' => __('Disabled', 'give'), |
|
112 | 112 | ), |
113 | 113 | ), |
114 | 114 | array( |
115 | 115 | 'name' => 'Give Cache', |
116 | 116 | 'id' => 'give-clear-cache', |
117 | - 'buttonTitle' => __( 'Clear Cache', 'give' ), |
|
118 | - 'desc' => __( 'Click this button if you want to clear Give\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give' ), |
|
117 | + 'buttonTitle' => __('Clear Cache', 'give'), |
|
118 | + 'desc' => __('Click this button if you want to clear Give\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give'), |
|
119 | 119 | 'type' => 'remove_cache_button' |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Advanced Settings Docs Link', 'give' ), |
|
122 | + 'name' => __('Advanced Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'advanced_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
125 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
125 | + 'title' => __('Advanced Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @since 2.0 |
140 | 140 | */ |
141 | - if ( apply_filters( 'give_settings_advanced_show_cache_setting', false ) ) { |
|
142 | - array_splice( $settings, 1, 0, array( |
|
141 | + if (apply_filters('give_settings_advanced_show_cache_setting', false)) { |
|
142 | + array_splice($settings, 1, 0, array( |
|
143 | 143 | array( |
144 | - 'name' => __( 'Cache', 'give' ), |
|
145 | - 'desc' => __( 'If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give' ), |
|
144 | + 'name' => __('Cache', 'give'), |
|
145 | + 'desc' => __('If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give'), |
|
146 | 146 | 'id' => 'cache', |
147 | 147 | 'type' => 'radio_inline', |
148 | 148 | 'default' => 'enabled', |
149 | 149 | 'options' => array( |
150 | - 'enabled' => __( 'Enabled', 'give' ), |
|
151 | - 'disabled' => __( 'Disabled', 'give' ), |
|
150 | + 'enabled' => __('Enabled', 'give'), |
|
151 | + 'disabled' => __('Disabled', 'give'), |
|
152 | 152 | ), |
153 | 153 | ) |
154 | - ) ); |
|
154 | + )); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * Filter the advanced settings. |
160 | 160 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
161 | 161 | */ |
162 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
162 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Filter the settings. |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @param array $settings |
170 | 170 | */ |
171 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
171 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
172 | 172 | |
173 | 173 | // Output. |
174 | 174 | return $settings; |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function get_sections() { |
184 | 184 | $sections = array( |
185 | - 'advanced-options' => __( 'Advanced Options', 'give' ), |
|
185 | + 'advanced-options' => __('Advanced Options', 'give'), |
|
186 | 186 | ); |
187 | 187 | |
188 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
188 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param array $field |
199 | 199 | */ |
200 | - public function render_remove_cache_button( $field ) { |
|
200 | + public function render_remove_cache_button($field) { |
|
201 | 201 | ?> |
202 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
202 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
203 | 203 | <th scope="row" class="titledesc"> |
204 | 204 | <label |
205 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
205 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
206 | 206 | </th> |
207 | 207 | <td class="give-forminp"> |
208 | - <button type="button" id="<?php echo esc_attr( $field['id'] ); ?>" |
|
209 | - class="button button-secondary"><?php echo esc_html( $field['buttonTitle'] ) ?></button> |
|
210 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
208 | + <button type="button" id="<?php echo esc_attr($field['id']); ?>" |
|
209 | + class="button button-secondary"><?php echo esc_html($field['buttonTitle']) ?></button> |
|
210 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
211 | 211 | </td> |
212 | 212 | </tr> |
213 | 213 | <?php |
@@ -222,23 +222,23 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @param array $options |
224 | 224 | */ |
225 | - public function validate_settngs( $options ) { |
|
225 | + public function validate_settngs($options) { |
|
226 | 226 | // Sanitize data. |
227 | - $akismet_spam_protection = isset( $options['akismet_spam_protection'] ) |
|
227 | + $akismet_spam_protection = isset($options['akismet_spam_protection']) |
|
228 | 228 | ? $options['akismet_spam_protection'] |
229 | - : ( give_check_akismet_key() ? 'enabled' : 'disabled' ); |
|
229 | + : (give_check_akismet_key() ? 'enabled' : 'disabled'); |
|
230 | 230 | |
231 | 231 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
232 | 232 | if ( |
233 | - give_is_setting_enabled( $akismet_spam_protection ) |
|
233 | + give_is_setting_enabled($akismet_spam_protection) |
|
234 | 234 | && ! give_check_akismet_key() |
235 | 235 | ) { |
236 | 236 | Give_Admin_Settings::add_error( |
237 | 237 | 'give-akismet-protection', |
238 | - __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) |
|
238 | + __('Please properly configure Akismet to enable SPAM protection.', 'give') |
|
239 | 239 | ); |
240 | 240 | |
241 | - give_update_option( 'akismet_spam_protection', 'disabled' ); |
|
241 | + give_update_option('akismet_spam_protection', 'disabled'); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
17 | +if ( ! current_user_can('view_give_payments')) { |
|
18 | 18 | wp_die( |
19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
20 | 20 | 'response' => 403, |
21 | 21 | ) |
22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | * @since 1.0 |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Setup the variables |
36 | -$payment_id = absint( $_GET['id'] ); |
|
37 | -$payment = new Give_Payment( $payment_id ); |
|
36 | +$payment_id = absint($_GET['id']); |
|
37 | +$payment = new Give_Payment($payment_id); |
|
38 | 38 | |
39 | 39 | // Sanity check... fail if donation ID is invalid |
40 | 40 | $payment_exists = $payment->ID; |
41 | -if ( empty( $payment_exists ) ) { |
|
42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
41 | +if (empty($payment_exists)) { |
|
42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $number = $payment->number; |
46 | 46 | $payment_meta = $payment->get_meta(); |
47 | 47 | |
48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
50 | 50 | $user_id = $payment->user_id; |
51 | 51 | $donor_id = $payment->customer_id; |
52 | -$payment_date = strtotime( $payment->date ); |
|
53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
52 | +$payment_date = strtotime($payment->date); |
|
53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
54 | 54 | $address = $payment->address; |
55 | 55 | $currency_code = $payment->currency; |
56 | 56 | $gateway = $payment->gateway; |
57 | 57 | $currency_code = $payment->currency; |
58 | 58 | $payment_mode = $payment->mode; |
59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: %s: donation number */ |
68 | - esc_html__( 'Donation %s', 'give' ), |
|
68 | + esc_html__('Donation %s', 'give'), |
|
69 | 69 | $number |
70 | 70 | ); |
71 | - if ( $payment_mode == 'test' ) { |
|
71 | + if ($payment_mode == 'test') { |
|
72 | 72 | echo Give()->tooltips->render_span(array( |
73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
74 | + 'tag_content' => __('Test Donation', 'give'), |
|
75 | 75 | 'position'=> 'right', |
76 | 76 | 'attributes' => array( |
77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param int $payment_id Payment id. |
92 | 92 | */ |
93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
93 | + do_action('give_view_donation_details_before', $payment_id); |
|
94 | 94 | ?> |
95 | 95 | |
96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param int $payment_id Payment id. |
106 | 106 | */ |
107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
108 | 108 | ?> |
109 | 109 | <div id="poststuff"> |
110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param int $payment_id Payment id. |
122 | 122 | */ |
123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
127 | 127 | |
128 | 128 | <div class="give-order-top"> |
129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
130 | 130 | |
131 | 131 | <?php |
132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
132 | + if (current_user_can('view_give_payments')) { |
|
133 | 133 | echo sprintf( |
134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ), $base_url |
142 | 142 | ), 'give_donation_nonce' |
143 | 143 | ), |
144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | ?> |
@@ -158,34 +158,34 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $payment_id Payment id. |
160 | 160 | */ |
161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <div class="give-admin-box-inside"> |
165 | 165 | <p> |
166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
170 | 170 | <?php endforeach; ?> |
171 | 171 | </select> |
172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
173 | 173 | </p> |
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div class="give-admin-box-inside"> |
177 | 177 | <?php $localized_date_format = give_get_localized_date_format_to_js(); ?> |
178 | 178 | <p> |
179 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
180 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
179 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
180 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
181 | 181 | </p> |
182 | 182 | </div> |
183 | 183 | |
184 | 184 | <div class="give-admin-box-inside"> |
185 | 185 | <p> |
186 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
187 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
186 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
187 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
189 | 189 | </p> |
190 | 190 | </div> |
191 | 191 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @param int $payment_id Payment id. |
201 | 201 | */ |
202 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
202 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
203 | 203 | ?> |
204 | 204 | |
205 | 205 | <div class="give-order-payment give-admin-box-inside"> |
206 | 206 | <p> |
207 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
208 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
209 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
207 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
208 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
209 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
210 | 210 | </p> |
211 | 211 | </div> |
212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param int $payment_id Payment id. |
220 | 220 | */ |
221 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
221 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
222 | 222 | ?> |
223 | 223 | |
224 | 224 | </div> |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param int $payment_id Payment id. |
238 | 238 | */ |
239 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
239 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <div id="major-publishing-actions"> |
243 | 243 | <div id="publishing-action"> |
244 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
244 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
245 | 245 | <?php |
246 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
246 | + if (give_is_payment_complete($payment_id)) { |
|
247 | 247 | $url = add_query_arg( |
248 | 248 | array( |
249 | 249 | 'give-action' => 'email_links', |
250 | 250 | 'purchase_id' => $payment_id, |
251 | 251 | ), |
252 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ) |
|
252 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id) |
|
253 | 253 | ); |
254 | 254 | |
255 | 255 | echo sprintf( |
256 | 256 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
257 | - esc_url( $url ), |
|
258 | - esc_html__( 'Resend Receipt', 'give' ) |
|
257 | + esc_url($url), |
|
258 | + esc_html__('Resend Receipt', 'give') |
|
259 | 259 | ); |
260 | 260 | } |
261 | 261 | ?> |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @param int $payment_id Payment id. |
272 | 272 | */ |
273 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
273 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
274 | 274 | ?> |
275 | 275 | |
276 | 276 | </div> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | <div id="give-order-details" class="postbox give-order-data"> |
283 | 283 | |
284 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
284 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
285 | 285 | |
286 | 286 | <div class="inside"> |
287 | 287 | <div class="give-admin-box"> |
@@ -294,30 +294,30 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param int $payment_id Payment id. |
296 | 296 | */ |
297 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
297 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
298 | 298 | |
299 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
300 | - if ( $gateway ) : |
|
299 | + $gateway = give_get_payment_gateway($payment_id); |
|
300 | + if ($gateway) : |
|
301 | 301 | ?> |
302 | 302 | <div class="give-order-gateway give-admin-box-inside"> |
303 | 303 | <p> |
304 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
305 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
304 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
305 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
306 | 306 | </p> |
307 | 307 | </div> |
308 | 308 | <?php endif; ?> |
309 | 309 | |
310 | 310 | <div class="give-order-payment-key give-admin-box-inside"> |
311 | 311 | <p> |
312 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
313 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
312 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
313 | + <?php echo give_get_payment_key($payment_id); ?> |
|
314 | 314 | </p> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="give-order-ip give-admin-box-inside"> |
318 | 318 | <p> |
319 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
320 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
319 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
320 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
321 | 321 | </p> |
322 | 322 | </div> |
323 | 323 | |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | // Display the transaction ID present. |
326 | 326 | // The transaction ID is the charge ID from the gateway. |
327 | 327 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
328 | - if ( $transaction_id != $payment_id ) : ?> |
|
328 | + if ($transaction_id != $payment_id) : ?> |
|
329 | 329 | <div class="give-order-tx-id give-admin-box-inside"> |
330 | 330 | <p> |
331 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
332 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
331 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
332 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
333 | 333 | </p> |
334 | 334 | </div> |
335 | 335 | <?php endif; ?> |
336 | 336 | |
337 | 337 | <div class="give-admin-box-inside"> |
338 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
339 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
338 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
339 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
340 | 340 | </p> |
341 | 341 | </div> |
342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param int $payment_id Payment id. |
350 | 350 | */ |
351 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
351 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
352 | 352 | ?> |
353 | 353 | |
354 | 354 | </div> |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param int $payment_id Payment id. |
370 | 370 | */ |
371 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
371 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
372 | 372 | ?> |
373 | 373 | |
374 | 374 | </div> |
@@ -388,31 +388,31 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @param int $payment_id Payment id. |
390 | 390 | */ |
391 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
391 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
392 | 392 | ?> |
393 | 393 | |
394 | 394 | <?php $column_count = 'columns-3'; ?> |
395 | 395 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
396 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
396 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
397 | 397 | |
398 | 398 | <div class="inside"> |
399 | 399 | |
400 | 400 | <div class="column-container"> |
401 | 401 | <div class="column"> |
402 | 402 | <p> |
403 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
403 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
404 | 404 | <?php |
405 | - if ( $payment_meta['form_id'] ) : |
|
405 | + if ($payment_meta['form_id']) : |
|
406 | 406 | printf( |
407 | 407 | '<a href="%1$s">%2$s</a>', |
408 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
408 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
409 | 409 | $payment_meta['form_id'] |
410 | 410 | ); |
411 | 411 | endif; |
412 | 412 | ?> |
413 | 413 | </p> |
414 | 414 | <p> |
415 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
415 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
416 | 416 | <?php |
417 | 417 | echo Give()->html->forms_dropdown( |
418 | 418 | array( |
@@ -428,21 +428,21 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | <div class="column"> |
430 | 430 | <p> |
431 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
432 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
431 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
432 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
433 | 433 | </p> |
434 | 434 | <p> |
435 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
435 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
436 | 436 | <span class="give-donation-level"> |
437 | 437 | <?php |
438 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
439 | - if ( empty( $var_prices ) ) { |
|
440 | - _e( 'n/a', 'give' ); |
|
438 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
439 | + if (empty($var_prices)) { |
|
440 | + _e('n/a', 'give'); |
|
441 | 441 | } else { |
442 | 442 | $prices_atts = array(); |
443 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
444 | - foreach ( $variable_prices as $variable_price ) { |
|
445 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
443 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
444 | + foreach ($variable_prices as $variable_price) { |
|
445 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | // Variable price dropdown options. |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | 'name' => 'give-variable-price', |
452 | 452 | 'chosen' => true, |
453 | 453 | 'show_option_all' => '', |
454 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
455 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
454 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
455 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
456 | 456 | 'selected' => $payment_meta['price_id'], |
457 | 457 | ); |
458 | 458 | // Render variable prices select tag html. |
459 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
459 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
460 | 460 | } |
461 | 461 | ?> |
462 | 462 | </span> |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | </div> |
465 | 465 | <div class="column"> |
466 | 466 | <p> |
467 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
468 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
467 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
468 | + <?php echo give_donation_amount($payment, true); ?> |
|
469 | 469 | </p> |
470 | 470 | |
471 | - <?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ): ?> |
|
471 | + <?php if (give_is_anonymous_donation_field_enabled($payment->form_id)): ?> |
|
472 | 472 | <div> |
473 | - <strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong> |
|
473 | + <strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong> |
|
474 | 474 | <ul class="give-radio-inline"> |
475 | 475 | <li> |
476 | 476 | <label> |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | name="give_anonymous_donation" |
479 | 479 | value="1" |
480 | 480 | type="radio" |
481 | - <?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
482 | - ><?php _e( 'Yes', 'give' ); ?> |
|
481 | + <?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
482 | + ><?php _e('Yes', 'give'); ?> |
|
483 | 483 | </label> |
484 | 484 | </li> |
485 | 485 | <li> |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | name="give_anonymous_donation" |
489 | 489 | value="0" |
490 | 490 | type="radio" |
491 | - <?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
492 | - ><?php _e( 'No', 'give' ); ?> |
|
491 | + <?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
492 | + ><?php _e('No', 'give'); ?> |
|
493 | 493 | </label> |
494 | 494 | </li> |
495 | 495 | </ul> |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @param int $payment_id Payment id. |
508 | 508 | */ |
509 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
509 | + do_action('give_donation_details_thead_before', $payment_id); |
|
510 | 510 | |
511 | 511 | |
512 | 512 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * |
519 | 519 | * @param int $payment_id Payment id. |
520 | 520 | */ |
521 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
521 | + do_action('give_donation_details_thead_after', $payment_id); |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @param int $payment_id Payment id. |
531 | 531 | */ |
532 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
532 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * |
541 | 541 | * @param int $payment_id Payment id. |
542 | 542 | */ |
543 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
543 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
544 | 544 | ?> |
545 | 545 | </p> |
546 | 546 | </div> |
@@ -560,67 +560,67 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @param int $payment_id Payment id. |
562 | 562 | */ |
563 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
563 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
564 | 564 | ?> |
565 | 565 | |
566 | 566 | <div id="give-donor-details" class="postbox"> |
567 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
567 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
568 | 568 | |
569 | 569 | <div class="inside"> |
570 | 570 | |
571 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
571 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
572 | 572 | |
573 | 573 | <div class="column-container donor-info"> |
574 | 574 | <div class="column"> |
575 | 575 | <p> |
576 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
576 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
577 | 577 | <?php |
578 | - if ( ! empty( $donor->id ) ) { |
|
578 | + if ( ! empty($donor->id)) { |
|
579 | 579 | printf( |
580 | 580 | '<a href="%1$s">%2$s</a>', |
581 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ), |
|
582 | - intval( $donor->id ) |
|
581 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)), |
|
582 | + intval($donor->id) |
|
583 | 583 | ); |
584 | 584 | } |
585 | 585 | ?> |
586 | - <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
586 | + <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span> |
|
587 | 587 | </p> |
588 | 588 | <p> |
589 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
590 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
589 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
590 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
591 | 591 | </p> |
592 | 592 | </div> |
593 | 593 | <div class="column"> |
594 | 594 | <p> |
595 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
595 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
596 | 596 | <?php |
597 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
598 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
597 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
598 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
599 | 599 | |
600 | 600 | // Check whether the donor name and WP_User name is same or not. |
601 | - if ( $donor_billing_name !== $donor_name ) { |
|
601 | + if ($donor_billing_name !== $donor_name) { |
|
602 | 602 | echo sprintf( |
603 | 603 | '%1$s (<a href="%2$s">%3$s</a>)', |
604 | - esc_html( $donor_billing_name ), |
|
604 | + esc_html($donor_billing_name), |
|
605 | 605 | sprintf( |
606 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=%s' ) ), |
|
607 | - intval( $donor_id ) |
|
606 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=%s')), |
|
607 | + intval($donor_id) |
|
608 | 608 | ), |
609 | - esc_html( $donor_name ) |
|
609 | + esc_html($donor_name) |
|
610 | 610 | ); |
611 | 611 | } else { |
612 | - echo esc_html( $donor_name ); |
|
612 | + echo esc_html($donor_name); |
|
613 | 613 | } |
614 | 614 | ?> |
615 | 615 | </p> |
616 | 616 | <p> |
617 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
618 | - <?php echo esc_attr( $donor->email ); ?> |
|
617 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
618 | + <?php echo esc_attr($donor->email); ?> |
|
619 | 619 | </p> |
620 | 620 | </div> |
621 | 621 | <div class="column"> |
622 | 622 | <p> |
623 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
623 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
624 | 624 | <?php |
625 | 625 | echo Give()->html->donor_dropdown( |
626 | 626 | array( |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | ?> |
632 | 632 | </p> |
633 | 633 | <p> |
634 | - <?php if ( ! empty( $company_name ) ) { |
|
634 | + <?php if ( ! empty($company_name)) { |
|
635 | 635 | ?> |
636 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
636 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
637 | 637 | <?php |
638 | 638 | echo $company_name; |
639 | 639 | } ?> |
@@ -644,19 +644,19 @@ discard block |
||
644 | 644 | <div class="column-container new-donor" style="display: none"> |
645 | 645 | <div class="column"> |
646 | 646 | <p> |
647 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
647 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
648 | 648 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
649 | 649 | </p> |
650 | 650 | </div> |
651 | 651 | <div class="column"> |
652 | 652 | <p> |
653 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
653 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
654 | 654 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
655 | 655 | </p> |
656 | 656 | </div> |
657 | 657 | <div class="column"> |
658 | 658 | <p> |
659 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
659 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
660 | 660 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
661 | 661 | </p> |
662 | 662 | </div> |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | <p> |
665 | 665 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
666 | 666 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
667 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
667 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
668 | 668 | <br> |
669 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
669 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
670 | 670 | </p> |
671 | 671 | </div> |
672 | 672 | </div> |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @param array $payment_meta Payment meta. |
682 | 682 | * @param array $user_info User information. |
683 | 683 | */ |
684 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
684 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
685 | 685 | |
686 | 686 | /** |
687 | 687 | * Fires on the donation details page, in the donor-details metabox. |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * |
691 | 691 | * @param int $payment_id Payment id. |
692 | 692 | */ |
693 | - do_action( 'give_payment_view_details', $payment_id ); |
|
693 | + do_action('give_payment_view_details', $payment_id); |
|
694 | 694 | ?> |
695 | 695 | |
696 | 696 | </div> |
@@ -706,11 +706,11 @@ discard block |
||
706 | 706 | * |
707 | 707 | * @param int $payment_id Payment id. |
708 | 708 | */ |
709 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
709 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
710 | 710 | ?> |
711 | 711 | |
712 | 712 | <div id="give-billing-details" class="postbox"> |
713 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
713 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
714 | 714 | |
715 | 715 | <div class="inside"> |
716 | 716 | |
@@ -720,9 +720,9 @@ discard block |
||
720 | 720 | <div class="data column-container"> |
721 | 721 | |
722 | 722 | <?php |
723 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
723 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
724 | 724 | |
725 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
725 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
726 | 726 | |
727 | 727 | // Get the country list that does not have any states init. |
728 | 728 | $no_states_country = give_no_states_country_list(); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | <div class="row"> |
732 | 732 | <div id="give-order-address-country-wrap"> |
733 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
733 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
734 | 734 | <?php |
735 | 735 | echo Give()->html->select( |
736 | 736 | array( |
@@ -740,8 +740,8 @@ discard block |
||
740 | 740 | 'show_option_all' => false, |
741 | 741 | 'show_option_none' => false, |
742 | 742 | 'chosen' => true, |
743 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
744 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
743 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
744 | + 'data' => array('search-type' => 'no_ajax'), |
|
745 | 745 | ) |
746 | 746 | ); |
747 | 747 | ?> |
@@ -750,35 +750,35 @@ discard block |
||
750 | 750 | |
751 | 751 | <div class="row"> |
752 | 752 | <div class="give-wrap-address-line1"> |
753 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
754 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
753 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
754 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
755 | 755 | </div> |
756 | 756 | </div> |
757 | 757 | |
758 | 758 | <div class="row"> |
759 | 759 | <div class="give-wrap-address-line2"> |
760 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
761 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
760 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
761 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
762 | 762 | </div> |
763 | 763 | </div> |
764 | 764 | |
765 | 765 | <div class="row"> |
766 | 766 | <div class="give-wrap-address-city"> |
767 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
768 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
767 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
768 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
769 | 769 | </div> |
770 | 770 | </div> |
771 | 771 | |
772 | 772 | <?php |
773 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
773 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
774 | 774 | ?> |
775 | 775 | <div class="row"> |
776 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
777 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
778 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
776 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
777 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
778 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
779 | 779 | <?php |
780 | - $states = give_get_states( $address['country'] ); |
|
781 | - if ( ! empty( $states ) ) { |
|
780 | + $states = give_get_states($address['country']); |
|
781 | + if ( ! empty($states)) { |
|
782 | 782 | echo Give()->html->select( |
783 | 783 | array( |
784 | 784 | 'options' => $states, |
@@ -787,23 +787,23 @@ discard block |
||
787 | 787 | 'show_option_all' => false, |
788 | 788 | 'show_option_none' => false, |
789 | 789 | 'chosen' => true, |
790 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
791 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
790 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
791 | + 'data' => array('search-type' => 'no_ajax'), |
|
792 | 792 | ) |
793 | 793 | ); |
794 | 794 | } else { |
795 | 795 | ?> |
796 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
796 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
797 | 797 | <?php |
798 | 798 | } |
799 | 799 | ?> |
800 | 800 | </div> |
801 | 801 | </div> |
802 | 802 | |
803 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
803 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
804 | 804 | <div class="give-wrap-address-zip"> |
805 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
806 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
805 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
806 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
807 | 807 | </div> |
808 | 808 | </div> |
809 | 809 | </div> |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @param int $payment_id Payment id. |
824 | 824 | */ |
825 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
825 | + do_action('give_payment_billing_details', $payment_id); |
|
826 | 826 | ?> |
827 | 827 | |
828 | 828 | </div> |
@@ -838,34 +838,34 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @param int $payment_id Payment id. |
840 | 840 | */ |
841 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
841 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
842 | 842 | ?> |
843 | 843 | |
844 | 844 | <div id="give-payment-notes" class="postbox"> |
845 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
845 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
846 | 846 | |
847 | 847 | <div class="inside"> |
848 | 848 | <div id="give-payment-notes-inner"> |
849 | 849 | <?php |
850 | - $notes = give_get_payment_notes( $payment_id ); |
|
851 | - if ( ! empty( $notes ) ) { |
|
850 | + $notes = give_get_payment_notes($payment_id); |
|
851 | + if ( ! empty($notes)) { |
|
852 | 852 | $no_notes_display = ' style="display:none;"'; |
853 | - foreach ( $notes as $note ) : |
|
853 | + foreach ($notes as $note) : |
|
854 | 854 | |
855 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
855 | + echo give_get_payment_note_html($note, $payment_id); |
|
856 | 856 | |
857 | 857 | endforeach; |
858 | 858 | } else { |
859 | 859 | $no_notes_display = ''; |
860 | 860 | } |
861 | 861 | |
862 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
862 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
863 | 863 | ?> |
864 | 864 | </div> |
865 | 865 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
866 | 866 | |
867 | 867 | <div class="give-clearfix"> |
868 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
868 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
869 | 869 | </div> |
870 | 870 | |
871 | 871 | </div> |
@@ -881,18 +881,18 @@ discard block |
||
881 | 881 | * |
882 | 882 | * @param int $payment_id Payment id. |
883 | 883 | */ |
884 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
884 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
885 | 885 | ?> |
886 | 886 | |
887 | - <?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?> |
|
887 | + <?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?> |
|
888 | 888 | <div id="give-payment-donor-comment" class="postbox"> |
889 | - <h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3> |
|
889 | + <h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3> |
|
890 | 890 | |
891 | 891 | <div class="inside"> |
892 | 892 | <div id="give-payment-donor-comment-inner"> |
893 | 893 | <p> |
894 | 894 | <?php |
895 | - $donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id ); |
|
895 | + $donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id); |
|
896 | 896 | |
897 | 897 | echo sprintf( |
898 | 898 | '<input type="hidden" name="give_comment_id" value="%s">', |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | |
902 | 902 | echo sprintf( |
903 | 903 | '<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>', |
904 | - __( 'Add a comment', 'give' ), |
|
904 | + __('Add a comment', 'give'), |
|
905 | 905 | $donor_comment instanceof WP_Comment ? $donor_comment->comment_content : '' |
906 | 906 | ); |
907 | 907 | ?> |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * |
923 | 923 | * @param int $payment_id Payment id. |
924 | 924 | */ |
925 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
925 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
926 | 926 | ?> |
927 | 927 | |
928 | 928 | </div> |
@@ -944,11 +944,11 @@ discard block |
||
944 | 944 | * |
945 | 945 | * @param int $payment_id Payment id. |
946 | 946 | */ |
947 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
947 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
948 | 948 | |
949 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
949 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
950 | 950 | ?> |
951 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
951 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
952 | 952 | <input type="hidden" name="give_action" value="update_payment_details"/> |
953 | 953 | </form> |
954 | 954 | <?php |
@@ -959,6 +959,6 @@ discard block |
||
959 | 959 | * |
960 | 960 | * @param int $payment_id Payment id. |
961 | 961 | */ |
962 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
962 | + do_action('give_view_donation_details_after', $payment_id); |
|
963 | 963 | ?> |
964 | 964 | </div><!-- /.wrap --> |
@@ -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,48 +25,48 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | $status = $data['give-payment-status']; |
43 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
44 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
43 | + $date = sanitize_text_field($data['give-payment-date']); |
|
44 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
45 | 45 | |
46 | 46 | // Restrict to our high and low. |
47 | - if ( $hour > 23 ) { |
|
47 | + if ($hour > 23) { |
|
48 | 48 | $hour = 23; |
49 | - } elseif ( $hour < 0 ) { |
|
49 | + } elseif ($hour < 0) { |
|
50 | 50 | $hour = 00; |
51 | 51 | } |
52 | 52 | |
53 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
53 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
54 | 54 | |
55 | 55 | // Restrict to our high and low. |
56 | - if ( $minute > 59 ) { |
|
56 | + if ($minute > 59) { |
|
57 | 57 | $minute = 59; |
58 | - } elseif ( $minute < 0 ) { |
|
58 | + } elseif ($minute < 0) { |
|
59 | 59 | $minute = 00; |
60 | 60 | } |
61 | 61 | |
62 | - $address = give_clean( $data['give-payment-address'][0] ); |
|
62 | + $address = give_clean($data['give-payment-address'][0]); |
|
63 | 63 | |
64 | 64 | $curr_total = $payment->total; |
65 | - $new_total = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) ); |
|
66 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
65 | + $new_total = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0)); |
|
66 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
67 | 67 | |
68 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
69 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
68 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
69 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Fires before updating edited donation. |
@@ -76,74 +76,74 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param int $payment_id The ID of the payment. |
78 | 78 | */ |
79 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
79 | + do_action('give_update_edited_donation', $payment_id); |
|
80 | 80 | |
81 | 81 | $payment->date = $date; |
82 | - $payment->anonymous = isset( $data['give_anonymous_donation'] ) ? absint( $data['give_anonymous_donation'] ) : 0; |
|
82 | + $payment->anonymous = isset($data['give_anonymous_donation']) ? absint($data['give_anonymous_donation']) : 0; |
|
83 | 83 | |
84 | 84 | |
85 | - $updated = $payment->save(); |
|
85 | + $updated = $payment->save(); |
|
86 | 86 | |
87 | - if ( 0 === $updated ) { |
|
88 | - wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
87 | + if (0 === $updated) { |
|
88 | + wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $donor_changed = false; |
92 | 92 | |
93 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
93 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
94 | 94 | |
95 | - $email = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
96 | - $first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : ''; |
|
97 | - $last_name = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : ''; |
|
98 | - $names = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
95 | + $email = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
96 | + $first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : ''; |
|
97 | + $last_name = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : ''; |
|
98 | + $names = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
99 | 99 | |
100 | - if ( empty( $email ) || empty( $first_name ) ) { |
|
101 | - wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
100 | + if (empty($email) || empty($first_name)) { |
|
101 | + wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
102 | 102 | } |
103 | 103 | |
104 | - $donor = new Give_Donor( $email ); |
|
105 | - if ( empty( $donor->id ) ) { |
|
106 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
107 | - $user_id = email_exists( $email ); |
|
108 | - if ( false !== $user_id ) { |
|
104 | + $donor = new Give_Donor($email); |
|
105 | + if (empty($donor->id)) { |
|
106 | + $donor_data = array('name' => $names, 'email' => $email); |
|
107 | + $user_id = email_exists($email); |
|
108 | + if (false !== $user_id) { |
|
109 | 109 | $donor_data['user_id'] = $user_id; |
110 | 110 | } |
111 | 111 | |
112 | - if ( ! $donor->create( $donor_data ) ) { |
|
112 | + if ( ! $donor->create($donor_data)) { |
|
113 | 113 | // Failed to create the new donor, assume the previous donor. |
114 | 114 | $donor_changed = false; |
115 | - $donor = new Give_Donor( $curr_donor_id ); |
|
116 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
115 | + $donor = new Give_Donor($curr_donor_id); |
|
116 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Create and Update Donor First Name and Last Name in Meta Fields. |
121 | - $donor->update_meta( '_give_donor_first_name', $first_name ); |
|
122 | - $donor->update_meta( '_give_donor_last_name', $last_name ); |
|
121 | + $donor->update_meta('_give_donor_first_name', $first_name); |
|
122 | + $donor->update_meta('_give_donor_last_name', $last_name); |
|
123 | 123 | |
124 | 124 | $new_donor_id = $donor->id; |
125 | 125 | |
126 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
126 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
127 | 127 | |
128 | 128 | $donor_changed = true; |
129 | 129 | |
130 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
130 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
131 | 131 | |
132 | - $donor = new Give_Donor( $new_donor_id ); |
|
132 | + $donor = new Give_Donor($new_donor_id); |
|
133 | 133 | $email = $donor->email; |
134 | 134 | $names = $donor->name; |
135 | 135 | |
136 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
136 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
137 | 137 | |
138 | 138 | $donor_changed = true; |
139 | 139 | |
140 | 140 | } else { |
141 | - $donor = new Give_Donor( $curr_donor_id ); |
|
141 | + $donor = new Give_Donor($curr_donor_id); |
|
142 | 142 | $email = $donor->email; |
143 | 143 | $names = $donor->name; |
144 | 144 | } |
145 | 145 | |
146 | - if ( $donor_changed ) { |
|
146 | + if ($donor_changed) { |
|
147 | 147 | |
148 | 148 | // Setup first and last name from input values. |
149 | 149 | $first_name = $donor->get_first_name(); |
@@ -153,26 +153,26 @@ discard block |
||
153 | 153 | $payment->last_name = $last_name; |
154 | 154 | |
155 | 155 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
156 | - $previous_donor->remove_payment( $payment_id, false ); |
|
157 | - $donor->attach_payment( $payment_id, false ); |
|
156 | + $previous_donor->remove_payment($payment_id, false); |
|
157 | + $donor->attach_payment($payment_id, false); |
|
158 | 158 | |
159 | - if ( 'publish' == $status ) { |
|
159 | + if ('publish' == $status) { |
|
160 | 160 | |
161 | 161 | // Reduce previous user donation count and amount. |
162 | 162 | $previous_donor->decrease_donation_count(); |
163 | - $previous_donor->decrease_value( $curr_total ); |
|
163 | + $previous_donor->decrease_value($curr_total); |
|
164 | 164 | |
165 | 165 | // If donation was completed adjust stats of new donors. |
166 | 166 | $donor->increase_purchase_count(); |
167 | - $donor->increase_value( $new_total ); |
|
167 | + $donor->increase_value($new_total); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $payment->customer_id = $donor->id; |
171 | 171 | } else { |
172 | 172 | |
173 | - if ( 'publish' === $status ) { |
|
173 | + if ('publish' === $status) { |
|
174 | 174 | // Update user donation stat. |
175 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
175 | + $donor->update_donation_value($curr_total, $new_total); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | $payment->total = $new_total; |
184 | 184 | |
185 | 185 | // Check for payment notes. |
186 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
186 | + if ( ! empty($data['give-payment-note'])) { |
|
187 | 187 | |
188 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
189 | - give_insert_payment_note( $payment_id, $note ); |
|
188 | + $note = wp_kses($data['give-payment-note'], array()); |
|
189 | + give_insert_payment_note($payment_id, $note); |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
@@ -194,77 +194,77 @@ discard block |
||
194 | 194 | $payment->status = $status; |
195 | 195 | |
196 | 196 | // Adjust total store earnings if the payment total has been changed. |
197 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
197 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
198 | 198 | |
199 | - if ( $new_total > $curr_total ) { |
|
199 | + if ($new_total > $curr_total) { |
|
200 | 200 | // Increase if our new total is higher. |
201 | 201 | $difference = $new_total - $curr_total; |
202 | - give_increase_total_earnings( $difference ); |
|
202 | + give_increase_total_earnings($difference); |
|
203 | 203 | |
204 | 204 | // Increase form earnings. |
205 | - give_increase_earnings( $payment->form_id, $difference, $payment->ID ); |
|
206 | - } elseif ( $curr_total > $new_total ) { |
|
205 | + give_increase_earnings($payment->form_id, $difference, $payment->ID); |
|
206 | + } elseif ($curr_total > $new_total) { |
|
207 | 207 | // Decrease if our new total is lower. |
208 | 208 | $difference = $curr_total - $new_total; |
209 | - give_decrease_total_earnings( $difference ); |
|
209 | + give_decrease_total_earnings($difference); |
|
210 | 210 | |
211 | 211 | // Decrease form earnings. |
212 | - give_decrease_form_earnings( $payment->form_id, $difference, $payment->ID ); |
|
212 | + give_decrease_form_earnings($payment->form_id, $difference, $payment->ID); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | 216 | $payment->save(); |
217 | 217 | |
218 | 218 | // Get new give form ID. |
219 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
220 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
219 | + $new_form_id = absint($data['give-payment-form-select']); |
|
220 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
221 | 221 | |
222 | 222 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
223 | 223 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
224 | 224 | // Check if user want to transfer current payment to new give form id. |
225 | - if ( $new_form_id && $new_form_id != $current_form_id ) { |
|
225 | + if ($new_form_id && $new_form_id != $current_form_id) { |
|
226 | 226 | |
227 | 227 | // Get new give form title. |
228 | - $new_form_title = get_the_title( $new_form_id ); |
|
228 | + $new_form_title = get_the_title($new_form_id); |
|
229 | 229 | |
230 | 230 | // Update payment give form meta data. |
231 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
232 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
231 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
232 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
233 | 233 | |
234 | 234 | // Update price id payment metadata. |
235 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
236 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
235 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
236 | + $payment->update_meta('_give_payment_price_id', ''); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | // If donation was completed, adjust stats of forms. |
240 | - if ( 'publish' == $status ) { |
|
240 | + if ('publish' == $status) { |
|
241 | 241 | |
242 | 242 | // Decrease sale of old give form. For other payment status. |
243 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
243 | + $current_form = new Give_Donate_Form($current_form_id); |
|
244 | 244 | $current_form->decrease_sales(); |
245 | - $current_form->decrease_earnings( $curr_total, $payment->ID ); |
|
245 | + $current_form->decrease_earnings($curr_total, $payment->ID); |
|
246 | 246 | |
247 | 247 | // Increase sale of new give form. |
248 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
248 | + $new_form = new Give_Donate_Form($new_form_id); |
|
249 | 249 | $new_form->increase_sales(); |
250 | - $new_form->increase_earnings( $new_total, $payment->ID ); |
|
250 | + $new_form->increase_earnings($new_total, $payment->ID); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | // Re setup payment to update new meta value in object. |
254 | - $payment->update_payment_setup( $payment->ID ); |
|
254 | + $payment->update_payment_setup($payment->ID); |
|
255 | 255 | |
256 | 256 | // Update form id in payment logs. |
257 | - Give()->async_process->data( array( |
|
258 | - 'data' => array( $new_form_id, $payment_id ), |
|
257 | + Give()->async_process->data(array( |
|
258 | + 'data' => array($new_form_id, $payment_id), |
|
259 | 259 | 'hook' => 'give_update_log_form_id', |
260 | - ) )->dispatch(); |
|
260 | + ))->dispatch(); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | // Update price id if current form is variable form. |
264 | 264 | /* @var Give_Donate_Form $form */ |
265 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
265 | + $form = new Give_Donate_Form($payment->form_id); |
|
266 | 266 | |
267 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
267 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
268 | 268 | |
269 | 269 | // Get payment meta data. |
270 | 270 | $payment_meta = $payment->get_meta(); |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | $price_id = ''; |
274 | 274 | |
275 | 275 | // Get price info |
276 | - if( 0 <= $data['give-variable-price'] ) { |
|
277 | - foreach ( $form->prices as $variable_price ) { |
|
278 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
276 | + if (0 <= $data['give-variable-price']) { |
|
277 | + foreach ($form->prices as $variable_price) { |
|
278 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
279 | 279 | $price_info = $variable_price; |
280 | 280 | break; |
281 | 281 | } |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | // Set price id. |
286 | - if( ! empty( $price_info ) ) { |
|
286 | + if ( ! empty($price_info)) { |
|
287 | 287 | $price_id = $data['give-variable-price']; |
288 | 288 | |
289 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
289 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
290 | 290 | // Set price id to amount match. |
291 | 291 | $price_id = $price_info['_give_id']['level_id']; |
292 | 292 | } |
293 | 293 | |
294 | - } elseif( $form->is_custom_price_mode() ){ |
|
294 | + } elseif ($form->is_custom_price_mode()) { |
|
295 | 295 | $price_id = 'custom'; |
296 | 296 | } |
297 | 297 | |
@@ -299,34 +299,34 @@ discard block |
||
299 | 299 | $payment_meta['price_id'] = $price_id; |
300 | 300 | |
301 | 301 | // Update payment give form meta data. |
302 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
303 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
302 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
303 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
304 | 304 | |
305 | 305 | // Re setup payment to update new meta value in object. |
306 | - $payment->update_payment_setup( $payment->ID ); |
|
306 | + $payment->update_payment_setup($payment->ID); |
|
307 | 307 | } |
308 | 308 | |
309 | - $comment_id = isset( $data['give_comment_id'] ) ? absint( $data['give_comment_id'] ) : 0; |
|
310 | - $is_anonymous_donation = give_is_anonymous_donation_field_enabled( $payment->form_id ); |
|
309 | + $comment_id = isset($data['give_comment_id']) ? absint($data['give_comment_id']) : 0; |
|
310 | + $is_anonymous_donation = give_is_anonymous_donation_field_enabled($payment->form_id); |
|
311 | 311 | |
312 | - if ( $is_anonymous_donation ) { |
|
313 | - give_update_meta( $payment->ID, '_give_anonymous_donation', $payment->anonymous ); |
|
314 | - Give()->donor_meta->update_meta( $payment->donor_id, '_give_anonymous_donor', $payment->anonymous ); |
|
312 | + if ($is_anonymous_donation) { |
|
313 | + give_update_meta($payment->ID, '_give_anonymous_donation', $payment->anonymous); |
|
314 | + Give()->donor_meta->update_meta($payment->donor_id, '_give_anonymous_donor', $payment->anonymous); |
|
315 | 315 | |
316 | 316 | // Update comment meta if admin is not updating comment. |
317 | - if( $comment_id ) { |
|
318 | - update_comment_meta( $comment_id, '_give_anonymous_donation', $payment->anonymous ); |
|
317 | + if ($comment_id) { |
|
318 | + update_comment_meta($comment_id, '_give_anonymous_donation', $payment->anonymous); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | 322 | // Update comment. |
323 | - if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) { |
|
323 | + if (give_is_donor_comment_field_enabled($payment->form_id)) { |
|
324 | 324 | // We are access comment directly from $_POST because comment formatting remove because of give_clean in give_post_actions. |
325 | - $data['give_comment'] = trim( $_POST['give_comment'] ); |
|
325 | + $data['give_comment'] = trim($_POST['give_comment']); |
|
326 | 326 | |
327 | - if ( empty( $data['give_comment'] ) ) { |
|
327 | + if (empty($data['give_comment'])) { |
|
328 | 328 | // Delete comment if empty |
329 | - Give_Comment::delete( $comment_id, $payment_id, 'payment' ); |
|
329 | + Give_Comment::delete($comment_id, $payment_id, 'payment'); |
|
330 | 330 | |
331 | 331 | } else { |
332 | 332 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | 'comment_author_email' => $payment->email |
338 | 338 | ); |
339 | 339 | |
340 | - if ( $comment_id ) { |
|
340 | + if ($comment_id) { |
|
341 | 341 | $comment_args['comment_ID'] = $comment_id; |
342 | 342 | } |
343 | 343 | |
@@ -348,16 +348,16 @@ discard block |
||
348 | 348 | $comment_args |
349 | 349 | ); |
350 | 350 | |
351 | - if ( $is_update_comment_meta ) { |
|
352 | - update_comment_meta( $comment_id, '_give_anonymous_donation', $is_anonymous_donation ); |
|
351 | + if ($is_update_comment_meta) { |
|
352 | + update_comment_meta($comment_id, '_give_anonymous_donation', $is_anonymous_donation); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | - $donor_has_comment = empty( $data['give_comment'] ) |
|
357 | - ? ( $latest_comment = give_get_donor_latest_comment( $payment->donor_id ) && empty( $latest_comment ) ? '0' : '1' ) |
|
356 | + $donor_has_comment = empty($data['give_comment']) |
|
357 | + ? ($latest_comment = give_get_donor_latest_comment($payment->donor_id) && empty($latest_comment) ? '0' : '1') |
|
358 | 358 | : '1'; |
359 | 359 | |
360 | - Give()->donor_meta->update_meta( $payment->donor_id, '_give_has_comment', $donor_has_comment ); |
|
360 | + Give()->donor_meta->update_meta($payment->donor_id, '_give_has_comment', $donor_has_comment); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param int $payment_id The ID of the payment. |
370 | 370 | */ |
371 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
371 | + do_action('give_updated_edited_donation', $payment_id); |
|
372 | 372 | |
373 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id=' . $payment_id ) ); |
|
373 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id='.$payment_id)); |
|
374 | 374 | exit; |
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
377 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Trigger a Donation Deletion. |
@@ -385,48 +385,48 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @return void |
387 | 387 | */ |
388 | -function give_trigger_donation_delete( $data ) { |
|
389 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
388 | +function give_trigger_donation_delete($data) { |
|
389 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
390 | 390 | |
391 | - $payment_id = absint( $data['purchase_id'] ); |
|
391 | + $payment_id = absint($data['purchase_id']); |
|
392 | 392 | |
393 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
394 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
393 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
394 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
395 | 395 | } |
396 | 396 | |
397 | - give_delete_donation( $payment_id ); |
|
398 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted' ) ); |
|
397 | + give_delete_donation($payment_id); |
|
398 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted')); |
|
399 | 399 | give_die(); |
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
403 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
404 | 404 | |
405 | 405 | /** |
406 | 406 | * AJAX Store Donation Note |
407 | 407 | */ |
408 | 408 | function give_ajax_store_payment_note() { |
409 | 409 | |
410 | - $payment_id = absint( $_POST['payment_id'] ); |
|
411 | - $note = wp_kses( $_POST['note'], array() ); |
|
410 | + $payment_id = absint($_POST['payment_id']); |
|
411 | + $note = wp_kses($_POST['note'], array()); |
|
412 | 412 | |
413 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
414 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
413 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
414 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
415 | 415 | } |
416 | 416 | |
417 | - if ( empty( $payment_id ) ) { |
|
418 | - die( '-1' ); |
|
417 | + if (empty($payment_id)) { |
|
418 | + die('-1'); |
|
419 | 419 | } |
420 | 420 | |
421 | - if ( empty( $note ) ) { |
|
422 | - die( '-1' ); |
|
421 | + if (empty($note)) { |
|
422 | + die('-1'); |
|
423 | 423 | } |
424 | 424 | |
425 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
426 | - die( give_get_payment_note_html( $note_id ) ); |
|
425 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
426 | + die(give_get_payment_note_html($note_id)); |
|
427 | 427 | } |
428 | 428 | |
429 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
429 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
430 | 430 | |
431 | 431 | /** |
432 | 432 | * Triggers a donation note deletion without ajax |
@@ -437,24 +437,24 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @return void |
439 | 439 | */ |
440 | -function give_trigger_payment_note_deletion( $data ) { |
|
440 | +function give_trigger_payment_note_deletion($data) { |
|
441 | 441 | |
442 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
442 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
443 | 443 | return; |
444 | 444 | } |
445 | 445 | |
446 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
447 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
446 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
447 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
448 | 448 | } |
449 | 449 | |
450 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
450 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id='.absint($data['payment_id'])); |
|
451 | 451 | |
452 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
452 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
453 | 453 | |
454 | - wp_redirect( $edit_order_url ); |
|
454 | + wp_redirect($edit_order_url); |
|
455 | 455 | } |
456 | 456 | |
457 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
457 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
458 | 458 | |
459 | 459 | /** |
460 | 460 | * Delete a payment note deletion with ajax |
@@ -465,16 +465,16 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function give_ajax_delete_payment_note() { |
467 | 467 | |
468 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
469 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
468 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
469 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
470 | 470 | } |
471 | 471 | |
472 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
473 | - die( '1' ); |
|
472 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
473 | + die('1'); |
|
474 | 474 | } else { |
475 | - die( '-1' ); |
|
475 | + die('-1'); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | } |
479 | 479 | |
480 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
480 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -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,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array An array of updated action links. |
25 | 25 | */ |
26 | -function give_plugin_action_links( $actions ) { |
|
26 | +function give_plugin_action_links($actions) { |
|
27 | 27 | $new_actions = array( |
28 | 28 | 'settings' => sprintf( |
29 | 29 | '<a href="%1$s">%2$s</a>', |
30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
31 | - __( 'Settings', 'give' ) |
|
30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
31 | + __('Settings', 'give') |
|
32 | 32 | ), |
33 | 33 | ); |
34 | 34 | |
35 | - return array_merge( $new_actions, $actions ); |
|
35 | + return array_merge($new_actions, $actions); |
|
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array |
50 | 50 | */ |
51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
52 | - if ( GIVE_PLUGIN_BASENAME !== $plugin_file ) { |
|
51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
52 | + if (GIVE_PLUGIN_BASENAME !== $plugin_file) { |
|
53 | 53 | return $plugin_meta; |
54 | 54 | } |
55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ), 'https://givewp.com/documentation/' |
66 | 66 | ) |
67 | 67 | ), |
68 | - __( 'Documentation', 'give' ) |
|
68 | + __('Documentation', 'give') |
|
69 | 69 | ), |
70 | 70 | sprintf( |
71 | 71 | '<a href="%1$s" target="_blank">%2$s</a>', |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | ), 'https://givewp.com/addons/' |
79 | 79 | ) |
80 | 80 | ), |
81 | - __( 'Add-ons', 'give' ) |
|
81 | + __('Add-ons', 'give') |
|
82 | 82 | ), |
83 | 83 | ); |
84 | 84 | |
85 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
85 | + return array_merge($plugin_meta, $new_meta_links); |
|
86 | 86 | } |
87 | 87 | |
88 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
88 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
@@ -103,19 +103,18 @@ discard block |
||
103 | 103 | $title = ''; |
104 | 104 | global $submenu, $plugin_page; |
105 | 105 | |
106 | - foreach ( array_keys( $submenu ) as $parent ) { |
|
107 | - if ( 'edit.php?post_type=give_forms' !== $parent ) { |
|
106 | + foreach (array_keys($submenu) as $parent) { |
|
107 | + if ('edit.php?post_type=give_forms' !== $parent) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - foreach ( $submenu[ $parent ] as $submenu_array ) { |
|
112 | - if ( $plugin_page !== $submenu_array[2] ) { |
|
111 | + foreach ($submenu[$parent] as $submenu_array) { |
|
112 | + if ($plugin_page !== $submenu_array[2]) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $title = isset( $submenu_array[0] ) ? |
|
117 | - $submenu_array[0] : |
|
118 | - $submenu_array[3]; |
|
116 | + $title = isset($submenu_array[0]) ? |
|
117 | + $submenu_array[0] : $submenu_array[3]; |
|
119 | 118 | } |
120 | 119 | } |
121 | 120 | |
@@ -129,11 +128,11 @@ discard block |
||
129 | 128 | */ |
130 | 129 | function give_recently_activated_addons() { |
131 | 130 | // Check if action is set. |
132 | - if ( isset( $_REQUEST['action'] ) ) { |
|
133 | - $plugin_action = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : ( isset( $_REQUEST['action2'] ) ? $_REQUEST['action2'] : '' ); |
|
131 | + if (isset($_REQUEST['action'])) { |
|
132 | + $plugin_action = ('-1' !== $_REQUEST['action']) ? $_REQUEST['action'] : (isset($_REQUEST['action2']) ? $_REQUEST['action2'] : ''); |
|
134 | 133 | $plugins = array(); |
135 | 134 | |
136 | - switch ( $plugin_action ) { |
|
135 | + switch ($plugin_action) { |
|
137 | 136 | case 'activate': // Single add-on activation. |
138 | 137 | $plugins[] = $_REQUEST['plugin']; |
139 | 138 | break; |
@@ -143,27 +142,27 @@ discard block |
||
143 | 142 | } |
144 | 143 | |
145 | 144 | |
146 | - if ( ! empty( $plugins ) ) { |
|
145 | + if ( ! empty($plugins)) { |
|
147 | 146 | |
148 | 147 | $give_addons = give_get_recently_activated_addons(); |
149 | 148 | |
150 | - foreach ( $plugins as $plugin ) { |
|
149 | + foreach ($plugins as $plugin) { |
|
151 | 150 | // Get plugins which has 'Give-' as prefix. |
152 | - if ( stripos( $plugin, 'Give-' ) !== false ) { |
|
151 | + if (stripos($plugin, 'Give-') !== false) { |
|
153 | 152 | $give_addons[] = $plugin; |
154 | 153 | } |
155 | 154 | } |
156 | 155 | |
157 | - if ( ! empty( $give_addons ) ) { |
|
156 | + if ( ! empty($give_addons)) { |
|
158 | 157 | // Update the Give's activated add-ons. |
159 | - update_option( 'give_recently_activated_addons', $give_addons, false ); |
|
158 | + update_option('give_recently_activated_addons', $give_addons, false); |
|
160 | 159 | } |
161 | 160 | } |
162 | 161 | } |
163 | 162 | } |
164 | 163 | |
165 | 164 | // Add add-on plugins to wp option table. |
166 | -add_action( 'activated_plugin', 'give_recently_activated_addons', 10 ); |
|
165 | +add_action('activated_plugin', 'give_recently_activated_addons', 10); |
|
167 | 166 | |
168 | 167 | /** |
169 | 168 | * Create new menu in plugin section that include all the add-on |
@@ -174,19 +173,19 @@ discard block |
||
174 | 173 | * |
175 | 174 | * @return mixed |
176 | 175 | */ |
177 | -function give_filter_addons_do_filter_addons( $plugin_menu ) { |
|
176 | +function give_filter_addons_do_filter_addons($plugin_menu) { |
|
178 | 177 | global $plugins; |
179 | 178 | |
180 | - foreach ( $plugins['all'] as $plugin_slug => $plugin_data ) { |
|
179 | + foreach ($plugins['all'] as $plugin_slug => $plugin_data) { |
|
181 | 180 | |
182 | - if ( false !== strpos( $plugin_data['Name'], 'Give' ) && false !== strpos( $plugin_data['AuthorName'], 'WordImpress' ) ) { |
|
183 | - $plugins['give'][ $plugin_slug ] = $plugins['all'][ $plugin_slug ]; |
|
184 | - $plugins['give'][ $plugin_slug ]['plugin'] = $plugin_slug; |
|
181 | + if (false !== strpos($plugin_data['Name'], 'Give') && false !== strpos($plugin_data['AuthorName'], 'WordImpress')) { |
|
182 | + $plugins['give'][$plugin_slug] = $plugins['all'][$plugin_slug]; |
|
183 | + $plugins['give'][$plugin_slug]['plugin'] = $plugin_slug; |
|
185 | 184 | // replicate the next step. |
186 | - if ( current_user_can( 'update_plugins' ) ) { |
|
187 | - $current = get_site_transient( 'update_plugins' ); |
|
188 | - if ( isset( $current->response[ $plugin_slug ] ) ) { |
|
189 | - $plugins['give'][ $plugin_slug ]['update'] = true; |
|
185 | + if (current_user_can('update_plugins')) { |
|
186 | + $current = get_site_transient('update_plugins'); |
|
187 | + if (isset($current->response[$plugin_slug])) { |
|
188 | + $plugins['give'][$plugin_slug]['update'] = true; |
|
190 | 189 | } |
191 | 190 | } |
192 | 191 | } |
@@ -196,8 +195,8 @@ discard block |
||
196 | 195 | |
197 | 196 | } |
198 | 197 | |
199 | -add_filter( 'show_advanced_plugins', 'give_filter_addons_do_filter_addons' ); |
|
200 | -add_filter( 'show_network_active_plugins', 'give_filter_addons_do_filter_addons' ); |
|
198 | +add_filter('show_advanced_plugins', 'give_filter_addons_do_filter_addons'); |
|
199 | +add_filter('show_network_active_plugins', 'give_filter_addons_do_filter_addons'); |
|
201 | 200 | |
202 | 201 | /** |
203 | 202 | * Keep activating the same add-on when admin activate or deactivate from Give Menu |
@@ -207,18 +206,18 @@ discard block |
||
207 | 206 | * @param $action |
208 | 207 | * @param $result |
209 | 208 | */ |
210 | -function give_prepare_filter_addons_referer( $action, $result ) { |
|
211 | - if ( ! function_exists( 'get_current_screen' ) ) { |
|
209 | +function give_prepare_filter_addons_referer($action, $result) { |
|
210 | + if ( ! function_exists('get_current_screen')) { |
|
212 | 211 | return; |
213 | 212 | } |
214 | 213 | $screen = get_current_screen(); |
215 | - if ( is_object( $screen ) && $screen->base === 'plugins' && ! empty( $_REQUEST['plugin_status'] ) && $_REQUEST['plugin_status'] === 'give' ) { |
|
214 | + if (is_object($screen) && $screen->base === 'plugins' && ! empty($_REQUEST['plugin_status']) && $_REQUEST['plugin_status'] === 'give') { |
|
216 | 215 | global $status; |
217 | 216 | $status = 'give'; |
218 | 217 | } |
219 | 218 | } |
220 | 219 | |
221 | -add_action( 'check_admin_referer', 'give_prepare_filter_addons_referer', 10, 2 ); |
|
220 | +add_action('check_admin_referer', 'give_prepare_filter_addons_referer', 10, 2); |
|
222 | 221 | |
223 | 222 | /** |
224 | 223 | * Make the Give Menu as an default menu and update the Menu Name |
@@ -229,30 +228,30 @@ discard block |
||
229 | 228 | * |
230 | 229 | * @return mixed |
231 | 230 | */ |
232 | -function give_filter_addons_filter_addons( $views ) { |
|
231 | +function give_filter_addons_filter_addons($views) { |
|
233 | 232 | |
234 | 233 | global $status, $plugins; |
235 | 234 | |
236 | - if ( ! empty( $plugins['give'] ) ) { |
|
235 | + if ( ! empty($plugins['give'])) { |
|
237 | 236 | $class = ''; |
238 | 237 | |
239 | - if ( 'give' === $status ) { |
|
238 | + if ('give' === $status) { |
|
240 | 239 | $class = 'current'; |
241 | 240 | } |
242 | 241 | |
243 | 242 | $views['give'] = sprintf( |
244 | 243 | '<a class="%s" href="plugins.php?plugin_status=give"> %s <span class="count">(%s) </span></a>', |
245 | 244 | $class, |
246 | - __( 'Give', 'give' ), |
|
247 | - count( $plugins['give'] ) |
|
245 | + __('Give', 'give'), |
|
246 | + count($plugins['give']) |
|
248 | 247 | ); |
249 | 248 | } |
250 | 249 | |
251 | 250 | return $views; |
252 | 251 | } |
253 | 252 | |
254 | -add_filter( 'views_plugins', 'give_filter_addons_filter_addons' ); |
|
255 | -add_filter( 'views_plugins-network', 'give_filter_addons_filter_addons' ); |
|
253 | +add_filter('views_plugins', 'give_filter_addons_filter_addons'); |
|
254 | +add_filter('views_plugins-network', 'give_filter_addons_filter_addons'); |
|
256 | 255 | |
257 | 256 | /** |
258 | 257 | * Set the Give as the Main menu when admin click on the Give Menu in Plugin section. |
@@ -263,17 +262,17 @@ discard block |
||
263 | 262 | * |
264 | 263 | * @return mixed |
265 | 264 | */ |
266 | -function give_prepare_filter_addons( $plugins ) { |
|
265 | +function give_prepare_filter_addons($plugins) { |
|
267 | 266 | global $status; |
268 | 267 | |
269 | - if ( isset( $_REQUEST['plugin_status'] ) && 'give' === $_REQUEST['plugin_status'] ) { |
|
268 | + if (isset($_REQUEST['plugin_status']) && 'give' === $_REQUEST['plugin_status']) { |
|
270 | 269 | $status = 'give'; |
271 | 270 | } |
272 | 271 | |
273 | 272 | return $plugins; |
274 | 273 | } |
275 | 274 | |
276 | -add_filter( 'all_plugins', 'give_prepare_filter_addons' ); |
|
275 | +add_filter('all_plugins', 'give_prepare_filter_addons'); |
|
277 | 276 | |
278 | 277 | |
279 | 278 | /** |
@@ -284,26 +283,26 @@ discard block |
||
284 | 283 | * |
285 | 284 | * @since 2.1 |
286 | 285 | */ |
287 | -function give_in_plugin_update_message( $data, $response ) { |
|
286 | +function give_in_plugin_update_message($data, $response) { |
|
288 | 287 | $new_version = $data['new_version']; |
289 | - $current_version_parts = explode( '.', GIVE_VERSION ); |
|
290 | - $new_version_parts = explode( '.', $new_version ); |
|
288 | + $current_version_parts = explode('.', GIVE_VERSION); |
|
289 | + $new_version_parts = explode('.', $new_version); |
|
291 | 290 | |
292 | 291 | // If it is a minor upgrade then return. |
293 | - if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) { |
|
292 | + if (version_compare($current_version_parts[0].'.'.$current_version_parts[1], $new_version_parts[0].'.'.$new_version_parts[1], '=')) { |
|
294 | 293 | |
295 | 294 | return; |
296 | 295 | } |
297 | 296 | |
298 | 297 | // Get the upgrade notice from the trunk. |
299 | - $upgrade_notice = give_get_plugin_upgrade_notice( $new_version ); |
|
298 | + $upgrade_notice = give_get_plugin_upgrade_notice($new_version); |
|
300 | 299 | |
301 | 300 | // Display upgrade notice. |
302 | - echo apply_filters( 'give_in_plugin_update_message', $upgrade_notice ? '</p>' . wp_kses_post( $upgrade_notice ) . '<p class="dummy">' : '' ); |
|
301 | + echo apply_filters('give_in_plugin_update_message', $upgrade_notice ? '</p>'.wp_kses_post($upgrade_notice).'<p class="dummy">' : ''); |
|
303 | 302 | } |
304 | 303 | |
305 | 304 | // Display upgrade notice. |
306 | -add_action( 'in_plugin_update_message-' . GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2 ); |
|
305 | +add_action('in_plugin_update_message-'.GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2); |
|
307 | 306 | |
308 | 307 | |
309 | 308 | /** |
@@ -317,18 +316,18 @@ discard block |
||
317 | 316 | * |
318 | 317 | * @return string |
319 | 318 | */ |
320 | -function give_get_plugin_upgrade_notice( $new_version ) { |
|
319 | +function give_get_plugin_upgrade_notice($new_version) { |
|
321 | 320 | |
322 | 321 | // Cache the upgrade notice. |
323 | 322 | $transient_name = "give_upgrade_notice_{$new_version}"; |
324 | - $upgrade_notice = get_transient( $transient_name ); |
|
323 | + $upgrade_notice = get_transient($transient_name); |
|
325 | 324 | |
326 | - if ( false === $upgrade_notice ) { |
|
327 | - $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/give/trunk/readme.txt' ); |
|
325 | + if (false === $upgrade_notice) { |
|
326 | + $response = wp_safe_remote_get('https://plugins.svn.wordpress.org/give/trunk/readme.txt'); |
|
328 | 327 | |
329 | - if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) { |
|
330 | - $upgrade_notice = give_parse_plugin_update_notice( $response['body'], $new_version ); |
|
331 | - set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS ); |
|
328 | + if ( ! is_wp_error($response) && ! empty($response['body'])) { |
|
329 | + $upgrade_notice = give_parse_plugin_update_notice($response['body'], $new_version); |
|
330 | + set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS); |
|
332 | 331 | } |
333 | 332 | } |
334 | 333 | |
@@ -348,46 +347,46 @@ discard block |
||
348 | 347 | * |
349 | 348 | * @return string |
350 | 349 | */ |
351 | -function give_parse_plugin_update_notice( $content, $new_version ) { |
|
352 | - $version_parts = explode( '.', $new_version ); |
|
350 | +function give_parse_plugin_update_notice($content, $new_version) { |
|
351 | + $version_parts = explode('.', $new_version); |
|
353 | 352 | $check_for_notices = array( |
354 | - $version_parts[0] . '.0', |
|
355 | - $version_parts[0] . '.0.0', |
|
356 | - $version_parts[0] . '.' . $version_parts[1] . '.' . '0', |
|
353 | + $version_parts[0].'.0', |
|
354 | + $version_parts[0].'.0.0', |
|
355 | + $version_parts[0].'.'.$version_parts[1].'.'.'0', |
|
357 | 356 | ); |
358 | 357 | |
359 | 358 | // Regex to extract Upgrade notice from the readme.txt file. |
360 | - $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis'; |
|
359 | + $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote($new_version).'\s*=|$)~Uis'; |
|
361 | 360 | |
362 | 361 | $upgrade_notice = ''; |
363 | 362 | |
364 | - foreach ( $check_for_notices as $check_version ) { |
|
365 | - if ( version_compare( GIVE_VERSION, $check_version, '>' ) ) { |
|
363 | + foreach ($check_for_notices as $check_version) { |
|
364 | + if (version_compare(GIVE_VERSION, $check_version, '>')) { |
|
366 | 365 | continue; |
367 | 366 | } |
368 | 367 | |
369 | 368 | $matches = null; |
370 | 369 | |
371 | - if ( preg_match( $notice_regexp, $content, $matches ) ) { |
|
372 | - $notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) ); |
|
370 | + if (preg_match($notice_regexp, $content, $matches)) { |
|
371 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2])); |
|
373 | 372 | |
374 | - if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) { |
|
373 | + if (version_compare(trim($matches[1]), $check_version, '=')) { |
|
375 | 374 | $upgrade_notice .= '<p class="give-plugin-upgrade-notice">'; |
376 | 375 | |
377 | - foreach ( $notices as $index => $line ) { |
|
378 | - $upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ); |
|
376 | + foreach ($notices as $index => $line) { |
|
377 | + $upgrade_notice .= preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line); |
|
379 | 378 | } |
380 | 379 | |
381 | 380 | $upgrade_notice .= '</p>'; |
382 | 381 | } |
383 | 382 | |
384 | - if ( ! empty( $upgrade_notice ) ) { |
|
383 | + if ( ! empty($upgrade_notice)) { |
|
385 | 384 | break; |
386 | 385 | } |
387 | 386 | } |
388 | 387 | } |
389 | 388 | |
390 | - return wp_kses_post( $upgrade_notice ); |
|
389 | + return wp_kses_post($upgrade_notice); |
|
391 | 390 | } |
392 | 391 | |
393 | 392 | |
@@ -424,7 +423,7 @@ discard block |
||
424 | 423 | <?php |
425 | 424 | } |
426 | 425 | |
427 | -add_action( 'admin_head', 'give_plugin_notice_css' ); |
|
426 | +add_action('admin_head', 'give_plugin_notice_css'); |
|
428 | 427 | |
429 | 428 | /** |
430 | 429 | * Get list of add-on last activated. |
@@ -434,7 +433,7 @@ discard block |
||
434 | 433 | * @return mixed|array list of recently activated add-on |
435 | 434 | */ |
436 | 435 | function give_get_recently_activated_addons() { |
437 | - return get_option( 'give_recently_activated_addons', array() ); |
|
436 | + return get_option('give_recently_activated_addons', array()); |
|
438 | 437 | } |
439 | 438 | |
440 | 439 | /** |
@@ -452,34 +451,34 @@ discard block |
||
452 | 451 | ?> |
453 | 452 | |
454 | 453 | <h2 id="deactivation-survey-title"> |
455 | - <img src="<?php echo esc_url( GIVE_PLUGIN_URL ) ?>/assets/dist/images/give-icon-full-circle.svg"> |
|
456 | - <span><?php esc_html_e( 'Give Deactivation', 'give' ); ?></span> |
|
454 | + <img src="<?php echo esc_url(GIVE_PLUGIN_URL) ?>/assets/dist/images/give-icon-full-circle.svg"> |
|
455 | + <span><?php esc_html_e('Give Deactivation', 'give'); ?></span> |
|
457 | 456 | </h2> |
458 | 457 | <form class="deactivation-survey-form" method="POST"> |
459 | - <p><?php esc_html_e( 'If you have a moment, please let us know why you are deactivating Give. All submissions are anonymous and we only use this feedback to improve this plugin.', 'give' ); ?></p> |
|
458 | + <p><?php esc_html_e('If you have a moment, please let us know why you are deactivating Give. All submissions are anonymous and we only use this feedback to improve this plugin.', 'give'); ?></p> |
|
460 | 459 | |
461 | 460 | <div> |
462 | 461 | <label class="give-field-description"> |
463 | 462 | <input type="radio" name="give-survey-radios" value="1"> |
464 | - <?php esc_html_e( "I'm only deactivating temporarily", 'give' ); ?> |
|
463 | + <?php esc_html_e("I'm only deactivating temporarily", 'give'); ?> |
|
465 | 464 | </label> |
466 | 465 | </div> |
467 | 466 | |
468 | 467 | <div> |
469 | 468 | <label class="give-field-description"> |
470 | 469 | <input type="radio" name="give-survey-radios" value="2"> |
471 | - <?php esc_html_e( 'I no longer need the plugin', 'give' ); ?> |
|
470 | + <?php esc_html_e('I no longer need the plugin', 'give'); ?> |
|
472 | 471 | </label> |
473 | 472 | </div> |
474 | 473 | |
475 | 474 | <div> |
476 | 475 | <label class="give-field-description"> |
477 | 476 | <input type="radio" name="give-survey-radios" value="3" data-has-field="true"> |
478 | - <?php esc_html_e( 'I found a better plugin', 'give' ); ?> |
|
477 | + <?php esc_html_e('I found a better plugin', 'give'); ?> |
|
479 | 478 | </label> |
480 | 479 | |
481 | 480 | <div class="give-survey-extra-field"> |
482 | - <p><?php esc_html_e( 'What is the name of the plugin?', 'give' ); ?></p> |
|
481 | + <p><?php esc_html_e('What is the name of the plugin?', 'give'); ?></p> |
|
483 | 482 | <input type="text" name="user-reason" class="widefat"> |
484 | 483 | </div> |
485 | 484 | </div> |
@@ -487,23 +486,23 @@ discard block |
||
487 | 486 | <div> |
488 | 487 | <label class="give-field-description"> |
489 | 488 | <input type="radio" name="give-survey-radios" value="4"> |
490 | - <?php esc_html_e( 'I only needed the plugin for a short period', 'give' ); ?> |
|
489 | + <?php esc_html_e('I only needed the plugin for a short period', 'give'); ?> |
|
491 | 490 | </label> |
492 | 491 | </div> |
493 | 492 | |
494 | 493 | <div> |
495 | 494 | <label class="give-field-description"> |
496 | 495 | <input type="radio" name="give-survey-radios" value="5" data-has-field="true"> |
497 | - <?php esc_html_e( 'The plugin broke my site', 'give' ); ?> |
|
496 | + <?php esc_html_e('The plugin broke my site', 'give'); ?> |
|
498 | 497 | </label> |
499 | 498 | |
500 | 499 | <div class="give-survey-extra-field"> |
501 | 500 | <p><?php |
502 | 501 | printf( |
503 | 502 | '%1$s %2$s %3$s', |
504 | - __( "We're sorry to hear that, check", 'give' ), |
|
503 | + __("We're sorry to hear that, check", 'give'), |
|
505 | 504 | '<a href="https://wordpress.org/support/plugin/give">Give Support</a>.', |
506 | - __( 'Can you describe the issue?', 'give' ) |
|
505 | + __('Can you describe the issue?', 'give') |
|
507 | 506 | ); |
508 | 507 | ?> |
509 | 508 | </p> |
@@ -514,16 +513,16 @@ discard block |
||
514 | 513 | <div> |
515 | 514 | <label class="give-field-description"> |
516 | 515 | <input type="radio" name="give-survey-radios" value="6" data-has-field="true"> |
517 | - <?php esc_html_e( 'The plugin suddenly stopped working', 'give' ); ?> |
|
516 | + <?php esc_html_e('The plugin suddenly stopped working', 'give'); ?> |
|
518 | 517 | </label> |
519 | 518 | |
520 | 519 | <div class="give-survey-extra-field"> |
521 | 520 | <p><?php |
522 | 521 | printf( |
523 | 522 | '%1$s %2$s %3$s', |
524 | - __( "We're sorry to hear that, check", 'give' ), |
|
523 | + __("We're sorry to hear that, check", 'give'), |
|
525 | 524 | '<a href="https://wordpress.org/support/plugin/give">Give Support</a>.', |
526 | - __( 'Can you describe the issue?', 'give' ) |
|
525 | + __('Can you describe the issue?', 'give') |
|
527 | 526 | ); |
528 | 527 | ?> |
529 | 528 | </p> |
@@ -534,11 +533,11 @@ discard block |
||
534 | 533 | <div> |
535 | 534 | <label class="give-field-description"> |
536 | 535 | <input type="radio" name="give-survey-radios" value="7" data-has-field="true"> |
537 | - <?php esc_html_e( 'Other', 'give' ); ?> |
|
536 | + <?php esc_html_e('Other', 'give'); ?> |
|
538 | 537 | </label> |
539 | 538 | |
540 | 539 | <div class="give-survey-extra-field"> |
541 | - <p><?php esc_html_e( "Please describe why you're deactivating Give", 'give' ); ?></p> |
|
540 | + <p><?php esc_html_e("Please describe why you're deactivating Give", 'give'); ?></p> |
|
542 | 541 | <textarea disabled name="user-reason" class="widefat" rows="6"></textarea disabled> |
543 | 542 | </div> |
544 | 543 | </div> |
@@ -547,10 +546,10 @@ discard block |
||
547 | 546 | <p> |
548 | 547 | <label> |
549 | 548 | <input type="checkbox" name="confirm_reset_store" value="1"> |
550 | - <?php esc_html_e( 'Would you like to delete all Give data?', 'give' ); ?> |
|
549 | + <?php esc_html_e('Would you like to delete all Give data?', 'give'); ?> |
|
551 | 550 | </label> |
552 | 551 | <section class="give-field-description"> |
553 | - <?php esc_html_e( 'By default the custom roles, Give options, and database entries are not deleted when you deactivate Give. If you are deleting Give completely from your website and want those items removed as well check this option. Note: This will permanently delete all Give data from your database.', 'give' ); ?> |
|
552 | + <?php esc_html_e('By default the custom roles, Give options, and database entries are not deleted when you deactivate Give. If you are deleting Give completely from your website and want those items removed as well check this option. Note: This will permanently delete all Give data from your database.', 'give'); ?> |
|
554 | 553 | </section> |
555 | 554 | </p> |
556 | 555 | </div> |
@@ -559,9 +558,9 @@ discard block |
||
559 | 558 | $current_user_email = $current_user->user_email; |
560 | 559 | ?> |
561 | 560 | <input type="hidden" name="current-user-email" value="<?php echo $current_user_email; ?>"> |
562 | - <input type="hidden" name="current-site-url" value="<?php echo esc_url( get_bloginfo( 'url' ) ); ?>"> |
|
561 | + <input type="hidden" name="current-site-url" value="<?php echo esc_url(get_bloginfo('url')); ?>"> |
|
563 | 562 | <input type="hidden" name="give-export-class" value="Give_Tools_Reset_Stats"> |
564 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
563 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
565 | 564 | </form> |
566 | 565 | |
567 | 566 | <?php |
@@ -574,10 +573,10 @@ discard block |
||
574 | 573 | |
575 | 574 | $results['html'] = $output; |
576 | 575 | |
577 | - wp_send_json( $results ); |
|
576 | + wp_send_json($results); |
|
578 | 577 | } |
579 | 578 | |
580 | -add_action( 'wp_ajax_give_deactivation_popup', 'give_deactivation_popup' ); |
|
579 | +add_action('wp_ajax_give_deactivation_popup', 'give_deactivation_popup'); |
|
581 | 580 | |
582 | 581 | /** |
583 | 582 | * Ajax callback after the deactivation survey form has been submitted. |
@@ -587,27 +586,27 @@ discard block |
||
587 | 586 | */ |
588 | 587 | function give_deactivation_form_submit() { |
589 | 588 | |
590 | - if ( ! check_ajax_referer( 'deactivation_survey_nonce', 'nonce', false ) ) { |
|
589 | + if ( ! check_ajax_referer('deactivation_survey_nonce', 'nonce', false)) { |
|
591 | 590 | wp_send_json_error(); |
592 | 591 | wp_die(); |
593 | 592 | } |
594 | 593 | |
595 | - $form_data = give_clean( wp_parse_args( $_POST['form-data'] ) ); |
|
594 | + $form_data = give_clean(wp_parse_args($_POST['form-data'])); |
|
596 | 595 | |
597 | 596 | // Get the selected radio value. |
598 | - $radio_value = isset( $form_data['give-survey-radios'] ) ? $form_data['give-survey-radios'] : 0; |
|
597 | + $radio_value = isset($form_data['give-survey-radios']) ? $form_data['give-survey-radios'] : 0; |
|
599 | 598 | |
600 | 599 | // Get the reason if any radio button has an optional text field. |
601 | - $user_reason = isset( $form_data['user-reason'] ) ? $form_data['user-reason'] : ''; |
|
600 | + $user_reason = isset($form_data['user-reason']) ? $form_data['user-reason'] : ''; |
|
602 | 601 | |
603 | 602 | // Get the email of the user who deactivated the plugin. |
604 | - $user_email = isset( $form_data['current-user-email'] ) ? $form_data['current-user-email'] : ''; |
|
603 | + $user_email = isset($form_data['current-user-email']) ? $form_data['current-user-email'] : ''; |
|
605 | 604 | |
606 | 605 | // Get the URL of the website on which Give plugin is being deactivated. |
607 | - $site_url = isset( $form_data['current-site-url'] ) ? $form_data['current-site-url'] : ''; |
|
606 | + $site_url = isset($form_data['current-site-url']) ? $form_data['current-site-url'] : ''; |
|
608 | 607 | |
609 | 608 | // Get the value of the checkbox for deleting Give's data. |
610 | - $delete_data = isset( $form_data['confirm_reset_store'] ) ? $form_data['confirm_reset_store'] : ''; |
|
609 | + $delete_data = isset($form_data['confirm_reset_store']) ? $form_data['confirm_reset_store'] : ''; |
|
611 | 610 | |
612 | 611 | /** |
613 | 612 | * Make a POST request to the endpoint to send the survey data. |
@@ -625,10 +624,10 @@ discard block |
||
625 | 624 | ); |
626 | 625 | |
627 | 626 | // Check if the data is sent and stored correctly. |
628 | - $response = wp_remote_retrieve_body( $response ); |
|
627 | + $response = wp_remote_retrieve_body($response); |
|
629 | 628 | |
630 | - if ( 'true' === $response ) { |
|
631 | - if ( '1' === $delete_data ) { |
|
629 | + if ('true' === $response) { |
|
630 | + if ('1' === $delete_data) { |
|
632 | 631 | wp_send_json_success( |
633 | 632 | array( |
634 | 633 | 'delete_data' => true, |
@@ -648,4 +647,4 @@ discard block |
||
648 | 647 | wp_die(); |
649 | 648 | } |
650 | 649 | |
651 | -add_action( 'wp_ajax_deactivation_form_submit', 'give_deactivation_form_submit' ); |
|
650 | +add_action('wp_ajax_deactivation_form_submit', 'give_deactivation_form_submit'); |
@@ -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,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string |
27 | 27 | */ |
28 | -function __give_get_format_address( $address, $address_args = array() ) { |
|
28 | +function __give_get_format_address($address, $address_args = array()) { |
|
29 | 29 | $address_html = ''; |
30 | 30 | $address_args = wp_parse_args( |
31 | 31 | $address_args, |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $address_id = $address_args['type']; |
41 | 41 | |
42 | 42 | // Bailout. |
43 | - if ( empty( $address ) || ! is_array( $address ) ) { |
|
43 | + if (empty($address) || ! is_array($address)) { |
|
44 | 44 | return $address_html; |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $address_html .= sprintf( |
50 | 50 | '<span data-address-type="line1">%1$s</span>%2$s', |
51 | 51 | $address['line1'], |
52 | - ( ! empty( $address['line2'] ) ? '<br>' : '' ) |
|
52 | + ( ! empty($address['line2']) ? '<br>' : '') |
|
53 | 53 | ); |
54 | 54 | $address_html .= sprintf( |
55 | 55 | '<span data-address-type="line2">%1$s</span>%2$s', |
56 | 56 | $address['line2'], |
57 | - ( ! empty( $address['city'] ) ? '<br>' : '' ) |
|
57 | + ( ! empty($address['city']) ? '<br>' : '') |
|
58 | 58 | ); |
59 | 59 | $address_html .= sprintf( |
60 | 60 | '<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
61 | 61 | $address['city'], |
62 | - ( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
|
63 | - ( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
|
64 | - ( ! empty( $address['country'] ) ? '<br>' : '' ) |
|
62 | + ( ! empty($address['state']) ? ", {$address['state']}" : ''), |
|
63 | + ( ! empty($address['zip']) ? " {$address['zip']}" : ''), |
|
64 | + ( ! empty($address['country']) ? '<br>' : '') |
|
65 | 65 | ); |
66 | 66 | $address_html .= sprintf( |
67 | 67 | '<span data-address-type="country">%s</span><br>', |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | // Address action. |
72 | 72 | $address_html .= sprintf( |
73 | 73 | '<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
74 | - __( 'Edit', 'give' ), |
|
75 | - __( 'Remove', 'give' ) |
|
74 | + __('Edit', 'give'), |
|
75 | + __('Remove', 'give') |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 2.0 |
82 | 82 | */ |
83 | - $address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
|
83 | + $address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args); |
|
84 | 84 | |
85 | 85 | // Set unique id and index for multi type address. |
86 | - if ( isset( $address_args['index'] ) ) { |
|
86 | + if (isset($address_args['index'])) { |
|
87 | 87 | $address_label = "{$address_label} #{$address_args['index']}"; |
88 | 88 | } |
89 | 89 | |
90 | - if ( isset( $address_args['id'] ) ) { |
|
90 | + if (isset($address_args['id'])) { |
|
91 | 91 | $address_id = "{$address_id}_{$address_args['id']}"; |
92 | 92 | } |
93 | 93 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function give_donors_page() { |
114 | 114 | $default_views = give_donor_views(); |
115 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
116 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
117 | - give_render_donor_view( $requested_view, $default_views ); |
|
115 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
116 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
117 | + give_render_donor_view($requested_view, $default_views); |
|
118 | 118 | } else { |
119 | 119 | give_donors_list(); |
120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $views = array(); |
132 | 132 | |
133 | - return apply_filters( 'give_donor_views', $views ); |
|
133 | + return apply_filters('give_donor_views', $views); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $tabs = array(); |
146 | 146 | |
147 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
147 | + return apply_filters('give_donor_tabs', $tabs); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_donors_list() { |
158 | 158 | |
159 | - include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
|
159 | + include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php'; |
|
160 | 160 | |
161 | 161 | $donors_table = new Give_Donor_List_Table(); |
162 | 162 | $donors_table->prepare_items(); |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_donors_table_top' ); |
|
172 | + do_action('give_donors_table_top'); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <hr class="wp-header-end"> |
176 | 176 | <form id="give-donors-search-filter" method="get" |
177 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
178 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
177 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
178 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
179 | 179 | <input type="hidden" name="post_type" value="give_forms"/> |
180 | 180 | <input type="hidden" name="page" value="give-donors"/> |
181 | 181 | <input type="hidden" name="view" value="donors"/> |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @since 1.0 |
194 | 194 | */ |
195 | - do_action( 'give_donors_table_bottom' ); |
|
195 | + do_action('give_donors_table_bottom'); |
|
196 | 196 | ?> |
197 | 197 | </div> |
198 | 198 | <?php |
@@ -208,33 +208,33 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return void |
210 | 210 | */ |
211 | -function give_render_donor_view( $view, $callbacks ) { |
|
211 | +function give_render_donor_view($view, $callbacks) { |
|
212 | 212 | |
213 | 213 | $render = true; |
214 | 214 | |
215 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
215 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
216 | 216 | |
217 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
218 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
217 | + if ( ! current_user_can($donor_view_role)) { |
|
218 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
219 | 219 | $render = false; |
220 | 220 | } |
221 | 221 | |
222 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
223 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
222 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
223 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
224 | 224 | $render = false; |
225 | 225 | } |
226 | 226 | |
227 | 227 | $donor_id = (int) $_GET['id']; |
228 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
229 | - $donor = new Give_Donor( $donor_id ); |
|
228 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
229 | + $donor = new Give_Donor($donor_id); |
|
230 | 230 | |
231 | 231 | // Reconnect User with Donor profile. |
232 | - if ( $reconnect_user_id ) { |
|
233 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
232 | + if ($reconnect_user_id) { |
|
233 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
234 | 234 | } |
235 | 235 | |
236 | - if ( empty( $donor->id ) ) { |
|
237 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
236 | + if (empty($donor->id)) { |
|
237 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
238 | 238 | $render = false; |
239 | 239 | } |
240 | 240 | |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | |
244 | 244 | <div class='wrap'> |
245 | 245 | |
246 | - <?php if ( give_get_errors() ) : ?> |
|
246 | + <?php if (give_get_errors()) : ?> |
|
247 | 247 | <div class="error settings-error"> |
248 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
248 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
249 | 249 | </div> |
250 | 250 | <?php endif; ?> |
251 | 251 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | <?php |
254 | 254 | printf( |
255 | 255 | /* translators: %s: donor first name */ |
256 | - __( 'Edit Donor: %s %s', 'give' ), |
|
256 | + __('Edit Donor: %s %s', 'give'), |
|
257 | 257 | $donor->get_first_name(), |
258 | 258 | $donor->get_last_name() |
259 | 259 | ); |
@@ -262,26 +262,26 @@ discard block |
||
262 | 262 | |
263 | 263 | <hr class="wp-header-end"> |
264 | 264 | |
265 | - <?php if ( $donor && $render ) : ?> |
|
265 | + <?php if ($donor && $render) : ?> |
|
266 | 266 | |
267 | 267 | <h2 class="nav-tab-wrapper"> |
268 | 268 | <?php |
269 | - foreach ( $donor_tabs as $key => $tab ) : |
|
269 | + foreach ($donor_tabs as $key => $tab) : |
|
270 | 270 | $active = $key === $view ? true : false; |
271 | 271 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
272 | 272 | printf( |
273 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
274 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
275 | - esc_attr( $class ), |
|
276 | - sanitize_html_class( $tab['dashicon'] ), |
|
277 | - esc_html( $tab['title'] ) |
|
273 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
274 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
275 | + esc_attr($class), |
|
276 | + sanitize_html_class($tab['dashicon']), |
|
277 | + esc_html($tab['title']) |
|
278 | 278 | ); |
279 | 279 | endforeach; |
280 | 280 | ?> |
281 | 281 | </h2> |
282 | 282 | |
283 | 283 | <div id="give-donor-card-wrapper"> |
284 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
284 | + <?php $callbacks[$view]($donor) ?> |
|
285 | 285 | </div> |
286 | 286 | |
287 | 287 | <?php endif; ?> |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return void |
303 | 303 | */ |
304 | -function give_donor_view( $donor ) { |
|
304 | +function give_donor_view($donor) { |
|
305 | 305 | |
306 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
306 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Fires in donor profile screen, above the donor card. |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @param object $donor The donor object being displayed. |
314 | 314 | */ |
315 | - do_action( 'give_donor_card_top', $donor ); |
|
315 | + do_action('give_donor_card_top', $donor); |
|
316 | 316 | |
317 | 317 | // Set Read only to the fields which needs to be locked. |
318 | 318 | $read_only = ''; |
319 | - if ( $donor->user_id ) { |
|
319 | + if ($donor->user_id) { |
|
320 | 320 | $read_only = 'readonly="readonly"'; |
321 | 321 | } |
322 | 322 | |
@@ -324,28 +324,28 @@ discard block |
||
324 | 324 | $title_prefixes = give_get_name_title_prefixes(); |
325 | 325 | |
326 | 326 | // Prepend title prefix to name if it is set. |
327 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
328 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
327 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
328 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
329 | 329 | ?> |
330 | 330 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
331 | 331 | <form id="edit-donor-info" method="post" |
332 | - action="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); ?>"> |
|
332 | + action="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); ?>"> |
|
333 | 333 | <div class="donor-info"> |
334 | 334 | <div class="donor-bio-header clearfix"> |
335 | 335 | <div class="avatar-wrap left" id="donor-avatar"> |
336 | - <?php echo get_avatar( $donor->email ); ?> |
|
336 | + <?php echo get_avatar($donor->email); ?> |
|
337 | 337 | </div> |
338 | 338 | <div id="donor-name-wrap" class="left"> |
339 | 339 | <span class="donor-name info-item edit-item"> |
340 | 340 | <select name="donor_info[title]"> |
341 | - <option disabled value="0"><?php esc_html_e( 'Title', 'give' ); ?></option> |
|
341 | + <option disabled value="0"><?php esc_html_e('Title', 'give'); ?></option> |
|
342 | 342 | <?php |
343 | - if ( is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { |
|
344 | - foreach ( $title_prefixes as $title ) { |
|
343 | + if (is_array($title_prefixes) && count($title_prefixes) > 0) { |
|
344 | + foreach ($title_prefixes as $title) { |
|
345 | 345 | echo sprintf( |
346 | 346 | '<option %1$s value="%2$s">%2$s</option>', |
347 | - selected( $title_prefix, $title, false ), |
|
348 | - esc_html( $title ) |
|
347 | + selected($title_prefix, $title, false), |
|
348 | + esc_html($title) |
|
349 | 349 | ); |
350 | 350 | } |
351 | 351 | } |
@@ -353,34 +353,34 @@ discard block |
||
353 | 353 | </select> |
354 | 354 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
355 | 355 | name="donor_info[first_name]" type="text" |
356 | - value="<?php echo esc_html( $donor->get_first_name() ); ?>" |
|
357 | - placeholder="<?php esc_html_e( 'First Name', 'give' ); ?>"/> |
|
358 | - <?php if ( $donor->user_id ) : ?> |
|
356 | + value="<?php echo esc_html($donor->get_first_name()); ?>" |
|
357 | + placeholder="<?php esc_html_e('First Name', 'give'); ?>"/> |
|
358 | + <?php if ($donor->user_id) : ?> |
|
359 | 359 | <a href="#" class="give-lock-block"> |
360 | 360 | <i class="give-icon give-icon-locked"></i> |
361 | 361 | </a> |
362 | 362 | <?php endif; ?> |
363 | 363 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
364 | 364 | name="donor_info[last_name]" type="text" |
365 | - value="<?php echo esc_html( $donor->get_last_name() ); ?>" |
|
366 | - placeholder="<?php esc_html_e( 'Last Name', 'give' ); ?>"/> |
|
367 | - <?php if ( $donor->user_id ) : ?> |
|
365 | + value="<?php echo esc_html($donor->get_last_name()); ?>" |
|
366 | + placeholder="<?php esc_html_e('Last Name', 'give'); ?>"/> |
|
367 | + <?php if ($donor->user_id) : ?> |
|
368 | 368 | <a href="#" class="give-lock-block"> |
369 | 369 | <i class="give-icon give-icon-locked"></i> |
370 | 370 | </a> |
371 | 371 | <?php endif; ?> |
372 | 372 | </span> |
373 | 373 | <span class="donor-name info-item editable"> |
374 | - <span data-key="name"><?php echo esc_html( $donor->name ); ?></span> |
|
374 | + <span data-key="name"><?php echo esc_html($donor->name); ?></span> |
|
375 | 375 | </span> |
376 | 376 | </div> |
377 | 377 | <p class="donor-since info-item"> |
378 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
379 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
378 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
379 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
380 | 380 | </p> |
381 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
381 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
382 | 382 | <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"> |
383 | - <?php esc_html_e( 'Edit Donor', 'give' ); ?> |
|
383 | + <?php esc_html_e('Edit Donor', 'give'); ?> |
|
384 | 384 | </a> |
385 | 385 | <?php endif; ?> |
386 | 386 | </div> |
@@ -391,12 +391,12 @@ discard block |
||
391 | 391 | <table class="widefat striped"> |
392 | 392 | <tbody> |
393 | 393 | <tr> |
394 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'Donor ID:', 'give' ); ?></label> |
|
394 | + <th scope="col"><label for="tablecell"><?php esc_html_e('Donor ID:', 'give'); ?></label> |
|
395 | 395 | </th> |
396 | - <td><?php echo intval( $donor->id ); ?></td> |
|
396 | + <td><?php echo intval($donor->id); ?></td> |
|
397 | 397 | </tr> |
398 | 398 | <tr> |
399 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label> |
|
399 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label> |
|
400 | 400 | </th> |
401 | 401 | <td> |
402 | 402 | <span class="donor-user-id info-item edit-item"> |
@@ -414,24 +414,24 @@ discard block |
||
414 | 414 | 'data' => $data_atts, |
415 | 415 | ); |
416 | 416 | |
417 | - if ( ! empty( $user_id ) ) { |
|
418 | - $userdata = get_userdata( $user_id ); |
|
417 | + if ( ! empty($user_id)) { |
|
418 | + $userdata = get_userdata($user_id); |
|
419 | 419 | $user_args['selected'] = $user_id; |
420 | 420 | } |
421 | 421 | |
422 | - echo Give()->html->ajax_user_search( $user_args ); |
|
422 | + echo Give()->html->ajax_user_search($user_args); |
|
423 | 423 | ?> |
424 | 424 | </span> |
425 | 425 | |
426 | 426 | <span class="donor-user-id info-item editable"> |
427 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
427 | + <?php if ( ! empty($userdata)) : ?> |
|
428 | 428 | <span |
429 | - data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
429 | + data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
430 | 430 | <?php else : ?> |
431 | 431 | <span |
432 | - data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
|
432 | + data-key="user_id"><?php esc_html_e('Unregistered', 'give'); ?></span> |
|
433 | 433 | <?php endif; ?> |
434 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
|
434 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) : |
|
435 | 435 | |
436 | 436 | echo sprintf( |
437 | 437 | '- <span class="disconnect-user"> |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | <span class="view-user-profile"> |
441 | 441 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
442 | 442 | </span>', |
443 | - esc_html__( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
444 | - esc_html__( 'Disconnect User', 'give' ), |
|
445 | - esc_url( 'user-edit.php?user_id=' . $donor->user_id ), |
|
446 | - esc_html__( 'View User Profile of current user ID.', 'give' ), |
|
447 | - esc_html__( 'View User Profile', 'give' ) |
|
443 | + esc_html__('Disconnects the current user ID from this donor record.', 'give'), |
|
444 | + esc_html__('Disconnect User', 'give'), |
|
445 | + esc_url('user-edit.php?user_id='.$donor->user_id), |
|
446 | + esc_html__('View User Profile of current user ID.', 'give'), |
|
447 | + esc_html__('View User Profile', 'give') |
|
448 | 448 | ); |
449 | 449 | |
450 | 450 | endif; ?> |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | </tr> |
454 | 454 | |
455 | 455 | <?php |
456 | - $donor_company = $donor->get_meta( '_give_donor_company', true ); |
|
456 | + $donor_company = $donor->get_meta('_give_donor_company', true); |
|
457 | 457 | ?> |
458 | 458 | <tr class="alternate"> |
459 | 459 | <th scope="col"> |
460 | - <label for="tablecell"><?php esc_html_e( 'Company Name:', 'give' ); ?></label> |
|
460 | + <label for="tablecell"><?php esc_html_e('Company Name:', 'give'); ?></label> |
|
461 | 461 | </th> |
462 | 462 | <td> |
463 | 463 | <span class="donor-user-id info-item edit-item"> |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | </td> |
471 | 471 | </tr> |
472 | 472 | |
473 | - <?php $anonymous_donor = absint( $donor->get_meta( '_give_anonymous_donor', true ) ); ?> |
|
473 | + <?php $anonymous_donor = absint($donor->get_meta('_give_anonymous_donor', true)); ?> |
|
474 | 474 | <tr class="alternate"> |
475 | 475 | <th scope="col"> |
476 | - <label for="tablecell"><?php _e( 'Anonymous Donor:', 'give' ); ?></label> |
|
476 | + <label for="tablecell"><?php _e('Anonymous Donor:', 'give'); ?></label> |
|
477 | 477 | </th> |
478 | 478 | <td> |
479 | 479 | <span class="donor-anonymous-donor info-item edit-item"> |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | name="give_anonymous_donor" |
485 | 485 | value="1" |
486 | 486 | type="radio" |
487 | - <?php checked( 1, $anonymous_donor ) ?> |
|
488 | - ><?php _e( 'Yes', 'give' ); ?> |
|
487 | + <?php checked(1, $anonymous_donor) ?> |
|
488 | + ><?php _e('Yes', 'give'); ?> |
|
489 | 489 | </label> |
490 | 490 | </li> |
491 | 491 | <li> |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | name="give_anonymous_donor" |
495 | 495 | value="0" |
496 | 496 | type="radio" |
497 | - <?php checked( 0, $anonymous_donor ) ?> |
|
498 | - ><?php _e( 'No', 'give' ); ?> |
|
497 | + <?php checked(0, $anonymous_donor) ?> |
|
498 | + ><?php _e('No', 'give'); ?> |
|
499 | 499 | </label> |
500 | 500 | </li> |
501 | 501 | </ul> |
502 | 502 | </span> |
503 | 503 | <span class="donor-anonymous-donor info-item editable"> |
504 | - <?php echo( $anonymous_donor ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ); ?> |
|
504 | + <?php echo($anonymous_donor ? __('Yes', 'give') : __('No', 'give')); ?> |
|
505 | 505 | </span> |
506 | 506 | </td> |
507 | 507 | </tr> |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | </div> |
514 | 514 | |
515 | 515 | <span id="donor-edit-actions" class="edit-item"> |
516 | - <input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval( $donor->id ); ?>"/> |
|
517 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
516 | + <input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval($donor->id); ?>"/> |
|
517 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
518 | 518 | <input type="hidden" name="give_action" value="edit-donor"/> |
519 | 519 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
520 | - value="<?php esc_html_e( 'Update Donor', 'give' ); ?>"/> |
|
521 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
520 | + value="<?php esc_html_e('Update Donor', 'give'); ?>"/> |
|
521 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
522 | 522 | </span> |
523 | 523 | |
524 | 524 | </form> |
@@ -533,24 +533,24 @@ discard block |
||
533 | 533 | * |
534 | 534 | * @param Give_Donor $donor The donor object being displayed. |
535 | 535 | */ |
536 | - do_action( 'give_donor_before_stats', $donor ); |
|
536 | + do_action('give_donor_before_stats', $donor); |
|
537 | 537 | ?> |
538 | 538 | |
539 | 539 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
540 | 540 | <ul> |
541 | 541 | <li> |
542 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
542 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
543 | 543 | <span class="dashicons dashicons-heart"></span> |
544 | 544 | <?php |
545 | 545 | // Completed Donations. |
546 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
547 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
546 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
547 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
548 | 548 | ?> |
549 | 549 | </a> |
550 | 550 | </li> |
551 | 551 | <li> |
552 | 552 | <span class="dashicons dashicons-chart-area"></span> |
553 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
553 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
554 | 554 | </li> |
555 | 555 | <?php |
556 | 556 | /** |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @param object $donor The donor object being displayed. |
564 | 564 | */ |
565 | - do_action( 'give_donor_stats_list', $donor ); |
|
565 | + do_action('give_donor_stats_list', $donor); |
|
566 | 566 | ?> |
567 | 567 | </ul> |
568 | 568 | </div> |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @param Give_Donor $donor The donor object being displayed. |
577 | 577 | */ |
578 | - do_action( 'give_donor_before_address', $donor ); |
|
578 | + do_action('give_donor_before_address', $donor); |
|
579 | 579 | ?> |
580 | 580 | |
581 | 581 | <div id="donor-address-wrapper" class="donor-section clear"> |
582 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
582 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
583 | 583 | |
584 | 584 | <div class="postbox"> |
585 | 585 | <div class="give-spinner-wrapper"> |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | <div class="all-address"> |
590 | 590 | <div class="give-grid-row"> |
591 | 591 | <?php |
592 | - if ( ! empty( $donor->address ) ) : |
|
592 | + if ( ! empty($donor->address)) : |
|
593 | 593 | // Default address always will be at zero array index. |
594 | 594 | $is_set_as_default = null; |
595 | 595 | |
596 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
596 | + foreach ($donor->address as $address_type => $addresses) { |
|
597 | 597 | |
598 | - switch ( true ) { |
|
599 | - case is_array( end( $addresses ) ): |
|
598 | + switch (true) { |
|
599 | + case is_array(end($addresses)): |
|
600 | 600 | $index = 1; |
601 | - foreach ( $addresses as $id => $address ) { |
|
601 | + foreach ($addresses as $id => $address) { |
|
602 | 602 | echo __give_get_format_address( |
603 | 603 | $address, |
604 | 604 | array( |
@@ -608,11 +608,11 @@ discard block |
||
608 | 608 | ) |
609 | 609 | ); |
610 | 610 | |
611 | - $index ++; |
|
611 | + $index++; |
|
612 | 612 | } |
613 | 613 | break; |
614 | 614 | |
615 | - case is_string( end( $addresses ) ): |
|
615 | + case is_string(end($addresses)): |
|
616 | 616 | echo __give_get_format_address( |
617 | 617 | $addresses, |
618 | 618 | array( |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | endif; |
626 | 626 | ?> |
627 | 627 | </div> |
628 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
628 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
629 | 629 | echo ' give-hidden'; |
630 | 630 | } ?>"> |
631 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
631 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
632 | 632 | </span> |
633 | 633 | <button class="button add-new-address"> |
634 | - <?php _e( 'Add Address', 'give' ); ?> |
|
634 | + <?php _e('Add Address', 'give'); ?> |
|
635 | 635 | </button> |
636 | 636 | </div> |
637 | 637 | |
@@ -641,26 +641,26 @@ discard block |
||
641 | 641 | <tbody> |
642 | 642 | <tr> |
643 | 643 | <th class="col"> |
644 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
644 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
645 | 645 | </th> |
646 | 646 | <td> |
647 | 647 | <?php |
648 | - echo Give()->html->select( array( |
|
648 | + echo Give()->html->select(array( |
|
649 | 649 | 'options' => give_get_country_list(), |
650 | 650 | 'name' => 'country', |
651 | - 'selected' => give_get_option( 'base_country' ), |
|
651 | + 'selected' => give_get_option('base_country'), |
|
652 | 652 | 'show_option_all' => false, |
653 | 653 | 'show_option_none' => false, |
654 | 654 | 'chosen' => true, |
655 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
656 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
657 | - ) ); |
|
655 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
656 | + 'data' => array('search-type' => 'no_ajax'), |
|
657 | + )); |
|
658 | 658 | ?> |
659 | 659 | </td> |
660 | 660 | </tr> |
661 | 661 | <tr> |
662 | 662 | <th class="col"> |
663 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
663 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
664 | 664 | </th> |
665 | 665 | <td> |
666 | 666 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | </tr> |
669 | 669 | <tr> |
670 | 670 | <th class="col"> |
671 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
671 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
672 | 672 | </th> |
673 | 673 | <td> |
674 | 674 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | </tr> |
678 | 678 | <tr> |
679 | 679 | <th class="col"> |
680 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
680 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
681 | 681 | </th> |
682 | 682 | <td> |
683 | 683 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -685,42 +685,42 @@ discard block |
||
685 | 685 | </tr> |
686 | 686 | <?php |
687 | 687 | $no_states_country = give_no_states_country_list(); |
688 | - $base_country = give_get_option( 'base_country' ); |
|
689 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
688 | + $base_country = give_get_option('base_country'); |
|
689 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
690 | 690 | ?> |
691 | 691 | <tr class="give-field-wrap"> |
692 | 692 | <th class="col"> |
693 | 693 | <label |
694 | - for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
694 | + for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
695 | 695 | </th> |
696 | 696 | <td> |
697 | 697 | <?php |
698 | - $states = give_get_states( $base_country ); |
|
698 | + $states = give_get_states($base_country); |
|
699 | 699 | $state_args = array( |
700 | 700 | 'name' => 'state', |
701 | 701 | 'class' => 'regular-text', |
702 | 702 | ); |
703 | 703 | |
704 | - if ( empty( $states ) ) { |
|
704 | + if (empty($states)) { |
|
705 | 705 | |
706 | 706 | // Show Text field, if empty states. |
707 | - $state_args = wp_parse_args( $state_args, array( |
|
708 | - 'value' => give_get_option( 'base_state' ), |
|
709 | - ) ); |
|
710 | - echo Give()->html->text( $state_args ); |
|
707 | + $state_args = wp_parse_args($state_args, array( |
|
708 | + 'value' => give_get_option('base_state'), |
|
709 | + )); |
|
710 | + echo Give()->html->text($state_args); |
|
711 | 711 | } else { |
712 | 712 | |
713 | 713 | // Show Chosen DropDown, if states are not empty. |
714 | - $state_args = wp_parse_args( $state_args, array( |
|
714 | + $state_args = wp_parse_args($state_args, array( |
|
715 | 715 | 'options' => $states, |
716 | - 'selected' => give_get_option( 'base_state' ), |
|
716 | + 'selected' => give_get_option('base_state'), |
|
717 | 717 | 'show_option_all' => false, |
718 | 718 | 'show_option_none' => false, |
719 | 719 | 'chosen' => true, |
720 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
721 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
722 | - ) ); |
|
723 | - echo Give()->html->select( $state_args ); |
|
720 | + 'placeholder' => __('Select a state', 'give'), |
|
721 | + 'data' => array('search-type' => 'no_ajax'), |
|
722 | + )); |
|
723 | + echo Give()->html->select($state_args); |
|
724 | 724 | } |
725 | 725 | ?> |
726 | 726 | </td> |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | ?> |
731 | 731 | <tr> |
732 | 732 | <th class="col"> |
733 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
733 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
734 | 734 | </th> |
735 | 735 | <td> |
736 | 736 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | </tr> |
739 | 739 | <tr> |
740 | 740 | <td colspan="2"> |
741 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
741 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
742 | 742 | <input type="hidden" name="address-action" value="add"> |
743 | 743 | <input type="hidden" name="address-id" value=""> |
744 | 744 | <input type="submit" class="button button-primary js-save" |
745 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
746 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
745 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
746 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
747 | 747 | </td> |
748 | 748 | </tr> |
749 | 749 | </tbody> |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @param Give_Donor $donor The donor object being displayed. |
764 | 764 | */ |
765 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
765 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
766 | 766 | ?> |
767 | 767 | |
768 | 768 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -775,46 +775,46 @@ discard block |
||
775 | 775 | * |
776 | 776 | * @param object $donor The donor object being displayed. |
777 | 777 | */ |
778 | - do_action( 'give_donor_before_tables', $donor ); |
|
778 | + do_action('give_donor_before_tables', $donor); |
|
779 | 779 | ?> |
780 | 780 | |
781 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
781 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
782 | 782 | |
783 | 783 | <table class="wp-list-table widefat striped emails"> |
784 | 784 | <thead> |
785 | 785 | <tr> |
786 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
787 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
786 | + <th><?php _e('Email', 'give'); ?></th> |
|
787 | + <th><?php _e('Actions', 'give'); ?></th> |
|
788 | 788 | </tr> |
789 | 789 | </thead> |
790 | 790 | |
791 | 791 | <tbody> |
792 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
792 | + <?php if ( ! empty($donor->emails)) { ?> |
|
793 | 793 | |
794 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
794 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
795 | 795 | <tr data-key="<?php echo $key; ?>"> |
796 | 796 | <td> |
797 | 797 | <?php echo $email; ?> |
798 | - <?php if ( 'primary' === $key ) : ?> |
|
798 | + <?php if ('primary' === $key) : ?> |
|
799 | 799 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
800 | 800 | <?php endif; ?> |
801 | 801 | </td> |
802 | 802 | <td> |
803 | - <?php if ( 'primary' !== $key ) : ?> |
|
803 | + <?php if ('primary' !== $key) : ?> |
|
804 | 804 | <?php |
805 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
806 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
807 | - 'email' => rawurlencode( $email ), |
|
805 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
806 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
807 | + 'email' => rawurlencode($email), |
|
808 | 808 | 'give_action' => 'set_donor_primary_email', |
809 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
810 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
811 | - 'email' => rawurlencode( $email ), |
|
809 | + ), $base_url), 'give-set-donor-primary-email'); |
|
810 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
811 | + 'email' => rawurlencode($email), |
|
812 | 812 | 'give_action' => 'remove_donor_email', |
813 | - ), $base_url ), 'give-remove-donor-email' ); |
|
813 | + ), $base_url), 'give-remove-donor-email'); |
|
814 | 814 | ?> |
815 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
815 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
816 | 816 | | |
817 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
817 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
818 | 818 | <?php endif; ?> |
819 | 819 | </td> |
820 | 820 | </tr> |
@@ -824,14 +824,14 @@ discard block |
||
824 | 824 | <td colspan="2" class="add-donor-email-td"> |
825 | 825 | <div class="add-donor-email-wrapper"> |
826 | 826 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
827 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
827 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
828 | 828 | <input type="email" name="additional-email" value="" |
829 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
829 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
830 | 830 | <input type="checkbox" name="make-additional-primary" value="1" |
831 | 831 | id="make-additional-primary"/> <label |
832 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
832 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
833 | 833 | <button class="button-secondary give-add-donor-email" |
834 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
834 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
835 | 835 | <span class="spinner"></span> |
836 | 836 | </div> |
837 | 837 | <div class="notice-wrap"></div> |
@@ -839,54 +839,54 @@ discard block |
||
839 | 839 | </tr> |
840 | 840 | <?php } else { ?> |
841 | 841 | <tr> |
842 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
842 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
843 | 843 | </tr> |
844 | 844 | <?php }// End if(). |
845 | 845 | ?> |
846 | 846 | </tbody> |
847 | 847 | </table> |
848 | 848 | |
849 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
849 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
850 | 850 | <?php |
851 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
852 | - $payments = give_get_payments( array( |
|
851 | + $payment_ids = explode(',', $donor->payment_ids); |
|
852 | + $payments = give_get_payments(array( |
|
853 | 853 | 'post__in' => $payment_ids, |
854 | - ) ); |
|
855 | - $payments = array_slice( $payments, 0, 10 ); |
|
854 | + )); |
|
855 | + $payments = array_slice($payments, 0, 10); |
|
856 | 856 | ?> |
857 | 857 | <table class="wp-list-table widefat striped payments"> |
858 | 858 | <thead> |
859 | 859 | <tr> |
860 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
861 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
862 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
863 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
864 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
860 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
861 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
862 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
863 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
864 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
865 | 865 | </tr> |
866 | 866 | </thead> |
867 | 867 | <tbody> |
868 | - <?php if ( ! empty( $payments ) ) { ?> |
|
869 | - <?php foreach ( $payments as $payment ) : ?> |
|
868 | + <?php if ( ! empty($payments)) { ?> |
|
869 | + <?php foreach ($payments as $payment) : ?> |
|
870 | 870 | <tr> |
871 | - <td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td> |
|
872 | - <td><?php echo give_donation_amount( $payment->ID, array( |
|
871 | + <td><?php echo Give()->seq_donation_number->get_serial_code($payment->ID); ?></td> |
|
872 | + <td><?php echo give_donation_amount($payment->ID, array( |
|
873 | 873 | 'currency' => true, |
874 | 874 | 'amount' => true, |
875 | 875 | 'type' => 'donor' |
876 | - ) ); ?></td> |
|
877 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
878 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
876 | + )); ?></td> |
|
877 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
878 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
879 | 879 | <td> |
880 | 880 | <?php |
881 | 881 | printf( |
882 | 882 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
883 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
883 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
884 | 884 | sprintf( |
885 | 885 | /* translators: %s: Donation ID */ |
886 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
886 | + esc_attr__('View Donation %s.', 'give'), |
|
887 | 887 | $payment->ID |
888 | 888 | ), |
889 | - __( 'View Donation', 'give' ) |
|
889 | + __('View Donation', 'give') |
|
890 | 890 | ); |
891 | 891 | ?> |
892 | 892 | |
@@ -901,47 +901,47 @@ discard block |
||
901 | 901 | * @param object $donor The donor object being displayed. |
902 | 902 | * @param object $payment The payment object being displayed. |
903 | 903 | */ |
904 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
904 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
905 | 905 | ?> |
906 | 906 | </td> |
907 | 907 | </tr> |
908 | 908 | <?php endforeach; ?> |
909 | 909 | <?php } else { ?> |
910 | 910 | <tr> |
911 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
911 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
912 | 912 | </tr> |
913 | 913 | <?php }// End if(). |
914 | 914 | ?> |
915 | 915 | </tbody> |
916 | 916 | </table> |
917 | 917 | |
918 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
918 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
919 | 919 | <?php |
920 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
920 | + $donations = give_get_users_completed_donations($donor->email); |
|
921 | 921 | ?> |
922 | 922 | <table class="wp-list-table widefat striped donations"> |
923 | 923 | <thead> |
924 | 924 | <tr> |
925 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
926 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
925 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
926 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
927 | 927 | </tr> |
928 | 928 | </thead> |
929 | 929 | <tbody> |
930 | - <?php if ( ! empty( $donations ) ) { ?> |
|
931 | - <?php foreach ( $donations as $donation ) : ?> |
|
930 | + <?php if ( ! empty($donations)) { ?> |
|
931 | + <?php foreach ($donations as $donation) : ?> |
|
932 | 932 | <tr> |
933 | 933 | <td><?php echo $donation->post_title; ?></td> |
934 | 934 | <td> |
935 | 935 | <?php |
936 | 936 | printf( |
937 | 937 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
938 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
938 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
939 | 939 | sprintf( |
940 | 940 | /* translators: %s: form name */ |
941 | - esc_attr__( 'View Form %s.', 'give' ), |
|
941 | + esc_attr__('View Form %s.', 'give'), |
|
942 | 942 | $donation->post_title |
943 | 943 | ), |
944 | - __( 'View Form', 'give' ) |
|
944 | + __('View Form', 'give') |
|
945 | 945 | ); |
946 | 946 | ?> |
947 | 947 | </td> |
@@ -949,62 +949,62 @@ discard block |
||
949 | 949 | <?php endforeach; ?> |
950 | 950 | <?php } else { ?> |
951 | 951 | <tr> |
952 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
952 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
953 | 953 | </tr> |
954 | 954 | <?php } ?> |
955 | 955 | </tbody> |
956 | 956 | </table> |
957 | 957 | |
958 | - <h3><?php _e( 'Comments', 'give' ); ?></h3> |
|
958 | + <h3><?php _e('Comments', 'give'); ?></h3> |
|
959 | 959 | <?php |
960 | 960 | // @todo load comment by ajax to improve performance. |
961 | - $donations = give_get_users_donations( $donor->email ); |
|
961 | + $donations = give_get_users_donations($donor->email); |
|
962 | 962 | ?> |
963 | 963 | <table class="wp-list-table widefat striped comments"> |
964 | 964 | <thead> |
965 | 965 | <tr> |
966 | - <th scope="col"><?php _e( 'Donation', 'give' ); ?></th> |
|
967 | - <th scope="col"><?php _e( 'Anonymous', 'give' ); ?></th> |
|
968 | - <th scope="col" colspan="3"><?php _e( 'Comment', 'give' ); ?></th> |
|
966 | + <th scope="col"><?php _e('Donation', 'give'); ?></th> |
|
967 | + <th scope="col"><?php _e('Anonymous', 'give'); ?></th> |
|
968 | + <th scope="col" colspan="3"><?php _e('Comment', 'give'); ?></th> |
|
969 | 969 | </tr> |
970 | 970 | </thead> |
971 | 971 | <tbody> |
972 | - <?php if ( ! empty( $donations ) ) : ?> |
|
973 | - <?php foreach ( $donations as $donation ) : ?> |
|
972 | + <?php if ( ! empty($donations)) : ?> |
|
973 | + <?php foreach ($donations as $donation) : ?> |
|
974 | 974 | <?php |
975 | - $comment = give_get_donor_donation_comment( $donation->ID, give_get_payment_donor_id( $donation->ID ) ); |
|
975 | + $comment = give_get_donor_donation_comment($donation->ID, give_get_payment_donor_id($donation->ID)); |
|
976 | 976 | |
977 | - if ( ! $comment instanceof WP_Comment ) { |
|
977 | + if ( ! $comment instanceof WP_Comment) { |
|
978 | 978 | continue; |
979 | 979 | } |
980 | 980 | ?> |
981 | 981 | <tr> |
982 | 982 | <td> |
983 | 983 | <?php |
984 | - $donation_number = Give()->seq_donation_number->get_serial_code( $donation ); |
|
984 | + $donation_number = Give()->seq_donation_number->get_serial_code($donation); |
|
985 | 985 | echo $donation_number; |
986 | 986 | ?> |
987 | 987 | </td> |
988 | 988 | <td> |
989 | 989 | <?php |
990 | - echo absint( give_get_payment_meta( $donation->ID, '_give_anonymous_donation' ) ) |
|
991 | - ? __( 'Yes', 'give' ) |
|
992 | - : __( 'No', 'give' ); |
|
990 | + echo absint(give_get_payment_meta($donation->ID, '_give_anonymous_donation')) |
|
991 | + ? __('Yes', 'give') |
|
992 | + : __('No', 'give'); |
|
993 | 993 | ?> |
994 | 994 | </td> |
995 | 995 | <td> |
996 | 996 | <?php |
997 | - echo apply_filters( 'the_content', $comment->comment_content ); |
|
997 | + echo apply_filters('the_content', $comment->comment_content); |
|
998 | 998 | |
999 | 999 | echo sprintf( |
1000 | 1000 | '<a href="%1$s" aria-label="%2$s" target="_blank">%3$s</a>', |
1001 | - admin_url( "edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id={$donation->ID}#give-payment-donor-comment" ), |
|
1001 | + admin_url("edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id={$donation->ID}#give-payment-donor-comment"), |
|
1002 | 1002 | sprintf( |
1003 | 1003 | /* translators: %s: Comment ID */ |
1004 | - esc_attr__( 'Edit Comment %s.', 'give' ), |
|
1004 | + esc_attr__('Edit Comment %s.', 'give'), |
|
1005 | 1005 | $comment->comment_ID |
1006 | 1006 | ), |
1007 | - __( 'Edit Comment', 'give' ) |
|
1007 | + __('Edit Comment', 'give') |
|
1008 | 1008 | ); |
1009 | 1009 | ?> |
1010 | 1010 | </td> |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | <?php endforeach; ?> |
1013 | 1013 | <?php else: ?> |
1014 | 1014 | <tr> |
1015 | - <td colspan="5"><?php _e( 'No comment found.', 'give' ); ?></td> |
|
1015 | + <td colspan="5"><?php _e('No comment found.', 'give'); ?></td> |
|
1016 | 1016 | </tr> |
1017 | 1017 | <?php endif ?> |
1018 | 1018 | </tbody> |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | * |
1027 | 1027 | * @param object $donor The donor object being displayed. |
1028 | 1028 | */ |
1029 | - do_action( 'give_donor_after_tables', $donor ); |
|
1029 | + do_action('give_donor_after_tables', $donor); |
|
1030 | 1030 | ?> |
1031 | 1031 | |
1032 | 1032 | </div> |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | * |
1040 | 1040 | * @param object $donor The donor object being displayed. |
1041 | 1041 | */ |
1042 | - do_action( 'give_donor_card_bottom', $donor ); |
|
1042 | + do_action('give_donor_card_bottom', $donor); |
|
1043 | 1043 | |
1044 | 1044 | } |
1045 | 1045 | |
@@ -1052,31 +1052,31 @@ discard block |
||
1052 | 1052 | * |
1053 | 1053 | * @return void |
1054 | 1054 | */ |
1055 | -function give_donor_notes_view( $donor ) { |
|
1055 | +function give_donor_notes_view($donor) { |
|
1056 | 1056 | |
1057 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
1058 | - $paged = absint( $paged ); |
|
1057 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
1058 | + $paged = absint($paged); |
|
1059 | 1059 | $note_count = $donor->get_notes_count(); |
1060 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
1061 | - $total_pages = ceil( $note_count / $per_page ); |
|
1062 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
1060 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
1061 | + $total_pages = ceil($note_count / $per_page); |
|
1062 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
1063 | 1063 | ?> |
1064 | 1064 | |
1065 | 1065 | <div id="donor-notes-wrapper"> |
1066 | 1066 | <div class="donor-notes-header"> |
1067 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1067 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1068 | 1068 | </div> |
1069 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
1069 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
1070 | 1070 | |
1071 | - <?php if ( 1 == $paged ) : ?> |
|
1071 | + <?php if (1 == $paged) : ?> |
|
1072 | 1072 | <div style="display: block; margin-bottom: 55px;"> |
1073 | 1073 | <form id="give-add-donor-note" method="post" |
1074 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
1074 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
1075 | 1075 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
1076 | 1076 | <br/> |
1077 | 1077 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
1078 | 1078 | <input type="hidden" name="give_action" value="add-donor-note"/> |
1079 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
1079 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
1080 | 1080 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
1081 | 1081 | </form> |
1082 | 1082 | </div> |
@@ -1091,26 +1091,26 @@ discard block |
||
1091 | 1091 | 'show_all' => true, |
1092 | 1092 | ); |
1093 | 1093 | |
1094 | - echo paginate_links( $pagination_args ); |
|
1094 | + echo paginate_links($pagination_args); |
|
1095 | 1095 | ?> |
1096 | 1096 | |
1097 | 1097 | <div id="give-donor-notes" class="postbox"> |
1098 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
1099 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
1098 | + <?php if (count($donor_notes) > 0) { ?> |
|
1099 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
1100 | 1100 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
1101 | 1101 | <span class="note-content-wrap"> |
1102 | - <?php echo stripslashes( $note ); ?> |
|
1102 | + <?php echo stripslashes($note); ?> |
|
1103 | 1103 | </span> |
1104 | 1104 | </div> |
1105 | 1105 | <?php endforeach; ?> |
1106 | 1106 | <?php } else { ?> |
1107 | 1107 | <div class="give-no-donor-notes"> |
1108 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
1108 | + <?php _e('No donor notes found.', 'give'); ?> |
|
1109 | 1109 | </div> |
1110 | 1110 | <?php } ?> |
1111 | 1111 | </div> |
1112 | 1112 | |
1113 | - <?php echo paginate_links( $pagination_args ); ?> |
|
1113 | + <?php echo paginate_links($pagination_args); ?> |
|
1114 | 1114 | |
1115 | 1115 | </div> |
1116 | 1116 | |
@@ -1126,9 +1126,9 @@ discard block |
||
1126 | 1126 | * |
1127 | 1127 | * @return void |
1128 | 1128 | */ |
1129 | -function give_donor_delete_view( $donor ) { |
|
1129 | +function give_donor_delete_view($donor) { |
|
1130 | 1130 | |
1131 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
1131 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
1132 | 1132 | |
1133 | 1133 | /** |
1134 | 1134 | * Fires in donor delete screen, above the content. |
@@ -1137,16 +1137,16 @@ discard block |
||
1137 | 1137 | * |
1138 | 1138 | * @param object $donor The donor object being displayed. |
1139 | 1139 | */ |
1140 | - do_action( 'give_donor_delete_top', $donor ); |
|
1140 | + do_action('give_donor_delete_top', $donor); |
|
1141 | 1141 | ?> |
1142 | 1142 | |
1143 | 1143 | <div class="info-wrapper donor-section"> |
1144 | 1144 | |
1145 | 1145 | <form id="delete-donor" method="post" |
1146 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
1146 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
1147 | 1147 | |
1148 | 1148 | <div class="donor-notes-header"> |
1149 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1149 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1150 | 1150 | </div> |
1151 | 1151 | |
1152 | 1152 | |
@@ -1154,22 +1154,22 @@ discard block |
||
1154 | 1154 | |
1155 | 1155 | <span class="delete-donor-options"> |
1156 | 1156 | <p> |
1157 | - <?php echo Give()->html->checkbox( array( |
|
1157 | + <?php echo Give()->html->checkbox(array( |
|
1158 | 1158 | 'name' => 'give-donor-delete-confirm', |
1159 | - ) ); ?> |
|
1159 | + )); ?> |
|
1160 | 1160 | <label |
1161 | - for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
1161 | + for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
1162 | 1162 | </p> |
1163 | 1163 | |
1164 | 1164 | <p> |
1165 | - <?php echo Give()->html->checkbox( array( |
|
1165 | + <?php echo Give()->html->checkbox(array( |
|
1166 | 1166 | 'name' => 'give-donor-delete-records', |
1167 | 1167 | 'options' => array( |
1168 | 1168 | 'disabled' => true, |
1169 | 1169 | ), |
1170 | - ) ); ?> |
|
1170 | + )); ?> |
|
1171 | 1171 | <label |
1172 | - for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
1172 | + for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
1173 | 1173 | </p> |
1174 | 1174 | |
1175 | 1175 | <?php |
@@ -1182,19 +1182,19 @@ discard block |
||
1182 | 1182 | * |
1183 | 1183 | * @param object $donor The donor object being displayed. |
1184 | 1184 | */ |
1185 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
1185 | + do_action('give_donor_delete_inputs', $donor); |
|
1186 | 1186 | ?> |
1187 | 1187 | </span> |
1188 | 1188 | |
1189 | 1189 | <span id="donor-edit-actions"> |
1190 | 1190 | <input type="hidden" name="donor_id" value="<?php echo $donor->id; ?>"/> |
1191 | - <?php wp_nonce_field( 'give-delete-donor', '_wpnonce', false, true ); ?> |
|
1191 | + <?php wp_nonce_field('give-delete-donor', '_wpnonce', false, true); ?> |
|
1192 | 1192 | <input type="hidden" name="give_action" value="delete_donor"/> |
1193 | 1193 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
1194 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
1194 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
1195 | 1195 | <a id="give-delete-donor-cancel" |
1196 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
1197 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
1196 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
1197 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
1198 | 1198 | </span> |
1199 | 1199 | |
1200 | 1200 | </div> |
@@ -1210,5 +1210,5 @@ discard block |
||
1210 | 1210 | * |
1211 | 1211 | * @param object $donor The donor object being displayed. |
1212 | 1212 | */ |
1213 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
1213 | + do_action('give_donor_delete_bottom', $donor); |
|
1214 | 1214 | } |
@@ -427,9 +427,12 @@ discard block |
||
427 | 427 | <?php if ( ! empty( $userdata ) ) : ?> |
428 | 428 | <span |
429 | 429 | data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
430 | - <?php else : ?> |
|
430 | + <?php else { |
|
431 | + : ?> |
|
431 | 432 | <span |
432 | - data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
|
433 | + data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); |
|
434 | +} |
|
435 | +?></span> |
|
433 | 436 | <?php endif; ?> |
434 | 437 | <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
435 | 438 | |
@@ -1010,9 +1013,12 @@ discard block |
||
1010 | 1013 | </td> |
1011 | 1014 | </tr> |
1012 | 1015 | <?php endforeach; ?> |
1013 | - <?php else: ?> |
|
1016 | + <?php else { |
|
1017 | + : ?> |
|
1014 | 1018 | <tr> |
1015 | - <td colspan="5"><?php _e( 'No comment found.', 'give' ); ?></td> |
|
1019 | + <td colspan="5"><?php _e( 'No comment found.', 'give' ); |
|
1020 | +} |
|
1021 | +?></td> |
|
1016 | 1022 | </tr> |
1017 | 1023 | <?php endif ?> |
1018 | 1024 | </tbody> |