@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | 'disabled' => __( 'Disabled', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'display_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'display_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | + 'title' => __( 'Display Options Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_display_settings_1', |
99 | 99 | 'type' => 'sectionend' |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | 'disabled' => __( 'Disabled', 'give' ), |
171 | 171 | ) |
172 | 172 | ), |
173 | - array( |
|
174 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
175 | - 'id' => 'post_types_settings_docs_link', |
|
176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
178 | - 'type' => 'give_docs_link', |
|
179 | - ), |
|
173 | + array( |
|
174 | + 'name' => __( 'Post Types Docs Link', 'give' ), |
|
175 | + 'id' => 'post_types_settings_docs_link', |
|
176 | + 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | + 'title' => __( 'Post Types Settings', 'give' ), |
|
178 | + 'type' => 'give_docs_link', |
|
179 | + ), |
|
180 | 180 | array( |
181 | 181 | 'id' => 'give_title_display_settings_2', |
182 | 182 | 'type' => 'sectionend' |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | 'disabled' => __( 'Disabled', 'give' ), |
213 | 213 | ) |
214 | 214 | ), |
215 | - array( |
|
216 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
217 | - 'id' => 'taxonomies_settings_docs_link', |
|
218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
220 | - 'type' => 'give_docs_link', |
|
221 | - ), |
|
215 | + array( |
|
216 | + 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
217 | + 'id' => 'taxonomies_settings_docs_link', |
|
218 | + 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | + 'title' => __( 'Taxonomies Settings', 'give' ), |
|
220 | + 'type' => 'give_docs_link', |
|
221 | + ), |
|
222 | 222 | array( |
223 | 223 | 'id' => 'give_title_display_settings_3', |
224 | 224 | 'type' => 'sectionend' |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | 'id' => 'agreement_text', |
259 | 259 | 'type' => 'wysiwyg' |
260 | 260 | ), |
261 | - array( |
|
262 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
263 | - 'id' => 'terms_settings_docs_link', |
|
264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
266 | - 'type' => 'give_docs_link', |
|
267 | - ), |
|
261 | + array( |
|
262 | + 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
263 | + 'id' => 'terms_settings_docs_link', |
|
264 | + 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | + 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
266 | + 'type' => 'give_docs_link', |
|
267 | + ), |
|
268 | 268 | array( |
269 | 269 | 'id' => 'give_title_display_settings_4', |
270 | 270 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_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,45 +53,45 @@ 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 lables 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( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your lables 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('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
70 | 70 | 'id' => 'floatlabels', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
79 | + 'name' => __('Welcome Screen', 'give'), |
|
80 | 80 | /* translators: %s: about page URL */ |
81 | - '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( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
81 | + '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('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))), |
|
82 | 82 | 'id' => 'welcome', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'enabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Enabled', 'give' ), |
|
87 | - 'disabled' => __( 'Disabled', 'give' ), |
|
86 | + 'enabled' => __('Enabled', 'give'), |
|
87 | + 'disabled' => __('Disabled', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
91 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'display_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
94 | + 'title' => __('Display Options Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -108,73 +108,73 @@ discard block |
||
108 | 108 | 'type' => 'title' |
109 | 109 | ), |
110 | 110 | array( |
111 | - 'name' => __( 'Form Single Views', 'give' ), |
|
112 | - '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' ), |
|
111 | + 'name' => __('Form Single Views', 'give'), |
|
112 | + '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'), |
|
113 | 113 | 'id' => 'forms_singular', |
114 | 114 | 'type' => 'radio_inline', |
115 | 115 | 'default' => 'enabled', |
116 | 116 | 'options' => array( |
117 | - 'enabled' => __( 'Enabled', 'give' ), |
|
118 | - 'disabled' => __( 'Disabled', 'give' ), |
|
117 | + 'enabled' => __('Enabled', 'give'), |
|
118 | + 'disabled' => __('Disabled', 'give'), |
|
119 | 119 | ) |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Form Archives', 'give' ), |
|
123 | - '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( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
122 | + 'name' => __('Form Archives', 'give'), |
|
123 | + '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('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))), |
|
124 | 124 | 'id' => 'forms_archives', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'enabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give'), |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
134 | - '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' ), |
|
133 | + 'name' => __('Form Excerpts', 'give'), |
|
134 | + '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'), |
|
135 | 135 | 'id' => 'forms_excerpt', |
136 | 136 | 'type' => 'radio_inline', |
137 | 137 | 'default' => 'enabled', |
138 | 138 | 'options' => array( |
139 | - 'enabled' => __( 'Enabled', 'give' ), |
|
140 | - 'disabled' => __( 'Disabled', 'give' ), |
|
139 | + 'enabled' => __('Enabled', 'give'), |
|
140 | + 'disabled' => __('Disabled', 'give'), |
|
141 | 141 | ) |
142 | 142 | ), |
143 | 143 | array( |
144 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
145 | - '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' ), |
|
144 | + 'name' => __('Form Featured Image', 'give'), |
|
145 | + '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'), |
|
146 | 146 | 'id' => 'form_featured_img', |
147 | 147 | 'type' => 'radio_inline', |
148 | 148 | 'default' => 'enabled', |
149 | 149 | 'options' => array( |
150 | - 'enabled' => __( 'Enabled', 'give' ), |
|
151 | - 'disabled' => __( 'Disabled', 'give' ), |
|
150 | + 'enabled' => __('Enabled', 'give'), |
|
151 | + 'disabled' => __('Disabled', 'give'), |
|
152 | 152 | ) |
153 | 153 | ), |
154 | 154 | array( |
155 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
156 | - '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' ), |
|
155 | + 'name' => __('Featured Image Size', 'give'), |
|
156 | + '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'), |
|
157 | 157 | 'id' => 'featured_image_size', |
158 | 158 | 'type' => 'select', |
159 | 159 | 'default' => 'large', |
160 | 160 | 'options' => give_get_featured_image_sizes() |
161 | 161 | ), |
162 | 162 | array( |
163 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
164 | - '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' ), |
|
163 | + 'name' => __('Single Form Sidebar', 'give'), |
|
164 | + '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'), |
|
165 | 165 | 'id' => 'form_sidebar', |
166 | 166 | 'type' => 'radio_inline', |
167 | 167 | 'default' => 'enabled', |
168 | 168 | 'options' => array( |
169 | - 'enabled' => __( 'Enabled', 'give' ), |
|
170 | - 'disabled' => __( 'Disabled', 'give' ), |
|
169 | + 'enabled' => __('Enabled', 'give'), |
|
170 | + 'disabled' => __('Disabled', 'give'), |
|
171 | 171 | ) |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
174 | + 'name' => __('Post Types Docs Link', 'give'), |
|
175 | 175 | 'id' => 'post_types_settings_docs_link', |
176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
176 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
177 | + 'title' => __('Post Types Settings', 'give'), |
|
178 | 178 | 'type' => 'give_docs_link', |
179 | 179 | ), |
180 | 180 | array( |
@@ -191,32 +191,32 @@ discard block |
||
191 | 191 | 'type' => 'title' |
192 | 192 | ), |
193 | 193 | array( |
194 | - 'name' => __( 'Form Categories', 'give' ), |
|
195 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
194 | + 'name' => __('Form Categories', 'give'), |
|
195 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
196 | 196 | 'id' => 'categories', |
197 | 197 | 'type' => 'radio_inline', |
198 | 198 | 'default' => 'disabled', |
199 | 199 | 'options' => array( |
200 | - 'enabled' => __( 'Enabled', 'give' ), |
|
201 | - 'disabled' => __( 'Disabled', 'give' ), |
|
200 | + 'enabled' => __('Enabled', 'give'), |
|
201 | + 'disabled' => __('Disabled', 'give'), |
|
202 | 202 | ) |
203 | 203 | ), |
204 | 204 | array( |
205 | - 'name' => __( 'Form Tags', 'give' ), |
|
206 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
205 | + 'name' => __('Form Tags', 'give'), |
|
206 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
207 | 207 | 'id' => 'tags', |
208 | 208 | 'type' => 'radio_inline', |
209 | 209 | 'default' => 'disabled', |
210 | 210 | 'options' => array( |
211 | - 'enabled' => __( 'Enabled', 'give' ), |
|
212 | - 'disabled' => __( 'Disabled', 'give' ), |
|
211 | + 'enabled' => __('Enabled', 'give'), |
|
212 | + 'disabled' => __('Disabled', 'give'), |
|
213 | 213 | ) |
214 | 214 | ), |
215 | 215 | array( |
216 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
216 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
217 | 217 | 'id' => 'taxonomies_settings_docs_link', |
218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
218 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
219 | + 'title' => __('Taxonomies Settings', 'give'), |
|
220 | 220 | 'type' => 'give_docs_link', |
221 | 221 | ), |
222 | 222 | array( |
@@ -233,36 +233,36 @@ discard block |
||
233 | 233 | 'type' => 'title' |
234 | 234 | ), |
235 | 235 | array( |
236 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
237 | - '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' ), |
|
236 | + 'name' => __('Terms and Conditions', 'give'), |
|
237 | + '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'), |
|
238 | 238 | 'id' => 'terms', |
239 | 239 | 'type' => 'radio_inline', |
240 | 240 | 'default' => 'disabled', |
241 | 241 | 'options' => array( |
242 | - 'enabled' => __( 'Enabled', 'give' ), |
|
243 | - 'disabled' => __( 'Disabled', 'give' ), |
|
242 | + 'enabled' => __('Enabled', 'give'), |
|
243 | + 'disabled' => __('Disabled', 'give'), |
|
244 | 244 | ) |
245 | 245 | ), |
246 | 246 | array( |
247 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
248 | - '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' ), |
|
247 | + 'name' => __('Agree to Terms Label', 'give'), |
|
248 | + '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'), |
|
249 | 249 | 'id' => 'agree_to_terms_label', |
250 | 250 | 'attributes' => array( |
251 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
251 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
252 | 252 | ), |
253 | 253 | 'type' => 'text' |
254 | 254 | ), |
255 | 255 | array( |
256 | - 'name' => __( 'Agreement Text', 'give' ), |
|
257 | - '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' ), |
|
256 | + 'name' => __('Agreement Text', 'give'), |
|
257 | + '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'), |
|
258 | 258 | 'id' => 'agreement_text', |
259 | 259 | 'type' => 'wysiwyg' |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
262 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
263 | 263 | 'id' => 'terms_settings_docs_link', |
264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
264 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
265 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
266 | 266 | 'type' => 'give_docs_link', |
267 | 267 | ), |
268 | 268 | array( |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Filter the display options settings. |
278 | 278 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
279 | 279 | */ |
280 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
280 | + $settings = apply_filters('give_settings_display', $settings); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Filter the settings. |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @since 1.8 |
286 | 286 | * @param array $settings |
287 | 287 | */ |
288 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
288 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
289 | 289 | |
290 | 290 | // Output. |
291 | 291 | return $settings; |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function get_sections() { |
301 | 301 | $sections = array( |
302 | - 'display-settings' => __( 'Display', 'give' ), |
|
303 | - 'post-types' => __( 'Post Types', 'give' ), |
|
304 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
305 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ) |
|
302 | + 'display-settings' => __('Display', 'give'), |
|
303 | + 'post-types' => __('Post Types', 'give'), |
|
304 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
305 | + 'term-and-conditions' => __('Terms and Conditions', 'give') |
|
306 | 306 | ); |
307 | 307 | |
308 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
308 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | default: |
77 | 77 | |
78 | 78 | if ( |
79 | - array_key_exists( 'callback', $field ) |
|
80 | - && ! empty( $field['callback'] ) |
|
79 | + array_key_exists('callback', $field) |
|
80 | + && ! empty($field['callback']) |
|
81 | 81 | ) { |
82 | 82 | $func_name = $field['callback']; |
83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.8 |
92 | 92 | */ |
93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
94 | 94 | |
95 | 95 | // Exit if not any function exist. |
96 | 96 | // Check if render callback exist or not. |
97 | - if ( empty( $func_name ) ) { |
|
97 | + if (empty($func_name)) { |
|
98 | 98 | return false; |
99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
100 | 100 | return false; |
101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return bool |
116 | 116 | */ |
117 | -function give_render_field( $field ) { |
|
117 | +function give_render_field($field) { |
|
118 | 118 | |
119 | 119 | // Check if render callback exist or not. |
120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
125 | - if ( empty( $field['class'] ) ) { |
|
125 | + if (empty($field['class'])) { |
|
126 | 126 | $field['class'] = ''; |
127 | 127 | } |
128 | 128 | |
129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
129 | + if (empty($field['attributes']['class'])) { |
|
130 | 130 | $field['attributes']['class'] = ''; |
131 | 131 | } |
132 | 132 | |
133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
134 | - unset( $field['class'] ); |
|
133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
134 | + unset($field['class']); |
|
135 | 135 | |
136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
137 | + if ( ! empty($field['row_classes'])) { |
|
138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
139 | - unset( $field['row_classes'] ); |
|
139 | + unset($field['row_classes']); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Set field params on basis of cmb2 field name. |
143 | - switch ( $field['type'] ) { |
|
143 | + switch ($field['type']) { |
|
144 | 144 | case 'radio_inline': |
145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
145 | + if (empty($field['wrapper_class'])) { |
|
146 | 146 | $field['wrapper_class'] = ''; |
147 | 147 | } |
148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | case 'text-small' : |
156 | 156 | case 'text_small' : |
157 | 157 | // CMB2 compatibility: Set field type to text. |
158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
159 | 159 | |
160 | 160 | // CMB2 compatibility: Set data type to price. |
161 | 161 | if ( |
162 | - empty( $field['data_type'] ) |
|
163 | - && ! empty( $field['attributes']['class'] ) |
|
162 | + empty($field['data_type']) |
|
163 | + && ! empty($field['attributes']['class']) |
|
164 | 164 | && ( |
165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
165 | + false !== strpos($field['attributes']['class'], 'money') |
|
166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
167 | 167 | ) |
168 | 168 | ) { |
169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | case 'give_default_radio_inline': |
183 | 183 | $field['type'] = 'radio'; |
184 | 184 | $field['options'] = array( |
185 | - 'default' => __( 'Default' ), |
|
185 | + 'default' => __('Default'), |
|
186 | 186 | ); |
187 | 187 | break; |
188 | 188 | } |
189 | 189 | |
190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
191 | 191 | // We encourage you to use description param. |
192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
192 | + $field['description'] = ( ! empty($field['description']) |
|
193 | 193 | ? $field['description'] |
194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
195 | 195 | |
196 | 196 | // Call render function. |
197 | - if ( is_array( $func_name ) ) { |
|
198 | - $func_name[0]->{$func_name[1]}( $field ); |
|
197 | + if (is_array($func_name)) { |
|
198 | + $func_name[0]->{$func_name[1]}($field); |
|
199 | 199 | } else { |
200 | - $func_name( $field ); |
|
200 | + $func_name($field); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
227 | 227 | * } |
228 | 228 | * @return void |
229 | 229 | */ |
230 | -function give_text_input( $field ) { |
|
230 | +function give_text_input($field) { |
|
231 | 231 | global $thepostid, $post; |
232 | 232 | |
233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
238 | 238 | $field['before_field'] = ''; |
239 | 239 | $field['after_field'] = ''; |
240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
241 | 241 | |
242 | - switch ( $data_type ) { |
|
242 | + switch ($data_type) { |
|
243 | 243 | case 'price' : |
244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
245 | 245 | |
246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
246 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
247 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'decimal' : |
251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
253 | 253 | break; |
254 | 254 | |
255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | ?> |
260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
262 | 262 | <?php echo $field['before_field']; ?> |
263 | 263 | <input |
264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
266 | + name="<?php echo give_get_field_name($field); ?>" |
|
267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
269 | + <?php echo give_get_custom_attributes($field); ?> |
|
270 | 270 | /> |
271 | 271 | <?php echo $field['after_field']; ?> |
272 | 272 | <?php |
273 | - echo give_get_field_description( $field ); |
|
273 | + echo give_get_field_description($field); |
|
274 | 274 | echo '</p>'; |
275 | 275 | } |
276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
292 | 292 | * } |
293 | 293 | * @return void |
294 | 294 | */ |
295 | -function give_hidden_input( $field ) { |
|
295 | +function give_hidden_input($field) { |
|
296 | 296 | global $thepostid, $post; |
297 | 297 | |
298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
300 | 300 | |
301 | 301 | // Custom attribute handling |
302 | 302 | $custom_attributes = array(); |
303 | 303 | |
304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
305 | 305 | |
306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | ?> |
311 | 311 | |
312 | 312 | <input |
313 | 313 | type="hidden" |
314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
314 | + name="<?php echo give_get_field_name($field); ?>" |
|
315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
317 | + <?php echo give_get_custom_attributes($field); ?> |
|
318 | 318 | /> |
319 | 319 | <?php |
320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
340 | 340 | * } |
341 | 341 | * @return void |
342 | 342 | */ |
343 | -function give_textarea_input( $field ) { |
|
343 | +function give_textarea_input($field) { |
|
344 | 344 | global $thepostid, $post; |
345 | 345 | |
346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
350 | 350 | |
351 | 351 | ?> |
352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
354 | 354 | <textarea |
355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
356 | + name="<?php echo give_get_field_name($field); ?>" |
|
357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
358 | 358 | rows="10" |
359 | 359 | cols="20" |
360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
360 | + <?php echo give_get_custom_attributes($field); ?> |
|
361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
362 | 362 | <?php |
363 | - echo give_get_field_description( $field ); |
|
363 | + echo give_get_field_description($field); |
|
364 | 364 | echo '</p>'; |
365 | 365 | } |
366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
384 | 384 | * } |
385 | 385 | * @return void |
386 | 386 | */ |
387 | -function give_wysiwyg( $field ) { |
|
387 | +function give_wysiwyg($field) { |
|
388 | 388 | global $thepostid, $post; |
389 | 389 | |
390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
394 | 394 | |
395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
396 | 396 | $editor_attributes = array( |
397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
398 | 398 | 'textarea_rows' => '10', |
399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
399 | + 'editor_css' => esc_attr($field['style']), |
|
400 | 400 | 'editor_class' => $field['attributes']['class'], |
401 | 401 | ); |
402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
403 | 403 | $field['value'], |
404 | 404 | $field['unique_field_id'], |
405 | 405 | $editor_attributes, |
406 | - ) ) ) . '"'; |
|
407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
406 | + ))).'"'; |
|
407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
408 | 408 | |
409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
410 | 410 | |
411 | 411 | wp_editor( |
412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $editor_attributes |
415 | 415 | ); |
416 | 416 | |
417 | - echo give_get_field_description( $field ); |
|
417 | + echo give_get_field_description($field); |
|
418 | 418 | echo '</div>'; |
419 | 419 | } |
420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
439 | 439 | * } |
440 | 440 | * @return void |
441 | 441 | */ |
442 | -function give_checkbox( $field ) { |
|
442 | +function give_checkbox($field) { |
|
443 | 443 | global $thepostid, $post; |
444 | 444 | |
445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
451 | 451 | ?> |
452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
454 | 454 | <input |
455 | 455 | type="checkbox" |
456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
457 | + name="<?php echo give_get_field_name($field); ?>" |
|
458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
461 | + <?php echo give_get_custom_attributes($field); ?> |
|
462 | 462 | /> |
463 | 463 | <?php |
464 | - echo give_get_field_description( $field ); |
|
464 | + echo give_get_field_description($field); |
|
465 | 465 | echo '</p>'; |
466 | 466 | } |
467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
487 | 487 | * } |
488 | 488 | * @return void |
489 | 489 | */ |
490 | -function give_select( $field ) { |
|
490 | +function give_select($field) { |
|
491 | 491 | global $thepostid, $post; |
492 | 492 | |
493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
498 | 498 | ?> |
499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
501 | 501 | <select |
502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
503 | + name="<?php echo give_get_field_name($field); ?>" |
|
504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
505 | + <?php echo give_get_custom_attributes($field); ?> |
|
506 | 506 | > |
507 | 507 | <?php |
508 | - foreach ( $field['options'] as $key => $value ) { |
|
509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
508 | + foreach ($field['options'] as $key => $value) { |
|
509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
510 | 510 | } |
511 | 511 | echo '</select>'; |
512 | - echo give_get_field_description( $field ); |
|
512 | + echo give_get_field_description($field); |
|
513 | 513 | echo '</p>'; |
514 | 514 | } |
515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
536 | 536 | * } |
537 | 537 | * @return void |
538 | 538 | */ |
539 | -function give_radio( $field ) { |
|
539 | +function give_radio($field) { |
|
540 | 540 | global $thepostid, $post; |
541 | 541 | |
542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
547 | 547 | |
548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
549 | 549 | |
550 | - foreach ( $field['options'] as $key => $value ) { |
|
550 | + foreach ($field['options'] as $key => $value) { |
|
551 | 551 | |
552 | 552 | echo '<li><label><input |
553 | - name="' . give_get_field_name( $field ) . '" |
|
554 | - value="' . esc_attr( $key ) . '" |
|
553 | + name="' . give_get_field_name($field).'" |
|
554 | + value="' . esc_attr($key).'" |
|
555 | 555 | type="radio" |
556 | - style="' . esc_attr( $field['style'] ) . '" |
|
557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
558 | - . give_get_custom_attributes( $field ) . ' |
|
559 | - /> ' . esc_html( $value ) . '</label> |
|
556 | + style="' . esc_attr($field['style']).'" |
|
557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
558 | + . give_get_custom_attributes($field).' |
|
559 | + /> ' . esc_html($value).'</label> |
|
560 | 560 | </li>'; |
561 | 561 | } |
562 | 562 | echo '</ul>'; |
563 | 563 | |
564 | - echo give_get_field_description( $field ); |
|
564 | + echo give_get_field_description($field); |
|
565 | 565 | echo '</fieldset>'; |
566 | 566 | } |
567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
585 | 585 | * } |
586 | 586 | * @return void |
587 | 587 | */ |
588 | -function give_colorpicker( $field ) { |
|
588 | +function give_colorpicker($field) { |
|
589 | 589 | global $thepostid, $post; |
590 | 590 | |
591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
596 | 596 | $field['type'] = 'text'; |
597 | 597 | ?> |
598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
600 | 600 | <input |
601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
603 | + name="<?php echo give_get_field_name($field); ?>" |
|
604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
605 | + <?php echo give_get_custom_attributes($field); ?> |
|
606 | 606 | /> |
607 | 607 | <?php |
608 | - echo give_get_field_description( $field ); |
|
608 | + echo give_get_field_description($field); |
|
609 | 609 | echo '</p>'; |
610 | 610 | } |
611 | 611 | |
@@ -617,33 +617,33 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @param array $field |
619 | 619 | */ |
620 | -function give_media( $field ) { |
|
620 | +function give_media($field) { |
|
621 | 621 | global $thepostid, $post; |
622 | 622 | |
623 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
624 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
625 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
626 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
627 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
623 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
624 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
625 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
626 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
627 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
628 | 628 | $field['type'] = 'text'; |
629 | 629 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
630 | 630 | |
631 | 631 | // Allow developer to save attachment ID or attachment url as metadata. |
632 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
632 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
633 | 633 | ?> |
634 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
635 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
634 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
635 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
636 | 636 | <input |
637 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
638 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
637 | + name="<?php echo give_get_field_name($field); ?>" |
|
638 | + id="<?php echo esc_attr($field['id']); ?>" |
|
639 | 639 | type="text" |
640 | 640 | value="<?php echo $field['value']; ?>" |
641 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
641 | + style="<?php echo esc_attr($field['style']); ?>" |
|
642 | 642 | data-fvalue="<?php echo $field['fvalue']; ?>" |
643 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
643 | + <?php echo give_get_custom_attributes($field); ?> |
|
644 | 644 | /> <input class="give-media-upload button" type="button" |
645 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
646 | - <?php echo give_get_field_description( $field ); ?> |
|
645 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
646 | + <?php echo give_get_field_description($field); ?> |
|
647 | 647 | </p> |
648 | 648 | <?php |
649 | 649 | } |
@@ -657,27 +657,27 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | -function give_default_gateway( $field ) { |
|
660 | +function give_default_gateway($field) { |
|
661 | 661 | global $thepostid, $post; |
662 | 662 | |
663 | 663 | // get all active payment gateways. |
664 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
664 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
665 | 665 | $field['options'] = array(); |
666 | 666 | |
667 | 667 | // Set field option value. |
668 | - if ( ! empty( $gateways ) ) { |
|
669 | - foreach ( $gateways as $key => $option ) { |
|
670 | - $field['options'][ $key ] = $option['admin_label']; |
|
668 | + if ( ! empty($gateways)) { |
|
669 | + foreach ($gateways as $key => $option) { |
|
670 | + $field['options'][$key] = $option['admin_label']; |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | 674 | // Add a field to the Give Form admin single post view of this field |
675 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
676 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
675 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
676 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | // Render select field. |
680 | - give_select( $field ); |
|
680 | + give_select($field); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
@@ -699,13 +699,13 @@ discard block |
||
699 | 699 | * @return void |
700 | 700 | */ |
701 | 701 | |
702 | -function give_docs_link( $field ) { |
|
703 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
704 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
702 | +function give_docs_link($field) { |
|
703 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
704 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
705 | 705 | |
706 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
706 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
707 | 707 | . '" target="_blank">' |
708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
708 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
709 | 709 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
710 | 710 | } |
711 | 711 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @return mixed |
723 | 723 | */ |
724 | -function give_get_field_value( $field, $postid ) { |
|
725 | - if ( isset( $field['attributes']['value'] ) ) { |
|
724 | +function give_get_field_value($field, $postid) { |
|
725 | + if (isset($field['attributes']['value'])) { |
|
726 | 726 | return $field['attributes']['value']; |
727 | 727 | } |
728 | 728 | |
729 | 729 | // Get value from db. |
730 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
730 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
731 | 731 | |
732 | 732 | /** |
733 | 733 | * Filter the field value before apply default value. |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @param mixed $field_value Field value. |
738 | 738 | */ |
739 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
739 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
740 | 740 | |
741 | 741 | // Set default value if no any data saved to db. |
742 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
742 | + if ( ! $field_value && isset($field['default'])) { |
|
743 | 743 | $field_value = $field['default']; |
744 | 744 | } |
745 | 745 | |
@@ -756,20 +756,20 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @return string |
758 | 758 | */ |
759 | -function give_get_field_description( $field ) { |
|
759 | +function give_get_field_description($field) { |
|
760 | 760 | $field_desc_html = ''; |
761 | 761 | $description = ''; |
762 | 762 | |
763 | 763 | // Check for both `description` and `desc`. |
764 | - if ( isset( $field['description'] ) ) { |
|
764 | + if (isset($field['description'])) { |
|
765 | 765 | $description = $field['description']; |
766 | - } elseif ( isset( $field['desc'] ) ) { |
|
766 | + } elseif (isset($field['desc'])) { |
|
767 | 767 | $description = $field['desc']; |
768 | 768 | } |
769 | 769 | |
770 | 770 | // Set if there is a description. |
771 | - if ( ! empty( $description ) ) { |
|
772 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
771 | + if ( ! empty($description)) { |
|
772 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | return $field_desc_html; |
@@ -785,18 +785,18 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @return string |
787 | 787 | */ |
788 | -function give_get_custom_attributes( $field ) { |
|
788 | +function give_get_custom_attributes($field) { |
|
789 | 789 | // Custom attribute handling |
790 | 790 | $custom_attributes = array(); |
791 | 791 | |
792 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
792 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
793 | 793 | |
794 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
795 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
794 | + foreach ($field['attributes'] as $attribute => $value) { |
|
795 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
799 | - return implode( ' ', $custom_attributes ); |
|
799 | + return implode(' ', $custom_attributes); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
@@ -812,8 +812,8 @@ discard block |
||
812 | 812 | * |
813 | 813 | * @return string |
814 | 814 | */ |
815 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
816 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
815 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
816 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
817 | 817 | |
818 | 818 | /** |
819 | 819 | * Filter the specific repeater field value |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @param string $field_id |
824 | 824 | */ |
825 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
825 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
826 | 826 | |
827 | 827 | /** |
828 | 828 | * Filter the repeater field value |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | * |
832 | 832 | * @param string $field_id |
833 | 833 | */ |
834 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
834 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
835 | 835 | |
836 | 836 | return $field_value; |
837 | 837 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * |
850 | 850 | * @return string |
851 | 851 | */ |
852 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
852 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
853 | 853 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
854 | 854 | |
855 | 855 | // Get field id. |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @param string $field_id |
864 | 864 | */ |
865 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
865 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
866 | 866 | |
867 | 867 | /** |
868 | 868 | * Filter the repeater field id |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | * |
872 | 872 | * @param string $field_id |
873 | 873 | */ |
874 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
874 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
875 | 875 | |
876 | 876 | return $field_id; |
877 | 877 | } |
@@ -886,8 +886,8 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @return string |
888 | 888 | */ |
889 | -function give_get_field_name( $field ) { |
|
890 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
889 | +function give_get_field_name($field) { |
|
890 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
891 | 891 | |
892 | 892 | /** |
893 | 893 | * Filter the field name. |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * |
897 | 897 | * @param string $field_name |
898 | 898 | */ |
899 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
899 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
900 | 900 | |
901 | 901 | return $field_name; |
902 | 902 | } |
@@ -913,39 +913,39 @@ discard block |
||
913 | 913 | * |
914 | 914 | * @return void |
915 | 915 | */ |
916 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
916 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
917 | 917 | global $thepostid, $post; |
918 | 918 | |
919 | 919 | // Bailout. |
920 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
920 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
921 | 921 | return; |
922 | 922 | } |
923 | 923 | |
924 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
925 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
924 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
925 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
926 | 926 | ?> |
927 | 927 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
928 | 928 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
929 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
929 | + <?php if ( ! empty($fields['name'])) : ?> |
|
930 | 930 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
931 | 931 | <?php endif; ?> |
932 | 932 | |
933 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
933 | + <?php if ( ! empty($fields['description'])) : ?> |
|
934 | 934 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
935 | 935 | <?php endif; ?> |
936 | 936 | |
937 | 937 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
938 | 938 | <?php |
939 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
940 | - $header_title = isset( $fields['options']['header_title'] ) |
|
939 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
940 | + $header_title = isset($fields['options']['header_title']) |
|
941 | 941 | ? $fields['options']['header_title'] |
942 | - : esc_attr__( 'Group', 'give' ); |
|
942 | + : esc_attr__('Group', 'give'); |
|
943 | 943 | |
944 | 944 | $add_default_donation_field = false; |
945 | 945 | |
946 | 946 | // Check if level is not created or we have to add default level. |
947 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
948 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
947 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
948 | + $repeater_field_values = array_values($repeater_field_values); |
|
949 | 949 | } else { |
950 | 950 | $fields_count = 1; |
951 | 951 | $add_default_donation_field = true; |
@@ -958,59 +958,59 @@ discard block |
||
958 | 958 | <div class="give-row-head give-move"> |
959 | 959 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
960 | 960 | </button> |
961 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
961 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
962 | 962 | <h2> |
963 | 963 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
964 | 964 | </h2> |
965 | 965 | </div> |
966 | 966 | <div class="give-row-body"> |
967 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
968 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
967 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
968 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
969 | 969 | continue; |
970 | 970 | } ?> |
971 | 971 | <?php |
972 | 972 | $field['repeat'] = true; |
973 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
974 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
973 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
974 | + $field['id'] = str_replace(array('[', ']'), array( |
|
975 | 975 | '_', |
976 | 976 | '', |
977 | - ), $field['repeatable_field_id'] ); |
|
977 | + ), $field['repeatable_field_id']); |
|
978 | 978 | ?> |
979 | - <?php give_render_field( $field ); ?> |
|
979 | + <?php give_render_field($field); ?> |
|
980 | 980 | <?php endforeach; ?> |
981 | 981 | </div> |
982 | 982 | </td> |
983 | 983 | </tr> |
984 | 984 | |
985 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
985 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
986 | 986 | <!--Stored repeater field group--> |
987 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
987 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
988 | 988 | <tr class="give-row"> |
989 | 989 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
990 | 990 | <div class="give-row-head give-move"> |
991 | 991 | <button type="button" class="handlediv button-link"> |
992 | 992 | <span class="toggle-indicator"></span></button> |
993 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
993 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
994 | 994 | </sapn> |
995 | 995 | <h2> |
996 | 996 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
997 | 997 | </h2> |
998 | 998 | </div> |
999 | 999 | <div class="give-row-body"> |
1000 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1001 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
1000 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1001 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
1002 | 1002 | continue; |
1003 | 1003 | } ?> |
1004 | 1004 | <?php |
1005 | 1005 | $field['repeat'] = true; |
1006 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
1007 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
1008 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1006 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
1007 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
1008 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1009 | 1009 | '_', |
1010 | 1010 | '', |
1011 | - ), $field['repeatable_field_id'] ); |
|
1011 | + ), $field['repeatable_field_id']); |
|
1012 | 1012 | ?> |
1013 | - <?php give_render_field( $field ); ?> |
|
1013 | + <?php give_render_field($field); ?> |
|
1014 | 1014 | <?php endforeach; ?> |
1015 | 1015 | </div> |
1016 | 1016 | </td> |
@@ -1018,14 +1018,14 @@ discard block |
||
1018 | 1018 | <?php endforeach; |
1019 | 1019 | ; ?> |
1020 | 1020 | |
1021 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1021 | + <?php elseif ($add_default_donation_field) : ?> |
|
1022 | 1022 | <!--Default repeater field group--> |
1023 | 1023 | <tr class="give-row"> |
1024 | 1024 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1025 | 1025 | <div class="give-row-head give-move"> |
1026 | 1026 | <button type="button" class="handlediv button-link"> |
1027 | 1027 | <span class="toggle-indicator"></span></button> |
1028 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1028 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1029 | 1029 | </sapn> |
1030 | 1030 | <h2> |
1031 | 1031 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1033,19 +1033,19 @@ discard block |
||
1033 | 1033 | </div> |
1034 | 1034 | <div class="give-row-body"> |
1035 | 1035 | <?php |
1036 | - foreach ( $fields['fields'] as $field ) : |
|
1037 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1036 | + foreach ($fields['fields'] as $field) : |
|
1037 | + if ( ! give_is_field_callback_exist($field)) { |
|
1038 | 1038 | continue; |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | $field['repeat'] = true; |
1042 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1043 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
1044 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1042 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1043 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
1044 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1045 | 1045 | '_', |
1046 | 1046 | '', |
1047 | - ), $field['repeatable_field_id'] ); |
|
1048 | - give_render_field( $field ); |
|
1047 | + ), $field['repeatable_field_id']); |
|
1048 | + give_render_field($field); |
|
1049 | 1049 | endforeach; |
1050 | 1050 | ?> |
1051 | 1051 | </div> |
@@ -1056,9 +1056,9 @@ discard block |
||
1056 | 1056 | <tfoot> |
1057 | 1057 | <tr> |
1058 | 1058 | <?php |
1059 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1059 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1060 | 1060 | ? $add_row_btn_title = $fields['options']['add_button'] |
1061 | - : esc_html__( 'Add Row', 'give' ); |
|
1061 | + : esc_html__('Add Row', 'give'); |
|
1062 | 1062 | ?> |
1063 | 1063 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1064 | 1064 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1088,10 +1088,10 @@ discard block |
||
1088 | 1088 | * |
1089 | 1089 | * @param string |
1090 | 1090 | */ |
1091 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1091 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1092 | 1092 | |
1093 | 1093 | // Get current tab. |
1094 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1094 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1095 | 1095 | |
1096 | 1096 | // Output. |
1097 | 1097 | return $current_tab; |
@@ -1115,10 +1115,10 @@ discard block |
||
1115 | 1115 | * |
1116 | 1116 | * @param string |
1117 | 1117 | */ |
1118 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1118 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1119 | 1119 | |
1120 | 1120 | // Get current section. |
1121 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1121 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1122 | 1122 | |
1123 | 1123 | // Output. |
1124 | 1124 | return $current_section; |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | */ |
1133 | 1133 | function give_get_current_setting_page() { |
1134 | 1134 | // Get current page. |
1135 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1135 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1136 | 1136 | |
1137 | 1137 | // Output. |
1138 | 1138 | return $setting_page; |
@@ -1152,13 +1152,13 @@ discard block |
||
1152 | 1152 | * |
1153 | 1153 | * @return string |
1154 | 1154 | */ |
1155 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1156 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1155 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1156 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1157 | 1157 | |
1158 | 1158 | if ( |
1159 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
1159 | + ! give_get_meta($postid, '_give_display_content', true) |
|
1160 | 1160 | && $show_content |
1161 | - && ( 'none' !== $show_content ) |
|
1161 | + && ('none' !== $show_content) |
|
1162 | 1162 | ) { |
1163 | 1163 | $field_value = 'enabled'; |
1164 | 1164 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | return $field_value; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1169 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1170 | 1170 | |
1171 | 1171 | |
1172 | 1172 | /** |
@@ -1183,12 +1183,12 @@ discard block |
||
1183 | 1183 | * |
1184 | 1184 | * @return string |
1185 | 1185 | */ |
1186 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1187 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1186 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1187 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1188 | 1188 | |
1189 | 1189 | if ( |
1190 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
1191 | - && ( 'none' !== $show_content ) |
|
1190 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
1191 | + && ('none' !== $show_content) |
|
1192 | 1192 | ) { |
1193 | 1193 | $field_value = $show_content; |
1194 | 1194 | } |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | return $field_value; |
1197 | 1197 | } |
1198 | 1198 | |
1199 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1199 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1200 | 1200 | |
1201 | 1201 | |
1202 | 1202 | /** |
@@ -1212,17 +1212,17 @@ discard block |
||
1212 | 1212 | * |
1213 | 1213 | * @return string |
1214 | 1214 | */ |
1215 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1216 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
1215 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1216 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
1217 | 1217 | |
1218 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1219 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1218 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1219 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | return $field_value; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1225 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1226 | 1226 | |
1227 | 1227 | |
1228 | 1228 | /** |
@@ -1239,17 +1239,17 @@ discard block |
||
1239 | 1239 | * |
1240 | 1240 | * @return string |
1241 | 1241 | */ |
1242 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1243 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1242 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1243 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1244 | 1244 | |
1245 | - if ( 'on' === $offline_donation ) { |
|
1245 | + if ('on' === $offline_donation) { |
|
1246 | 1246 | $field_value = 'enabled'; |
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | return $field_value; |
1250 | 1250 | } |
1251 | 1251 | |
1252 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1252 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1253 | 1253 | |
1254 | 1254 | |
1255 | 1255 | /** |
@@ -1265,17 +1265,17 @@ discard block |
||
1265 | 1265 | * |
1266 | 1266 | * @return string |
1267 | 1267 | */ |
1268 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1269 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
1268 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1269 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
1270 | 1270 | |
1271 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1272 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1271 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1272 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | return $field_value; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1278 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1279 | 1279 | |
1280 | 1280 | |
1281 | 1281 | /** |
@@ -1291,17 +1291,17 @@ discard block |
||
1291 | 1291 | * |
1292 | 1292 | * @return string |
1293 | 1293 | */ |
1294 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1295 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
1294 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1295 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
1296 | 1296 | |
1297 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1298 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1297 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1298 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | return $field_value; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1304 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1305 | 1305 | |
1306 | 1306 | /** |
1307 | 1307 | * Set value for Donation Goal --> close Form. |
@@ -1317,17 +1317,17 @@ discard block |
||
1317 | 1317 | * |
1318 | 1318 | * @return string |
1319 | 1319 | */ |
1320 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1321 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1320 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1321 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1322 | 1322 | |
1323 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1324 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1323 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1324 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | 1327 | return $field_value; |
1328 | 1328 | } |
1329 | 1329 | |
1330 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1330 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1331 | 1331 | |
1332 | 1332 | |
1333 | 1333 | /** |
@@ -1343,17 +1343,17 @@ discard block |
||
1343 | 1343 | * |
1344 | 1344 | * @return string |
1345 | 1345 | */ |
1346 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1347 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
1346 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1347 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
1348 | 1348 | |
1349 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1350 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1349 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1350 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1351 | 1351 | } |
1352 | 1352 | |
1353 | 1353 | return $field_value; |
1354 | 1354 | } |
1355 | 1355 | |
1356 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1356 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1357 | 1357 | |
1358 | 1358 | /** |
1359 | 1359 | * Set value for Offline Donations --> Offline Donations. |
@@ -1369,17 +1369,17 @@ discard block |
||
1369 | 1369 | * |
1370 | 1370 | * @return string |
1371 | 1371 | */ |
1372 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1373 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
1372 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1373 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
1374 | 1374 | |
1375 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1376 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1375 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1376 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | return $field_value; |
1380 | 1380 | } |
1381 | 1381 | |
1382 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1382 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1383 | 1383 | |
1384 | 1384 | |
1385 | 1385 | /** |
@@ -1394,14 +1394,14 @@ discard block |
||
1394 | 1394 | * |
1395 | 1395 | * @return mixed |
1396 | 1396 | */ |
1397 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1397 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1398 | 1398 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1399 | 1399 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1400 | 1400 | |
1401 | 1401 | return $field_id; |
1402 | 1402 | } |
1403 | 1403 | |
1404 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1404 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1405 | 1405 | |
1406 | 1406 | /** |
1407 | 1407 | * Set repeater field value for multi donation form. |
@@ -1415,13 +1415,13 @@ discard block |
||
1415 | 1415 | * |
1416 | 1416 | * @return mixed |
1417 | 1417 | */ |
1418 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1419 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1418 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1419 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1420 | 1420 | |
1421 | 1421 | return $field_value; |
1422 | 1422 | } |
1423 | 1423 | |
1424 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1424 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1425 | 1425 | |
1426 | 1426 | /** |
1427 | 1427 | * Set default value for _give_id field. |
@@ -1432,11 +1432,11 @@ discard block |
||
1432 | 1432 | * |
1433 | 1433 | * @return string |
1434 | 1434 | */ |
1435 | -function _give_set_field_give_id_default_value( $field ) { |
|
1435 | +function _give_set_field_give_id_default_value($field) { |
|
1436 | 1436 | return 0; |
1437 | 1437 | } |
1438 | 1438 | |
1439 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1439 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1440 | 1440 | |
1441 | 1441 | /** |
1442 | 1442 | * Set default value for _give_default field. |
@@ -1447,11 +1447,11 @@ discard block |
||
1447 | 1447 | * |
1448 | 1448 | * @return string |
1449 | 1449 | */ |
1450 | -function _give_set_field_give_default_default_value( $field ) { |
|
1450 | +function _give_set_field_give_default_default_value($field) { |
|
1451 | 1451 | return 'default'; |
1452 | 1452 | } |
1453 | 1453 | |
1454 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1454 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1455 | 1455 | |
1456 | 1456 | /** |
1457 | 1457 | * Set repeater field editor id for field type wysiwyg. |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1467 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1468 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1466 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1467 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1468 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1469 | 1469 | } |
1470 | 1470 | |
1471 | 1471 | return $field_name; |
1472 | 1472 | } |
1473 | 1473 | |
1474 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1474 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
@@ -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 | |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param array $request The Form Data passed into the batch processing |
64 | 64 | */ |
65 | - public function set_properties( $request ) { |
|
65 | + public function set_properties($request) { |
|
66 | 66 | |
67 | 67 | // Set data from form submission |
68 | - if ( isset( $_POST['form'] ) ) { |
|
69 | - parse_str( $_POST['form'], $this->data ); |
|
68 | + if (isset($_POST['form'])) { |
|
69 | + parse_str($_POST['form'], $this->data); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->form = $this->data['forms']; |
73 | 73 | |
74 | 74 | // Setup donor ids cache. |
75 | - if( ! empty( $this->form ) ) { |
|
75 | + if ( ! empty($this->form)) { |
|
76 | 76 | // Cache donor ids to output unique list of donor. |
77 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
78 | - if( ! ( $this->donor_ids = Give_Cache::get( $this->query_id, true ) ) ) { |
|
77 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
78 | + if ( ! ($this->donor_ids = Give_Cache::get($this->query_id, true))) { |
|
79 | 79 | $this->donor_ids = array(); |
80 | - Give_Cache::set( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true ); |
|
80 | + Give_Cache::set($this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
84 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function csv_cols() { |
96 | 96 | |
97 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
97 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
98 | 98 | |
99 | 99 | // We need columns. |
100 | - if ( empty( $columns ) ) { |
|
100 | + if (empty($columns)) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - $cols = $this->get_cols( $columns ); |
|
104 | + $cols = $this->get_cols($columns); |
|
105 | 105 | |
106 | 106 | return $cols; |
107 | 107 | } |
@@ -113,38 +113,38 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - private function get_cols( $columns ) { |
|
116 | + private function get_cols($columns) { |
|
117 | 117 | |
118 | 118 | $cols = array(); |
119 | 119 | |
120 | - foreach ( $columns as $key => $value ) { |
|
120 | + foreach ($columns as $key => $value) { |
|
121 | 121 | |
122 | - switch ( $key ) { |
|
122 | + switch ($key) { |
|
123 | 123 | case 'full_name' : |
124 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
124 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
125 | 125 | break; |
126 | 126 | case 'email' : |
127 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
127 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
128 | 128 | break; |
129 | 129 | case 'address' : |
130 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
131 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
132 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
133 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
134 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
135 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
130 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
131 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
132 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
133 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
134 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
135 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
136 | 136 | break; |
137 | 137 | case 'userid' : |
138 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
138 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
139 | 139 | break; |
140 | 140 | case 'date_first_donated' : |
141 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
141 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
142 | 142 | break; |
143 | 143 | case 'donations' : |
144 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
144 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
145 | 145 | break; |
146 | 146 | case 'donation_sum' : |
147 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
147 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
148 | 148 | break; |
149 | 149 | } |
150 | 150 | } |
@@ -167,20 +167,20 @@ discard block |
||
167 | 167 | |
168 | 168 | $i = 0; |
169 | 169 | |
170 | - if ( ! empty( $this->form ) ) { |
|
170 | + if ( ! empty($this->form)) { |
|
171 | 171 | |
172 | 172 | // Export donors of a specific product |
173 | 173 | global $give_logs; |
174 | 174 | |
175 | 175 | $args = array( |
176 | - 'post_parent' => absint( $this->form ), |
|
176 | + 'post_parent' => absint($this->form), |
|
177 | 177 | 'log_type' => 'sale', |
178 | 178 | 'posts_per_page' => 30, |
179 | 179 | 'paged' => $this->step, |
180 | 180 | ); |
181 | 181 | |
182 | 182 | // Check for price option |
183 | - if ( null !== $this->price_id ) { |
|
183 | + if (null !== $this->price_id) { |
|
184 | 184 | $args['meta_query'] = array( |
185 | 185 | array( |
186 | 186 | 'key' => '_give_log_price_id', |
@@ -189,44 +189,44 @@ discard block |
||
189 | 189 | ); |
190 | 190 | } |
191 | 191 | |
192 | - $logs = $give_logs->get_connected_logs( $args ); |
|
192 | + $logs = $give_logs->get_connected_logs($args); |
|
193 | 193 | |
194 | - if ( $logs ) { |
|
195 | - foreach ( $logs as $log ) { |
|
196 | - $payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
197 | - $payment = new Give_Payment( $payment_id ); |
|
194 | + if ($logs) { |
|
195 | + foreach ($logs as $log) { |
|
196 | + $payment_id = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
197 | + $payment = new Give_Payment($payment_id); |
|
198 | 198 | |
199 | 199 | // Continue if donor already included. |
200 | - if( in_array( $payment->customer_id , $this->donor_ids ) ) { |
|
200 | + if (in_array($payment->customer_id, $this->donor_ids)) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $this->donor_ids[] = $payment->customer_id; |
205 | 205 | |
206 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
207 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
208 | - $i ++; |
|
206 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
207 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
208 | + $i++; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // Cache donor ids only if admin export donor for specific form. |
212 | - Give_Cache::set( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS, true ); |
|
212 | + Give_Cache::set($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS, true); |
|
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | |
216 | 216 | // Export all donors. |
217 | - $offset = 30 * ( $this->step - 1 ); |
|
218 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
217 | + $offset = 30 * ($this->step - 1); |
|
218 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
219 | 219 | |
220 | - foreach ( $donors as $donor ) { |
|
220 | + foreach ($donors as $donor) { |
|
221 | 221 | |
222 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
223 | - $i ++; |
|
222 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
223 | + $i++; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
229 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
228 | + $data = apply_filters('give_export_get_data', $data); |
|
229 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
230 | 230 | |
231 | 231 | return $data; |
232 | 232 | } |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | $percentage = 0; |
243 | 243 | |
244 | 244 | // We can't count the number when getting them for a specific form |
245 | - if ( empty( $this->form ) ) { |
|
245 | + if (empty($this->form)) { |
|
246 | 246 | |
247 | 247 | $total = Give()->customers->count(); |
248 | 248 | |
249 | - if ( $total > 0 ) { |
|
249 | + if ($total > 0) { |
|
250 | 250 | |
251 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
251 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
252 | 252 | |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - if ( $percentage > 100 ) { |
|
256 | + if ($percentage > 100) { |
|
257 | 257 | $percentage = 100; |
258 | 258 | } |
259 | 259 | |
@@ -269,46 +269,46 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | - private function set_donor_data( $i, $data, $donor ) { |
|
272 | + private function set_donor_data($i, $data, $donor) { |
|
273 | 273 | |
274 | 274 | $columns = $this->csv_cols(); |
275 | 275 | |
276 | 276 | // Set address variable |
277 | 277 | $address = ''; |
278 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
279 | - $address = give_get_donor_address( $donor->user_id ); |
|
278 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
279 | + $address = give_get_donor_address($donor->user_id); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // Set columns |
283 | - if ( ! empty( $columns['full_name'] ) ) { |
|
284 | - $data[ $i ]['full_name'] = $donor->name; |
|
283 | + if ( ! empty($columns['full_name'])) { |
|
284 | + $data[$i]['full_name'] = $donor->name; |
|
285 | 285 | } |
286 | - if ( ! empty( $columns['email'] ) ) { |
|
287 | - $data[ $i ]['email'] = $donor->email; |
|
286 | + if ( ! empty($columns['email'])) { |
|
287 | + $data[$i]['email'] = $donor->email; |
|
288 | 288 | } |
289 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
290 | - |
|
291 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
292 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
293 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
294 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
295 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
296 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
289 | + if ( ! empty($columns['address_line1'])) { |
|
290 | + |
|
291 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
292 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
293 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
294 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
295 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
296 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
297 | 297 | } |
298 | - if ( ! empty( $columns['userid'] ) ) { |
|
299 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
298 | + if ( ! empty($columns['userid'])) { |
|
299 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
300 | 300 | } |
301 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
302 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
301 | + if ( ! empty($columns['date_first_donated'])) { |
|
302 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
303 | 303 | } |
304 | - if ( ! empty( $columns['donations'] ) ) { |
|
305 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
304 | + if ( ! empty($columns['donations'])) { |
|
305 | + $data[$i]['donations'] = $donor->purchase_count; |
|
306 | 306 | } |
307 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
308 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
307 | + if ( ! empty($columns['donation_sum'])) { |
|
308 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
309 | 309 | } |
310 | 310 | |
311 | - return $data[ $i ]; |
|
311 | + return $data[$i]; |
|
312 | 312 | |
313 | 313 | } |
314 | 314 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Fires before batch export. |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $class Export class. |
37 | 37 | */ |
38 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
38 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
39 | 39 | |
40 | 40 | $export = new $_REQUEST['class']; |
41 | 41 | $export->export(); |
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
45 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Exports earnings for a specified time period |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | function give_export_earnings() { |
56 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
|
56 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php'; |
|
57 | 57 | |
58 | 58 | $earnings_export = new Give_Earnings_Export(); |
59 | 59 | |
60 | 60 | $earnings_export->export(); |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
63 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
64 | 64 | |
65 | 65 | |
66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | function give_register_batch_exporters() { |
73 | - if ( is_admin() ) { |
|
73 | + if (is_admin()) { |
|
74 | 74 | /** |
75 | 75 | * Fires in the admin, while plugins loaded. |
76 | 76 | * |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param string $class Export class. |
82 | 82 | */ |
83 | - do_action( 'give_register_batch_exporter' ); |
|
83 | + do_action('give_register_batch_exporter'); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
87 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Register the payments batch exporter |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * @since 1.5 |
93 | 93 | */ |
94 | 94 | function give_register_payments_batch_export() { |
95 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
95 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
96 | 96 | } |
97 | 97 | |
98 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
98 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Loads the payments batch process if needed |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | -function give_include_payments_batch_processor( $class ) { |
|
109 | +function give_include_payments_batch_processor($class) { |
|
110 | 110 | |
111 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
112 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php'; |
|
111 | + if ('Give_Batch_Payments_Export' === $class) { |
|
112 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php'; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * @since 1.5.2 |
121 | 121 | */ |
122 | 122 | function give_register_customers_batch_export() { |
123 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
123 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
126 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Loads the customers batch process if needed |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return void |
136 | 136 | */ |
137 | -function give_include_customers_batch_processor( $class ) { |
|
137 | +function give_include_customers_batch_processor($class) { |
|
138 | 138 | |
139 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
140 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-customers.php'; |
|
139 | + if ('Give_Batch_Customers_Export' === $class) { |
|
140 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-customers.php'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | } |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | * @since 1.5 |
149 | 149 | */ |
150 | 150 | function give_register_forms_batch_export() { |
151 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
151 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
152 | 152 | } |
153 | 153 | |
154 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
154 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Loads the file downloads batch process if needed |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return void |
164 | 164 | */ |
165 | -function give_include_forms_batch_processor( $class ) { |
|
165 | +function give_include_forms_batch_processor($class) { |
|
166 | 166 | |
167 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
168 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
|
167 | + if ('Give_Batch_Forms_Export' === $class) { |
|
168 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | } |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public function headers() { |
51 | - ignore_user_abort( true ); |
|
51 | + ignore_user_abort(true); |
|
52 | 52 | |
53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
54 | - set_time_limit( 0 ); |
|
53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
54 | + set_time_limit(0); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | nocache_headers(); |
58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
60 | - header( "Expires: 0" ); |
|
58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
60 | + header("Expires: 0"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function csv_cols() { |
71 | 71 | $cols = array( |
72 | - 'id' => __( 'ID', 'give' ), |
|
73 | - 'date' => __( 'Date', 'give' ) |
|
72 | + 'id' => __('ID', 'give'), |
|
73 | + 'date' => __('Date', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function get_csv_cols() { |
87 | 87 | $cols = $this->csv_cols(); |
88 | 88 | |
89 | - return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols ); |
|
89 | + return apply_filters("give_export_csv_cols_{$this->export_type}", $cols); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | public function csv_cols_out() { |
101 | 101 | $cols = $this->get_csv_cols(); |
102 | 102 | $i = 1; |
103 | - foreach ( $cols as $col_id => $column ) { |
|
104 | - echo '"' . addslashes( $column ) . '"'; |
|
105 | - echo $i == count( $cols ) ? '' : ','; |
|
106 | - $i ++; |
|
103 | + foreach ($cols as $col_id => $column) { |
|
104 | + echo '"'.addslashes($column).'"'; |
|
105 | + echo $i == count($cols) ? '' : ','; |
|
106 | + $i++; |
|
107 | 107 | } |
108 | 108 | echo "\r\n"; |
109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $data = array( |
121 | 121 | 0 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ), |
125 | 125 | 1 => array( |
126 | 126 | 'id' => '', |
127 | - 'data' => date( 'F j, Y' ) |
|
127 | + 'data' => date('F j, Y') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $cols = $this->get_csv_cols(); |
148 | 148 | |
149 | 149 | // Output each row |
150 | - foreach ( $data as $row ) { |
|
150 | + foreach ($data as $row) { |
|
151 | 151 | $i = 1; |
152 | - foreach ( $row as $col_id => $column ) { |
|
152 | + foreach ($row as $col_id => $column) { |
|
153 | 153 | // Make sure the column is valid |
154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
155 | - echo '"' . addslashes( $column ) . '"'; |
|
156 | - echo $i == count( $cols ) ? '' : ','; |
|
157 | - $i ++; |
|
154 | + if (array_key_exists($col_id, $cols)) { |
|
155 | + echo '"'.addslashes($column).'"'; |
|
156 | + echo $i == count($cols) ? '' : ','; |
|
157 | + $i++; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function export() { |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Set headers |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_ajax_export() { |
27 | 27 | |
28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
29 | 29 | |
30 | - parse_str( $_POST['form'], $form ); |
|
30 | + parse_str($_POST['form'], $form); |
|
31 | 31 | |
32 | 32 | $_REQUEST = $form = (array) $form; |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
35 | - die( '-2' ); |
|
34 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
35 | + die('-2'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,69 +42,69 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param string $class Export class. |
44 | 44 | */ |
45 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
45 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
46 | 46 | |
47 | - $step = absint( $_POST['step'] ); |
|
48 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
47 | + $step = absint($_POST['step']); |
|
48 | + $class = sanitize_text_field($form['give-export-class']); |
|
49 | 49 | |
50 | - $export = new $class( $step ); |
|
50 | + $export = new $class($step); |
|
51 | 51 | |
52 | - if ( ! $export->can_export() ) { |
|
53 | - die( '-1' ); |
|
52 | + if ( ! $export->can_export()) { |
|
53 | + die('-1'); |
|
54 | 54 | } |
55 | 55 | |
56 | - if ( ! $export->is_writable ) { |
|
56 | + if ( ! $export->is_writable) { |
|
57 | 57 | $json_args = array( |
58 | 58 | 'error' => true, |
59 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
59 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
60 | 60 | ); |
61 | 61 | echo json_encode($json_args); |
62 | 62 | exit; |
63 | 63 | } |
64 | 64 | |
65 | - $export->set_properties( $_REQUEST ); |
|
65 | + $export->set_properties($_REQUEST); |
|
66 | 66 | |
67 | 67 | $export->pre_fetch(); |
68 | 68 | |
69 | - $ret = $export->process_step( $step ); |
|
69 | + $ret = $export->process_step($step); |
|
70 | 70 | |
71 | 71 | $percentage = $export->get_percentage_complete(); |
72 | 72 | |
73 | - if ( $ret ) { |
|
73 | + if ($ret) { |
|
74 | 74 | |
75 | 75 | $step += 1; |
76 | - echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); |
|
76 | + echo json_encode(array('step' => $step, 'percentage' => $percentage)); |
|
77 | 77 | exit; |
78 | 78 | |
79 | - } elseif ( true === $export->is_empty ) { |
|
79 | + } elseif (true === $export->is_empty) { |
|
80 | 80 | |
81 | - echo json_encode( array( |
|
81 | + echo json_encode(array( |
|
82 | 82 | 'error' => true, |
83 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
84 | - ) ); |
|
83 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
84 | + )); |
|
85 | 85 | exit; |
86 | 86 | |
87 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
87 | + } elseif (true === $export->done && true === $export->is_void) { |
|
88 | 88 | |
89 | - $message = ! empty( $export->message ) ? $export->message : esc_html__( 'Batch Processing Complete', 'give' ); |
|
90 | - echo json_encode( array( 'success' => true, 'message' => $message ) ); |
|
89 | + $message = ! empty($export->message) ? $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
90 | + echo json_encode(array('success' => true, 'message' => $message)); |
|
91 | 91 | exit; |
92 | 92 | |
93 | 93 | } else { |
94 | 94 | |
95 | - $args = array_merge( $_REQUEST, array( |
|
95 | + $args = array_merge($_REQUEST, array( |
|
96 | 96 | 'step' => $step, |
97 | 97 | 'class' => $class, |
98 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
98 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
99 | 99 | 'give_action' => 'form_batch_export', |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | |
102 | - $download_url = add_query_arg( $args, admin_url() ); |
|
102 | + $download_url = add_query_arg($args, admin_url()); |
|
103 | 103 | |
104 | - echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); |
|
104 | + echo json_encode(array('step' => 'done', 'url' => $download_url)); |
|
105 | 105 | exit; |
106 | 106 | |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
110 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
39 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
39 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
40 | 40 | <?php |
41 | 41 | /** |
42 | 42 | * Fires in the recount stats selectbox. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @since 1.5 |
47 | 47 | */ |
48 | - do_action( 'give_recount_tool_options' ); |
|
48 | + do_action('give_recount_tool_options'); |
|
49 | 49 | ?> |
50 | 50 | </select> |
51 | 51 | |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | <?php |
54 | 54 | $args = array( |
55 | 55 | 'name' => 'form_id', |
56 | - 'number' => - 1, |
|
56 | + 'number' => -1, |
|
57 | 57 | 'chosen' => true, |
58 | 58 | ); |
59 | - echo Give()->html->forms_dropdown( $args ); |
|
59 | + echo Give()->html->forms_dropdown($args); |
|
60 | 60 | ?> |
61 | 61 | </span> |
62 | 62 | |
63 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
63 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
64 | 64 | |
65 | 65 | <br/> |
66 | 66 | |
67 | 67 | <span class="give-recount-stats-descriptions"> |
68 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
70 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
71 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
68 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
69 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
70 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
71 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
72 | 72 | <?php |
73 | 73 | /** |
74 | 74 | * Fires in the recount stats description area. |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @since 1.5 |
79 | 79 | */ |
80 | - do_action( 'give_recount_tool_descriptions' ); |
|
80 | + do_action('give_recount_tool_descriptions'); |
|
81 | 81 | ?> |
82 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
83 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
82 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
83 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
84 | 84 | </span> |
85 | 85 | |
86 | 86 | <span class="spinner"></span> |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @since 1.5 |
96 | 96 | */ |
97 | - do_action( 'give_tools_recount_forms' ); |
|
97 | + do_action('give_tools_recount_forms'); |
|
98 | 98 | ?> |
99 | 99 | </div><!-- .inside --> |
100 | 100 | </div><!-- .postbox --> |
@@ -105,4 +105,4 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.5 |
107 | 107 | */ |
108 | -do_action( 'give_tools_recount_stats_after' ); |
|
108 | +do_action('give_tools_recount_stats_after'); |
@@ -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_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'logs'; |
46 | - $this->label = __( 'Logs', 'give' ); |
|
46 | + $this->label = __('Logs', 'give'); |
|
47 | 47 | |
48 | 48 | $this->default_tab = 'sales'; |
49 | 49 | |
50 | 50 | parent::__construct(); |
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
55 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public function add_settings_page( $pages ) { |
|
69 | - $pages[ $this->id ] = $this->label; |
|
68 | + public function add_settings_page($pages) { |
|
69 | + $pages[$this->id] = $this->label; |
|
70 | 70 | |
71 | 71 | return $pages; |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $GLOBALS['give_hide_save_button'] = true; |
83 | 83 | |
84 | 84 | // Get settings. |
85 | - $settings = apply_filters( 'give_settings_logs', array( |
|
85 | + $settings = apply_filters('give_settings_logs', array( |
|
86 | 86 | array( |
87 | 87 | 'id' => 'give_tools_logs', |
88 | 88 | 'type' => 'title', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ), |
91 | 91 | array( |
92 | 92 | 'id' => 'api', |
93 | - 'name' => __( 'Log', 'give' ), |
|
93 | + 'name' => __('Log', 'give'), |
|
94 | 94 | 'type' => 'logs', |
95 | 95 | |
96 | 96 | ), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'type' => 'sectionend', |
100 | 100 | 'table_html' => false, |
101 | 101 | ), |
102 | - ) ); |
|
102 | + )); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Filter the settings. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param array $settings |
110 | 110 | */ |
111 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
111 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
112 | 112 | |
113 | 113 | // Output. |
114 | 114 | return $settings; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_sections() { |
124 | 124 | $sections = array( |
125 | - 'sales' => __( 'Donations', 'give' ), |
|
126 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
127 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
125 | + 'sales' => __('Donations', 'give'), |
|
126 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
127 | + 'api_requests' => __('API Requests', 'give'), |
|
128 | 128 | ); |
129 | 129 | |
130 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
130 | + $sections = apply_filters('give_log_views', $sections); |
|
131 | 131 | |
132 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
132 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function output() { |
142 | 142 | $settings = $this->get_settings(); |
143 | 143 | |
144 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
144 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 |
@@ -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,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
57 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_logs_view_gateway_errors() { |
69 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
69 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
70 | 70 | |
71 | 71 | $logs_table = new Give_Gateway_Error_Log_Table(); |
72 | 72 | $logs_table->prepare_items(); |
73 | 73 | $logs_table->display(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
76 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * API Request Logs |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | function give_logs_view_api_requests() { |
88 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
88 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
89 | 89 | |
90 | 90 | $logs_table = new Give_API_Request_Log_Table(); |
91 | 91 | $logs_table->prepare_items(); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @since 1.0 |
100 | 100 | */ |
101 | - do_action( 'give_logs_api_requests_top' ); |
|
101 | + do_action('give_logs_api_requests_top'); |
|
102 | 102 | ?> |
103 | 103 | |
104 | 104 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
105 | 105 | <?php |
106 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
106 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
107 | 107 | $logs_table->display(); |
108 | 108 | ?> |
109 | 109 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @since 1.0 |
118 | 118 | */ |
119 | - do_action( 'give_logs_api_requests_bottom' ); |
|
119 | + do_action('give_logs_api_requests_bottom'); |
|
120 | 120 | ?> |
121 | 121 | |
122 | 122 | </div> |
123 | 123 | <?php |
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
126 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Renders the log views drop down. |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | $current_section = give_get_current_setting_section(); |
136 | 136 | |
137 | 137 | // If there are not any event attach to action then do not show form. |
138 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
138 | + if ( ! has_action('give_log_view_actions')) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | ?> |
142 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
142 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
143 | 143 | <?php |
144 | 144 | /** |
145 | 145 | * Fires after displaying the reports page views drop down. |
@@ -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 |