@@ -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,49 +23,49 @@ 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 | 29 | // Enable/Disable give_forms links if form is saving. |
30 | - if ( Give_Admin_Settings::is_saving_settings() ) { |
|
31 | - if ( isset( $_POST['forms_singular'] ) ) { |
|
32 | - $give_forms_singular = give_is_setting_enabled( give_clean( $_POST['forms_singular'] ) ); |
|
30 | + if (Give_Admin_Settings::is_saving_settings()) { |
|
31 | + if (isset($_POST['forms_singular'])) { |
|
32 | + $give_forms_singular = give_is_setting_enabled(give_clean($_POST['forms_singular'])); |
|
33 | 33 | flush_rewrite_rules(); |
34 | 34 | } |
35 | 35 | |
36 | - if ( isset( $_POST['forms_archives'] ) ) { |
|
37 | - $give_forms_archives = give_is_setting_enabled( give_clean( $_POST['forms_archives'] ) ); |
|
36 | + if (isset($_POST['forms_archives'])) { |
|
37 | + $give_forms_archives = give_is_setting_enabled(give_clean($_POST['forms_archives'])); |
|
38 | 38 | flush_rewrite_rules(); |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
42 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
43 | 43 | // Support for old 'GIVE_FORMS_SLUG' constant |
44 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
44 | + if (defined('GIVE_FORMS_SLUG')) { |
|
45 | 45 | $give_forms_slug = GIVE_FORMS_SLUG; |
46 | 46 | } |
47 | 47 | |
48 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
48 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
49 | 49 | 'slug' => $give_forms_slug, |
50 | 50 | 'with_front' => false, |
51 | 51 | ); |
52 | 52 | |
53 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
54 | - 'name' => __( 'Donation Forms', 'give' ), |
|
55 | - 'singular_name' => __( 'Form', 'give' ), |
|
56 | - 'add_new' => __( 'Add Form', 'give' ), |
|
57 | - 'add_new_item' => __( 'Add New Donation Form', 'give' ), |
|
58 | - 'edit_item' => __( 'Edit Donation Form', 'give' ), |
|
59 | - 'new_item' => __( 'New Form', 'give' ), |
|
60 | - 'all_items' => __( 'All Forms', 'give' ), |
|
61 | - 'view_item' => __( 'View Form', 'give' ), |
|
62 | - 'search_items' => __( 'Search Forms', 'give' ), |
|
63 | - 'not_found' => __( 'No forms found.', 'give' ), |
|
64 | - 'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ), |
|
53 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
54 | + 'name' => __('Donation Forms', 'give'), |
|
55 | + 'singular_name' => __('Form', 'give'), |
|
56 | + 'add_new' => __('Add Form', 'give'), |
|
57 | + 'add_new_item' => __('Add New Donation Form', 'give'), |
|
58 | + 'edit_item' => __('Edit Donation Form', 'give'), |
|
59 | + 'new_item' => __('New Form', 'give'), |
|
60 | + 'all_items' => __('All Forms', 'give'), |
|
61 | + 'view_item' => __('View Form', 'give'), |
|
62 | + 'search_items' => __('Search Forms', 'give'), |
|
63 | + 'not_found' => __('No forms found.', 'give'), |
|
64 | + 'not_found_in_trash' => __('No forms found in Trash.', 'give'), |
|
65 | 65 | 'parent_item_colon' => '', |
66 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
67 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ), |
|
68 | - ) ); |
|
66 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
67 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')), |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | // Default give_forms supports. |
71 | 71 | $give_form_supports = array( |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Has the user disabled the excerpt? |
80 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
81 | - unset( $give_form_supports[2] ); |
|
80 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
81 | + unset($give_form_supports[2]); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Has user disabled the featured image? |
85 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
86 | - unset( $give_form_supports[1] ); |
|
87 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
85 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
86 | + unset($give_form_supports[1]); |
|
87 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $give_forms_args = array( |
@@ -99,42 +99,42 @@ discard block |
||
99 | 99 | 'has_archive' => $give_forms_archives, |
100 | 100 | 'menu_icon' => 'dashicons-give', |
101 | 101 | 'hierarchical' => false, |
102 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
102 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
103 | 103 | ); |
104 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
104 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
105 | 105 | |
106 | 106 | /** Donation Post Type */ |
107 | 107 | $payment_labels = array( |
108 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
109 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
110 | - 'add_new' => __( 'Add New', 'give' ), |
|
111 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
112 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
113 | - 'new_item' => __( 'New Donation', 'give' ), |
|
114 | - 'all_items' => __( 'All Donations', 'give' ), |
|
115 | - 'view_item' => __( 'View Donation', 'give' ), |
|
116 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
117 | - 'not_found' => __( 'No donations found.', 'give' ), |
|
118 | - 'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ), |
|
108 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
109 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
110 | + 'add_new' => __('Add New', 'give'), |
|
111 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
112 | + 'edit_item' => __('Edit Donation', 'give'), |
|
113 | + 'new_item' => __('New Donation', 'give'), |
|
114 | + 'all_items' => __('All Donations', 'give'), |
|
115 | + 'view_item' => __('View Donation', 'give'), |
|
116 | + 'search_items' => __('Search Donations', 'give'), |
|
117 | + 'not_found' => __('No donations found.', 'give'), |
|
118 | + 'not_found_in_trash' => __('No donations found in Trash.', 'give'), |
|
119 | 119 | 'parent_item_colon' => '', |
120 | - 'menu_name' => __( 'Donations', 'give' ), |
|
120 | + 'menu_name' => __('Donations', 'give'), |
|
121 | 121 | ); |
122 | 122 | |
123 | 123 | $payment_args = array( |
124 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
124 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
125 | 125 | 'public' => false, |
126 | 126 | 'query_var' => false, |
127 | 127 | 'rewrite' => false, |
128 | 128 | 'map_meta_cap' => true, |
129 | 129 | 'capability_type' => 'give_payment', |
130 | - 'supports' => array( 'title' ), |
|
130 | + 'supports' => array('title'), |
|
131 | 131 | 'can_export' => true, |
132 | 132 | ); |
133 | - register_post_type( 'give_payment', $payment_args ); |
|
133 | + register_post_type('give_payment', $payment_args); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
137 | +add_action('init', 'give_setup_post_types', 1); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,30 +147,30 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function give_setup_taxonomies() { |
149 | 149 | |
150 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
150 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
151 | 151 | |
152 | 152 | /** Categories */ |
153 | 153 | $category_labels = array( |
154 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
155 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
156 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
157 | - 'all_items' => __( 'All Categories', 'give' ), |
|
158 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
159 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
160 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
161 | - 'update_item' => __( 'Update Category', 'give' ), |
|
162 | - 'add_new_item' => __( 'Add New Category', 'give' ), |
|
163 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
164 | - 'menu_name' => __( 'Categories', 'give' ), |
|
154 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
155 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
156 | + 'search_items' => __('Search Categories', 'give'), |
|
157 | + 'all_items' => __('All Categories', 'give'), |
|
158 | + 'parent_item' => __('Parent Category', 'give'), |
|
159 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
160 | + 'edit_item' => __('Edit Category', 'give'), |
|
161 | + 'update_item' => __('Update Category', 'give'), |
|
162 | + 'add_new_item' => __('Add New Category', 'give'), |
|
163 | + 'new_item_name' => __('New Category Name', 'give'), |
|
164 | + 'menu_name' => __('Categories', 'give'), |
|
165 | 165 | ); |
166 | 166 | |
167 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
167 | + $category_args = apply_filters('give_forms_category_args', array( |
|
168 | 168 | 'hierarchical' => true, |
169 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
169 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
170 | 170 | 'show_ui' => true, |
171 | 171 | 'query_var' => 'give_forms_category', |
172 | 172 | 'rewrite' => array( |
173 | - 'slug' => $slug . '/category', |
|
173 | + 'slug' => $slug.'/category', |
|
174 | 174 | 'with_front' => false, |
175 | 175 | 'hierarchical' => true, |
176 | 176 | ), |
@@ -185,26 +185,26 @@ discard block |
||
185 | 185 | |
186 | 186 | /** Tags */ |
187 | 187 | $tag_labels = array( |
188 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
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' => __( 'Choose from most used tags.', 'give' ), |
|
188 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
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' => __('Choose from most used tags.', 'give'), |
|
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_form_terms', |
210 | 210 | 'edit_terms' => 'edit_give_form_terms', |
@@ -215,36 +215,36 @@ discard block |
||
215 | 215 | ); |
216 | 216 | |
217 | 217 | // Does the user want category? |
218 | - $enable_category = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
218 | + $enable_category = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
219 | 219 | |
220 | 220 | // Does the user want tag? |
221 | - $enable_tag = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
221 | + $enable_tag = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
222 | 222 | |
223 | 223 | // Enable/Disable category and tag if form is saving. |
224 | - if ( Give_Admin_Settings::is_saving_settings() ) { |
|
225 | - if ( isset( $_POST['categories'] ) ) { |
|
226 | - $enable_category = give_is_setting_enabled( give_clean( $_POST['categories'] ) ); |
|
224 | + if (Give_Admin_Settings::is_saving_settings()) { |
|
225 | + if (isset($_POST['categories'])) { |
|
226 | + $enable_category = give_is_setting_enabled(give_clean($_POST['categories'])); |
|
227 | 227 | flush_rewrite_rules(); |
228 | 228 | } |
229 | 229 | |
230 | - if ( isset( $_POST['tags'] ) ) { |
|
231 | - $enable_tag = give_is_setting_enabled( give_clean( $_POST['tags'] ) ); |
|
230 | + if (isset($_POST['tags'])) { |
|
231 | + $enable_tag = give_is_setting_enabled(give_clean($_POST['tags'])); |
|
232 | 232 | flush_rewrite_rules(); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if ( $enable_category ) { |
|
237 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
238 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
236 | + if ($enable_category) { |
|
237 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
238 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $enable_tag ) { |
|
242 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
243 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
241 | + if ($enable_tag) { |
|
242 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
243 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
247 | +add_action('init', 'give_setup_taxonomies', 0); |
|
248 | 248 | |
249 | 249 | |
250 | 250 | /** |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function give_get_default_form_labels() { |
257 | 257 | $defaults = array( |
258 | - 'singular' => __( 'Form', 'give' ), |
|
259 | - 'plural' => __( 'Forms', 'give' ), |
|
258 | + 'singular' => __('Form', 'give'), |
|
259 | + 'plural' => __('Forms', 'give'), |
|
260 | 260 | ); |
261 | 261 | |
262 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
262 | + return apply_filters('give_default_form_name', $defaults); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return string $defaults['singular'] Singular label |
273 | 273 | */ |
274 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
274 | +function give_get_forms_label_singular($lowercase = false) { |
|
275 | 275 | $defaults = give_get_default_form_labels(); |
276 | 276 | |
277 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
277 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * @since 1.0 |
284 | 284 | * @return string $defaults['plural'] Plural label |
285 | 285 | */ |
286 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
286 | +function give_get_forms_label_plural($lowercase = false) { |
|
287 | 287 | $defaults = give_get_default_form_labels(); |
288 | 288 | |
289 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
289 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -298,24 +298,24 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return string $title New placeholder text |
300 | 300 | */ |
301 | -function give_change_default_title( $title ) { |
|
301 | +function give_change_default_title($title) { |
|
302 | 302 | // If a frontend plugin uses this filter (check extensions before changing this function) |
303 | - if ( ! is_admin() ) { |
|
304 | - $title = __( 'Enter form title here', 'give' ); |
|
303 | + if ( ! is_admin()) { |
|
304 | + $title = __('Enter form title here', 'give'); |
|
305 | 305 | |
306 | 306 | return $title; |
307 | 307 | } |
308 | 308 | |
309 | 309 | $screen = get_current_screen(); |
310 | 310 | |
311 | - if ( 'give_forms' == $screen->post_type ) { |
|
312 | - $title = __( 'Enter form title here', 'give' ); |
|
311 | + if ('give_forms' == $screen->post_type) { |
|
312 | + $title = __('Enter form title here', 'give'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | return $title; |
316 | 316 | } |
317 | 317 | |
318 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
318 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Registers Custom Post Statuses which are used by the Payments |
@@ -325,67 +325,67 @@ discard block |
||
325 | 325 | */ |
326 | 326 | function give_register_post_type_statuses() { |
327 | 327 | // Payment Statuses |
328 | - register_post_status( 'refunded', array( |
|
329 | - 'label' => __( 'Refunded', 'give' ), |
|
328 | + register_post_status('refunded', array( |
|
329 | + 'label' => __('Refunded', 'give'), |
|
330 | 330 | 'public' => true, |
331 | 331 | 'exclude_from_search' => false, |
332 | 332 | 'show_in_admin_all_list' => true, |
333 | 333 | 'show_in_admin_status_list' => true, |
334 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
335 | - ) ); |
|
336 | - register_post_status( 'failed', array( |
|
337 | - 'label' => __( 'Failed', 'give' ), |
|
334 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
335 | + )); |
|
336 | + register_post_status('failed', array( |
|
337 | + 'label' => __('Failed', 'give'), |
|
338 | 338 | 'public' => true, |
339 | 339 | 'exclude_from_search' => false, |
340 | 340 | 'show_in_admin_all_list' => true, |
341 | 341 | 'show_in_admin_status_list' => true, |
342 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
343 | - ) ); |
|
344 | - register_post_status( 'revoked', array( |
|
345 | - 'label' => __( 'Revoked', 'give' ), |
|
342 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
343 | + )); |
|
344 | + register_post_status('revoked', array( |
|
345 | + 'label' => __('Revoked', 'give'), |
|
346 | 346 | 'public' => true, |
347 | 347 | 'exclude_from_search' => false, |
348 | 348 | 'show_in_admin_all_list' => true, |
349 | 349 | 'show_in_admin_status_list' => true, |
350 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
351 | - ) ); |
|
352 | - register_post_status( 'cancelled', array( |
|
353 | - 'label' => __( 'Cancelled', 'give' ), |
|
350 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
351 | + )); |
|
352 | + register_post_status('cancelled', array( |
|
353 | + 'label' => __('Cancelled', 'give'), |
|
354 | 354 | 'public' => true, |
355 | 355 | 'exclude_from_search' => false, |
356 | 356 | 'show_in_admin_all_list' => true, |
357 | 357 | 'show_in_admin_status_list' => true, |
358 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
359 | - ) ); |
|
360 | - register_post_status( 'abandoned', array( |
|
361 | - 'label' => __( 'Abandoned', 'give' ), |
|
358 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
359 | + )); |
|
360 | + register_post_status('abandoned', array( |
|
361 | + 'label' => __('Abandoned', 'give'), |
|
362 | 362 | 'public' => true, |
363 | 363 | 'exclude_from_search' => false, |
364 | 364 | 'show_in_admin_all_list' => true, |
365 | 365 | 'show_in_admin_status_list' => true, |
366 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
367 | - ) ); |
|
368 | - register_post_status( 'processing', array( |
|
369 | - 'label' => _x( 'Processing', 'Processing payment status', 'give' ), |
|
366 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
367 | + )); |
|
368 | + register_post_status('processing', array( |
|
369 | + 'label' => _x('Processing', 'Processing payment status', 'give'), |
|
370 | 370 | 'public' => true, |
371 | 371 | 'exclude_from_search' => false, |
372 | 372 | 'show_in_admin_all_list' => true, |
373 | 373 | 'show_in_admin_status_list' => true, |
374 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' ) |
|
375 | - ) ); |
|
374 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give') |
|
375 | + )); |
|
376 | 376 | |
377 | - register_post_status( 'preapproval', array( |
|
378 | - 'label' => _x( 'Preapproval', 'Preapproval payment status', 'give' ), |
|
377 | + register_post_status('preapproval', array( |
|
378 | + 'label' => _x('Preapproval', 'Preapproval payment status', 'give'), |
|
379 | 379 | 'public' => true, |
380 | 380 | 'exclude_from_search' => false, |
381 | 381 | 'show_in_admin_all_list' => true, |
382 | 382 | 'show_in_admin_status_list' => true, |
383 | - 'label_count' => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ), |
|
384 | - ) ); |
|
383 | + 'label_count' => _n_noop('Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give'), |
|
384 | + )); |
|
385 | 385 | |
386 | 386 | } |
387 | 387 | |
388 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
388 | +add_action('init', 'give_register_post_type_statuses'); |
|
389 | 389 | |
390 | 390 | /** |
391 | 391 | * Updated Messages |
@@ -398,27 +398,27 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @return array $messages New post updated messages |
400 | 400 | */ |
401 | -function give_updated_messages( $messages ) { |
|
401 | +function give_updated_messages($messages) { |
|
402 | 402 | global $post, $post_ID; |
403 | 403 | |
404 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) { |
|
404 | + if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) { |
|
405 | 405 | |
406 | 406 | $messages['give_forms'] = array( |
407 | - 1 => __( 'Form updated.', 'give' ), |
|
408 | - 4 => __( 'Form updated.', 'give' ), |
|
409 | - 6 => __( 'Form published.', 'give' ), |
|
410 | - 7 => __( 'Form saved.', 'give' ), |
|
411 | - 8 => __( 'Form submitted.', 'give' ), |
|
407 | + 1 => __('Form updated.', 'give'), |
|
408 | + 4 => __('Form updated.', 'give'), |
|
409 | + 6 => __('Form published.', 'give'), |
|
410 | + 7 => __('Form saved.', 'give'), |
|
411 | + 8 => __('Form submitted.', 'give'), |
|
412 | 412 | ); |
413 | 413 | |
414 | 414 | } else { |
415 | 415 | |
416 | 416 | $messages['give_forms'] = array( |
417 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
418 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
419 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
420 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
421 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
417 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
418 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
419 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
420 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
421 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
422 | 422 | ); |
423 | 423 | |
424 | 424 | } |
@@ -426,24 +426,24 @@ discard block |
||
426 | 426 | return $messages; |
427 | 427 | } |
428 | 428 | |
429 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
429 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
430 | 430 | |
431 | 431 | /** |
432 | 432 | * Ensure post thumbnail support is turned on |
433 | 433 | */ |
434 | 434 | function give_add_thumbnail_support() { |
435 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
435 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
436 | 436 | return; |
437 | 437 | } |
438 | 438 | |
439 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
440 | - add_theme_support( 'post-thumbnails' ); |
|
439 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
440 | + add_theme_support('post-thumbnails'); |
|
441 | 441 | } |
442 | 442 | |
443 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
443 | + add_post_type_support('give_forms', 'thumbnail'); |
|
444 | 444 | } |
445 | 445 | |
446 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
446 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
447 | 447 | |
448 | 448 | /** |
449 | 449 | * Give Sidebars |
@@ -454,21 +454,21 @@ discard block |
||
454 | 454 | |
455 | 455 | // Single Give Forms (disabled if single turned off in settings) |
456 | 456 | if ( |
457 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
458 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
457 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
458 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
459 | 459 | ) { |
460 | 460 | |
461 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
462 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
461 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
462 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
463 | 463 | 'id' => 'give-forms-sidebar', |
464 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
464 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
465 | 465 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
466 | 466 | 'after_widget' => '</div>', |
467 | 467 | 'before_title' => '<h3 class="widgettitle widget-title">', |
468 | 468 | 'after_title' => '</h3>', |
469 | - ) ) ); |
|
469 | + ))); |
|
470 | 470 | |
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
474 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Add give command. |
15 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
15 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @subcommand logo |
78 | 78 | */ |
79 | - public function ascii( $args, $assoc_args ) { |
|
80 | - WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) ); |
|
79 | + public function ascii($args, $assoc_args) { |
|
80 | + WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -102,54 +102,54 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @subcommand details |
104 | 104 | */ |
105 | - public function details( $args, $assoc_args ) { |
|
105 | + public function details($args, $assoc_args) { |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Plugin Information |
109 | 109 | */ |
110 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
110 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * General Information. |
114 | 114 | */ |
115 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
115 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
116 | 116 | |
117 | - $success_page = give_get_option( 'success_page' ); |
|
118 | - $failure_page = give_get_option( 'failure_page' ); |
|
119 | - $history_page = give_get_option( 'history_page' ); |
|
117 | + $success_page = give_get_option('success_page'); |
|
118 | + $failure_page = give_get_option('failure_page'); |
|
119 | + $history_page = give_get_option('history_page'); |
|
120 | 120 | |
121 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
122 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
123 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
124 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
121 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
122 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
123 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
124 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Currency Information. |
128 | 128 | */ |
129 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
129 | + $default_gateway = give_get_option('default_gateway'); |
|
130 | 130 | |
131 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
131 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
132 | 132 | |
133 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
134 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
135 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
136 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
137 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
138 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
139 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
133 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
134 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
135 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
136 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
137 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
138 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
139 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
140 | 140 | |
141 | 141 | // Payment gateways Information. |
142 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
143 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
142 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
143 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
144 | 144 | |
145 | - if ( ! empty( $gateways ) ) { |
|
145 | + if ( ! empty($gateways)) { |
|
146 | 146 | self::$counter = 1; |
147 | - foreach ( $gateways as $gateway ) { |
|
148 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
149 | - self::$counter ++; |
|
147 | + foreach ($gateways as $gateway) { |
|
148 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
149 | + self::$counter++; |
|
150 | 150 | } |
151 | 151 | } else { |
152 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
152 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @subcommand forms |
183 | 183 | */ |
184 | - public function forms( $args, $assoc_args ) { |
|
184 | + public function forms($args, $assoc_args) { |
|
185 | 185 | global $wp_query; |
186 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
187 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
186 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
187 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
188 | 188 | $start = time(); |
189 | 189 | |
190 | 190 | // Cache previous number query var. |
191 | 191 | $is_set_number = $cache_per_page = false; |
192 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
192 | + if (isset($wp_query->query_vars['number'])) { |
|
193 | 193 | $cache_per_page = $wp_query->query_vars['number']; |
194 | 194 | $is_set_number = true; |
195 | 195 | } |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | $wp_query->query_vars['number'] = $number; |
199 | 199 | |
200 | 200 | // Get forms. |
201 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
201 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
202 | 202 | |
203 | 203 | // Reset number query var. |
204 | - if ( $is_set_number ) { |
|
204 | + if ($is_set_number) { |
|
205 | 205 | $wp_query->query_vars['number'] = $cache_per_page; |
206 | 206 | } |
207 | 207 | |
208 | 208 | // Bailout. |
209 | - if ( array_key_exists( 'error', $forms ) ) { |
|
209 | + if (array_key_exists('error', $forms)) { |
|
210 | 210 | |
211 | - WP_CLI::warning( $forms['error'] ); |
|
211 | + WP_CLI::warning($forms['error']); |
|
212 | 212 | |
213 | 213 | return; |
214 | - } elseif ( empty( $forms['forms'] ) ) { |
|
214 | + } elseif (empty($forms['forms'])) { |
|
215 | 215 | |
216 | - WP_CLI::error( __( 'No forms found.', 'give' ) ); |
|
216 | + WP_CLI::error(__('No forms found.', 'give')); |
|
217 | 217 | |
218 | 218 | return; |
219 | 219 | } |
@@ -221,25 +221,25 @@ discard block |
||
221 | 221 | // Param to check if form typeis already showed or not. |
222 | 222 | $is_show_form_type = false; |
223 | 223 | |
224 | - if ( 1 === count( $forms ) && $form_id ) { |
|
224 | + if (1 === count($forms) && $form_id) { |
|
225 | 225 | // Show single form. |
226 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
227 | - switch ( $key ) { |
|
226 | + foreach ($forms['forms'][0] as $key => $info) { |
|
227 | + switch ($key) { |
|
228 | 228 | case 'stats': |
229 | - $this->color_main_heading( ucfirst( $key ) ); |
|
229 | + $this->color_main_heading(ucfirst($key)); |
|
230 | 230 | |
231 | - foreach ( $info as $heading => $data ) { |
|
232 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
233 | - switch ( $heading ) { |
|
231 | + foreach ($info as $heading => $data) { |
|
232 | + $this->color_sub_heading(ucfirst($heading)); |
|
233 | + switch ($heading) { |
|
234 | 234 | default: |
235 | - foreach ( $data as $subheading => $subdata ) { |
|
235 | + foreach ($data as $subheading => $subdata) { |
|
236 | 236 | |
237 | - switch ( $subheading ) { |
|
237 | + switch ($subheading) { |
|
238 | 238 | case 'earnings': |
239 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
239 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
240 | 240 | break; |
241 | 241 | default: |
242 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
242 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | } |
@@ -249,26 +249,26 @@ discard block |
||
249 | 249 | case 'pricing': |
250 | 250 | case 'info': |
251 | 251 | default: |
252 | - $this->color_main_heading( ucfirst( $key ) ); |
|
252 | + $this->color_main_heading(ucfirst($key)); |
|
253 | 253 | |
254 | 254 | // Show form type. |
255 | - if ( ! $is_show_form_type ) { |
|
256 | - $form = new Give_Donate_Form( $form_id ); |
|
255 | + if ( ! $is_show_form_type) { |
|
256 | + $form = new Give_Donate_Form($form_id); |
|
257 | 257 | $is_show_form_type = true; |
258 | 258 | |
259 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
259 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
260 | 260 | } |
261 | 261 | |
262 | - foreach ( $info as $heading => $data ) { |
|
262 | + foreach ($info as $heading => $data) { |
|
263 | 263 | |
264 | - switch ( $heading ) { |
|
264 | + switch ($heading) { |
|
265 | 265 | case 'id': |
266 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
266 | + WP_CLI::log($this->color_message($heading, $data)); |
|
267 | 267 | break; |
268 | 268 | |
269 | 269 | default: |
270 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
271 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
270 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
271 | + WP_CLI::log($this->color_message($heading, $data)); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | }// End switch(). |
@@ -279,37 +279,37 @@ discard block |
||
279 | 279 | $is_table_first_row_set = false; |
280 | 280 | $table_column_count = 0; |
281 | 281 | |
282 | - WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
282 | + WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
283 | 283 | |
284 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
284 | + foreach ($forms['forms'] as $index => $form_data) { |
|
285 | 285 | |
286 | 286 | // Default table data. |
287 | 287 | $table_first_row = array(); |
288 | 288 | $table_row = array(); |
289 | 289 | |
290 | - foreach ( $form_data['info'] as $key => $form ) { |
|
290 | + foreach ($form_data['info'] as $key => $form) { |
|
291 | 291 | |
292 | 292 | // Do not show thumbnail, content and link in table. |
293 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
293 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | - if ( ! $is_table_first_row_set ) { |
|
297 | + if ( ! $is_table_first_row_set) { |
|
298 | 298 | $table_first_row[] = $key; |
299 | 299 | } |
300 | 300 | |
301 | 301 | $table_row[] = $form; |
302 | 302 | |
303 | - if ( 'status' === $key ) { |
|
303 | + if ('status' === $key) { |
|
304 | 304 | // First array item will be an form id in our case. |
305 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
305 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
306 | 306 | |
307 | 307 | $table_row[] = $form->get_type(); |
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | // Set table first row. |
312 | - if ( ! $is_table_first_row_set ) { |
|
312 | + if ( ! $is_table_first_row_set) { |
|
313 | 313 | |
314 | 314 | // Add extra column to table. |
315 | 315 | $table_first_row[] = 'type'; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $table_data[] = $table_row; |
323 | 323 | }// End foreach(). |
324 | 324 | |
325 | - $this->display_table( $table_data ); |
|
325 | + $this->display_table($table_data); |
|
326 | 326 | }// End if(). |
327 | 327 | } |
328 | 328 | |
@@ -375,59 +375,59 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @subcommand donors |
377 | 377 | */ |
378 | - public function donors( $args, $assoc_args ) { |
|
378 | + public function donors($args, $assoc_args) { |
|
379 | 379 | global $wp_query; |
380 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
381 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
382 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
383 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
384 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
385 | - $form_id = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0; |
|
386 | - $format = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table'; |
|
380 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
381 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
382 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
383 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
384 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
385 | + $form_id = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0; |
|
386 | + $format = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table'; |
|
387 | 387 | $start = time(); |
388 | 388 | |
389 | - if ( $create ) { |
|
390 | - if ( 80 < $create ) { |
|
391 | - WP_CLI::warning( 'Currently we can only generate maximum 80 donors.', 'give' ); |
|
389 | + if ($create) { |
|
390 | + if (80 < $create) { |
|
391 | + WP_CLI::warning('Currently we can only generate maximum 80 donors.', 'give'); |
|
392 | 392 | $create = 80; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $number = 1; |
396 | 396 | |
397 | - if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) { |
|
398 | - WP_CLI::warning( 'Wrong email address provided.', 'give' ); |
|
397 | + if (isset($assoc_args['email']) && ! is_email($email)) { |
|
398 | + WP_CLI::warning('Wrong email address provided.', 'give'); |
|
399 | 399 | |
400 | 400 | return; |
401 | 401 | } |
402 | 402 | |
403 | 403 | // Create one or more donors. |
404 | - if ( ! $email ) { |
|
404 | + if ( ! $email) { |
|
405 | 405 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
406 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
406 | + $number = is_numeric($create) ? absint($create) : 1; |
|
407 | 407 | } |
408 | 408 | |
409 | - for ( $i = 0; $i < $number; $i ++ ) { |
|
409 | + for ($i = 0; $i < $number; $i++) { |
|
410 | 410 | $name = $name ? $name : $this->get_random_name(); |
411 | - $email = $email ? $email : $this->get_random_email( $name ); |
|
411 | + $email = $email ? $email : $this->get_random_email($name); |
|
412 | 412 | |
413 | 413 | $args = array( |
414 | 414 | 'email' => $email, |
415 | 415 | 'name' => $name, |
416 | 416 | ); |
417 | 417 | |
418 | - $donor_id = Give()->donors->add( $args ); |
|
418 | + $donor_id = Give()->donors->add($args); |
|
419 | 419 | |
420 | - if ( $donor_id ) { |
|
421 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) ); |
|
420 | + if ($donor_id) { |
|
421 | + WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id))); |
|
422 | 422 | } else { |
423 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
423 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | // Reset email and name to false so it is generated on the next loop (if creating donors). |
427 | 427 | $email = $name = false; |
428 | 428 | } |
429 | 429 | |
430 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
430 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
431 | 431 | |
432 | 432 | } else { |
433 | 433 | // Counter. |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | // Cache previous number query var. |
443 | 443 | $is_set_number = $cache_per_page = false; |
444 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
444 | + if (isset($wp_query->query_vars['number'])) { |
|
445 | 445 | $cache_per_page = $wp_query->query_vars['number']; |
446 | 446 | $is_set_number = true; |
447 | 447 | } |
@@ -450,24 +450,24 @@ discard block |
||
450 | 450 | $wp_query->query_vars['number'] = $number; |
451 | 451 | |
452 | 452 | // Get donors. |
453 | - if ( $form_id ) { |
|
453 | + if ($form_id) { |
|
454 | 454 | // @TODO: Allow user to get a list of donors by donation status. |
455 | - $donors = $this->get_donors_by_form_id( $form_id ); |
|
455 | + $donors = $this->get_donors_by_form_id($form_id); |
|
456 | 456 | } else { |
457 | - $donors = $this->api->get_donors( $search ); |
|
457 | + $donors = $this->api->get_donors($search); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | // Reset number query var. |
461 | - if ( $is_set_number ) { |
|
461 | + if ($is_set_number) { |
|
462 | 462 | $wp_query->query_vars['number'] = $cache_per_page; |
463 | 463 | } |
464 | 464 | |
465 | - if ( isset( $donors['error'] ) ) { |
|
466 | - WP_CLI::error( $donors['error'] ); |
|
465 | + if (isset($donors['error'])) { |
|
466 | + WP_CLI::error($donors['error']); |
|
467 | 467 | } |
468 | 468 | |
469 | - if ( empty( $donors ) ) { |
|
470 | - WP_CLI::error( __( 'No donors found.', 'give' ) ); |
|
469 | + if (empty($donors)) { |
|
470 | + WP_CLI::error(__('No donors found.', 'give')); |
|
471 | 471 | |
472 | 472 | return; |
473 | 473 | } |
@@ -475,24 +475,24 @@ discard block |
||
475 | 475 | $table_data = array(); |
476 | 476 | $is_table_first_row_set = false; |
477 | 477 | |
478 | - foreach ( $donors['donors'] as $donor_data ) { |
|
478 | + foreach ($donors['donors'] as $donor_data) { |
|
479 | 479 | // Set default table row data. |
480 | - $table_first_row = array( __( 's_no', 'give' ) ); |
|
481 | - $table_row = array( self::$counter ); |
|
480 | + $table_first_row = array(__('s_no', 'give')); |
|
481 | + $table_row = array(self::$counter); |
|
482 | 482 | |
483 | - foreach ( $donor_data as $key => $donor ) { |
|
484 | - switch ( $key ) { |
|
483 | + foreach ($donor_data as $key => $donor) { |
|
484 | + switch ($key) { |
|
485 | 485 | case 'stats': |
486 | - foreach ( $donor as $heading => $data ) { |
|
486 | + foreach ($donor as $heading => $data) { |
|
487 | 487 | |
488 | 488 | // Get first row. |
489 | - if ( ! $is_table_first_row_set ) { |
|
489 | + if ( ! $is_table_first_row_set) { |
|
490 | 490 | $table_first_row[] = $heading; |
491 | 491 | } |
492 | 492 | |
493 | - switch ( $heading ) { |
|
493 | + switch ($heading) { |
|
494 | 494 | case 'total_spent': |
495 | - $table_row[] = give_currency_filter( $data ); |
|
495 | + $table_row[] = give_currency_filter($data); |
|
496 | 496 | break; |
497 | 497 | |
498 | 498 | default: |
@@ -503,10 +503,10 @@ discard block |
||
503 | 503 | |
504 | 504 | case 'info': |
505 | 505 | default: |
506 | - foreach ( $donor as $heading => $data ) { |
|
506 | + foreach ($donor as $heading => $data) { |
|
507 | 507 | |
508 | 508 | // Get first row. |
509 | - if ( ! $is_table_first_row_set ) { |
|
509 | + if ( ! $is_table_first_row_set) { |
|
510 | 510 | $table_first_row[] = $heading; |
511 | 511 | } |
512 | 512 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | // Add first row data to table data. |
519 | - if ( ! $is_table_first_row_set ) { |
|
519 | + if ( ! $is_table_first_row_set) { |
|
520 | 520 | $table_data[] = $table_first_row; |
521 | 521 | $is_table_first_row_set = true; |
522 | 522 | } |
@@ -525,44 +525,44 @@ discard block |
||
525 | 525 | $table_data[] = $table_row; |
526 | 526 | |
527 | 527 | // Increase counter. |
528 | - self::$counter ++; |
|
528 | + self::$counter++; |
|
529 | 529 | }// End foreach(). |
530 | 530 | |
531 | - switch ( $format ) { |
|
531 | + switch ($format) { |
|
532 | 532 | case 'json': |
533 | 533 | $table_column_name = $table_data[0]; |
534 | - unset( $table_data[0] ); |
|
534 | + unset($table_data[0]); |
|
535 | 535 | |
536 | 536 | $new_table_data = array(); |
537 | - foreach ( $table_data as $index => $data ) { |
|
538 | - foreach ( $data as $key => $value ) { |
|
539 | - $new_table_data[ $index ][ $table_column_name[ $key ] ] = $value; |
|
537 | + foreach ($table_data as $index => $data) { |
|
538 | + foreach ($data as $key => $value) { |
|
539 | + $new_table_data[$index][$table_column_name[$key]] = $value; |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
543 | - WP_CLI::log( json_encode( $new_table_data ) ); |
|
543 | + WP_CLI::log(json_encode($new_table_data)); |
|
544 | 544 | break; |
545 | 545 | |
546 | 546 | case 'csv': |
547 | - $file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv'; |
|
548 | - $fp = fopen( $file_path, 'w' ); |
|
547 | + $file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv'; |
|
548 | + $fp = fopen($file_path, 'w'); |
|
549 | 549 | |
550 | - if ( is_writable( $file_path ) ) { |
|
551 | - foreach ( $table_data as $fields ) { |
|
552 | - fputcsv( $fp, $fields ); |
|
550 | + if (is_writable($file_path)) { |
|
551 | + foreach ($table_data as $fields) { |
|
552 | + fputcsv($fp, $fields); |
|
553 | 553 | } |
554 | 554 | |
555 | - fclose( $fp ); |
|
555 | + fclose($fp); |
|
556 | 556 | |
557 | - WP_CLI::success( "Donors list csv created successfully: {$file_path}" ); |
|
557 | + WP_CLI::success("Donors list csv created successfully: {$file_path}"); |
|
558 | 558 | } else { |
559 | - WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" ); |
|
559 | + WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)"); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | break; |
563 | 563 | |
564 | 564 | default: |
565 | - $this->display_table( $table_data ); |
|
565 | + $this->display_table($table_data); |
|
566 | 566 | }// End switch(). |
567 | 567 | }// End if(). |
568 | 568 | } |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | * |
593 | 593 | * @subcommand donations |
594 | 594 | */ |
595 | - public function donations( $args, $assoc_args ) { |
|
595 | + public function donations($args, $assoc_args) { |
|
596 | 596 | global $wp_query; |
597 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
597 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
598 | 598 | |
599 | 599 | // Cache previous number query var. |
600 | 600 | $is_set_number = $cache_per_page = false; |
601 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
601 | + if (isset($wp_query->query_vars['number'])) { |
|
602 | 602 | $cache_per_page = $wp_query->query_vars['number']; |
603 | 603 | $is_set_number = true; |
604 | 604 | } |
@@ -610,46 +610,46 @@ discard block |
||
610 | 610 | $donations = $this->api->get_recent_donations(); |
611 | 611 | |
612 | 612 | // Reset number query var. |
613 | - if ( $is_set_number ) { |
|
613 | + if ($is_set_number) { |
|
614 | 614 | $wp_query->query_vars['number'] = $cache_per_page; |
615 | 615 | } |
616 | 616 | |
617 | - if ( empty( $donations ) ) { |
|
618 | - WP_CLI::error( __( 'No donations found.', 'give' ) ); |
|
617 | + if (empty($donations)) { |
|
618 | + WP_CLI::error(__('No donations found.', 'give')); |
|
619 | 619 | |
620 | 620 | return; |
621 | 621 | } |
622 | 622 | |
623 | 623 | self::$counter = 1; |
624 | 624 | |
625 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
626 | - $this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
627 | - self::$counter ++; |
|
625 | + foreach ($donations['donations'] as $key => $donation) { |
|
626 | + $this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
627 | + self::$counter++; |
|
628 | 628 | |
629 | - foreach ( $donation as $column => $data ) { |
|
629 | + foreach ($donation as $column => $data) { |
|
630 | 630 | |
631 | - if ( is_array( $data ) ) { |
|
632 | - $this->color_sub_heading( $column ); |
|
633 | - foreach ( $data as $subcolumn => $subdata ) { |
|
631 | + if (is_array($data)) { |
|
632 | + $this->color_sub_heading($column); |
|
633 | + foreach ($data as $subcolumn => $subdata) { |
|
634 | 634 | |
635 | 635 | // Decode html codes. |
636 | - switch ( $subcolumn ) { |
|
636 | + switch ($subcolumn) { |
|
637 | 637 | case 'name': |
638 | - $subdata = html_entity_decode( $subdata ); |
|
638 | + $subdata = html_entity_decode($subdata); |
|
639 | 639 | break; |
640 | 640 | } |
641 | 641 | |
642 | 642 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
643 | - if ( is_array( $subdata ) ) { |
|
643 | + if (is_array($subdata)) { |
|
644 | 644 | continue; |
645 | 645 | } |
646 | 646 | |
647 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
647 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
648 | 648 | } |
649 | 649 | continue; |
650 | 650 | } |
651 | 651 | |
652 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
652 | + WP_CLI::log($this->color_message($column, $data)); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | } |
@@ -689,27 +689,27 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @return void |
691 | 691 | */ |
692 | - public function report( $args, $assoc_args ) { |
|
692 | + public function report($args, $assoc_args) { |
|
693 | 693 | $stats = new Give_Payment_Stats(); |
694 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
695 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
696 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
697 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
694 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
695 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
696 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
697 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
698 | 698 | |
699 | - if ( ! empty( $date ) ) { |
|
699 | + if ( ! empty($date)) { |
|
700 | 700 | $start_date = $date; |
701 | 701 | $end_date = false; |
702 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
702 | + } elseif (empty($date) && empty($start_date)) { |
|
703 | 703 | $start_date = 'this_month'; |
704 | 704 | $end_date = false; |
705 | 705 | } |
706 | 706 | |
707 | 707 | // Get stats. |
708 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
709 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
708 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
709 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
710 | 710 | |
711 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
712 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
711 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
712 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -736,27 +736,27 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @subcommand cache |
738 | 738 | */ |
739 | - public function cache( $args, $assoc_args ) { |
|
740 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
739 | + public function cache($args, $assoc_args) { |
|
740 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
741 | 741 | |
742 | 742 | // Bailout. |
743 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
744 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
743 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
744 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
745 | 745 | |
746 | 746 | return; |
747 | 747 | } |
748 | 748 | |
749 | - switch ( $action ) { |
|
749 | + switch ($action) { |
|
750 | 750 | case 'delete': |
751 | 751 | // Reset counter. |
752 | 752 | self::$counter = 1; |
753 | 753 | |
754 | - if ( $this->delete_stats_transients() ) { |
|
754 | + if ($this->delete_stats_transients()) { |
|
755 | 755 | // Report .eading. |
756 | - WP_CLI::success( 'Give cache deleted.' ); |
|
756 | + WP_CLI::success('Give cache deleted.'); |
|
757 | 757 | } else { |
758 | 758 | // Report .eading. |
759 | - WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' ); |
|
759 | + WP_CLI::warning('We did not find any Give plugin cache to delete :)'); |
|
760 | 760 | } |
761 | 761 | break; |
762 | 762 | } |
@@ -785,27 +785,27 @@ discard block |
||
785 | 785 | ARRAY_A |
786 | 786 | ); |
787 | 787 | |
788 | - if ( ! empty( $stat_option_names ) ) { |
|
788 | + if ( ! empty($stat_option_names)) { |
|
789 | 789 | |
790 | - foreach ( $stat_option_names as $option_name ) { |
|
790 | + foreach ($stat_option_names as $option_name) { |
|
791 | 791 | $error = false; |
792 | 792 | $option_name = $option_name['option_name']; |
793 | 793 | |
794 | - switch ( true ) { |
|
795 | - case ( false !== strpos( $option_name, 'transient' ) ): |
|
796 | - $option_name = str_replace( '_transient_', '', $option_name ); |
|
797 | - $error = delete_transient( $option_name ); |
|
794 | + switch (true) { |
|
795 | + case (false !== strpos($option_name, 'transient')): |
|
796 | + $option_name = str_replace('_transient_', '', $option_name); |
|
797 | + $error = delete_transient($option_name); |
|
798 | 798 | break; |
799 | 799 | |
800 | 800 | default: |
801 | - $error = delete_option( $option_name ); |
|
801 | + $error = delete_option($option_name); |
|
802 | 802 | } |
803 | 803 | |
804 | - if ( $error ) { |
|
805 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
806 | - self::$counter ++; |
|
804 | + if ($error) { |
|
805 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
806 | + self::$counter++; |
|
807 | 807 | } else { |
808 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
808 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
809 | 809 | } |
810 | 810 | } |
811 | 811 | |
@@ -826,13 +826,13 @@ discard block |
||
826 | 826 | * |
827 | 827 | * @return string |
828 | 828 | */ |
829 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
829 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
830 | 830 | // Add colon. |
831 | - if ( $colon ) { |
|
832 | - $heading = $heading . ': '; |
|
831 | + if ($colon) { |
|
832 | + $heading = $heading.': '; |
|
833 | 833 | } |
834 | 834 | |
835 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
835 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @return void |
849 | 849 | */ |
850 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
851 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
850 | + private function color_main_heading($heading, $color = 'g') { |
|
851 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | /** |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @return void |
863 | 863 | */ |
864 | - private function color_sub_heading( $subheading ) { |
|
865 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
864 | + private function color_sub_heading($subheading) { |
|
865 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -876,17 +876,17 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @return void |
878 | 878 | */ |
879 | - private function display_table( $data ) { |
|
879 | + private function display_table($data) { |
|
880 | 880 | $table = new \cli\Table(); |
881 | 881 | |
882 | 882 | // Set table header. |
883 | - $table->setHeaders( $data[0] ); |
|
883 | + $table->setHeaders($data[0]); |
|
884 | 884 | |
885 | 885 | // Remove table header. |
886 | - unset( $data[0] ); |
|
886 | + unset($data[0]); |
|
887 | 887 | |
888 | 888 | // Set table data. |
889 | - $table->setRows( $data ); |
|
889 | + $table->setRows($data); |
|
890 | 890 | |
891 | 891 | // Display table. |
892 | 892 | $table->display(); |
@@ -903,14 +903,14 @@ discard block |
||
903 | 903 | * @return array |
904 | 904 | */ |
905 | 905 | |
906 | - private function get_donors_by_form_id( $form_id ) { |
|
906 | + private function get_donors_by_form_id($form_id) { |
|
907 | 907 | $donors = array(); |
908 | 908 | |
909 | 909 | $donations = new Give_Payments_Query( |
910 | 910 | array( |
911 | - 'give_forms' => array( $form_id ), |
|
912 | - 'number' => - 1, |
|
913 | - 'status' => array( 'publish' ), |
|
911 | + 'give_forms' => array($form_id), |
|
912 | + 'number' => -1, |
|
913 | + 'status' => array('publish'), |
|
914 | 914 | ) |
915 | 915 | ); |
916 | 916 | |
@@ -918,16 +918,16 @@ discard block |
||
918 | 918 | $skip_donors = array(); |
919 | 919 | |
920 | 920 | /* @var Give_Payment|object $donation Payment object. */ |
921 | - foreach ( $donations as $donation ) { |
|
921 | + foreach ($donations as $donation) { |
|
922 | 922 | |
923 | - if ( in_array( $donation->customer_id, $skip_donors, true ) ) { |
|
923 | + if (in_array($donation->customer_id, $skip_donors, true)) { |
|
924 | 924 | continue; |
925 | 925 | } |
926 | 926 | |
927 | - if ( ! empty( $donors ) ) { |
|
928 | - $donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) ); |
|
927 | + if ( ! empty($donors)) { |
|
928 | + $donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id))); |
|
929 | 929 | } else { |
930 | - $donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) ); |
|
930 | + $donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id)); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | $skip_donors[] = $donation->customer_id; |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | ); |
973 | 973 | |
974 | 974 | // Generate a random forename. |
975 | - $random_name = $names[ mt_rand( 0, sizeof( $names ) - 1 ) ]; |
|
975 | + $random_name = $names[mt_rand(0, sizeof($names) - 1)]; |
|
976 | 976 | |
977 | 977 | // Generate a random surname. |
978 | - $random_surname = $surnames[ mt_rand( 0, sizeof( $surnames ) - 1 ) ]; |
|
978 | + $random_surname = $surnames[mt_rand(0, sizeof($surnames) - 1)]; |
|
979 | 979 | |
980 | 980 | // Generate name. |
981 | 981 | $name = "{$random_name} {$random_surname}"; |
982 | 982 | |
983 | - if ( in_array( $name, $this->new_donor_names ) ) { |
|
983 | + if (in_array($name, $this->new_donor_names)) { |
|
984 | 984 | $name = $this->get_random_name(); |
985 | 985 | } |
986 | 986 | |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return string |
1001 | 1001 | */ |
1002 | - private function get_random_email( $name ) { |
|
1003 | - return implode( '.', explode( ' ', strtolower( $name ) ) ) . '@test.com'; |
|
1002 | + private function get_random_email($name) { |
|
1003 | + return implode('.', explode(' ', strtolower($name))).'@test.com'; |
|
1004 | 1004 | } |
1005 | 1005 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Earnings_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Earnings_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Earnings_Report. |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | 37 | $this->id = 'earnings'; |
38 | - $this->label = esc_html__( 'Income', 'give' ); |
|
38 | + $this->label = esc_html__('Income', 'give'); |
|
39 | 39 | |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
42 | + add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2); |
|
43 | 43 | |
44 | 44 | // Do not use main form for this tab. |
45 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
46 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
47 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
45 | + if (give_get_current_setting_tab() === $this->id) { |
|
46 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
47 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $settings |
65 | 65 | */ |
66 | 66 | $settings = apply_filters( |
67 | - 'give_get_settings_' . $this->id, |
|
67 | + 'give_get_settings_'.$this->id, |
|
68 | 68 | array( |
69 | 69 | array( |
70 | 70 | 'id' => 'give_tools_earnings', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'earnings', |
76 | - 'name' => esc_html__( 'Income', 'give' ), |
|
76 | + 'name' => esc_html__('Income', 'give'), |
|
77 | 77 | 'type' => 'report_earnings', |
78 | 78 | ), |
79 | 79 | array( |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param $field |
98 | 98 | * @param $option_value |
99 | 99 | */ |
100 | - public function render_report_earnings_field( $field, $option_value ) { |
|
101 | - do_action( 'give_reports_view_earnings' ); |
|
100 | + public function render_report_earnings_field($field, $option_value) { |
|
101 | + do_action('give_reports_view_earnings'); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Forms_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Forms_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Forms_Report. |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'forms'; |
37 | - $this->label = esc_html__( 'Forms', 'give' ); |
|
37 | + $this->label = esc_html__('Forms', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 ); |
|
41 | + add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2); |
|
42 | 42 | |
43 | 43 | // Do not use main form for this tab. |
44 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
45 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
46 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
44 | + if (give_get_current_setting_tab() === $this->id) { |
|
45 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
46 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array $settings |
64 | 64 | */ |
65 | 65 | $settings = apply_filters( |
66 | - 'give_get_settings_' . $this->id, |
|
66 | + 'give_get_settings_'.$this->id, |
|
67 | 67 | array( |
68 | 68 | array( |
69 | 69 | 'id' => 'give_reports_forms', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'id' => 'forms', |
75 | - 'name' => esc_html__( 'Forms', 'give' ), |
|
75 | + 'name' => esc_html__('Forms', 'give'), |
|
76 | 76 | 'type' => 'report_forms', |
77 | 77 | ), |
78 | 78 | array( |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @param $field |
97 | 97 | * @param $option_value |
98 | 98 | */ |
99 | - public function render_report_forms_field( $field, $option_value ) { |
|
100 | - do_action( 'give_reports_view_forms' ); |
|
99 | + public function render_report_forms_field($field, $option_value) { |
|
100 | + do_action('give_reports_view_forms'); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Gateways_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Gateways_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Gateways_Report. |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'gateways'; |
37 | - $this->label = esc_html__( 'Donation Methods', 'give' ); |
|
37 | + $this->label = esc_html__('Donation Methods', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 ); |
|
41 | + add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2); |
|
42 | 42 | |
43 | 43 | // Do not use main form for this tab. |
44 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
45 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
46 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
44 | + if (give_get_current_setting_tab() === $this->id) { |
|
45 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
46 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param array $settings |
76 | 76 | */ |
77 | 77 | $settings = apply_filters( |
78 | - 'give_get_settings_' . $this->id, |
|
78 | + 'give_get_settings_'.$this->id, |
|
79 | 79 | array( |
80 | 80 | array( |
81 | 81 | 'id' => 'give_reports_gateways', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ), |
85 | 85 | array( |
86 | 86 | 'id' => 'gateways', |
87 | - 'name' => esc_html__( 'Gateways', 'give' ), |
|
87 | + 'name' => esc_html__('Gateways', 'give'), |
|
88 | 88 | 'type' => 'report_gateways', |
89 | 89 | ), |
90 | 90 | array( |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * @param $field |
109 | 109 | * @param $option_value |
110 | 110 | */ |
111 | - public function render_report_gateways_field( $field, $option_value ) { |
|
112 | - do_action( 'give_reports_view_gateways' ); |
|
111 | + public function render_report_gateways_field($field, $option_value) { |
|
112 | + do_action('give_reports_view_gateways'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | global $status, $page; |
57 | 57 | |
58 | 58 | // Set parent defaults |
59 | - parent::__construct( array( |
|
60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
59 | + parent::__construct(array( |
|
60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
62 | 62 | 'ajax' => false // Does this table support ajax? |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
66 | 66 | $this->query(); |
67 | 67 | |
68 | 68 | } |
@@ -78,32 +78,32 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string Column Name |
80 | 80 | */ |
81 | - public function column_default( $item, $column_name ) { |
|
82 | - switch ( $column_name ) { |
|
81 | + public function column_default($item, $column_name) { |
|
82 | + switch ($column_name) { |
|
83 | 83 | case 'title': |
84 | - $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; |
|
84 | + $title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title']; |
|
85 | 85 | |
86 | 86 | return sprintf( |
87 | 87 | '<a href="%s">%s</a>', |
88 | - get_edit_post_link( $item['ID'] ), |
|
88 | + get_edit_post_link($item['ID']), |
|
89 | 89 | $title |
90 | 90 | ); |
91 | 91 | case 'sales': |
92 | 92 | return sprintf( |
93 | 93 | '<a href="%s">%s</a>', |
94 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), |
|
94 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])), |
|
95 | 95 | $item['sales'] |
96 | 96 | ); |
97 | 97 | case 'earnings' : |
98 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
98 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
99 | 99 | case 'average_sales' : |
100 | - return round( $item[ $column_name ] ); |
|
100 | + return round($item[$column_name]); |
|
101 | 101 | case 'average_earnings' : |
102 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
102 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
103 | 103 | case 'details' : |
104 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
104 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
105 | 105 | default: |
106 | - return $item[ $column_name ]; |
|
106 | + return $item[$column_name]; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_columns() { |
119 | 119 | $columns = array( |
120 | - 'title' => esc_html__( 'Form', 'give' ), |
|
121 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
122 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
123 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
124 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
125 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
120 | + 'title' => esc_html__('Form', 'give'), |
|
121 | + 'sales' => esc_html__('Donations', 'give'), |
|
122 | + 'earnings' => esc_html__('Income', 'give'), |
|
123 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
124 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
125 | + 'details' => esc_html__('Detailed Report', 'give') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $columns; |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_sortable_columns() { |
140 | 140 | return array( |
141 | - 'title' => array( 'title', true ), |
|
142 | - 'sales' => array( 'sales', false ), |
|
143 | - 'earnings' => array( 'earnings', false ), |
|
141 | + 'title' => array('title', true), |
|
142 | + 'sales' => array('sales', false), |
|
143 | + 'earnings' => array('earnings', false), |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return int Current page number |
154 | 154 | */ |
155 | 155 | public function get_paged() { |
156 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
156 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return int Category ID |
166 | 166 | */ |
167 | 167 | public function get_category() { |
168 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
168 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return void |
178 | 178 | */ |
179 | - public function bulk_actions( $which = '' ) { |
|
179 | + public function bulk_actions($which = '') { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param string $which |
190 | 190 | */ |
191 | - protected function display_tablenav( $which ) { |
|
191 | + protected function display_tablenav($which) { |
|
192 | 192 | |
193 | - if ( 'top' === $which ) { |
|
194 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
193 | + if ('top' === $which) { |
|
194 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
197 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
198 | 198 | |
199 | - <?php if ( 'top' === $which ) { ?> |
|
199 | + <?php if ('top' === $which) { ?> |
|
200 | 200 | <h2 class="alignleft reports-earnings-title screen-reader-text"> |
201 | - <?php _e( 'Donation Forms Report', 'give' ); ?> |
|
201 | + <?php _e('Donation Forms Report', 'give'); ?> |
|
202 | 202 | </h2> |
203 | 203 | <?php } ?> |
204 | 204 | |
205 | 205 | <div class="alignright tablenav-right"> |
206 | 206 | <div class="actions bulkactions"> |
207 | - <?php $this->bulk_actions( $which ); ?> |
|
207 | + <?php $this->bulk_actions($which); ?> |
|
208 | 208 | </div> |
209 | 209 | <?php |
210 | - $this->extra_tablenav( $which ); |
|
211 | - $this->pagination( $which ); |
|
210 | + $this->extra_tablenav($which); |
|
211 | + $this->pagination($which); |
|
212 | 212 | ?> |
213 | 213 | </div> |
214 | 214 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function category_filter() { |
230 | 230 | |
231 | - $categories = get_terms( 'form_category' ); |
|
232 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
233 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
231 | + $categories = get_terms('form_category'); |
|
232 | + if ($categories && ! is_wp_error($categories)) { |
|
233 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function query() { |
246 | 246 | |
247 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
248 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
247 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
248 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
249 | 249 | $category = $this->get_category(); |
250 | 250 | |
251 | 251 | $args = array( |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'suppress_filters' => true |
259 | 259 | ); |
260 | 260 | |
261 | - if ( ! empty( $category ) ) { |
|
261 | + if ( ! empty($category)) { |
|
262 | 262 | $args['tax_query'] = array( |
263 | 263 | array( |
264 | 264 | 'taxonomy' => 'form_category', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ); |
268 | 268 | } |
269 | 269 | |
270 | - switch ( $orderby ) : |
|
270 | + switch ($orderby) : |
|
271 | 271 | case 'title' : |
272 | 272 | $args['orderby'] = 'title'; |
273 | 273 | break; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | break; |
284 | 284 | endswitch; |
285 | 285 | |
286 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
286 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
287 | 287 | |
288 | - $this->donation_forms = new WP_Query( $args ); |
|
288 | + $this->donation_forms = new WP_Query($args); |
|
289 | 289 | |
290 | 290 | // Store total number of donation forms count. |
291 | 291 | $this->count = $this->donation_forms->found_posts; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | |
306 | 306 | $give_forms = $this->donation_forms->posts; |
307 | 307 | |
308 | - if ( $give_forms ) { |
|
309 | - foreach ( $give_forms as $form ) { |
|
308 | + if ($give_forms) { |
|
309 | + foreach ($give_forms as $form) { |
|
310 | 310 | $reports_data[] = array( |
311 | 311 | 'ID' => $form, |
312 | - 'title' => get_the_title( $form ), |
|
313 | - 'sales' => give_get_form_sales_stats( $form ), |
|
314 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
315 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
316 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
312 | + 'title' => get_the_title($form), |
|
313 | + 'sales' => give_get_form_sales_stats($form), |
|
314 | + 'earnings' => give_get_form_earnings_stats($form), |
|
315 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
316 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | } |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | $columns = $this->get_columns(); |
339 | 339 | $hidden = array(); // No hidden columns |
340 | 340 | $sortable = $this->get_sortable_columns(); |
341 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
341 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
342 | 342 | $this->items = $this->reports_data(); |
343 | 343 | $total_items = $this->count; |
344 | 344 | |
345 | - $this->set_pagination_args( array( |
|
345 | + $this->set_pagination_args(array( |
|
346 | 346 | 'total_items' => $total_items, |
347 | 347 | 'per_page' => $this->per_page, |
348 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
348 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
349 | 349 | ) |
350 | 350 | ); |
351 | 351 | } |
@@ -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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats(); ?> |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date(_x('F j, Y', 'dashboard widget', 'give')); ?></h3> |
|
50 | 50 | |
51 | 51 | <p class="give-dashboard-happy-day"><?php |
52 | 52 | printf( |
53 | 53 | /* translators: %s: day of the week */ |
54 | - __( 'Happy %s!', 'give' ), |
|
55 | - date( 'l', current_time( 'timestamp' ) ) |
|
54 | + __('Happy %s!', 'give'), |
|
55 | + date('l', current_time('timestamp')) |
|
56 | 56 | ); |
57 | 57 | ?></p> |
58 | 58 | |
59 | 59 | <p class="give-dashboard-today-earnings"><?php |
60 | - $earnings_today = $stats->get_earnings( 0, 'today', false ); |
|
61 | - echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) ); |
|
60 | + $earnings_today = $stats->get_earnings(0, 'today', false); |
|
61 | + echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false))); |
|
62 | 62 | ?></p> |
63 | 63 | |
64 | 64 | <p class="give-donations-today"><?php |
65 | - $donations_today = $stats->get_sales( 0, 'today', false ); |
|
65 | + $donations_today = $stats->get_sales(0, 'today', false); |
|
66 | 66 | printf( |
67 | 67 | /* translators: %s: daily donation count */ |
68 | - __( '%s donations today', 'give' ), |
|
69 | - give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) ) |
|
68 | + __('%s donations today', 'give'), |
|
69 | + give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false)) |
|
70 | 70 | ); |
71 | 71 | ?></p> |
72 | 72 | |
@@ -76,34 +76,34 @@ discard block |
||
76 | 76 | <table class="give-table-stats"> |
77 | 77 | <thead style="display: none;"> |
78 | 78 | <tr> |
79 | - <th><?php _e( 'This Week', 'give' ); ?></th> |
|
80 | - <th><?php _e( 'This Month', 'give' ); ?></th> |
|
81 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> |
|
79 | + <th><?php _e('This Week', 'give'); ?></th> |
|
80 | + <th><?php _e('This Month', 'give'); ?></th> |
|
81 | + <th><?php _e('Past 30 Days', 'give'); ?></th> |
|
82 | 82 | </tr> |
83 | 83 | </thead> |
84 | 84 | <tbody> |
85 | 85 | <tr id="give-table-stats-tr-1"> |
86 | 86 | <td> |
87 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p> |
|
87 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p> |
|
88 | 88 | |
89 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Week', 'give' ); ?></p> |
|
89 | + <p class="give-dashboard-stat-total-label"><?php _e('This Week', 'give'); ?></p> |
|
90 | 90 | </td> |
91 | 91 | <td> |
92 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p> |
|
92 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p> |
|
93 | 93 | |
94 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Month', 'give' ); ?></p> |
|
94 | + <p class="give-dashboard-stat-total-label"><?php _e('This Month', 'give'); ?></p> |
|
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr id="give-table-stats-tr-2"> |
98 | 98 | <td> |
99 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p> |
|
99 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p> |
|
100 | 100 | |
101 | - <p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p> |
|
101 | + <p class="give-dashboard-stat-total-label"><?php _e('Last Month', 'give'); ?></p> |
|
102 | 102 | </td> |
103 | 103 | <td> |
104 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( give_get_total_earnings(), array( 'sanitize' => false ) ) ) ?></p> |
|
104 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount(give_get_total_earnings(), array('sanitize' => false))) ?></p> |
|
105 | 105 | |
106 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Year', 'give' ); ?></p> |
|
106 | + <p class="give-dashboard-stat-total-label"><?php _e('This Year', 'give'); ?></p> |
|
107 | 107 | </td> |
108 | 108 | </tr> |
109 | 109 | </tbody> |
@@ -123,24 +123,24 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return array |
125 | 125 | */ |
126 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
126 | +function give_dashboard_at_a_glance_widget($items) { |
|
127 | 127 | |
128 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
128 | + $num_posts = wp_count_posts('give_forms'); |
|
129 | 129 | |
130 | - if ( $num_posts && $num_posts->publish ) { |
|
130 | + if ($num_posts && $num_posts->publish) { |
|
131 | 131 | |
132 | 132 | $text = sprintf( |
133 | 133 | /* translators: %s: number of posts published */ |
134 | - _n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ), |
|
134 | + _n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'), |
|
135 | 135 | $num_posts->publish |
136 | 136 | ); |
137 | 137 | |
138 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
138 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
139 | 139 | |
140 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
140 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
141 | 141 | $text = sprintf( |
142 | 142 | '<a class="give-forms-count" href="%1$s">%2$s</a>', |
143 | - admin_url( 'edit.php?post_type=give_forms' ), |
|
143 | + admin_url('edit.php?post_type=give_forms'), |
|
144 | 144 | $text |
145 | 145 | ); |
146 | 146 | } else { |
@@ -156,4 +156,4 @@ discard block |
||
156 | 156 | return $items; |
157 | 157 | } |
158 | 158 | |
159 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 ); |
|
159 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | |
45 | 45 | // Custom CMB2 Settings Fields |
46 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
47 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
48 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
49 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
46 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
47 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
48 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
49 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
50 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
51 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
52 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
53 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 1.0 |
61 | 61 | */ |
62 | 62 | public function init() { |
63 | - register_setting( $this->key, $this->key ); |
|
63 | + register_setting($this->key, $this->key); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function give_update_cmb_meta_box_url( $url ) { |
|
77 | + public function give_update_cmb_meta_box_url($url) { |
|
78 | 78 | // Path to Give's CMB |
79 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
79 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function give_get_settings_tabs() { |
90 | 90 | |
91 | - $settings = $this->give_settings( null ); |
|
91 | + $settings = $this->give_settings(null); |
|
92 | 92 | |
93 | 93 | $tabs = array(); |
94 | - $tabs['general'] = __( 'General', 'give' ); |
|
95 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
96 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
97 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
94 | + $tabs['general'] = __('General', 'give'); |
|
95 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
96 | + $tabs['display'] = __('Display Options', 'give'); |
|
97 | + $tabs['emails'] = __('Emails', 'give'); |
|
98 | 98 | |
99 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
100 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
99 | + if ( ! empty($settings['addons']['fields'])) { |
|
100 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
104 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
103 | + if ( ! empty($settings['licenses']['fields'])) { |
|
104 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
108 | - $tabs['api'] = __( 'API', 'give' ); |
|
109 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
107 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
108 | + $tabs['api'] = __('API', 'give'); |
|
109 | + $tabs['system_info'] = __('System Info', 'give'); |
|
110 | 110 | |
111 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
111 | + return apply_filters('give_settings_tabs', $tabs); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function admin_page_display() { |
121 | 121 | |
122 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
122 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
123 | 123 | |
124 | 124 | ?> |
125 | 125 | |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | <h2 class="nav-tab-wrapper"> |
131 | 131 | <?php |
132 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
132 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
133 | 133 | |
134 | - $tab_url = esc_url( add_query_arg( array( |
|
134 | + $tab_url = esc_url(add_query_arg(array( |
|
135 | 135 | 'settings-updated' => false, |
136 | 136 | 'tab' => $tab_id, |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
140 | 140 | |
141 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
141 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | ?> |
145 | 145 | </h2> |
146 | 146 | |
147 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
147 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
148 | 148 | |
149 | 149 | </div><!-- .wrap --> |
150 | 150 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
169 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
170 | 170 | |
171 | 171 | // only modify the give settings form |
172 | - if ( 'give_settings' == $object_id ) { |
|
172 | + if ('give_settings' == $object_id) { |
|
173 | 173 | |
174 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
174 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - public function give_settings( $active_tab ) { |
|
191 | + public function give_settings($active_tab) { |
|
192 | 192 | |
193 | 193 | $give_settings = array( |
194 | 194 | /** |
@@ -196,99 +196,99 @@ discard block |
||
196 | 196 | */ |
197 | 197 | 'general' => array( |
198 | 198 | 'id' => 'general_settings', |
199 | - 'give_title' => __( 'General Settings', 'give' ), |
|
200 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
201 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
199 | + 'give_title' => __('General Settings', 'give'), |
|
200 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
201 | + 'fields' => apply_filters('give_settings_general', array( |
|
202 | 202 | array( |
203 | - 'name' => __( 'General Settings', 'give' ), |
|
203 | + 'name' => __('General Settings', 'give'), |
|
204 | 204 | 'desc' => '', |
205 | 205 | 'type' => 'give_title', |
206 | 206 | 'id' => 'give_title_general_settings_1', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Success Page', 'give' ), |
|
209 | + 'name' => __('Success Page', 'give'), |
|
210 | 210 | /* translators: %s: [give_receipt] */ |
211 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
211 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
212 | 212 | 'id' => 'success_page', |
213 | 213 | 'type' => 'select', |
214 | - 'options' => give_cmb2_get_post_options( array( |
|
214 | + 'options' => give_cmb2_get_post_options(array( |
|
215 | 215 | 'post_type' => 'page', |
216 | 216 | 'numberposts' => 999, |
217 | - ) ), |
|
217 | + )), |
|
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
221 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
220 | + 'name' => __('Failed Donation Page', 'give'), |
|
221 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
222 | 222 | 'id' => 'failure_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | 226 | 'numberposts' => 999, |
227 | - ) ), |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Donation History Page', 'give' ), |
|
230 | + 'name' => __('Donation History Page', 'give'), |
|
231 | 231 | /* translators: %s: [donation_history] */ |
232 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
232 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
233 | 233 | 'id' => 'history_page', |
234 | 234 | 'type' => 'select', |
235 | - 'options' => give_cmb2_get_post_options( array( |
|
235 | + 'options' => give_cmb2_get_post_options(array( |
|
236 | 236 | 'post_type' => 'page', |
237 | 237 | 'numberposts' => 999, |
238 | - ) ), |
|
238 | + )), |
|
239 | 239 | ), |
240 | 240 | array( |
241 | - 'name' => __( 'Base Country', 'give' ), |
|
242 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
241 | + 'name' => __('Base Country', 'give'), |
|
242 | + 'desc' => __('The country your site operates from.', 'give'), |
|
243 | 243 | 'id' => 'base_country', |
244 | 244 | 'type' => 'select', |
245 | 245 | 'options' => give_get_country_list(), |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => __( 'Currency Settings', 'give' ), |
|
248 | + 'name' => __('Currency Settings', 'give'), |
|
249 | 249 | 'desc' => '', |
250 | 250 | 'type' => 'give_title', |
251 | 251 | 'id' => 'give_title_general_settings_2', |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => __( 'Currency', 'give' ), |
|
255 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
254 | + 'name' => __('Currency', 'give'), |
|
255 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
256 | 256 | 'id' => 'currency', |
257 | 257 | 'type' => 'select', |
258 | 258 | 'options' => give_get_currencies(), |
259 | 259 | 'default' => 'USD', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Currency Position', 'give' ), |
|
263 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
262 | + 'name' => __('Currency Position', 'give'), |
|
263 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
264 | 264 | 'id' => 'currency_position', |
265 | 265 | 'type' => 'select', |
266 | 266 | 'options' => array( |
267 | 267 | /* translators: %s: currency symbol */ |
268 | - 'before' => sprintf( __( 'Before - %s‎10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
268 | + 'before' => sprintf(__('Before - %s‎10', 'give'), give_currency_symbol(give_get_currency())), |
|
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'after' => sprintf( __( 'After - 10%s‏', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'after' => sprintf(__('After - 10%s‏', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | ), |
272 | 272 | 'default' => 'before', |
273 | 273 | ), |
274 | 274 | array( |
275 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
276 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
275 | + 'name' => __('Thousands Separator', 'give'), |
|
276 | + 'desc' => __('The symbol (usually , or .) to separate thousands.', 'give'), |
|
277 | 277 | 'id' => 'thousands_separator', |
278 | 278 | 'type' => 'text_small', |
279 | 279 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
280 | 280 | 'default' => ',', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
284 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
283 | + 'name' => __('Decimal Separator', 'give'), |
|
284 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
285 | 285 | 'id' => 'decimal_separator', |
286 | 286 | 'type' => 'text_small', |
287 | 287 | 'default' => '.', |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
291 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
290 | + 'name' => __('Number of Decimals', 'give'), |
|
291 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
292 | 292 | 'id' => 'number_decimals', |
293 | 293 | 'type' => 'text_small', |
294 | 294 | 'default' => 2, |
@@ -302,83 +302,83 @@ discard block |
||
302 | 302 | */ |
303 | 303 | 'gateways' => array( |
304 | 304 | 'id' => 'payment_gateways', |
305 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
306 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
307 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
305 | + 'give_title' => __('Payment Gateways', 'give'), |
|
306 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
307 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
308 | 308 | array( |
309 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
309 | + 'name' => __('Gateways Settings', 'give'), |
|
310 | 310 | 'desc' => '', |
311 | 311 | 'id' => 'give_title_gateway_settings_1', |
312 | 312 | 'type' => 'give_title', |
313 | 313 | ), |
314 | 314 | array( |
315 | - 'name' => __( 'Test Mode', 'give' ), |
|
316 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
315 | + 'name' => __('Test Mode', 'give'), |
|
316 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
317 | 317 | 'id' => 'test_mode', |
318 | 318 | 'type' => 'checkbox', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
322 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
321 | + 'name' => __('Enabled Gateways', 'give'), |
|
322 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
323 | 323 | 'id' => 'gateways', |
324 | 324 | 'type' => 'enabled_gateways', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Default Gateway', 'give' ), |
|
328 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
327 | + 'name' => __('Default Gateway', 'give'), |
|
328 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
329 | 329 | 'id' => 'default_gateway', |
330 | 330 | 'type' => 'default_gateway', |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
333 | + 'name' => __('PayPal Standard', 'give'), |
|
334 | 334 | 'desc' => '', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_2', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'PayPal Email', 'give' ), |
|
340 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
339 | + 'name' => __('PayPal Email', 'give'), |
|
340 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
341 | 341 | 'id' => 'paypal_email', |
342 | 342 | 'type' => 'text_email', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
346 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
345 | + 'name' => __('PayPal Page Style', 'give'), |
|
346 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
347 | 347 | 'id' => 'paypal_page_style', |
348 | 348 | 'type' => 'text', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
352 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
351 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
352 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
353 | 353 | 'id' => 'paypal_button_type', |
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'donation' => __( 'Donation', 'give' ), |
|
357 | - 'standard' => __( 'Standard Transaction', 'give' ), |
|
356 | + 'donation' => __('Donation', 'give'), |
|
357 | + 'standard' => __('Standard Transaction', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
363 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
362 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
363 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
364 | 364 | 'id' => 'disable_paypal_verification', |
365 | 365 | 'type' => 'checkbox', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Offline Donations', 'give' ), |
|
368 | + 'name' => __('Offline Donations', 'give'), |
|
369 | 369 | 'desc' => '', |
370 | 370 | 'type' => 'give_title', |
371 | 371 | 'id' => 'give_title_gateway_settings_3', |
372 | 372 | ), |
373 | 373 | array( |
374 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
375 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
374 | + 'name' => __('Collect Billing Details', 'give'), |
|
375 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
376 | 376 | 'id' => 'give_offline_donation_enable_billing_fields', |
377 | 377 | 'type' => 'checkbox', |
378 | 378 | ), |
379 | 379 | array( |
380 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
381 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
380 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
381 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
382 | 382 | 'id' => 'global_offline_donation_content', |
383 | 383 | 'default' => give_get_default_offline_donation_content(), |
384 | 384 | 'type' => 'wysiwyg', |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
391 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
390 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
391 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
392 | 392 | 'id' => 'offline_donation_subject', |
393 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
393 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
394 | 394 | 'type' => 'text', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
398 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
397 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
398 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
399 | 399 | 'id' => 'global_offline_donation_email', |
400 | 400 | 'default' => give_get_default_offline_donation_email_content(), |
401 | 401 | 'type' => 'wysiwyg', |
@@ -409,104 +409,104 @@ discard block |
||
409 | 409 | /** Display Settings */ |
410 | 410 | 'display' => array( |
411 | 411 | 'id' => 'display_settings', |
412 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
413 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
414 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
412 | + 'give_title' => __('Display Settings', 'give'), |
|
413 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
414 | + 'fields' => apply_filters('give_settings_display', array( |
|
415 | 415 | array( |
416 | - 'name' => __( 'Display Settings', 'give' ), |
|
416 | + 'name' => __('Display Settings', 'give'), |
|
417 | 417 | 'desc' => '', |
418 | 418 | 'id' => 'give_title_display_settings_1', |
419 | 419 | 'type' => 'give_title', |
420 | 420 | ), |
421 | 421 | array( |
422 | - 'name' => __( 'Disable CSS', 'give' ), |
|
423 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
422 | + 'name' => __('Disable CSS', 'give'), |
|
423 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
424 | 424 | 'id' => 'disable_css', |
425 | 425 | 'type' => 'checkbox', |
426 | 426 | ), |
427 | 427 | array( |
428 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
428 | + 'name' => __('Enable Floating Labels', 'give'), |
|
429 | 429 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
430 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
430 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
431 | 431 | 'a' => array( |
432 | 432 | 'href' => array(), |
433 | 433 | 'target' => array(), |
434 | 434 | ), |
435 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
435 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
436 | 436 | 'id' => 'floatlabels', |
437 | 437 | 'type' => 'checkbox', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
440 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
441 | 441 | /* translators: %s: about page URL */ |
442 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
442 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
443 | 443 | 'a' => array( |
444 | 444 | 'href' => array(), |
445 | 445 | 'target' => array(), |
446 | 446 | ), |
447 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox', |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => __( 'Post Types', 'give' ), |
|
452 | + 'name' => __('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title', |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => __('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox', |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => __('Disable Form Archives', 'give'), |
|
465 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox', |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
471 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
470 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
471 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox', |
474 | 474 | ), |
475 | 475 | array( |
476 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
477 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
476 | + 'name' => __('Featured Image Size', 'give'), |
|
477 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
478 | 478 | 'id' => 'featured_image_size', |
479 | 479 | 'type' => 'select', |
480 | 480 | 'default' => 'large', |
481 | 481 | 'options' => give_get_featured_image_sizes(), |
482 | 482 | ), |
483 | 483 | array( |
484 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
485 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
484 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
485 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
486 | 486 | 'id' => 'disable_form_featured_img', |
487 | 487 | 'type' => 'checkbox', |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
491 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
490 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
491 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_sidebar', |
493 | 493 | 'type' => 'checkbox', |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => __( 'Taxonomies', 'give' ), |
|
496 | + 'name' => __('Taxonomies', 'give'), |
|
497 | 497 | 'desc' => '', |
498 | 498 | 'id' => 'give_title_display_settings_3', |
499 | 499 | 'type' => 'give_title', |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
503 | - 'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
502 | + 'name' => __('Enable Form Categories', 'give'), |
|
503 | + 'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
504 | 504 | 'id' => 'categories', |
505 | 505 | 'type' => 'checkbox', |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
509 | - 'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
508 | + 'name' => __('Enable Form Tags', 'give'), |
|
509 | + 'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
510 | 510 | 'id' => 'tags', |
511 | 511 | 'type' => 'checkbox', |
512 | 512 | ), |
@@ -519,101 +519,101 @@ discard block |
||
519 | 519 | */ |
520 | 520 | 'emails' => array( |
521 | 521 | 'id' => 'email_settings', |
522 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
523 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
524 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
522 | + 'give_title' => __('Email Settings', 'give'), |
|
523 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
524 | + 'fields' => apply_filters('give_settings_emails', array( |
|
525 | 525 | array( |
526 | - 'name' => __( 'Email Settings', 'give' ), |
|
526 | + 'name' => __('Email Settings', 'give'), |
|
527 | 527 | 'desc' => '', |
528 | 528 | 'id' => 'give_title_email_settings_1', |
529 | 529 | 'type' => 'give_title', |
530 | 530 | ), |
531 | 531 | array( |
532 | 532 | 'id' => 'email_template', |
533 | - 'name' => __( 'Email Template', 'give' ), |
|
534 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
533 | + 'name' => __('Email Template', 'give'), |
|
534 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
535 | 535 | 'type' => 'select', |
536 | 536 | 'options' => give_get_email_templates(), |
537 | 537 | ), |
538 | 538 | array( |
539 | 539 | 'id' => 'email_logo', |
540 | - 'name' => __( 'Logo', 'give' ), |
|
541 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
540 | + 'name' => __('Logo', 'give'), |
|
541 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
542 | 542 | 'type' => 'file', |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'from_name', |
546 | - 'name' => __( 'From Name', 'give' ), |
|
547 | - 'desc' => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
548 | - 'default' => get_bloginfo( 'name' ), |
|
546 | + 'name' => __('From Name', 'give'), |
|
547 | + 'desc' => __('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
548 | + 'default' => get_bloginfo('name'), |
|
549 | 549 | 'type' => 'text', |
550 | 550 | ), |
551 | 551 | array( |
552 | 552 | 'id' => 'from_email', |
553 | - 'name' => __( 'From Email', 'give' ), |
|
554 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
555 | - 'default' => get_bloginfo( 'admin_email' ), |
|
553 | + 'name' => __('From Email', 'give'), |
|
554 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
555 | + 'default' => get_bloginfo('admin_email'), |
|
556 | 556 | 'type' => 'text', |
557 | 557 | ), |
558 | 558 | array( |
559 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
559 | + 'name' => __('Donation Receipt', 'give'), |
|
560 | 560 | 'desc' => '', |
561 | 561 | 'id' => 'give_title_email_settings_2', |
562 | 562 | 'type' => 'give_title', |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | 'id' => 'donation_subject', |
566 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
567 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
568 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
566 | + 'name' => __('Donation Email Subject', 'give'), |
|
567 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
568 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
569 | 569 | 'type' => 'text', |
570 | 570 | ), |
571 | 571 | array( |
572 | 572 | 'id' => 'donation_receipt', |
573 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
573 | + 'name' => __('Donation Receipt', 'give'), |
|
574 | 574 | 'desc' => sprintf( |
575 | 575 | /* translators: %s: emails tags list */ |
576 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
577 | - '<br/>' . give_get_emails_tags_list() |
|
576 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
577 | + '<br/>'.give_get_emails_tags_list() |
|
578 | 578 | ), |
579 | 579 | 'type' => 'wysiwyg', |
580 | 580 | 'default' => give_get_default_donation_receipt_email(), |
581 | 581 | ), |
582 | 582 | array( |
583 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
583 | + 'name' => __('New Donation Notification', 'give'), |
|
584 | 584 | 'desc' => '', |
585 | 585 | 'id' => 'give_title_email_settings_3', |
586 | 586 | 'type' => 'give_title', |
587 | 587 | ), |
588 | 588 | array( |
589 | 589 | 'id' => 'donation_notification_subject', |
590 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
591 | - 'desc' => __( 'Enter the subject line for the donation notification email.', 'give' ), |
|
590 | + 'name' => __('Donation Notification Subject', 'give'), |
|
591 | + 'desc' => __('Enter the subject line for the donation notification email.', 'give'), |
|
592 | 592 | 'type' => 'text', |
593 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
593 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'id' => 'donation_notification', |
597 | - 'name' => __( 'Donation Notification', 'give' ), |
|
597 | + 'name' => __('Donation Notification', 'give'), |
|
598 | 598 | 'desc' => sprintf( |
599 | 599 | /* translators: %s: emails tags list */ |
600 | - __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
601 | - '<br/>' . give_get_emails_tags_list() |
|
600 | + __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
601 | + '<br/>'.give_get_emails_tags_list() |
|
602 | 602 | ), |
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email(), |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
609 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
608 | + 'name' => __('Donation Notification Emails', 'give'), |
|
609 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ), |
|
611 | + 'default' => get_bloginfo('admin_email'), |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox', |
618 | 618 | ), |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ), |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => __('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ), |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => __('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => __( 'Access Control', 'give' ), |
|
645 | + 'name' => __('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title', |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
652 | + 'name' => __('Session Lifetime', 'give'), |
|
653 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => __( '24 Hours', 'give' ), |
|
657 | - '172800' => __( '48 Hours', 'give' ), |
|
658 | - '259200' => __( '72 Hours', 'give' ), |
|
659 | - '604800' => __( '1 Week', 'give' ), |
|
656 | + '86400' => __('24 Hours', 'give'), |
|
657 | + '172800' => __('48 Hours', 'give'), |
|
658 | + '259200' => __('72 Hours', 'give'), |
|
659 | + '604800' => __('1 Week', 'give'), |
|
660 | 660 | ), |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => __( 'Email Access', 'give' ), |
|
664 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => __('Email Access', 'give'), |
|
664 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text', |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text', |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => __( 'Data Control', 'give' ), |
|
684 | + 'name' => __('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title', |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
690 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox', |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => __( 'Filter Control', 'give' ), |
|
696 | + 'name' => __('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title', |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox', |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => __( 'Script Loading', 'give' ), |
|
710 | + 'name' => __('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title', |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox', |
720 | 720 | ), |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => __( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
727 | + 'give_title' => __('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => __( 'API', 'give' ), |
|
733 | + 'name' => __('API', 'give'), |
|
734 | 734 | 'type' => 'api', |
735 | 735 | ), |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => __( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => __('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system-info-textarea', |
747 | - 'name' => __( 'System Info', 'give' ), |
|
748 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => __('System Info', 'give'), |
|
748 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info', |
750 | 750 | ), |
751 | 751 | ) |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | ), |
754 | 754 | ); |
755 | 755 | |
756 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
756 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
757 | 757 | |
758 | 758 | // Return all settings array if no active tab |
759 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
759 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
760 | 760 | return $give_settings; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Add other tabs and settings fields as needed |
764 | - return $give_settings[ $active_tab ]; |
|
764 | + return $give_settings[$active_tab]; |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | */ |
771 | 771 | public function settings_notices() { |
772 | 772 | |
773 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
773 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
774 | 774 | return; |
775 | 775 | } |
776 | 776 | |
777 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
777 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | * @return mixed Field value or exception is thrown. |
790 | 790 | * @throws Exception Throws an exception if the field is invalid. |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | 798 | |
799 | - throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) ); |
|
799 | + throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return mixed Option value |
817 | 817 | */ |
818 | -function give_get_option( $key = '', $default = false ) { |
|
818 | +function give_get_option($key = '', $default = false) { |
|
819 | 819 | $give_options = give_get_settings(); |
820 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
821 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
820 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
821 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
822 | 822 | |
823 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
823 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -838,33 +838,33 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @return boolean True if updated, false if not. |
840 | 840 | */ |
841 | -function give_update_option( $key = '', $value = false ) { |
|
841 | +function give_update_option($key = '', $value = false) { |
|
842 | 842 | |
843 | 843 | // If no key, exit |
844 | - if ( empty( $key ) ) { |
|
844 | + if (empty($key)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
848 | - if ( empty( $value ) ) { |
|
849 | - $remove_option = give_delete_option( $key ); |
|
848 | + if (empty($value)) { |
|
849 | + $remove_option = give_delete_option($key); |
|
850 | 850 | |
851 | 851 | return $remove_option; |
852 | 852 | } |
853 | 853 | |
854 | 854 | // First let's grab the current settings |
855 | - $options = get_option( 'give_settings' ); |
|
855 | + $options = get_option('give_settings'); |
|
856 | 856 | |
857 | 857 | // Let's let devs alter that value coming in |
858 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
858 | + $value = apply_filters('give_update_option', $value, $key); |
|
859 | 859 | |
860 | 860 | // Next let's try to update the value |
861 | - $options[ $key ] = $value; |
|
862 | - $did_update = update_option( 'give_settings', $options ); |
|
861 | + $options[$key] = $value; |
|
862 | + $did_update = update_option('give_settings', $options); |
|
863 | 863 | |
864 | 864 | // If it updated, let's update the global variable |
865 | - if ( $did_update ) { |
|
865 | + if ($did_update) { |
|
866 | 866 | global $give_options; |
867 | - $give_options[ $key ] = $value; |
|
867 | + $give_options[$key] = $value; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $did_update; |
@@ -883,25 +883,25 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
898 | - unset( $options[ $key ] ); |
|
897 | + if (isset($options[$key])) { |
|
898 | + unset($options[$key]); |
|
899 | 899 | } |
900 | 900 | |
901 | - $did_update = update_option( 'give_settings', $options ); |
|
901 | + $did_update = update_option('give_settings', $options); |
|
902 | 902 | |
903 | 903 | // If it updated, let's update the global variable |
904 | - if ( $did_update ) { |
|
904 | + if ($did_update) { |
|
905 | 905 | global $give_options; |
906 | 906 | $give_options = $options; |
907 | 907 | } |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | */ |
921 | 921 | function give_get_settings() { |
922 | 922 | |
923 | - $settings = get_option( 'give_settings' ); |
|
923 | + $settings = get_option('give_settings'); |
|
924 | 924 | |
925 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
925 | + return (array) apply_filters('give_get_settings', $settings); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -940,25 +940,25 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return array |
942 | 942 | */ |
943 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
944 | - if ( is_int( $position ) ) { |
|
945 | - array_splice( $array, $position, 0, $insert ); |
|
943 | +function give_settings_array_insert($array, $position, $insert) { |
|
944 | + if (is_int($position)) { |
|
945 | + array_splice($array, $position, 0, $insert); |
|
946 | 946 | } else { |
947 | 947 | |
948 | - foreach ( $array as $index => $subarray ) { |
|
949 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
948 | + foreach ($array as $index => $subarray) { |
|
949 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
950 | 950 | $pos = $index; |
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | - if ( ! isset( $pos ) ) { |
|
954 | + if ( ! isset($pos)) { |
|
955 | 955 | return $array; |
956 | 956 | } |
957 | 957 | |
958 | 958 | $array = array_merge( |
959 | - array_slice( $array, 0, $pos ), |
|
959 | + array_slice($array, 0, $pos), |
|
960 | 960 | $insert, |
961 | - array_slice( $array, $pos ) |
|
961 | + array_slice($array, $pos) |
|
962 | 962 | ); |
963 | 963 | } |
964 | 964 | |
@@ -978,23 +978,23 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
981 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
982 | 982 | |
983 | 983 | $id = $field_arr['id']; |
984 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
984 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
985 | 985 | |
986 | 986 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
987 | 987 | |
988 | - foreach ( $gateways as $key => $option ) : |
|
988 | + foreach ($gateways as $key => $option) : |
|
989 | 989 | |
990 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
990 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
991 | 991 | $enabled = '1'; |
992 | 992 | } else { |
993 | 993 | $enabled = null; |
994 | 994 | } |
995 | 995 | |
996 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
997 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
996 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
997 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
998 | 998 | |
999 | 999 | endforeach; |
1000 | 1000 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
1016 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1016 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1017 | 1017 | $id = $field_arr['id']; |
1018 | 1018 | $gateways = give_get_enabled_payment_gateways(); |
1019 | - $saved_value = give_get_default_gateway( null ); |
|
1019 | + $saved_value = give_get_default_gateway(null); |
|
1020 | 1020 | |
1021 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1021 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1022 | 1022 | |
1023 | - foreach ( $gateways as $key => $option ) : |
|
1024 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1025 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1023 | + foreach ($gateways as $key => $option) : |
|
1024 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1025 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1026 | 1026 | endforeach; |
1027 | 1027 | |
1028 | 1028 | echo '</select>'; |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return void |
1042 | 1042 | */ |
1043 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1043 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1044 | 1044 | |
1045 | 1045 | $id = $field_type_object->field->args['id']; |
1046 | 1046 | $title = $field_type_object->field->args['name']; |
1047 | 1047 | $field_description = $field_type_object->field->args['desc']; |
1048 | 1048 | |
1049 | - echo '<hr>' . $field_description; |
|
1049 | + echo '<hr>'.$field_description; |
|
1050 | 1050 | |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return void |
1063 | 1063 | */ |
1064 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1064 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1065 | 1065 | |
1066 | 1066 | $id = $field_type_object->field->args['id']; |
1067 | 1067 | $title = $field_type_object->field->args['name']; |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1081 | 1081 | * @return array An array of options that matches the CMB2 options array |
1082 | 1082 | */ |
1083 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1083 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1084 | 1084 | |
1085 | - $post_options = array( '' => '' ); // Blank option |
|
1085 | + $post_options = array('' => ''); // Blank option |
|
1086 | 1086 | |
1087 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1087 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1088 | 1088 | return $post_options; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - $args = wp_parse_args( $query_args, array( |
|
1091 | + $args = wp_parse_args($query_args, array( |
|
1092 | 1092 | 'post_type' => 'page', |
1093 | 1093 | 'numberposts' => 10, |
1094 | - ) ); |
|
1094 | + )); |
|
1095 | 1095 | |
1096 | - $posts = get_posts( $args ); |
|
1096 | + $posts = get_posts($args); |
|
1097 | 1097 | |
1098 | - if ( $posts ) { |
|
1099 | - foreach ( $posts as $post ) { |
|
1098 | + if ($posts) { |
|
1099 | + foreach ($posts as $post) { |
|
1100 | 1100 | |
1101 | - $post_options[ $post->ID ] = $post->post_title; |
|
1101 | + $post_options[$post->ID] = $post->post_title; |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | } |
@@ -1123,33 +1123,33 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $sizes = array(); |
1125 | 1125 | $get_sizes = get_intermediate_image_sizes(); |
1126 | - $core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1126 | + $core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // This will help us to filter special characters from a string |
1130 | - $filter_slug_items = array( '_', '-' ); |
|
1130 | + $filter_slug_items = array('_', '-'); |
|
1131 | 1131 | |
1132 | - foreach ( $get_sizes as $_size ) { |
|
1132 | + foreach ($get_sizes as $_size) { |
|
1133 | 1133 | |
1134 | 1134 | // Converting image size slug to title case |
1135 | - $sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items ); |
|
1135 | + $sizes[$_size] = give_slug_to_title($_size, $filter_slug_items); |
|
1136 | 1136 | |
1137 | - if ( in_array( $_size, $core_image_sizes ) ) { |
|
1138 | - $sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1139 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1140 | - $sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}"; |
|
1137 | + if (in_array($_size, $core_image_sizes)) { |
|
1138 | + $sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1139 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1140 | + $sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}"; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Based on the above image height check, label the respective resolution as responsive |
1144 | - if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) { |
|
1145 | - $sizes[ $_size ] .= ' - responsive'; |
|
1144 | + if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) { |
|
1145 | + $sizes[$_size] .= ' - responsive'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $sizes[ $_size ] .= ')'; |
|
1148 | + $sizes[$_size] .= ')'; |
|
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1152 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return text $string |
1167 | 1167 | */ |
1168 | -function give_slug_to_title( $string, $filters = array() ) { |
|
1168 | +function give_slug_to_title($string, $filters = array()) { |
|
1169 | 1169 | |
1170 | - foreach ( $filters as $filter_item ) { |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1170 | + foreach ($filters as $filter_item) { |
|
1171 | + $string = str_replace($filter_item, ' ', $string); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Return updated string after converting it to title case |
1175 | - return ucwords( $string ); |
|
1175 | + return ucwords($string); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1188,18 +1188,18 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1191 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1192 | 1192 | /* @var CMB2_Types $field_type_object */ |
1193 | 1193 | |
1194 | 1194 | $id = $field_type_object->field->args['id']; |
1195 | 1195 | $field_description = $field_type_object->field->args['desc']; |
1196 | 1196 | $license = $field_type_object->field->args['options']['license']; |
1197 | 1197 | $license_key = $escaped_value; |
1198 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1199 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1198 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1199 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1200 | 1200 | $shortname = $field_type_object->field->args['options']['shortname']; |
1201 | 1201 | $field_classes = 'regular-text give-license-field'; |
1202 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1202 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1203 | 1203 | $custom_html = ''; |
1204 | 1204 | $messages = array(); |
1205 | 1205 | $class = ''; |
@@ -1211,83 +1211,83 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1213 | 1213 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1214 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1214 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1215 | 1215 | $is_license_key = false; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Check if current license is part of subscription or not. |
1219 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1219 | + $subscriptions = get_option('give_subscriptions'); |
|
1220 | 1220 | |
1221 | - if ( $is_license_key && $subscriptions ) { |
|
1222 | - foreach ( $subscriptions as $subscription ) { |
|
1223 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1221 | + if ($is_license_key && $subscriptions) { |
|
1222 | + foreach ($subscriptions as $subscription) { |
|
1223 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1224 | 1224 | $is_in_subscription = $subscription['id']; |
1225 | 1225 | break; |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $is_license_key ) { |
|
1230 | + if ($is_license_key) { |
|
1231 | 1231 | |
1232 | - if ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1232 | + if (empty($license->success) && property_exists($license, 'error')) { |
|
1233 | 1233 | |
1234 | 1234 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1235 | - switch ( $license->error ) { |
|
1235 | + switch ($license->error) { |
|
1236 | 1236 | case 'expired' : |
1237 | 1237 | $class = $license->error; |
1238 | 1238 | $messages[] = sprintf( |
1239 | - __( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1240 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1241 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1239 | + __('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1240 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1241 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1242 | 1242 | ); |
1243 | - $license_status = 'license-' . $class; |
|
1243 | + $license_status = 'license-'.$class; |
|
1244 | 1244 | break; |
1245 | 1245 | |
1246 | 1246 | case 'missing' : |
1247 | 1247 | $class = $license->error; |
1248 | 1248 | $messages[] = sprintf( |
1249 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1250 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1249 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1250 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1251 | 1251 | ); |
1252 | - $license_status = 'license-' . $class; |
|
1252 | + $license_status = 'license-'.$class; |
|
1253 | 1253 | break; |
1254 | 1254 | |
1255 | 1255 | case 'invalid' : |
1256 | 1256 | $class = $license->error; |
1257 | 1257 | $messages[] = sprintf( |
1258 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1258 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1259 | 1259 | $addon_name, |
1260 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1260 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1261 | 1261 | ); |
1262 | - $license_status = 'license-' . $class; |
|
1262 | + $license_status = 'license-'.$class; |
|
1263 | 1263 | break; |
1264 | 1264 | |
1265 | 1265 | case 'site_inactive' : |
1266 | 1266 | $class = $license->error; |
1267 | 1267 | $messages[] = sprintf( |
1268 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1268 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1269 | 1269 | $addon_name, |
1270 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1270 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1271 | 1271 | ); |
1272 | - $license_status = 'license-' . $class; |
|
1272 | + $license_status = 'license-'.$class; |
|
1273 | 1273 | break; |
1274 | 1274 | |
1275 | 1275 | case 'item_name_mismatch' : |
1276 | 1276 | $class = $license->error; |
1277 | - $messages[] = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name ); |
|
1278 | - $license_status = 'license-' . $class; |
|
1277 | + $messages[] = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name); |
|
1278 | + $license_status = 'license-'.$class; |
|
1279 | 1279 | break; |
1280 | 1280 | |
1281 | 1281 | case 'no_activations_left': |
1282 | 1282 | $class = $license->error; |
1283 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1284 | - $license_status = 'license-' . $class; |
|
1283 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1284 | + $license_status = 'license-'.$class; |
|
1285 | 1285 | break; |
1286 | 1286 | |
1287 | 1287 | default: |
1288 | 1288 | $class = $license->error; |
1289 | 1289 | $messages[] = sprintf( |
1290 | - __( 'Your license is not activated. Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give' ), |
|
1290 | + __('Your license is not activated. Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give'), |
|
1291 | 1291 | $license->error, |
1292 | 1292 | '<br/>', |
1293 | 1293 | "{$account_page_link}?utm_campaign=admin&utm_source=licenses&utm_medium={$license->error}" |
@@ -1296,74 +1296,74 @@ discard block |
||
1296 | 1296 | break; |
1297 | 1297 | } |
1298 | 1298 | |
1299 | - } elseif ( $is_in_subscription ) { |
|
1299 | + } elseif ($is_in_subscription) { |
|
1300 | 1300 | |
1301 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1302 | - $subscription_status = __( 'renew', 'give' ); |
|
1301 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1302 | + $subscription_status = __('renew', 'give'); |
|
1303 | 1303 | |
1304 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1305 | - $subscription_status = __( 'expire', 'give' ); |
|
1304 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1305 | + $subscription_status = __('expire', 'give'); |
|
1306 | 1306 | } |
1307 | 1307 | |
1308 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1309 | - $messages[] = sprintf( |
|
1310 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1311 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1312 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1313 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1308 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1309 | + $messages[] = sprintf( |
|
1310 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1311 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1312 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1313 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1314 | 1314 | ); |
1315 | 1315 | $license_status = 'license-expired'; |
1316 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1316 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1317 | 1317 | $messages[] = sprintf( |
1318 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ), |
|
1319 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1320 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1318 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'), |
|
1319 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1320 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1321 | 1321 | $subscription_status, |
1322 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1322 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1323 | 1323 | ); |
1324 | 1324 | $license_status = 'license-expires-soon'; |
1325 | 1325 | } else { |
1326 | 1326 | $messages[] = sprintf( |
1327 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ), |
|
1328 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1329 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1327 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'), |
|
1328 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1329 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1330 | 1330 | $subscription_status, |
1331 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1331 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1332 | 1332 | ); |
1333 | 1333 | $license_status = 'license-expiration-date'; |
1334 | 1334 | } |
1335 | 1335 | |
1336 | - } elseif ( empty( $license->success ) ) { |
|
1336 | + } elseif (empty($license->success)) { |
|
1337 | 1337 | $class = 'invalid'; |
1338 | 1338 | $messages[] = sprintf( |
1339 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1339 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1340 | 1340 | $addon_name, |
1341 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1341 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1342 | 1342 | ); |
1343 | - $license_status = 'license-' . $class; |
|
1343 | + $license_status = 'license-'.$class; |
|
1344 | 1344 | |
1345 | 1345 | } else { |
1346 | - switch ( $license->license ) { |
|
1346 | + switch ($license->license) { |
|
1347 | 1347 | case 'valid' : |
1348 | 1348 | default: |
1349 | 1349 | $class = 'valid'; |
1350 | - $now = current_time( 'timestamp' ); |
|
1351 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1350 | + $now = current_time('timestamp'); |
|
1351 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1352 | 1352 | |
1353 | - if ( 'lifetime' === $license->expires ) { |
|
1354 | - $messages[] = __( 'License key never expires.', 'give' ); |
|
1353 | + if ('lifetime' === $license->expires) { |
|
1354 | + $messages[] = __('License key never expires.', 'give'); |
|
1355 | 1355 | $license_status = 'license-lifetime-notice'; |
1356 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1356 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1357 | 1357 | $messages[] = sprintf( |
1358 | - __( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1359 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1360 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1358 | + __('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1359 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1360 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1361 | 1361 | ); |
1362 | 1362 | $license_status = 'license-expires-soon'; |
1363 | 1363 | } else { |
1364 | 1364 | $messages[] = sprintf( |
1365 | - __( 'Your license key expires on %s.', 'give' ), |
|
1366 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1365 | + __('Your license key expires on %s.', 'give'), |
|
1366 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1367 | 1367 | ); |
1368 | 1368 | $license_status = 'license-expiration-date'; |
1369 | 1369 | } |
@@ -1371,15 +1371,15 @@ discard block |
||
1371 | 1371 | } |
1372 | 1372 | } |
1373 | 1373 | } else { |
1374 | - $messages[] = sprintf( |
|
1375 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1374 | + $messages[] = sprintf( |
|
1375 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1376 | 1376 | $addon_name |
1377 | 1377 | ); |
1378 | 1378 | $license_status = 'inactive'; |
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | // Add class for input field if license is active. |
1382 | - if ( $is_valid_license ) { |
|
1382 | + if ($is_valid_license) { |
|
1383 | 1383 | $field_classes .= ' give-license-active'; |
1384 | 1384 | } |
1385 | 1385 | |
@@ -1387,33 +1387,33 @@ discard block |
||
1387 | 1387 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1388 | 1388 | |
1389 | 1389 | // If license is active so show deactivate button. |
1390 | - if ( $is_valid_license ) { |
|
1390 | + if ($is_valid_license) { |
|
1391 | 1391 | // Get input field html. |
1392 | 1392 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1393 | 1393 | |
1394 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1394 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1395 | 1395 | |
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | // Field description. |
1399 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1399 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1400 | 1400 | |
1401 | 1401 | // If no messages found then inform user that to get updated in future register yourself. |
1402 | - if ( empty( $messages ) ) { |
|
1403 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1402 | + if (empty($messages)) { |
|
1403 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give')); |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | - foreach ( $messages as $message ) { |
|
1407 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1408 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1406 | + foreach ($messages as $message) { |
|
1407 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1408 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1409 | 1409 | $custom_html .= '</div>'; |
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | // Field html. |
1413 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1413 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1414 | 1414 | |
1415 | 1415 | // Nonce. |
1416 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1416 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1417 | 1417 | |
1418 | 1418 | // Print field html. |
1419 | 1419 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | */ |
1429 | 1429 | function give_api_callback() { |
1430 | 1430 | |
1431 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1431 | + if ( ! current_user_can('manage_give_settings')) { |
|
1432 | 1432 | return; |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1437,9 +1437,9 @@ discard block |
||
1437 | 1437 | * |
1438 | 1438 | * @since 1.0 |
1439 | 1439 | */ |
1440 | - do_action( 'give_tools_api_keys_before' ); |
|
1440 | + do_action('give_tools_api_keys_before'); |
|
1441 | 1441 | |
1442 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1442 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1443 | 1443 | |
1444 | 1444 | $api_keys_table = new Give_API_Keys_Table(); |
1445 | 1445 | $api_keys_table->prepare_items(); |
@@ -1448,9 +1448,9 @@ discard block |
||
1448 | 1448 | <span class="cmb2-metabox-description api-description"> |
1449 | 1449 | <?php echo sprintf( |
1450 | 1450 | /* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */ |
1451 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1452 | - esc_url( 'http://docs.givewp.com/api' ), |
|
1453 | - esc_url( 'http://docs.givewp.com/addon-zapier' ) |
|
1451 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1452 | + esc_url('http://docs.givewp.com/api'), |
|
1453 | + esc_url('http://docs.givewp.com/addon-zapier') |
|
1454 | 1454 | ); ?> |
1455 | 1455 | </span> |
1456 | 1456 | <?php |
@@ -1460,10 +1460,10 @@ discard block |
||
1460 | 1460 | * |
1461 | 1461 | * @since 1.0 |
1462 | 1462 | */ |
1463 | - do_action( 'give_tools_api_keys_after' ); |
|
1463 | + do_action('give_tools_api_keys_after'); |
|
1464 | 1464 | } |
1465 | 1465 | |
1466 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1466 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1467 | 1467 | |
1468 | 1468 | /** |
1469 | 1469 | * Hook Callback |
@@ -1476,7 +1476,7 @@ discard block |
||
1476 | 1476 | * |
1477 | 1477 | * @return void |
1478 | 1478 | */ |
1479 | -function give_hook_callback( $args ) { |
|
1479 | +function give_hook_callback($args) { |
|
1480 | 1480 | |
1481 | 1481 | $id = $args['id']; |
1482 | 1482 | |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | * |
1486 | 1486 | * @since 1.0 |
1487 | 1487 | */ |
1488 | - do_action( "give_{$id}" ); |
|
1488 | + do_action("give_{$id}"); |
|
1489 | 1489 | |
1490 | 1490 | } |
1491 | 1491 | |
@@ -1500,19 +1500,19 @@ discard block |
||
1500 | 1500 | * |
1501 | 1501 | * @return bool |
1502 | 1502 | */ |
1503 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1504 | - if ( ! is_null( $compare_with ) ) { |
|
1503 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1504 | + if ( ! is_null($compare_with)) { |
|
1505 | 1505 | |
1506 | - if ( is_array( $compare_with ) ) { |
|
1506 | + if (is_array($compare_with)) { |
|
1507 | 1507 | // Output. |
1508 | - return in_array( $value, $compare_with ); |
|
1508 | + return in_array($value, $compare_with); |
|
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | // Output. |
1512 | - return ( $value === $compare_with ); |
|
1512 | + return ($value === $compare_with); |
|
1513 | 1513 | } |
1514 | 1514 | |
1515 | 1515 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1516 | 1516 | // Output. |
1517 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1517 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1518 | 1518 | } |
1519 | 1519 | \ No newline at end of file |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param $url |
74 | 74 | * |
75 | - * @return mixed |
|
75 | + * @return string |
|
76 | 76 | */ |
77 | 77 | public function give_update_cmb_meta_box_url( $url ) { |
78 | 78 | // Path to Give's CMB |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @since 1.0 |
975 | 975 | * |
976 | 976 | * @param array $field_arr |
977 | - * @param array $saved_values |
|
977 | + * @param string|boolean $saved_values |
|
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * @since 1.0 |
1010 | 1010 | * |
1011 | 1011 | * @param array $field_arr |
1012 | - * @param array $saved_value |
|
1012 | + * @param string|boolean $saved_value |
|
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @params $string text |
1164 | 1164 | * @params $filter array |
1165 | 1165 | * |
1166 | - * @return text $string |
|
1166 | + * @return string $string |
|
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ) { |
1169 | 1169 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Export' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Export')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Export. |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'export'; |
37 | - $this->label = __( 'Export', 'give' ); |
|
37 | + $this->label = __('Export', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 ); |
|
41 | + add_action('give_admin_field_tools_export', array($this, 'render_export_field'), 10, 2); |
|
42 | 42 | |
43 | 43 | // Do not use main donor for this tab. |
44 | - if( give_get_current_setting_tab() === $this->id ) { |
|
45 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
46 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
44 | + if (give_get_current_setting_tab() === $this->id) { |
|
45 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
46 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param array $settings |
62 | 62 | */ |
63 | 63 | $settings = apply_filters( |
64 | - 'give_get_settings_' . $this->id, |
|
64 | + 'give_get_settings_'.$this->id, |
|
65 | 65 | array( |
66 | 66 | array( |
67 | 67 | 'id' => 'give_tools_export', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ), |
71 | 71 | array( |
72 | 72 | 'id' => 'export', |
73 | - 'name' => __( 'Export', 'give' ), |
|
73 | + 'name' => __('Export', 'give'), |
|
74 | 74 | 'type' => 'tools_export', |
75 | 75 | ), |
76 | 76 | array( |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param $field |
95 | 95 | * @param $option_value |
96 | 96 | */ |
97 | - public function render_export_field( $field, $option_value ) { |
|
98 | - include_once( 'views/html-admin-page-exports.php' ); |
|
97 | + public function render_export_field($field, $option_value) { |
|
98 | + include_once('views/html-admin-page-exports.php'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |