@@ -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,40 +23,40 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | /** Give Forms Post Type */ |
26 | - $give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false; |
|
26 | + $give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false; |
|
27 | 27 | |
28 | - $give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false; |
|
28 | + $give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false; |
|
29 | 29 | |
30 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
30 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
31 | 31 | //support for old 'GIVE_FORMS_SLUG' constant |
32 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
32 | + if (defined('GIVE_FORMS_SLUG')) { |
|
33 | 33 | $give_forms_slug = GIVE_FORMS_SLUG; |
34 | 34 | } |
35 | 35 | |
36 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
37 | 37 | 'slug' => $give_forms_slug, |
38 | 38 | 'with_front' => false |
39 | 39 | ); |
40 | 40 | |
41 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
42 | - 'name' => __( 'Donation %2$s', 'give' ), |
|
41 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
42 | + 'name' => __('Donation %2$s', 'give'), |
|
43 | 43 | 'singular_name' => '%1$s', |
44 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
45 | - 'add_new_item' => __( 'Add New Donation %1$s', 'give' ), |
|
46 | - 'edit_item' => __( 'Edit Donation %1$s', 'give' ), |
|
47 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
48 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
49 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
50 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
51 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
52 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
44 | + 'add_new' => __('Add %1$s', 'give'), |
|
45 | + 'add_new_item' => __('Add New Donation %1$s', 'give'), |
|
46 | + 'edit_item' => __('Edit Donation %1$s', 'give'), |
|
47 | + 'new_item' => __('New %1$s', 'give'), |
|
48 | + 'all_items' => __('All %2$s', 'give'), |
|
49 | + 'view_item' => __('View %1$s', 'give'), |
|
50 | + 'search_items' => __('Search %2$s', 'give'), |
|
51 | + 'not_found' => __('No %2$s found', 'give'), |
|
52 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
53 | 53 | 'parent_item_colon' => '', |
54 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
55 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ) |
|
56 | - ) ); |
|
54 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
55 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')) |
|
56 | + )); |
|
57 | 57 | |
58 | - foreach ( $give_forms_labels as $key => $value ) { |
|
59 | - $give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
58 | + foreach ($give_forms_labels as $key => $value) { |
|
59 | + $give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | //Default give_forms supports |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | //Has the user disabled the excerpt |
72 | - if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) { |
|
73 | - unset( $give_form_supports[2] ); |
|
72 | + if (give_get_option('disable_forms_excerpt') === 'on') { |
|
73 | + unset($give_form_supports[2]); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | //Has user disabled the featured image? |
77 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
78 | - unset( $give_form_supports[1] ); |
|
79 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
77 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
78 | + unset($give_form_supports[1]); |
|
79 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $give_forms_args = array( |
@@ -92,42 +92,42 @@ discard block |
||
92 | 92 | 'has_archive' => $give_forms_archives, |
93 | 93 | 'menu_icon' => 'dashicons-give', |
94 | 94 | 'hierarchical' => false, |
95 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
95 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
96 | 96 | ); |
97 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
97 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
98 | 98 | |
99 | 99 | /** Payment Post Type */ |
100 | 100 | $payment_labels = array( |
101 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
102 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
103 | - 'add_new' => __( 'Add New', 'give' ), |
|
104 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
105 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
106 | - 'new_item' => __( 'New Donation', 'give' ), |
|
107 | - 'all_items' => __( 'All Donations', 'give' ), |
|
108 | - 'view_item' => __( 'View Donation', 'give' ), |
|
109 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
110 | - 'not_found' => __( 'No Donations found', 'give' ), |
|
111 | - 'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ), |
|
101 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
102 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
103 | + 'add_new' => __('Add New', 'give'), |
|
104 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
105 | + 'edit_item' => __('Edit Donation', 'give'), |
|
106 | + 'new_item' => __('New Donation', 'give'), |
|
107 | + 'all_items' => __('All Donations', 'give'), |
|
108 | + 'view_item' => __('View Donation', 'give'), |
|
109 | + 'search_items' => __('Search Donations', 'give'), |
|
110 | + 'not_found' => __('No Donations found', 'give'), |
|
111 | + 'not_found_in_trash' => __('No Donations found in Trash', 'give'), |
|
112 | 112 | 'parent_item_colon' => '', |
113 | - 'menu_name' => __( 'Transactions', 'give' ) |
|
113 | + 'menu_name' => __('Transactions', 'give') |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | $payment_args = array( |
117 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
117 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
118 | 118 | 'public' => false, |
119 | 119 | 'query_var' => false, |
120 | 120 | 'rewrite' => false, |
121 | 121 | 'map_meta_cap' => true, |
122 | 122 | 'capability_type' => 'give_payment', |
123 | - 'supports' => array( 'title' ), |
|
123 | + 'supports' => array('title'), |
|
124 | 124 | 'can_export' => true |
125 | 125 | ); |
126 | - register_post_type( 'give_payment', $payment_args ); |
|
126 | + register_post_type('give_payment', $payment_args); |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
130 | +add_action('init', 'give_setup_post_types', 1); |
|
131 | 131 | |
132 | 132 | |
133 | 133 | /** |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function give_setup_taxonomies() { |
142 | 142 | |
143 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
143 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
144 | 144 | |
145 | 145 | /** Categories */ |
146 | 146 | $category_labels = array( |
147 | - 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
148 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
149 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
150 | - 'all_items' => __( 'All Categories', 'give' ), |
|
151 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
152 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
153 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
154 | - 'update_item' => __( 'Update Category', 'give' ), |
|
155 | - 'add_new_item' => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ), |
|
156 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
157 | - 'menu_name' => __( 'Categories', 'give' ), |
|
147 | + 'name' => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
148 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
149 | + 'search_items' => __('Search Categories', 'give'), |
|
150 | + 'all_items' => __('All Categories', 'give'), |
|
151 | + 'parent_item' => __('Parent Category', 'give'), |
|
152 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
153 | + 'edit_item' => __('Edit Category', 'give'), |
|
154 | + 'update_item' => __('Update Category', 'give'), |
|
155 | + 'add_new_item' => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()), |
|
156 | + 'new_item_name' => __('New Category Name', 'give'), |
|
157 | + 'menu_name' => __('Categories', 'give'), |
|
158 | 158 | ); |
159 | 159 | |
160 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
160 | + $category_args = apply_filters('give_forms_category_args', array( |
|
161 | 161 | 'hierarchical' => true, |
162 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
162 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
163 | 163 | 'show_ui' => true, |
164 | 164 | 'query_var' => 'give_forms_category', |
165 | 165 | 'rewrite' => array( |
166 | - 'slug' => $slug . '/category', |
|
166 | + 'slug' => $slug.'/category', |
|
167 | 167 | 'with_front' => false, |
168 | 168 | 'hierarchical' => true |
169 | 169 | ), |
@@ -177,34 +177,34 @@ discard block |
||
177 | 177 | ); |
178 | 178 | |
179 | 179 | //Does the user want categories? |
180 | - if ( give_get_option( 'enable_categories' ) == 'on' ) { |
|
181 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
182 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
180 | + if (give_get_option('enable_categories') == 'on') { |
|
181 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
182 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | 186 | /** Tags */ |
187 | 187 | $tag_labels = array( |
188 | - 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
189 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
190 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
191 | - 'all_items' => __( 'All Tags', 'give' ), |
|
192 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
193 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
194 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
195 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
196 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
197 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
198 | - 'menu_name' => __( 'Tags', 'give' ), |
|
199 | - 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags.', 'give' ), give_get_forms_label_singular() ), |
|
188 | + 'name' => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
189 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
190 | + 'search_items' => __('Search Tags', 'give'), |
|
191 | + 'all_items' => __('All Tags', 'give'), |
|
192 | + 'parent_item' => __('Parent Tag', 'give'), |
|
193 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
194 | + 'edit_item' => __('Edit Tag', 'give'), |
|
195 | + 'update_item' => __('Update Tag', 'give'), |
|
196 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
197 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
198 | + 'menu_name' => __('Tags', 'give'), |
|
199 | + 'choose_from_most_used' => sprintf(__('Choose from most used %s tags.', 'give'), give_get_forms_label_singular()), |
|
200 | 200 | ); |
201 | 201 | |
202 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
202 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
203 | 203 | 'hierarchical' => false, |
204 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
204 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
205 | 205 | 'show_ui' => true, |
206 | 206 | 'query_var' => 'give_forms_tag', |
207 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
207 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
208 | 208 | 'capabilities' => array( |
209 | 209 | 'manage_terms' => 'manage_give_forms_terms', |
210 | 210 | 'edit_terms' => 'edit_give_forms_terms', |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | ) |
216 | 216 | ); |
217 | 217 | |
218 | - if ( give_get_option( 'enable_tags' ) == 'on' ) { |
|
219 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
220 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
218 | + if (give_get_option('enable_tags') == 'on') { |
|
219 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
220 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
224 | 224 | } |
225 | 225 | |
226 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
226 | +add_action('init', 'give_setup_taxonomies', 0); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | /** |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | */ |
235 | 235 | function give_get_default_form_labels() { |
236 | 236 | $defaults = array( |
237 | - 'singular' => __( 'Form', 'give' ), |
|
238 | - 'plural' => __( 'Forms', 'give' ) |
|
237 | + 'singular' => __('Form', 'give'), |
|
238 | + 'plural' => __('Forms', 'give') |
|
239 | 239 | ); |
240 | 240 | |
241 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
241 | + return apply_filters('give_default_form_name', $defaults); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return string $defaults['singular'] Singular label |
252 | 252 | */ |
253 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
253 | +function give_get_forms_label_singular($lowercase = false) { |
|
254 | 254 | $defaults = give_get_default_form_labels(); |
255 | 255 | |
256 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
256 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | * @since 1.0 |
263 | 263 | * @return string $defaults['plural'] Plural label |
264 | 264 | */ |
265 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
265 | +function give_get_forms_label_plural($lowercase = false) { |
|
266 | 266 | $defaults = give_get_default_form_labels(); |
267 | 267 | |
268 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
268 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -277,26 +277,26 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return string $title New placeholder text |
279 | 279 | */ |
280 | -function give_change_default_title( $title ) { |
|
280 | +function give_change_default_title($title) { |
|
281 | 281 | // If a frontend plugin uses this filter (check extensions before changing this function) |
282 | - if ( ! is_admin() ) { |
|
282 | + if ( ! is_admin()) { |
|
283 | 283 | $label = give_get_forms_label_singular(); |
284 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
284 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
285 | 285 | |
286 | 286 | return $title; |
287 | 287 | } |
288 | 288 | |
289 | 289 | $screen = get_current_screen(); |
290 | 290 | |
291 | - if ( 'give_forms' == $screen->post_type ) { |
|
291 | + if ('give_forms' == $screen->post_type) { |
|
292 | 292 | $label = give_get_forms_label_singular(); |
293 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
293 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | return $title; |
297 | 297 | } |
298 | 298 | |
299 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
299 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Registers Custom Post Statuses which are used by the Payments |
@@ -306,50 +306,50 @@ discard block |
||
306 | 306 | */ |
307 | 307 | function give_register_post_type_statuses() { |
308 | 308 | // Payment Statuses |
309 | - register_post_status( 'refunded', array( |
|
310 | - 'label' => _x( 'Refunded', 'Refunded payment status', 'give' ), |
|
309 | + register_post_status('refunded', array( |
|
310 | + 'label' => _x('Refunded', 'Refunded payment status', 'give'), |
|
311 | 311 | 'public' => true, |
312 | 312 | 'exclude_from_search' => false, |
313 | 313 | 'show_in_admin_all_list' => true, |
314 | 314 | 'show_in_admin_status_list' => true, |
315 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ) |
|
316 | - ) ); |
|
317 | - register_post_status( 'failed', array( |
|
318 | - 'label' => _x( 'Failed', 'Failed payment status', 'give' ), |
|
315 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give') |
|
316 | + )); |
|
317 | + register_post_status('failed', array( |
|
318 | + 'label' => _x('Failed', 'Failed payment status', 'give'), |
|
319 | 319 | 'public' => true, |
320 | 320 | 'exclude_from_search' => false, |
321 | 321 | 'show_in_admin_all_list' => true, |
322 | 322 | 'show_in_admin_status_list' => true, |
323 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ) |
|
324 | - ) ); |
|
325 | - register_post_status( 'revoked', array( |
|
326 | - 'label' => _x( 'Revoked', 'Revoked payment status', 'give' ), |
|
323 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give') |
|
324 | + )); |
|
325 | + register_post_status('revoked', array( |
|
326 | + 'label' => _x('Revoked', 'Revoked payment status', 'give'), |
|
327 | 327 | 'public' => true, |
328 | 328 | 'exclude_from_search' => false, |
329 | 329 | 'show_in_admin_all_list' => true, |
330 | 330 | 'show_in_admin_status_list' => true, |
331 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ) |
|
332 | - ) ); |
|
333 | - register_post_status( 'cancelled', array( |
|
334 | - 'label' => _x( 'Cancelled', 'Cancelled payment status', 'give' ), |
|
331 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give') |
|
332 | + )); |
|
333 | + register_post_status('cancelled', array( |
|
334 | + 'label' => _x('Cancelled', 'Cancelled payment status', 'give'), |
|
335 | 335 | 'public' => true, |
336 | 336 | 'exclude_from_search' => false, |
337 | 337 | 'show_in_admin_all_list' => true, |
338 | 338 | 'show_in_admin_status_list' => true, |
339 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ) |
|
340 | - ) ); |
|
341 | - register_post_status( 'abandoned', array( |
|
342 | - 'label' => _x( 'Abandoned', 'Abandoned payment status', 'give' ), |
|
339 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give') |
|
340 | + )); |
|
341 | + register_post_status('abandoned', array( |
|
342 | + 'label' => _x('Abandoned', 'Abandoned payment status', 'give'), |
|
343 | 343 | 'public' => true, |
344 | 344 | 'exclude_from_search' => false, |
345 | 345 | 'show_in_admin_all_list' => true, |
346 | 346 | 'show_in_admin_status_list' => true, |
347 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ) |
|
348 | - ) ); |
|
347 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give') |
|
348 | + )); |
|
349 | 349 | |
350 | 350 | } |
351 | 351 | |
352 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
352 | +add_action('init', 'give_register_post_type_statuses'); |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Updated Messages |
@@ -362,43 +362,43 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @return array $messages New post updated messages |
364 | 364 | */ |
365 | -function give_updated_messages( $messages ) { |
|
365 | +function give_updated_messages($messages) { |
|
366 | 366 | global $post, $post_ID; |
367 | 367 | |
368 | - $url1 = '<a href="' . get_permalink( $post_ID ) . '">'; |
|
368 | + $url1 = '<a href="'.get_permalink($post_ID).'">'; |
|
369 | 369 | $url2 = give_get_forms_label_singular(); |
370 | 370 | $url3 = '</a>'; |
371 | 371 | |
372 | 372 | $messages['give_forms'] = array( |
373 | - 1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
374 | - 4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
375 | - 6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
376 | - 7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
377 | - 8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ) |
|
373 | + 1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
374 | + 4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
375 | + 6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
376 | + 7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
377 | + 8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3) |
|
378 | 378 | ); |
379 | 379 | |
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_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
395 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
396 | 396 | return; |
397 | 397 | } |
398 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
399 | - add_theme_support( 'post-thumbnails' ); |
|
398 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
399 | + add_theme_support('post-thumbnails'); |
|
400 | 400 | } |
401 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
401 | + add_post_type_support('give_forms', 'thumbnail'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -410,19 +410,19 @@ discard block |
||
410 | 410 | function give_widgets_init() { |
411 | 411 | |
412 | 412 | //Single Give Forms (disabled if single turned off in settings) |
413 | - if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) { |
|
413 | + if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') { |
|
414 | 414 | |
415 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
416 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
415 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
416 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
417 | 417 | 'id' => 'give-forms-sidebar', |
418 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
418 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
419 | 419 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
420 | 420 | 'after_widget' => '</div>', |
421 | 421 | 'before_title' => '<h3 class="widgettitle widget-title">', |
422 | 422 | 'after_title' => '</h3>', |
423 | - ) ) ); |
|
423 | + ))); |
|
424 | 424 | |
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
428 | +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 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -51,45 +51,45 @@ discard block |
||
51 | 51 | $price_id = $payment->price_id; |
52 | 52 | $form_id = $payment->form_id; |
53 | 53 | |
54 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
54 | + do_action('give_pre_complete_purchase', $payment_id); |
|
55 | 55 | |
56 | 56 | // Ensure these actions only run once, ever |
57 | - if ( empty( $completed_date ) ) { |
|
57 | + if (empty($completed_date)) { |
|
58 | 58 | |
59 | - give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
60 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
59 | + give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
60 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
61 | 61 | |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Increase the earnings for this form ID |
65 | - give_increase_earnings( $form_id, $amount ); |
|
66 | - give_increase_purchase_count( $form_id ); |
|
65 | + give_increase_earnings($form_id, $amount); |
|
66 | + give_increase_purchase_count($form_id); |
|
67 | 67 | |
68 | 68 | // Clear the total earnings cache |
69 | - delete_transient( 'give_earnings_total' ); |
|
69 | + delete_transient('give_earnings_total'); |
|
70 | 70 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
71 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
72 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
71 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
72 | + delete_transient(md5('give_earnings_todaytoday')); |
|
73 | 73 | |
74 | 74 | // Increase the donor's purchase stats |
75 | - $customer = new Give_Customer( $customer_id ); |
|
75 | + $customer = new Give_Customer($customer_id); |
|
76 | 76 | $customer->increase_purchase_count(); |
77 | - $customer->increase_value( $amount ); |
|
77 | + $customer->increase_value($amount); |
|
78 | 78 | |
79 | - give_increase_total_earnings( $amount ); |
|
79 | + give_increase_total_earnings($amount); |
|
80 | 80 | |
81 | 81 | // Ensure this action only runs once ever |
82 | - if ( empty( $completed_date ) ) { |
|
82 | + if (empty($completed_date)) { |
|
83 | 83 | |
84 | 84 | // Save the completed date |
85 | - $payment->completed_date = current_time( 'mysql' ); |
|
85 | + $payment->completed_date = current_time('mysql'); |
|
86 | 86 | $payment->save(); |
87 | - do_action( 'give_complete_purchase', $payment_id ); |
|
87 | + do_action('give_complete_purchase', $payment_id); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
92 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | /** |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return void |
105 | 105 | */ |
106 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
106 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
107 | 107 | |
108 | 108 | // Get the list of statuses so that status in the payment note can be translated |
109 | 109 | $stati = give_get_payment_statuses(); |
110 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
111 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
110 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
111 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
112 | 112 | |
113 | - $status_change = sprintf( __( 'Status changed from %s to %s.', 'give' ), $old_status, $new_status ); |
|
113 | + $status_change = sprintf(__('Status changed from %s to %s.', 'give'), $old_status, $new_status); |
|
114 | 114 | |
115 | - give_insert_payment_note( $payment_id, $status_change ); |
|
115 | + give_insert_payment_note($payment_id, $status_change); |
|
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
118 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | /** |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | * @param $new_status the status of the payment, probably "publish" |
129 | 129 | * @param $old_status the status of the payment prior to being marked as "complete", probably "pending" |
130 | 130 | */ |
131 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
131 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
132 | 132 | |
133 | - $payment = new Give_Payment( $payment_id ); |
|
133 | + $payment = new Give_Payment($payment_id); |
|
134 | 134 | |
135 | - if ( ! empty( $payment->user_id ) ) { |
|
136 | - delete_transient( 'give_user_' . $payment->user_id . '_purchases' ); |
|
135 | + if ( ! empty($payment->user_id)) { |
|
136 | + delete_transient('give_user_'.$payment->user_id.'_purchases'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | } |
140 | 140 | |
141 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
141 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Updates all old payments, prior to 1.2, with new |
@@ -152,25 +152,25 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_update_old_payments_with_totals( $data ) { |
|
156 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
155 | +function give_update_old_payments_with_totals($data) { |
|
156 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
160 | + if (get_option('give_payment_totals_upgraded')) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | - $payments = give_get_payments( array( |
|
164 | + $payments = give_get_payments(array( |
|
165 | 165 | 'offset' => 0, |
166 | - 'number' => - 1, |
|
166 | + 'number' => -1, |
|
167 | 167 | 'mode' => 'all' |
168 | - ) ); |
|
168 | + )); |
|
169 | 169 | |
170 | - if ( $payments ) { |
|
171 | - foreach ( $payments as $payment ) { |
|
170 | + if ($payments) { |
|
171 | + foreach ($payments as $payment) { |
|
172 | 172 | |
173 | - $payment = new Give_Payment( $payment->ID ); |
|
173 | + $payment = new Give_Payment($payment->ID); |
|
174 | 174 | $meta = $payment->get_meta(); |
175 | 175 | |
176 | 176 | $payment->total = $meta['amount']; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
182 | + add_option('give_payment_totals_upgraded', 1); |
|
183 | 183 | } |
184 | 184 | |
185 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
185 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Updates week-old+ 'pending' orders to 'abandoned' |
@@ -193,21 +193,21 @@ discard block |
||
193 | 193 | function give_mark_abandoned_donations() { |
194 | 194 | $args = array( |
195 | 195 | 'status' => 'pending', |
196 | - 'number' => - 1, |
|
196 | + 'number' => -1, |
|
197 | 197 | 'output' => 'give_payments', |
198 | 198 | ); |
199 | 199 | |
200 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
200 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
201 | 201 | |
202 | - $payments = give_get_payments( $args ); |
|
202 | + $payments = give_get_payments($args); |
|
203 | 203 | |
204 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
204 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
205 | 205 | |
206 | - if ( $payments ) { |
|
207 | - foreach ( $payments as $payment ) { |
|
208 | - $gateway = give_get_payment_gateway( $payment ); |
|
206 | + if ($payments) { |
|
207 | + foreach ($payments as $payment) { |
|
208 | + $gateway = give_get_payment_gateway($payment); |
|
209 | 209 | //Skip offline gateway payments |
210 | - if ( $gateway == 'offline' ) { |
|
210 | + if ($gateway == 'offline') { |
|
211 | 211 | continue; |
212 | 212 | } |
213 | 213 | $payment->status = 'abandoned'; |
@@ -216,4 +216,4 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
220 | 219 | \ No newline at end of file |
220 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
221 | 221 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = __( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = __( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = __('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = __('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | public function define_fields() { |
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
39 | + admin_url('post-new.php?post_type=give_forms') |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | return array( |
@@ -46,68 +46,68 @@ discard block |
||
46 | 46 | 'post_type' => 'give_forms', |
47 | 47 | ), |
48 | 48 | 'name' => 'id', |
49 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
50 | - 'placeholder' => __( '- Select a Form -', 'give' ), |
|
49 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
50 | + 'placeholder' => __('- Select a Form -', 'give'), |
|
51 | 51 | 'required' => array( |
52 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
52 | + 'alert' => __('You must first select a Form!', 'give'), |
|
53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
54 | 54 | ), |
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'type' => 'container', |
58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional form settings', 'give' ) ), |
|
58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional form settings', 'give')), |
|
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'listbox', |
62 | 62 | 'name' => 'show_title', |
63 | - 'label' => __( 'Show Title:', 'give' ), |
|
64 | - 'tooltip' => __( 'Do you want to display the form title?', 'give' ), |
|
63 | + 'label' => __('Show Title:', 'give'), |
|
64 | + 'tooltip' => __('Do you want to display the form title?', 'give'), |
|
65 | 65 | 'options' => array( |
66 | - 'true' => __( 'Show', 'give' ), |
|
67 | - 'false' => __( 'Hide', 'give' ), |
|
66 | + 'true' => __('Show', 'give'), |
|
67 | + 'false' => __('Hide', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | 71 | 'type' => 'listbox', |
72 | 72 | 'name' => 'show_goal', |
73 | - 'label' => __( 'Show Goal:', 'give' ), |
|
74 | - 'tooltip' => __( 'Do you want to display the donation goal?', 'give' ), |
|
73 | + 'label' => __('Show Goal:', 'give'), |
|
74 | + 'tooltip' => __('Do you want to display the donation goal?', 'give'), |
|
75 | 75 | 'options' => array( |
76 | - 'true' => __( 'Show', 'give' ), |
|
77 | - 'false' => __( 'Hide', 'give' ), |
|
76 | + 'true' => __('Show', 'give'), |
|
77 | + 'false' => __('Hide', 'give'), |
|
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | array( |
81 | 81 | 'type' => 'listbox', |
82 | 82 | 'name' => 'show_content', |
83 | 83 | 'minWidth' => 240, |
84 | - 'label' => __( 'Display Content:', 'give' ), |
|
85 | - 'tooltip' => __( 'Do you want to display the form content?', 'give' ), |
|
84 | + 'label' => __('Display Content:', 'give'), |
|
85 | + 'tooltip' => __('Do you want to display the form content?', 'give'), |
|
86 | 86 | 'options' => array( |
87 | - 'none' => __( 'No Content', 'give' ), |
|
88 | - 'above' => __( 'Display above the form fields', 'give' ), |
|
89 | - 'below' => __( 'Display below the form fields', 'give' ), |
|
87 | + 'none' => __('No Content', 'give'), |
|
88 | + 'above' => __('Display above the form fields', 'give'), |
|
89 | + 'below' => __('Display below the form fields', 'give'), |
|
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | array( |
93 | 93 | 'type' => 'listbox', |
94 | 94 | 'name' => 'display_style', |
95 | - 'label' => __( 'Payment Fields:', 'give' ), |
|
96 | - 'tooltip' => __( 'How would you like to display payment information?', 'give' ), |
|
95 | + 'label' => __('Payment Fields:', 'give'), |
|
96 | + 'tooltip' => __('How would you like to display payment information?', 'give'), |
|
97 | 97 | 'options' => array( |
98 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
99 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
100 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
98 | + 'onpage' => __('Show on Page', 'give'), |
|
99 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
100 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
101 | 101 | ), |
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'type' => 'listbox', |
105 | 105 | 'name' => 'float_labels', |
106 | - 'label' => __( 'Floating Labels:', 'give' ), |
|
107 | - 'tooltip' => __( 'Override the default floating labels setting for this form?', 'give' ), |
|
106 | + 'label' => __('Floating Labels:', 'give'), |
|
107 | + 'tooltip' => __('Override the default floating labels setting for this form?', 'give'), |
|
108 | 108 | 'options' => array( |
109 | - 'enabled' => __( 'Enabled', 'give' ), |
|
110 | - 'disabled' => __( 'Disabled', 'give' ), |
|
109 | + 'enabled' => __('Enabled', 'give'), |
|
110 | + 'disabled' => __('Disabled', 'give'), |
|
111 | 111 | ), |
112 | 112 | ), |
113 | 113 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | 34 | $create_form_link = sprintf( |
35 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
36 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
35 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
36 | + admin_url('post-new.php?post_type=give_forms') |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | return array( |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => __( '- Select a Form -', 'give' ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => __('- Select a Form -', 'give'), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_text', |
60 | - 'label' => __( 'Show Text:', 'give' ), |
|
61 | - 'tooltip' => __( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
60 | + 'label' => __('Show Text:', 'give'), |
|
61 | + 'tooltip' => __('This text displays the amount of income raised compared to the goal.', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_bar', |
70 | - 'label' => __( 'Show Progress Bar:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
70 | + 'label' => __('Show Progress Bar:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | ); |
@@ -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 | |
@@ -50,50 +50,50 @@ discard block |
||
50 | 50 | */ |
51 | 51 | |
52 | 52 | // https://gist.github.com/justinph/5197810 |
53 | - function validate_gravatar( $id_or_email ) { |
|
53 | + function validate_gravatar($id_or_email) { |
|
54 | 54 | //id or email code borrowed from wp-includes/pluggable.php |
55 | 55 | $email = ''; |
56 | - if ( is_numeric( $id_or_email ) ) { |
|
56 | + if (is_numeric($id_or_email)) { |
|
57 | 57 | $id = (int) $id_or_email; |
58 | - $user = get_userdata( $id ); |
|
59 | - if ( $user ) { |
|
58 | + $user = get_userdata($id); |
|
59 | + if ($user) { |
|
60 | 60 | $email = $user->user_email; |
61 | 61 | } |
62 | - } elseif ( is_object( $id_or_email ) ) { |
|
62 | + } elseif (is_object($id_or_email)) { |
|
63 | 63 | // No avatar for pingbacks or trackbacks |
64 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
65 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
64 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
65 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
69 | + if ( ! empty($id_or_email->user_id)) { |
|
70 | 70 | $id = (int) $id_or_email->user_id; |
71 | - $user = get_userdata( $id ); |
|
72 | - if ( $user ) { |
|
71 | + $user = get_userdata($id); |
|
72 | + if ($user) { |
|
73 | 73 | $email = $user->user_email; |
74 | 74 | } |
75 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
75 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
76 | 76 | $email = $id_or_email->comment_author_email; |
77 | 77 | } |
78 | 78 | } else { |
79 | 79 | $email = $id_or_email; |
80 | 80 | } |
81 | 81 | |
82 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
83 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
82 | + $hashkey = md5(strtolower(trim($email))); |
|
83 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
84 | 84 | |
85 | - $data = wp_cache_get( $hashkey ); |
|
86 | - if ( false === $data ) { |
|
87 | - $response = wp_remote_head( $uri ); |
|
88 | - if ( is_wp_error( $response ) ) { |
|
85 | + $data = wp_cache_get($hashkey); |
|
86 | + if (false === $data) { |
|
87 | + $response = wp_remote_head($uri); |
|
88 | + if (is_wp_error($response)) { |
|
89 | 89 | $data = 'not200'; |
90 | 90 | } else { |
91 | 91 | $data = $response['response']['code']; |
92 | 92 | } |
93 | - wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
93 | + wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5); |
|
94 | 94 | |
95 | 95 | } |
96 | - if ( $data == '200' ) { |
|
96 | + if ($data == '200') { |
|
97 | 97 | return true; |
98 | 98 | } else { |
99 | 99 | return false; |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param int $form_id |
110 | 110 | */ |
111 | - function get_log_ids( $form_id = '' ) { |
|
111 | + function get_log_ids($form_id = '') { |
|
112 | 112 | |
113 | 113 | // get Give_Logging class |
114 | 114 | global $give_logs; |
115 | 115 | |
116 | 116 | // get log for this form |
117 | - $logs = $give_logs->get_logs( $form_id ); |
|
117 | + $logs = $give_logs->get_logs($form_id); |
|
118 | 118 | |
119 | - if ( $logs ) { |
|
119 | + if ($logs) { |
|
120 | 120 | // make an array with all the donor IDs |
121 | - foreach ( $logs as $log ) { |
|
121 | + foreach ($logs as $log) { |
|
122 | 122 | $log_ids[] = $log->ID; |
123 | 123 | } |
124 | 124 | |
@@ -135,49 +135,49 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @since 1.0 |
137 | 137 | */ |
138 | - function get_payment_ids( $form_id = '' ) { |
|
138 | + function get_payment_ids($form_id = '') { |
|
139 | 139 | |
140 | 140 | global $give_options; |
141 | 141 | |
142 | - $log_ids = $this->get_log_ids( $form_id ); |
|
142 | + $log_ids = $this->get_log_ids($form_id); |
|
143 | 143 | |
144 | - if ( $log_ids ) { |
|
144 | + if ($log_ids) { |
|
145 | 145 | |
146 | 146 | $payment_ids = array(); |
147 | 147 | |
148 | - foreach ( $log_ids as $id ) { |
|
148 | + foreach ($log_ids as $id) { |
|
149 | 149 | // get the payment ID for each corresponding log ID |
150 | - $payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true ); |
|
150 | + $payment_ids[] = get_post_meta($id, '_give_log_payment_id', true); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | // remove donors who have purchased more than once so we can have unique avatars |
154 | 154 | $unique_emails = array(); |
155 | 155 | |
156 | - foreach ( $payment_ids as $key => $id ) { |
|
156 | + foreach ($payment_ids as $key => $id) { |
|
157 | 157 | |
158 | - $email = get_post_meta( $id, '_give_payment_user_email', true ); |
|
158 | + $email = get_post_meta($id, '_give_payment_user_email', true); |
|
159 | 159 | |
160 | - if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) { |
|
161 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
160 | + if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) { |
|
161 | + if ( ! $this->validate_gravatar($email)) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - $unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true ); |
|
166 | + $unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | 170 | // strip duplicate emails |
171 | - $unique_emails = array_unique( $unique_emails ); |
|
171 | + $unique_emails = array_unique($unique_emails); |
|
172 | 172 | |
173 | 173 | // convert the unique IDs back into simple array |
174 | - foreach ( $unique_emails as $id => $email ) { |
|
174 | + foreach ($unique_emails as $id => $email) { |
|
175 | 175 | $unique_ids[] = $id; |
176 | 176 | } |
177 | 177 | |
178 | 178 | // randomize the payment IDs if enabled |
179 | - if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) { |
|
180 | - shuffle( $unique_ids ); |
|
179 | + if (isset($give_options['give_donators_gravatars_random_gravatars'])) { |
|
180 | + shuffle($unique_ids); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // return our unique IDs |
@@ -193,22 +193,22 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @since 1.0 |
195 | 195 | */ |
196 | - function gravatars( $form_id = false, $title = '' ) { |
|
196 | + function gravatars($form_id = false, $title = '') { |
|
197 | 197 | |
198 | 198 | // unique $payment_ids |
199 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
199 | + $payment_ids = $this->get_payment_ids($form_id); |
|
200 | 200 | |
201 | 201 | global $give_options; |
202 | 202 | |
203 | 203 | // return if no ID |
204 | - if ( ! $form_id ) { |
|
204 | + if ( ! $form_id) { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
208 | 208 | // minimum amount of purchases before showing gravatars |
209 | 209 | // if the number of items in array is not greater or equal to the number specified, then exit |
210 | - if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) { |
|
211 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) { |
|
210 | + if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) { |
|
211 | + if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | } |
@@ -219,51 +219,51 @@ discard block |
||
219 | 219 | echo '<div id="give-purchase-gravatars">'; |
220 | 220 | |
221 | 221 | |
222 | - if ( isset ( $title ) ) { |
|
222 | + if (isset ($title)) { |
|
223 | 223 | |
224 | - if ( $title ) { |
|
225 | - echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
226 | - } elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) { |
|
227 | - echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donators_gravatars_heading'] ) . '</h2>' ); |
|
224 | + if ($title) { |
|
225 | + echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
226 | + } elseif (isset($give_options['give_donators_gravatars_heading'])) { |
|
227 | + echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donators_gravatars_heading']).'</h2>'); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | } |
231 | 231 | echo '<ul class="give-purchase-gravatars-list">'; |
232 | 232 | $i = 0; |
233 | 233 | |
234 | - if ( $payment_ids ) { |
|
235 | - foreach ( $payment_ids as $id ) { |
|
234 | + if ($payment_ids) { |
|
235 | + foreach ($payment_ids as $id) { |
|
236 | 236 | |
237 | 237 | // Give saves a blank option even when the control is turned off, hence the extra check |
238 | - if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) { |
|
238 | + if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) { |
|
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | |
242 | 242 | // get the payment meta |
243 | - $payment_meta = get_post_meta( $id, '_give_payment_meta', true ); |
|
243 | + $payment_meta = get_post_meta($id, '_give_payment_meta', true); |
|
244 | 244 | |
245 | 245 | // unserialize the payment meta |
246 | - $user_info = maybe_unserialize( $payment_meta['user_info'] ); |
|
246 | + $user_info = maybe_unserialize($payment_meta['user_info']); |
|
247 | 247 | |
248 | 248 | // get donor's first name |
249 | 249 | $name = $user_info['first_name']; |
250 | 250 | |
251 | 251 | // get donor's email |
252 | - $email = get_post_meta( $id, '_give_payment_user_email', true ); |
|
252 | + $email = get_post_meta($id, '_give_payment_user_email', true); |
|
253 | 253 | |
254 | 254 | // set gravatar size and provide filter |
255 | - $size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : ''; |
|
255 | + $size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : ''; |
|
256 | 256 | |
257 | 257 | // default image |
258 | - $default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false ); |
|
258 | + $default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false); |
|
259 | 259 | |
260 | 260 | // assemble output |
261 | 261 | $output .= '<li>'; |
262 | 262 | |
263 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
263 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
264 | 264 | $output .= '</li>'; |
265 | 265 | |
266 | - $i ++; |
|
266 | + $i++; |
|
267 | 267 | |
268 | 268 | } // end foreach |
269 | 269 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | echo '</ul>'; |
273 | 273 | echo '</div>'; |
274 | 274 | |
275 | - return apply_filters( 'give_donators_gravatars', ob_get_clean() ); |
|
275 | + return apply_filters('give_donators_gravatars', ob_get_clean()); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @since 1.0 |
282 | 282 | */ |
283 | 283 | function register_widget() { |
284 | - register_widget( 'Give_Donators_Gravatars_Widget' ); |
|
284 | + register_widget('Give_Donators_Gravatars_Widget'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | * @since 1.0 |
291 | 291 | * @todo set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars |
292 | 292 | */ |
293 | - function shortcode( $atts, $content = null ) { |
|
293 | + function shortcode($atts, $content = null) { |
|
294 | 294 | |
295 | - $atts = shortcode_atts( array( |
|
295 | + $atts = shortcode_atts(array( |
|
296 | 296 | 'id' => '', |
297 | 297 | 'title' => '' |
298 | - ), $atts, 'give_donators_gravatars' ); |
|
298 | + ), $atts, 'give_donators_gravatars'); |
|
299 | 299 | |
300 | 300 | // if no ID is passed on single give_forms pages, get the correct ID |
301 | - if ( is_singular( 'give_forms' ) ) { |
|
301 | + if (is_singular('give_forms')) { |
|
302 | 302 | $id = get_the_ID(); |
303 | 303 | } |
304 | 304 | |
305 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
305 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
306 | 306 | |
307 | 307 | return $content; |
308 | 308 | |
@@ -313,56 +313,56 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @since 1.0 |
315 | 315 | */ |
316 | - function settings( $settings ) { |
|
316 | + function settings($settings) { |
|
317 | 317 | |
318 | 318 | $give_gravatar_settings = array( |
319 | 319 | array( |
320 | - 'name' => __( 'Donator Gravatars', 'give' ), |
|
320 | + 'name' => __('Donator Gravatars', 'give'), |
|
321 | 321 | 'desc' => '<hr>', |
322 | 322 | 'id' => 'give_title', |
323 | 323 | 'type' => 'give_title' |
324 | 324 | ), |
325 | 325 | array( |
326 | - 'name' => __( 'Heading', 'give' ), |
|
327 | - 'desc' => __( 'The heading to display above the Gravatars', 'give' ), |
|
326 | + 'name' => __('Heading', 'give'), |
|
327 | + 'desc' => __('The heading to display above the Gravatars', 'give'), |
|
328 | 328 | 'type' => 'text', |
329 | 329 | 'id' => 'give_donators_gravatars_heading' |
330 | 330 | ), |
331 | 331 | array( |
332 | - 'name' => __( 'Gravatar Size', 'give' ), |
|
333 | - 'desc' => __( 'The size of each Gravatar in pixels (512px maximum)', 'give' ), |
|
332 | + 'name' => __('Gravatar Size', 'give'), |
|
333 | + 'desc' => __('The size of each Gravatar in pixels (512px maximum)', 'give'), |
|
334 | 334 | 'type' => 'text_small', |
335 | 335 | 'id' => 'give_donators_gravatars_gravatar_size', |
336 | 336 | 'default' => '64' |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Minimum Unique Purchases Required', 'give' ), |
|
340 | - 'desc' => sprintf( __( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ), |
|
339 | + 'name' => __('Minimum Unique Purchases Required', 'give'), |
|
340 | + 'desc' => sprintf(__('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())), |
|
341 | 341 | 'type' => 'text_small', |
342 | 342 | 'id' => 'give_donators_gravatars_min_purchases_required', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'Maximum Gravatars To Show', 'give' ), |
|
346 | - 'desc' => __( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
345 | + 'name' => __('Maximum Gravatars To Show', 'give'), |
|
346 | + 'desc' => __('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
347 | 347 | 'type' => 'text', |
348 | 348 | 'id' => 'give_donators_gravatars_maximum_number', |
349 | 349 | 'default' => '20', |
350 | 350 | ), |
351 | 351 | array( |
352 | - 'name' => __( 'Gravatar Visibility', 'give' ), |
|
353 | - 'desc' => __( 'Only show donators with a Gravatar account', 'give' ), |
|
352 | + 'name' => __('Gravatar Visibility', 'give'), |
|
353 | + 'desc' => __('Only show donators with a Gravatar account', 'give'), |
|
354 | 354 | 'id' => 'give_donators_gravatars_has_gravatar_account', |
355 | 355 | 'type' => 'checkbox', |
356 | 356 | ), |
357 | 357 | array( |
358 | - 'name' => __( 'Randomize Gravatars', 'give' ), |
|
359 | - 'desc' => __( 'Randomize the Gravatars', 'give' ), |
|
358 | + 'name' => __('Randomize Gravatars', 'give'), |
|
359 | + 'desc' => __('Randomize the Gravatars', 'give'), |
|
360 | 360 | 'id' => 'give_donators_gravatars_random_gravatars', |
361 | 361 | 'type' => 'checkbox', |
362 | 362 | ), |
363 | 363 | ); |
364 | 364 | |
365 | - return array_merge( $settings, $give_gravatar_settings ); |
|
365 | + return array_merge($settings, $give_gravatar_settings); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | } |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function __construct() { |
382 | 382 | |
383 | - $give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null; |
|
383 | + $give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null; |
|
384 | 384 | |
385 | 385 | // widget settings |
386 | 386 | $widget_ops = array( |
387 | 387 | 'classname' => 'give-donators-gravatars', |
388 | - 'description' => sprintf( __( 'Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give' ), $give_label_singular, $give_label_singular ) |
|
388 | + 'description' => sprintf(__('Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give'), $give_label_singular, $give_label_singular) |
|
389 | 389 | ); |
390 | 390 | |
391 | 391 | // widget control settings |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | // create the widget |
399 | 399 | parent::__construct( |
400 | 400 | 'give_donators_gravatars_widget', |
401 | - __( 'Give Donators Gravatars', 'give' ), |
|
401 | + __('Give Donators Gravatars', 'give'), |
|
402 | 402 | $widget_ops, |
403 | 403 | $control_ops |
404 | 404 | ); |
@@ -409,30 +409,30 @@ discard block |
||
409 | 409 | /* |
410 | 410 | * Outputs the content of the widget |
411 | 411 | */ |
412 | - function widget( $args, $instance ) { |
|
412 | + function widget($args, $instance) { |
|
413 | 413 | global $give_options; |
414 | 414 | |
415 | 415 | //@TODO: Don't extract it!!! |
416 | - extract( $args ); |
|
416 | + extract($args); |
|
417 | 417 | |
418 | - if ( ! is_singular( 'give_forms' ) ) { |
|
418 | + if ( ! is_singular('give_forms')) { |
|
419 | 419 | return; |
420 | 420 | } |
421 | 421 | |
422 | 422 | // Variables from widget settings |
423 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
423 | + $title = apply_filters('widget_title', $instance['title']); |
|
424 | 424 | |
425 | 425 | // Used by themes. Opens the widget |
426 | 426 | echo $before_widget; |
427 | 427 | |
428 | 428 | // Display the widget title |
429 | - if ( $title ) { |
|
430 | - echo $before_title . $title . $after_title; |
|
429 | + if ($title) { |
|
430 | + echo $before_title.$title.$after_title; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | $gravatars = new Give_Donators_Gravatars(); |
434 | 434 | |
435 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
435 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
436 | 436 | |
437 | 437 | // Used by themes. Closes the widget |
438 | 438 | echo $after_widget; |
@@ -442,11 +442,11 @@ discard block |
||
442 | 442 | /* |
443 | 443 | * Update function. Processes widget options to be saved |
444 | 444 | */ |
445 | - function update( $new_instance, $old_instance ) { |
|
445 | + function update($new_instance, $old_instance) { |
|
446 | 446 | |
447 | 447 | $instance = $old_instance; |
448 | 448 | |
449 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
449 | + $instance['title'] = strip_tags($new_instance['title']); |
|
450 | 450 | |
451 | 451 | return $instance; |
452 | 452 | |
@@ -455,19 +455,19 @@ discard block |
||
455 | 455 | /* |
456 | 456 | * Form function. Displays the actual form on the widget page |
457 | 457 | */ |
458 | - function form( $instance ) { |
|
458 | + function form($instance) { |
|
459 | 459 | |
460 | 460 | // Set up some default widget settings. |
461 | 461 | $defaults = array( |
462 | 462 | 'title' => '', |
463 | 463 | ); |
464 | 464 | |
465 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
465 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
466 | 466 | |
467 | 467 | <!-- Title --> |
468 | 468 | <p> |
469 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ) ?></label> |
|
470 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
469 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give') ?></label> |
|
470 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
471 | 471 | </p> |
472 | 472 | |
473 | 473 |