@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,36 +23,36 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | // Give Forms single post and archive options. |
26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
28 | 28 | |
29 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
29 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
30 | 30 | // Support for old 'GIVE_FORMS_SLUG' constant |
31 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
31 | + if (defined('GIVE_FORMS_SLUG')) { |
|
32 | 32 | $give_forms_slug = GIVE_FORMS_SLUG; |
33 | 33 | } |
34 | 34 | |
35 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
35 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | 36 | 'slug' => $give_forms_slug, |
37 | 37 | 'with_front' => false, |
38 | 38 | ); |
39 | 39 | |
40 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
41 | - 'name' => esc_html__( 'Donation Forms', 'give' ), |
|
42 | - 'singular_name' => esc_html__( 'Form', 'give' ), |
|
43 | - 'add_new' => esc_html__( 'Add Form', 'give' ), |
|
44 | - 'add_new_item' => esc_html__( 'Add New Donation Form', 'give' ), |
|
45 | - 'edit_item' => esc_html__( 'Edit Donation Form', 'give' ), |
|
46 | - 'new_item' => esc_html__( 'New Form', 'give' ), |
|
47 | - 'all_items' => esc_html__( 'All Forms', 'give' ), |
|
48 | - 'view_item' => esc_html__( 'View Form', 'give' ), |
|
49 | - 'search_items' => esc_html__( 'Search Forms', 'give' ), |
|
50 | - 'not_found' => esc_html__( 'No forms found.', 'give' ), |
|
51 | - 'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ), |
|
40 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
41 | + 'name' => esc_html__('Donation Forms', 'give'), |
|
42 | + 'singular_name' => esc_html__('Form', 'give'), |
|
43 | + 'add_new' => esc_html__('Add Form', 'give'), |
|
44 | + 'add_new_item' => esc_html__('Add New Donation Form', 'give'), |
|
45 | + 'edit_item' => esc_html__('Edit Donation Form', 'give'), |
|
46 | + 'new_item' => esc_html__('New Form', 'give'), |
|
47 | + 'all_items' => esc_html__('All Forms', 'give'), |
|
48 | + 'view_item' => esc_html__('View Form', 'give'), |
|
49 | + 'search_items' => esc_html__('Search Forms', 'give'), |
|
50 | + 'not_found' => esc_html__('No forms found.', 'give'), |
|
51 | + 'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'), |
|
52 | 52 | 'parent_item_colon' => '', |
53 | - 'menu_name' => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ), |
|
54 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) ), |
|
55 | - ) ); |
|
53 | + 'menu_name' => apply_filters('give_menu_name', esc_html__('Donations', 'give')), |
|
54 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give')), |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | // Default give_forms supports. |
58 | 58 | $give_form_supports = array( |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | // Has the user disabled the excerpt? |
67 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
68 | - unset( $give_form_supports[2] ); |
|
67 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
68 | + unset($give_form_supports[2]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Has user disabled the featured image? |
72 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
73 | - unset( $give_form_supports[1] ); |
|
74 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
72 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
73 | + unset($give_form_supports[1]); |
|
74 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $give_forms_args = array( |
@@ -87,42 +87,42 @@ discard block |
||
87 | 87 | 'has_archive' => $give_forms_archives, |
88 | 88 | 'menu_icon' => 'dashicons-give', |
89 | 89 | 'hierarchical' => false, |
90 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
90 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
91 | 91 | ); |
92 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
92 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
93 | 93 | |
94 | 94 | /** Donation Post Type */ |
95 | 95 | $payment_labels = array( |
96 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
97 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
98 | - 'add_new' => esc_html__( 'Add New', 'give' ), |
|
99 | - 'add_new_item' => esc_html__( 'Add New Donation', 'give' ), |
|
100 | - 'edit_item' => esc_html__( 'Edit Donation', 'give' ), |
|
101 | - 'new_item' => esc_html__( 'New Donation', 'give' ), |
|
102 | - 'all_items' => esc_html__( 'All Donations', 'give' ), |
|
103 | - 'view_item' => esc_html__( 'View Donation', 'give' ), |
|
104 | - 'search_items' => esc_html__( 'Search Donations', 'give' ), |
|
105 | - 'not_found' => esc_html__( 'No donations found.', 'give' ), |
|
106 | - 'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ), |
|
96 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
97 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
98 | + 'add_new' => esc_html__('Add New', 'give'), |
|
99 | + 'add_new_item' => esc_html__('Add New Donation', 'give'), |
|
100 | + 'edit_item' => esc_html__('Edit Donation', 'give'), |
|
101 | + 'new_item' => esc_html__('New Donation', 'give'), |
|
102 | + 'all_items' => esc_html__('All Donations', 'give'), |
|
103 | + 'view_item' => esc_html__('View Donation', 'give'), |
|
104 | + 'search_items' => esc_html__('Search Donations', 'give'), |
|
105 | + 'not_found' => esc_html__('No donations found.', 'give'), |
|
106 | + 'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'), |
|
107 | 107 | 'parent_item_colon' => '', |
108 | - 'menu_name' => esc_html__( 'Donations', 'give' ), |
|
108 | + 'menu_name' => esc_html__('Donations', 'give'), |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | $payment_args = array( |
112 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
112 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
113 | 113 | 'public' => false, |
114 | 114 | 'query_var' => false, |
115 | 115 | 'rewrite' => false, |
116 | 116 | 'map_meta_cap' => true, |
117 | 117 | 'capability_type' => 'give_payment', |
118 | - 'supports' => array( 'title' ), |
|
118 | + 'supports' => array('title'), |
|
119 | 119 | 'can_export' => true, |
120 | 120 | ); |
121 | - register_post_type( 'give_payment', $payment_args ); |
|
121 | + register_post_type('give_payment', $payment_args); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
125 | +add_action('init', 'give_setup_post_types', 1); |
|
126 | 126 | |
127 | 127 | |
128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function give_setup_taxonomies() { |
137 | 137 | |
138 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
138 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
139 | 139 | |
140 | 140 | /** Categories */ |
141 | 141 | $category_labels = array( |
142 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
143 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
144 | - 'search_items' => esc_html__( 'Search Categories', 'give' ), |
|
145 | - 'all_items' => esc_html__( 'All Categories', 'give' ), |
|
146 | - 'parent_item' => esc_html__( 'Parent Category', 'give' ), |
|
147 | - 'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ), |
|
148 | - 'edit_item' => esc_html__( 'Edit Category', 'give' ), |
|
149 | - 'update_item' => esc_html__( 'Update Category', 'give' ), |
|
150 | - 'add_new_item' => esc_html__( 'Add New Category', 'give' ), |
|
151 | - 'new_item_name' => esc_html__( 'New Category Name', 'give' ), |
|
152 | - 'menu_name' => esc_html__( 'Categories', 'give' ), |
|
142 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
143 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
144 | + 'search_items' => esc_html__('Search Categories', 'give'), |
|
145 | + 'all_items' => esc_html__('All Categories', 'give'), |
|
146 | + 'parent_item' => esc_html__('Parent Category', 'give'), |
|
147 | + 'parent_item_colon' => esc_html__('Parent Category:', 'give'), |
|
148 | + 'edit_item' => esc_html__('Edit Category', 'give'), |
|
149 | + 'update_item' => esc_html__('Update Category', 'give'), |
|
150 | + 'add_new_item' => esc_html__('Add New Category', 'give'), |
|
151 | + 'new_item_name' => esc_html__('New Category Name', 'give'), |
|
152 | + 'menu_name' => esc_html__('Categories', 'give'), |
|
153 | 153 | ); |
154 | 154 | |
155 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
155 | + $category_args = apply_filters('give_forms_category_args', array( |
|
156 | 156 | 'hierarchical' => true, |
157 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
157 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
158 | 158 | 'show_ui' => true, |
159 | 159 | 'query_var' => 'give_forms_category', |
160 | 160 | 'rewrite' => array( |
161 | - 'slug' => $slug . '/category', |
|
161 | + 'slug' => $slug.'/category', |
|
162 | 162 | 'with_front' => false, |
163 | 163 | 'hierarchical' => true, |
164 | 164 | ), |
@@ -172,33 +172,33 @@ discard block |
||
172 | 172 | ); |
173 | 173 | |
174 | 174 | // Does the user want categories? |
175 | - if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
176 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
177 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
175 | + if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
176 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
177 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** Tags */ |
181 | 181 | $tag_labels = array( |
182 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
183 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
184 | - 'search_items' => esc_html__( 'Search Tags', 'give' ), |
|
185 | - 'all_items' => esc_html__( 'All Tags', 'give' ), |
|
186 | - 'parent_item' => esc_html__( 'Parent Tag', 'give' ), |
|
187 | - 'parent_item_colon' => esc_html__( 'Parent Tag:', 'give' ), |
|
188 | - 'edit_item' => esc_html__( 'Edit Tag', 'give' ), |
|
189 | - 'update_item' => esc_html__( 'Update Tag', 'give' ), |
|
190 | - 'add_new_item' => esc_html__( 'Add New Tag', 'give' ), |
|
191 | - 'new_item_name' => esc_html__( 'New Tag Name', 'give' ), |
|
192 | - 'menu_name' => esc_html__( 'Tags', 'give' ), |
|
193 | - 'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ), |
|
182 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
183 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
184 | + 'search_items' => esc_html__('Search Tags', 'give'), |
|
185 | + 'all_items' => esc_html__('All Tags', 'give'), |
|
186 | + 'parent_item' => esc_html__('Parent Tag', 'give'), |
|
187 | + 'parent_item_colon' => esc_html__('Parent Tag:', 'give'), |
|
188 | + 'edit_item' => esc_html__('Edit Tag', 'give'), |
|
189 | + 'update_item' => esc_html__('Update Tag', 'give'), |
|
190 | + 'add_new_item' => esc_html__('Add New Tag', 'give'), |
|
191 | + 'new_item_name' => esc_html__('New Tag Name', 'give'), |
|
192 | + 'menu_name' => esc_html__('Tags', 'give'), |
|
193 | + 'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'), |
|
194 | 194 | ); |
195 | 195 | |
196 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
196 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
197 | 197 | 'hierarchical' => false, |
198 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
198 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
199 | 199 | 'show_ui' => true, |
200 | 200 | 'query_var' => 'give_forms_tag', |
201 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
201 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
202 | 202 | 'capabilities' => array( |
203 | 203 | 'manage_terms' => 'manage_give_form_terms', |
204 | 204 | 'edit_terms' => 'edit_give_form_terms', |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | |
211 | - if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
212 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
213 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
211 | + if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
212 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
213 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | } |
217 | 217 | |
218 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
218 | +add_action('init', 'give_setup_taxonomies', 0); |
|
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function give_get_default_form_labels() { |
228 | 228 | $defaults = array( |
229 | - 'singular' => esc_html__( 'Form', 'give' ), |
|
230 | - 'plural' => esc_html__( 'Forms', 'give' ), |
|
229 | + 'singular' => esc_html__('Form', 'give'), |
|
230 | + 'plural' => esc_html__('Forms', 'give'), |
|
231 | 231 | ); |
232 | 232 | |
233 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
233 | + return apply_filters('give_default_form_name', $defaults); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return string $defaults['singular'] Singular label |
244 | 244 | */ |
245 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
245 | +function give_get_forms_label_singular($lowercase = false) { |
|
246 | 246 | $defaults = give_get_default_form_labels(); |
247 | 247 | |
248 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
248 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | * @since 1.0 |
255 | 255 | * @return string $defaults['plural'] Plural label |
256 | 256 | */ |
257 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
257 | +function give_get_forms_label_plural($lowercase = false) { |
|
258 | 258 | $defaults = give_get_default_form_labels(); |
259 | 259 | |
260 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
260 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return string $title New placeholder text |
271 | 271 | */ |
272 | -function give_change_default_title( $title ) { |
|
272 | +function give_change_default_title($title) { |
|
273 | 273 | // If a frontend plugin uses this filter (check extensions before changing this function) |
274 | - if ( ! is_admin() ) { |
|
275 | - $title = esc_html__( 'Enter form title here', 'give' ); |
|
274 | + if ( ! is_admin()) { |
|
275 | + $title = esc_html__('Enter form title here', 'give'); |
|
276 | 276 | |
277 | 277 | return $title; |
278 | 278 | } |
279 | 279 | |
280 | 280 | $screen = get_current_screen(); |
281 | 281 | |
282 | - if ( 'give_forms' == $screen->post_type ) { |
|
283 | - $title = esc_html__( 'Enter form title here', 'give' ); |
|
282 | + if ('give_forms' == $screen->post_type) { |
|
283 | + $title = esc_html__('Enter form title here', 'give'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $title; |
287 | 287 | } |
288 | 288 | |
289 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
289 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Registers Custom Post Statuses which are used by the Payments |
@@ -296,50 +296,50 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function give_register_post_type_statuses() { |
298 | 298 | // Payment Statuses |
299 | - register_post_status( 'refunded', array( |
|
300 | - 'label' => esc_html__( 'Refunded', 'give' ), |
|
299 | + register_post_status('refunded', array( |
|
300 | + 'label' => esc_html__('Refunded', 'give'), |
|
301 | 301 | 'public' => true, |
302 | 302 | 'exclude_from_search' => false, |
303 | 303 | 'show_in_admin_all_list' => true, |
304 | 304 | 'show_in_admin_status_list' => true, |
305 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
306 | - ) ); |
|
307 | - register_post_status( 'failed', array( |
|
308 | - 'label' => esc_html__( 'Failed', 'give' ), |
|
305 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
306 | + )); |
|
307 | + register_post_status('failed', array( |
|
308 | + 'label' => esc_html__('Failed', 'give'), |
|
309 | 309 | 'public' => true, |
310 | 310 | 'exclude_from_search' => false, |
311 | 311 | 'show_in_admin_all_list' => true, |
312 | 312 | 'show_in_admin_status_list' => true, |
313 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
314 | - ) ); |
|
315 | - register_post_status( 'revoked', array( |
|
316 | - 'label' => esc_html__( 'Revoked', 'give' ), |
|
313 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
314 | + )); |
|
315 | + register_post_status('revoked', array( |
|
316 | + 'label' => esc_html__('Revoked', 'give'), |
|
317 | 317 | 'public' => true, |
318 | 318 | 'exclude_from_search' => false, |
319 | 319 | 'show_in_admin_all_list' => true, |
320 | 320 | 'show_in_admin_status_list' => true, |
321 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
322 | - ) ); |
|
323 | - register_post_status( 'cancelled', array( |
|
324 | - 'label' => esc_html__( 'Cancelled', 'give' ), |
|
321 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
322 | + )); |
|
323 | + register_post_status('cancelled', array( |
|
324 | + 'label' => esc_html__('Cancelled', 'give'), |
|
325 | 325 | 'public' => true, |
326 | 326 | 'exclude_from_search' => false, |
327 | 327 | 'show_in_admin_all_list' => true, |
328 | 328 | 'show_in_admin_status_list' => true, |
329 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
330 | - ) ); |
|
331 | - register_post_status( 'abandoned', array( |
|
332 | - 'label' => esc_html__( 'Abandoned', 'give' ), |
|
329 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
330 | + )); |
|
331 | + register_post_status('abandoned', array( |
|
332 | + 'label' => esc_html__('Abandoned', 'give'), |
|
333 | 333 | 'public' => true, |
334 | 334 | 'exclude_from_search' => false, |
335 | 335 | 'show_in_admin_all_list' => true, |
336 | 336 | 'show_in_admin_status_list' => true, |
337 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
338 | - ) ); |
|
337 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
338 | + )); |
|
339 | 339 | |
340 | 340 | } |
341 | 341 | |
342 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
342 | +add_action('init', 'give_register_post_type_statuses'); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Updated Messages |
@@ -352,27 +352,27 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return array $messages New post updated messages |
354 | 354 | */ |
355 | -function give_updated_messages( $messages ) { |
|
355 | +function give_updated_messages($messages) { |
|
356 | 356 | global $post, $post_ID; |
357 | 357 | |
358 | - if ( give_get_option( 'disable_forms_singular' ) === 'on' ) { |
|
358 | + if (give_get_option('disable_forms_singular') === 'on') { |
|
359 | 359 | |
360 | 360 | $messages['give_forms'] = array( |
361 | - 1 => esc_html__( 'Form updated.', 'give' ), |
|
362 | - 4 => esc_html__( 'Form updated.', 'give' ), |
|
363 | - 6 => esc_html__( 'Form published.', 'give' ), |
|
364 | - 7 => esc_html__( 'Form saved.', 'give' ), |
|
365 | - 8 => esc_html__( 'Form submitted.', 'give' ), |
|
361 | + 1 => esc_html__('Form updated.', 'give'), |
|
362 | + 4 => esc_html__('Form updated.', 'give'), |
|
363 | + 6 => esc_html__('Form published.', 'give'), |
|
364 | + 7 => esc_html__('Form saved.', 'give'), |
|
365 | + 8 => esc_html__('Form submitted.', 'give'), |
|
366 | 366 | ); |
367 | 367 | |
368 | 368 | } else { |
369 | 369 | |
370 | 370 | $messages['give_forms'] = array( |
371 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
372 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
373 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
374 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
375 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ), |
|
371 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
372 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
373 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
374 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
375 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')), |
|
376 | 376 | ); |
377 | 377 | |
378 | 378 | } |
@@ -380,27 +380,27 @@ discard block |
||
380 | 380 | return $messages; |
381 | 381 | } |
382 | 382 | |
383 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
383 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
384 | 384 | |
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Setup Post Type Images |
388 | 388 | */ |
389 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
389 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Ensure post thumbnail support is turned on |
393 | 393 | */ |
394 | 394 | function give_add_thumbnail_support() { |
395 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
395 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
396 | 396 | return; |
397 | 397 | } |
398 | 398 | |
399 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
400 | - add_theme_support( 'post-thumbnails' ); |
|
399 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
400 | + add_theme_support('post-thumbnails'); |
|
401 | 401 | } |
402 | 402 | |
403 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
403 | + add_post_type_support('give_forms', 'thumbnail'); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -412,21 +412,21 @@ discard block |
||
412 | 412 | |
413 | 413 | // Single Give Forms (disabled if single turned off in settings) |
414 | 414 | if ( |
415 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
416 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
415 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
416 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
417 | 417 | ) { |
418 | 418 | |
419 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
420 | - 'name' => esc_html__( 'Give Single Form Sidebar', 'give' ), |
|
419 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
420 | + 'name' => esc_html__('Give Single Form Sidebar', 'give'), |
|
421 | 421 | 'id' => 'give-forms-sidebar', |
422 | - 'description' => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
422 | + 'description' => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
423 | 423 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
424 | 424 | 'after_widget' => '</div>', |
425 | 425 | 'before_title' => '<h3 class="widgettitle widget-title">', |
426 | 426 | 'after_title' => '</h3>', |
427 | - ) ) ); |
|
427 | + ))); |
|
428 | 428 | |
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
432 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function give_get_currency() { |
39 | 39 | |
40 | - $currency = give_get_option( 'currency', 'USD' ); |
|
40 | + $currency = give_get_option('currency', 'USD'); |
|
41 | 41 | |
42 | - return apply_filters( 'give_currency', $currency ); |
|
42 | + return apply_filters('give_currency', $currency); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function give_get_currency_position() { |
53 | 53 | |
54 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
54 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
55 | 55 | |
56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
56 | + return apply_filters('give_currency_position', $currency_pos); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | |
67 | 67 | function give_get_currencies() { |
68 | 68 | $currencies = array( |
69 | - 'USD' => esc_html__( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => esc_html__( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => esc_html__( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => esc_html__( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => esc_html__( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => esc_html__( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => esc_html__( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => esc_html__( 'Danish Krone (kr)', 'give' ), |
|
77 | - 'HKD' => esc_html__( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => esc_html__( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => esc_html__( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => esc_html__( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => esc_html__( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => esc_html__( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => esc_html__( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => esc_html__( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => esc_html__( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => esc_html__( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => esc_html__( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => esc_html__( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => esc_html__( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => esc_html__( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => esc_html__( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => esc_html__( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => esc_html__( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => esc_html__( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => esc_html__( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => esc_html__( 'Russian Rubles (руб)', 'give' ) |
|
69 | + 'USD' => esc_html__('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => esc_html__('Euros (€)', 'give'), |
|
71 | + 'GBP' => esc_html__('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => esc_html__('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => esc_html__('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => esc_html__('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => esc_html__('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => esc_html__('Danish Krone (kr)', 'give'), |
|
77 | + 'HKD' => esc_html__('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => esc_html__('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => esc_html__('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => esc_html__('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => esc_html__('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => esc_html__('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => esc_html__('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => esc_html__('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => esc_html__('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => esc_html__('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => esc_html__('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => esc_html__('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => esc_html__('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => esc_html__('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => esc_html__('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => esc_html__('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => esc_html__('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => esc_html__('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => esc_html__('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => esc_html__('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => esc_html__('Russian Rubles (руб)', 'give') |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string The symbol to use for the currency |
115 | 115 | */ |
116 | -function give_currency_symbol( $currency = '' ) { |
|
116 | +function give_currency_symbol($currency = '') { |
|
117 | 117 | |
118 | - if ( empty( $currency ) ) { |
|
118 | + if (empty($currency)) { |
|
119 | 119 | $currency = give_get_currency(); |
120 | 120 | } |
121 | - switch ( $currency ) : |
|
121 | + switch ($currency) : |
|
122 | 122 | case 'GBP' : |
123 | 123 | $symbol = '£'; |
124 | 124 | break; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | endswitch; |
198 | 198 | |
199 | 199 | |
200 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
200 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function give_get_current_page_url() { |
211 | 211 | |
212 | - if ( is_front_page() ) { |
|
213 | - $current_url = home_url( '/' ); |
|
212 | + if (is_front_page()) { |
|
213 | + $current_url = home_url('/'); |
|
214 | 214 | } else { |
215 | - $http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] ); |
|
216 | - $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] ); |
|
217 | - $current_url = set_url_scheme( 'http://' . $http_host . untrailingslashit( $request_uri ) ); |
|
215 | + $http_host = sanitize_text_field($_SERVER['HTTP_HOST']); |
|
216 | + $request_uri = sanitize_text_field($_SERVER['REQUEST_URI']); |
|
217 | + $current_url = set_url_scheme('http://'.$http_host.untrailingslashit($request_uri)); |
|
218 | 218 | } |
219 | 219 | |
220 | - return apply_filters( 'give_get_current_page_url', $current_url ); |
|
220 | + return apply_filters('give_get_current_page_url', $current_url); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | */ |
239 | 239 | $gateways = give_get_enabled_payment_gateways(); |
240 | 240 | |
241 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
241 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
242 | 242 | $ret = true; |
243 | - } else if ( count( $gateways ) == 1 ) { |
|
243 | + } else if (count($gateways) == 1) { |
|
244 | 244 | $ret = false; |
245 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
245 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
246 | 246 | $ret = false; |
247 | 247 | } |
248 | 248 | |
249 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
249 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,26 +258,26 @@ discard block |
||
258 | 258 | function give_get_timezone_id() { |
259 | 259 | |
260 | 260 | // if site timezone string exists, return it |
261 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
261 | + if ($timezone = get_option('timezone_string')) { |
|
262 | 262 | return $timezone; |
263 | 263 | } |
264 | 264 | |
265 | 265 | // get UTC offset, if it isn't set return UTC |
266 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
266 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
267 | 267 | return 'UTC'; |
268 | 268 | } |
269 | 269 | |
270 | 270 | // attempt to guess the timezone string from the UTC offset |
271 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
271 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
272 | 272 | |
273 | 273 | // last try, guess timezone string manually |
274 | - if ( $timezone === false ) { |
|
274 | + if ($timezone === false) { |
|
275 | 275 | |
276 | - $is_dst = date( 'I' ); |
|
276 | + $is_dst = date('I'); |
|
277 | 277 | |
278 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
279 | - foreach ( $abbr as $city ) { |
|
280 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
278 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
279 | + foreach ($abbr as $city) { |
|
280 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
281 | 281 | return $city['timezone_id']; |
282 | 282 | } |
283 | 283 | } |
@@ -301,17 +301,17 @@ discard block |
||
301 | 301 | |
302 | 302 | $ip = '127.0.0.1'; |
303 | 303 | |
304 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
304 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
305 | 305 | //check ip from share internet |
306 | 306 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
307 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
307 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
308 | 308 | //to check ip is pass from proxy |
309 | 309 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
310 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
310 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
311 | 311 | $ip = $_SERVER['REMOTE_ADDR']; |
312 | 312 | } |
313 | 313 | |
314 | - return apply_filters( 'give_get_ip', $ip ); |
|
314 | + return apply_filters('give_get_ip', $ip); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @uses Give()->session->set() |
328 | 328 | */ |
329 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
330 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
331 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
329 | +function give_set_purchase_session($purchase_data = array()) { |
|
330 | + Give()->session->set('give_purchase', $purchase_data); |
|
331 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @return mixed array | false |
343 | 343 | */ |
344 | 344 | function give_get_purchase_session() { |
345 | - return Give()->session->get( 'give_purchase' ); |
|
345 | + return Give()->session->get('give_purchase'); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -357,14 +357,14 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return string |
359 | 359 | */ |
360 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
360 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
361 | 361 | $summary = ''; |
362 | 362 | |
363 | - if ( $email ) { |
|
364 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
363 | + if ($email) { |
|
364 | + $summary .= $purchase_data['user_email'].' - '; |
|
365 | 365 | } |
366 | 366 | |
367 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
367 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
368 | 368 | |
369 | 369 | return $summary; |
370 | 370 | } |
@@ -381,31 +381,31 @@ discard block |
||
381 | 381 | function give_get_host() { |
382 | 382 | $host = false; |
383 | 383 | |
384 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
384 | + if (defined('WPE_APIKEY')) { |
|
385 | 385 | $host = 'WP Engine'; |
386 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
386 | + } elseif (defined('PAGELYBIN')) { |
|
387 | 387 | $host = 'Pagely'; |
388 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
388 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
389 | 389 | $host = 'ICDSoft'; |
390 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
390 | + } elseif (DB_HOST == 'mysqlv5') { |
|
391 | 391 | $host = 'NetworkSolutions'; |
392 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
392 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
393 | 393 | $host = 'iPage'; |
394 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
394 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
395 | 395 | $host = 'IPower'; |
396 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
396 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
397 | 397 | $host = 'MediaTemple Grid'; |
398 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
398 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
399 | 399 | $host = 'pair Networks'; |
400 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
400 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
401 | 401 | $host = 'Rackspace Cloud'; |
402 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
402 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
403 | 403 | $host = 'SysFix.eu Power Hosting'; |
404 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
404 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
405 | 405 | $host = 'Flywheel'; |
406 | 406 | } else { |
407 | 407 | // Adding a general fallback for data gathering |
408 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
408 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | return $host; |
@@ -421,67 +421,67 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return bool true if host matches, false if not |
423 | 423 | */ |
424 | -function give_is_host( $host = false ) { |
|
424 | +function give_is_host($host = false) { |
|
425 | 425 | |
426 | 426 | $return = false; |
427 | 427 | |
428 | - if ( $host ) { |
|
429 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
428 | + if ($host) { |
|
429 | + $host = str_replace(' ', '', strtolower($host)); |
|
430 | 430 | |
431 | - switch ( $host ) { |
|
431 | + switch ($host) { |
|
432 | 432 | case 'wpengine': |
433 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
433 | + if (defined('WPE_APIKEY')) { |
|
434 | 434 | $return = true; |
435 | 435 | } |
436 | 436 | break; |
437 | 437 | case 'pagely': |
438 | - if ( defined( 'PAGELYBIN' ) ) { |
|
438 | + if (defined('PAGELYBIN')) { |
|
439 | 439 | $return = true; |
440 | 440 | } |
441 | 441 | break; |
442 | 442 | case 'icdsoft': |
443 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
443 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
444 | 444 | $return = true; |
445 | 445 | } |
446 | 446 | break; |
447 | 447 | case 'networksolutions': |
448 | - if ( DB_HOST == 'mysqlv5' ) { |
|
448 | + if (DB_HOST == 'mysqlv5') { |
|
449 | 449 | $return = true; |
450 | 450 | } |
451 | 451 | break; |
452 | 452 | case 'ipage': |
453 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
453 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
454 | 454 | $return = true; |
455 | 455 | } |
456 | 456 | break; |
457 | 457 | case 'ipower': |
458 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
458 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
459 | 459 | $return = true; |
460 | 460 | } |
461 | 461 | break; |
462 | 462 | case 'mediatemplegrid': |
463 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
463 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
464 | 464 | $return = true; |
465 | 465 | } |
466 | 466 | break; |
467 | 467 | case 'pairnetworks': |
468 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
468 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
469 | 469 | $return = true; |
470 | 470 | } |
471 | 471 | break; |
472 | 472 | case 'rackspacecloud': |
473 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
473 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
474 | 474 | $return = true; |
475 | 475 | } |
476 | 476 | break; |
477 | 477 | case 'sysfix.eu': |
478 | 478 | case 'sysfix.eupowerhosting': |
479 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
479 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
480 | 480 | $return = true; |
481 | 481 | } |
482 | 482 | break; |
483 | 483 | case 'flywheel': |
484 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
484 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
485 | 485 | $return = true; |
486 | 486 | } |
487 | 487 | break; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param string $replacement Optional. The function that should have been called. |
515 | 515 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
516 | 516 | */ |
517 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
517 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
518 | 518 | |
519 | 519 | /** |
520 | 520 | * Fires while give deprecated function call occurs. |
@@ -527,19 +527,19 @@ discard block |
||
527 | 527 | * @param string $replacement Optional. The function that should have been called. |
528 | 528 | * @param string $version The plugin version that deprecated the function. |
529 | 529 | */ |
530 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
530 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
531 | 531 | |
532 | - $show_errors = current_user_can( 'manage_options' ); |
|
532 | + $show_errors = current_user_can('manage_options'); |
|
533 | 533 | |
534 | 534 | // Allow plugin to filter the output error trigger |
535 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
536 | - if ( ! is_null( $replacement ) ) { |
|
537 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
538 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
535 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
536 | + if ( ! is_null($replacement)) { |
|
537 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
538 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
539 | 539 | // Alternatively we could dump this to a file. |
540 | 540 | } else { |
541 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
542 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
541 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
542 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
543 | 543 | // Alternatively we could dump this to a file. |
544 | 544 | } |
545 | 545 | } |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | * @return string $post_id |
554 | 554 | */ |
555 | 555 | function give_get_admin_post_id() { |
556 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
557 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
556 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
557 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
558 | 558 | $post_id = $_POST['post_id']; |
559 | 559 | } |
560 | 560 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * @return string Arg separator output |
569 | 569 | */ |
570 | 570 | function give_get_php_arg_separator_output() { |
571 | - return ini_get( 'arg_separator.output' ); |
|
571 | + return ini_get('arg_separator.output'); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -583,10 +583,10 @@ discard block |
||
583 | 583 | * |
584 | 584 | * @return string Short month name |
585 | 585 | */ |
586 | -function give_month_num_to_name( $n ) { |
|
587 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
586 | +function give_month_num_to_name($n) { |
|
587 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
588 | 588 | |
589 | - return date_i18n( "M", $timestamp ); |
|
589 | + return date_i18n("M", $timestamp); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -599,10 +599,10 @@ discard block |
||
599 | 599 | * |
600 | 600 | * @return bool Whether or not function is disabled. |
601 | 601 | */ |
602 | -function give_is_func_disabled( $function ) { |
|
603 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
602 | +function give_is_func_disabled($function) { |
|
603 | + $disabled = explode(',', ini_get('disable_functions')); |
|
604 | 604 | |
605 | - return in_array( $function, $disabled ); |
|
605 | + return in_array($function, $disabled); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | |
@@ -613,31 +613,31 @@ discard block |
||
613 | 613 | */ |
614 | 614 | function give_get_newsletter() { ?> |
615 | 615 | |
616 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
616 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
617 | 617 | |
618 | 618 | <div class="give-newsletter-form-wrap"> |
619 | 619 | |
620 | 620 | <form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> |
621 | 621 | <div class="give-newsletter-confirmation"> |
622 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
622 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
623 | 623 | </div> |
624 | 624 | |
625 | 625 | <table class="form-table give-newsletter-form"> |
626 | 626 | <tr valign="middle"> |
627 | 627 | <td> |
628 | - <label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
629 | - <input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" class="required email" value=""> |
|
628 | + <label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
629 | + <input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" class="required email" value=""> |
|
630 | 630 | </td> |
631 | 631 | <td> |
632 | - <label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
633 | - <input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
632 | + <label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
633 | + <input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
634 | 634 | </td> |
635 | 635 | <td> |
636 | - <label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
637 | - <input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
636 | + <label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
637 | + <input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
638 | 638 | </td> |
639 | 639 | <td> |
640 | - <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
640 | + <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
641 | 641 | </td> |
642 | 642 | </tr> |
643 | 643 | </table> |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
699 | 699 | printf( |
700 | 700 | /* translators: %s: Give twitter user @givewp */ |
701 | - esc_html_e( 'Follow %s', 'give' ), |
|
701 | + esc_html_e('Follow %s', 'give'), |
|
702 | 702 | '@givewp' |
703 | 703 | ); |
704 | 704 | ?></a> |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return string |
729 | 729 | */ |
730 | -function give_svg_icons( $icon ) { |
|
730 | +function give_svg_icons($icon) { |
|
731 | 731 | |
732 | 732 | // Store your SVGs in an associative array |
733 | 733 | $svgs = array( |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | ); |
740 | 740 | |
741 | 741 | // Return the chosen icon's SVG string |
742 | - return $svgs[ $icon ]; |
|
742 | + return $svgs[$icon]; |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | /** |
@@ -751,15 +751,15 @@ discard block |
||
751 | 751 | * |
752 | 752 | * @return mixed |
753 | 753 | */ |
754 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
755 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
756 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
754 | +function modify_nav_menu_meta_box_object($post_type) { |
|
755 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
756 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | return $post_type; |
760 | 760 | } |
761 | 761 | |
762 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
762 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
763 | 763 | |
764 | 764 | |
765 | 765 | /** |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @license https://opensource.org/licenses/MIT MIT |
774 | 774 | */ |
775 | 775 | |
776 | -if ( ! function_exists( 'array_column' ) ) { |
|
776 | +if ( ! function_exists('array_column')) { |
|
777 | 777 | /** |
778 | 778 | * Returns the values from a single column of the input array, identified by |
779 | 779 | * the $columnKey. |
@@ -792,53 +792,53 @@ discard block |
||
792 | 792 | * |
793 | 793 | * @return array |
794 | 794 | */ |
795 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
795 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
796 | 796 | // Using func_get_args() in order to check for proper number of |
797 | 797 | // parameters and trigger errors exactly as the built-in array_column() |
798 | 798 | // does in PHP 5.5. |
799 | 799 | $argc = func_num_args(); |
800 | 800 | $params = func_get_args(); |
801 | 801 | |
802 | - if ( $argc < 2 ) { |
|
803 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
802 | + if ($argc < 2) { |
|
803 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
804 | 804 | |
805 | 805 | return null; |
806 | 806 | } |
807 | 807 | |
808 | - if ( ! is_array( $params[0] ) ) { |
|
809 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
808 | + if ( ! is_array($params[0])) { |
|
809 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
810 | 810 | |
811 | 811 | return null; |
812 | 812 | } |
813 | 813 | |
814 | - if ( ! is_int( $params[1] ) |
|
815 | - && ! is_float( $params[1] ) |
|
816 | - && ! is_string( $params[1] ) |
|
814 | + if ( ! is_int($params[1]) |
|
815 | + && ! is_float($params[1]) |
|
816 | + && ! is_string($params[1]) |
|
817 | 817 | && $params[1] !== null |
818 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
818 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
819 | 819 | ) { |
820 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
820 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
821 | 821 | |
822 | 822 | return false; |
823 | 823 | } |
824 | 824 | |
825 | - if ( isset( $params[2] ) |
|
826 | - && ! is_int( $params[2] ) |
|
827 | - && ! is_float( $params[2] ) |
|
828 | - && ! is_string( $params[2] ) |
|
829 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
825 | + if (isset($params[2]) |
|
826 | + && ! is_int($params[2]) |
|
827 | + && ! is_float($params[2]) |
|
828 | + && ! is_string($params[2]) |
|
829 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
830 | 830 | ) { |
831 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
831 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
832 | 832 | |
833 | 833 | return false; |
834 | 834 | } |
835 | 835 | |
836 | 836 | $paramsInput = $params[0]; |
837 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
837 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
838 | 838 | |
839 | 839 | $paramsIndexKey = null; |
840 | - if ( isset( $params[2] ) ) { |
|
841 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
840 | + if (isset($params[2])) { |
|
841 | + if (is_float($params[2]) || is_int($params[2])) { |
|
842 | 842 | $paramsIndexKey = (int) $params[2]; |
843 | 843 | } else { |
844 | 844 | $paramsIndexKey = (string) $params[2]; |
@@ -847,26 +847,26 @@ discard block |
||
847 | 847 | |
848 | 848 | $resultArray = array(); |
849 | 849 | |
850 | - foreach ( $paramsInput as $row ) { |
|
850 | + foreach ($paramsInput as $row) { |
|
851 | 851 | $key = $value = null; |
852 | 852 | $keySet = $valueSet = false; |
853 | 853 | |
854 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
854 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
855 | 855 | $keySet = true; |
856 | - $key = (string) $row[ $paramsIndexKey ]; |
|
856 | + $key = (string) $row[$paramsIndexKey]; |
|
857 | 857 | } |
858 | 858 | |
859 | - if ( $paramsColumnKey === null ) { |
|
859 | + if ($paramsColumnKey === null) { |
|
860 | 860 | $valueSet = true; |
861 | 861 | $value = $row; |
862 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
862 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
863 | 863 | $valueSet = true; |
864 | - $value = $row[ $paramsColumnKey ]; |
|
864 | + $value = $row[$paramsColumnKey]; |
|
865 | 865 | } |
866 | 866 | |
867 | - if ( $valueSet ) { |
|
868 | - if ( $keySet ) { |
|
869 | - $resultArray[ $key ] = $value; |
|
867 | + if ($valueSet) { |
|
868 | + if ($keySet) { |
|
869 | + $resultArray[$key] = $value; |
|
870 | 870 | } else { |
871 | 871 | $resultArray[] = $value; |
872 | 872 | } |
@@ -888,40 +888,40 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @return bool Whether the receipt is visible or not. |
890 | 890 | */ |
891 | -function give_can_view_receipt( $payment_key = '' ) { |
|
891 | +function give_can_view_receipt($payment_key = '') { |
|
892 | 892 | |
893 | 893 | $return = false; |
894 | 894 | |
895 | - if ( empty( $payment_key ) ) { |
|
895 | + if (empty($payment_key)) { |
|
896 | 896 | return $return; |
897 | 897 | } |
898 | 898 | |
899 | 899 | global $give_receipt_args; |
900 | 900 | |
901 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
901 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
902 | 902 | |
903 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
903 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
904 | 904 | |
905 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
905 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
906 | 906 | |
907 | - if ( is_user_logged_in() ) { |
|
908 | - if ( $user_id === (int) get_current_user_id() ) { |
|
907 | + if (is_user_logged_in()) { |
|
908 | + if ($user_id === (int) get_current_user_id()) { |
|
909 | 909 | $return = true; |
910 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
910 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
911 | 911 | $return = true; |
912 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
912 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
913 | 913 | $return = true; |
914 | 914 | } |
915 | 915 | } |
916 | 916 | |
917 | 917 | $session = give_get_purchase_session(); |
918 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
919 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
918 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
919 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
920 | 920 | $return = true; |
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
924 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
924 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
925 | 925 | |
926 | 926 | } |
927 | 927 | |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | * |
931 | 931 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
932 | 932 | */ |
933 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
933 | +if ( ! function_exists('cal_days_in_month')) { |
|
934 | 934 | /** |
935 | 935 | * cal_days_in_month |
936 | 936 | * |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return bool|string |
942 | 942 | */ |
943 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
944 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
943 | + function cal_days_in_month($calendar, $month, $year) { |
|
944 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
945 | 945 | } |
946 | 946 | } |
947 | 947 | |
@@ -960,42 +960,42 @@ discard block |
||
960 | 960 | */ |
961 | 961 | function give_get_plugins() { |
962 | 962 | $plugins = get_plugins(); |
963 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
963 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
964 | 964 | |
965 | - if ( is_multisite() ) { |
|
966 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
967 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
965 | + if (is_multisite()) { |
|
966 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
967 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
968 | 968 | } |
969 | 969 | |
970 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
970 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
971 | 971 | // Is plugin active? |
972 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
973 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
972 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
973 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
974 | 974 | } else { |
975 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
975 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
976 | 976 | } |
977 | 977 | |
978 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
978 | + $dirname = strtolower(dirname($plugin_path)); |
|
979 | 979 | |
980 | 980 | // Is plugin a Give add-on by WordImpress? |
981 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
981 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
982 | 982 | // Plugin is a Give-addon. |
983 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
983 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
984 | 984 | |
985 | 985 | // Get license info from database. |
986 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); |
|
987 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; |
|
988 | - $license_active = get_option( $db_option ); |
|
986 | + $plugin_name = str_replace('Give - ', '', $plugin_data['Name']); |
|
987 | + $db_option = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; |
|
988 | + $license_active = get_option($db_option); |
|
989 | 989 | |
990 | 990 | // Does a valid license exist? |
991 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
992 | - $plugins[ $plugin_path ]['License'] = true; |
|
991 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
992 | + $plugins[$plugin_path]['License'] = true; |
|
993 | 993 | } else { |
994 | - $plugins[ $plugin_path ]['License'] = false; |
|
994 | + $plugins[$plugin_path]['License'] = false; |
|
995 | 995 | } |
996 | 996 | } else { |
997 | 997 | // Plugin is not a Give add-on. |
998 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
998 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1012,16 +1012,16 @@ discard block |
||
1012 | 1012 | * |
1013 | 1013 | * @return bool |
1014 | 1014 | */ |
1015 | -function give_is_terms_enabled( $form_id ) { |
|
1016 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1015 | +function give_is_terms_enabled($form_id) { |
|
1016 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1017 | 1017 | |
1018 | 1018 | if ( |
1019 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1020 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1019 | + give_is_setting_enabled($form_option, 'global') |
|
1020 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1021 | 1021 | ) { |
1022 | 1022 | return true; |
1023 | 1023 | |
1024 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1024 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1025 | 1025 | return true; |
1026 | 1026 | |
1027 | 1027 | } else { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
39 | - 'currency_sign' => give_currency_filter( '' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | + 'currency_sign' => give_currency_filter(''), |
|
40 | 40 | 'currency_pos' => give_get_currency_position(), |
41 | 41 | 'thousands_separator' => give_get_price_thousand_separator(), |
42 | 42 | 'decimal_separator' => give_get_price_decimal_separator(), |
43 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
44 | - 'bad_minimum' => __( 'The minimum donation amount for this form is', 'give' ), |
|
45 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
46 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
43 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
44 | + 'bad_minimum' => __('The minimum donation amount for this form is', 'give'), |
|
45 | + 'general_loading' => __('Loading...', 'give'), |
|
46 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
47 | 47 | 'number_decimals' => give_get_price_decimals(), |
48 | 48 | 'give_version' => GIVE_VERSION, |
49 | 49 | 'magnific_options' => apply_filters( |
@@ -57,81 +57,81 @@ discard block |
||
57 | 57 | 'give_form_translation_js', |
58 | 58 | array( |
59 | 59 | // Field name Validation message. |
60 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
61 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
62 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
63 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
64 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
65 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
66 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
60 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
61 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
62 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
63 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
64 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
65 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
66 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
67 | 67 | ) |
68 | 68 | ), |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
71 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
72 | 72 | 'ajaxurl' => give_get_ajax_url(), |
73 | - 'loading' => __( 'Loading', 'give' ), |
|
73 | + 'loading' => __('Loading', 'give'), |
|
74 | 74 | // General loading message. |
75 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
75 | + 'select_option' => __('Please select an option', 'give'), |
|
76 | 76 | // Variable pricing error with multi-donation option enabled. |
77 | - 'default_gateway' => give_get_default_gateway( null ), |
|
78 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
77 | + 'default_gateway' => give_get_default_gateway(null), |
|
78 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
79 | 79 | 'number_decimals' => give_get_price_decimals(), |
80 | - ) ); |
|
80 | + )); |
|
81 | 81 | |
82 | 82 | // DEBUG is On. |
83 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
83 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
84 | 84 | |
85 | - if ( give_is_cc_verify_enabled() ) { |
|
86 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
87 | - wp_enqueue_script( 'give-cc-validator' ); |
|
85 | + if (give_is_cc_verify_enabled()) { |
|
86 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
87 | + wp_enqueue_script('give-cc-validator'); |
|
88 | 88 | } |
89 | 89 | |
90 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
91 | - wp_enqueue_script( 'give-float-labels' ); |
|
90 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
91 | + wp_enqueue_script('give-float-labels'); |
|
92 | 92 | |
93 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-blockui' ); |
|
93 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-blockui'); |
|
95 | 95 | |
96 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
97 | - wp_enqueue_script( 'give-qtip' ); |
|
96 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
97 | + wp_enqueue_script('give-qtip'); |
|
98 | 98 | |
99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
100 | - wp_enqueue_script( 'give-accounting' ); |
|
99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
100 | + wp_enqueue_script('give-accounting'); |
|
101 | 101 | |
102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
103 | - wp_enqueue_script( 'give-magnific' ); |
|
102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
103 | + wp_enqueue_script('give-magnific'); |
|
104 | 104 | |
105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
105 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
106 | + wp_enqueue_script('give-checkout-global'); |
|
107 | 107 | |
108 | 108 | // General scripts. |
109 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
110 | - wp_enqueue_script( 'give-scripts' ); |
|
109 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
110 | + wp_enqueue_script('give-scripts'); |
|
111 | 111 | |
112 | 112 | // Load AJAX scripts, if enabled. |
113 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
114 | - wp_enqueue_script( 'give-ajax' ); |
|
113 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
114 | + wp_enqueue_script('give-ajax'); |
|
115 | 115 | |
116 | 116 | // Localize / Pass AJAX vars from PHP, |
117 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
118 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
117 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
118 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
119 | 119 | |
120 | 120 | } else { |
121 | 121 | |
122 | 122 | // DEBUG is OFF (one JS file to rule them all!). |
123 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
124 | - wp_enqueue_script( 'give' ); |
|
123 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
124 | + wp_enqueue_script('give'); |
|
125 | 125 | |
126 | 126 | // Localize / Pass AJAX vars from PHP. |
127 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
128 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
127 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
128 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
129 | 129 | |
130 | 130 | } |
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
134 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Register styles. |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | */ |
145 | 145 | function give_register_styles() { |
146 | 146 | |
147 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
147 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
151 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
152 | - wp_enqueue_style( 'give-styles' ); |
|
151 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
152 | + wp_enqueue_style('give-styles'); |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
156 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | /** |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | function give_get_stylesheet_uri() { |
167 | 167 | |
168 | 168 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
169 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
169 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
170 | 170 | |
171 | 171 | // LTR or RTL files. |
172 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
172 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
173 | 173 | |
174 | - $file = 'give' . $direction . $suffix . '.css'; |
|
174 | + $file = 'give'.$direction.$suffix.'.css'; |
|
175 | 175 | $templates_dir = give_get_theme_template_dir_name(); |
176 | 176 | |
177 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
178 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
179 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
180 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
181 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
177 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
178 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
179 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
180 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
181 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
182 | 182 | |
183 | 183 | $uri = false; |
184 | 184 | |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
189 | 189 | * This allows users to copy just give.css to their theme. |
190 | 190 | */ |
191 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
192 | - if ( ! empty( $nonmin ) ) { |
|
193 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
191 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
192 | + if ( ! empty($nonmin)) { |
|
193 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
194 | 194 | } else { |
195 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
195 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
196 | 196 | } |
197 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
198 | - if ( ! empty( $nonmin ) ) { |
|
199 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
197 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
198 | + if ( ! empty($nonmin)) { |
|
199 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
200 | 200 | } else { |
201 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
201 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
202 | 202 | } |
203 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
204 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
203 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
204 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
205 | 205 | } |
206 | 206 | |
207 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
207 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,73 +221,73 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | -function give_load_admin_scripts( $hook ) { |
|
224 | +function give_load_admin_scripts($hook) { |
|
225 | 225 | |
226 | 226 | global $post, $post_type; |
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // Directories of assets. |
231 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
232 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
233 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
231 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
232 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
233 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
234 | 234 | |
235 | 235 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
236 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
236 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
237 | 237 | |
238 | 238 | // LTR or RTL files. |
239 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
239 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
240 | 240 | |
241 | 241 | // Global Admin. |
242 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
243 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
242 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
243 | + wp_enqueue_style('give-admin-bar-notification'); |
|
244 | 244 | |
245 | 245 | // Give Admin Only. |
246 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
246 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | |
250 | 250 | // CSS. |
251 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
252 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
253 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', GIVE_VERSION ); |
|
254 | - wp_enqueue_style( 'give-admin' ); |
|
255 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
256 | - wp_enqueue_style( 'jquery-chosen' ); |
|
257 | - wp_enqueue_style( 'thickbox' ); |
|
251 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
252 | + wp_enqueue_style('jquery-ui-css'); |
|
253 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', GIVE_VERSION); |
|
254 | + wp_enqueue_style('give-admin'); |
|
255 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
256 | + wp_enqueue_style('jquery-chosen'); |
|
257 | + wp_enqueue_style('thickbox'); |
|
258 | 258 | |
259 | 259 | // JS. |
260 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
261 | - wp_enqueue_script( 'jquery-chosen' ); |
|
260 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
261 | + wp_enqueue_script('jquery-chosen'); |
|
262 | 262 | |
263 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-accounting' ); |
|
263 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-accounting'); |
|
265 | 265 | |
266 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
267 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
266 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
267 | + wp_enqueue_script('give-admin-scripts'); |
|
268 | 268 | |
269 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
270 | - wp_enqueue_script( 'jquery-flot' ); |
|
269 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
270 | + wp_enqueue_script('jquery-flot'); |
|
271 | 271 | |
272 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
273 | - wp_enqueue_script( 'give-qtip' ); |
|
272 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
273 | + wp_enqueue_script('give-qtip'); |
|
274 | 274 | |
275 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
276 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
275 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
276 | + wp_enqueue_script('give-repeatable-fields'); |
|
277 | 277 | |
278 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
279 | - wp_enqueue_script( 'thickbox' ); |
|
278 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
279 | + wp_enqueue_script('thickbox'); |
|
280 | 280 | |
281 | 281 | // Forms CPT Script. |
282 | - if ( $post_type === 'give_forms' ) { |
|
283 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
284 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
282 | + if ($post_type === 'give_forms') { |
|
283 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
284 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // Settings Scripts. |
288 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
289 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
290 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
288 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
289 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
290 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // Price Separators. |
@@ -295,54 +295,54 @@ discard block |
||
295 | 295 | $decimal_separator = give_get_price_decimal_separator(); |
296 | 296 | |
297 | 297 | // Localize strings & variables for JS. |
298 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
299 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
298 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
299 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
300 | 300 | 'give_version' => GIVE_VERSION, |
301 | 301 | 'thousands_separator' => $thousand_separator, |
302 | 302 | 'decimal_separator' => $decimal_separator, |
303 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
304 | - 'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'give' ), |
|
305 | - 'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'give' ), |
|
306 | - 'revoke_api_key' => __( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
307 | - 'regenerate_api_key' => __( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
308 | - 'resend_receipt' => __( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
309 | - 'logo' => __( 'Logo', 'give' ), |
|
310 | - 'use_this_image' => __( 'Use this image', 'give' ), |
|
311 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
312 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
313 | - 'currency_sign' => give_currency_filter( '' ), |
|
314 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
315 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
316 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
317 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
318 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
319 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
303 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
304 | + 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), |
|
305 | + 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), |
|
306 | + 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), |
|
307 | + 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), |
|
308 | + 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), |
|
309 | + 'logo' => __('Logo', 'give'), |
|
310 | + 'use_this_image' => __('Use this image', 'give'), |
|
311 | + 'one_option' => __('Choose a form', 'give'), |
|
312 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
313 | + 'currency_sign' => give_currency_filter(''), |
|
314 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
315 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
316 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
317 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
318 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
319 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
320 | 320 | /* translators : %s: Donation form options metabox */ |
321 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
322 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
323 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
321 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
322 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
323 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
324 | 324 | 'bulk_action' => array( |
325 | 325 | 'delete' => array( |
326 | - 'zero_payment_selected' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
327 | - 'delete_payment' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
328 | - 'delete_payments' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
326 | + 'zero_payment_selected' => __('You must choose at least one or more payments to delete.', 'give'), |
|
327 | + 'delete_payment' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
328 | + 'delete_payments' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
329 | 329 | ), |
330 | 330 | 'resend_receipt' => array( |
331 | - 'zero_recipient_selected' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
332 | - 'resend_receipt' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
333 | - 'resend_receipts' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
331 | + 'zero_recipient_selected' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
332 | + 'resend_receipt' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
333 | + 'resend_receipts' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
334 | 334 | ), |
335 | 335 | ), |
336 | - ) ); |
|
336 | + )); |
|
337 | 337 | |
338 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
338 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
339 | 339 | // call for new media manager. |
340 | 340 | wp_enqueue_media(); |
341 | 341 | } |
342 | 342 | |
343 | 343 | } |
344 | 344 | |
345 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
345 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
346 | 346 | |
347 | 347 | /** |
348 | 348 | * Admin Give Icon |
@@ -357,13 +357,13 @@ discard block |
||
357 | 357 | ?> |
358 | 358 | <style type="text/css" media="screen"> |
359 | 359 | |
360 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
360 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
361 | 361 | @font-face { |
362 | 362 | font-family: 'give-icomoon'; |
363 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
364 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
365 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
366 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
363 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
364 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
365 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
366 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
367 | 367 | font-weight: normal; |
368 | 368 | font-style: normal; |
369 | 369 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | <?php |
383 | 383 | } |
384 | 384 | |
385 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
385 | +add_action('admin_head', 'give_admin_icon'); |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Admin js code |
@@ -412,4 +412,4 @@ discard block |
||
412 | 412 | <?php |
413 | 413 | } |
414 | 414 | |
415 | -add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' ); |
|
415 | +add_action('admin_head', 'give_admin_hide_notice_shortly_js'); |
@@ -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 | |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool|object List of all user donations |
32 | 32 | */ |
33 | -function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
33 | +function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
34 | 34 | |
35 | - if ( empty( $user ) ) { |
|
35 | + if (empty($user)) { |
|
36 | 36 | $user = get_current_user_id(); |
37 | 37 | } |
38 | 38 | |
39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $status = $status === 'complete' ? 'publish' : $status; |
44 | 44 | |
45 | - if ( $pagination ) { |
|
46 | - if ( get_query_var( 'paged' ) ) { |
|
47 | - $paged = get_query_var( 'paged' ); |
|
48 | - } elseif ( get_query_var( 'page' ) ) { |
|
49 | - $paged = get_query_var( 'page' ); |
|
45 | + if ($pagination) { |
|
46 | + if (get_query_var('paged')) { |
|
47 | + $paged = get_query_var('paged'); |
|
48 | + } elseif (get_query_var('page')) { |
|
49 | + $paged = get_query_var('page'); |
|
50 | 50 | } else { |
51 | 51 | $paged = 1; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
55 | + $args = apply_filters('give_get_users_donations_args', array( |
|
56 | 56 | 'user' => $user, |
57 | 57 | 'number' => $number, |
58 | 58 | 'status' => $status, |
59 | 59 | 'orderby' => 'date', |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | - if ( $pagination ) { |
|
62 | + if ($pagination) { |
|
63 | 63 | |
64 | 64 | $args['page'] = $paged; |
65 | 65 | |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | |
70 | 70 | } |
71 | 71 | |
72 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
73 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
72 | + $by_user_id = is_numeric($user) ? true : false; |
|
73 | + $customer = new Give_Customer($user, $by_user_id); |
|
74 | 74 | |
75 | - if ( ! empty( $customer->payment_ids ) ) { |
|
75 | + if ( ! empty($customer->payment_ids)) { |
|
76 | 76 | |
77 | - unset( $args['user'] ); |
|
78 | - $args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) ); |
|
77 | + unset($args['user']); |
|
78 | + $args['post__in'] = array_map('absint', explode(',', $customer->payment_ids)); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - $purchases = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
82 | + $purchases = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
83 | 83 | |
84 | 84 | // No donations |
85 | - if ( ! $purchases ) { |
|
85 | + if ( ! $purchases) { |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
@@ -101,65 +101,65 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return bool|object List of unique forms donated by user |
103 | 103 | */ |
104 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
105 | - if ( empty( $user ) ) { |
|
104 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
105 | + if (empty($user)) { |
|
106 | 106 | $user = get_current_user_id(); |
107 | 107 | } |
108 | 108 | |
109 | - if ( empty( $user ) ) { |
|
109 | + if (empty($user)) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
113 | + $by_user_id = is_numeric($user) ? true : false; |
|
114 | 114 | |
115 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
115 | + $customer = new Give_Customer($user, $by_user_id); |
|
116 | 116 | |
117 | - if ( empty( $customer->payment_ids ) ) { |
|
117 | + if (empty($customer->payment_ids)) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Get all the items donated |
122 | - $payment_ids = array_reverse( explode( ',', $customer->payment_ids ) ); |
|
123 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
124 | - if ( ! empty( $limit_payments ) ) { |
|
125 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
122 | + $payment_ids = array_reverse(explode(',', $customer->payment_ids)); |
|
123 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
124 | + if ( ! empty($limit_payments)) { |
|
125 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
126 | 126 | } |
127 | 127 | $donation_data = array(); |
128 | - foreach ( $payment_ids as $payment_id ) { |
|
129 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
128 | + foreach ($payment_ids as $payment_id) { |
|
129 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
130 | 130 | } |
131 | 131 | |
132 | - if ( empty( $donation_data ) ) { |
|
132 | + if (empty($donation_data)) { |
|
133 | 133 | return false; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // Grab only the post ids "form_id" of the forms donated on this order |
137 | 137 | $completed_donations_ids = array(); |
138 | - foreach ( $donation_data as $purchase_meta ) { |
|
139 | - $completed_donations_ids[] = isset( $purchase_meta['form_id'] ) ? $purchase_meta['form_id'] : ''; |
|
138 | + foreach ($donation_data as $purchase_meta) { |
|
139 | + $completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : ''; |
|
140 | 140 | } |
141 | 141 | |
142 | - if ( empty( $completed_donations_ids ) ) { |
|
142 | + if (empty($completed_donations_ids)) { |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Only include each donation once |
147 | - $form_ids = array_unique( $completed_donations_ids ); |
|
147 | + $form_ids = array_unique($completed_donations_ids); |
|
148 | 148 | |
149 | 149 | // Make sure we still have some products and a first item |
150 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
150 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | |
154 | - $post_type = get_post_type( $form_ids[0] ); |
|
154 | + $post_type = get_post_type($form_ids[0]); |
|
155 | 155 | |
156 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
156 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
157 | 157 | 'include' => $form_ids, |
158 | 158 | 'post_type' => $post_type, |
159 | - 'posts_per_page' => - 1, |
|
160 | - ) ); |
|
159 | + 'posts_per_page' => -1, |
|
160 | + )); |
|
161 | 161 | |
162 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
162 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool True if has donated, false other wise. |
177 | 177 | */ |
178 | -function give_has_purchases( $user_id = null ) { |
|
179 | - if ( empty( $user_id ) ) { |
|
178 | +function give_has_purchases($user_id = null) { |
|
179 | + if (empty($user_id)) { |
|
180 | 180 | $user_id = get_current_user_id(); |
181 | 181 | } |
182 | 182 | |
183 | - if ( give_get_users_purchases( $user_id, 1 ) ) { |
|
183 | + if (give_get_users_purchases($user_id, 1)) { |
|
184 | 184 | return true; // User has at least one donation |
185 | 185 | } |
186 | 186 | |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return array |
202 | 202 | */ |
203 | -function give_get_purchase_stats_by_user( $user = '' ) { |
|
203 | +function give_get_purchase_stats_by_user($user = '') { |
|
204 | 204 | |
205 | - if ( is_email( $user ) ) { |
|
205 | + if (is_email($user)) { |
|
206 | 206 | |
207 | 207 | $field = 'email'; |
208 | 208 | |
209 | - } elseif ( is_numeric( $user ) ) { |
|
209 | + } elseif (is_numeric($user)) { |
|
210 | 210 | |
211 | 211 | $field = 'user_id'; |
212 | 212 | |
213 | 213 | } |
214 | 214 | |
215 | 215 | $stats = array(); |
216 | - $customer = Give()->customers->get_customer_by( $field, $user ); |
|
216 | + $customer = Give()->customers->get_customer_by($field, $user); |
|
217 | 217 | |
218 | - if ( $customer ) { |
|
218 | + if ($customer) { |
|
219 | 219 | |
220 | - $customer = new Give_Customer( $customer->id ); |
|
220 | + $customer = new Give_Customer($customer->id); |
|
221 | 221 | |
222 | - $stats['purchases'] = absint( $customer->purchase_count ); |
|
223 | - $stats['total_spent'] = give_sanitize_amount( $customer->purchase_value ); |
|
222 | + $stats['purchases'] = absint($customer->purchase_count); |
|
223 | + $stats['total_spent'] = give_sanitize_amount($customer->purchase_value); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @since 1.7 |
231 | 231 | */ |
232 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
232 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
233 | 233 | |
234 | 234 | return $stats; |
235 | 235 | } |
@@ -247,21 +247,21 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return int The total number of donations |
249 | 249 | */ |
250 | -function give_count_purchases_of_customer( $user = null ) { |
|
250 | +function give_count_purchases_of_customer($user = null) { |
|
251 | 251 | |
252 | 252 | // Logged in? |
253 | - if ( empty( $user ) ) { |
|
253 | + if (empty($user)) { |
|
254 | 254 | $user = get_current_user_id(); |
255 | 255 | } |
256 | 256 | |
257 | 257 | // Email access? |
258 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
258 | + if (empty($user) && Give()->email_access->token_email) { |
|
259 | 259 | $user = Give()->email_access->token_email; |
260 | 260 | } |
261 | 261 | |
262 | - $stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false; |
|
262 | + $stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false; |
|
263 | 263 | |
264 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
264 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return float The total amount the user has spent |
276 | 276 | */ |
277 | -function give_purchase_total_of_user( $user = null ) { |
|
277 | +function give_purchase_total_of_user($user = null) { |
|
278 | 278 | |
279 | - $stats = give_get_purchase_stats_by_user( $user ); |
|
279 | + $stats = give_get_purchase_stats_by_user($user); |
|
280 | 280 | |
281 | 281 | return $stats['total_spent']; |
282 | 282 | } |
@@ -292,40 +292,40 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @return bool |
294 | 294 | */ |
295 | -function give_validate_username( $username, $form_id = 0 ) { |
|
295 | +function give_validate_username($username, $form_id = 0) { |
|
296 | 296 | $valid = true; |
297 | 297 | |
298 | 298 | // Validate username. |
299 | - if ( ! empty( $username ) ) { |
|
299 | + if ( ! empty($username)) { |
|
300 | 300 | |
301 | 301 | // Sanitize username. |
302 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
302 | + $sanitized_user_name = sanitize_user($username, false); |
|
303 | 303 | |
304 | 304 | // We have an user name, check if it already exists. |
305 | - if ( username_exists( $username ) ) { |
|
305 | + if (username_exists($username)) { |
|
306 | 306 | // Username already registered. |
307 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
307 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
308 | 308 | $valid = false; |
309 | 309 | |
310 | 310 | // Check if it's valid. |
311 | - } elseif ( $sanitized_user_name !== $username ) { |
|
311 | + } elseif ($sanitized_user_name !== $username) { |
|
312 | 312 | // Invalid username. |
313 | - if ( is_multisite() ) { |
|
314 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
313 | + if (is_multisite()) { |
|
314 | + give_set_error('username_invalid', esc_html__('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
315 | 315 | $valid = false; |
316 | 316 | } else { |
317 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
317 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
318 | 318 | $valid = false; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | } else { |
322 | 322 | // Username is empty. |
323 | - give_set_error( 'username_empty', esc_html__( 'Enter an username.', 'give' ) ); |
|
323 | + give_set_error('username_empty', esc_html__('Enter an username.', 'give')); |
|
324 | 324 | $valid = false; |
325 | 325 | |
326 | 326 | // Check if guest checkout is disable for form. |
327 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
328 | - give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation.', 'give' ) ); |
|
327 | + if ($form_id && give_logged_in_only($form_id)) { |
|
328 | + give_set_error('registration_required', esc_html__('You must register or login to complete your donation.', 'give')); |
|
329 | 329 | $valid = false; |
330 | 330 | } |
331 | 331 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @param string $username |
340 | 340 | * @param bool $form_id |
341 | 341 | */ |
342 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
342 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
343 | 343 | |
344 | 344 | return $valid; |
345 | 345 | } |
@@ -355,22 +355,22 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return bool |
357 | 357 | */ |
358 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
358 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
359 | 359 | $valid = true; |
360 | 360 | |
361 | - if ( empty( $email ) ) { |
|
361 | + if (empty($email)) { |
|
362 | 362 | // No email. |
363 | - give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) ); |
|
363 | + give_set_error('email_empty', esc_html__('Enter an email.', 'give')); |
|
364 | 364 | $valid = false; |
365 | 365 | |
366 | - } elseif ( ! is_email( $email ) ) { |
|
366 | + } elseif ( ! is_email($email)) { |
|
367 | 367 | // Validate email. |
368 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
368 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
369 | 369 | $valid = false; |
370 | 370 | |
371 | - } elseif ( $registering_new_user && email_exists( $email ) ) { |
|
371 | + } elseif ($registering_new_user && email_exists($email)) { |
|
372 | 372 | // Check if email exists. |
373 | - give_set_error( 'email_used', esc_html__( 'The email already active for another user.', 'give' ) ); |
|
373 | + give_set_error('email_used', esc_html__('The email already active for another user.', 'give')); |
|
374 | 374 | $valid = false; |
375 | 375 | } |
376 | 376 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @param string $email |
384 | 384 | * @param bool $registering_new_user |
385 | 385 | */ |
386 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
386 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
387 | 387 | |
388 | 388 | return $valid; |
389 | 389 | } |
@@ -399,25 +399,25 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return bool |
401 | 401 | */ |
402 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
402 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
403 | 403 | $valid = true; |
404 | 404 | |
405 | - if ( $password && $confirm_password ) { |
|
405 | + if ($password && $confirm_password) { |
|
406 | 406 | // Verify confirmation matches. |
407 | - if ( $password != $confirm_password ) { |
|
407 | + if ($password != $confirm_password) { |
|
408 | 408 | // Passwords do not match |
409 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
409 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
410 | 410 | $valid = false; |
411 | 411 | } |
412 | - } elseif ( $registering_new_user ) { |
|
412 | + } elseif ($registering_new_user) { |
|
413 | 413 | // Password or confirmation missing. |
414 | - if ( ! $password ) { |
|
414 | + if ( ! $password) { |
|
415 | 415 | // The password is invalid. |
416 | - give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) ); |
|
416 | + give_set_error('password_empty', esc_html__('Enter a password.', 'give')); |
|
417 | 417 | $valid = false; |
418 | - } elseif ( ! $confirm_password ) { |
|
418 | + } elseif ( ! $confirm_password) { |
|
419 | 419 | // Confirmation password is invalid. |
420 | - give_set_error( 'confirmation_empty', esc_html__( 'Enter the password confirmation.', 'give' ) ); |
|
420 | + give_set_error('confirmation_empty', esc_html__('Enter the password confirmation.', 'give')); |
|
421 | 421 | $valid = false; |
422 | 422 | } |
423 | 423 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @param string $confirm_password |
433 | 433 | * @param bool $registering_new_user |
434 | 434 | */ |
435 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
435 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
436 | 436 | |
437 | 437 | return $valid; |
438 | 438 | } |
@@ -451,32 +451,32 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @return void |
453 | 453 | */ |
454 | -function give_add_past_purchases_to_new_user( $user_id ) { |
|
454 | +function give_add_past_purchases_to_new_user($user_id) { |
|
455 | 455 | |
456 | - $email = get_the_author_meta( 'user_email', $user_id ); |
|
456 | + $email = get_the_author_meta('user_email', $user_id); |
|
457 | 457 | |
458 | - $payments = give_get_payments( array( 's' => $email ) ); |
|
458 | + $payments = give_get_payments(array('s' => $email)); |
|
459 | 459 | |
460 | - if ( $payments ) { |
|
461 | - foreach ( $payments as $payment ) { |
|
462 | - if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) { |
|
460 | + if ($payments) { |
|
461 | + foreach ($payments as $payment) { |
|
462 | + if (intval(give_get_payment_user_id($payment->ID)) > 0) { |
|
463 | 463 | continue; |
464 | 464 | } // This payment already associated with an account |
465 | 465 | |
466 | - $meta = give_get_payment_meta( $payment->ID ); |
|
467 | - $meta['user_info'] = maybe_unserialize( $meta['user_info'] ); |
|
466 | + $meta = give_get_payment_meta($payment->ID); |
|
467 | + $meta['user_info'] = maybe_unserialize($meta['user_info']); |
|
468 | 468 | $meta['user_info']['id'] = $user_id; |
469 | 469 | $meta['user_info'] = $meta['user_info']; |
470 | 470 | |
471 | 471 | // Store the updated user ID in the payment meta |
472 | - give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta ); |
|
473 | - give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id ); |
|
472 | + give_update_payment_meta($payment->ID, '_give_payment_meta', $meta); |
|
473 | + give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
477 | 477 | } |
478 | 478 | |
479 | -add_action( 'user_register', 'give_add_past_purchases_to_new_user' ); |
|
479 | +add_action('user_register', 'give_add_past_purchases_to_new_user'); |
|
480 | 480 | |
481 | 481 | |
482 | 482 | /** |
@@ -502,34 +502,34 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @return array The donor's address, if any |
504 | 504 | */ |
505 | -function give_get_donor_address( $user_id = 0 ) { |
|
506 | - if ( empty( $user_id ) ) { |
|
505 | +function give_get_donor_address($user_id = 0) { |
|
506 | + if (empty($user_id)) { |
|
507 | 507 | $user_id = get_current_user_id(); |
508 | 508 | } |
509 | 509 | |
510 | - $address = get_user_meta( $user_id, '_give_user_address', true ); |
|
510 | + $address = get_user_meta($user_id, '_give_user_address', true); |
|
511 | 511 | |
512 | - if ( ! isset( $address['line1'] ) ) { |
|
512 | + if ( ! isset($address['line1'])) { |
|
513 | 513 | $address['line1'] = ''; |
514 | 514 | } |
515 | 515 | |
516 | - if ( ! isset( $address['line2'] ) ) { |
|
516 | + if ( ! isset($address['line2'])) { |
|
517 | 517 | $address['line2'] = ''; |
518 | 518 | } |
519 | 519 | |
520 | - if ( ! isset( $address['city'] ) ) { |
|
520 | + if ( ! isset($address['city'])) { |
|
521 | 521 | $address['city'] = ''; |
522 | 522 | } |
523 | 523 | |
524 | - if ( ! isset( $address['zip'] ) ) { |
|
524 | + if ( ! isset($address['zip'])) { |
|
525 | 525 | $address['zip'] = ''; |
526 | 526 | } |
527 | 527 | |
528 | - if ( ! isset( $address['country'] ) ) { |
|
528 | + if ( ! isset($address['country'])) { |
|
529 | 529 | $address['country'] = ''; |
530 | 530 | } |
531 | 531 | |
532 | - if ( ! isset( $address['state'] ) ) { |
|
532 | + if ( ! isset($address['state'])) { |
|
533 | 533 | $address['state'] = ''; |
534 | 534 | } |
535 | 535 | |
@@ -549,42 +549,42 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @return void |
551 | 551 | */ |
552 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
552 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
553 | 553 | |
554 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
554 | + if (empty($user_id) || empty($user_data)) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | - $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
557 | + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
558 | 558 | |
559 | 559 | /* translators: %s: site name */ |
560 | - $message = sprintf( esc_attr__( 'New user registration on your site %s:', 'give' ), $blogname ) . "\r\n\r\n"; |
|
560 | + $message = sprintf(esc_attr__('New user registration on your site %s:', 'give'), $blogname)."\r\n\r\n"; |
|
561 | 561 | /* translators: %s: user login */ |
562 | - $message .= sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n\r\n"; |
|
562 | + $message .= sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n\r\n"; |
|
563 | 563 | /* translators: %s: user email */ |
564 | - $message .= sprintf( esc_attr__( 'E-mail: %s', 'give' ), $user_data['user_email'] ) . "\r\n"; |
|
564 | + $message .= sprintf(esc_attr__('E-mail: %s', 'give'), $user_data['user_email'])."\r\n"; |
|
565 | 565 | |
566 | 566 | @wp_mail( |
567 | - get_option( 'admin_email' ), |
|
567 | + get_option('admin_email'), |
|
568 | 568 | sprintf( |
569 | 569 | /* translators: %s: site name */ |
570 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
570 | + esc_attr__('[%s] New User Registration', 'give'), |
|
571 | 571 | $blogname |
572 | 572 | ), |
573 | 573 | $message |
574 | 574 | ); |
575 | 575 | |
576 | 576 | /* translators: %s: user login */ |
577 | - $message = sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n"; |
|
577 | + $message = sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n"; |
|
578 | 578 | /* translators: %s: paswword */ |
579 | - $message .= sprintf( esc_attr__( 'Password: %s', 'give' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n"; |
|
579 | + $message .= sprintf(esc_attr__('Password: %s', 'give'), esc_attr__('[Password entered during donation]', 'give'))."\r\n"; |
|
580 | 580 | |
581 | - $message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login »', 'give' ) . '</a>' . "\r\n"; |
|
581 | + $message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login »', 'give').'</a>'."\r\n"; |
|
582 | 582 | |
583 | 583 | wp_mail( |
584 | 584 | $user_data['user_email'], |
585 | 585 | sprintf( |
586 | 586 | /* translators: %s: site name */ |
587 | - esc_attr__( '[%s] Your username and password', 'give' ), |
|
587 | + esc_attr__('[%s] Your username and password', 'give'), |
|
588 | 588 | $blogname |
589 | 589 | ), |
590 | 590 | $message |
@@ -592,4 +592,4 @@ discard block |
||
592 | 592 | |
593 | 593 | } |
594 | 594 | |
595 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
595 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return string Donations dropdown. |
37 | 37 | */ |
38 | - public function transactions_dropdown( $args = array() ) { |
|
38 | + public function transactions_dropdown($args = array()) { |
|
39 | 39 | |
40 | 40 | $defaults = array( |
41 | 41 | 'name' => 'transactions', |
@@ -45,33 +45,33 @@ discard block |
||
45 | 45 | 'selected' => 0, |
46 | 46 | 'chosen' => false, |
47 | 47 | 'number' => 30, |
48 | - 'placeholder' => esc_html__( 'Select a transaction', 'give' ) |
|
48 | + 'placeholder' => esc_html__('Select a transaction', 'give') |
|
49 | 49 | ); |
50 | 50 | |
51 | - $args = wp_parse_args( $args, $defaults ); |
|
51 | + $args = wp_parse_args($args, $defaults); |
|
52 | 52 | |
53 | - $payments = new Give_Payments_Query( array( |
|
53 | + $payments = new Give_Payments_Query(array( |
|
54 | 54 | 'number' => $args['number'] |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | $payments = $payments->get_payments(); |
58 | 58 | |
59 | 59 | $options = array(); |
60 | 60 | |
61 | 61 | //Provide nice human readable options. |
62 | - if ( $payments ) { |
|
63 | - $options[0] = esc_html__( 'Select a donation', 'give' ); |
|
64 | - foreach ( $payments as $payment ) { |
|
62 | + if ($payments) { |
|
63 | + $options[0] = esc_html__('Select a donation', 'give'); |
|
64 | + foreach ($payments as $payment) { |
|
65 | 65 | |
66 | - $options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title); |
|
66 | + $options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | } else { |
70 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
70 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | - $output = $this->select( array( |
|
74 | + $output = $this->select(array( |
|
75 | 75 | 'name' => $args['name'], |
76 | 76 | 'selected' => $args['selected'], |
77 | 77 | 'id' => $args['id'], |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'select_atts' => $args['select_atts'], |
84 | 84 | 'show_option_all' => false, |
85 | 85 | 'show_option_none' => false |
86 | - ) ); |
|
86 | + )); |
|
87 | 87 | |
88 | 88 | return $output; |
89 | 89 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string Give forms dropdown. |
102 | 102 | */ |
103 | - public function forms_dropdown( $args = array() ) { |
|
103 | + public function forms_dropdown($args = array()) { |
|
104 | 104 | |
105 | 105 | $defaults = array( |
106 | 106 | 'name' => 'forms', |
@@ -110,31 +110,31 @@ discard block |
||
110 | 110 | 'selected' => 0, |
111 | 111 | 'chosen' => false, |
112 | 112 | 'number' => 30, |
113 | - 'placeholder' => esc_attr__( 'Select a Donation Form', 'give' ) |
|
113 | + 'placeholder' => esc_attr__('Select a Donation Form', 'give') |
|
114 | 114 | ); |
115 | 115 | |
116 | - $args = wp_parse_args( $args, $defaults ); |
|
116 | + $args = wp_parse_args($args, $defaults); |
|
117 | 117 | |
118 | - $forms = get_posts( array( |
|
118 | + $forms = get_posts(array( |
|
119 | 119 | 'post_type' => 'give_forms', |
120 | 120 | 'orderby' => 'title', |
121 | 121 | 'order' => 'ASC', |
122 | 122 | 'posts_per_page' => $args['number'] |
123 | - ) ); |
|
123 | + )); |
|
124 | 124 | |
125 | 125 | $options = array(); |
126 | 126 | |
127 | - if ( $forms ) { |
|
128 | - $options[0] = esc_attr__( 'Select a Donation Form', 'give' ); |
|
129 | - foreach ( $forms as $form ) { |
|
130 | - $form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title; |
|
131 | - $options[ absint( $form->ID ) ] = esc_html( $form_title ); |
|
127 | + if ($forms) { |
|
128 | + $options[0] = esc_attr__('Select a Donation Form', 'give'); |
|
129 | + foreach ($forms as $form) { |
|
130 | + $form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title; |
|
131 | + $options[absint($form->ID)] = esc_html($form_title); |
|
132 | 132 | } |
133 | 133 | } else { |
134 | - $options[0] = esc_html__( 'No forms found.', 'give' ); |
|
134 | + $options[0] = esc_html__('No forms found.', 'give'); |
|
135 | 135 | } |
136 | 136 | |
137 | - $output = $this->select( array( |
|
137 | + $output = $this->select(array( |
|
138 | 138 | 'name' => $args['name'], |
139 | 139 | 'selected' => $args['selected'], |
140 | 140 | 'id' => $args['id'], |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | 'placeholder' => $args['placeholder'], |
146 | 146 | 'show_option_all' => false, |
147 | 147 | 'show_option_none' => false |
148 | - ) ); |
|
148 | + )); |
|
149 | 149 | |
150 | 150 | return $output; |
151 | 151 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return string Donors dropdown. |
164 | 164 | */ |
165 | - public function donor_dropdown( $args = array() ) { |
|
165 | + public function donor_dropdown($args = array()) { |
|
166 | 166 | |
167 | 167 | $defaults = array( |
168 | 168 | 'name' => 'customers', |
@@ -171,38 +171,38 @@ discard block |
||
171 | 171 | 'multiple' => false, |
172 | 172 | 'selected' => 0, |
173 | 173 | 'chosen' => true, |
174 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
174 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
175 | 175 | 'number' => 30 |
176 | 176 | ); |
177 | 177 | |
178 | - $args = wp_parse_args( $args, $defaults ); |
|
178 | + $args = wp_parse_args($args, $defaults); |
|
179 | 179 | |
180 | - $customers = Give()->customers->get_customers( array( |
|
180 | + $customers = Give()->customers->get_customers(array( |
|
181 | 181 | 'number' => $args['number'] |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | |
184 | 184 | $options = array(); |
185 | 185 | |
186 | - if ( $customers ) { |
|
187 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
188 | - foreach ( $customers as $customer ) { |
|
189 | - $options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
186 | + if ($customers) { |
|
187 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
188 | + foreach ($customers as $customer) { |
|
189 | + $options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')'); |
|
190 | 190 | } |
191 | 191 | } else { |
192 | - $options[0] = esc_html__( 'No donors found.', 'give' ); |
|
192 | + $options[0] = esc_html__('No donors found.', 'give'); |
|
193 | 193 | } |
194 | 194 | |
195 | - if ( ! empty( $args['selected'] ) ) { |
|
195 | + if ( ! empty($args['selected'])) { |
|
196 | 196 | |
197 | 197 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed. |
198 | 198 | |
199 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
199 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
200 | 200 | |
201 | - $customer = new Give_Customer( $args['selected'] ); |
|
201 | + $customer = new Give_Customer($args['selected']); |
|
202 | 202 | |
203 | - if ( $customer ) { |
|
203 | + if ($customer) { |
|
204 | 204 | |
205 | - $options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
205 | + $options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')'); |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | |
211 | 211 | } |
212 | 212 | |
213 | - $output = $this->select( array( |
|
213 | + $output = $this->select(array( |
|
214 | 214 | 'name' => $args['name'], |
215 | 215 | 'selected' => $args['selected'], |
216 | 216 | 'id' => $args['id'], |
217 | - 'class' => $args['class'] . ' give-customer-select', |
|
217 | + 'class' => $args['class'].' give-customer-select', |
|
218 | 218 | 'options' => $options, |
219 | 219 | 'multiple' => $args['multiple'], |
220 | 220 | 'chosen' => $args['chosen'], |
221 | 221 | 'show_option_all' => false, |
222 | 222 | 'show_option_none' => false |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | |
225 | 225 | return $output; |
226 | 226 | } |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return string Categories dropdown. |
241 | 241 | */ |
242 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) { |
|
243 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
242 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) { |
|
243 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
244 | 244 | $options = array(); |
245 | 245 | |
246 | - foreach ( $categories as $category ) { |
|
247 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
246 | + foreach ($categories as $category) { |
|
247 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
248 | 248 | } |
249 | 249 | |
250 | - $output = $this->select( wp_parse_args( |
|
250 | + $output = $this->select(wp_parse_args( |
|
251 | 251 | $args, |
252 | 252 | array( |
253 | 253 | 'name' => $name, |
254 | 254 | 'selected' => $selected, |
255 | 255 | 'options' => $options, |
256 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
256 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
257 | 257 | 'show_option_none' => false |
258 | 258 | ) |
259 | - ) ); |
|
259 | + )); |
|
260 | 260 | |
261 | 261 | return $output; |
262 | 262 | } |
@@ -275,24 +275,24 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return string Tags dropdown. |
277 | 277 | */ |
278 | - public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) { |
|
279 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
278 | + public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) { |
|
279 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
280 | 280 | $options = array(); |
281 | 281 | |
282 | - foreach ( $tags as $tag ) { |
|
283 | - $options[ absint( $tag->term_id ) ] = esc_html( $tag->name ); |
|
282 | + foreach ($tags as $tag) { |
|
283 | + $options[absint($tag->term_id)] = esc_html($tag->name); |
|
284 | 284 | } |
285 | 285 | |
286 | - $output = $this->select( wp_parse_args( |
|
286 | + $output = $this->select(wp_parse_args( |
|
287 | 287 | $args, |
288 | 288 | array( |
289 | 289 | 'name' => $name, |
290 | 290 | 'selected' => $selected, |
291 | 291 | 'options' => $options, |
292 | - 'show_option_all' => esc_html__( 'All Tags', 'give' ), |
|
292 | + 'show_option_all' => esc_html__('All Tags', 'give'), |
|
293 | 293 | 'show_option_none' => false, |
294 | 294 | ) |
295 | - ) ); |
|
295 | + )); |
|
296 | 296 | |
297 | 297 | return $output; |
298 | 298 | } |
@@ -312,25 +312,25 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return string Years dropdown. |
314 | 314 | */ |
315 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
316 | - $current = date( 'Y' ); |
|
317 | - $start_year = $current - absint( $years_before ); |
|
318 | - $end_year = $current + absint( $years_after ); |
|
319 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
315 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
316 | + $current = date('Y'); |
|
317 | + $start_year = $current - absint($years_before); |
|
318 | + $end_year = $current + absint($years_after); |
|
319 | + $selected = empty($selected) ? date('Y') : $selected; |
|
320 | 320 | $options = array(); |
321 | 321 | |
322 | - while ( $start_year <= $end_year ) { |
|
323 | - $options[ absint( $start_year ) ] = $start_year; |
|
324 | - $start_year ++; |
|
322 | + while ($start_year <= $end_year) { |
|
323 | + $options[absint($start_year)] = $start_year; |
|
324 | + $start_year++; |
|
325 | 325 | } |
326 | 326 | |
327 | - $output = $this->select( array( |
|
327 | + $output = $this->select(array( |
|
328 | 328 | 'name' => $name, |
329 | 329 | 'selected' => $selected, |
330 | 330 | 'options' => $options, |
331 | 331 | 'show_option_all' => false, |
332 | 332 | 'show_option_none' => false |
333 | - ) ); |
|
333 | + )); |
|
334 | 334 | |
335 | 335 | return $output; |
336 | 336 | } |
@@ -348,23 +348,23 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return string Months dropdown. |
350 | 350 | */ |
351 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
351 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
352 | 352 | $month = 1; |
353 | 353 | $options = array(); |
354 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
354 | + $selected = empty($selected) ? date('n') : $selected; |
|
355 | 355 | |
356 | - while ( $month <= 12 ) { |
|
357 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
358 | - $month ++; |
|
356 | + while ($month <= 12) { |
|
357 | + $options[absint($month)] = give_month_num_to_name($month); |
|
358 | + $month++; |
|
359 | 359 | } |
360 | 360 | |
361 | - $output = $this->select( array( |
|
361 | + $output = $this->select(array( |
|
362 | 362 | 'name' => $name, |
363 | 363 | 'selected' => $selected, |
364 | 364 | 'options' => $options, |
365 | 365 | 'show_option_all' => false, |
366 | 366 | 'show_option_none' => false |
367 | - ) ); |
|
367 | + )); |
|
368 | 368 | |
369 | 369 | return $output; |
370 | 370 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @return string The dropdown. |
383 | 383 | */ |
384 | - public function select( $args = array() ) { |
|
384 | + public function select($args = array()) { |
|
385 | 385 | $defaults = array( |
386 | 386 | 'options' => array(), |
387 | 387 | 'name' => null, |
@@ -392,60 +392,60 @@ discard block |
||
392 | 392 | 'placeholder' => null, |
393 | 393 | 'multiple' => false, |
394 | 394 | 'select_atts' => false, |
395 | - 'show_option_all' => esc_html__( 'All', 'give' ), |
|
396 | - 'show_option_none' => esc_html__( 'None', 'give' ) |
|
395 | + 'show_option_all' => esc_html__('All', 'give'), |
|
396 | + 'show_option_none' => esc_html__('None', 'give') |
|
397 | 397 | ); |
398 | 398 | |
399 | - $args = wp_parse_args( $args, $defaults ); |
|
399 | + $args = wp_parse_args($args, $defaults); |
|
400 | 400 | |
401 | - if ( $args['multiple'] ) { |
|
401 | + if ($args['multiple']) { |
|
402 | 402 | $multiple = ' MULTIPLE'; |
403 | 403 | } else { |
404 | 404 | $multiple = ''; |
405 | 405 | } |
406 | 406 | |
407 | - if ( $args['chosen'] ) { |
|
407 | + if ($args['chosen']) { |
|
408 | 408 | $args['class'] .= ' give-select-chosen'; |
409 | 409 | } |
410 | 410 | |
411 | - if ( $args['placeholder'] ) { |
|
411 | + if ($args['placeholder']) { |
|
412 | 412 | $placeholder = $args['placeholder']; |
413 | 413 | } else { |
414 | 414 | $placeholder = ''; |
415 | 415 | } |
416 | 416 | |
417 | 417 | |
418 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">'; |
|
418 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">'; |
|
419 | 419 | |
420 | - if ( $args['show_option_all'] ) { |
|
421 | - if ( $args['multiple'] ) { |
|
422 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
420 | + if ($args['show_option_all']) { |
|
421 | + if ($args['multiple']) { |
|
422 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
423 | 423 | } else { |
424 | - $selected = selected( $args['selected'], 0, false ); |
|
424 | + $selected = selected($args['selected'], 0, false); |
|
425 | 425 | } |
426 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
426 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
427 | 427 | } |
428 | 428 | |
429 | - if ( ! empty( $args['options'] ) ) { |
|
429 | + if ( ! empty($args['options'])) { |
|
430 | 430 | |
431 | - if ( $args['show_option_none'] ) { |
|
432 | - if ( $args['multiple'] ) { |
|
433 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
431 | + if ($args['show_option_none']) { |
|
432 | + if ($args['multiple']) { |
|
433 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
434 | 434 | } else { |
435 | - $selected = selected( $args['selected'], - 1, false ); |
|
435 | + $selected = selected($args['selected'], - 1, false); |
|
436 | 436 | } |
437 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
437 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
438 | 438 | } |
439 | 439 | |
440 | - foreach ( $args['options'] as $key => $option ) { |
|
440 | + foreach ($args['options'] as $key => $option) { |
|
441 | 441 | |
442 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
443 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
442 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
443 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
444 | 444 | } else { |
445 | - $selected = selected( $args['selected'], $key, false ); |
|
445 | + $selected = selected($args['selected'], $key, false); |
|
446 | 446 | } |
447 | 447 | |
448 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
448 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * |
467 | 467 | * @return string The checkbox. |
468 | 468 | */ |
469 | - public function checkbox( $args = array() ) { |
|
469 | + public function checkbox($args = array()) { |
|
470 | 470 | $defaults = array( |
471 | 471 | 'name' => null, |
472 | 472 | 'current' => null, |
@@ -477,16 +477,16 @@ discard block |
||
477 | 477 | ) |
478 | 478 | ); |
479 | 479 | |
480 | - $args = wp_parse_args( $args, $defaults ); |
|
480 | + $args = wp_parse_args($args, $defaults); |
|
481 | 481 | |
482 | 482 | $options = ''; |
483 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
483 | + if ( ! empty($args['options']['disabled'])) { |
|
484 | 484 | $options .= ' disabled="disabled"'; |
485 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
485 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
486 | 486 | $options .= ' readonly'; |
487 | 487 | } |
488 | 488 | |
489 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
489 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
490 | 490 | |
491 | 491 | return $output; |
492 | 492 | } |
@@ -503,22 +503,22 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return string The text field. |
505 | 505 | */ |
506 | - public function text( $args = array() ) { |
|
506 | + public function text($args = array()) { |
|
507 | 507 | // Backwards compatibility |
508 | - if ( func_num_args() > 1 ) { |
|
508 | + if (func_num_args() > 1) { |
|
509 | 509 | $args = func_get_args(); |
510 | 510 | |
511 | 511 | $name = $args[0]; |
512 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
513 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
514 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
512 | + $value = isset($args[1]) ? $args[1] : ''; |
|
513 | + $label = isset($args[2]) ? $args[2] : ''; |
|
514 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $defaults = array( |
518 | - 'name' => isset( $name ) ? $name : 'text', |
|
519 | - 'value' => isset( $value ) ? $value : null, |
|
520 | - 'label' => isset( $label ) ? $label : null, |
|
521 | - 'desc' => isset( $desc ) ? $desc : null, |
|
518 | + 'name' => isset($name) ? $name : 'text', |
|
519 | + 'value' => isset($value) ? $value : null, |
|
520 | + 'label' => isset($label) ? $label : null, |
|
521 | + 'desc' => isset($desc) ? $desc : null, |
|
522 | 522 | 'placeholder' => '', |
523 | 523 | 'class' => 'regular-text', |
524 | 524 | 'disabled' => false, |
@@ -526,29 +526,29 @@ discard block |
||
526 | 526 | 'data' => false |
527 | 527 | ); |
528 | 528 | |
529 | - $args = wp_parse_args( $args, $defaults ); |
|
529 | + $args = wp_parse_args($args, $defaults); |
|
530 | 530 | |
531 | 531 | $disabled = ''; |
532 | - if ( $args['disabled'] ) { |
|
532 | + if ($args['disabled']) { |
|
533 | 533 | $disabled = ' disabled="disabled"'; |
534 | 534 | } |
535 | 535 | |
536 | 536 | $data = ''; |
537 | - if ( ! empty( $args['data'] ) ) { |
|
538 | - foreach ( $args['data'] as $key => $value ) { |
|
539 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
537 | + if ( ! empty($args['data'])) { |
|
538 | + foreach ($args['data'] as $key => $value) { |
|
539 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
543 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
543 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
544 | 544 | |
545 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
545 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
546 | 546 | |
547 | - if ( ! empty( $args['desc'] ) ) { |
|
548 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
547 | + if ( ! empty($args['desc'])) { |
|
548 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
549 | 549 | } |
550 | 550 | |
551 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
551 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
552 | 552 | |
553 | 553 | $output .= '</span>'; |
554 | 554 | |
@@ -567,15 +567,15 @@ discard block |
||
567 | 567 | * |
568 | 568 | * @return string The date picker. |
569 | 569 | */ |
570 | - public function date_field( $args = array() ) { |
|
570 | + public function date_field($args = array()) { |
|
571 | 571 | |
572 | - if ( empty( $args['class'] ) ) { |
|
572 | + if (empty($args['class'])) { |
|
573 | 573 | $args['class'] = 'give_datepicker'; |
574 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
574 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
575 | 575 | $args['class'] .= ' give_datepicker'; |
576 | 576 | } |
577 | 577 | |
578 | - return $this->text( $args ); |
|
578 | + return $this->text($args); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @return string The textarea. |
592 | 592 | */ |
593 | - public function textarea( $args = array() ) { |
|
593 | + public function textarea($args = array()) { |
|
594 | 594 | $defaults = array( |
595 | 595 | 'name' => 'textarea', |
596 | 596 | 'value' => null, |
@@ -600,21 +600,21 @@ discard block |
||
600 | 600 | 'disabled' => false |
601 | 601 | ); |
602 | 602 | |
603 | - $args = wp_parse_args( $args, $defaults ); |
|
603 | + $args = wp_parse_args($args, $defaults); |
|
604 | 604 | |
605 | 605 | $disabled = ''; |
606 | - if ( $args['disabled'] ) { |
|
606 | + if ($args['disabled']) { |
|
607 | 607 | $disabled = ' disabled="disabled"'; |
608 | 608 | } |
609 | 609 | |
610 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
610 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
611 | 611 | |
612 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
612 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
613 | 613 | |
614 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
614 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
615 | 615 | |
616 | - if ( ! empty( $args['desc'] ) ) { |
|
617 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
616 | + if ( ! empty($args['desc'])) { |
|
617 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | $output .= '</span>'; |
@@ -634,12 +634,12 @@ discard block |
||
634 | 634 | * |
635 | 635 | * @return string The text field with ajax search. |
636 | 636 | */ |
637 | - public function ajax_user_search( $args = array() ) { |
|
637 | + public function ajax_user_search($args = array()) { |
|
638 | 638 | |
639 | 639 | $defaults = array( |
640 | 640 | 'name' => 'user_id', |
641 | 641 | 'value' => null, |
642 | - 'placeholder' => esc_attr__( 'Enter username', 'give' ), |
|
642 | + 'placeholder' => esc_attr__('Enter username', 'give'), |
|
643 | 643 | 'label' => null, |
644 | 644 | 'desc' => null, |
645 | 645 | 'class' => '', |
@@ -648,13 +648,13 @@ discard block |
||
648 | 648 | 'data' => false |
649 | 649 | ); |
650 | 650 | |
651 | - $args = wp_parse_args( $args, $defaults ); |
|
651 | + $args = wp_parse_args($args, $defaults); |
|
652 | 652 | |
653 | - $args['class'] = 'give-ajax-user-search ' . $args['class']; |
|
653 | + $args['class'] = 'give-ajax-user-search '.$args['class']; |
|
654 | 654 | |
655 | 655 | $output = '<span class="give_user_search_wrap">'; |
656 | - $output .= $this->text( $args ); |
|
657 | - $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>'; |
|
656 | + $output .= $this->text($args); |
|
657 | + $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>'; |
|
658 | 658 | $output .= '</span>'; |
659 | 659 | |
660 | 660 | return $output; |