@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = __( 'Display Options', 'give' ); |
|
30 | + $this->label = __('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,65 +53,65 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => __('Default Give Styles', 'give'), |
|
57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
67 | + 'name' => __('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
70 | 70 | 'a' => array( |
71 | 71 | 'href' => array(), |
72 | 72 | 'target' => array(), |
73 | 73 | ), |
74 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
74 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
75 | 75 | 'id' => 'floatlabels', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'default' => 'disabled', |
78 | 78 | 'options' => array( |
79 | - 'enabled' => __( 'Enabled', 'give' ), |
|
80 | - 'disabled' => __( 'Disabled', 'give' ), |
|
79 | + 'enabled' => __('Enabled', 'give'), |
|
80 | + 'disabled' => __('Disabled', 'give'), |
|
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
84 | + 'name' => __('Welcome Screen', 'give'), |
|
85 | 85 | /* translators: %s: about page URL */ |
86 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( |
|
86 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array( |
|
87 | 87 | 'a' => array( |
88 | 88 | 'href' => array(), |
89 | 89 | 'target' => array(), |
90 | 90 | ), |
91 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
91 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
92 | 92 | 'id' => 'welcome', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Name Title Prefix', 'give' ), |
|
102 | - 'desc' => __( 'Do you want a Name Title Prefix field to appear before First Name?', 'give' ), |
|
101 | + 'name' => __('Name Title Prefix', 'give'), |
|
102 | + 'desc' => __('Do you want a Name Title Prefix field to appear before First Name?', 'give'), |
|
103 | 103 | 'id' => 'name_title_prefix', |
104 | 104 | 'type' => 'radio_inline', |
105 | 105 | 'default' => 'disabled', |
106 | 106 | 'options' => array( |
107 | - 'disabled' => __( 'Disabled', 'give' ), |
|
108 | - 'required' => __( 'Required', 'give' ), |
|
109 | - 'optional' => __( 'Optional', 'give' ), |
|
107 | + 'disabled' => __('Disabled', 'give'), |
|
108 | + 'required' => __('Required', 'give'), |
|
109 | + 'optional' => __('Optional', 'give'), |
|
110 | 110 | ), |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Title Prefixes', 'give' ), |
|
114 | - 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
|
113 | + 'name' => __('Title Prefixes', 'give'), |
|
114 | + 'desc' => __('Add or remove salutations from the dropdown using the field above.', 'give'), |
|
115 | 115 | 'id' => 'title_prefixes', |
116 | 116 | 'type' => 'chosen', |
117 | 117 | 'data_type' => 'multiselect', |
@@ -120,44 +120,44 @@ discard block |
||
120 | 120 | 'options' => give_get_default_title_prefixes(), |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Company Field', 'give' ), |
|
124 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name fields on all donation forms? You can enable this option per form as well.', 'give' ), |
|
123 | + 'name' => __('Company Field', 'give'), |
|
124 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name fields on all donation forms? You can enable this option per form as well.', 'give'), |
|
125 | 125 | 'id' => 'company_field', |
126 | 126 | 'type' => 'radio_inline', |
127 | 127 | 'default' => 'disabled', |
128 | 128 | 'options' => array( |
129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
130 | - 'required' => __( 'Required', 'give' ), |
|
131 | - 'optional' => __( 'Optional', 'give' ), |
|
129 | + 'disabled' => __('Disabled', 'give'), |
|
130 | + 'required' => __('Required', 'give'), |
|
131 | + 'optional' => __('Optional', 'give'), |
|
132 | 132 | ), |
133 | 133 | ), |
134 | 134 | array( |
135 | - 'name' => __( 'Anonymous Donations', 'give' ), |
|
136 | - 'desc' => __( 'Do you want to provide donors the ability mark themselves anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
|
135 | + 'name' => __('Anonymous Donations', 'give'), |
|
136 | + 'desc' => __('Do you want to provide donors the ability mark themselves anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give'), |
|
137 | 137 | 'id' => 'anonymous_donation', |
138 | 138 | 'type' => 'radio_inline', |
139 | 139 | 'default' => 'disabled', |
140 | 140 | 'options' => array( |
141 | - 'enabled' => __( 'Enabled', 'give' ), |
|
142 | - 'disabled' => __( 'Disabled', 'give' ), |
|
141 | + 'enabled' => __('Enabled', 'give'), |
|
142 | + 'disabled' => __('Disabled', 'give'), |
|
143 | 143 | ), |
144 | 144 | ), |
145 | 145 | array( |
146 | - 'name' => __( 'Donor Comments', 'give' ), |
|
147 | - 'desc' => __( 'Do you want to provide donors the ability to add a comment to their donation? The comment will display publicly on the donor wall if they do not select to give anonymously.', 'give' ), |
|
146 | + 'name' => __('Donor Comments', 'give'), |
|
147 | + 'desc' => __('Do you want to provide donors the ability to add a comment to their donation? The comment will display publicly on the donor wall if they do not select to give anonymously.', 'give'), |
|
148 | 148 | 'id' => 'donor_comment', |
149 | 149 | 'type' => 'radio_inline', |
150 | 150 | 'default' => 'disabled', |
151 | 151 | 'options' => array( |
152 | - 'enabled' => __( 'Enabled', 'give' ), |
|
153 | - 'disabled' => __( 'Disabled', 'give' ), |
|
152 | + 'enabled' => __('Enabled', 'give'), |
|
153 | + 'disabled' => __('Disabled', 'give'), |
|
154 | 154 | ), |
155 | 155 | ), |
156 | 156 | array( |
157 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
157 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
158 | 158 | 'id' => 'display_settings_docs_link', |
159 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
160 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
159 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
160 | + 'title' => __('Display Options Settings', 'give'), |
|
161 | 161 | 'type' => 'give_docs_link', |
162 | 162 | ), |
163 | 163 | array( |
@@ -174,78 +174,78 @@ discard block |
||
174 | 174 | 'type' => 'title', |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => __( 'Form Single Views', 'give' ), |
|
178 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
177 | + 'name' => __('Form Single Views', 'give'), |
|
178 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
179 | 179 | 'id' => 'forms_singular', |
180 | 180 | 'type' => 'radio_inline', |
181 | 181 | 'default' => 'enabled', |
182 | 182 | 'options' => array( |
183 | - 'enabled' => __( 'Enabled', 'give' ), |
|
184 | - 'disabled' => __( 'Disabled', 'give' ), |
|
183 | + 'enabled' => __('Enabled', 'give'), |
|
184 | + 'disabled' => __('Disabled', 'give'), |
|
185 | 185 | ), |
186 | 186 | ), |
187 | 187 | array( |
188 | - 'name' => __( 'Form Archives', 'give' ), |
|
189 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( |
|
188 | + 'name' => __('Form Archives', 'give'), |
|
189 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array( |
|
190 | 190 | 'a' => array( |
191 | 191 | 'href' => array(), |
192 | 192 | 'target' => array(), |
193 | 193 | ), |
194 | - ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
194 | + )), esc_url(admin_url('options-permalink.php'))), |
|
195 | 195 | 'id' => 'forms_archives', |
196 | 196 | 'type' => 'radio_inline', |
197 | 197 | 'default' => 'enabled', |
198 | 198 | 'options' => array( |
199 | - 'enabled' => __( 'Enabled', 'give' ), |
|
200 | - 'disabled' => __( 'Disabled', 'give' ), |
|
199 | + 'enabled' => __('Enabled', 'give'), |
|
200 | + 'disabled' => __('Disabled', 'give'), |
|
201 | 201 | ), |
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
205 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
204 | + 'name' => __('Form Excerpts', 'give'), |
|
205 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
206 | 206 | 'id' => 'forms_excerpt', |
207 | 207 | 'type' => 'radio_inline', |
208 | 208 | 'default' => 'enabled', |
209 | 209 | 'options' => array( |
210 | - 'enabled' => __( 'Enabled', 'give' ), |
|
211 | - 'disabled' => __( 'Disabled', 'give' ), |
|
210 | + 'enabled' => __('Enabled', 'give'), |
|
211 | + 'disabled' => __('Disabled', 'give'), |
|
212 | 212 | ), |
213 | 213 | ), |
214 | 214 | array( |
215 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
216 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
215 | + 'name' => __('Form Featured Image', 'give'), |
|
216 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
217 | 217 | 'id' => 'form_featured_img', |
218 | 218 | 'type' => 'radio_inline', |
219 | 219 | 'default' => 'enabled', |
220 | 220 | 'options' => array( |
221 | - 'enabled' => __( 'Enabled', 'give' ), |
|
222 | - 'disabled' => __( 'Disabled', 'give' ), |
|
221 | + 'enabled' => __('Enabled', 'give'), |
|
222 | + 'disabled' => __('Disabled', 'give'), |
|
223 | 223 | ), |
224 | 224 | ), |
225 | 225 | array( |
226 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
227 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
226 | + 'name' => __('Featured Image Size', 'give'), |
|
227 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
228 | 228 | 'id' => 'featured_image_size', |
229 | 229 | 'type' => 'select', |
230 | 230 | 'default' => 'large', |
231 | 231 | 'options' => give_get_featured_image_sizes(), |
232 | 232 | ), |
233 | 233 | array( |
234 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
235 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
234 | + 'name' => __('Single Form Sidebar', 'give'), |
|
235 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
236 | 236 | 'id' => 'form_sidebar', |
237 | 237 | 'type' => 'radio_inline', |
238 | 238 | 'default' => 'enabled', |
239 | 239 | 'options' => array( |
240 | - 'enabled' => __( 'Enabled', 'give' ), |
|
241 | - 'disabled' => __( 'Disabled', 'give' ), |
|
240 | + 'enabled' => __('Enabled', 'give'), |
|
241 | + 'disabled' => __('Disabled', 'give'), |
|
242 | 242 | ), |
243 | 243 | ), |
244 | 244 | array( |
245 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
245 | + 'name' => __('Post Types Docs Link', 'give'), |
|
246 | 246 | 'id' => 'post_types_settings_docs_link', |
247 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
248 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
247 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
248 | + 'title' => __('Post Types Settings', 'give'), |
|
249 | 249 | 'type' => 'give_docs_link', |
250 | 250 | ), |
251 | 251 | array( |
@@ -262,32 +262,32 @@ discard block |
||
262 | 262 | 'type' => 'title', |
263 | 263 | ), |
264 | 264 | array( |
265 | - 'name' => __( 'Form Categories', 'give' ), |
|
266 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
265 | + 'name' => __('Form Categories', 'give'), |
|
266 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
267 | 267 | 'id' => 'categories', |
268 | 268 | 'type' => 'radio_inline', |
269 | 269 | 'default' => 'disabled', |
270 | 270 | 'options' => array( |
271 | - 'enabled' => __( 'Enabled', 'give' ), |
|
272 | - 'disabled' => __( 'Disabled', 'give' ), |
|
271 | + 'enabled' => __('Enabled', 'give'), |
|
272 | + 'disabled' => __('Disabled', 'give'), |
|
273 | 273 | ), |
274 | 274 | ), |
275 | 275 | array( |
276 | - 'name' => __( 'Form Tags', 'give' ), |
|
277 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
276 | + 'name' => __('Form Tags', 'give'), |
|
277 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
278 | 278 | 'id' => 'tags', |
279 | 279 | 'type' => 'radio_inline', |
280 | 280 | 'default' => 'disabled', |
281 | 281 | 'options' => array( |
282 | - 'enabled' => __( 'Enabled', 'give' ), |
|
283 | - 'disabled' => __( 'Disabled', 'give' ), |
|
282 | + 'enabled' => __('Enabled', 'give'), |
|
283 | + 'disabled' => __('Disabled', 'give'), |
|
284 | 284 | ), |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
287 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
288 | 288 | 'id' => 'taxonomies_settings_docs_link', |
289 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
290 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
289 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
290 | + 'title' => __('Taxonomies Settings', 'give'), |
|
291 | 291 | 'type' => 'give_docs_link', |
292 | 292 | ), |
293 | 293 | array( |
@@ -304,37 +304,37 @@ discard block |
||
304 | 304 | 'type' => 'title', |
305 | 305 | ), |
306 | 306 | array( |
307 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
308 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
307 | + 'name' => __('Terms and Conditions', 'give'), |
|
308 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
309 | 309 | 'id' => 'terms', |
310 | 310 | 'type' => 'radio_inline', |
311 | 311 | 'default' => 'disabled', |
312 | 312 | 'options' => array( |
313 | - 'enabled' => __( 'Enabled', 'give' ), |
|
314 | - 'disabled' => __( 'Disabled', 'give' ), |
|
313 | + 'enabled' => __('Enabled', 'give'), |
|
314 | + 'disabled' => __('Disabled', 'give'), |
|
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
319 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
318 | + 'name' => __('Agree to Terms Label', 'give'), |
|
319 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
320 | 320 | 'id' => 'agree_to_terms_label', |
321 | 321 | 'attributes' => array( |
322 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
322 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
323 | 323 | 'rows' => 1 |
324 | 324 | ), |
325 | 325 | 'type' => 'textarea', |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'name' => __( 'Agreement Text', 'give' ), |
|
329 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
328 | + 'name' => __('Agreement Text', 'give'), |
|
329 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
330 | 330 | 'id' => 'agreement_text', |
331 | 331 | 'type' => 'wysiwyg', |
332 | 332 | ), |
333 | 333 | array( |
334 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
334 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
335 | 335 | 'id' => 'terms_settings_docs_link', |
336 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
337 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
336 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
337 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
338 | 338 | 'type' => 'give_docs_link', |
339 | 339 | ), |
340 | 340 | array( |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * Filter the display options settings. |
350 | 350 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
351 | 351 | */ |
352 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
352 | + $settings = apply_filters('give_settings_display', $settings); |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Filter the settings. |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param array $settings |
360 | 360 | */ |
361 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
361 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
362 | 362 | |
363 | 363 | // Output. |
364 | 364 | return $settings; |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function get_sections() { |
374 | 374 | $sections = array( |
375 | - 'display-settings' => __( 'Display', 'give' ), |
|
376 | - 'post-types' => __( 'Post Types', 'give' ), |
|
377 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
378 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ), |
|
375 | + 'display-settings' => __('Display', 'give'), |
|
376 | + 'post-types' => __('Post Types', 'give'), |
|
377 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
378 | + 'term-and-conditions' => __('Terms and Conditions', 'give'), |
|
379 | 379 | ); |
380 | 380 | |
381 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
381 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | |
65 | 65 | // Maintain active tab query parameter after save. |
66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function get_settings() { |
89 | 89 | $post_id = give_get_admin_post_id(); |
90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
91 | 91 | |
92 | 92 | // Start with an underscore to hide fields from custom fields list |
93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Repeatable Field Groups |
98 | 98 | */ |
99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
100 | 100 | 'id' => 'form_field_options', |
101 | - 'title' => __( 'Donation Options', 'give' ), |
|
101 | + 'title' => __('Donation Options', 'give'), |
|
102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
104 | 104 | // Donation Option. |
105 | 105 | array( |
106 | - 'name' => __( 'Donation Option', 'give' ), |
|
107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
108 | - 'id' => $prefix . 'price_option', |
|
106 | + 'name' => __('Donation Option', 'give'), |
|
107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
108 | + 'id' => $prefix.'price_option', |
|
109 | 109 | 'type' => 'radio_inline', |
110 | 110 | 'default' => 'multi', |
111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
113 | - 'set' => __( 'Set Donation', 'give' ), |
|
114 | - ) ), |
|
111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
113 | + 'set' => __('Set Donation', 'give'), |
|
114 | + )), |
|
115 | 115 | ), |
116 | 116 | array( |
117 | - 'name' => __( 'Set Donation', 'give' ), |
|
118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
119 | - 'id' => $prefix . 'set_price', |
|
117 | + 'name' => __('Set Donation', 'give'), |
|
118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
119 | + 'id' => $prefix.'set_price', |
|
120 | 120 | 'type' => 'text_small', |
121 | 121 | 'data_type' => 'price', |
122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | ), |
127 | 127 | // Display Style. |
128 | 128 | array( |
129 | - 'name' => __( 'Display Style', 'give' ), |
|
130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
131 | - 'id' => $prefix . 'display_style', |
|
129 | + 'name' => __('Display Style', 'give'), |
|
130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
131 | + 'id' => $prefix.'display_style', |
|
132 | 132 | 'type' => 'radio_inline', |
133 | 133 | 'default' => 'buttons', |
134 | 134 | 'options' => array( |
135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
136 | - 'radios' => __( 'Radios', 'give' ), |
|
137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
135 | + 'buttons' => __('Buttons', 'give'), |
|
136 | + 'radios' => __('Radios', 'give'), |
|
137 | + 'dropdown' => __('Dropdown', 'give'), |
|
138 | 138 | ), |
139 | 139 | 'wrapper_class' => 'give-hidden', |
140 | 140 | ), |
141 | 141 | // Custom Amount. |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'disabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Donation Limit', 'give' ), |
|
155 | - 'description' => __( 'Set the minimum and maximum amount for all gateways.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_range', |
|
154 | + 'name' => __('Donation Limit', 'give'), |
|
155 | + 'description' => __('Set the minimum and maximum amount for all gateways.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_range', |
|
157 | 157 | 'type' => 'donation_limit', |
158 | 158 | 'wrapper_class' => 'give-hidden', |
159 | 159 | 'data_type' => 'price', |
@@ -162,43 +162,43 @@ discard block |
||
162 | 162 | 'class' => 'give-money-field', |
163 | 163 | ), |
164 | 164 | 'options' => array( |
165 | - 'display_label' => __( 'Donation Limits: ', 'give' ), |
|
166 | - 'minimum' => give_format_decimal( '1.00', false, false ), |
|
167 | - 'maximum' => give_format_decimal( '999999.99', false, false ), |
|
165 | + 'display_label' => __('Donation Limits: ', 'give'), |
|
166 | + 'minimum' => give_format_decimal('1.00', false, false), |
|
167 | + 'maximum' => give_format_decimal('999999.99', false, false), |
|
168 | 168 | ), |
169 | 169 | ), |
170 | 170 | array( |
171 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
172 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
173 | - 'id' => $prefix . 'custom_amount_text', |
|
171 | + 'name' => __('Custom Amount Text', 'give'), |
|
172 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
173 | + 'id' => $prefix.'custom_amount_text', |
|
174 | 174 | 'type' => 'text_medium', |
175 | 175 | 'attributes' => array( |
176 | 176 | 'rows' => 3, |
177 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
177 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
178 | 178 | ), |
179 | 179 | 'wrapper_class' => 'give-hidden', |
180 | 180 | ), |
181 | 181 | // Donation Levels. |
182 | 182 | array( |
183 | - 'id' => $prefix . 'donation_levels', |
|
183 | + 'id' => $prefix.'donation_levels', |
|
184 | 184 | 'type' => 'group', |
185 | 185 | 'options' => array( |
186 | - 'add_button' => __( 'Add Level', 'give' ), |
|
187 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
186 | + 'add_button' => __('Add Level', 'give'), |
|
187 | + 'header_title' => __('Donation Level', 'give'), |
|
188 | 188 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
189 | 189 | ), |
190 | 190 | 'wrapper_class' => 'give-hidden', |
191 | 191 | // Fields array works the same, except id's only need to be unique for this group. |
192 | 192 | // Prefix is not needed. |
193 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
193 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
194 | 194 | array( |
195 | - 'name' => __( 'ID', 'give' ), |
|
196 | - 'id' => $prefix . 'id', |
|
195 | + 'name' => __('ID', 'give'), |
|
196 | + 'id' => $prefix.'id', |
|
197 | 197 | 'type' => 'levels_id', |
198 | 198 | ), |
199 | 199 | array( |
200 | - 'name' => __( 'Amount', 'give' ), |
|
201 | - 'id' => $prefix . 'amount', |
|
200 | + 'name' => __('Amount', 'give'), |
|
201 | + 'id' => $prefix.'amount', |
|
202 | 202 | 'type' => 'text_small', |
203 | 203 | 'data_type' => 'price', |
204 | 204 | 'attributes' => array( |
@@ -207,95 +207,95 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | array( |
210 | - 'name' => __( 'Text', 'give' ), |
|
211 | - 'id' => $prefix . 'text', |
|
210 | + 'name' => __('Text', 'give'), |
|
211 | + 'id' => $prefix.'text', |
|
212 | 212 | 'type' => 'text', |
213 | 213 | 'attributes' => array( |
214 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
214 | + 'placeholder' => __('Donation Level', 'give'), |
|
215 | 215 | 'class' => 'give-multilevel-text-field', |
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => __( 'Default', 'give' ), |
|
220 | - 'id' => $prefix . 'default', |
|
219 | + 'name' => __('Default', 'give'), |
|
220 | + 'id' => $prefix.'default', |
|
221 | 221 | 'type' => 'give_default_radio_inline', |
222 | 222 | ), |
223 | - ) ), |
|
223 | + )), |
|
224 | 224 | ), |
225 | 225 | array( |
226 | 226 | 'name' => 'donation_options_docs', |
227 | 227 | 'type' => 'docs_link', |
228 | 228 | 'url' => 'http://docs.givewp.com/form-donation-options', |
229 | - 'title' => __( 'Donation Options', 'give' ), |
|
229 | + 'title' => __('Donation Options', 'give'), |
|
230 | 230 | ), |
231 | 231 | ), |
232 | 232 | $post_id |
233 | 233 | ), |
234 | - ) ), |
|
234 | + )), |
|
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Display Options |
238 | 238 | */ |
239 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
239 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
240 | 240 | 'id' => 'form_display_options', |
241 | - 'title' => __( 'Form Display', 'give' ), |
|
241 | + 'title' => __('Form Display', 'give'), |
|
242 | 242 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
243 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
243 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
244 | 244 | array( |
245 | - 'name' => __( 'Display Options', 'give' ), |
|
246 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
247 | - 'id' => $prefix . 'payment_display', |
|
245 | + 'name' => __('Display Options', 'give'), |
|
246 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
247 | + 'id' => $prefix.'payment_display', |
|
248 | 248 | 'type' => 'radio_inline', |
249 | 249 | 'options' => array( |
250 | - 'onpage' => __( 'All Fields', 'give' ), |
|
251 | - 'modal' => __( 'Modal', 'give' ), |
|
252 | - 'reveal' => __( 'Reveal', 'give' ), |
|
253 | - 'button' => __( 'Button', 'give' ), |
|
250 | + 'onpage' => __('All Fields', 'give'), |
|
251 | + 'modal' => __('Modal', 'give'), |
|
252 | + 'reveal' => __('Reveal', 'give'), |
|
253 | + 'button' => __('Button', 'give'), |
|
254 | 254 | ), |
255 | 255 | 'default' => 'onpage', |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'id' => $prefix . 'reveal_label', |
|
259 | - 'name' => __( 'Continue Button', 'give' ), |
|
260 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
258 | + 'id' => $prefix.'reveal_label', |
|
259 | + 'name' => __('Continue Button', 'give'), |
|
260 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
261 | 261 | 'type' => 'text_small', |
262 | 262 | 'attributes' => array( |
263 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
263 | + 'placeholder' => __('Donate Now', 'give'), |
|
264 | 264 | ), |
265 | 265 | 'wrapper_class' => 'give-hidden', |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Name Title Prefix', 'give' ), |
|
284 | - 'desc' => __( 'Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give' ), |
|
285 | - 'id' => $prefix . 'name_title_prefix', |
|
283 | + 'name' => __('Name Title Prefix', 'give'), |
|
284 | + 'desc' => __('Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give'), |
|
285 | + 'id' => $prefix.'name_title_prefix', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'options' => array( |
288 | - 'global' => __( 'Global Option', 'give' ), |
|
289 | - 'required' => __( 'Required', 'give' ), |
|
290 | - 'optional' => __( 'Optional', 'give' ), |
|
291 | - 'disabled' => __( 'Disabled', 'give' ), |
|
288 | + 'global' => __('Global Option', 'give'), |
|
289 | + 'required' => __('Required', 'give'), |
|
290 | + 'optional' => __('Optional', 'give'), |
|
291 | + 'disabled' => __('Disabled', 'give'), |
|
292 | 292 | ), |
293 | 293 | 'default' => 'global', |
294 | 294 | ), |
295 | 295 | array( |
296 | - 'name' => __( 'Title Prefixes', 'give' ), |
|
297 | - 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
|
298 | - 'id' => $prefix . 'title_prefixes', |
|
296 | + 'name' => __('Title Prefixes', 'give'), |
|
297 | + 'desc' => __('Add or remove salutations from the dropdown using the field above.', 'give'), |
|
298 | + 'id' => $prefix.'title_prefixes', |
|
299 | 299 | 'type' => 'chosen', |
300 | 300 | 'data_type' => 'multiselect', |
301 | 301 | 'style' => 'width: 100%', |
@@ -303,77 +303,77 @@ discard block |
||
303 | 303 | 'options' => give_get_default_title_prefixes(), |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => __( 'Company Donations', 'give' ), |
|
307 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
|
308 | - 'id' => $prefix . 'company_field', |
|
306 | + 'name' => __('Company Donations', 'give'), |
|
307 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name?', 'give'), |
|
308 | + 'id' => $prefix.'company_field', |
|
309 | 309 | 'type' => 'radio_inline', |
310 | 310 | 'default' => 'global', |
311 | 311 | 'options' => array( |
312 | - 'global' => __( 'Global Option', 'give' ), |
|
313 | - 'required' => __( 'Required', 'give' ), |
|
314 | - 'optional' => __( 'Optional', 'give' ), |
|
315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
312 | + 'global' => __('Global Option', 'give'), |
|
313 | + 'required' => __('Required', 'give'), |
|
314 | + 'optional' => __('Optional', 'give'), |
|
315 | + 'disabled' => __('Disabled', 'give'), |
|
316 | 316 | |
317 | 317 | ), |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Anonymous Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to provide donors the ability mark themselves anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
|
320 | + 'name' => __('Anonymous Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to provide donors the ability mark themselves anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give'), |
|
322 | 322 | 'id' => "{$prefix}anonymous_donation", |
323 | 323 | 'type' => 'radio_inline', |
324 | 324 | 'default' => 'global', |
325 | 325 | 'options' => array( |
326 | - 'global' => __( 'Global Option', 'give' ), |
|
327 | - 'enabled' => __( 'Enabled', 'give' ), |
|
328 | - 'disabled' => __( 'Disabled', 'give' ), |
|
326 | + 'global' => __('Global Option', 'give'), |
|
327 | + 'enabled' => __('Enabled', 'give'), |
|
328 | + 'disabled' => __('Disabled', 'give'), |
|
329 | 329 | ), |
330 | 330 | ), |
331 | 331 | array( |
332 | - 'name' => __( 'Donor Comments', 'give' ), |
|
333 | - 'desc' => __( 'Do you want to provide donors the ability to add a comment to their donation? The comment will display publicly on the donor wall if they do not select to give anonymously.', 'give' ), |
|
332 | + 'name' => __('Donor Comments', 'give'), |
|
333 | + 'desc' => __('Do you want to provide donors the ability to add a comment to their donation? The comment will display publicly on the donor wall if they do not select to give anonymously.', 'give'), |
|
334 | 334 | 'id' => "{$prefix}donor_comment", |
335 | 335 | 'type' => 'radio_inline', |
336 | 336 | 'default' => 'global', |
337 | 337 | 'options' => array( |
338 | - 'global' => __( 'Global Option', 'give' ), |
|
339 | - 'enabled' => __( 'Enabled', 'give' ), |
|
340 | - 'disabled' => __( 'Disabled', 'give' ), |
|
338 | + 'global' => __('Global Option', 'give'), |
|
339 | + 'enabled' => __('Enabled', 'give'), |
|
340 | + 'disabled' => __('Disabled', 'give'), |
|
341 | 341 | ), |
342 | 342 | ), |
343 | 343 | array( |
344 | - 'name' => __( 'Guest Donations', 'give' ), |
|
345 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
346 | - 'id' => $prefix . 'logged_in_only', |
|
344 | + 'name' => __('Guest Donations', 'give'), |
|
345 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
346 | + 'id' => $prefix.'logged_in_only', |
|
347 | 347 | 'type' => 'radio_inline', |
348 | 348 | 'default' => 'enabled', |
349 | 349 | 'options' => array( |
350 | - 'enabled' => __( 'Enabled', 'give' ), |
|
351 | - 'disabled' => __( 'Disabled', 'give' ), |
|
350 | + 'enabled' => __('Enabled', 'give'), |
|
351 | + 'disabled' => __('Disabled', 'give'), |
|
352 | 352 | ), |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => __( 'Registration', 'give' ), |
|
356 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
357 | - 'id' => $prefix . 'show_register_form', |
|
355 | + 'name' => __('Registration', 'give'), |
|
356 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
357 | + 'id' => $prefix.'show_register_form', |
|
358 | 358 | 'type' => 'radio', |
359 | 359 | 'options' => array( |
360 | - 'none' => __( 'None', 'give' ), |
|
361 | - 'registration' => __( 'Registration', 'give' ), |
|
362 | - 'login' => __( 'Login', 'give' ), |
|
363 | - 'both' => __( 'Registration + Login', 'give' ), |
|
360 | + 'none' => __('None', 'give'), |
|
361 | + 'registration' => __('Registration', 'give'), |
|
362 | + 'login' => __('Login', 'give'), |
|
363 | + 'both' => __('Registration + Login', 'give'), |
|
364 | 364 | ), |
365 | 365 | 'default' => 'none', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Floating Labels', 'give' ), |
|
368 | + 'name' => __('Floating Labels', 'give'), |
|
369 | 369 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
370 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
371 | - 'id' => $prefix . 'form_floating_labels', |
|
370 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
371 | + 'id' => $prefix.'form_floating_labels', |
|
372 | 372 | 'type' => 'radio_inline', |
373 | 373 | 'options' => array( |
374 | - 'global' => __( 'Global Option', 'give' ), |
|
375 | - 'enabled' => __( 'Enabled', 'give' ), |
|
376 | - 'disabled' => __( 'Disabled', 'give' ), |
|
374 | + 'global' => __('Global Option', 'give'), |
|
375 | + 'enabled' => __('Enabled', 'give'), |
|
376 | + 'disabled' => __('Disabled', 'give'), |
|
377 | 377 | ), |
378 | 378 | 'default' => 'global', |
379 | 379 | ), |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | 'name' => 'form_display_docs', |
382 | 382 | 'type' => 'docs_link', |
383 | 383 | 'url' => 'http://docs.givewp.com/form-display-options', |
384 | - 'title' => __( 'Form Display', 'give' ), |
|
384 | + 'title' => __('Form Display', 'give'), |
|
385 | 385 | ), |
386 | 386 | ), |
387 | 387 | $post_id |
@@ -392,42 +392,42 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * Donation Goals |
394 | 394 | */ |
395 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
395 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
396 | 396 | 'id' => 'donation_goal_options', |
397 | - 'title' => __( 'Donation Goal', 'give' ), |
|
397 | + 'title' => __('Donation Goal', 'give'), |
|
398 | 398 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
399 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
399 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
400 | 400 | // Goals |
401 | 401 | array( |
402 | - 'name' => __( 'Donation Goal', 'give' ), |
|
403 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
404 | - 'id' => $prefix . 'goal_option', |
|
402 | + 'name' => __('Donation Goal', 'give'), |
|
403 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
404 | + 'id' => $prefix.'goal_option', |
|
405 | 405 | 'type' => 'radio_inline', |
406 | 406 | 'default' => 'disabled', |
407 | 407 | 'options' => array( |
408 | - 'enabled' => __( 'Enabled', 'give' ), |
|
409 | - 'disabled' => __( 'Disabled', 'give' ), |
|
408 | + 'enabled' => __('Enabled', 'give'), |
|
409 | + 'disabled' => __('Disabled', 'give'), |
|
410 | 410 | ), |
411 | 411 | ), |
412 | 412 | |
413 | 413 | array( |
414 | - 'name' => __( 'Goal Format', 'give' ), |
|
415 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ), |
|
416 | - 'id' => $prefix . 'goal_format', |
|
414 | + 'name' => __('Goal Format', 'give'), |
|
415 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give'), |
|
416 | + 'id' => $prefix.'goal_format', |
|
417 | 417 | 'type' => 'donation_form_goal', |
418 | 418 | 'default' => 'amount', |
419 | 419 | 'options' => array( |
420 | - 'amount' => __( 'Amount Raised', 'give' ), |
|
421 | - 'percentage' => __( 'Percentage Raised', 'give' ), |
|
422 | - 'donation' => __( 'Number of Donations', 'give' ), |
|
423 | - 'donors' => __( 'Number of Donors', 'give' ), |
|
420 | + 'amount' => __('Amount Raised', 'give'), |
|
421 | + 'percentage' => __('Percentage Raised', 'give'), |
|
422 | + 'donation' => __('Number of Donations', 'give'), |
|
423 | + 'donors' => __('Number of Donors', 'give'), |
|
424 | 424 | ), |
425 | 425 | ), |
426 | 426 | |
427 | 427 | array( |
428 | - 'name' => __( 'Goal Amount', 'give' ), |
|
429 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
430 | - 'id' => $prefix . 'set_goal', |
|
428 | + 'name' => __('Goal Amount', 'give'), |
|
429 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
430 | + 'id' => $prefix.'set_goal', |
|
431 | 431 | 'type' => 'text_small', |
432 | 432 | 'data_type' => 'price', |
433 | 433 | 'attributes' => array( |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | 'wrapper_class' => 'give-hidden', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'id' => $prefix . 'number_of_donation_goal', |
|
441 | - 'name' => __( 'Donation Goal', 'give' ), |
|
442 | - 'desc' => __( 'Set the total number of donations as a goal.', 'give' ), |
|
440 | + 'id' => $prefix.'number_of_donation_goal', |
|
441 | + 'name' => __('Donation Goal', 'give'), |
|
442 | + 'desc' => __('Set the total number of donations as a goal.', 'give'), |
|
443 | 443 | 'type' => 'number', |
444 | 444 | 'default' => 1, |
445 | 445 | 'attributes' => array( |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | ), |
448 | 448 | ), |
449 | 449 | array( |
450 | - 'id' => $prefix . 'number_of_donor_goal', |
|
451 | - 'name' => __( 'Donor Goal', 'give' ), |
|
452 | - 'desc' => __( 'Set the total number of donors as a goal.', 'give' ), |
|
450 | + 'id' => $prefix.'number_of_donor_goal', |
|
451 | + 'name' => __('Donor Goal', 'give'), |
|
452 | + 'desc' => __('Set the total number of donors as a goal.', 'give'), |
|
453 | 453 | 'type' => 'number', |
454 | 454 | 'default' => 1, |
455 | 455 | 'attributes' => array( |
@@ -457,85 +457,85 @@ discard block |
||
457 | 457 | ), |
458 | 458 | ), |
459 | 459 | array( |
460 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
461 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
462 | - 'id' => $prefix . 'goal_color', |
|
460 | + 'name' => __('Progress Bar Color', 'give'), |
|
461 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
462 | + 'id' => $prefix.'goal_color', |
|
463 | 463 | 'type' => 'colorpicker', |
464 | 464 | 'default' => '#2bc253', |
465 | 465 | 'wrapper_class' => 'give-hidden', |
466 | 466 | ), |
467 | 467 | |
468 | 468 | array( |
469 | - 'name' => __( 'Close Form', 'give' ), |
|
470 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
471 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
469 | + 'name' => __('Close Form', 'give'), |
|
470 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
471 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
472 | 472 | 'type' => 'radio_inline', |
473 | 473 | 'default' => 'disabled', |
474 | 474 | 'options' => array( |
475 | - 'enabled' => __( 'Enabled', 'give' ), |
|
476 | - 'disabled' => __( 'Disabled', 'give' ), |
|
475 | + 'enabled' => __('Enabled', 'give'), |
|
476 | + 'disabled' => __('Disabled', 'give'), |
|
477 | 477 | ), |
478 | 478 | 'wrapper_class' => 'give-hidden', |
479 | 479 | ), |
480 | 480 | array( |
481 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
482 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
483 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
481 | + 'name' => __('Goal Achieved Message', 'give'), |
|
482 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
483 | + 'id' => $prefix.'form_goal_achieved_message', |
|
484 | 484 | 'type' => 'wysiwyg', |
485 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
485 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
486 | 486 | 'wrapper_class' => 'give-hidden', |
487 | 487 | ), |
488 | 488 | array( |
489 | 489 | 'name' => 'donation_goal_docs', |
490 | 490 | 'type' => 'docs_link', |
491 | 491 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
492 | - 'title' => __( 'Donation Goal', 'give' ), |
|
492 | + 'title' => __('Donation Goal', 'give'), |
|
493 | 493 | ), |
494 | 494 | ), |
495 | 495 | $post_id |
496 | 496 | ), |
497 | - ) ), |
|
497 | + )), |
|
498 | 498 | |
499 | 499 | /** |
500 | 500 | * Content Field |
501 | 501 | */ |
502 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
502 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
503 | 503 | 'id' => 'form_content_options', |
504 | - 'title' => __( 'Form Content', 'give' ), |
|
504 | + 'title' => __('Form Content', 'give'), |
|
505 | 505 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
506 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
506 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
507 | 507 | |
508 | 508 | // Donation content. |
509 | 509 | array( |
510 | - 'name' => __( 'Display Content', 'give' ), |
|
511 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
512 | - 'id' => $prefix . 'display_content', |
|
510 | + 'name' => __('Display Content', 'give'), |
|
511 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
512 | + 'id' => $prefix.'display_content', |
|
513 | 513 | 'type' => 'radio_inline', |
514 | 514 | 'options' => array( |
515 | - 'enabled' => __( 'Enabled', 'give' ), |
|
516 | - 'disabled' => __( 'Disabled', 'give' ), |
|
515 | + 'enabled' => __('Enabled', 'give'), |
|
516 | + 'disabled' => __('Disabled', 'give'), |
|
517 | 517 | ), |
518 | 518 | 'default' => 'disabled', |
519 | 519 | ), |
520 | 520 | |
521 | 521 | // Content placement. |
522 | 522 | array( |
523 | - 'name' => __( 'Content Placement', 'give' ), |
|
524 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
525 | - 'id' => $prefix . 'content_placement', |
|
523 | + 'name' => __('Content Placement', 'give'), |
|
524 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
525 | + 'id' => $prefix.'content_placement', |
|
526 | 526 | 'type' => 'radio_inline', |
527 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
528 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
529 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
527 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
528 | + 'give_pre_form' => __('Above fields', 'give'), |
|
529 | + 'give_post_form' => __('Below fields', 'give'), |
|
530 | 530 | ) |
531 | 531 | ), |
532 | 532 | 'default' => 'give_pre_form', |
533 | 533 | 'wrapper_class' => 'give-hidden', |
534 | 534 | ), |
535 | 535 | array( |
536 | - 'name' => __( 'Content', 'give' ), |
|
537 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
538 | - 'id' => $prefix . 'form_content', |
|
536 | + 'name' => __('Content', 'give'), |
|
537 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
538 | + 'id' => $prefix.'form_content', |
|
539 | 539 | 'type' => 'wysiwyg', |
540 | 540 | 'wrapper_class' => 'give-hidden', |
541 | 541 | ), |
@@ -543,51 +543,51 @@ discard block |
||
543 | 543 | 'name' => 'form_content_docs', |
544 | 544 | 'type' => 'docs_link', |
545 | 545 | 'url' => 'http://docs.givewp.com/form-content', |
546 | - 'title' => __( 'Form Content', 'give' ), |
|
546 | + 'title' => __('Form Content', 'give'), |
|
547 | 547 | ), |
548 | 548 | ), |
549 | 549 | $post_id |
550 | 550 | ), |
551 | - ) ), |
|
551 | + )), |
|
552 | 552 | |
553 | 553 | /** |
554 | 554 | * Terms & Conditions |
555 | 555 | */ |
556 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
556 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
557 | 557 | 'id' => 'form_terms_options', |
558 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
558 | + 'title' => __('Terms & Conditions', 'give'), |
|
559 | 559 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
560 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
560 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
561 | 561 | // Donation Option |
562 | 562 | array( |
563 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
564 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
565 | - 'id' => $prefix . 'terms_option', |
|
563 | + 'name' => __('Terms and Conditions', 'give'), |
|
564 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
565 | + 'id' => $prefix.'terms_option', |
|
566 | 566 | 'type' => 'radio_inline', |
567 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
568 | - 'global' => __( 'Global Option', 'give' ), |
|
569 | - 'enabled' => __( 'Customize', 'give' ), |
|
570 | - 'disabled' => __( 'Disable', 'give' ), |
|
567 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
568 | + 'global' => __('Global Option', 'give'), |
|
569 | + 'enabled' => __('Customize', 'give'), |
|
570 | + 'disabled' => __('Disable', 'give'), |
|
571 | 571 | ) |
572 | 572 | ), |
573 | 573 | 'default' => 'global', |
574 | 574 | ), |
575 | 575 | array( |
576 | - 'id' => $prefix . 'agree_label', |
|
577 | - 'name' => __( 'Agreement Label', 'give' ), |
|
578 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
576 | + 'id' => $prefix.'agree_label', |
|
577 | + 'name' => __('Agreement Label', 'give'), |
|
578 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
579 | 579 | 'type' => 'textarea', |
580 | 580 | 'attributes' => array( |
581 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
581 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
582 | 582 | 'rows' => 1 |
583 | 583 | ), |
584 | 584 | 'wrapper_class' => 'give-hidden', |
585 | 585 | ), |
586 | 586 | array( |
587 | - 'id' => $prefix . 'agree_text', |
|
588 | - 'name' => __( 'Agreement Text', 'give' ), |
|
589 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
590 | - 'default' => give_get_option( 'agreement_text' ), |
|
587 | + 'id' => $prefix.'agree_text', |
|
588 | + 'name' => __('Agreement Text', 'give'), |
|
589 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
590 | + 'default' => give_get_option('agreement_text'), |
|
591 | 591 | 'type' => 'wysiwyg', |
592 | 592 | 'wrapper_class' => 'give-hidden', |
593 | 593 | ), |
@@ -595,18 +595,18 @@ discard block |
||
595 | 595 | 'name' => 'terms_docs', |
596 | 596 | 'type' => 'docs_link', |
597 | 597 | 'url' => 'http://docs.givewp.com/form-terms', |
598 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
598 | + 'title' => __('Terms and Conditions', 'give'), |
|
599 | 599 | ), |
600 | 600 | ), |
601 | 601 | $post_id |
602 | 602 | ), |
603 | - ) ), |
|
603 | + )), |
|
604 | 604 | ); |
605 | 605 | |
606 | 606 | /** |
607 | 607 | * Filter the metabox tabbed panel settings. |
608 | 608 | */ |
609 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
609 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
610 | 610 | |
611 | 611 | // Output. |
612 | 612 | return $settings; |
@@ -623,19 +623,19 @@ discard block |
||
623 | 623 | add_meta_box( |
624 | 624 | $this->get_metabox_ID(), |
625 | 625 | $this->get_metabox_label(), |
626 | - array( $this, 'output' ), |
|
627 | - array( 'give_forms' ), |
|
626 | + array($this, 'output'), |
|
627 | + array('give_forms'), |
|
628 | 628 | 'normal', |
629 | 629 | 'high' |
630 | 630 | ); |
631 | 631 | |
632 | 632 | // Show Goal Metabox only if goal is enabled. |
633 | - if ( give_is_setting_enabled( give_get_meta( give_get_admin_post_id(), '_give_goal_option', true ) ) ) { |
|
633 | + if (give_is_setting_enabled(give_get_meta(give_get_admin_post_id(), '_give_goal_option', true))) { |
|
634 | 634 | add_meta_box( |
635 | 635 | 'give-form-goal-stats', |
636 | - __( 'Goal Statistics', 'give' ), |
|
637 | - array( $this, 'output_goal' ), |
|
638 | - array( 'give_forms' ), |
|
636 | + __('Goal Statistics', 'give'), |
|
637 | + array($this, 'output_goal'), |
|
638 | + array('give_forms'), |
|
639 | 639 | 'side', |
640 | 640 | 'low' |
641 | 641 | ); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | function enqueue_script() { |
655 | 655 | global $post; |
656 | 656 | |
657 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
657 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
658 | 658 | |
659 | 659 | } |
660 | 660 | } |
@@ -692,32 +692,32 @@ discard block |
||
692 | 692 | public function get_tabs() { |
693 | 693 | $tabs = array(); |
694 | 694 | |
695 | - if ( ! empty( $this->settings ) ) { |
|
696 | - foreach ( $this->settings as $setting ) { |
|
697 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
695 | + if ( ! empty($this->settings)) { |
|
696 | + foreach ($this->settings as $setting) { |
|
697 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
698 | 698 | continue; |
699 | 699 | } |
700 | 700 | $tab = array( |
701 | 701 | 'id' => $setting['id'], |
702 | 702 | 'label' => $setting['title'], |
703 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
703 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
704 | 704 | ); |
705 | 705 | |
706 | - if ( $this->has_sub_tab( $setting ) ) { |
|
707 | - if ( empty( $setting['sub-fields'] ) ) { |
|
706 | + if ($this->has_sub_tab($setting)) { |
|
707 | + if (empty($setting['sub-fields'])) { |
|
708 | 708 | $tab = array(); |
709 | 709 | } else { |
710 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
710 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
711 | 711 | $tab['sub-fields'][] = array( |
712 | 712 | 'id' => $sub_fields['id'], |
713 | 713 | 'label' => $sub_fields['title'], |
714 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
714 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
715 | 715 | ); |
716 | 716 | } |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
720 | - if ( ! empty( $tab ) ) { |
|
720 | + if ( ! empty($tab)) { |
|
721 | 721 | $tabs[] = $tab; |
722 | 722 | } |
723 | 723 | } |
@@ -735,35 +735,35 @@ discard block |
||
735 | 735 | */ |
736 | 736 | public function output() { |
737 | 737 | // Bailout. |
738 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
739 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
740 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
738 | + if ($form_data_tabs = $this->get_tabs()) : |
|
739 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
740 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
741 | 741 | ?> |
742 | 742 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
743 | 743 | <div class="give-metabox-panel-wrap"> |
744 | 744 | <ul class="give-form-data-tabs give-metabox-tabs"> |
745 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
745 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
746 | 746 | <?php |
747 | 747 | // Determine if current tab is active. |
748 | 748 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
749 | 749 | ?> |
750 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
750 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
751 | 751 | <a href="#<?php echo $form_data_tab['id']; ?>" |
752 | 752 | data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
753 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
753 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
754 | 754 | <?php echo $form_data_tab['icon-html']; ?> |
755 | 755 | <?php else : ?> |
756 | 756 | <span class="give-icon give-icon-default"></span> |
757 | 757 | <?php endif; ?> |
758 | 758 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
759 | 759 | </a> |
760 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
760 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
761 | 761 | <ul class="give-metabox-sub-tabs give-hidden"> |
762 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
762 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
763 | 763 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
764 | 764 | <a href="#<?php echo $sub_tab['id']; ?>" |
765 | 765 | data-tab-id="<?php echo $sub_tab['id']; ?>"> |
766 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
766 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
767 | 767 | <?php echo $sub_tab['icon-html']; ?> |
768 | 768 | <?php else : ?> |
769 | 769 | <span class="give-icon give-icon-default"></span> |
@@ -778,30 +778,30 @@ discard block |
||
778 | 778 | <?php endforeach; ?> |
779 | 779 | </ul> |
780 | 780 | |
781 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
782 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
781 | + <?php foreach ($this->settings as $setting) : ?> |
|
782 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
783 | 783 | <?php |
784 | 784 | // Determine if current panel is active. |
785 | 785 | $is_active = $active_tab === $setting['id'] ? true : false; |
786 | 786 | ?> |
787 | 787 | <div id="<?php echo $setting['id']; ?>" |
788 | - class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
789 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
790 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
791 | - <?php give_render_field( $field ); ?> |
|
788 | + class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
789 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
790 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
791 | + <?php give_render_field($field); ?> |
|
792 | 792 | <?php endforeach; ?> |
793 | 793 | <?php endif; ?> |
794 | 794 | </div> |
795 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
795 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
796 | 796 | |
797 | 797 | |
798 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
799 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
800 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
798 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
799 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
800 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
801 | 801 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
802 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
803 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
804 | - <?php give_render_field( $sub_field ); ?> |
|
802 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
803 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
804 | + <?php give_render_field($sub_field); ?> |
|
805 | 805 | <?php endforeach; ?> |
806 | 806 | <?php endif; ?> |
807 | 807 | </div> |
@@ -824,9 +824,9 @@ discard block |
||
824 | 824 | * |
825 | 825 | * @return void |
826 | 826 | */ |
827 | - public function output_goal( $post ) { |
|
827 | + public function output_goal($post) { |
|
828 | 828 | |
829 | - echo give_admin_form_goal_stats( $post->ID ); |
|
829 | + echo give_admin_form_goal_stats($post->ID); |
|
830 | 830 | |
831 | 831 | } |
832 | 832 | |
@@ -839,9 +839,9 @@ discard block |
||
839 | 839 | * |
840 | 840 | * @return bool |
841 | 841 | */ |
842 | - private function has_sub_tab( $field_setting ) { |
|
842 | + private function has_sub_tab($field_setting) { |
|
843 | 843 | $has_sub_tab = false; |
844 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
844 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
845 | 845 | $has_sub_tab = true; |
846 | 846 | } |
847 | 847 | |
@@ -856,13 +856,13 @@ discard block |
||
856 | 856 | * @return array |
857 | 857 | */ |
858 | 858 | function cmb2_metabox_settings() { |
859 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
859 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
860 | 860 | $give_forms_settings = $all_cmb2_settings; |
861 | 861 | |
862 | 862 | // Filter settings: Use only give forms related settings. |
863 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
864 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
865 | - unset( $give_forms_settings[ $index ] ); |
|
863 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
864 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
865 | + unset($give_forms_settings[$index]); |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
@@ -880,100 +880,100 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @return void |
882 | 882 | */ |
883 | - public function save( $post_id, $post ) { |
|
883 | + public function save($post_id, $post) { |
|
884 | 884 | |
885 | 885 | // $post_id and $post are required. |
886 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
886 | + if (empty($post_id) || empty($post)) { |
|
887 | 887 | return; |
888 | 888 | } |
889 | 889 | |
890 | 890 | // Don't save meta boxes for revisions or autosaves. |
891 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
891 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
892 | 892 | return; |
893 | 893 | } |
894 | 894 | |
895 | 895 | // Check the nonce. |
896 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
896 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
897 | 897 | return; |
898 | 898 | } |
899 | 899 | |
900 | 900 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
901 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
901 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
902 | 902 | return; |
903 | 903 | } |
904 | 904 | |
905 | 905 | // Check user has permission to edit. |
906 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
906 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
907 | 907 | return; |
908 | 908 | } |
909 | 909 | |
910 | 910 | // Fire action before saving form meta. |
911 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
911 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
912 | 912 | |
913 | 913 | /** |
914 | 914 | * Filter the meta key to save. |
915 | 915 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
916 | 916 | */ |
917 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
917 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
918 | 918 | |
919 | 919 | // Save form meta data. |
920 | - if ( ! empty( $form_meta_keys ) ) { |
|
921 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
920 | + if ( ! empty($form_meta_keys)) { |
|
921 | + foreach ($form_meta_keys as $form_meta_key) { |
|
922 | 922 | |
923 | 923 | // Set default value for checkbox fields. |
924 | 924 | if ( |
925 | - ! isset( $_POST[ $form_meta_key ] ) && |
|
926 | - in_array( $this->get_field_type( $form_meta_key ), array( 'checkbox', 'chosen' ) ) |
|
925 | + ! isset($_POST[$form_meta_key]) && |
|
926 | + in_array($this->get_field_type($form_meta_key), array('checkbox', 'chosen')) |
|
927 | 927 | ) { |
928 | - $_POST[ $form_meta_key ] = ''; |
|
928 | + $_POST[$form_meta_key] = ''; |
|
929 | 929 | } |
930 | 930 | |
931 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
932 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
933 | - if ( ! empty( $setting_field['type'] ) ) { |
|
934 | - switch ( $setting_field['type'] ) { |
|
931 | + if (isset($_POST[$form_meta_key])) { |
|
932 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
933 | + if ( ! empty($setting_field['type'])) { |
|
934 | + switch ($setting_field['type']) { |
|
935 | 935 | case 'textarea': |
936 | 936 | case 'wysiwyg': |
937 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
937 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
938 | 938 | break; |
939 | 939 | |
940 | 940 | case 'donation_limit' : |
941 | - $form_meta_value = $_POST[ $form_meta_key ]; |
|
941 | + $form_meta_value = $_POST[$form_meta_key]; |
|
942 | 942 | break; |
943 | 943 | |
944 | 944 | case 'group': |
945 | 945 | $form_meta_value = array(); |
946 | 946 | |
947 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
947 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
948 | 948 | |
949 | 949 | // Do not save template input field values. |
950 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
950 | + if ('{{row-count-placeholder}}' === $index) { |
|
951 | 951 | continue; |
952 | 952 | } |
953 | 953 | |
954 | 954 | $group_meta_value = array(); |
955 | - foreach ( $group as $field_id => $field_value ) { |
|
956 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
955 | + foreach ($group as $field_id => $field_value) { |
|
956 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
957 | 957 | case 'wysiwyg': |
958 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
958 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
959 | 959 | break; |
960 | 960 | |
961 | 961 | default: |
962 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
962 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - if ( ! empty( $group_meta_value ) ) { |
|
967 | - $form_meta_value[ $index ] = $group_meta_value; |
|
966 | + if ( ! empty($group_meta_value)) { |
|
967 | + $form_meta_value[$index] = $group_meta_value; |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
971 | 971 | // Arrange repeater field keys in order. |
972 | - $form_meta_value = array_values( $form_meta_value ); |
|
972 | + $form_meta_value = array_values($form_meta_value); |
|
973 | 973 | break; |
974 | 974 | |
975 | 975 | default: |
976 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
976 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
977 | 977 | }// End switch(). |
978 | 978 | |
979 | 979 | /** |
@@ -983,38 +983,38 @@ discard block |
||
983 | 983 | */ |
984 | 984 | $form_meta_value = apply_filters( |
985 | 985 | 'give_pre_save_form_meta_value', |
986 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
986 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
987 | 987 | $form_meta_key, |
988 | 988 | $this, |
989 | 989 | $post_id |
990 | 990 | ); |
991 | 991 | |
992 | 992 | // Range slider. |
993 | - if ( 'donation_limit' === $setting_field['type'] ) { |
|
993 | + if ('donation_limit' === $setting_field['type']) { |
|
994 | 994 | |
995 | 995 | // Sanitize amount for db. |
996 | - $form_meta_value = array_map( 'give_sanitize_amount_for_db', $form_meta_value ); |
|
996 | + $form_meta_value = array_map('give_sanitize_amount_for_db', $form_meta_value); |
|
997 | 997 | |
998 | 998 | // Store it to form meta. |
999 | - give_update_meta( $post_id, $form_meta_key . '_minimum', $form_meta_value['minimum'] ); |
|
1000 | - give_update_meta( $post_id, $form_meta_key . '_maximum', $form_meta_value['maximum'] ); |
|
999 | + give_update_meta($post_id, $form_meta_key.'_minimum', $form_meta_value['minimum']); |
|
1000 | + give_update_meta($post_id, $form_meta_key.'_maximum', $form_meta_value['maximum']); |
|
1001 | 1001 | } else { |
1002 | 1002 | // Save data. |
1003 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
1003 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // Verify and delete form meta based on the form status. |
1007 | - give_set_form_closed_status( $post_id ); |
|
1007 | + give_set_form_closed_status($post_id); |
|
1008 | 1008 | |
1009 | 1009 | // Fire after saving form meta key. |
1010 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
1010 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
1011 | 1011 | }// End if(). |
1012 | 1012 | }// End if(). |
1013 | 1013 | }// End foreach(). |
1014 | 1014 | }// End if(). |
1015 | 1015 | |
1016 | 1016 | // Fire action after saving form meta. |
1017 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
1017 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | |
@@ -1027,10 +1027,10 @@ discard block |
||
1027 | 1027 | * |
1028 | 1028 | * @return string |
1029 | 1029 | */ |
1030 | - private function get_field_id( $field ) { |
|
1030 | + private function get_field_id($field) { |
|
1031 | 1031 | $field_id = ''; |
1032 | 1032 | |
1033 | - if ( array_key_exists( 'id', $field ) ) { |
|
1033 | + if (array_key_exists('id', $field)) { |
|
1034 | 1034 | $field_id = $field['id']; |
1035 | 1035 | |
1036 | 1036 | } |
@@ -1047,16 +1047,16 @@ discard block |
||
1047 | 1047 | * |
1048 | 1048 | * @return array |
1049 | 1049 | */ |
1050 | - private function get_fields_id( $setting ) { |
|
1050 | + private function get_fields_id($setting) { |
|
1051 | 1051 | $meta_keys = array(); |
1052 | 1052 | |
1053 | 1053 | if ( |
1054 | - ! empty( $setting ) |
|
1055 | - && array_key_exists( 'fields', $setting ) |
|
1056 | - && ! empty( $setting['fields'] ) |
|
1054 | + ! empty($setting) |
|
1055 | + && array_key_exists('fields', $setting) |
|
1056 | + && ! empty($setting['fields']) |
|
1057 | 1057 | ) { |
1058 | - foreach ( $setting['fields'] as $field ) { |
|
1059 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1058 | + foreach ($setting['fields'] as $field) { |
|
1059 | + if ($field_id = $this->get_field_id($field)) { |
|
1060 | 1060 | $meta_keys[] = $field_id; |
1061 | 1061 | } |
1062 | 1062 | } |
@@ -1074,14 +1074,14 @@ discard block |
||
1074 | 1074 | * |
1075 | 1075 | * @return array |
1076 | 1076 | */ |
1077 | - private function get_sub_fields_id( $setting ) { |
|
1077 | + private function get_sub_fields_id($setting) { |
|
1078 | 1078 | $meta_keys = array(); |
1079 | 1079 | |
1080 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
1081 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1082 | - if ( ! empty( $fields['fields'] ) ) { |
|
1083 | - foreach ( $fields['fields'] as $field ) { |
|
1084 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1080 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
1081 | + foreach ($setting['sub-fields'] as $fields) { |
|
1082 | + if ( ! empty($fields['fields'])) { |
|
1083 | + foreach ($fields['fields'] as $field) { |
|
1084 | + if ($field_id = $this->get_field_id($field)) { |
|
1085 | 1085 | $meta_keys[] = $field_id; |
1086 | 1086 | } |
1087 | 1087 | } |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | private function get_meta_keys_from_settings() { |
1104 | 1104 | $meta_keys = array(); |
1105 | 1105 | |
1106 | - foreach ( $this->settings as $setting ) { |
|
1107 | - $meta_key = $this->get_fields_id( $setting ); |
|
1106 | + foreach ($this->settings as $setting) { |
|
1107 | + $meta_key = $this->get_fields_id($setting); |
|
1108 | 1108 | |
1109 | - if ( $this->has_sub_tab( $setting ) ) { |
|
1110 | - $meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) ); |
|
1109 | + if ($this->has_sub_tab($setting)) { |
|
1110 | + $meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting)); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
1113 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | return $meta_keys; |
@@ -1127,10 +1127,10 @@ discard block |
||
1127 | 1127 | * |
1128 | 1128 | * @return string |
1129 | 1129 | */ |
1130 | - function get_field_type( $field_id, $group_id = '' ) { |
|
1131 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
1130 | + function get_field_type($field_id, $group_id = '') { |
|
1131 | + $field = $this->get_setting_field($field_id, $group_id); |
|
1132 | 1132 | |
1133 | - $type = array_key_exists( 'type', $field ) |
|
1133 | + $type = array_key_exists('type', $field) |
|
1134 | 1134 | ? $field['type'] |
1135 | 1135 | : ''; |
1136 | 1136 | |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | * |
1149 | 1149 | * @return array |
1150 | 1150 | */ |
1151 | - private function get_field( $setting, $field_id ) { |
|
1151 | + private function get_field($setting, $field_id) { |
|
1152 | 1152 | $setting_field = array(); |
1153 | 1153 | |
1154 | - if ( ! empty( $setting['fields'] ) ) { |
|
1155 | - foreach ( $setting['fields'] as $field ) { |
|
1156 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1154 | + if ( ! empty($setting['fields'])) { |
|
1155 | + foreach ($setting['fields'] as $field) { |
|
1156 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1157 | 1157 | $setting_field = $field; |
1158 | 1158 | break; |
1159 | 1159 | } |
@@ -1173,12 +1173,12 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @return array |
1175 | 1175 | */ |
1176 | - private function get_sub_field( $setting, $field_id ) { |
|
1176 | + private function get_sub_field($setting, $field_id) { |
|
1177 | 1177 | $setting_field = array(); |
1178 | 1178 | |
1179 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1180 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1181 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1179 | + if ( ! empty($setting['sub-fields'])) { |
|
1180 | + foreach ($setting['sub-fields'] as $fields) { |
|
1181 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1182 | 1182 | $setting_field = $field; |
1183 | 1183 | break; |
1184 | 1184 | } |
@@ -1198,17 +1198,17 @@ discard block |
||
1198 | 1198 | * |
1199 | 1199 | * @return array |
1200 | 1200 | */ |
1201 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1201 | + function get_setting_field($field_id, $group_id = '') { |
|
1202 | 1202 | $setting_field = array(); |
1203 | 1203 | |
1204 | 1204 | $_field_id = $field_id; |
1205 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1205 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1206 | 1206 | |
1207 | - if ( ! empty( $this->settings ) ) { |
|
1208 | - foreach ( $this->settings as $setting ) { |
|
1207 | + if ( ! empty($this->settings)) { |
|
1208 | + foreach ($this->settings as $setting) { |
|
1209 | 1209 | if ( |
1210 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1211 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1210 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1211 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1212 | 1212 | ) { |
1213 | 1213 | break; |
1214 | 1214 | } |
@@ -1216,9 +1216,9 @@ discard block |
||
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Get field from group. |
1219 | - if ( ! empty( $group_id ) ) { |
|
1220 | - foreach ( $setting_field['fields'] as $field ) { |
|
1221 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1219 | + if ( ! empty($group_id)) { |
|
1220 | + foreach ($setting_field['fields'] as $field) { |
|
1221 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1222 | 1222 | $setting_field = $field; |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1237,14 +1237,14 @@ discard block |
||
1237 | 1237 | * |
1238 | 1238 | * @return mixed |
1239 | 1239 | */ |
1240 | - function add_offline_donations_setting_tab( $settings ) { |
|
1241 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1242 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1240 | + function add_offline_donations_setting_tab($settings) { |
|
1241 | + if (give_is_gateway_active('offline')) { |
|
1242 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1243 | 1243 | 'id' => 'offline_donations_options', |
1244 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1244 | + 'title' => __('Offline Donations', 'give'), |
|
1245 | 1245 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1246 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1247 | - ) ); |
|
1246 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1247 | + )); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | return $settings; |
@@ -1262,41 +1262,37 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @return mixed |
1264 | 1264 | */ |
1265 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1266 | - switch ( $setting_field['type'] ) { |
|
1265 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1266 | + switch ($setting_field['type']) { |
|
1267 | 1267 | case 'group': |
1268 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1269 | - foreach ( $setting_field['fields'] as $field ) { |
|
1270 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1268 | + if ( ! empty($setting_field['fields'])) { |
|
1269 | + foreach ($setting_field['fields'] as $field) { |
|
1270 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1271 | 1271 | continue; |
1272 | 1272 | } |
1273 | 1273 | |
1274 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1275 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1274 | + foreach ($meta_value as $index => $meta_data) { |
|
1275 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1276 | 1276 | continue; |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ? |
|
1280 | - give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) : |
|
1281 | - ( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ? |
|
1282 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1283 | - 0 ); |
|
1279 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ? |
|
1280 | + give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ? |
|
1281 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1284 | 1282 | } |
1285 | 1283 | } |
1286 | 1284 | } |
1287 | 1285 | break; |
1288 | 1286 | |
1289 | 1287 | default: |
1290 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1288 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1291 | 1289 | $meta_value = $meta_value ? |
1292 | - give_sanitize_amount_for_db( $meta_value ) : |
|
1293 | - ( in_array( $setting_field['id'], array( |
|
1290 | + give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array( |
|
1294 | 1291 | '_give_set_price', |
1295 | 1292 | '_give_custom_amount_minimum', |
1296 | 1293 | '_give_set_goal' |
1297 | - ) ) ? |
|
1298 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1299 | - 0 ); |
|
1294 | + )) ? |
|
1295 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1300 | 1296 | } |
1301 | 1297 | } |
1302 | 1298 | |
@@ -1314,12 +1310,12 @@ discard block |
||
1314 | 1310 | * |
1315 | 1311 | * @return string The URL after redirect. |
1316 | 1312 | */ |
1317 | - public function maintain_active_tab( $location, $post_id ) { |
|
1313 | + public function maintain_active_tab($location, $post_id) { |
|
1318 | 1314 | if ( |
1319 | - 'give_forms' === get_post_type( $post_id ) && |
|
1320 | - ! empty( $_POST['give_form_active_tab'] ) |
|
1315 | + 'give_forms' === get_post_type($post_id) && |
|
1316 | + ! empty($_POST['give_form_active_tab']) |
|
1321 | 1317 | ) { |
1322 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
1318 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
1323 | 1319 | } |
1324 | 1320 | |
1325 | 1321 | return $location; |