@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | * |
88 | - * @param $setting_tab |
|
88 | + * @param string $setting_tab |
|
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) : |
|
12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * This class loads the cmb2 settings. |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | |
53 | 53 | // Get current tab. |
54 | 54 | $this->current_tab = give_get_current_setting_tab(); |
55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] ); |
|
55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']); |
|
56 | 56 | |
57 | 57 | // Tab ID. |
58 | 58 | $this->id = $this->current_tab; |
59 | 59 | |
60 | 60 | |
61 | 61 | // Add addon tabs. |
62 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 ); |
|
62 | + add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); |
|
63 | 63 | |
64 | 64 | // Add save hook to addons. |
65 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 ); |
|
65 | + add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); |
|
66 | 66 | |
67 | 67 | // Add backward compatibility filters plugin settings. |
68 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' ); |
|
68 | + $setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); |
|
69 | 69 | |
70 | 70 | // Filter Payment Gateways settings. |
71 | - if ( in_array( $this->current_tab, $setting_tabs ) ) { |
|
72 | - add_filter( "give_get_settings_{$this->current_tab}", array( |
|
71 | + if (in_array($this->current_tab, $setting_tabs)) { |
|
72 | + add_filter("give_get_settings_{$this->current_tab}", array( |
|
73 | 73 | $this, |
74 | 74 | 'get_filtered_addon_settings' |
75 | - ), 999999, 1 ); |
|
76 | - add_filter( "give_get_sections_{$this->current_tab}", array( |
|
75 | + ), 999999, 1); |
|
76 | + add_filter("give_get_sections_{$this->current_tab}", array( |
|
77 | 77 | $this, |
78 | 78 | 'get_filtered_addon_sections' |
79 | - ), 999999, 1 ); |
|
79 | + ), 999999, 1); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
92 | - function set_default_setting_tab( $setting_tab ) { |
|
92 | + function set_default_setting_tab($setting_tab) { |
|
93 | 93 | $default_tab = ''; |
94 | 94 | |
95 | 95 | // Set default tab to first setting tab. |
96 | - if ( $sections = array_keys( $this->get_sections() ) ) { |
|
97 | - $default_tab = current( $sections ); |
|
96 | + if ($sections = array_keys($this->get_sections())) { |
|
97 | + $default_tab = current($sections); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return $default_tab; |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | - function add_addon_settings_page( $pages ) { |
|
112 | + function add_addon_settings_page($pages) { |
|
113 | 113 | // Previous setting page. |
114 | 114 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
115 | 115 | |
116 | 116 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
117 | - unset( $previous_pages['api'] ); |
|
118 | - unset( $previous_pages['system_info'] ); |
|
117 | + unset($previous_pages['api']); |
|
118 | + unset($previous_pages['system_info']); |
|
119 | 119 | |
120 | 120 | // Tab is not register. |
121 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) ); |
|
121 | + $pages_diff = array_keys(array_diff($previous_pages, $pages)); |
|
122 | 122 | |
123 | 123 | // Merge old settings with new settings. |
124 | - $pages = array_merge( $pages, $previous_pages ); |
|
124 | + $pages = array_merge($pages, $previous_pages); |
|
125 | 125 | |
126 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
126 | + if (in_array($this->current_tab, $pages_diff)) { |
|
127 | 127 | // Filter & actions. |
128 | - add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( |
|
128 | + add_filter("give_default_setting_tab_section_{$this->current_tab}", array( |
|
129 | 129 | $this, |
130 | 130 | 'set_default_setting_tab' |
131 | - ), 10 ); |
|
132 | - add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); |
|
133 | - add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); |
|
134 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
131 | + ), 10); |
|
132 | + add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); |
|
133 | + add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); |
|
134 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $pages; |
@@ -147,29 +147,29 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @return mixed |
149 | 149 | */ |
150 | - function setup_addon_save_hook( $pages ) { |
|
150 | + function setup_addon_save_hook($pages) { |
|
151 | 151 | $page_ids = array(); |
152 | 152 | |
153 | - foreach ( $pages as $page ) { |
|
154 | - $page_ids = $page->add_settings_page( $page_ids ); |
|
153 | + foreach ($pages as $page) { |
|
154 | + $page_ids = $page->add_settings_page($page_ids); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | // Previous setting page. |
158 | 158 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
159 | 159 | |
160 | 160 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
161 | - unset( $previous_pages['api'] ); |
|
162 | - unset( $previous_pages['system_info'] ); |
|
161 | + unset($previous_pages['api']); |
|
162 | + unset($previous_pages['system_info']); |
|
163 | 163 | |
164 | 164 | // Tab is not register. |
165 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) ); |
|
165 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids)); |
|
166 | 166 | |
167 | 167 | // Merge old settings with new settings. |
168 | - $pages = array_merge( $page_ids, $previous_pages ); |
|
168 | + $pages = array_merge($page_ids, $previous_pages); |
|
169 | 169 | |
170 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
170 | + if (in_array($this->current_tab, $pages_diff)) { |
|
171 | 171 | // Filter & actions. |
172 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
172 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return $pages; |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return string |
186 | 186 | */ |
187 | - function get_section_name( $field_name ) { |
|
187 | + function get_section_name($field_name) { |
|
188 | 188 | // Bailout. |
189 | - if ( empty( $field_name ) ) { |
|
189 | + if (empty($field_name)) { |
|
190 | 190 | return $field_name; |
191 | 191 | } |
192 | 192 | |
193 | - $section_name = explode( ' ', $field_name ); |
|
193 | + $section_name = explode(' ', $field_name); |
|
194 | 194 | // unset( $section_name[ count( $section_name ) - 1 ] ); |
195 | 195 | |
196 | 196 | // Output. |
197 | - return strip_tags( implode( ' ', $section_name ) ); |
|
197 | + return strip_tags(implode(' ', $section_name)); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -207,39 +207,39 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - function get_filtered_addon_sections( $sections = array() ) { |
|
210 | + function get_filtered_addon_sections($sections = array()) { |
|
211 | 211 | // New sections. |
212 | 212 | $new_sections = array(); |
213 | - $sections_ID = array_keys( $sections ); |
|
213 | + $sections_ID = array_keys($sections); |
|
214 | 214 | |
215 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
215 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
216 | 216 | |
217 | - foreach ( $setting_fields['fields'] as $field ) { |
|
217 | + foreach ($setting_fields['fields'] as $field) { |
|
218 | 218 | // Section name. |
219 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : ''; |
|
220 | - $section_name = $this->get_section_name( $field['name'] ); |
|
219 | + $field['name'] = isset($field['name']) ? $field['name'] : ''; |
|
220 | + $section_name = $this->get_section_name($field['name']); |
|
221 | 221 | |
222 | 222 | // Check if section name exit and section title array is not empty. |
223 | - if ( ! empty( $sections ) && ! empty( $field['name'] ) ) { |
|
223 | + if ( ! empty($sections) && ! empty($field['name'])) { |
|
224 | 224 | |
225 | 225 | // Bailout: Do not load section if it is already exist. |
226 | 226 | if ( |
227 | - in_array( sanitize_title( $field['name'] ), $sections_ID ) // Check section id. |
|
228 | - || in_array( $section_name, $sections ) // Check section name. |
|
227 | + in_array(sanitize_title($field['name']), $sections_ID) // Check section id. |
|
228 | + || in_array($section_name, $sections) // Check section name. |
|
229 | 229 | ) { |
230 | 230 | continue; |
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | 234 | // Collect new sections from addons. |
235 | - if ( 'give_title' == $field['type'] ) { |
|
236 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name; |
|
235 | + if ('give_title' == $field['type']) { |
|
236 | + $new_sections[sanitize_title($field['name'])] = $section_name; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
241 | 241 | // Add new section. |
242 | - $sections = array_merge( $sections, $new_sections ); |
|
242 | + $sections = array_merge($sections, $new_sections); |
|
243 | 243 | |
244 | 244 | // Output. |
245 | 245 | return $sections; |
@@ -256,19 +256,19 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return array |
258 | 258 | */ |
259 | - function get_filtered_addon_settings( $settings, $setting_fields = array() ) { |
|
259 | + function get_filtered_addon_settings($settings, $setting_fields = array()) { |
|
260 | 260 | global $wp_filter; |
261 | 261 | |
262 | 262 | $new_setting_fields = array(); |
263 | 263 | |
264 | - if ( ! empty( $settings ) ) { |
|
264 | + if ( ! empty($settings)) { |
|
265 | 265 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ). |
266 | - if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { |
|
267 | - foreach ( $settings as $setting ) { |
|
266 | + if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { |
|
267 | + foreach ($settings as $setting) { |
|
268 | 268 | $new_setting_fields[] = $setting; |
269 | 269 | |
270 | 270 | // We need setting only till first section end. |
271 | - if ( 'sectionend' === $setting['type'] ) { |
|
271 | + if ('sectionend' === $setting['type']) { |
|
272 | 272 | break; |
273 | 273 | } |
274 | 274 | } |
@@ -280,18 +280,18 @@ discard block |
||
280 | 280 | $prev_title_field_id = ''; |
281 | 281 | |
282 | 282 | // Create new setting fields. |
283 | - foreach ( $settings as $index => $field ) { |
|
283 | + foreach ($settings as $index => $field) { |
|
284 | 284 | |
285 | 285 | // Bailout: Must need field type to process. |
286 | - if ( ! isset( $field['type'] ) ) { |
|
286 | + if ( ! isset($field['type'])) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name']; |
|
291 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc']; |
|
290 | + $field['name'] = ! isset($field['name']) ? '' : $field['name']; |
|
291 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc']; |
|
292 | 292 | |
293 | 293 | // Modify cmb2 setting fields. |
294 | - switch ( $field['type'] ) { |
|
294 | + switch ($field['type']) { |
|
295 | 295 | case 'text' : |
296 | 296 | case 'file' : |
297 | 297 | $field['css'] = 'width:25em;'; |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | break; |
317 | 317 | } |
318 | 318 | |
319 | - if ( 'title' === $field['type'] ) { |
|
319 | + if ('title' === $field['type']) { |
|
320 | 320 | |
321 | 321 | // If we do not have first element as title then these field will be skip from frontend |
322 | 322 | // because there are not belong to any section, so put all abandon fields under first section. |
323 | - if ( $index && empty( $prev_title_field_id ) ) { |
|
323 | + if ($index && empty($prev_title_field_id)) { |
|
324 | 324 | array_unshift( |
325 | 325 | $new_setting_fields, |
326 | 326 | array( |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $prev_title_field_id = $field['id']; |
335 | 335 | |
336 | 336 | continue; |
337 | - } elseif ( $index ) { |
|
337 | + } elseif ($index) { |
|
338 | 338 | // Section end. |
339 | 339 | $new_setting_fields[] = array( |
340 | 340 | 'type' => 'sectionend', |
@@ -366,47 +366,47 @@ discard block |
||
366 | 366 | |
367 | 367 | // Check if setting page has title section or not. |
368 | 368 | // If setting page does not have title section then add title section to it and fix section end array id. |
369 | - if ( 'title' !== $new_setting_fields[0]['type'] ) { |
|
369 | + if ('title' !== $new_setting_fields[0]['type']) { |
|
370 | 370 | array_unshift( |
371 | 371 | $new_setting_fields, |
372 | 372 | array( |
373 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ), |
|
373 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''), |
|
374 | 374 | 'type' => 'title', |
375 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '', |
|
376 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ) |
|
375 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '', |
|
376 | + 'id' => (isset($settings['id']) ? $settings['id'] : '') |
|
377 | 377 | ) |
378 | 378 | ); |
379 | 379 | |
380 | 380 | // Update id in section end array if does not contain. |
381 | - if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { |
|
382 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' ); |
|
381 | + if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { |
|
382 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : ''); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | 386 | // Return only section related settings. |
387 | - if ( $sections = $this->get_filtered_addon_sections() ) { |
|
388 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields ); |
|
387 | + if ($sections = $this->get_filtered_addon_sections()) { |
|
388 | + $new_setting_fields = $this->get_section_settings($new_setting_fields); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | // Third party plugin backward compatibility. |
392 | - foreach ( $new_setting_fields as $index => $field ) { |
|
392 | + foreach ($new_setting_fields as $index => $field) { |
|
393 | 393 | |
394 | - if ( in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { |
|
394 | + if (in_array($field['type'], array('title', 'sectionend'))) { |
|
395 | 395 | continue; |
396 | 396 | } |
397 | 397 | |
398 | 398 | $cmb2_filter_name = "cmb2_render_{$field['type']}"; |
399 | 399 | |
400 | - if ( ! empty( $wp_filter[ $cmb2_filter_name ] ) ) { |
|
401 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] ); |
|
400 | + if ( ! empty($wp_filter[$cmb2_filter_name])) { |
|
401 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]); |
|
402 | 402 | |
403 | - if ( ! empty( $cmb2_filter_arr ) ) { |
|
403 | + if ( ! empty($cmb2_filter_arr)) { |
|
404 | 404 | // Note: function can be called either globally or with class object, it depends on how developer invoke it. |
405 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr ); |
|
406 | - add_action( "give_admin_field_{$field['type']}", array( |
|
405 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr); |
|
406 | + add_action("give_admin_field_{$field['type']}", array( |
|
407 | 407 | $this, |
408 | 408 | 'addon_setting_field' |
409 | - ), 10, 2 ); |
|
409 | + ), 10, 2); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -427,31 +427,31 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @return array |
429 | 429 | */ |
430 | - function get_section_settings( $tab_settings ) { |
|
430 | + function get_section_settings($tab_settings) { |
|
431 | 431 | $current_section = give_get_current_setting_section(); |
432 | 432 | |
433 | 433 | // Note: If we are opening default tabe for addon setting then it is possible that we will get empty string as current section |
434 | 434 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section |
435 | 435 | // This is hack to fix this. |
436 | - if ( empty( $current_section ) ) { |
|
437 | - $current_section = $this->set_default_setting_tab( $current_section ); |
|
436 | + if (empty($current_section)) { |
|
437 | + $current_section = $this->set_default_setting_tab($current_section); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | $section_start = false; |
441 | 441 | $section_end = false; |
442 | 442 | $section_only_setting_fields = array(); |
443 | 443 | |
444 | - foreach ( $tab_settings as $field ) { |
|
445 | - if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { |
|
444 | + foreach ($tab_settings as $field) { |
|
445 | + if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { |
|
446 | 446 | $section_start = true; |
447 | 447 | } |
448 | 448 | |
449 | - if ( ! $section_start || $section_end ) { |
|
449 | + if ( ! $section_start || $section_end) { |
|
450 | 450 | continue; |
451 | 451 | } |
452 | 452 | |
453 | - if ( $section_start && ! $section_end ) { |
|
454 | - if ( 'sectionend' == $field['type'] ) { |
|
453 | + if ($section_start && ! $section_end) { |
|
454 | + if ('sectionend' == $field['type']) { |
|
455 | 455 | $section_end = true; |
456 | 456 | } |
457 | 457 | $section_only_setting_fields[] = $field; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | // Remove title from setting, pevent it from render in setting tab. |
462 | 462 | $section_only_setting_fields[0]['title'] = ''; |
463 | 463 | |
464 | - return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); |
|
464 | + return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -475,17 +475,17 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return void |
477 | 477 | */ |
478 | - function addon_setting_field( $field, $saved_value ) { |
|
478 | + function addon_setting_field($field, $saved_value) { |
|
479 | 479 | // Create object for cmb2 function callback backward compatibility. |
480 | 480 | // Note: Do not call any cmb2 function on these objects |
481 | - $field_obj = (object) array( 'args' => $field ); |
|
482 | - $field_type_obj = (object) array( 'field' => $field_obj ); |
|
481 | + $field_obj = (object) array('args' => $field); |
|
482 | + $field_type_obj = (object) array('field' => $field_obj); |
|
483 | 483 | |
484 | - switch ( $this->current_tab ) : |
|
484 | + switch ($this->current_tab) : |
|
485 | 485 | case 'licenses': |
486 | 486 | ?> |
487 | 487 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>"> |
488 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?> |
|
488 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?> |
|
489 | 489 | </div> |
490 | 490 | <? break; |
491 | 491 | |
@@ -493,19 +493,19 @@ discard block |
||
493 | 493 | $colspan = "colspan=\"2\""; |
494 | 494 | ?> |
495 | 495 | <tr valign="top"> |
496 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?> |
|
496 | + <?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> |
|
497 | 497 | <th scope="row" class="titledesc"> |
498 | 498 | <label |
499 | - for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label> |
|
499 | + for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label> |
|
500 | 500 | </th> |
501 | 501 | <?php $colspan = ''; ?> |
502 | 502 | <?php endif; ?> |
503 | 503 | <td class="give-forminp" <?php echo $colspan; ?>> |
504 | 504 | <?php |
505 | - if ( is_array( $field['func']['function'] ) ) { |
|
506 | - $field['func']['function'][0]->$field['func']['function'][1]( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
505 | + if (is_array($field['func']['function'])) { |
|
506 | + $field['func']['function'][0]->$field['func']['function'][1]($field_obj, $saved_value, '', '', $field_type_obj); |
|
507 | 507 | } else { |
508 | - $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
508 | + $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); |
|
509 | 509 | } |
510 | 510 | ?> |
511 | 511 | </td> |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | public function get_sections() { |
524 | 524 | $sections = array(); |
525 | 525 | |
526 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
527 | - foreach ( $setting_fields['fields'] as $field ) { |
|
528 | - if ( 'give_title' == $field['type'] ) { |
|
529 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] ); |
|
526 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
527 | + foreach ($setting_fields['fields'] as $field) { |
|
528 | + if ('give_title' == $field['type']) { |
|
529 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']); |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -546,16 +546,16 @@ discard block |
||
546 | 546 | |
547 | 547 | $new_setting_fields = array(); |
548 | 548 | |
549 | - if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { |
|
550 | - if ( isset( $setting_fields['fields'] ) ) { |
|
549 | + if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { |
|
550 | + if (isset($setting_fields['fields'])) { |
|
551 | 551 | |
552 | 552 | $tab_data = array( |
553 | 553 | 'id' => $setting_fields['id'], |
554 | 554 | 'give_title' => $setting_fields['give_title'], |
555 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ) |
|
555 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : '') |
|
556 | 556 | ); |
557 | 557 | |
558 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data ); |
|
558 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
@@ -571,16 +571,16 @@ discard block |
||
571 | 571 | public function output_sections() { |
572 | 572 | $sections = $this->get_sections(); |
573 | 573 | |
574 | - if ( empty( $sections ) || 1 === sizeof( $sections ) ) { |
|
574 | + if (empty($sections) || 1 === sizeof($sections)) { |
|
575 | 575 | return; |
576 | 576 | } |
577 | 577 | |
578 | 578 | echo '<ul class="subsubsub">'; |
579 | 579 | |
580 | - $array_keys = array_keys( $sections ); |
|
580 | + $array_keys = array_keys($sections); |
|
581 | 581 | |
582 | - foreach ( $sections as $id => $label ) { |
|
583 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
582 | + foreach ($sections as $id => $label) { |
|
583 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | echo '</ul><br class="clear" />'; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | public function output() { |
596 | 596 | $settings = $this->get_settings(); |
597 | 597 | |
598 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
598 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | public function save() { |
608 | 608 | $settings = $this->get_settings(); |
609 | 609 | |
610 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
610 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | endif; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param array $args An array of form arguments. |
23 | 23 | * |
24 | - * @return string Donation form. |
|
24 | + * @return false|null Donation form. |
|
25 | 25 | */ |
26 | 26 | function give_get_donation_form( $args = array() ) { |
27 | 27 | |
@@ -1391,7 +1391,7 @@ discard block |
||
1391 | 1391 | * |
1392 | 1392 | * @param int $form_id The form ID. |
1393 | 1393 | * |
1394 | - * @return void|bool |
|
1394 | + * @return false|null |
|
1395 | 1395 | */ |
1396 | 1396 | function give_terms_agreement( $form_id ) { |
1397 | 1397 | $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
@@ -1589,7 +1589,7 @@ discard block |
||
1589 | 1589 | * @param int $form_id The form ID. |
1590 | 1590 | * @param array $args An array of form arguments. |
1591 | 1591 | * |
1592 | - * @return mixed |
|
1592 | + * @return boolean |
|
1593 | 1593 | */ |
1594 | 1594 | function give_show_goal_progress( $form_id, $args ) { |
1595 | 1595 | |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | * Get form content position. |
1609 | 1609 | * |
1610 | 1610 | * @since 1.8 |
1611 | - * @param $form_id |
|
1611 | + * @param integer $form_id |
|
1612 | 1612 | * @param $args |
1613 | 1613 | * @return mixed|string |
1614 | 1614 | */ |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | * @param int $form_id The form ID. |
1633 | 1633 | * @param array $args An array of form arguments. |
1634 | 1634 | * |
1635 | - * @return void|bool |
|
1635 | + * @return false|null |
|
1636 | 1636 | */ |
1637 | 1637 | function give_form_content( $form_id, $args ) { |
1638 | 1638 |
@@ -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,47 +23,47 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id, |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID. |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | 55 | ); |
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | 62 | //Get the form wrap CSS classes. |
63 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
64 | 64 | |
65 | 65 | //Get the <form> tag wrap CSS classes. |
66 | - $form_classes = $form->get_form_classes( $args ); |
|
66 | + $form_classes = $form->get_form_classes($args); |
|
67 | 67 | |
68 | 68 | ob_start(); |
69 | 69 | |
@@ -75,25 +75,25 @@ discard block |
||
75 | 75 | * @param int $form_id The form ID. |
76 | 76 | * @param array $args An array of form arguments. |
77 | 77 | */ |
78 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
78 | + do_action('give_pre_form_output', $form->ID, $args); |
|
79 | 79 | |
80 | 80 | ?> |
81 | 81 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
82 | 82 | |
83 | - <?php if ( $form->is_close_donation_form() ) { |
|
83 | + <?php if ($form->is_close_donation_form()) { |
|
84 | 84 | |
85 | 85 | //Get Goal thank you message. |
86 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
87 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
86 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
87 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
88 | 88 | |
89 | 89 | //Print thank you message. |
90 | - echo apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, false, 'success' ), $form->ID ); |
|
90 | + echo apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, false, 'success'), $form->ID); |
|
91 | 91 | |
92 | 92 | } else { |
93 | 93 | |
94 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
94 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
95 | 95 | |
96 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
96 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | * @param int $form_id The form ID. |
106 | 106 | * @param array $args An array of form arguments. |
107 | 107 | */ |
108 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
108 | + do_action('give_pre_form', $form->ID, $args); |
|
109 | 109 | ?> |
110 | 110 | |
111 | 111 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
112 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
112 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
113 | 113 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
114 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
114 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
115 | 115 | <input type="hidden" name="give-current-url" |
116 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
116 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
117 | 117 | <input type="hidden" name="give-form-url" |
118 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
118 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
119 | 119 | <input type="hidden" name="give-form-minimum" |
120 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
120 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
121 | 121 | |
122 | 122 | <!-- The following field is for robots only, invisible to humans: --> |
123 | 123 | <span class="give-hidden" style="display: none !important;"> |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | <?php |
130 | 130 | |
131 | 131 | //Price ID hidden field for variable (mult-level) donation forms. |
132 | - if ( give_has_variable_prices( $form_id ) ) { |
|
132 | + if (give_has_variable_prices($form_id)) { |
|
133 | 133 | //get default selected price ID. |
134 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
134 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
135 | 135 | $price_id = 0; |
136 | 136 | //loop through prices. |
137 | - foreach ( $prices as $price ) { |
|
138 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
137 | + foreach ($prices as $price) { |
|
138 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
139 | 139 | $price_id = $price['_give_id']['level_id']; |
140 | 140 | }; |
141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param int $form_id The form ID. |
152 | 152 | * @param array $args An array of form arguments. |
153 | 153 | */ |
154 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
154 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Fires while outputing donation form, for payment gatways fields. |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param int $form_id The form ID. |
162 | 162 | * @param array $args An array of form arguments. |
163 | 163 | */ |
164 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
164 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
165 | 165 | |
166 | 166 | /** |
167 | 167 | * Fires while outputing donation form, after all other fields. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param int $form_id The form ID. |
172 | 172 | * @param array $args An array of form arguments. |
173 | 173 | */ |
174 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
174 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
175 | 175 | |
176 | 176 | ?> |
177 | 177 | </form> |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | * @param int $form_id The form ID. |
186 | 186 | * @param array $args An array of form arguments. |
187 | 187 | */ |
188 | - do_action( 'give_post_form', $form->ID, $args ); |
|
188 | + do_action('give_post_form', $form->ID, $args); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | |
193 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
193 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
194 | 194 | <?php |
195 | 195 | |
196 | 196 | /** |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * @param int $form_id The form ID. |
202 | 202 | * @param array $args An array of form arguments. |
203 | 203 | */ |
204 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
204 | + do_action('give_post_form_output', $form->ID, $args); |
|
205 | 205 | |
206 | 206 | $final_output = ob_get_clean(); |
207 | 207 | |
208 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
208 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return string |
224 | 224 | */ |
225 | -function give_show_purchase_form( $form_id ) { |
|
225 | +function give_show_purchase_form($form_id) { |
|
226 | 226 | |
227 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
227 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
228 | 228 | |
229 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
229 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
230 | 230 | $form_id = $_POST['give_form_id']; |
231 | 231 | } |
232 | 232 | |
@@ -235,33 +235,33 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @since 1.7 |
237 | 237 | */ |
238 | - do_action( 'give_donation_form_top', $form_id ); |
|
238 | + do_action('give_donation_form_top', $form_id); |
|
239 | 239 | |
240 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
240 | + if (give_can_checkout() && isset($form_id)) { |
|
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Fires while displaying donation form, before registration login. |
244 | 244 | * |
245 | 245 | * @since 1.7 |
246 | 246 | */ |
247 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
247 | + do_action('give_donation_form_before_register_login', $form_id); |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * Fire when register/login form fields render. |
251 | 251 | * |
252 | 252 | * @since 1.7 |
253 | 253 | */ |
254 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
254 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Fire when credit card form fields render. |
258 | 258 | * |
259 | 259 | * @since 1.7 |
260 | 260 | */ |
261 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
261 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
262 | 262 | |
263 | 263 | // Load the credit card form and allow gateways to load their own if they wish. |
264 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
264 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
265 | 265 | /** |
266 | 266 | * Fires while displaying donation form, credit card form fields for a given gateway. |
267 | 267 | * |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @param int $form_id The form ID. |
271 | 271 | */ |
272 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
272 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
273 | 273 | } else { |
274 | 274 | /** |
275 | 275 | * Fires while displaying donation form, credit card form fields. |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param int $form_id The form ID. |
280 | 280 | */ |
281 | - do_action( 'give_cc_form', $form_id ); |
|
281 | + do_action('give_cc_form', $form_id); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @since 1.7 |
288 | 288 | */ |
289 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
289 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
290 | 290 | |
291 | 291 | } else { |
292 | 292 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @since 1.7 |
296 | 296 | */ |
297 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
297 | + do_action('give_donation_form_no_access', $form_id); |
|
298 | 298 | |
299 | 299 | } |
300 | 300 | |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @since 1.7 |
305 | 305 | */ |
306 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
306 | + do_action('give_donation_form_bottom', $form_id); |
|
307 | 307 | } |
308 | 308 | |
309 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
309 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Give Show Login/Register Form Fields. |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return void |
319 | 319 | */ |
320 | -function give_show_register_login_fields( $form_id ) { |
|
320 | +function give_show_register_login_fields($form_id) { |
|
321 | 321 | |
322 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
322 | + $show_register_form = give_show_login_register_option($form_id); |
|
323 | 323 | |
324 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
324 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
325 | 325 | ?> |
326 | 326 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
327 | 327 | <?php |
@@ -330,11 +330,11 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @since 1.7 |
332 | 332 | */ |
333 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
333 | + do_action('give_donation_form_register_fields', $form_id); |
|
334 | 334 | ?> |
335 | 335 | </div> |
336 | 336 | <?php |
337 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
337 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
338 | 338 | ?> |
339 | 339 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
340 | 340 | <?php |
@@ -343,23 +343,23 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @since 1.7 |
345 | 345 | */ |
346 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
346 | + do_action('give_donation_form_login_fields', $form_id); |
|
347 | 347 | ?> |
348 | 348 | </div> |
349 | 349 | <?php |
350 | 350 | endif; |
351 | 351 | |
352 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
352 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
353 | 353 | /** |
354 | 354 | * Fire when user info render. |
355 | 355 | * |
356 | 356 | * @since 1.7 |
357 | 357 | */ |
358 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
358 | + do_action('give_donation_form_after_user_info', $form_id); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
362 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
363 | 363 | |
364 | 364 | /** |
365 | 365 | * Donation Amount Field. |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return void |
375 | 375 | */ |
376 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
376 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
377 | 377 | |
378 | 378 | $give_options = give_get_settings(); |
379 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
380 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
381 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
382 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
383 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
384 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
385 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
379 | + $variable_pricing = give_has_variable_prices($form_id); |
|
380 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
381 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
382 | + $symbol = give_currency_symbol(give_get_currency()); |
|
383 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
384 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
385 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Fires while displaying donation form, before donation level fields. |
@@ -392,20 +392,20 @@ discard block |
||
392 | 392 | * @param int $form_id The form ID. |
393 | 393 | * @param array $args An array of form arguments. |
394 | 394 | */ |
395 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
395 | + do_action('give_before_donation_levels', $form_id, $args); |
|
396 | 396 | |
397 | 397 | //Set Price, No Custom Amount Allowed means hidden price field |
398 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
398 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
399 | 399 | ?> |
400 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
400 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
401 | 401 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
402 | 402 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
403 | 403 | <div class="set-price give-donation-amount form-row-wide"> |
404 | - <?php if ( $currency_position == 'before' ) { |
|
404 | + <?php if ($currency_position == 'before') { |
|
405 | 405 | echo $currency_output; |
406 | 406 | } ?> |
407 | 407 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
408 | - <?php if ( $currency_position == 'after' ) { |
|
408 | + <?php if ($currency_position == 'after') { |
|
409 | 409 | echo $currency_output; |
410 | 410 | } ?> |
411 | 411 | </div> |
@@ -415,13 +415,13 @@ discard block |
||
415 | 415 | ?> |
416 | 416 | <div class="give-total-wrap"> |
417 | 417 | <div class="give-donation-amount form-row-wide"> |
418 | - <?php if ( $currency_position == 'before' ) { |
|
418 | + <?php if ($currency_position == 'before') { |
|
419 | 419 | echo $currency_output; |
420 | 420 | } ?> |
421 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
421 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
422 | 422 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
423 | 423 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
424 | - <?php if ( $currency_position == 'after' ) { |
|
424 | + <?php if ($currency_position == 'after') { |
|
425 | 425 | echo $currency_output; |
426 | 426 | } ?> |
427 | 427 | </div> |
@@ -436,16 +436,16 @@ discard block |
||
436 | 436 | * @param int $form_id The form ID. |
437 | 437 | * @param array $args An array of form arguments. |
438 | 438 | */ |
439 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
439 | + do_action('give_after_donation_amount', $form_id, $args); |
|
440 | 440 | |
441 | 441 | //Custom Amount Text |
442 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
442 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
443 | 443 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
444 | 444 | <?php } |
445 | 445 | |
446 | 446 | //Output Variable Pricing Levels. |
447 | - if ( $variable_pricing ) { |
|
448 | - give_output_levels( $form_id ); |
|
447 | + if ($variable_pricing) { |
|
448 | + give_output_levels($form_id); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | * @param int $form_id The form ID. |
457 | 457 | * @param array $args An array of form arguments. |
458 | 458 | */ |
459 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
459 | + do_action('give_after_donation_levels', $form_id, $args); |
|
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
462 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -470,32 +470,32 @@ discard block |
||
470 | 470 | * |
471 | 471 | * @return string Donation levels. |
472 | 472 | */ |
473 | -function give_output_levels( $form_id ) { |
|
473 | +function give_output_levels($form_id) { |
|
474 | 474 | |
475 | 475 | //Get variable pricing. |
476 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
477 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
478 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
479 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
480 | - if ( empty( $custom_amount_text ) ) { |
|
481 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
476 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
477 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
478 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
479 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
480 | + if (empty($custom_amount_text)) { |
|
481 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | $output = ''; |
485 | 485 | $counter = 0; |
486 | 486 | |
487 | - switch ( $display_style ) { |
|
487 | + switch ($display_style) { |
|
488 | 488 | case 'buttons': |
489 | 489 | |
490 | 490 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
491 | 491 | |
492 | - foreach ( $prices as $price ) { |
|
493 | - $counter ++; |
|
494 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
495 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
492 | + foreach ($prices as $price) { |
|
493 | + $counter++; |
|
494 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
495 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
496 | 496 | |
497 | 497 | $output .= '<li>'; |
498 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
498 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
499 | 499 | $output .= $level_text; |
500 | 500 | $output .= '</button>'; |
501 | 501 | $output .= '</li>'; |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | } |
504 | 504 | |
505 | 505 | //Custom Amount. |
506 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
506 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
507 | 507 | $output .= '<li>'; |
508 | 508 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
509 | 509 | $output .= $custom_amount_text; |
@@ -519,23 +519,23 @@ discard block |
||
519 | 519 | |
520 | 520 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
521 | 521 | |
522 | - foreach ( $prices as $price ) { |
|
523 | - $counter ++; |
|
524 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
525 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
522 | + foreach ($prices as $price) { |
|
523 | + $counter++; |
|
524 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
525 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
526 | 526 | |
527 | 527 | $output .= '<li>'; |
528 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
529 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
528 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
529 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
530 | 530 | $output .= '</li>'; |
531 | 531 | |
532 | 532 | } |
533 | 533 | |
534 | 534 | //Custom Amount |
535 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
535 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
536 | 536 | $output .= '<li>'; |
537 | 537 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
538 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
538 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
539 | 539 | $output .= '</li>'; |
540 | 540 | } |
541 | 541 | |
@@ -545,23 +545,23 @@ discard block |
||
545 | 545 | |
546 | 546 | case 'dropdown': |
547 | 547 | |
548 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
549 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
548 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
549 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
550 | 550 | |
551 | 551 | //first loop through prices. |
552 | - foreach ( $prices as $price ) { |
|
553 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
554 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
552 | + foreach ($prices as $price) { |
|
553 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
554 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
555 | 555 | |
556 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
556 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
557 | 557 | $output .= $level_text; |
558 | 558 | $output .= '</option>'; |
559 | 559 | |
560 | 560 | } |
561 | 561 | |
562 | 562 | //Custom Amount. |
563 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
564 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
563 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
564 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | $output .= '</select>'; |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | break; |
570 | 570 | } |
571 | 571 | |
572 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
572 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | /** |
@@ -584,28 +584,28 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @return string Checkout button. |
586 | 586 | */ |
587 | -function give_display_checkout_button( $form_id, $args ) { |
|
587 | +function give_display_checkout_button($form_id, $args) { |
|
588 | 588 | |
589 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
589 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
590 | 590 | ? $args['display_style'] |
591 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
591 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
592 | 592 | |
593 | - if( 'button' === $display_option ) { |
|
593 | + if ('button' === $display_option) { |
|
594 | 594 | $display_option = 'modal'; |
595 | - }elseif ( $display_option === 'onpage' ) { |
|
595 | + }elseif ($display_option === 'onpage') { |
|
596 | 596 | return ''; |
597 | 597 | } |
598 | 598 | |
599 | 599 | |
600 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
601 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
600 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
601 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
602 | 602 | |
603 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
603 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
604 | 604 | |
605 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
605 | + echo apply_filters('give_display_checkout_button', $output); |
|
606 | 606 | } |
607 | 607 | |
608 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
608 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
609 | 609 | |
610 | 610 | /** |
611 | 611 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -616,57 +616,57 @@ discard block |
||
616 | 616 | * |
617 | 617 | * @return void |
618 | 618 | */ |
619 | -function give_user_info_fields( $form_id ) { |
|
619 | +function give_user_info_fields($form_id) { |
|
620 | 620 | // Get user info. |
621 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
621 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
622 | 622 | |
623 | 623 | /** |
624 | 624 | * Fire before user personal information fields |
625 | 625 | * |
626 | 626 | * @since 1.7 |
627 | 627 | */ |
628 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
628 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
629 | 629 | ?> |
630 | 630 | <fieldset id="give_checkout_user_info"> |
631 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
631 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
632 | 632 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
633 | 633 | <label class="give-label" for="give-first"> |
634 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
635 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
634 | + <?php esc_html_e('First Name', 'give'); ?> |
|
635 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
636 | 636 | <span class="give-required-indicator">*</span> |
637 | 637 | <?php endif ?> |
638 | 638 | <span class="give-tooltip give-icon give-icon-question" |
639 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
639 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
640 | 640 | </label> |
641 | 641 | <input |
642 | 642 | class="give-input required" |
643 | 643 | type="text" |
644 | 644 | name="give_first" |
645 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
645 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
646 | 646 | id="give-first" |
647 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
648 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
647 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
648 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
649 | 649 | /> |
650 | 650 | </p> |
651 | 651 | |
652 | 652 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
653 | 653 | <label class="give-label" for="give-last"> |
654 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
655 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
654 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
655 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
656 | 656 | <span class="give-required-indicator">*</span> |
657 | 657 | <?php endif ?> |
658 | 658 | <span class="give-tooltip give-icon give-icon-question" |
659 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
659 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
660 | 660 | </label> |
661 | 661 | |
662 | 662 | <input |
663 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
663 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
664 | 664 | type="text" |
665 | 665 | name="give_last" |
666 | 666 | id="give-last" |
667 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
668 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
669 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
667 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
668 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
669 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
670 | 670 | /> |
671 | 671 | </p> |
672 | 672 | |
@@ -676,26 +676,26 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @since 1.7 |
678 | 678 | */ |
679 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
679 | + do_action('give_donation_form_before_email', $form_id); |
|
680 | 680 | ?> |
681 | 681 | <p id="give-email-wrap" class="form-row form-row-wide"> |
682 | 682 | <label class="give-label" for="give-email"> |
683 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
684 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
683 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
684 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
685 | 685 | <span class="give-required-indicator">*</span> |
686 | 686 | <?php } ?> |
687 | 687 | <span class="give-tooltip give-icon give-icon-question" |
688 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
688 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
689 | 689 | </label> |
690 | 690 | |
691 | 691 | <input |
692 | 692 | class="give-input required" |
693 | 693 | type="email" |
694 | 694 | name="give_email" |
695 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
695 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
696 | 696 | id="give-email" |
697 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
698 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
697 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
698 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
699 | 699 | /> |
700 | 700 | |
701 | 701 | </p> |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | * |
706 | 706 | * @since 1.7 |
707 | 707 | */ |
708 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
708 | + do_action('give_donation_form_after_email', $form_id); |
|
709 | 709 | |
710 | 710 | /** |
711 | 711 | * Fire after personal email field |
712 | 712 | * |
713 | 713 | * @since 1.7 |
714 | 714 | */ |
715 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
715 | + do_action('give_donation_form_user_info', $form_id); |
|
716 | 716 | ?> |
717 | 717 | </fieldset> |
718 | 718 | <?php |
@@ -721,11 +721,11 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @since 1.7 |
723 | 723 | */ |
724 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
724 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
725 | 725 | } |
726 | 726 | |
727 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
728 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
727 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
728 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
729 | 729 | |
730 | 730 | /** |
731 | 731 | * Renders the credit card info form. |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return void |
738 | 738 | */ |
739 | -function give_get_cc_form( $form_id ) { |
|
739 | +function give_get_cc_form($form_id) { |
|
740 | 740 | |
741 | 741 | ob_start(); |
742 | 742 | |
@@ -747,53 +747,53 @@ discard block |
||
747 | 747 | * |
748 | 748 | * @param int $form_id The form ID. |
749 | 749 | */ |
750 | - do_action( 'give_before_cc_fields', $form_id ); |
|
750 | + do_action('give_before_cc_fields', $form_id); |
|
751 | 751 | ?> |
752 | 752 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
753 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
754 | - <?php if ( is_ssl() ) : ?> |
|
753 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
754 | + <?php if (is_ssl()) : ?> |
|
755 | 755 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
756 | 756 | <span class="give-icon padlock"></span> |
757 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
757 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
758 | 758 | </div> |
759 | 759 | <?php endif; ?> |
760 | 760 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
761 | 761 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
762 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
762 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
763 | 763 | <span class="give-required-indicator">*</span> |
764 | 764 | <span class="give-tooltip give-icon give-icon-question" |
765 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
765 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
766 | 766 | <span class="card-type"></span> |
767 | 767 | </label> |
768 | 768 | |
769 | 769 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
770 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
770 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
771 | 771 | required aria-required="true"/> |
772 | 772 | </p> |
773 | 773 | |
774 | 774 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
775 | 775 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
776 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
776 | + <?php esc_html_e('CVC', 'give'); ?> |
|
777 | 777 | <span class="give-required-indicator">*</span> |
778 | 778 | <span class="give-tooltip give-icon give-icon-question" |
779 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
779 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
780 | 780 | </label> |
781 | 781 | |
782 | 782 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
783 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
783 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
784 | 784 | required aria-required="true"/> |
785 | 785 | </p> |
786 | 786 | |
787 | 787 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
788 | 788 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
789 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
789 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
790 | 790 | <span class="give-required-indicator">*</span> |
791 | 791 | <span class="give-tooltip give-icon give-icon-question" |
792 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
792 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
793 | 793 | </label> |
794 | 794 | |
795 | 795 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
796 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
796 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
797 | 797 | required aria-required="true"/> |
798 | 798 | </p> |
799 | 799 | <?php |
@@ -804,14 +804,14 @@ discard block |
||
804 | 804 | * |
805 | 805 | * @param int $form_id The form ID. |
806 | 806 | */ |
807 | - do_action( 'give_before_cc_expiration' ); |
|
807 | + do_action('give_before_cc_expiration'); |
|
808 | 808 | ?> |
809 | 809 | <p class="card-expiration form-row form-row-one-third"> |
810 | 810 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
811 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
811 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
812 | 812 | <span class="give-required-indicator">*</span> |
813 | 813 | <span class="give-tooltip give-icon give-icon-question" |
814 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
814 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
815 | 815 | </label> |
816 | 816 | |
817 | 817 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | class="card-expiry-year"/> |
821 | 821 | |
822 | 822 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
823 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
823 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
824 | 824 | required aria-required="true"/> |
825 | 825 | </p> |
826 | 826 | <?php |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | * |
832 | 832 | * @param int $form_id The form ID. |
833 | 833 | */ |
834 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
834 | + do_action('give_after_cc_expiration', $form_id); |
|
835 | 835 | ?> |
836 | 836 | </fieldset> |
837 | 837 | <?php |
@@ -842,12 +842,12 @@ discard block |
||
842 | 842 | * |
843 | 843 | * @param int $form_id The form ID. |
844 | 844 | */ |
845 | - do_action( 'give_after_cc_fields', $form_id ); |
|
845 | + do_action('give_after_cc_fields', $form_id); |
|
846 | 846 | |
847 | 847 | echo ob_get_clean(); |
848 | 848 | } |
849 | 849 | |
850 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
850 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
851 | 851 | |
852 | 852 | /** |
853 | 853 | * Outputs the default credit card address fields. |
@@ -858,24 +858,24 @@ discard block |
||
858 | 858 | * |
859 | 859 | * @return void |
860 | 860 | */ |
861 | -function give_default_cc_address_fields( $form_id ) { |
|
861 | +function give_default_cc_address_fields($form_id) { |
|
862 | 862 | // Get user info. |
863 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
863 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
864 | 864 | |
865 | 865 | $logged_in = is_user_logged_in(); |
866 | 866 | |
867 | - if ( $logged_in ) { |
|
868 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
867 | + if ($logged_in) { |
|
868 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
869 | 869 | } |
870 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
871 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
872 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
873 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
870 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
871 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
872 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
873 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
874 | 874 | |
875 | 875 | ob_start(); |
876 | 876 | ?> |
877 | 877 | <fieldset id="give_cc_address" class="cc-address"> |
878 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
878 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
879 | 879 | <?php |
880 | 880 | /** |
881 | 881 | * Fires while rendering credit card billing form, before address fields. |
@@ -884,79 +884,79 @@ discard block |
||
884 | 884 | * |
885 | 885 | * @param int $form_id The form ID. |
886 | 886 | */ |
887 | - do_action( 'give_cc_billing_top' ); |
|
887 | + do_action('give_cc_billing_top'); |
|
888 | 888 | ?> |
889 | 889 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
890 | 890 | <label for="card_address" class="give-label"> |
891 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
891 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
892 | 892 | <?php |
893 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
893 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
894 | 894 | <span class="give-required-indicator">*</span> |
895 | 895 | <?php endif; ?> |
896 | 896 | <span class="give-tooltip give-icon give-icon-question" |
897 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
897 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
898 | 898 | </label> |
899 | 899 | |
900 | 900 | <input |
901 | 901 | type="text" |
902 | 902 | id="card_address" |
903 | 903 | name="card_address" |
904 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
905 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
906 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
907 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
904 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
905 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
906 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
907 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
908 | 908 | /> |
909 | 909 | </p> |
910 | 910 | |
911 | 911 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
912 | 912 | <label for="card_address_2" class="give-label"> |
913 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
914 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
913 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
914 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
915 | 915 | <span class="give-required-indicator">*</span> |
916 | 916 | <?php endif; ?> |
917 | 917 | <span class="give-tooltip give-icon give-icon-question" |
918 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
918 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
919 | 919 | </label> |
920 | 920 | |
921 | 921 | <input |
922 | 922 | type="text" |
923 | 923 | id="card_address_2" |
924 | 924 | name="card_address_2" |
925 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
926 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
927 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
928 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
925 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
926 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
927 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
928 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
929 | 929 | /> |
930 | 930 | </p> |
931 | 931 | |
932 | 932 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
933 | 933 | <label for="card_city" class="give-label"> |
934 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
935 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
934 | + <?php esc_html_e('City', 'give'); ?> |
|
935 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
936 | 936 | <span class="give-required-indicator">*</span> |
937 | 937 | <?php endif; ?> |
938 | 938 | <span class="give-tooltip give-icon give-icon-question" |
939 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
939 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
940 | 940 | </label> |
941 | 941 | <input |
942 | 942 | type="text" |
943 | 943 | id="card_city" |
944 | 944 | name="card_city" |
945 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
946 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
947 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
948 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
945 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
946 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
947 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
948 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
949 | 949 | /> |
950 | 950 | </p> |
951 | 951 | |
952 | 952 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
953 | 953 | <label for="card_zip" class="give-label"> |
954 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
955 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
954 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
955 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
956 | 956 | <span class="give-required-indicator">*</span> |
957 | 957 | <?php endif; ?> |
958 | 958 | <span class="give-tooltip give-icon give-icon-question" |
959 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
959 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
960 | 960 | </label> |
961 | 961 | |
962 | 962 | <input |
@@ -964,40 +964,40 @@ discard block |
||
964 | 964 | size="4" |
965 | 965 | id="card_zip" |
966 | 966 | name="card_zip" |
967 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
968 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
969 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
970 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
967 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
968 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
969 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
970 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
971 | 971 | /> |
972 | 972 | </p> |
973 | 973 | |
974 | 974 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
975 | 975 | <label for="billing_country" class="give-label"> |
976 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
977 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
976 | + <?php esc_html_e('Country', 'give'); ?> |
|
977 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
978 | 978 | <span class="give-required-indicator">*</span> |
979 | 979 | <?php endif; ?> |
980 | 980 | <span class="give-tooltip give-icon give-icon-question" |
981 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
981 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
982 | 982 | </label> |
983 | 983 | |
984 | 984 | <select |
985 | 985 | name="billing_country" |
986 | 986 | id="billing_country" |
987 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
988 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
987 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
988 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
989 | 989 | > |
990 | 990 | <?php |
991 | 991 | |
992 | 992 | $selected_country = give_get_country(); |
993 | 993 | |
994 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
994 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
995 | 995 | $selected_country = $give_user_info['billing_country']; |
996 | 996 | } |
997 | 997 | |
998 | 998 | $countries = give_get_country_list(); |
999 | - foreach ( $countries as $country_code => $country ) { |
|
1000 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
999 | + foreach ($countries as $country_code => $country) { |
|
1000 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1001 | 1001 | } |
1002 | 1002 | ?> |
1003 | 1003 | </select> |
@@ -1005,37 +1005,37 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
1007 | 1007 | <label for="card_state" class="give-label"> |
1008 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
1009 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
1008 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
1009 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
1010 | 1010 | <span class="give-required-indicator">*</span> |
1011 | 1011 | <?php endif; ?> |
1012 | 1012 | <span class="give-tooltip give-icon give-icon-question" |
1013 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
1013 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
1014 | 1014 | </label> |
1015 | 1015 | |
1016 | 1016 | <?php |
1017 | 1017 | $selected_state = give_get_state(); |
1018 | - $states = give_get_states( $selected_country ); |
|
1018 | + $states = give_get_states($selected_country); |
|
1019 | 1019 | |
1020 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
1020 | + if ( ! empty($give_user_info['card_state'])) { |
|
1021 | 1021 | $selected_state = $give_user_info['card_state']; |
1022 | 1022 | } |
1023 | 1023 | |
1024 | - if ( ! empty( $states ) ) : ?> |
|
1024 | + if ( ! empty($states)) : ?> |
|
1025 | 1025 | <select |
1026 | 1026 | name="card_state" |
1027 | 1027 | id="card_state" |
1028 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1029 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1028 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1029 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1030 | 1030 | <?php |
1031 | - foreach ( $states as $state_code => $state ) { |
|
1032 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1031 | + foreach ($states as $state_code => $state) { |
|
1032 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1033 | 1033 | } |
1034 | 1034 | ?> |
1035 | 1035 | </select> |
1036 | 1036 | <?php else : ?> |
1037 | 1037 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1038 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
1038 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
1039 | 1039 | <?php endif; ?> |
1040 | 1040 | </p> |
1041 | 1041 | <?php |
@@ -1046,14 +1046,14 @@ discard block |
||
1046 | 1046 | * |
1047 | 1047 | * @param int $form_id The form ID. |
1048 | 1048 | */ |
1049 | - do_action( 'give_cc_billing_bottom' ); |
|
1049 | + do_action('give_cc_billing_bottom'); |
|
1050 | 1050 | ?> |
1051 | 1051 | </fieldset> |
1052 | 1052 | <?php |
1053 | 1053 | echo ob_get_clean(); |
1054 | 1054 | } |
1055 | 1055 | |
1056 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1056 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1057 | 1057 | |
1058 | 1058 | |
1059 | 1059 | /** |
@@ -1065,27 +1065,27 @@ discard block |
||
1065 | 1065 | * |
1066 | 1066 | * @return string |
1067 | 1067 | */ |
1068 | -function give_get_register_fields( $form_id ) { |
|
1068 | +function give_get_register_fields($form_id) { |
|
1069 | 1069 | |
1070 | 1070 | global $user_ID; |
1071 | 1071 | |
1072 | - if ( is_user_logged_in() ) { |
|
1073 | - $user_data = get_userdata( $user_ID ); |
|
1072 | + if (is_user_logged_in()) { |
|
1073 | + $user_data = get_userdata($user_ID); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1076 | + $show_register_form = give_show_login_register_option($form_id); |
|
1077 | 1077 | |
1078 | 1078 | ob_start(); ?> |
1079 | 1079 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1080 | 1080 | |
1081 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1081 | + <?php if ($show_register_form == 'both') { ?> |
|
1082 | 1082 | <div class="give-login-account-wrap"> |
1083 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1084 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1085 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1083 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1084 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1085 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1086 | 1086 | </p> |
1087 | 1087 | <p class="give-loading-text"> |
1088 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
1088 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
1089 | 1089 | </div> |
1090 | 1090 | <?php } ?> |
1091 | 1091 | |
@@ -1097,15 +1097,15 @@ discard block |
||
1097 | 1097 | * |
1098 | 1098 | * @param int $form_id The form ID. |
1099 | 1099 | */ |
1100 | - do_action( 'give_register_fields_before', $form_id ); |
|
1100 | + do_action('give_register_fields_before', $form_id); |
|
1101 | 1101 | ?> |
1102 | 1102 | |
1103 | 1103 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1104 | 1104 | <legend> |
1105 | 1105 | <?php |
1106 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1107 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1108 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1106 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1107 | + if ( ! give_logged_in_only($form_id)) { |
|
1108 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1109 | 1109 | } |
1110 | 1110 | ?> |
1111 | 1111 | </legend> |
@@ -1117,52 +1117,52 @@ discard block |
||
1117 | 1117 | * |
1118 | 1118 | * @param int $form_id The form ID. |
1119 | 1119 | */ |
1120 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1120 | + do_action('give_register_account_fields_before', $form_id); |
|
1121 | 1121 | ?> |
1122 | 1122 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
1123 | 1123 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1124 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1125 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1124 | + <?php esc_html_e('Username', 'give'); ?> |
|
1125 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1126 | 1126 | <span class="give-required-indicator">*</span> |
1127 | 1127 | <?php } ?> |
1128 | 1128 | <span class="give-tooltip give-icon give-icon-question" |
1129 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1129 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1130 | 1130 | </label> |
1131 | 1131 | |
1132 | 1132 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
1133 | 1133 | type="text" |
1134 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1134 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1135 | 1135 | </div> |
1136 | 1136 | |
1137 | 1137 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
1138 | 1138 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1139 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1140 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1139 | + <?php esc_html_e('Password', 'give'); ?> |
|
1140 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1141 | 1141 | <span class="give-required-indicator">*</span> |
1142 | 1142 | <?php } ?> |
1143 | 1143 | <span class="give-tooltip give-icon give-icon-question" |
1144 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1144 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1145 | 1145 | </label> |
1146 | 1146 | |
1147 | 1147 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
1148 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
1149 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1148 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
1149 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1150 | 1150 | </div> |
1151 | 1151 | |
1152 | 1152 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
1153 | 1153 | class="give-register-password form-row form-row-one-third"> |
1154 | 1154 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1155 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1156 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1155 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1156 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1157 | 1157 | <span class="give-required-indicator">*</span> |
1158 | 1158 | <?php } ?> |
1159 | 1159 | <span class="give-tooltip give-icon give-icon-question" |
1160 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1160 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1161 | 1161 | </label> |
1162 | 1162 | |
1163 | 1163 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
1164 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
1165 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1164 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
1165 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1166 | 1166 | </div> |
1167 | 1167 | <?php |
1168 | 1168 | /** |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | * |
1173 | 1173 | * @param int $form_id The form ID. |
1174 | 1174 | */ |
1175 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1175 | + do_action('give_register_account_fields_after', $form_id); |
|
1176 | 1176 | ?> |
1177 | 1177 | </fieldset> |
1178 | 1178 | |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | * |
1185 | 1185 | * @param int $form_id The form ID. |
1186 | 1186 | */ |
1187 | - do_action( 'give_register_fields_after', $form_id ); |
|
1187 | + do_action('give_register_fields_after', $form_id); |
|
1188 | 1188 | ?> |
1189 | 1189 | |
1190 | 1190 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | * |
1196 | 1196 | * @since 1.7 |
1197 | 1197 | */ |
1198 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1198 | + do_action('give_donation_form_user_info', $form_id); |
|
1199 | 1199 | ?> |
1200 | 1200 | |
1201 | 1201 | </fieldset> |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | echo ob_get_clean(); |
1204 | 1204 | } |
1205 | 1205 | |
1206 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1206 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1207 | 1207 | |
1208 | 1208 | /** |
1209 | 1209 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1216,32 +1216,32 @@ discard block |
||
1216 | 1216 | * |
1217 | 1217 | * @return string |
1218 | 1218 | */ |
1219 | -function give_get_login_fields( $form_id ) { |
|
1219 | +function give_get_login_fields($form_id) { |
|
1220 | 1220 | |
1221 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1222 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1221 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1222 | + $show_register_form = give_show_login_register_option($form_id); |
|
1223 | 1223 | |
1224 | 1224 | ob_start(); |
1225 | 1225 | ?> |
1226 | 1226 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1227 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1228 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1229 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1227 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1228 | + if ( ! give_logged_in_only($form_id)) { |
|
1229 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1230 | 1230 | } ?> |
1231 | 1231 | </legend> |
1232 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1232 | + <?php if ($show_register_form == 'both') { ?> |
|
1233 | 1233 | <p class="give-new-account-link"> |
1234 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1235 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1234 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1235 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1236 | 1236 | data-action="give_checkout_register"> |
1237 | - <?php esc_html_e( 'Register', 'give' ); |
|
1238 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1239 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
1237 | + <?php esc_html_e('Register', 'give'); |
|
1238 | + if ( ! give_logged_in_only($form_id)) { |
|
1239 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
1240 | 1240 | } ?> |
1241 | 1241 | </a> |
1242 | 1242 | </p> |
1243 | 1243 | <p class="give-loading-text"> |
1244 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
1244 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
1245 | 1245 | <?php } ?> |
1246 | 1246 | <?php |
1247 | 1247 | /** |
@@ -1251,48 +1251,48 @@ discard block |
||
1251 | 1251 | * |
1252 | 1252 | * @param int $form_id The form ID. |
1253 | 1253 | */ |
1254 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1254 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1255 | 1255 | ?> |
1256 | 1256 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
1257 | 1257 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1258 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1259 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1258 | + <?php esc_html_e('Username', 'give'); ?> |
|
1259 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1260 | 1260 | <span class="give-required-indicator">*</span> |
1261 | 1261 | <?php } ?> |
1262 | 1262 | </label> |
1263 | 1263 | |
1264 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1264 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1265 | 1265 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1266 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1266 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1267 | 1267 | </div> |
1268 | 1268 | |
1269 | 1269 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
1270 | 1270 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1271 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1272 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1271 | + <?php esc_html_e('Password', 'give'); ?> |
|
1272 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1273 | 1273 | <span class="give-required-indicator">*</span> |
1274 | 1274 | <?php } ?> |
1275 | 1275 | </label> |
1276 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1276 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1277 | 1277 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1278 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1278 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1279 | 1279 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1280 | 1280 | </div> |
1281 | 1281 | |
1282 | 1282 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1283 | 1283 | <span class="give-forgot-password "> |
1284 | 1284 | <a href="<?php echo wp_lostpassword_url() ?>" |
1285 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1285 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1286 | 1286 | </span> |
1287 | 1287 | </div> |
1288 | 1288 | |
1289 | 1289 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1290 | 1290 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1291 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1292 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1291 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1292 | + <?php if ($show_register_form !== 'login') { ?> |
|
1293 | 1293 | <input type="button" data-action="give_cancel_login" |
1294 | 1294 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1295 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1295 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1296 | 1296 | <?php } ?> |
1297 | 1297 | <span class="give-loading-animation"></span> |
1298 | 1298 | </div> |
@@ -1304,14 +1304,14 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @param int $form_id The form ID. |
1306 | 1306 | */ |
1307 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1307 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1308 | 1308 | ?> |
1309 | 1309 | </fieldset><!--end #give-login-fields--> |
1310 | 1310 | <?php |
1311 | 1311 | echo ob_get_clean(); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1314 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1315 | 1315 | |
1316 | 1316 | /** |
1317 | 1317 | * Payment Mode Select. |
@@ -1327,9 +1327,9 @@ discard block |
||
1327 | 1327 | * |
1328 | 1328 | * @return void |
1329 | 1329 | */ |
1330 | -function give_payment_mode_select( $form_id ) { |
|
1330 | +function give_payment_mode_select($form_id) { |
|
1331 | 1331 | |
1332 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1332 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1333 | 1333 | |
1334 | 1334 | /** |
1335 | 1335 | * Fires while selecting payment gateways, before the fields. |
@@ -1338,10 +1338,10 @@ discard block |
||
1338 | 1338 | * |
1339 | 1339 | * @param int $form_id The form ID. |
1340 | 1340 | */ |
1341 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1341 | + do_action('give_payment_mode_top', $form_id); |
|
1342 | 1342 | ?> |
1343 | 1343 | |
1344 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1344 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1345 | 1345 | echo 'style="display: none;"'; |
1346 | 1346 | } ?>> |
1347 | 1347 | <?php |
@@ -1352,14 +1352,14 @@ discard block |
||
1352 | 1352 | * |
1353 | 1353 | * @param int $form_id The form ID. |
1354 | 1354 | */ |
1355 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1355 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1356 | 1356 | ?> |
1357 | 1357 | <legend |
1358 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend> |
|
1358 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend> |
|
1359 | 1359 | |
1360 | 1360 | <div id="give-payment-mode-wrap"> |
1361 | 1361 | <span class="give-loading-text"><span |
1362 | - class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
1362 | + class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
1363 | 1363 | |
1364 | 1364 | <?php |
1365 | 1365 | /** |
@@ -1367,26 +1367,26 @@ discard block |
||
1367 | 1367 | * |
1368 | 1368 | * @since 1.7 |
1369 | 1369 | */ |
1370 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1370 | + do_action('give_payment_mode_before_gateways') |
|
1371 | 1371 | ?> |
1372 | 1372 | <ul id="give-gateway-radio-list"> |
1373 | 1373 | <?php |
1374 | 1374 | /** |
1375 | 1375 | * Loop through the active payment gateways. |
1376 | 1376 | */ |
1377 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1377 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1378 | 1378 | |
1379 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1379 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1380 | 1380 | //Determine the default gateway. |
1381 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1381 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1382 | 1382 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; ?> |
1383 | 1383 | <li> |
1384 | 1384 | <input type="radio" name="payment-mode" class="give-gateway" |
1385 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1386 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1387 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1385 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1386 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1387 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1388 | 1388 | class="give-gateway-option<?php echo $checked_class; ?>" |
1389 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
1389 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
1390 | 1390 | </li> |
1391 | 1391 | <?php |
1392 | 1392 | endforeach; |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | * |
1399 | 1399 | * @since 1.7 |
1400 | 1400 | */ |
1401 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1401 | + do_action('give_payment_mode_after_gateways'); |
|
1402 | 1402 | ?> |
1403 | 1403 | </div> |
1404 | 1404 | <?php |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @param int $form_id The form ID. |
1411 | 1411 | */ |
1412 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1412 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1413 | 1413 | ?> |
1414 | 1414 | </fieldset> |
1415 | 1415 | |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | * |
1422 | 1422 | * @param int $form_id The form ID. |
1423 | 1423 | */ |
1424 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1424 | + do_action('give_payment_mode_bottom', $form_id); |
|
1425 | 1425 | ?> |
1426 | 1426 | |
1427 | 1427 | <div id="give_purchase_form_wrap"> |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | * |
1433 | 1433 | * @since 1.7 |
1434 | 1434 | */ |
1435 | - do_action( 'give_donation_form', $form_id ); |
|
1435 | + do_action('give_donation_form', $form_id); |
|
1436 | 1436 | ?> |
1437 | 1437 | |
1438 | 1438 | </div> |
@@ -1443,10 +1443,10 @@ discard block |
||
1443 | 1443 | * |
1444 | 1444 | * @since 1.7 |
1445 | 1445 | */ |
1446 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1446 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1449 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1450 | 1450 | |
1451 | 1451 | /** |
1452 | 1452 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1459,25 +1459,25 @@ discard block |
||
1459 | 1459 | * |
1460 | 1460 | * @return void|bool |
1461 | 1461 | */ |
1462 | -function give_terms_agreement( $form_id ) { |
|
1463 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1462 | +function give_terms_agreement($form_id) { |
|
1463 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1464 | 1464 | |
1465 | 1465 | // Bailout if per form and global term and conditions is not setup. |
1466 | - if ( 'yes' !== $form_option ) { |
|
1466 | + if ('yes' !== $form_option) { |
|
1467 | 1467 | return false; |
1468 | 1468 | } |
1469 | 1469 | |
1470 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1471 | - $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' ); |
|
1470 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1471 | + $terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', ''); |
|
1472 | 1472 | |
1473 | 1473 | // Set term and conditions label and text on basis of per form and global setting. |
1474 | 1474 | // $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
1475 | 1475 | // $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' ); |
1476 | 1476 | |
1477 | 1477 | // Bailout: Check if term and conditions text is empty or not. |
1478 | - if ( empty( $terms ) ) { |
|
1479 | - if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) { |
|
1480 | - echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) ); |
|
1478 | + if (empty($terms)) { |
|
1479 | + if (is_user_logged_in() && current_user_can('manage_options')) { |
|
1480 | + echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit')); |
|
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | return false; |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | |
1486 | 1486 | ?> |
1487 | 1487 | <fieldset id="give_terms_agreement"> |
1488 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1488 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1489 | 1489 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1490 | 1490 | <?php |
1491 | 1491 | /** |
@@ -1493,22 +1493,22 @@ discard block |
||
1493 | 1493 | * |
1494 | 1494 | * @since 1.0 |
1495 | 1495 | */ |
1496 | - do_action( 'give_before_terms' ); |
|
1496 | + do_action('give_before_terms'); |
|
1497 | 1497 | |
1498 | - echo wpautop( stripslashes( $terms ) ); |
|
1498 | + echo wpautop(stripslashes($terms)); |
|
1499 | 1499 | /** |
1500 | 1500 | * Fires while rendering terms of agreement, after the fields. |
1501 | 1501 | * |
1502 | 1502 | * @since 1.0 |
1503 | 1503 | */ |
1504 | - do_action( 'give_after_terms' ); |
|
1504 | + do_action('give_after_terms'); |
|
1505 | 1505 | ?> |
1506 | 1506 | </div> |
1507 | 1507 | <div id="give_show_terms"> |
1508 | 1508 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1509 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1509 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1510 | 1510 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1511 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1511 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1512 | 1512 | </div> |
1513 | 1513 | |
1514 | 1514 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" /> |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | <?php |
1519 | 1519 | } |
1520 | 1520 | |
1521 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1521 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1522 | 1522 | |
1523 | 1523 | /** |
1524 | 1524 | * Checkout Final Total. |
@@ -1531,29 +1531,29 @@ discard block |
||
1531 | 1531 | * |
1532 | 1532 | * @return void |
1533 | 1533 | */ |
1534 | -function give_checkout_final_total( $form_id ) { |
|
1534 | +function give_checkout_final_total($form_id) { |
|
1535 | 1535 | |
1536 | - if ( isset( $_POST['give_total'] ) ) { |
|
1537 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1536 | + if (isset($_POST['give_total'])) { |
|
1537 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1538 | 1538 | } else { |
1539 | 1539 | //default total. |
1540 | - $total = give_get_default_form_amount( $form_id ); |
|
1540 | + $total = give_get_default_form_amount($form_id); |
|
1541 | 1541 | } |
1542 | 1542 | //Only proceed if give_total available. |
1543 | - if ( empty( $total ) ) { |
|
1543 | + if (empty($total)) { |
|
1544 | 1544 | return; |
1545 | 1545 | } |
1546 | 1546 | ?> |
1547 | 1547 | <p id="give-final-total-wrap" class="form-wrap "> |
1548 | 1548 | <span |
1549 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1549 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1550 | 1550 | <span class="give-final-total-amount" |
1551 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1551 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1552 | 1552 | </p> |
1553 | 1553 | <?php |
1554 | 1554 | } |
1555 | 1555 | |
1556 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1556 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1557 | 1557 | |
1558 | 1558 | /** |
1559 | 1559 | * Renders the Checkout Submit section. |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | * |
1565 | 1565 | * @return void |
1566 | 1566 | */ |
1567 | -function give_checkout_submit( $form_id ) { |
|
1567 | +function give_checkout_submit($form_id) { |
|
1568 | 1568 | ?> |
1569 | 1569 | <fieldset id="give_purchase_submit"> |
1570 | 1570 | <?php |
@@ -1573,24 +1573,24 @@ discard block |
||
1573 | 1573 | * |
1574 | 1574 | * @since 1.7 |
1575 | 1575 | */ |
1576 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1576 | + do_action('give_donation_form_before_submit', $form_id); |
|
1577 | 1577 | |
1578 | - give_checkout_hidden_fields( $form_id ); |
|
1578 | + give_checkout_hidden_fields($form_id); |
|
1579 | 1579 | |
1580 | - echo give_checkout_button_purchase( $form_id ); |
|
1580 | + echo give_checkout_button_purchase($form_id); |
|
1581 | 1581 | |
1582 | 1582 | /** |
1583 | 1583 | * Fire after donation form submit. |
1584 | 1584 | * |
1585 | 1585 | * @since 1.7 |
1586 | 1586 | */ |
1587 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1587 | + do_action('give_donation_form_after_submit', $form_id); |
|
1588 | 1588 | ?> |
1589 | 1589 | </fieldset> |
1590 | 1590 | <?php |
1591 | 1591 | } |
1592 | 1592 | |
1593 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1593 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1594 | 1594 | |
1595 | 1595 | /** |
1596 | 1596 | * Give Checkout Button. |
@@ -1603,10 +1603,10 @@ discard block |
||
1603 | 1603 | * |
1604 | 1604 | * @return string |
1605 | 1605 | */ |
1606 | -function give_checkout_button_purchase( $form_id ) { |
|
1606 | +function give_checkout_button_purchase($form_id) { |
|
1607 | 1607 | |
1608 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1609 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1608 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1609 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1610 | 1610 | ob_start(); ?> |
1611 | 1611 | <div class="give-submit-button-wrap give-clearfix"> |
1612 | 1612 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | <span class="give-loading-animation"></span> |
1615 | 1615 | </div> |
1616 | 1616 | <?php |
1617 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1617 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | /** |
@@ -1628,18 +1628,18 @@ discard block |
||
1628 | 1628 | * |
1629 | 1629 | * @return void |
1630 | 1630 | */ |
1631 | -function give_agree_to_terms_js( $form_id ) { |
|
1631 | +function give_agree_to_terms_js($form_id) { |
|
1632 | 1632 | |
1633 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1633 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1634 | 1634 | |
1635 | - if ( $form_option === 'yes' ) { |
|
1635 | + if ($form_option === 'yes') { |
|
1636 | 1636 | ?> |
1637 | 1637 | <script type="text/javascript"> |
1638 | 1638 | jQuery(document).ready(function ($) { |
1639 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
1639 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1640 | 1640 | e.preventDefault(); |
1641 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1642 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
1641 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
1642 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1643 | 1643 | return false; |
1644 | 1644 | }); |
1645 | 1645 | }); |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | } |
1649 | 1649 | } |
1650 | 1650 | |
1651 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1651 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1652 | 1652 | |
1653 | 1653 | /** |
1654 | 1654 | * Show Give Goals. |
@@ -1662,17 +1662,17 @@ discard block |
||
1662 | 1662 | * |
1663 | 1663 | * @return mixed |
1664 | 1664 | */ |
1665 | -function give_show_goal_progress( $form_id, $args ) { |
|
1665 | +function give_show_goal_progress($form_id, $args) { |
|
1666 | 1666 | |
1667 | 1667 | ob_start(); |
1668 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1668 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1669 | 1669 | |
1670 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1670 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1671 | 1671 | |
1672 | 1672 | return true; |
1673 | 1673 | } |
1674 | 1674 | |
1675 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1675 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1676 | 1676 | |
1677 | 1677 | |
1678 | 1678 | /** |
@@ -1683,10 +1683,10 @@ discard block |
||
1683 | 1683 | * @param $args |
1684 | 1684 | * @return mixed|string |
1685 | 1685 | */ |
1686 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1686 | +function give_get_form_content_placement($form_id, $args) { |
|
1687 | 1687 | $show_content = ''; |
1688 | 1688 | |
1689 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1689 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1690 | 1690 | // Content positions. |
1691 | 1691 | $content_placement = array( |
1692 | 1692 | 'above' => 'give_pre_form', |
@@ -1694,13 +1694,13 @@ discard block |
||
1694 | 1694 | ); |
1695 | 1695 | |
1696 | 1696 | // Check if content position already decoded. |
1697 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1697 | + if (in_array($args['show_content'], $content_placement)) { |
|
1698 | 1698 | return $args['show_content']; |
1699 | 1699 | } |
1700 | 1700 | |
1701 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1702 | - } elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1703 | - $show_content = get_post_meta( $form_id, '_give_content_placement', true ); |
|
1701 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1702 | + } elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) { |
|
1703 | + $show_content = get_post_meta($form_id, '_give_content_placement', true); |
|
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | return $show_content; |
@@ -1716,20 +1716,20 @@ discard block |
||
1716 | 1716 | * |
1717 | 1717 | * @return void|bool |
1718 | 1718 | */ |
1719 | -function give_form_content( $form_id, $args ) { |
|
1719 | +function give_form_content($form_id, $args) { |
|
1720 | 1720 | |
1721 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1721 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1722 | 1722 | |
1723 | 1723 | // Bailout. |
1724 | - if( empty( $show_content ) ) { |
|
1724 | + if (empty($show_content)) { |
|
1725 | 1725 | return false; |
1726 | 1726 | } |
1727 | 1727 | |
1728 | 1728 | // Add action according to value. |
1729 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1729 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1730 | 1730 | } |
1731 | 1731 | |
1732 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1732 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1733 | 1733 | |
1734 | 1734 | /** |
1735 | 1735 | * Renders Post Form Content. |
@@ -1743,22 +1743,22 @@ discard block |
||
1743 | 1743 | * |
1744 | 1744 | * @return void |
1745 | 1745 | */ |
1746 | -function give_form_display_content( $form_id, $args ) { |
|
1746 | +function give_form_display_content($form_id, $args) { |
|
1747 | 1747 | |
1748 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1749 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1748 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1749 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1750 | 1750 | |
1751 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1752 | - $content = apply_filters( 'the_content', $content ); |
|
1751 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1752 | + $content = apply_filters('the_content', $content); |
|
1753 | 1753 | } |
1754 | 1754 | |
1755 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
1755 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
1756 | 1756 | |
1757 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1757 | + echo apply_filters('give_form_content_output', $output); |
|
1758 | 1758 | |
1759 | 1759 | //remove action to prevent content output on addition forms on page. |
1760 | 1760 | //@see: https://github.com/WordImpress/Give/issues/634. |
1761 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1761 | + remove_action($show_content, 'give_form_display_content'); |
|
1762 | 1762 | } |
1763 | 1763 | |
1764 | 1764 | /** |
@@ -1770,7 +1770,7 @@ discard block |
||
1770 | 1770 | * |
1771 | 1771 | * @return void |
1772 | 1772 | */ |
1773 | -function give_checkout_hidden_fields( $form_id ) { |
|
1773 | +function give_checkout_hidden_fields($form_id) { |
|
1774 | 1774 | |
1775 | 1775 | /** |
1776 | 1776 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1779,13 +1779,13 @@ discard block |
||
1779 | 1779 | * |
1780 | 1780 | * @param int $form_id The form ID. |
1781 | 1781 | */ |
1782 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1782 | + do_action('give_hidden_fields_before', $form_id); |
|
1783 | 1783 | |
1784 | - if ( is_user_logged_in() ) { ?> |
|
1784 | + if (is_user_logged_in()) { ?> |
|
1785 | 1785 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1786 | 1786 | <?php } ?> |
1787 | 1787 | <input type="hidden" name="give_action" value="purchase"/> |
1788 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1788 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1789 | 1789 | <?php |
1790 | 1790 | /** |
1791 | 1791 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | * |
1795 | 1795 | * @param int $form_id The form ID. |
1796 | 1796 | */ |
1797 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1797 | + do_action('give_hidden_fields_after', $form_id); |
|
1798 | 1798 | |
1799 | 1799 | } |
1800 | 1800 | |
@@ -1809,20 +1809,20 @@ discard block |
||
1809 | 1809 | * |
1810 | 1810 | * @return string $content Filtered content. |
1811 | 1811 | */ |
1812 | -function give_filter_success_page_content( $content ) { |
|
1812 | +function give_filter_success_page_content($content) { |
|
1813 | 1813 | |
1814 | 1814 | $give_options = give_get_settings(); |
1815 | 1815 | |
1816 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1817 | - if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1818 | - $content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1816 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1817 | + if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) { |
|
1818 | + $content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content); |
|
1819 | 1819 | } |
1820 | 1820 | } |
1821 | 1821 | |
1822 | 1822 | return $content; |
1823 | 1823 | } |
1824 | 1824 | |
1825 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1825 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1826 | 1826 | |
1827 | 1827 | /** |
1828 | 1828 | * Test Mode Frontend Warning. |
@@ -1833,12 +1833,12 @@ discard block |
||
1833 | 1833 | */ |
1834 | 1834 | function give_test_mode_frontend_warning() { |
1835 | 1835 | |
1836 | - if ( give_is_test_mode() ) { |
|
1837 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
1836 | + if (give_is_test_mode()) { |
|
1837 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
1838 | 1838 | } |
1839 | 1839 | } |
1840 | 1840 | |
1841 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1841 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1842 | 1842 | |
1843 | 1843 | /** |
1844 | 1844 | * Members-only Form. |
@@ -1852,21 +1852,21 @@ discard block |
||
1852 | 1852 | * |
1853 | 1853 | * @return string |
1854 | 1854 | */ |
1855 | -function give_members_only_form( $final_output, $args ) { |
|
1855 | +function give_members_only_form($final_output, $args) { |
|
1856 | 1856 | |
1857 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1857 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1858 | 1858 | |
1859 | 1859 | //Sanity Check: Must have form_id & not be logged in. |
1860 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1860 | + if (empty($form_id) || is_user_logged_in()) { |
|
1861 | 1861 | return $final_output; |
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | //Logged in only and Register / Login set to none. |
1865 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1865 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1866 | 1866 | |
1867 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1867 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1868 | 1868 | |
1869 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1869 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1870 | 1870 | |
1871 | 1871 | } |
1872 | 1872 | |
@@ -1874,4 +1874,4 @@ discard block |
||
1874 | 1874 | |
1875 | 1875 | } |
1876 | 1876 | |
1877 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1877 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | if( 'button' === $display_option ) { |
594 | 594 | $display_option = 'modal'; |
595 | - }elseif ( $display_option === 'onpage' ) { |
|
595 | + } elseif ( $display_option === 'onpage' ) { |
|
596 | 596 | return ''; |
597 | 597 | } |
598 | 598 | |
@@ -1033,9 +1033,12 @@ discard block |
||
1033 | 1033 | } |
1034 | 1034 | ?> |
1035 | 1035 | </select> |
1036 | - <?php else : ?> |
|
1036 | + <?php else { |
|
1037 | + : ?> |
|
1037 | 1038 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1038 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
1039 | + placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
1040 | +} |
|
1041 | +?>"/> |
|
1039 | 1042 | <?php endif; ?> |
1040 | 1043 | </p> |
1041 | 1044 | <?php |
@@ -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,36 +23,36 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | // Give Forms single post and archive options. |
26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
28 | 28 | |
29 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
29 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
30 | 30 | //support for old 'GIVE_FORMS_SLUG' constant |
31 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
31 | + if (defined('GIVE_FORMS_SLUG')) { |
|
32 | 32 | $give_forms_slug = GIVE_FORMS_SLUG; |
33 | 33 | } |
34 | 34 | |
35 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
35 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | 36 | 'slug' => $give_forms_slug, |
37 | 37 | 'with_front' => false |
38 | 38 | ); |
39 | 39 | |
40 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
41 | - 'name' => esc_html__( 'Donation Forms', 'give' ), |
|
42 | - 'singular_name' => esc_html__( 'Form', 'give' ), |
|
43 | - 'add_new' => esc_html__( 'Add Form', 'give' ), |
|
44 | - 'add_new_item' => esc_html__( 'Add New Donation Form', 'give' ), |
|
45 | - 'edit_item' => esc_html__( 'Edit Donation Form', 'give' ), |
|
46 | - 'new_item' => esc_html__( 'New Form', 'give' ), |
|
47 | - 'all_items' => esc_html__( 'All Forms', 'give' ), |
|
48 | - 'view_item' => esc_html__( 'View Form', 'give' ), |
|
49 | - 'search_items' => esc_html__( 'Search Forms', 'give' ), |
|
50 | - 'not_found' => esc_html__( 'No forms found.', 'give' ), |
|
51 | - 'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ), |
|
40 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
41 | + 'name' => esc_html__('Donation Forms', 'give'), |
|
42 | + 'singular_name' => esc_html__('Form', 'give'), |
|
43 | + 'add_new' => esc_html__('Add Form', 'give'), |
|
44 | + 'add_new_item' => esc_html__('Add New Donation Form', 'give'), |
|
45 | + 'edit_item' => esc_html__('Edit Donation Form', 'give'), |
|
46 | + 'new_item' => esc_html__('New Form', 'give'), |
|
47 | + 'all_items' => esc_html__('All Forms', 'give'), |
|
48 | + 'view_item' => esc_html__('View Form', 'give'), |
|
49 | + 'search_items' => esc_html__('Search Forms', 'give'), |
|
50 | + 'not_found' => esc_html__('No forms found.', 'give'), |
|
51 | + 'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'), |
|
52 | 52 | 'parent_item_colon' => '', |
53 | - 'menu_name' => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ), |
|
54 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) ) |
|
55 | - ) ); |
|
53 | + 'menu_name' => apply_filters('give_menu_name', esc_html__('Donations', 'give')), |
|
54 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give')) |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Default give_forms supports. |
58 | 58 | $give_form_supports = array( |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | //Has the user disabled the excerpt? |
67 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
68 | - unset( $give_form_supports[2] ); |
|
67 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
68 | + unset($give_form_supports[2]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | //Has user disabled the featured image? |
72 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
73 | - unset( $give_form_supports[1] ); |
|
74 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
72 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
73 | + unset($give_form_supports[1]); |
|
74 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $give_forms_args = array( |
@@ -87,42 +87,42 @@ discard block |
||
87 | 87 | 'has_archive' => $give_forms_archives, |
88 | 88 | 'menu_icon' => 'dashicons-give', |
89 | 89 | 'hierarchical' => false, |
90 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
90 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
91 | 91 | ); |
92 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
92 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
93 | 93 | |
94 | 94 | /** Donation Post Type */ |
95 | 95 | $payment_labels = array( |
96 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
97 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
98 | - 'add_new' => esc_html__( 'Add New', 'give' ), |
|
99 | - 'add_new_item' => esc_html__( 'Add New Donation', 'give' ), |
|
100 | - 'edit_item' => esc_html__( 'Edit Donation', 'give' ), |
|
101 | - 'new_item' => esc_html__( 'New Donation', 'give' ), |
|
102 | - 'all_items' => esc_html__( 'All Donations', 'give' ), |
|
103 | - 'view_item' => esc_html__( 'View Donation', 'give' ), |
|
104 | - 'search_items' => esc_html__( 'Search Donations', 'give' ), |
|
105 | - 'not_found' => esc_html__( 'No donations found.', 'give' ), |
|
106 | - 'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ), |
|
96 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
97 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
98 | + 'add_new' => esc_html__('Add New', 'give'), |
|
99 | + 'add_new_item' => esc_html__('Add New Donation', 'give'), |
|
100 | + 'edit_item' => esc_html__('Edit Donation', 'give'), |
|
101 | + 'new_item' => esc_html__('New Donation', 'give'), |
|
102 | + 'all_items' => esc_html__('All Donations', 'give'), |
|
103 | + 'view_item' => esc_html__('View Donation', 'give'), |
|
104 | + 'search_items' => esc_html__('Search Donations', 'give'), |
|
105 | + 'not_found' => esc_html__('No donations found.', 'give'), |
|
106 | + 'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'), |
|
107 | 107 | 'parent_item_colon' => '', |
108 | - 'menu_name' => esc_html__( 'Donations', 'give' ) |
|
108 | + 'menu_name' => esc_html__('Donations', 'give') |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | $payment_args = array( |
112 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
112 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
113 | 113 | 'public' => false, |
114 | 114 | 'query_var' => false, |
115 | 115 | 'rewrite' => false, |
116 | 116 | 'map_meta_cap' => true, |
117 | 117 | 'capability_type' => 'give_payment', |
118 | - 'supports' => array( 'title' ), |
|
118 | + 'supports' => array('title'), |
|
119 | 119 | 'can_export' => true |
120 | 120 | ); |
121 | - register_post_type( 'give_payment', $payment_args ); |
|
121 | + register_post_type('give_payment', $payment_args); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
125 | +add_action('init', 'give_setup_post_types', 1); |
|
126 | 126 | |
127 | 127 | |
128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function give_setup_taxonomies() { |
137 | 137 | |
138 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
138 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
139 | 139 | |
140 | 140 | /** Categories */ |
141 | 141 | $category_labels = array( |
142 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
143 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
144 | - 'search_items' => esc_html__( 'Search Categories', 'give' ), |
|
145 | - 'all_items' => esc_html__( 'All Categories', 'give' ), |
|
146 | - 'parent_item' => esc_html__( 'Parent Category', 'give' ), |
|
147 | - 'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ), |
|
148 | - 'edit_item' => esc_html__( 'Edit Category', 'give' ), |
|
149 | - 'update_item' => esc_html__( 'Update Category', 'give' ), |
|
150 | - 'add_new_item' => esc_html__( 'Add New Category', 'give' ), |
|
151 | - 'new_item_name' => esc_html__( 'New Category Name', 'give' ), |
|
152 | - 'menu_name' => esc_html__( 'Categories', 'give' ), |
|
142 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
143 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
144 | + 'search_items' => esc_html__('Search Categories', 'give'), |
|
145 | + 'all_items' => esc_html__('All Categories', 'give'), |
|
146 | + 'parent_item' => esc_html__('Parent Category', 'give'), |
|
147 | + 'parent_item_colon' => esc_html__('Parent Category:', 'give'), |
|
148 | + 'edit_item' => esc_html__('Edit Category', 'give'), |
|
149 | + 'update_item' => esc_html__('Update Category', 'give'), |
|
150 | + 'add_new_item' => esc_html__('Add New Category', 'give'), |
|
151 | + 'new_item_name' => esc_html__('New Category Name', 'give'), |
|
152 | + 'menu_name' => esc_html__('Categories', 'give'), |
|
153 | 153 | ); |
154 | 154 | |
155 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
155 | + $category_args = apply_filters('give_forms_category_args', array( |
|
156 | 156 | 'hierarchical' => true, |
157 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
157 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
158 | 158 | 'show_ui' => true, |
159 | 159 | 'query_var' => 'give_forms_category', |
160 | 160 | 'rewrite' => array( |
161 | - 'slug' => $slug . '/category', |
|
161 | + 'slug' => $slug.'/category', |
|
162 | 162 | 'with_front' => false, |
163 | 163 | 'hierarchical' => true |
164 | 164 | ), |
@@ -172,34 +172,34 @@ discard block |
||
172 | 172 | ); |
173 | 173 | |
174 | 174 | //Does the user want categories? |
175 | - if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
176 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
177 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
175 | + if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
176 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
177 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | 181 | /** Tags */ |
182 | 182 | $tag_labels = array( |
183 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
184 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
185 | - 'search_items' => esc_html__( 'Search Tags', 'give' ), |
|
186 | - 'all_items' => esc_html__( 'All Tags', 'give' ), |
|
187 | - 'parent_item' => esc_html__( 'Parent Tag', 'give' ), |
|
188 | - 'parent_item_colon' => esc_html__( 'Parent Tag:', 'give' ), |
|
189 | - 'edit_item' => esc_html__( 'Edit Tag', 'give' ), |
|
190 | - 'update_item' => esc_html__( 'Update Tag', 'give' ), |
|
191 | - 'add_new_item' => esc_html__( 'Add New Tag', 'give' ), |
|
192 | - 'new_item_name' => esc_html__( 'New Tag Name', 'give' ), |
|
193 | - 'menu_name' => esc_html__( 'Tags', 'give' ), |
|
194 | - 'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ), |
|
183 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
184 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
185 | + 'search_items' => esc_html__('Search Tags', 'give'), |
|
186 | + 'all_items' => esc_html__('All Tags', 'give'), |
|
187 | + 'parent_item' => esc_html__('Parent Tag', 'give'), |
|
188 | + 'parent_item_colon' => esc_html__('Parent Tag:', 'give'), |
|
189 | + 'edit_item' => esc_html__('Edit Tag', 'give'), |
|
190 | + 'update_item' => esc_html__('Update Tag', 'give'), |
|
191 | + 'add_new_item' => esc_html__('Add New Tag', 'give'), |
|
192 | + 'new_item_name' => esc_html__('New Tag Name', 'give'), |
|
193 | + 'menu_name' => esc_html__('Tags', 'give'), |
|
194 | + 'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'), |
|
195 | 195 | ); |
196 | 196 | |
197 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
197 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
198 | 198 | 'hierarchical' => false, |
199 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
199 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
200 | 200 | 'show_ui' => true, |
201 | 201 | 'query_var' => 'give_forms_tag', |
202 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
202 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
203 | 203 | 'capabilities' => array( |
204 | 204 | 'manage_terms' => 'manage_give_form_terms', |
205 | 205 | 'edit_terms' => 'edit_give_form_terms', |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | ) |
210 | 210 | ); |
211 | 211 | |
212 | - if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
213 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
214 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
212 | + if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
213 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
214 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
218 | 218 | } |
219 | 219 | |
220 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
220 | +add_action('init', 'give_setup_taxonomies', 0); |
|
221 | 221 | |
222 | 222 | |
223 | 223 | /** |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | */ |
229 | 229 | function give_get_default_form_labels() { |
230 | 230 | $defaults = array( |
231 | - 'singular' => esc_html__( 'Form', 'give' ), |
|
232 | - 'plural' => esc_html__( 'Forms', 'give' ) |
|
231 | + 'singular' => esc_html__('Form', 'give'), |
|
232 | + 'plural' => esc_html__('Forms', 'give') |
|
233 | 233 | ); |
234 | 234 | |
235 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
235 | + return apply_filters('give_default_form_name', $defaults); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return string $defaults['singular'] Singular label |
246 | 246 | */ |
247 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
247 | +function give_get_forms_label_singular($lowercase = false) { |
|
248 | 248 | $defaults = give_get_default_form_labels(); |
249 | 249 | |
250 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
250 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | * @since 1.0 |
257 | 257 | * @return string $defaults['plural'] Plural label |
258 | 258 | */ |
259 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
259 | +function give_get_forms_label_plural($lowercase = false) { |
|
260 | 260 | $defaults = give_get_default_form_labels(); |
261 | 261 | |
262 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
262 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -271,24 +271,24 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return string $title New placeholder text |
273 | 273 | */ |
274 | -function give_change_default_title( $title ) { |
|
274 | +function give_change_default_title($title) { |
|
275 | 275 | // If a frontend plugin uses this filter (check extensions before changing this function) |
276 | - if ( ! is_admin() ) { |
|
277 | - $title = esc_html__( 'Enter form title here', 'give' ); |
|
276 | + if ( ! is_admin()) { |
|
277 | + $title = esc_html__('Enter form title here', 'give'); |
|
278 | 278 | |
279 | 279 | return $title; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $screen = get_current_screen(); |
283 | 283 | |
284 | - if ( 'give_forms' == $screen->post_type ) { |
|
285 | - $title = esc_html__( 'Enter form title here', 'give' ); |
|
284 | + if ('give_forms' == $screen->post_type) { |
|
285 | + $title = esc_html__('Enter form title here', 'give'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $title; |
289 | 289 | } |
290 | 290 | |
291 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
291 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
292 | 292 | |
293 | 293 | /** |
294 | 294 | * Registers Custom Post Statuses which are used by the Payments |
@@ -298,50 +298,50 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function give_register_post_type_statuses() { |
300 | 300 | // Payment Statuses |
301 | - register_post_status( 'refunded', array( |
|
302 | - 'label' => esc_html__( 'Refunded', 'give' ), |
|
301 | + register_post_status('refunded', array( |
|
302 | + 'label' => esc_html__('Refunded', 'give'), |
|
303 | 303 | 'public' => true, |
304 | 304 | 'exclude_from_search' => false, |
305 | 305 | 'show_in_admin_all_list' => true, |
306 | 306 | 'show_in_admin_status_list' => true, |
307 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ) |
|
308 | - ) ); |
|
309 | - register_post_status( 'failed', array( |
|
310 | - 'label' => esc_html__( 'Failed', 'give' ), |
|
307 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give') |
|
308 | + )); |
|
309 | + register_post_status('failed', array( |
|
310 | + 'label' => esc_html__('Failed', 'give'), |
|
311 | 311 | 'public' => true, |
312 | 312 | 'exclude_from_search' => false, |
313 | 313 | 'show_in_admin_all_list' => true, |
314 | 314 | 'show_in_admin_status_list' => true, |
315 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ) |
|
316 | - ) ); |
|
317 | - register_post_status( 'revoked', array( |
|
318 | - 'label' => esc_html__( 'Revoked', 'give' ), |
|
315 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give') |
|
316 | + )); |
|
317 | + register_post_status('revoked', array( |
|
318 | + 'label' => esc_html__('Revoked', 'give'), |
|
319 | 319 | 'public' => true, |
320 | 320 | 'exclude_from_search' => false, |
321 | 321 | 'show_in_admin_all_list' => true, |
322 | 322 | 'show_in_admin_status_list' => true, |
323 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ) |
|
324 | - ) ); |
|
325 | - register_post_status( 'cancelled', array( |
|
326 | - 'label' => esc_html__( 'Cancelled', 'give' ), |
|
323 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give') |
|
324 | + )); |
|
325 | + register_post_status('cancelled', array( |
|
326 | + 'label' => esc_html__('Cancelled', 'give'), |
|
327 | 327 | 'public' => true, |
328 | 328 | 'exclude_from_search' => false, |
329 | 329 | 'show_in_admin_all_list' => true, |
330 | 330 | 'show_in_admin_status_list' => true, |
331 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ) |
|
332 | - ) ); |
|
333 | - register_post_status( 'abandoned', array( |
|
334 | - 'label' => esc_html__( 'Abandoned', 'give' ), |
|
331 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give') |
|
332 | + )); |
|
333 | + register_post_status('abandoned', array( |
|
334 | + 'label' => esc_html__('Abandoned', 'give'), |
|
335 | 335 | 'public' => true, |
336 | 336 | 'exclude_from_search' => false, |
337 | 337 | 'show_in_admin_all_list' => true, |
338 | 338 | 'show_in_admin_status_list' => true, |
339 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ) |
|
340 | - ) ); |
|
339 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give') |
|
340 | + )); |
|
341 | 341 | |
342 | 342 | } |
343 | 343 | |
344 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
344 | +add_action('init', 'give_register_post_type_statuses'); |
|
345 | 345 | |
346 | 346 | /** |
347 | 347 | * Updated Messages |
@@ -354,27 +354,27 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return array $messages New post updated messages |
356 | 356 | */ |
357 | -function give_updated_messages( $messages ) { |
|
357 | +function give_updated_messages($messages) { |
|
358 | 358 | global $post, $post_ID; |
359 | 359 | |
360 | - if ( give_get_option( 'disable_forms_singular' ) === 'on' ) { |
|
360 | + if (give_get_option('disable_forms_singular') === 'on') { |
|
361 | 361 | |
362 | 362 | $messages['give_forms'] = array( |
363 | - 1 => esc_html__( 'Form updated.', 'give' ), |
|
364 | - 4 => esc_html__( 'Form updated.', 'give' ), |
|
365 | - 6 => esc_html__( 'Form published.', 'give' ), |
|
366 | - 7 => esc_html__( 'Form saved.', 'give' ), |
|
367 | - 8 => esc_html__( 'Form submitted.', 'give' ) |
|
363 | + 1 => esc_html__('Form updated.', 'give'), |
|
364 | + 4 => esc_html__('Form updated.', 'give'), |
|
365 | + 6 => esc_html__('Form published.', 'give'), |
|
366 | + 7 => esc_html__('Form saved.', 'give'), |
|
367 | + 8 => esc_html__('Form submitted.', 'give') |
|
368 | 368 | ); |
369 | 369 | |
370 | 370 | } else { |
371 | 371 | |
372 | 372 | $messages['give_forms'] = array( |
373 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
374 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
375 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
376 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
377 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ) |
|
373 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
374 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
375 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
376 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
377 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')) |
|
378 | 378 | ); |
379 | 379 | |
380 | 380 | } |
@@ -382,27 +382,27 @@ discard block |
||
382 | 382 | return $messages; |
383 | 383 | } |
384 | 384 | |
385 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
385 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
386 | 386 | |
387 | 387 | |
388 | 388 | /** |
389 | 389 | * Setup Post Type Images |
390 | 390 | */ |
391 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
391 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
392 | 392 | |
393 | 393 | /** |
394 | 394 | * Ensure post thumbnail support is turned on |
395 | 395 | */ |
396 | 396 | function give_add_thumbnail_support() { |
397 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
397 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
398 | 398 | return; |
399 | 399 | } |
400 | 400 | |
401 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
402 | - add_theme_support( 'post-thumbnails' ); |
|
401 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
402 | + add_theme_support('post-thumbnails'); |
|
403 | 403 | } |
404 | 404 | |
405 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
405 | + add_post_type_support('give_forms', 'thumbnail'); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -415,21 +415,21 @@ discard block |
||
415 | 415 | |
416 | 416 | //Single Give Forms (disabled if single turned off in settings) |
417 | 417 | if ( |
418 | - ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
419 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
418 | + ! give_is_setting_enabled(give_get_option('forms_singular')) |
|
419 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
420 | 420 | ) { |
421 | 421 | |
422 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
423 | - 'name' => esc_html__( 'Give Single Form Sidebar', 'give' ), |
|
422 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
423 | + 'name' => esc_html__('Give Single Form Sidebar', 'give'), |
|
424 | 424 | 'id' => 'give-forms-sidebar', |
425 | - 'description' => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
425 | + 'description' => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
426 | 426 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
427 | 427 | 'after_widget' => '</div>', |
428 | 428 | 'before_title' => '<h3 class="widgettitle widget-title">', |
429 | 429 | 'after_title' => '</h3>', |
430 | - ) ) ); |
|
430 | + ))); |
|
431 | 431 | |
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
435 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -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,15 +23,15 @@ discard block |
||
23 | 23 | * @global $wpdb |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_install( $network_wide = false ) { |
|
26 | +function give_install($network_wide = false) { |
|
27 | 27 | |
28 | 28 | global $wpdb; |
29 | 29 | |
30 | - if ( is_multisite() && $network_wide ) { |
|
30 | + if (is_multisite() && $network_wide) { |
|
31 | 31 | |
32 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
32 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
33 | 33 | |
34 | - switch_to_blog( $blog_id ); |
|
34 | + switch_to_blog($blog_id); |
|
35 | 35 | give_run_install(); |
36 | 36 | restore_current_blog(); |
37 | 37 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
48 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Run the Give Install process. |
@@ -61,24 +61,24 @@ discard block |
||
61 | 61 | give_setup_post_types(); |
62 | 62 | |
63 | 63 | // Clear the permalinks. |
64 | - flush_rewrite_rules( false ); |
|
64 | + flush_rewrite_rules(false); |
|
65 | 65 | |
66 | 66 | // Add Upgraded From Option. |
67 | - $current_version = get_option( 'give_version' ); |
|
68 | - if ( $current_version ) { |
|
69 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
67 | + $current_version = get_option('give_version'); |
|
68 | + if ($current_version) { |
|
69 | + update_option('give_version_upgraded_from', $current_version); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Setup some default options. |
73 | 73 | $options = array(); |
74 | 74 | |
75 | 75 | // Checks if the Success Page option exists AND that the page exists. |
76 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
76 | + if ( ! get_post(give_get_option('success_page'))) { |
|
77 | 77 | |
78 | 78 | // Donation Confirmation (Success) Page |
79 | 79 | $success = wp_insert_post( |
80 | 80 | array( |
81 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
81 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
82 | 82 | 'post_content' => '[give_receipt]', |
83 | 83 | 'post_status' => 'publish', |
84 | 84 | 'post_author' => 1, |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | // Checks if the Failure Page option exists AND that the page exists. |
95 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
95 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
96 | 96 | |
97 | 97 | // Failed Donation Page |
98 | 98 | $failed = wp_insert_post( |
99 | 99 | array( |
100 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
101 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
100 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
101 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
102 | 102 | 'post_status' => 'publish', |
103 | 103 | 'post_author' => 1, |
104 | 104 | 'post_type' => 'page', |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | // Checks if the History Page option exists AND that the page exists. |
113 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
113 | + if ( ! get_post(give_get_option('history_page'))) { |
|
114 | 114 | // Donation History Page |
115 | 115 | $history = wp_insert_post( |
116 | 116 | array( |
117 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
117 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
118 | 118 | 'post_content' => '[donation_history]', |
119 | 119 | 'post_status' => 'publish', |
120 | 120 | 'post_author' => 1, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
130 | - if ( empty( $current_version ) ) { |
|
130 | + if (empty($current_version)) { |
|
131 | 131 | |
132 | 132 | // General. |
133 | 133 | $options['base_country'] = 'US'; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $options['scripts_footer'] = 'disabled'; |
156 | 156 | |
157 | 157 | // Paypal IPN verification. |
158 | - $options['paypal_verification'] = 'enabled'; |
|
158 | + $options['paypal_verification'] = 'enabled'; |
|
159 | 159 | |
160 | 160 | // Default is manual gateway. |
161 | 161 | $options['gateways']['manual'] = 'on'; |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // Populate the default values. |
180 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
181 | - update_option( 'give_version', GIVE_VERSION ); |
|
180 | + update_option('give_settings', array_merge($give_options, $options)); |
|
181 | + update_option('give_version', GIVE_VERSION); |
|
182 | 182 | |
183 | 183 | // Create Give roles. |
184 | 184 | $roles = new Give_Roles(); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $roles->add_caps(); |
187 | 187 | |
188 | 188 | $api = new Give_API(); |
189 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
189 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
190 | 190 | |
191 | 191 | // Create the customers databases. |
192 | 192 | @Give()->customers->create_table(); |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | Give()->session->use_php_sessions(); |
197 | 197 | |
198 | 198 | // Add a temporary option to note that Give pages have been created. |
199 | - set_transient( '_give_installed', $options, 30 ); |
|
199 | + set_transient('_give_installed', $options, 30); |
|
200 | 200 | |
201 | - if ( ! $current_version ) { |
|
201 | + if ( ! $current_version) { |
|
202 | 202 | |
203 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
203 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
204 | 204 | |
205 | 205 | // When new upgrade routines are added, mark them as complete on fresh install. |
206 | 206 | $upgrade_routines = array( |
@@ -209,22 +209,22 @@ discard block |
||
209 | 209 | 'upgrade_give_offline_status' |
210 | 210 | ); |
211 | 211 | |
212 | - foreach ( $upgrade_routines as $upgrade ) { |
|
213 | - give_set_upgrade_complete( $upgrade ); |
|
212 | + foreach ($upgrade_routines as $upgrade) { |
|
213 | + give_set_upgrade_complete($upgrade); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Bail if activating from network, or bulk. |
218 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
218 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
219 | 219 | return; |
220 | 220 | } |
221 | 221 | |
222 | 222 | // Add the transient to redirect. |
223 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
223 | + set_transient('_give_activation_redirect', true, 30); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
227 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
228 | 228 | |
229 | 229 | /** |
230 | 230 | * Network Activated New Site Setup. |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | * @param int $site_id The Site ID. |
241 | 241 | * @param array $meta Blog Meta. |
242 | 242 | */ |
243 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
243 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
244 | 244 | |
245 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
245 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
246 | 246 | |
247 | - switch_to_blog( $blog_id ); |
|
247 | + switch_to_blog($blog_id); |
|
248 | 248 | give_install(); |
249 | 249 | restore_current_blog(); |
250 | 250 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
255 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
256 | 256 | |
257 | 257 | |
258 | 258 | /** |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return array The tables to drop. |
267 | 267 | */ |
268 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
268 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
269 | 269 | |
270 | - switch_to_blog( $blog_id ); |
|
270 | + switch_to_blog($blog_id); |
|
271 | 271 | $customers_db = new Give_DB_Customers(); |
272 | 272 | $customer_meta_db = new Give_DB_Customer_Meta(); |
273 | 273 | |
274 | - if ( $customers_db->installed() ) { |
|
274 | + if ($customers_db->installed()) { |
|
275 | 275 | $tables[] = $customers_db->table_name; |
276 | 276 | $tables[] = $customer_meta_db->table_name; |
277 | 277 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | } |
283 | 283 | |
284 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
284 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
285 | 285 | |
286 | 286 | /** |
287 | 287 | * Post-installation |
@@ -293,16 +293,16 @@ discard block |
||
293 | 293 | */ |
294 | 294 | function give_after_install() { |
295 | 295 | |
296 | - if ( ! is_admin() ) { |
|
296 | + if ( ! is_admin()) { |
|
297 | 297 | return; |
298 | 298 | } |
299 | 299 | |
300 | - $give_options = get_transient( '_give_installed' ); |
|
301 | - $give_table_check = get_option( '_give_table_check', false ); |
|
300 | + $give_options = get_transient('_give_installed'); |
|
301 | + $give_table_check = get_option('_give_table_check', false); |
|
302 | 302 | |
303 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
303 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
304 | 304 | |
305 | - if ( ! @Give()->customer_meta->installed() ) { |
|
305 | + if ( ! @Give()->customer_meta->installed()) { |
|
306 | 306 | |
307 | 307 | // Create the customer meta database |
308 | 308 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | } |
312 | 312 | |
313 | - if ( ! @Give()->customers->installed() ) { |
|
313 | + if ( ! @Give()->customers->installed()) { |
|
314 | 314 | // Create the customers database |
315 | 315 | // (this ensures it creates it on multisite instances where it is network activated). |
316 | 316 | @Give()->customers->create_table(); |
@@ -322,22 +322,22 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @param array $give_options Give plugin options. |
324 | 324 | */ |
325 | - do_action( 'give_after_install', $give_options ); |
|
325 | + do_action('give_after_install', $give_options); |
|
326 | 326 | } |
327 | 327 | |
328 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
328 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
329 | 329 | |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Delete the transient |
333 | - if ( false !== $give_options ) { |
|
334 | - delete_transient( '_give_installed' ); |
|
333 | + if (false !== $give_options) { |
|
334 | + delete_transient('_give_installed'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
338 | 338 | } |
339 | 339 | |
340 | -add_action( 'admin_init', 'give_after_install' ); |
|
340 | +add_action('admin_init', 'give_after_install'); |
|
341 | 341 | |
342 | 342 | |
343 | 343 | /** |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | |
353 | 353 | global $wp_roles; |
354 | 354 | |
355 | - if ( ! is_object( $wp_roles ) ) { |
|
355 | + if ( ! is_object($wp_roles)) { |
|
356 | 356 | return; |
357 | 357 | } |
358 | 358 | |
359 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
359 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
360 | 360 | |
361 | 361 | // Create Give plugin roles |
362 | 362 | $roles = new Give_Roles(); |
@@ -367,4 +367,4 @@ discard block |
||
367 | 367 | |
368 | 368 | } |
369 | 369 | |
370 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
371 | 370 | \ No newline at end of file |
371 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
372 | 372 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Templates |
38 | 38 | */ |
39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
39 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Content Wrappers |
43 | 43 | */ |
44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
44 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
45 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Entry Summary Classes |
49 | 49 | */ |
50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
50 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Sidebar |
54 | 54 | */ |
55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
55 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Single Forms Summary Box |
59 | 59 | */ |
60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
60 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
61 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string $classes List of space separated class names. |
75 | 75 | */ |
76 | - public function give_set_single_summary_classes( $classes ) { |
|
76 | + public function give_set_single_summary_classes($classes) { |
|
77 | 77 | |
78 | 78 | //Add full width class when feature image is disabled AND no widgets are present |
79 | - if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
79 | + if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
80 | 80 | $classes .= ' give-full-width'; |
81 | 81 | } |
82 | 82 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function give_output_sidebar_option() { |
98 | 98 | |
99 | 99 | //Add full width class when feature image is disabled AND no widgets are present |
100 | - if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
100 | + if (give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
101 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
102 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
103 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
104 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string $template |
125 | 125 | */ |
126 | - public static function template_loader( $template ) { |
|
127 | - $find = array( 'give.php' ); |
|
126 | + public static function template_loader($template) { |
|
127 | + $find = array('give.php'); |
|
128 | 128 | $file = ''; |
129 | 129 | |
130 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
130 | + if (is_single() && get_post_type() == 'give_forms') { |
|
131 | 131 | $file = 'single-give-form.php'; |
132 | 132 | $find[] = $file; |
133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
133 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( $file ) { |
|
137 | - $template = locate_template( array_unique( $find ) ); |
|
138 | - if ( ! $template ) { |
|
139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
136 | + if ($file) { |
|
137 | + $template = locate_template(array_unique($find)); |
|
138 | + if ( ! $template) { |
|
139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return bool $ret True if guest checkout is enabled, false otherwise |
29 | 29 | */ |
30 | -function give_no_guest_checkout( $form_id ) { |
|
30 | +function give_no_guest_checkout($form_id) { |
|
31 | 31 | |
32 | 32 | $backtrace = debug_backtrace(); |
33 | 33 | |
34 | - _give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace ); |
|
34 | + _give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace); |
|
35 | 35 | |
36 | - $ret = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
36 | + $ret = get_post_meta($form_id, '_give_logged_in_only', true); |
|
37 | 37 | |
38 | - return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) ); |
|
38 | + return (bool) apply_filters('give_no_guest_checkout', give_is_setting_enabled($ret)); |
|
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Page' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Page. |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | // Get current setting page. |
63 | 63 | $this->current_setting_page = give_get_current_setting_page(); |
64 | 64 | |
65 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
66 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
67 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections' ) ); |
|
68 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
69 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
65 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
66 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
67 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array($this, 'output_sections')); |
|
68 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
69 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param $setting_tab |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - function set_default_setting_tab( $setting_tab ) { |
|
79 | + function set_default_setting_tab($setting_tab) { |
|
80 | 80 | return $this->default_tab; |
81 | 81 | } |
82 | 82 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * @param array $pages Lst of pages. |
88 | 88 | * @return array |
89 | 89 | */ |
90 | - public function add_settings_page( $pages ) { |
|
91 | - $pages[ $this->id ] = $this->label; |
|
90 | + public function add_settings_page($pages) { |
|
91 | + $pages[$this->id] = $this->label; |
|
92 | 92 | |
93 | 93 | return $pages; |
94 | 94 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @since 1.8 |
107 | 107 | * @param array $settings |
108 | 108 | */ |
109 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
109 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
110 | 110 | |
111 | 111 | // Output. |
112 | 112 | return $settings; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return array |
120 | 120 | */ |
121 | 121 | public function get_sections() { |
122 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
122 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | // Bailout. |
140 | - if ( empty( $sections ) || 1 === sizeof( $sections ) ) { |
|
140 | + if (empty($sections) || 1 === sizeof($sections)) { |
|
141 | 141 | return; |
142 | 142 | } |
143 | 143 | |
144 | - if( is_null( $this->current_setting_page ) ) { |
|
144 | + if (is_null($this->current_setting_page)) { |
|
145 | 145 | $this->current_setting_page = give_get_current_setting_page(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | echo '<ul class="subsubsub">'; |
149 | 149 | |
150 | 150 | // Get section keys. |
151 | - $array_keys = array_keys( $sections ); |
|
151 | + $array_keys = array_keys($sections); |
|
152 | 152 | |
153 | - foreach ( $sections as $id => $label ) { |
|
154 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
153 | + foreach ($sections as $id => $label) { |
|
154 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | echo '</ul><br class="clear" />'; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function output() { |
167 | 167 | $settings = $this->get_settings(); |
168 | 168 | |
169 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
169 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | $settings = $this->get_settings(); |
180 | 180 | $current_section = give_get_current_setting_section(); |
181 | 181 | |
182 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
182 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Trigger Action |
186 | 186 | * |
187 | 187 | * @since 1.8 |
188 | 188 | */ |
189 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
189 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 |
@@ -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 | |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_add_shortcode_to_publish_metabox() { |
24 | 24 | |
25 | - if ( 'give_forms' !== get_post_type() ) { |
|
25 | + if ('give_forms' !== get_post_type()) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | global $post; |
29 | 29 | |
30 | 30 | //Shortcode column with select all input |
31 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
32 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
31 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
32 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
35 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function give_logs_view_sales() { |
26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
27 | 27 | |
28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | function give_logs_view_gateway_errors() { |
46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
47 | 47 | |
48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
49 | 49 | $logs_table->prepare_items(); |
50 | 50 | $logs_table->display(); |
51 | 51 | } |
52 | 52 | |
53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * API Request Logs |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return void |
63 | 63 | */ |
64 | 64 | function give_logs_view_api_requests() { |
65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
66 | 66 | |
67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
68 | 68 | $logs_table->prepare_items(); |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.0 |
77 | 77 | */ |
78 | - do_action( 'give_logs_api_requests_top' ); |
|
78 | + do_action('give_logs_api_requests_top'); |
|
79 | 79 | ?> |
80 | 80 | |
81 | 81 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
82 | 82 | <?php |
83 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
83 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
84 | 84 | $logs_table->display(); |
85 | 85 | ?> |
86 | 86 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.0 |
95 | 95 | */ |
96 | - do_action( 'give_logs_api_requests_bottom' ); |
|
96 | + do_action('give_logs_api_requests_bottom'); |
|
97 | 97 | ?> |
98 | 98 | |
99 | 99 | </div> |
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | |
103 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
103 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | /** |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | */ |
112 | 112 | function give_log_default_views() { |
113 | 113 | $views = array( |
114 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
115 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
116 | - 'api_requests' => esc_html__( 'API Requests', 'give' ) |
|
114 | + 'sales' => esc_html__('Donations', 'give'), |
|
115 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
116 | + 'api_requests' => esc_html__('API Requests', 'give') |
|
117 | 117 | ); |
118 | 118 | |
119 | - $views = apply_filters( 'give_log_views', $views ); |
|
119 | + $views = apply_filters('give_log_views', $views); |
|
120 | 120 | |
121 | 121 | return $views; |
122 | 122 | } |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | */ |
130 | 130 | function give_log_views() { |
131 | 131 | $views = give_log_default_views(); |
132 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
132 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
133 | 133 | ?> |
134 | 134 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
135 | 135 | <select id="give-logs-view" name="view"> |
136 | 136 | <optgroup label="Log Type:"> |
137 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
138 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
137 | + <?php foreach ($views as $view_id => $label): ?> |
|
138 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
139 | 139 | <?php endforeach; ?> |
140 | 140 | </optgroup> |
141 | 141 | </select> |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | */ |
151 | - do_action( 'give_log_view_actions' ); |
|
151 | + do_action('give_log_view_actions'); |
|
152 | 152 | ?> |
153 | 153 | |
154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
155 | 155 | <input type="hidden" name="page" value="give-tools"/> |
156 | 156 | <input type="hidden" name="tab" value="logs"/> |
157 | 157 | |
158 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
158 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
159 | 159 | </form> |
160 | 160 | <?php |
161 | 161 | } |
162 | 162 | \ No newline at end of file |