Completed
Push — master ( 0af146...0e0d02 )
by Devin
13s
created
includes/post-types.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,36 +23,36 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	// Give Forms single post and archive options.
26
-	$give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) );
27
-	$give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) );
26
+	$give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular'));
27
+	$give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives'));
28 28
 
29
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
29
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
30 30
 	// Support for old 'GIVE_FORMS_SLUG' constant
31
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
31
+	if (defined('GIVE_FORMS_SLUG')) {
32 32
 		$give_forms_slug = GIVE_FORMS_SLUG;
33 33
 	}
34 34
 
35
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
35
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36 36
 		'slug'       => $give_forms_slug,
37 37
 		'with_front' => false,
38 38
 	);
39 39
 
40
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
41
-		'name'               => esc_html__( 'Donation Forms', 'give' ),
42
-		'singular_name'      => esc_html__( 'Form', 'give' ),
43
-		'add_new'            => esc_html__( 'Add Form', 'give' ),
44
-		'add_new_item'       => esc_html__( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => esc_html__( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => esc_html__( 'New Form', 'give' ),
47
-		'all_items'          => esc_html__( 'All Forms', 'give' ),
48
-		'view_item'          => esc_html__( 'View Form', 'give' ),
49
-		'search_items'       => esc_html__( 'Search Forms', 'give' ),
50
-		'not_found'          => esc_html__( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => esc_html__('Donation Forms', 'give'),
42
+		'singular_name'      => esc_html__('Form', 'give'),
43
+		'add_new'            => esc_html__('Add Form', 'give'),
44
+		'add_new_item'       => esc_html__('Add New Donation Form', 'give'),
45
+		'edit_item'          => esc_html__('Edit Donation Form', 'give'),
46
+		'new_item'           => esc_html__('New Form', 'give'),
47
+		'all_items'          => esc_html__('All Forms', 'give'),
48
+		'view_item'          => esc_html__('View Form', 'give'),
49
+		'search_items'       => esc_html__('Search Forms', 'give'),
50
+		'not_found'          => esc_html__('No forms found.', 'give'),
51
+		'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) ),
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give')),
55
+	));
56 56
 
57 57
 	// Default give_forms supports.
58 58
 	$give_form_supports = array(
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 
66 66
 	// Has the user disabled the excerpt?
67
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
68
-		unset( $give_form_supports[2] );
67
+	if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) {
68
+		unset($give_form_supports[2]);
69 69
 	}
70 70
 
71 71
 	// Has user disabled the featured image?
72
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
73
-		unset( $give_form_supports[1] );
74
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
72
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
73
+		unset($give_form_supports[1]);
74
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
75 75
 	}
76 76
 
77 77
 	$give_forms_args = array(
@@ -87,42 +87,42 @@  discard block
 block discarded – undo
87 87
 		'has_archive'        => $give_forms_archives,
88 88
 		'menu_icon'          => 'dashicons-give',
89 89
 		'hierarchical'       => false,
90
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
90
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
91 91
 	);
92
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
92
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
93 93
 
94 94
 	/** Donation Post Type */
95 95
 	$payment_labels = array(
96
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
97
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
98
-		'add_new'            => esc_html__( 'Add New', 'give' ),
99
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
100
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
101
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
102
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
103
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
104
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
105
-		'not_found'          => esc_html__( 'No donations found.', 'give' ),
106
-		'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ),
96
+		'name'               => _x('Donations', 'post type general name', 'give'),
97
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
98
+		'add_new'            => esc_html__('Add New', 'give'),
99
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
100
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
101
+		'new_item'           => esc_html__('New Donation', 'give'),
102
+		'all_items'          => esc_html__('All Donations', 'give'),
103
+		'view_item'          => esc_html__('View Donation', 'give'),
104
+		'search_items'       => esc_html__('Search Donations', 'give'),
105
+		'not_found'          => esc_html__('No donations found.', 'give'),
106
+		'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'),
107 107
 		'parent_item_colon'  => '',
108
-		'menu_name'          => esc_html__( 'Donations', 'give' ),
108
+		'menu_name'          => esc_html__('Donations', 'give'),
109 109
 	);
110 110
 
111 111
 	$payment_args = array(
112
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
112
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
113 113
 		'public'          => false,
114 114
 		'query_var'       => false,
115 115
 		'rewrite'         => false,
116 116
 		'map_meta_cap'    => true,
117 117
 		'capability_type' => 'give_payment',
118
-		'supports'        => array( 'title' ),
118
+		'supports'        => array('title'),
119 119
 		'can_export'      => true,
120 120
 	);
121
-	register_post_type( 'give_payment', $payment_args );
121
+	register_post_type('give_payment', $payment_args);
122 122
 
123 123
 }
124 124
 
125
-add_action( 'init', 'give_setup_post_types', 1 );
125
+add_action('init', 'give_setup_post_types', 1);
126 126
 
127 127
 
128 128
 /**
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_setup_taxonomies() {
137 137
 
138
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
138
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
139 139
 
140 140
 	/** Categories */
141 141
 	$category_labels = array(
142
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
143
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
144
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
145
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
146
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
147
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
148
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
149
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
150
-		'add_new_item'      => esc_html__( 'Add New Category', 'give' ),
151
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
152
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
142
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
143
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
144
+		'search_items'      => esc_html__('Search Categories', 'give'),
145
+		'all_items'         => esc_html__('All Categories', 'give'),
146
+		'parent_item'       => esc_html__('Parent Category', 'give'),
147
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
148
+		'edit_item'         => esc_html__('Edit Category', 'give'),
149
+		'update_item'       => esc_html__('Update Category', 'give'),
150
+		'add_new_item'      => esc_html__('Add New Category', 'give'),
151
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
152
+		'menu_name'         => esc_html__('Categories', 'give'),
153 153
 	);
154 154
 
155
-	$category_args = apply_filters( 'give_forms_category_args', array(
155
+	$category_args = apply_filters('give_forms_category_args', array(
156 156
 			'hierarchical' => true,
157
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
157
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
158 158
 			'show_ui'      => true,
159 159
 			'query_var'    => 'give_forms_category',
160 160
 			'rewrite'      => array(
161
-				'slug'         => $slug . '/category',
161
+				'slug'         => $slug.'/category',
162 162
 				'with_front'   => false,
163 163
 				'hierarchical' => true,
164 164
 			),
@@ -172,33 +172,33 @@  discard block
 block discarded – undo
172 172
 	);
173 173
 
174 174
 	// Does the user want categories?
175
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
176
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
177
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
175
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
176
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
177
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
178 178
 	}
179 179
 
180 180
 	/** Tags */
181 181
 	$tag_labels = array(
182
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
183
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
184
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
185
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
186
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
187
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
188
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
189
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
190
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
191
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
192
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
193
-		'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ),
182
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
183
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
184
+		'search_items'          => esc_html__('Search Tags', 'give'),
185
+		'all_items'             => esc_html__('All Tags', 'give'),
186
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
187
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
188
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
189
+		'update_item'           => esc_html__('Update Tag', 'give'),
190
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
191
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
192
+		'menu_name'             => esc_html__('Tags', 'give'),
193
+		'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'),
194 194
 	);
195 195
 
196
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
196
+	$tag_args = apply_filters('give_forms_tag_args', array(
197 197
 			'hierarchical' => false,
198
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
198
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
199 199
 			'show_ui'      => true,
200 200
 			'query_var'    => 'give_forms_tag',
201
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
201
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
202 202
 			'capabilities' => array(
203 203
 				'manage_terms' => 'manage_give_form_terms',
204 204
 				'edit_terms'   => 'edit_give_form_terms',
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 		)
209 209
 	);
210 210
 
211
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
212
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
213
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
211
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
212
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
213
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
214 214
 	}
215 215
 
216 216
 }
217 217
 
218
-add_action( 'init', 'give_setup_taxonomies', 0 );
218
+add_action('init', 'give_setup_taxonomies', 0);
219 219
 
220 220
 
221 221
 /**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function give_get_default_form_labels() {
228 228
 	$defaults = array(
229
-		'singular' => esc_html__( 'Form', 'give' ),
230
-		'plural'   => esc_html__( 'Forms', 'give' ),
229
+		'singular' => esc_html__('Form', 'give'),
230
+		'plural'   => esc_html__('Forms', 'give'),
231 231
 	);
232 232
 
233
-	return apply_filters( 'give_default_form_name', $defaults );
233
+	return apply_filters('give_default_form_name', $defaults);
234 234
 }
235 235
 
236 236
 /**
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return string $defaults['singular'] Singular label
244 244
  */
245
-function give_get_forms_label_singular( $lowercase = false ) {
245
+function give_get_forms_label_singular($lowercase = false) {
246 246
 	$defaults = give_get_default_form_labels();
247 247
 
248
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
248
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
249 249
 }
250 250
 
251 251
 /**
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
  * @since 1.0
255 255
  * @return string $defaults['plural'] Plural label
256 256
  */
257
-function give_get_forms_label_plural( $lowercase = false ) {
257
+function give_get_forms_label_plural($lowercase = false) {
258 258
 	$defaults = give_get_default_form_labels();
259 259
 
260
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
260
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
261 261
 }
262 262
 
263 263
 /**
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return string $title New placeholder text
271 271
  */
272
-function give_change_default_title( $title ) {
272
+function give_change_default_title($title) {
273 273
 	// If a frontend plugin uses this filter (check extensions before changing this function)
274
-	if ( ! is_admin() ) {
275
-		$title = esc_html__( 'Enter form title here', 'give' );
274
+	if ( ! is_admin()) {
275
+		$title = esc_html__('Enter form title here', 'give');
276 276
 
277 277
 		return $title;
278 278
 	}
279 279
 
280 280
 	$screen = get_current_screen();
281 281
 
282
-	if ( 'give_forms' == $screen->post_type ) {
283
-		$title = esc_html__( 'Enter form title here', 'give' );
282
+	if ('give_forms' == $screen->post_type) {
283
+		$title = esc_html__('Enter form title here', 'give');
284 284
 	}
285 285
 
286 286
 	return $title;
287 287
 }
288 288
 
289
-add_filter( 'enter_title_here', 'give_change_default_title' );
289
+add_filter('enter_title_here', 'give_change_default_title');
290 290
 
291 291
 /**
292 292
  * Registers Custom Post Statuses which are used by the Payments
@@ -296,50 +296,50 @@  discard block
 block discarded – undo
296 296
  */
297 297
 function give_register_post_type_statuses() {
298 298
 	// Payment Statuses
299
-	register_post_status( 'refunded', array(
300
-		'label'                     => esc_html__( 'Refunded', 'give' ),
299
+	register_post_status('refunded', array(
300
+		'label'                     => esc_html__('Refunded', 'give'),
301 301
 		'public'                    => true,
302 302
 		'exclude_from_search'       => false,
303 303
 		'show_in_admin_all_list'    => true,
304 304
 		'show_in_admin_status_list' => true,
305
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
306
-	) );
307
-	register_post_status( 'failed', array(
308
-		'label'                     => esc_html__( 'Failed', 'give' ),
305
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'),
306
+	));
307
+	register_post_status('failed', array(
308
+		'label'                     => esc_html__('Failed', 'give'),
309 309
 		'public'                    => true,
310 310
 		'exclude_from_search'       => false,
311 311
 		'show_in_admin_all_list'    => true,
312 312
 		'show_in_admin_status_list' => true,
313
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
314
-	) );
315
-	register_post_status( 'revoked', array(
316
-		'label'                     => esc_html__( 'Revoked', 'give' ),
313
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'),
314
+	));
315
+	register_post_status('revoked', array(
316
+		'label'                     => esc_html__('Revoked', 'give'),
317 317
 		'public'                    => true,
318 318
 		'exclude_from_search'       => false,
319 319
 		'show_in_admin_all_list'    => true,
320 320
 		'show_in_admin_status_list' => true,
321
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
322
-	) );
323
-	register_post_status( 'cancelled', array(
324
-		'label'                     => esc_html__( 'Cancelled', 'give' ),
321
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'),
322
+	));
323
+	register_post_status('cancelled', array(
324
+		'label'                     => esc_html__('Cancelled', 'give'),
325 325
 		'public'                    => true,
326 326
 		'exclude_from_search'       => false,
327 327
 		'show_in_admin_all_list'    => true,
328 328
 		'show_in_admin_status_list' => true,
329
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
330
-	) );
331
-	register_post_status( 'abandoned', array(
332
-		'label'                     => esc_html__( 'Abandoned', 'give' ),
329
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'),
330
+	));
331
+	register_post_status('abandoned', array(
332
+		'label'                     => esc_html__('Abandoned', 'give'),
333 333
 		'public'                    => true,
334 334
 		'exclude_from_search'       => false,
335 335
 		'show_in_admin_all_list'    => true,
336 336
 		'show_in_admin_status_list' => true,
337
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
338
-	) );
337
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'),
338
+	));
339 339
 
340 340
 }
341 341
 
342
-add_action( 'init', 'give_register_post_type_statuses' );
342
+add_action('init', 'give_register_post_type_statuses');
343 343
 
344 344
 /**
345 345
  * Updated Messages
@@ -352,27 +352,27 @@  discard block
 block discarded – undo
352 352
  *
353 353
  * @return array $messages New post updated messages
354 354
  */
355
-function give_updated_messages( $messages ) {
355
+function give_updated_messages($messages) {
356 356
 	global $post, $post_ID;
357 357
 
358
-	if ( give_get_option( 'disable_forms_singular' ) === 'on' ) {
358
+	if (give_get_option('disable_forms_singular') === 'on') {
359 359
 
360 360
 		$messages['give_forms'] = array(
361
-			1 => esc_html__( 'Form updated.', 'give' ),
362
-			4 => esc_html__( 'Form updated.', 'give' ),
363
-			6 => esc_html__( 'Form published.', 'give' ),
364
-			7 => esc_html__( 'Form saved.', 'give' ),
365
-			8 => esc_html__( 'Form submitted.', 'give' ),
361
+			1 => esc_html__('Form updated.', 'give'),
362
+			4 => esc_html__('Form updated.', 'give'),
363
+			6 => esc_html__('Form published.', 'give'),
364
+			7 => esc_html__('Form saved.', 'give'),
365
+			8 => esc_html__('Form submitted.', 'give'),
366 366
 		);
367 367
 
368 368
 	} else {
369 369
 
370 370
 		$messages['give_forms'] = array(
371
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
372
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
373
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
374
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
375
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
371
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
372
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
373
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
374
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
375
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
376 376
 		);
377 377
 
378 378
 	}
@@ -380,27 +380,27 @@  discard block
 block discarded – undo
380 380
 	return $messages;
381 381
 }
382 382
 
383
-add_filter( 'post_updated_messages', 'give_updated_messages' );
383
+add_filter('post_updated_messages', 'give_updated_messages');
384 384
 
385 385
 
386 386
 /**
387 387
  * Setup Post Type Images
388 388
  */
389
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
389
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
390 390
 
391 391
 /**
392 392
  * Ensure post thumbnail support is turned on
393 393
  */
394 394
 function give_add_thumbnail_support() {
395
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
395
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
396 396
 		return;
397 397
 	}
398 398
 
399
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
400
-		add_theme_support( 'post-thumbnails' );
399
+	if ( ! current_theme_supports('post-thumbnails')) {
400
+		add_theme_support('post-thumbnails');
401 401
 	}
402 402
 
403
-	add_post_type_support( 'give_forms', 'thumbnail' );
403
+	add_post_type_support('give_forms', 'thumbnail');
404 404
 }
405 405
 
406 406
 /**
@@ -412,21 +412,21 @@  discard block
 block discarded – undo
412 412
 
413 413
 	// Single Give Forms (disabled if single turned off in settings)
414 414
 	if (
415
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) )
416
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
415
+		give_is_setting_enabled(give_get_option('forms_singular'))
416
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
417 417
 	) {
418 418
 
419
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
420
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
419
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
420
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
421 421
 			'id'            => 'give-forms-sidebar',
422
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
422
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
423 423
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
424 424
 			'after_widget'  => '</div>',
425 425
 			'before_title'  => '<h3 class="widgettitle widget-title">',
426 426
 			'after_title'   => '</h3>',
427
-		) ) );
427
+		)));
428 428
 
429 429
 	}
430 430
 }
431 431
 
432
-add_action( 'widgets_init', 'give_widgets_init', 999 );
432
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/misc-functions.php 2 patches
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 
40
-	$currency = give_get_option( 'currency', 'USD' );
40
+	$currency = give_get_option('currency', 'USD');
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 
54
-	$currency_pos = give_get_option( 'currency_position', 'before' );
54
+	$currency_pos = give_get_option('currency_position', 'before');
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => esc_html__( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => esc_html__( 'Euros (€)', 'give' ),
71
-		'GBP'  => esc_html__( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => esc_html__( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => esc_html__( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => esc_html__( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => esc_html__( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => esc_html__( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => esc_html__( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => esc_html__( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => esc_html__( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => esc_html__( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => esc_html__( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => esc_html__( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => esc_html__( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
84
-		'NZD'  => esc_html__( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => esc_html__( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => esc_html__( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => esc_html__( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => esc_html__( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => esc_html__( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => esc_html__( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => esc_html__( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => esc_html__( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => esc_html__( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => esc_html__( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => esc_html__( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => esc_html__( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => esc_html__('US Dollars ($)', 'give'),
70
+		'EUR'  => esc_html__('Euros (€)', 'give'),
71
+		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => esc_html__('Australian Dollars ($)', 'give'),
73
+		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => esc_html__('Danish Krone (kr)', 'give'),
77
+		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => esc_html__('Mexican Peso ($)', 'give'),
83
+		'MAD'  => esc_html__('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
84
+		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => esc_html__('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => esc_html__('South African Rand (R)', 'give'),
91
+		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => esc_html__('Thai Baht (฿)', 'give'),
95
+		'INR'  => esc_html__('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => esc_html__('Russian Rubles (руб)', 'give')
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string           The symbol to use for the currency
115 115
  */
116
-function give_currency_symbol( $currency = '' ) {
116
+function give_currency_symbol($currency = '') {
117 117
 
118
-	if ( empty( $currency ) ) {
118
+	if (empty($currency)) {
119 119
 		$currency = give_get_currency();
120 120
 	}
121
-	switch ( $currency ) :
121
+	switch ($currency) :
122 122
 		case 'GBP' :
123 123
 			$symbol = '£';
124 124
 			break;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	endswitch;
198 198
 
199 199
 
200
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
200
+	return apply_filters('give_currency_symbol', $symbol, $currency);
201 201
 }
202 202
 
203 203
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function give_get_current_page_url() {
211 211
 
212
-	if ( is_front_page() ) {
213
-		$current_url = home_url( '/' );
212
+	if (is_front_page()) {
213
+		$current_url = home_url('/');
214 214
 	} else {
215
-		$http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] );
216
-		$request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
217
-		$current_url = set_url_scheme( 'http://' . $http_host . untrailingslashit( $request_uri ) );
215
+		$http_host = sanitize_text_field($_SERVER['HTTP_HOST']);
216
+		$request_uri = sanitize_text_field($_SERVER['REQUEST_URI']);
217
+		$current_url = set_url_scheme('http://'.$http_host.untrailingslashit($request_uri));
218 218
 	}
219 219
 
220
-	return apply_filters( 'give_get_current_page_url', $current_url );
220
+	return apply_filters('give_get_current_page_url', $current_url);
221 221
 }
222 222
 
223 223
 
@@ -238,15 +238,15 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	$gateways = give_get_enabled_payment_gateways();
240 240
 
241
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
241
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
242 242
 		$ret = true;
243
-	} else if ( count( $gateways ) == 1 ) {
243
+	} else if (count($gateways) == 1) {
244 244
 		$ret = false;
245
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
245
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
246 246
 		$ret = false;
247 247
 	}
248 248
 
249
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
249
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
250 250
 }
251 251
 
252 252
 /**
@@ -258,26 +258,26 @@  discard block
 block discarded – undo
258 258
 function give_get_timezone_id() {
259 259
 
260 260
 	// if site timezone string exists, return it
261
-	if ( $timezone = get_option( 'timezone_string' ) ) {
261
+	if ($timezone = get_option('timezone_string')) {
262 262
 		return $timezone;
263 263
 	}
264 264
 
265 265
 	// get UTC offset, if it isn't set return UTC
266
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
266
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
267 267
 		return 'UTC';
268 268
 	}
269 269
 
270 270
 	// attempt to guess the timezone string from the UTC offset
271
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
271
+	$timezone = timezone_name_from_abbr('', $utc_offset);
272 272
 
273 273
 	// last try, guess timezone string manually
274
-	if ( $timezone === false ) {
274
+	if ($timezone === false) {
275 275
 
276
-		$is_dst = date( 'I' );
276
+		$is_dst = date('I');
277 277
 
278
-		foreach ( timezone_abbreviations_list() as $abbr ) {
279
-			foreach ( $abbr as $city ) {
280
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
278
+		foreach (timezone_abbreviations_list() as $abbr) {
279
+			foreach ($abbr as $city) {
280
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
281 281
 					return $city['timezone_id'];
282 282
 				}
283 283
 			}
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 
302 302
 	$ip = '127.0.0.1';
303 303
 
304
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
304
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
305 305
 		//check ip from share internet
306 306
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
307
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
307
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
308 308
 		//to check ip is pass from proxy
309 309
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
310
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
310
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
311 311
 		$ip = $_SERVER['REMOTE_ADDR'];
312 312
 	}
313 313
 
314
-	return apply_filters( 'give_get_ip', $ip );
314
+	return apply_filters('give_get_ip', $ip);
315 315
 }
316 316
 
317 317
 
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @uses  Give()->session->set()
328 328
  */
329
-function give_set_purchase_session( $purchase_data = array() ) {
330
-	Give()->session->set( 'give_purchase', $purchase_data );
331
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
329
+function give_set_purchase_session($purchase_data = array()) {
330
+	Give()->session->set('give_purchase', $purchase_data);
331
+	Give()->session->set('give_email', $purchase_data['user_email']);
332 332
 }
333 333
 
334 334
 /**
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
  * @return mixed array | false
343 343
  */
344 344
 function give_get_purchase_session() {
345
-	return Give()->session->get( 'give_purchase' );
345
+	return Give()->session->get('give_purchase');
346 346
 }
347 347
 
348 348
 /**
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
  *
358 358
  * @return string
359 359
  */
360
-function give_get_purchase_summary( $purchase_data, $email = true ) {
360
+function give_get_purchase_summary($purchase_data, $email = true) {
361 361
 	$summary = '';
362 362
 
363
-	if ( $email ) {
364
-		$summary .= $purchase_data['user_email'] . ' - ';
363
+	if ($email) {
364
+		$summary .= $purchase_data['user_email'].' - ';
365 365
 	}
366 366
 
367
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
367
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
368 368
 
369 369
 	return $summary;
370 370
 }
@@ -381,31 +381,31 @@  discard block
 block discarded – undo
381 381
 function give_get_host() {
382 382
 	$host = false;
383 383
 
384
-	if ( defined( 'WPE_APIKEY' ) ) {
384
+	if (defined('WPE_APIKEY')) {
385 385
 		$host = 'WP Engine';
386
-	} elseif ( defined( 'PAGELYBIN' ) ) {
386
+	} elseif (defined('PAGELYBIN')) {
387 387
 		$host = 'Pagely';
388
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
388
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
389 389
 		$host = 'ICDSoft';
390
-	} elseif ( DB_HOST == 'mysqlv5' ) {
390
+	} elseif (DB_HOST == 'mysqlv5') {
391 391
 		$host = 'NetworkSolutions';
392
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
392
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
393 393
 		$host = 'iPage';
394
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
395 395
 		$host = 'IPower';
396
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
397 397
 		$host = 'MediaTemple Grid';
398
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
399 399
 		$host = 'pair Networks';
400
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
401 401
 		$host = 'Rackspace Cloud';
402
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
402
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
403 403
 		$host = 'SysFix.eu Power Hosting';
404
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
404
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
405 405
 		$host = 'Flywheel';
406 406
 	} else {
407 407
 		// Adding a general fallback for data gathering
408
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
408
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
409 409
 	}
410 410
 
411 411
 	return $host;
@@ -421,67 +421,67 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return bool true if host matches, false if not
423 423
  */
424
-function give_is_host( $host = false ) {
424
+function give_is_host($host = false) {
425 425
 
426 426
 	$return = false;
427 427
 
428
-	if ( $host ) {
429
-		$host = str_replace( ' ', '', strtolower( $host ) );
428
+	if ($host) {
429
+		$host = str_replace(' ', '', strtolower($host));
430 430
 
431
-		switch ( $host ) {
431
+		switch ($host) {
432 432
 			case 'wpengine':
433
-				if ( defined( 'WPE_APIKEY' ) ) {
433
+				if (defined('WPE_APIKEY')) {
434 434
 					$return = true;
435 435
 				}
436 436
 				break;
437 437
 			case 'pagely':
438
-				if ( defined( 'PAGELYBIN' ) ) {
438
+				if (defined('PAGELYBIN')) {
439 439
 					$return = true;
440 440
 				}
441 441
 				break;
442 442
 			case 'icdsoft':
443
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
443
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
444 444
 					$return = true;
445 445
 				}
446 446
 				break;
447 447
 			case 'networksolutions':
448
-				if ( DB_HOST == 'mysqlv5' ) {
448
+				if (DB_HOST == 'mysqlv5') {
449 449
 					$return = true;
450 450
 				}
451 451
 				break;
452 452
 			case 'ipage':
453
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
453
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
454 454
 					$return = true;
455 455
 				}
456 456
 				break;
457 457
 			case 'ipower':
458
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
458
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
459 459
 					$return = true;
460 460
 				}
461 461
 				break;
462 462
 			case 'mediatemplegrid':
463
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
463
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
464 464
 					$return = true;
465 465
 				}
466 466
 				break;
467 467
 			case 'pairnetworks':
468
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
468
+				if (strpos(DB_HOST, '.pair.com') !== false) {
469 469
 					$return = true;
470 470
 				}
471 471
 				break;
472 472
 			case 'rackspacecloud':
473
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
473
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
474 474
 					$return = true;
475 475
 				}
476 476
 				break;
477 477
 			case 'sysfix.eu':
478 478
 			case 'sysfix.eupowerhosting':
479
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
479
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
480 480
 					$return = true;
481 481
 				}
482 482
 				break;
483 483
 			case 'flywheel':
484
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
484
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
485 485
 					$return = true;
486 486
 				}
487 487
 				break;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
  * @param string $replacement Optional. The function that should have been called.
515 515
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
516 516
  */
517
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
517
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
518 518
 
519 519
 	/**
520 520
 	 * Fires while give deprecated function call occurs.
@@ -527,19 +527,19 @@  discard block
 block discarded – undo
527 527
 	 * @param string $replacement Optional. The function that should have been called.
528 528
 	 * @param string $version     The plugin version that deprecated the function.
529 529
 	 */
530
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
530
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
531 531
 
532
-	$show_errors = current_user_can( 'manage_options' );
532
+	$show_errors = current_user_can('manage_options');
533 533
 
534 534
 	// Allow plugin to filter the output error trigger
535
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
536
-		if ( ! is_null( $replacement ) ) {
537
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
538
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
535
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
536
+		if ( ! is_null($replacement)) {
537
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
538
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
539 539
 			// Alternatively we could dump this to a file.
540 540
 		} else {
541
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
542
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
541
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
542
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
543 543
 			// Alternatively we could dump this to a file.
544 544
 		}
545 545
 	}
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
  * @return string $post_id
554 554
  */
555 555
 function give_get_admin_post_id() {
556
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
557
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
556
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
557
+	if ( ! $post_id && isset($_POST['post_id'])) {
558 558
 		$post_id = $_POST['post_id'];
559 559
 	}
560 560
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
  * @return string Arg separator output
569 569
  */
570 570
 function give_get_php_arg_separator_output() {
571
-	return ini_get( 'arg_separator.output' );
571
+	return ini_get('arg_separator.output');
572 572
 }
573 573
 
574 574
 
@@ -583,10 +583,10 @@  discard block
 block discarded – undo
583 583
  *
584 584
  * @return string Short month name
585 585
  */
586
-function give_month_num_to_name( $n ) {
587
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
586
+function give_month_num_to_name($n) {
587
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
588 588
 
589
-	return date_i18n( "M", $timestamp );
589
+	return date_i18n("M", $timestamp);
590 590
 }
591 591
 
592 592
 
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
  *
600 600
  * @return bool Whether or not function is disabled.
601 601
  */
602
-function give_is_func_disabled( $function ) {
603
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
602
+function give_is_func_disabled($function) {
603
+	$disabled = explode(',', ini_get('disable_functions'));
604 604
 
605
-	return in_array( $function, $disabled );
605
+	return in_array($function, $disabled);
606 606
 }
607 607
 
608 608
 
@@ -613,31 +613,31 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function give_get_newsletter() { ?>
615 615
 
616
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
616
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
617 617
 
618 618
 	<div class="give-newsletter-form-wrap">
619 619
 
620 620
 		<form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&amp;id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
621 621
 			<div class="give-newsletter-confirmation">
622
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
622
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
623 623
 			</div>
624 624
 
625 625
 			<table class="form-table give-newsletter-form">
626 626
 				<tr valign="middle">
627 627
 					<td>
628
-						<label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
629
-						<input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" class="required email" value="">
628
+						<label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
629
+						<input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" class="required email" value="">
630 630
 					</td>
631 631
 					<td>
632
-						<label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
633
-						<input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
632
+						<label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
633
+						<input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
634 634
 					</td>
635 635
 					<td>
636
-						<label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
637
-						<input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
636
+						<label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
637
+						<input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
638 638
 					</td>
639 639
 					<td>
640
-						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
640
+						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e('Subscribe', 'give'); ?>">
641 641
 					</td>
642 642
 				</tr>
643 643
 			</table>
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 		<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
699 699
 			printf(
700 700
 				/* translators: %s: Give twitter user @givewp */
701
-				esc_html_e( 'Follow %s', 'give' ),
701
+				esc_html_e('Follow %s', 'give'),
702 702
 				'@givewp'
703 703
 			);
704 704
 		?></a>
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
  *
728 728
  * @return string
729 729
  */
730
-function give_svg_icons( $icon ) {
730
+function give_svg_icons($icon) {
731 731
 
732 732
 	// Store your SVGs in an associative array
733 733
 	$svgs = array(
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	);
740 740
 
741 741
 	// Return the chosen icon's SVG string
742
-	return $svgs[ $icon ];
742
+	return $svgs[$icon];
743 743
 }
744 744
 
745 745
 /**
@@ -751,15 +751,15 @@  discard block
 block discarded – undo
751 751
  *
752 752
  * @return mixed
753 753
  */
754
-function modify_nav_menu_meta_box_object( $post_type ) {
755
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
756
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
754
+function modify_nav_menu_meta_box_object($post_type) {
755
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
756
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
757 757
 	}
758 758
 
759 759
 	return $post_type;
760 760
 }
761 761
 
762
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
762
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
763 763
 
764 764
 
765 765
 /**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
  * @license    https://opensource.org/licenses/MIT MIT
774 774
  */
775 775
 
776
-if ( ! function_exists( 'array_column' ) ) {
776
+if ( ! function_exists('array_column')) {
777 777
 	/**
778 778
 	 * Returns the values from a single column of the input array, identified by
779 779
 	 * the $columnKey.
@@ -792,53 +792,53 @@  discard block
 block discarded – undo
792 792
 	 *
793 793
 	 * @return array
794 794
 	 */
795
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
795
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
796 796
 		// Using func_get_args() in order to check for proper number of
797 797
 		// parameters and trigger errors exactly as the built-in array_column()
798 798
 		// does in PHP 5.5.
799 799
 		$argc   = func_num_args();
800 800
 		$params = func_get_args();
801 801
 
802
-		if ( $argc < 2 ) {
803
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
802
+		if ($argc < 2) {
803
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
804 804
 
805 805
 			return null;
806 806
 		}
807 807
 
808
-		if ( ! is_array( $params[0] ) ) {
809
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
808
+		if ( ! is_array($params[0])) {
809
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
810 810
 
811 811
 			return null;
812 812
 		}
813 813
 
814
-		if ( ! is_int( $params[1] )
815
-		     && ! is_float( $params[1] )
816
-		     && ! is_string( $params[1] )
814
+		if ( ! is_int($params[1])
815
+		     && ! is_float($params[1])
816
+		     && ! is_string($params[1])
817 817
 		     && $params[1] !== null
818
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
818
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
819 819
 		) {
820
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
820
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
821 821
 
822 822
 			return false;
823 823
 		}
824 824
 
825
-		if ( isset( $params[2] )
826
-		     && ! is_int( $params[2] )
827
-		     && ! is_float( $params[2] )
828
-		     && ! is_string( $params[2] )
829
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
825
+		if (isset($params[2])
826
+		     && ! is_int($params[2])
827
+		     && ! is_float($params[2])
828
+		     && ! is_string($params[2])
829
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
830 830
 		) {
831
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
831
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
832 832
 
833 833
 			return false;
834 834
 		}
835 835
 
836 836
 		$paramsInput     = $params[0];
837
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
837
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
838 838
 
839 839
 		$paramsIndexKey = null;
840
-		if ( isset( $params[2] ) ) {
841
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
840
+		if (isset($params[2])) {
841
+			if (is_float($params[2]) || is_int($params[2])) {
842 842
 				$paramsIndexKey = (int) $params[2];
843 843
 			} else {
844 844
 				$paramsIndexKey = (string) $params[2];
@@ -847,26 +847,26 @@  discard block
 block discarded – undo
847 847
 
848 848
 		$resultArray = array();
849 849
 
850
-		foreach ( $paramsInput as $row ) {
850
+		foreach ($paramsInput as $row) {
851 851
 			$key    = $value = null;
852 852
 			$keySet = $valueSet = false;
853 853
 
854
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
854
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
855 855
 				$keySet = true;
856
-				$key    = (string) $row[ $paramsIndexKey ];
856
+				$key    = (string) $row[$paramsIndexKey];
857 857
 			}
858 858
 
859
-			if ( $paramsColumnKey === null ) {
859
+			if ($paramsColumnKey === null) {
860 860
 				$valueSet = true;
861 861
 				$value    = $row;
862
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
862
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
863 863
 				$valueSet = true;
864
-				$value    = $row[ $paramsColumnKey ];
864
+				$value    = $row[$paramsColumnKey];
865 865
 			}
866 866
 
867
-			if ( $valueSet ) {
868
-				if ( $keySet ) {
869
-					$resultArray[ $key ] = $value;
867
+			if ($valueSet) {
868
+				if ($keySet) {
869
+					$resultArray[$key] = $value;
870 870
 				} else {
871 871
 					$resultArray[] = $value;
872 872
 				}
@@ -888,40 +888,40 @@  discard block
 block discarded – undo
888 888
  *
889 889
  * @return bool Whether the receipt is visible or not.
890 890
  */
891
-function give_can_view_receipt( $payment_key = '' ) {
891
+function give_can_view_receipt($payment_key = '') {
892 892
 
893 893
 	$return = false;
894 894
 
895
-	if ( empty( $payment_key ) ) {
895
+	if (empty($payment_key)) {
896 896
 		return $return;
897 897
 	}
898 898
 
899 899
 	global $give_receipt_args;
900 900
 
901
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
901
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
902 902
 
903
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
903
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
904 904
 
905
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
905
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
906 906
 
907
-	if ( is_user_logged_in() ) {
908
-		if ( $user_id === (int) get_current_user_id() ) {
907
+	if (is_user_logged_in()) {
908
+		if ($user_id === (int) get_current_user_id()) {
909 909
 			$return = true;
910
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
910
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
911 911
 			$return = true;
912
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
912
+		} elseif (current_user_can('view_give_sensitive_data')) {
913 913
 			$return = true;
914 914
 		}
915 915
 	}
916 916
 
917 917
 	$session = give_get_purchase_session();
918
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
919
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
918
+	if ( ! empty($session) && ! is_user_logged_in()) {
919
+		if ($session['purchase_key'] === $payment_meta['key']) {
920 920
 			$return = true;
921 921
 		}
922 922
 	}
923 923
 
924
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
924
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
925 925
 
926 926
 }
927 927
 
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
  *
931 931
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
932 932
  */
933
-if ( ! function_exists( 'cal_days_in_month' ) ) {
933
+if ( ! function_exists('cal_days_in_month')) {
934 934
 	/**
935 935
 	 * cal_days_in_month
936 936
 	 *
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return bool|string
942 942
 	 */
943
-	function cal_days_in_month( $calendar, $month, $year ) {
944
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
943
+	function cal_days_in_month($calendar, $month, $year) {
944
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
945 945
 	}
946 946
 }
947 947
 
@@ -960,42 +960,42 @@  discard block
 block discarded – undo
960 960
  */
961 961
 function give_get_plugins() {
962 962
 	$plugins             = get_plugins();
963
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
963
+	$active_plugin_paths = (array) get_option('active_plugins', array());
964 964
 
965
-	if ( is_multisite() ) {
966
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
967
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
965
+	if (is_multisite()) {
966
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
967
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
968 968
 	}
969 969
 
970
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
970
+	foreach ($plugins as $plugin_path => $plugin_data) {
971 971
 		// Is plugin active?
972
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
973
-			$plugins[ $plugin_path ]['Status'] = 'active';
972
+		if (in_array($plugin_path, $active_plugin_paths)) {
973
+			$plugins[$plugin_path]['Status'] = 'active';
974 974
 		} else {
975
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
975
+			$plugins[$plugin_path]['Status'] = 'inactive';
976 976
 		}
977 977
 
978
-		$dirname = strtolower( dirname( $plugin_path ) );
978
+		$dirname = strtolower(dirname($plugin_path));
979 979
 
980 980
 		// Is plugin a Give add-on by WordImpress?
981
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
981
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
982 982
 			// Plugin is a Give-addon.
983
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
983
+			$plugins[$plugin_path]['Type'] = 'add-on';
984 984
 
985 985
 			// Get license info from database.
986
-			$plugin_name    = str_replace( 'Give - ', '', $plugin_data['Name'] );
987
-			$db_option      = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';
988
-			$license_active = get_option( $db_option );
986
+			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']);
987
+			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active';
988
+			$license_active = get_option($db_option);
989 989
 
990 990
 			// Does a valid license exist?
991
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
992
-				$plugins[ $plugin_path ]['License'] = true;
991
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
992
+				$plugins[$plugin_path]['License'] = true;
993 993
 			} else {
994
-				$plugins[ $plugin_path ]['License'] = false;
994
+				$plugins[$plugin_path]['License'] = false;
995 995
 			}
996 996
 		} else {
997 997
 			// Plugin is not a Give add-on.
998
-			$plugins[ $plugin_path ]['Type'] = 'other';
998
+			$plugins[$plugin_path]['Type'] = 'other';
999 999
 		}
1000 1000
 	}
1001 1001
 
@@ -1012,16 +1012,16 @@  discard block
 block discarded – undo
1012 1012
  *
1013 1013
  * @return bool
1014 1014
  */
1015
-function give_is_terms_enabled( $form_id ) {
1016
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1015
+function give_is_terms_enabled($form_id) {
1016
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1017 1017
 
1018 1018
 	if (
1019
-		give_is_setting_enabled( $form_option, 'global' )
1020
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1019
+		give_is_setting_enabled($form_option, 'global')
1020
+		&& give_is_setting_enabled(give_get_option('terms'))
1021 1021
 	) {
1022 1022
 		return true;
1023 1023
 
1024
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1024
+	} elseif (give_is_setting_enabled($form_option)) {
1025 1025
 		return true;
1026 1026
 
1027 1027
 	} else {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -812,10 +812,10 @@  discard block
 block discarded – undo
812 812
 		}
813 813
 
814 814
 		if ( ! is_int( $params[1] )
815
-		     && ! is_float( $params[1] )
816
-		     && ! is_string( $params[1] )
817
-		     && $params[1] !== null
818
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
815
+			 && ! is_float( $params[1] )
816
+			 && ! is_string( $params[1] )
817
+			 && $params[1] !== null
818
+			 && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
819 819
 		) {
820 820
 			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
821 821
 
@@ -823,10 +823,10 @@  discard block
 block discarded – undo
823 823
 		}
824 824
 
825 825
 		if ( isset( $params[2] )
826
-		     && ! is_int( $params[2] )
827
-		     && ! is_float( $params[2] )
828
-		     && ! is_string( $params[2] )
829
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
826
+			 && ! is_int( $params[2] )
827
+			 && ! is_float( $params[2] )
828
+			 && ! is_string( $params[2] )
829
+			 && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
830 830
 		) {
831 831
 			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
832 832
 
Please login to merge, or discard this patch.
includes/user-functions.php 1 patch
Spacing   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|object List of all user donations
32 32
  */
33
-function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 
45
-	if ( $pagination ) {
46
-		if ( get_query_var( 'paged' ) ) {
47
-			$paged = get_query_var( 'paged' );
48
-		} elseif ( get_query_var( 'page' ) ) {
49
-			$paged = get_query_var( 'page' );
45
+	if ($pagination) {
46
+		if (get_query_var('paged')) {
47
+			$paged = get_query_var('paged');
48
+		} elseif (get_query_var('page')) {
49
+			$paged = get_query_var('page');
50 50
 		} else {
51 51
 			$paged = 1;
52 52
 		}
53 53
 	}
54 54
 
55
-	$args = apply_filters( 'give_get_users_donations_args', array(
55
+	$args = apply_filters('give_get_users_donations_args', array(
56 56
 		'user'    => $user,
57 57
 		'number'  => $number,
58 58
 		'status'  => $status,
59 59
 		'orderby' => 'date',
60
-	) );
60
+	));
61 61
 
62
-	if ( $pagination ) {
62
+	if ($pagination) {
63 63
 
64 64
 		$args['page'] = $paged;
65 65
 
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
 
70 70
 	}
71 71
 
72
-	$by_user_id = is_numeric( $user ) ? true : false;
73
-	$customer   = new Give_Customer( $user, $by_user_id );
72
+	$by_user_id = is_numeric($user) ? true : false;
73
+	$customer   = new Give_Customer($user, $by_user_id);
74 74
 
75
-	if ( ! empty( $customer->payment_ids ) ) {
75
+	if ( ! empty($customer->payment_ids)) {
76 76
 
77
-		unset( $args['user'] );
78
-		$args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) );
77
+		unset($args['user']);
78
+		$args['post__in'] = array_map('absint', explode(',', $customer->payment_ids));
79 79
 
80 80
 	}
81 81
 
82
-	$purchases = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) );
82
+	$purchases = give_get_payments(apply_filters('give_get_users_donations_args', $args));
83 83
 
84 84
 	// No donations
85
-	if ( ! $purchases ) {
85
+	if ( ! $purchases) {
86 86
 		return false;
87 87
 	}
88 88
 
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return bool|object List of unique forms donated by user
103 103
  */
104
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
105
-	if ( empty( $user ) ) {
104
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
105
+	if (empty($user)) {
106 106
 		$user = get_current_user_id();
107 107
 	}
108 108
 
109
-	if ( empty( $user ) ) {
109
+	if (empty($user)) {
110 110
 		return false;
111 111
 	}
112 112
 
113
-	$by_user_id = is_numeric( $user ) ? true : false;
113
+	$by_user_id = is_numeric($user) ? true : false;
114 114
 
115
-	$customer = new Give_Customer( $user, $by_user_id );
115
+	$customer = new Give_Customer($user, $by_user_id);
116 116
 
117
-	if ( empty( $customer->payment_ids ) ) {
117
+	if (empty($customer->payment_ids)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	// Get all the items donated
122
-	$payment_ids    = array_reverse( explode( ',', $customer->payment_ids ) );
123
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
124
-	if ( ! empty( $limit_payments ) ) {
125
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
122
+	$payment_ids    = array_reverse(explode(',', $customer->payment_ids));
123
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
124
+	if ( ! empty($limit_payments)) {
125
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
126 126
 	}
127 127
 	$donation_data = array();
128
-	foreach ( $payment_ids as $payment_id ) {
129
-		$donation_data[] = give_get_payment_meta( $payment_id );
128
+	foreach ($payment_ids as $payment_id) {
129
+		$donation_data[] = give_get_payment_meta($payment_id);
130 130
 	}
131 131
 
132
-	if ( empty( $donation_data ) ) {
132
+	if (empty($donation_data)) {
133 133
 		return false;
134 134
 	}
135 135
 
136 136
 	// Grab only the post ids "form_id" of the forms donated on this order
137 137
 	$completed_donations_ids = array();
138
-	foreach ( $donation_data as $purchase_meta ) {
139
-		$completed_donations_ids[] = isset( $purchase_meta['form_id'] ) ? $purchase_meta['form_id'] : '';
138
+	foreach ($donation_data as $purchase_meta) {
139
+		$completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : '';
140 140
 	}
141 141
 
142
-	if ( empty( $completed_donations_ids ) ) {
142
+	if (empty($completed_donations_ids)) {
143 143
 		return false;
144 144
 	}
145 145
 
146 146
 	// Only include each donation once
147
-	$form_ids = array_unique( $completed_donations_ids );
147
+	$form_ids = array_unique($completed_donations_ids);
148 148
 
149 149
 	// Make sure we still have some products and a first item
150
-	if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) {
150
+	if (empty($form_ids) || ! isset($form_ids[0])) {
151 151
 		return false;
152 152
 	}
153 153
 
154
-	$post_type = get_post_type( $form_ids[0] );
154
+	$post_type = get_post_type($form_ids[0]);
155 155
 
156
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
156
+	$args = apply_filters('give_get_users_completed_donations_args', array(
157 157
 		'include'        => $form_ids,
158 158
 		'post_type'      => $post_type,
159
-		'posts_per_page' => - 1,
160
-	) );
159
+		'posts_per_page' => -1,
160
+	));
161 161
 
162
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
162
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
163 163
 }
164 164
 
165 165
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return      bool True if has donated, false other wise.
177 177
  */
178
-function give_has_purchases( $user_id = null ) {
179
-	if ( empty( $user_id ) ) {
178
+function give_has_purchases($user_id = null) {
179
+	if (empty($user_id)) {
180 180
 		$user_id = get_current_user_id();
181 181
 	}
182 182
 
183
-	if ( give_get_users_purchases( $user_id, 1 ) ) {
183
+	if (give_get_users_purchases($user_id, 1)) {
184 184
 		return true; // User has at least one donation
185 185
 	}
186 186
 
@@ -200,27 +200,27 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return      array
202 202
  */
203
-function give_get_purchase_stats_by_user( $user = '' ) {
203
+function give_get_purchase_stats_by_user($user = '') {
204 204
 
205
-	if ( is_email( $user ) ) {
205
+	if (is_email($user)) {
206 206
 
207 207
 		$field = 'email';
208 208
 
209
-	} elseif ( is_numeric( $user ) ) {
209
+	} elseif (is_numeric($user)) {
210 210
 
211 211
 		$field = 'user_id';
212 212
 
213 213
 	}
214 214
 
215 215
 	$stats    = array();
216
-	$customer = Give()->customers->get_customer_by( $field, $user );
216
+	$customer = Give()->customers->get_customer_by($field, $user);
217 217
 
218
-	if ( $customer ) {
218
+	if ($customer) {
219 219
 
220
-		$customer = new Give_Customer( $customer->id );
220
+		$customer = new Give_Customer($customer->id);
221 221
 
222
-		$stats['purchases']   = absint( $customer->purchase_count );
223
-		$stats['total_spent'] = give_sanitize_amount( $customer->purchase_value );
222
+		$stats['purchases']   = absint($customer->purchase_count);
223
+		$stats['total_spent'] = give_sanitize_amount($customer->purchase_value);
224 224
 
225 225
 	}
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @since 1.7
231 231
 	 */
232
-	$stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user );
232
+	$stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user);
233 233
 
234 234
 	return $stats;
235 235
 }
@@ -247,21 +247,21 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return      int The total number of donations
249 249
  */
250
-function give_count_purchases_of_customer( $user = null ) {
250
+function give_count_purchases_of_customer($user = null) {
251 251
 
252 252
 	// Logged in?
253
-	if ( empty( $user ) ) {
253
+	if (empty($user)) {
254 254
 		$user = get_current_user_id();
255 255
 	}
256 256
 
257 257
 	// Email access?
258
-	if ( empty( $user ) && Give()->email_access->token_email ) {
258
+	if (empty($user) && Give()->email_access->token_email) {
259 259
 		$user = Give()->email_access->token_email;
260 260
 	}
261 261
 
262
-	$stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false;
262
+	$stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false;
263 263
 
264
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
264
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
265 265
 }
266 266
 
267 267
 /**
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
  *
275 275
  * @return      float The total amount the user has spent
276 276
  */
277
-function give_purchase_total_of_user( $user = null ) {
277
+function give_purchase_total_of_user($user = null) {
278 278
 
279
-	$stats = give_get_purchase_stats_by_user( $user );
279
+	$stats = give_get_purchase_stats_by_user($user);
280 280
 
281 281
 	return $stats['total_spent'];
282 282
 }
@@ -292,40 +292,40 @@  discard block
 block discarded – undo
292 292
  *
293 293
  * @return bool
294 294
  */
295
-function give_validate_username( $username, $form_id = 0 ) {
295
+function give_validate_username($username, $form_id = 0) {
296 296
 	$valid = true;
297 297
 
298 298
 	// Validate username.
299
-	if ( ! empty( $username ) ) {
299
+	if ( ! empty($username)) {
300 300
 
301 301
 		// Sanitize username.
302
-		$sanitized_user_name = sanitize_user( $username, false );
302
+		$sanitized_user_name = sanitize_user($username, false);
303 303
 
304 304
 		// We have an user name, check if it already exists.
305
-		if ( username_exists( $username ) ) {
305
+		if (username_exists($username)) {
306 306
 			// Username already registered.
307
-			give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
307
+			give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
308 308
 			$valid = false;
309 309
 
310 310
 			// Check if it's valid.
311
-		} elseif ( $sanitized_user_name !== $username ) {
311
+		} elseif ($sanitized_user_name !== $username) {
312 312
 			// Invalid username.
313
-			if ( is_multisite() ) {
314
-				give_set_error( 'username_invalid', esc_html__( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) );
313
+			if (is_multisite()) {
314
+				give_set_error('username_invalid', esc_html__('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'));
315 315
 				$valid = false;
316 316
 			} else {
317
-				give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
317
+				give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
318 318
 				$valid = false;
319 319
 			}
320 320
 		}
321 321
 	} else {
322 322
 		// Username is empty.
323
-		give_set_error( 'username_empty', esc_html__( 'Enter an username.', 'give' ) );
323
+		give_set_error('username_empty', esc_html__('Enter an username.', 'give'));
324 324
 		$valid = false;
325 325
 
326 326
 		// Check if guest checkout is disable for form.
327
-		if ( $form_id && give_logged_in_only( $form_id ) ) {
328
-			give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation.', 'give' ) );
327
+		if ($form_id && give_logged_in_only($form_id)) {
328
+			give_set_error('registration_required', esc_html__('You must register or login to complete your donation.', 'give'));
329 329
 			$valid = false;
330 330
 		}
331 331
 	}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 * @param string $username
340 340
 	 * @param bool   $form_id
341 341
 	 */
342
-	$valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id );
342
+	$valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id);
343 343
 
344 344
 	return $valid;
345 345
 }
@@ -355,22 +355,22 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return bool
357 357
  */
358
-function give_validate_user_email( $email, $registering_new_user = false ) {
358
+function give_validate_user_email($email, $registering_new_user = false) {
359 359
 	$valid = true;
360 360
 
361
-	if ( empty( $email ) ) {
361
+	if (empty($email)) {
362 362
 		// No email.
363
-		give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) );
363
+		give_set_error('email_empty', esc_html__('Enter an email.', 'give'));
364 364
 		$valid = false;
365 365
 
366
-	} elseif ( ! is_email( $email ) ) {
366
+	} elseif ( ! is_email($email)) {
367 367
 		// Validate email.
368
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
368
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
369 369
 		$valid = false;
370 370
 
371
-	} elseif ( $registering_new_user && email_exists( $email ) ) {
371
+	} elseif ($registering_new_user && email_exists($email)) {
372 372
 		// Check if email exists.
373
-		give_set_error( 'email_used', esc_html__( 'The email already active for another user.', 'give' ) );
373
+		give_set_error('email_used', esc_html__('The email already active for another user.', 'give'));
374 374
 		$valid = false;
375 375
 	}
376 376
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @param string $email
384 384
 	 * @param bool   $registering_new_user
385 385
 	 */
386
-	$valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user );
386
+	$valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user);
387 387
 
388 388
 	return $valid;
389 389
 }
@@ -399,25 +399,25 @@  discard block
 block discarded – undo
399 399
  *
400 400
  * @return bool
401 401
  */
402
-function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) {
402
+function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) {
403 403
 	$valid = true;
404 404
 
405
-	if ( $password && $confirm_password ) {
405
+	if ($password && $confirm_password) {
406 406
 		// Verify confirmation matches.
407
-		if ( $password != $confirm_password ) {
407
+		if ($password != $confirm_password) {
408 408
 			// Passwords do not match
409
-			give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
409
+			give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
410 410
 			$valid = false;
411 411
 		}
412
-	} elseif ( $registering_new_user ) {
412
+	} elseif ($registering_new_user) {
413 413
 		// Password or confirmation missing.
414
-		if ( ! $password ) {
414
+		if ( ! $password) {
415 415
 			// The password is invalid.
416
-			give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) );
416
+			give_set_error('password_empty', esc_html__('Enter a password.', 'give'));
417 417
 			$valid = false;
418
-		} elseif ( ! $confirm_password ) {
418
+		} elseif ( ! $confirm_password) {
419 419
 			// Confirmation password is invalid.
420
-			give_set_error( 'confirmation_empty', esc_html__( 'Enter the password confirmation.', 'give' ) );
420
+			give_set_error('confirmation_empty', esc_html__('Enter the password confirmation.', 'give'));
421 421
 			$valid = false;
422 422
 		}
423 423
 	}
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @param string $confirm_password
433 433
 	 * @param bool   $registering_new_user
434 434
 	 */
435
-	$valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user );
435
+	$valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user);
436 436
 
437 437
 	return $valid;
438 438
 }
@@ -451,32 +451,32 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return      void
453 453
  */
454
-function give_add_past_purchases_to_new_user( $user_id ) {
454
+function give_add_past_purchases_to_new_user($user_id) {
455 455
 
456
-	$email = get_the_author_meta( 'user_email', $user_id );
456
+	$email = get_the_author_meta('user_email', $user_id);
457 457
 
458
-	$payments = give_get_payments( array( 's' => $email ) );
458
+	$payments = give_get_payments(array('s' => $email));
459 459
 
460
-	if ( $payments ) {
461
-		foreach ( $payments as $payment ) {
462
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
460
+	if ($payments) {
461
+		foreach ($payments as $payment) {
462
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
463 463
 				continue;
464 464
 			} // This payment already associated with an account
465 465
 
466
-			$meta                    = give_get_payment_meta( $payment->ID );
467
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
466
+			$meta                    = give_get_payment_meta($payment->ID);
467
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
468 468
 			$meta['user_info']['id'] = $user_id;
469 469
 			$meta['user_info']       = $meta['user_info'];
470 470
 
471 471
 			// Store the updated user ID in the payment meta
472
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
473
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
472
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
473
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
474 474
 		}
475 475
 	}
476 476
 
477 477
 }
478 478
 
479
-add_action( 'user_register', 'give_add_past_purchases_to_new_user' );
479
+add_action('user_register', 'give_add_past_purchases_to_new_user');
480 480
 
481 481
 
482 482
 /**
@@ -502,34 +502,34 @@  discard block
 block discarded – undo
502 502
  *
503 503
  * @return        array The donor's address, if any
504 504
  */
505
-function give_get_donor_address( $user_id = 0 ) {
506
-	if ( empty( $user_id ) ) {
505
+function give_get_donor_address($user_id = 0) {
506
+	if (empty($user_id)) {
507 507
 		$user_id = get_current_user_id();
508 508
 	}
509 509
 
510
-	$address = get_user_meta( $user_id, '_give_user_address', true );
510
+	$address = get_user_meta($user_id, '_give_user_address', true);
511 511
 
512
-	if ( ! isset( $address['line1'] ) ) {
512
+	if ( ! isset($address['line1'])) {
513 513
 		$address['line1'] = '';
514 514
 	}
515 515
 
516
-	if ( ! isset( $address['line2'] ) ) {
516
+	if ( ! isset($address['line2'])) {
517 517
 		$address['line2'] = '';
518 518
 	}
519 519
 
520
-	if ( ! isset( $address['city'] ) ) {
520
+	if ( ! isset($address['city'])) {
521 521
 		$address['city'] = '';
522 522
 	}
523 523
 
524
-	if ( ! isset( $address['zip'] ) ) {
524
+	if ( ! isset($address['zip'])) {
525 525
 		$address['zip'] = '';
526 526
 	}
527 527
 
528
-	if ( ! isset( $address['country'] ) ) {
528
+	if ( ! isset($address['country'])) {
529 529
 		$address['country'] = '';
530 530
 	}
531 531
 
532
-	if ( ! isset( $address['state'] ) ) {
532
+	if ( ! isset($address['state'])) {
533 533
 		$address['state'] = '';
534 534
 	}
535 535
 
@@ -549,42 +549,42 @@  discard block
 block discarded – undo
549 549
  *
550 550
  * @return        void
551 551
  */
552
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
552
+function give_new_user_notification($user_id = 0, $user_data = array()) {
553 553
 
554
-	if ( empty( $user_id ) || empty( $user_data ) ) {
554
+	if (empty($user_id) || empty($user_data)) {
555 555
 		return;
556 556
 	}
557
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
557
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
558 558
 
559 559
 	/* translators: %s: site name */
560
-	$message = sprintf( esc_attr__( 'New user registration on your site %s:', 'give' ), $blogname ) . "\r\n\r\n";
560
+	$message = sprintf(esc_attr__('New user registration on your site %s:', 'give'), $blogname)."\r\n\r\n";
561 561
 	/* translators: %s: user login */
562
-	$message .= sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n\r\n";
562
+	$message .= sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n\r\n";
563 563
 	/* translators: %s: user email */
564
-	$message .= sprintf( esc_attr__( 'E-mail: %s', 'give' ), $user_data['user_email'] ) . "\r\n";
564
+	$message .= sprintf(esc_attr__('E-mail: %s', 'give'), $user_data['user_email'])."\r\n";
565 565
 
566 566
 	@wp_mail(
567
-		get_option( 'admin_email' ),
567
+		get_option('admin_email'),
568 568
 		sprintf(
569 569
 			/* translators: %s: site name */
570
-			esc_attr__( '[%s] New User Registration', 'give' ),
570
+			esc_attr__('[%s] New User Registration', 'give'),
571 571
 			$blogname
572 572
 		),
573 573
 		$message
574 574
 	);
575 575
 
576 576
 	/* translators: %s: user login */
577
-	$message = sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n";
577
+	$message = sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n";
578 578
 	/* translators: %s: paswword */
579
-	$message .= sprintf( esc_attr__( 'Password: %s', 'give' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n";
579
+	$message .= sprintf(esc_attr__('Password: %s', 'give'), esc_attr__('[Password entered during donation]', 'give'))."\r\n";
580 580
 
581
-	$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login &raquo;', 'give' ) . '</a>' . "\r\n";
581
+	$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login &raquo;', 'give').'</a>'."\r\n";
582 582
 
583 583
 	wp_mail(
584 584
 		$user_data['user_email'],
585 585
 		sprintf(
586 586
 			/* translators: %s: site name */
587
-			esc_attr__( '[%s] Your username and password', 'give' ),
587
+			esc_attr__('[%s] Your username and password', 'give'),
588 588
 			$blogname
589 589
 		),
590 590
 		$message
@@ -592,4 +592,4 @@  discard block
 block discarded – undo
592 592
 
593 593
 }
594 594
 
595
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
595
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function transactions_dropdown( $args = array() ) {
38
+	public function transactions_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'transactions',
@@ -45,33 +45,33 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => esc_html__( 'Select a transaction', 'give' )
48
+			'placeholder' => esc_html__('Select a transaction', 'give')
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53
-		$payments = new Give_Payments_Query( array(
53
+		$payments = new Give_Payments_Query(array(
54 54
 			'number' => $args['number']
55
-		) );
55
+		));
56 56
 
57 57
 		$payments = $payments->get_payments();
58 58
 
59 59
 		$options = array();
60 60
 
61 61
 		//Provide nice human readable options.
62
-		if ( $payments ) {
63
-			$options[0] = esc_html__( 'Select a donation', 'give' );
64
-			foreach ( $payments as $payment ) {
62
+		if ($payments) {
63
+			$options[0] = esc_html__('Select a donation', 'give');
64
+			foreach ($payments as $payment) {
65 65
 
66
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title);
66
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
67 67
 
68 68
 			}
69 69
 		} else {
70
-			$options[0] = esc_html__( 'No donations found.', 'give' );
70
+			$options[0] = esc_html__('No donations found.', 'give');
71 71
 		}
72 72
 
73 73
 
74
-		$output = $this->select( array(
74
+		$output = $this->select(array(
75 75
 			'name'             => $args['name'],
76 76
 			'selected'         => $args['selected'],
77 77
 			'id'               => $args['id'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'select_atts'      => $args['select_atts'],
84 84
 			'show_option_all'  => false,
85 85
 			'show_option_none' => false
86
-		) );
86
+		));
87 87
 
88 88
 		return $output;
89 89
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string      Give forms dropdown.
102 102
 	 */
103
-	public function forms_dropdown( $args = array() ) {
103
+	public function forms_dropdown($args = array()) {
104 104
 
105 105
 		$defaults = array(
106 106
 			'name'        => 'forms',
@@ -110,31 +110,31 @@  discard block
 block discarded – undo
110 110
 			'selected'    => 0,
111 111
 			'chosen'      => false,
112 112
 			'number'      => 30,
113
-			'placeholder' => esc_attr__( 'Select a Donation Form', 'give' )
113
+			'placeholder' => esc_attr__('Select a Donation Form', 'give')
114 114
 		);
115 115
 
116
-		$args = wp_parse_args( $args, $defaults );
116
+		$args = wp_parse_args($args, $defaults);
117 117
 
118
-		$forms = get_posts( array(
118
+		$forms = get_posts(array(
119 119
 			'post_type'      => 'give_forms',
120 120
 			'orderby'        => 'title',
121 121
 			'order'          => 'ASC',
122 122
 			'posts_per_page' => $args['number']
123
-		) );
123
+		));
124 124
 
125 125
 		$options = array();
126 126
 
127
-		if ( $forms ) {
128
-			$options[0] = esc_attr__( 'Select a Donation Form', 'give' );
129
-			foreach ( $forms as $form ) {
130
-				$form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
131
-				$options[ absint( $form->ID ) ] = esc_html( $form_title );
127
+		if ($forms) {
128
+			$options[0] = esc_attr__('Select a Donation Form', 'give');
129
+			foreach ($forms as $form) {
130
+				$form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title;
131
+				$options[absint($form->ID)] = esc_html($form_title);
132 132
 			}
133 133
 		} else {
134
-			$options[0] = esc_html__( 'No forms found.', 'give' );
134
+			$options[0] = esc_html__('No forms found.', 'give');
135 135
 		}
136 136
 
137
-		$output = $this->select( array(
137
+		$output = $this->select(array(
138 138
 			'name'             => $args['name'],
139 139
 			'selected'         => $args['selected'],
140 140
 			'id'               => $args['id'],
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'placeholder'      => $args['placeholder'],
146 146
 			'show_option_all'  => false,
147 147
 			'show_option_none' => false
148
-		) );
148
+		));
149 149
 
150 150
 		return $output;
151 151
 	}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return string      Donors dropdown.
164 164
 	 */
165
-	public function donor_dropdown( $args = array() ) {
165
+	public function donor_dropdown($args = array()) {
166 166
 
167 167
 		$defaults = array(
168 168
 			'name'        => 'customers',
@@ -171,38 +171,38 @@  discard block
 block discarded – undo
171 171
 			'multiple'    => false,
172 172
 			'selected'    => 0,
173 173
 			'chosen'      => true,
174
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
174
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
175 175
 			'number'      => 30
176 176
 		);
177 177
 
178
-		$args = wp_parse_args( $args, $defaults );
178
+		$args = wp_parse_args($args, $defaults);
179 179
 
180
-		$customers = Give()->customers->get_customers( array(
180
+		$customers = Give()->customers->get_customers(array(
181 181
 			'number' => $args['number']
182
-		) );
182
+		));
183 183
 
184 184
 		$options = array();
185 185
 
186
-		if ( $customers ) {
187
-			$options[0] = esc_html__( 'No donor attached', 'give' );
188
-			foreach ( $customers as $customer ) {
189
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
186
+		if ($customers) {
187
+			$options[0] = esc_html__('No donor attached', 'give');
188
+			foreach ($customers as $customer) {
189
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
190 190
 			}
191 191
 		} else {
192
-			$options[0] = esc_html__( 'No donors found.', 'give' );
192
+			$options[0] = esc_html__('No donors found.', 'give');
193 193
 		}
194 194
 
195
-		if ( ! empty( $args['selected'] ) ) {
195
+		if ( ! empty($args['selected'])) {
196 196
 
197 197
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
198 198
 
199
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
199
+			if ( ! array_key_exists($args['selected'], $options)) {
200 200
 
201
-				$customer = new Give_Customer( $args['selected'] );
201
+				$customer = new Give_Customer($args['selected']);
202 202
 
203
-				if ( $customer ) {
203
+				if ($customer) {
204 204
 
205
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
205
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
206 206
 
207 207
 				}
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
 
211 211
 		}
212 212
 
213
-		$output = $this->select( array(
213
+		$output = $this->select(array(
214 214
 			'name'             => $args['name'],
215 215
 			'selected'         => $args['selected'],
216 216
 			'id'               => $args['id'],
217
-			'class'            => $args['class'] . ' give-customer-select',
217
+			'class'            => $args['class'].' give-customer-select',
218 218
 			'options'          => $options,
219 219
 			'multiple'         => $args['multiple'],
220 220
 			'chosen'           => $args['chosen'],
221 221
 			'show_option_all'  => false,
222 222
 			'show_option_none' => false
223
-		) );
223
+		));
224 224
 
225 225
 		return $output;
226 226
 	}
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return string           Categories dropdown.
241 241
 	 */
242
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
243
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
242
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) {
243
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
244 244
 		$options    = array();
245 245
 
246
-		foreach ( $categories as $category ) {
247
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
246
+		foreach ($categories as $category) {
247
+			$options[absint($category->term_id)] = esc_html($category->name);
248 248
 		}
249 249
 
250
-		$output = $this->select( wp_parse_args(
250
+		$output = $this->select(wp_parse_args(
251 251
 			$args,
252 252
 			array(
253 253
 				'name'             => $name,
254 254
 				'selected'         => $selected,
255 255
 				'options'          => $options,
256
-				'show_option_all'  => esc_html__( 'All Categories', 'give' ),
256
+				'show_option_all'  => esc_html__('All Categories', 'give'),
257 257
 				'show_option_none' => false
258 258
 			)
259
-		) );
259
+		));
260 260
 
261 261
 		return $output;
262 262
 	}
@@ -275,24 +275,24 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return string           Tags dropdown.
277 277
 	 */
278
-	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
279
-		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
278
+	public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) {
279
+		$tags    = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
280 280
 		$options = array();
281 281
 
282
-		foreach ( $tags as $tag ) {
283
-			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
282
+		foreach ($tags as $tag) {
283
+			$options[absint($tag->term_id)] = esc_html($tag->name);
284 284
 		}
285 285
 
286
-		$output = $this->select( wp_parse_args(
286
+		$output = $this->select(wp_parse_args(
287 287
 			$args,
288 288
 			array(
289 289
 				'name'             => $name,
290 290
 				'selected'         => $selected,
291 291
 				'options'          => $options,
292
-				'show_option_all'  => esc_html__( 'All Tags', 'give' ),
292
+				'show_option_all'  => esc_html__('All Tags', 'give'),
293 293
 				'show_option_none' => false,
294 294
 			)
295
-		) );
295
+		));
296 296
 
297 297
 		return $output;
298 298
 	}
@@ -312,25 +312,25 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return string               Years dropdown.
314 314
 	 */
315
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
316
-		$current    = date( 'Y' );
317
-		$start_year = $current - absint( $years_before );
318
-		$end_year   = $current + absint( $years_after );
319
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
315
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
316
+		$current    = date('Y');
317
+		$start_year = $current - absint($years_before);
318
+		$end_year   = $current + absint($years_after);
319
+		$selected   = empty($selected) ? date('Y') : $selected;
320 320
 		$options    = array();
321 321
 
322
-		while ( $start_year <= $end_year ) {
323
-			$options[ absint( $start_year ) ] = $start_year;
324
-			$start_year ++;
322
+		while ($start_year <= $end_year) {
323
+			$options[absint($start_year)] = $start_year;
324
+			$start_year++;
325 325
 		}
326 326
 
327
-		$output = $this->select( array(
327
+		$output = $this->select(array(
328 328
 			'name'             => $name,
329 329
 			'selected'         => $selected,
330 330
 			'options'          => $options,
331 331
 			'show_option_all'  => false,
332 332
 			'show_option_none' => false
333
-		) );
333
+		));
334 334
 
335 335
 		return $output;
336 336
 	}
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return string           Months dropdown.
350 350
 	 */
351
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
351
+	public function month_dropdown($name = 'month', $selected = 0) {
352 352
 		$month    = 1;
353 353
 		$options  = array();
354
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
354
+		$selected = empty($selected) ? date('n') : $selected;
355 355
 
356
-		while ( $month <= 12 ) {
357
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
358
-			$month ++;
356
+		while ($month <= 12) {
357
+			$options[absint($month)] = give_month_num_to_name($month);
358
+			$month++;
359 359
 		}
360 360
 
361
-		$output = $this->select( array(
361
+		$output = $this->select(array(
362 362
 			'name'             => $name,
363 363
 			'selected'         => $selected,
364 364
 			'options'          => $options,
365 365
 			'show_option_all'  => false,
366 366
 			'show_option_none' => false
367
-		) );
367
+		));
368 368
 
369 369
 		return $output;
370 370
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 * @return string      The dropdown.
383 383
 	 */
384
-	public function select( $args = array() ) {
384
+	public function select($args = array()) {
385 385
 		$defaults = array(
386 386
 			'options'          => array(),
387 387
 			'name'             => null,
@@ -392,60 +392,60 @@  discard block
 block discarded – undo
392 392
 			'placeholder'      => null,
393 393
 			'multiple'         => false,
394 394
 			'select_atts'      => false,
395
-			'show_option_all'  => esc_html__( 'All', 'give' ),
396
-			'show_option_none' => esc_html__( 'None', 'give' )
395
+			'show_option_all'  => esc_html__('All', 'give'),
396
+			'show_option_none' => esc_html__('None', 'give')
397 397
 		);
398 398
 
399
-		$args = wp_parse_args( $args, $defaults );
399
+		$args = wp_parse_args($args, $defaults);
400 400
 
401
-		if ( $args['multiple'] ) {
401
+		if ($args['multiple']) {
402 402
 			$multiple = ' MULTIPLE';
403 403
 		} else {
404 404
 			$multiple = '';
405 405
 		}
406 406
 
407
-		if ( $args['chosen'] ) {
407
+		if ($args['chosen']) {
408 408
 			$args['class'] .= ' give-select-chosen';
409 409
 		}
410 410
 
411
-		if ( $args['placeholder'] ) {
411
+		if ($args['placeholder']) {
412 412
 			$placeholder = $args['placeholder'];
413 413
 		} else {
414 414
 			$placeholder = '';
415 415
 		}
416 416
 
417 417
 
418
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">';
418
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">';
419 419
 
420
-		if ( $args['show_option_all'] ) {
421
-			if ( $args['multiple'] ) {
422
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
420
+		if ($args['show_option_all']) {
421
+			if ($args['multiple']) {
422
+				$selected = selected(true, in_array(0, $args['selected']), false);
423 423
 			} else {
424
-				$selected = selected( $args['selected'], 0, false );
424
+				$selected = selected($args['selected'], 0, false);
425 425
 			}
426
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
426
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
427 427
 		}
428 428
 
429
-		if ( ! empty( $args['options'] ) ) {
429
+		if ( ! empty($args['options'])) {
430 430
 
431
-			if ( $args['show_option_none'] ) {
432
-				if ( $args['multiple'] ) {
433
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
431
+			if ($args['show_option_none']) {
432
+				if ($args['multiple']) {
433
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
434 434
 				} else {
435
-					$selected = selected( $args['selected'], - 1, false );
435
+					$selected = selected($args['selected'], - 1, false);
436 436
 				}
437
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
437
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
438 438
 			}
439 439
 
440
-			foreach ( $args['options'] as $key => $option ) {
440
+			foreach ($args['options'] as $key => $option) {
441 441
 
442
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
443
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
442
+				if ($args['multiple'] && is_array($args['selected'])) {
443
+					$selected = selected(true, in_array($key, $args['selected']), false);
444 444
 				} else {
445
-					$selected = selected( $args['selected'], $key, false );
445
+					$selected = selected($args['selected'], $key, false);
446 446
 				}
447 447
 
448
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
448
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
449 449
 			}
450 450
 		}
451 451
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return string      The checkbox.
468 468
 	 */
469
-	public function checkbox( $args = array() ) {
469
+	public function checkbox($args = array()) {
470 470
 		$defaults = array(
471 471
 			'name'    => null,
472 472
 			'current' => null,
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
 			)
478 478
 		);
479 479
 
480
-		$args = wp_parse_args( $args, $defaults );
480
+		$args = wp_parse_args($args, $defaults);
481 481
 
482 482
 		$options = '';
483
-		if ( ! empty( $args['options']['disabled'] ) ) {
483
+		if ( ! empty($args['options']['disabled'])) {
484 484
 			$options .= ' disabled="disabled"';
485
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
485
+		} elseif ( ! empty($args['options']['readonly'])) {
486 486
 			$options .= ' readonly';
487 487
 		}
488 488
 
489
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
489
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
490 490
 
491 491
 		return $output;
492 492
 	}
@@ -503,22 +503,22 @@  discard block
 block discarded – undo
503 503
 	 *
504 504
 	 * @return string      The text field.
505 505
 	 */
506
-	public function text( $args = array() ) {
506
+	public function text($args = array()) {
507 507
 		// Backwards compatibility
508
-		if ( func_num_args() > 1 ) {
508
+		if (func_num_args() > 1) {
509 509
 			$args = func_get_args();
510 510
 
511 511
 			$name  = $args[0];
512
-			$value = isset( $args[1] ) ? $args[1] : '';
513
-			$label = isset( $args[2] ) ? $args[2] : '';
514
-			$desc  = isset( $args[3] ) ? $args[3] : '';
512
+			$value = isset($args[1]) ? $args[1] : '';
513
+			$label = isset($args[2]) ? $args[2] : '';
514
+			$desc  = isset($args[3]) ? $args[3] : '';
515 515
 		}
516 516
 
517 517
 		$defaults = array(
518
-			'name'         => isset( $name ) ? $name : 'text',
519
-			'value'        => isset( $value ) ? $value : null,
520
-			'label'        => isset( $label ) ? $label : null,
521
-			'desc'         => isset( $desc ) ? $desc : null,
518
+			'name'         => isset($name) ? $name : 'text',
519
+			'value'        => isset($value) ? $value : null,
520
+			'label'        => isset($label) ? $label : null,
521
+			'desc'         => isset($desc) ? $desc : null,
522 522
 			'placeholder'  => '',
523 523
 			'class'        => 'regular-text',
524 524
 			'disabled'     => false,
@@ -526,29 +526,29 @@  discard block
 block discarded – undo
526 526
 			'data'         => false
527 527
 		);
528 528
 
529
-		$args = wp_parse_args( $args, $defaults );
529
+		$args = wp_parse_args($args, $defaults);
530 530
 
531 531
 		$disabled = '';
532
-		if ( $args['disabled'] ) {
532
+		if ($args['disabled']) {
533 533
 			$disabled = ' disabled="disabled"';
534 534
 		}
535 535
 
536 536
 		$data = '';
537
-		if ( ! empty( $args['data'] ) ) {
538
-			foreach ( $args['data'] as $key => $value ) {
539
-				$data .= 'data-' . $key . '="' . $value . '" ';
537
+		if ( ! empty($args['data'])) {
538
+			foreach ($args['data'] as $key => $value) {
539
+				$data .= 'data-'.$key.'="'.$value.'" ';
540 540
 			}
541 541
 		}
542 542
 
543
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
543
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
544 544
 
545
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
545
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
546 546
 
547
-		if ( ! empty( $args['desc'] ) ) {
548
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
547
+		if ( ! empty($args['desc'])) {
548
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
549 549
 		}
550 550
 
551
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
551
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
552 552
 
553 553
 		$output .= '</span>';
554 554
 
@@ -567,15 +567,15 @@  discard block
 block discarded – undo
567 567
 	 *
568 568
 	 * @return string      The date picker.
569 569
 	 */
570
-	public function date_field( $args = array() ) {
570
+	public function date_field($args = array()) {
571 571
 
572
-		if ( empty( $args['class'] ) ) {
572
+		if (empty($args['class'])) {
573 573
 			$args['class'] = 'give_datepicker';
574
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
574
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
575 575
 			$args['class'] .= ' give_datepicker';
576 576
 		}
577 577
 
578
-		return $this->text( $args );
578
+		return $this->text($args);
579 579
 	}
580 580
 
581 581
 	/**
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return string      The textarea.
592 592
 	 */
593
-	public function textarea( $args = array() ) {
593
+	public function textarea($args = array()) {
594 594
 		$defaults = array(
595 595
 			'name'     => 'textarea',
596 596
 			'value'    => null,
@@ -600,21 +600,21 @@  discard block
 block discarded – undo
600 600
 			'disabled' => false
601 601
 		);
602 602
 
603
-		$args = wp_parse_args( $args, $defaults );
603
+		$args = wp_parse_args($args, $defaults);
604 604
 
605 605
 		$disabled = '';
606
-		if ( $args['disabled'] ) {
606
+		if ($args['disabled']) {
607 607
 			$disabled = ' disabled="disabled"';
608 608
 		}
609 609
 
610
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
610
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
611 611
 
612
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
612
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
613 613
 
614
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
614
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
615 615
 
616
-		if ( ! empty( $args['desc'] ) ) {
617
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
616
+		if ( ! empty($args['desc'])) {
617
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
618 618
 		}
619 619
 
620 620
 		$output .= '</span>';
@@ -634,12 +634,12 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @return string      The text field with ajax search.
636 636
 	 */
637
-	public function ajax_user_search( $args = array() ) {
637
+	public function ajax_user_search($args = array()) {
638 638
 
639 639
 		$defaults = array(
640 640
 			'name'         => 'user_id',
641 641
 			'value'        => null,
642
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
642
+			'placeholder'  => esc_attr__('Enter username', 'give'),
643 643
 			'label'        => null,
644 644
 			'desc'         => null,
645 645
 			'class'        => '',
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
 			'data'         => false
649 649
 		);
650 650
 
651
-		$args = wp_parse_args( $args, $defaults );
651
+		$args = wp_parse_args($args, $defaults);
652 652
 
653
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
653
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
654 654
 
655 655
 		$output = '<span class="give_user_search_wrap">';
656
-		$output .= $this->text( $args );
657
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
656
+		$output .= $this->text($args);
657
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
658 658
 		$output .= '</span>';
659 659
 
660 660
 		return $output;
Please login to merge, or discard this patch.
includes/admin/class-admin-notices.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference.
51 51
 	 *
52
-	 * @return bool
52
+	 * @return false|null
53 53
 	 */
54 54
 	public function give_admin_bar_menu( $wp_admin_bar ) {
55 55
 
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	 * @since 1.0
34 34
 	 */
35 35
 	public function __construct() {
36
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
37
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
38
-		add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000, 1 );
36
+		add_action('admin_notices', array($this, 'show_notices'));
37
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
38
+		add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000, 1);
39 39
 
40 40
 		$this->notices = array(
41 41
 			'updated' => array(),
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return bool
53 53
 	 */
54
-	public function give_admin_bar_menu( $wp_admin_bar ) {
54
+	public function give_admin_bar_menu($wp_admin_bar) {
55 55
 
56
-		if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) {
56
+		if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) {
57 57
 			return false;
58 58
 		}
59 59
 
60 60
 		// Add the main siteadmin menu item.
61
-		$wp_admin_bar->add_menu( array(
61
+		$wp_admin_bar->add_menu(array(
62 62
 			'id'     => 'give-test-notice',
63
-			'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
63
+			'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
64 64
 			'parent' => 'top-secondary',
65
-			'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
66
-			'meta'   => array( 'class' => 'give-test-mode-active' ),
67
-		) );
65
+			'title'  => esc_html__('Give Test Mode Active', 'give'),
66
+			'meta'   => array('class' => 'give-test-mode-active'),
67
+		));
68 68
 
69 69
 	}
70 70
 
@@ -75,100 +75,100 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function show_notices() {
77 77
 
78
-		if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) {
78
+		if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) {
79 79
 			echo '<div class="error">';
80
-			echo '<p>' . esc_html__( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>';
80
+			echo '<p>'.esc_html__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>';
81 81
 			/* translators: %s: http://docs.givewp.com/ajax-blocked */
82
-			echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'http://docs.givewp.com/ajax-blocked' ) ) . '</p>';
83
-			echo '<p><a href="' . add_query_arg( array(
82
+			echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('http://docs.givewp.com/ajax-blocked')).'</p>';
83
+			echo '<p><a href="'.add_query_arg(array(
84 84
 					'give_action' => 'dismiss_notices',
85 85
 					'give_notice' => 'admin_ajax_inaccessible',
86
-				) ) . '">' . esc_html__( 'Dismiss Notice', 'give' ) . '</a></p>';
86
+				)).'">'.esc_html__('Dismiss Notice', 'give').'</a></p>';
87 87
 			echo '</div>';
88 88
 		}
89 89
 
90
-		if ( isset( $_GET['give-message'] ) ) {
90
+		if (isset($_GET['give-message'])) {
91 91
 
92 92
 			// Donation reports errors.
93
-			if ( current_user_can( 'view_give_reports' ) ) {
94
-				switch ( $_GET['give-message'] ) {
93
+			if (current_user_can('view_give_reports')) {
94
+				switch ($_GET['give-message']) {
95 95
 					case 'donation_deleted' :
96
-						$this->notices['updated']['give-donation-deleted'] = esc_attr__( 'The donation has been deleted.', 'give' );
96
+						$this->notices['updated']['give-donation-deleted'] = esc_attr__('The donation has been deleted.', 'give');
97 97
 						break;
98 98
 					case 'email_sent' :
99
-						$this->notices['updated']['give-payment-sent'] = esc_attr__( 'The donation receipt has been resent.', 'give' );
99
+						$this->notices['updated']['give-payment-sent'] = esc_attr__('The donation receipt has been resent.', 'give');
100 100
 						break;
101 101
 					case 'refreshed-reports' :
102
-						$this->notices['updated']['give-refreshed-reports'] = esc_attr__( 'The reports cache has been cleared.', 'give' );
102
+						$this->notices['updated']['give-refreshed-reports'] = esc_attr__('The reports cache has been cleared.', 'give');
103 103
 						break;
104 104
 					case 'donation-note-deleted' :
105
-						$this->notices['updated']['give-donation-note-deleted'] = esc_attr__( 'The donation note has been deleted.', 'give' );
105
+						$this->notices['updated']['give-donation-note-deleted'] = esc_attr__('The donation note has been deleted.', 'give');
106 106
 						break;
107 107
 				}
108 108
 			}
109 109
 
110 110
 			// Give settings notices and errors.
111
-			if ( current_user_can( 'manage_give_settings' ) ) {
112
-				switch ( $_GET['give-message'] ) {
111
+			if (current_user_can('manage_give_settings')) {
112
+				switch ($_GET['give-message']) {
113 113
 					case 'settings-imported' :
114
-						$this->notices['updated']['give-settings-imported'] = esc_attr__( 'The settings have been imported.', 'give' );
114
+						$this->notices['updated']['give-settings-imported'] = esc_attr__('The settings have been imported.', 'give');
115 115
 						break;
116 116
 					case 'api-key-generated' :
117
-						$this->notices['updated']['give-api-key-generated'] = esc_attr__( 'API keys have been generated.', 'give' );
117
+						$this->notices['updated']['give-api-key-generated'] = esc_attr__('API keys have been generated.', 'give');
118 118
 						break;
119 119
 					case 'api-key-exists' :
120
-						$this->notices['error']['give-api-key-exists'] = esc_attr__( 'The specified user already has API keys.', 'give' );
120
+						$this->notices['error']['give-api-key-exists'] = esc_attr__('The specified user already has API keys.', 'give');
121 121
 						break;
122 122
 					case 'api-key-regenerated' :
123
-						$this->notices['updated']['give-api-key-regenerated'] = esc_attr__( 'API keys have been regenerated.', 'give' );
123
+						$this->notices['updated']['give-api-key-regenerated'] = esc_attr__('API keys have been regenerated.', 'give');
124 124
 						break;
125 125
 					case 'api-key-revoked' :
126
-						$this->notices['updated']['give-api-key-revoked'] = esc_attr__( 'API keys have been revoked.', 'give' );
126
+						$this->notices['updated']['give-api-key-revoked'] = esc_attr__('API keys have been revoked.', 'give');
127 127
 						break;
128 128
 					case 'sent-test-email' :
129
-						$this->notices['updated']['give-sent-test-email'] = esc_attr__( 'The test email has been sent.', 'give' );
129
+						$this->notices['updated']['give-sent-test-email'] = esc_attr__('The test email has been sent.', 'give');
130 130
 						break;
131 131
 					case 'matched-success-failure-page':
132
-						$this->notices['updated']['give-matched-success-failure-page'] = esc_html__( 'You cannot set the success and failed pages to the same page', 'give' );
132
+						$this->notices['updated']['give-matched-success-failure-page'] = esc_html__('You cannot set the success and failed pages to the same page', 'give');
133 133
 				}
134 134
 			}
135 135
 			// Payments errors.
136
-			if ( current_user_can( 'edit_give_payments' ) ) {
137
-				switch ( $_GET['give-message'] ) {
136
+			if (current_user_can('edit_give_payments')) {
137
+				switch ($_GET['give-message']) {
138 138
 					case 'note-added' :
139
-						$this->notices['updated']['give-note-added'] = esc_attr__( 'The donation note has been added.', 'give' );
139
+						$this->notices['updated']['give-note-added'] = esc_attr__('The donation note has been added.', 'give');
140 140
 						break;
141 141
 					case 'payment-updated' :
142
-						$this->notices['updated']['give-payment-updated'] = esc_attr__( 'The donation has been updated.', 'give' );
142
+						$this->notices['updated']['give-payment-updated'] = esc_attr__('The donation has been updated.', 'give');
143 143
 						break;
144 144
 				}
145 145
 			}
146 146
 
147 147
 			// Customer Notices.
148
-			if ( current_user_can( 'edit_give_payments' ) ) {
149
-				switch ( $_GET['give-message'] ) {
148
+			if (current_user_can('edit_give_payments')) {
149
+				switch ($_GET['give-message']) {
150 150
 					case 'customer-deleted' :
151
-						$this->notices['updated']['give-customer-deleted'] = esc_attr__( 'The donor has been deleted.', 'give' );
151
+						$this->notices['updated']['give-customer-deleted'] = esc_attr__('The donor has been deleted.', 'give');
152 152
 						break;
153 153
 
154 154
 					case 'email-added' :
155
-						$this->notices['updated']['give-customer-email-added'] = esc_attr__( 'Donor email added', 'give' );
155
+						$this->notices['updated']['give-customer-email-added'] = esc_attr__('Donor email added', 'give');
156 156
 						break;
157 157
 
158 158
 					case 'email-removed' :
159
-						$this->notices['updated']['give-customer-email-removed'] = esc_attr__( 'Donor email removed', 'give' );
159
+						$this->notices['updated']['give-customer-email-removed'] = esc_attr__('Donor email removed', 'give');
160 160
 						break;
161 161
 
162 162
 					case 'email-remove-failed' :
163
-						$this->notices['error']['give-customer-email-remove-failed'] = esc_attr__( 'Failed to remove donor email', 'give' );
163
+						$this->notices['error']['give-customer-email-remove-failed'] = esc_attr__('Failed to remove donor email', 'give');
164 164
 						break;
165 165
 
166 166
 					case 'primary-email-updated' :
167
-						$this->notices['updated']['give-customer-primary-email-updated'] = esc_attr__( 'Primary email updated for donor', 'give' );
167
+						$this->notices['updated']['give-customer-primary-email-updated'] = esc_attr__('Primary email updated for donor', 'give');
168 168
 						break;
169 169
 
170 170
 					case 'primary-email-failed' :
171
-						$this->notices['error']['give-customer-primary-email-failed'] = esc_attr__( 'Failed to set primary email', 'give' );
171
+						$this->notices['error']['give-customer-primary-email-failed'] = esc_attr__('Failed to set primary email', 'give');
172 172
 
173 173
 				}
174 174
 			}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$this->add_payment_bulk_action_notice();
178 178
 
179
-		if ( count( $this->notices['updated'] ) > 0 ) {
180
-			foreach ( $this->notices['updated'] as $notice => $message ) {
181
-				add_settings_error( 'give-notices', $notice, $message, 'updated' );
179
+		if (count($this->notices['updated']) > 0) {
180
+			foreach ($this->notices['updated'] as $notice => $message) {
181
+				add_settings_error('give-notices', $notice, $message, 'updated');
182 182
 			}
183 183
 		}
184 184
 
185
-		if ( count( $this->notices['error'] ) > 0 ) {
186
-			foreach ( $this->notices['error'] as $notice => $message ) {
187
-				add_settings_error( 'give-notices', $notice, $message, 'error' );
185
+		if (count($this->notices['error']) > 0) {
186
+			foreach ($this->notices['error'] as $notice => $message) {
187
+				add_settings_error('give-notices', $notice, $message, 'error');
188 188
 			}
189 189
 		}
190 190
 
191
-		settings_errors( 'give-notices' );
191
+		settings_errors('give-notices');
192 192
 
193 193
 	}
194 194
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	 * @return void
201 201
 	 */
202 202
 	function give_admin_addons_notices() {
203
-		add_settings_error( 'give-notices', 'give-addons-feed-error', esc_attr__( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' );
204
-		settings_errors( 'give-notices' );
203
+		add_settings_error('give-notices', 'give-addons-feed-error', esc_attr__('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error');
204
+		settings_errors('give-notices');
205 205
 	}
206 206
 
207 207
 
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @return void
213 213
 	 */
214 214
 	function dismiss_notices() {
215
-		if ( isset( $_GET['give_notice'] ) ) {
216
-			update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 );
217
-			wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) );
215
+		if (isset($_GET['give_notice'])) {
216
+			update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1);
217
+			wp_redirect(remove_query_arg(array('give_action', 'give_notice')));
218 218
 			exit;
219 219
 		}
220 220
 	}
@@ -229,24 +229,24 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	function add_payment_bulk_action_notice() {
231 231
 		if (
232
-			current_user_can( 'edit_give_payments' )
233
-			&& isset( $_GET['action'] )
234
-			&& ! empty( $_GET['action'] )
235
-			&& isset( $_GET['payment'] )
236
-			&& ! empty( $_GET['payment'] )
232
+			current_user_can('edit_give_payments')
233
+			&& isset($_GET['action'])
234
+			&& ! empty($_GET['action'])
235
+			&& isset($_GET['payment'])
236
+			&& ! empty($_GET['payment'])
237 237
 		) {
238
-			$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
238
+			$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
239 239
 
240
-			switch ( $_GET['action'] ) {
240
+			switch ($_GET['action']) {
241 241
 				case 'delete':
242
-					if ( $payment_count ) {
243
-						$this->notices['updated']['bulk_action_delete'] = sprintf( _n( 'Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give' ), $payment_count );
242
+					if ($payment_count) {
243
+						$this->notices['updated']['bulk_action_delete'] = sprintf(_n('Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give'), $payment_count);
244 244
 					}
245 245
 					break;
246 246
 
247 247
 				case 'resend-receipt':
248
-					if ( $payment_count ) {
249
-						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf( _n( 'Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give' ), $payment_count );
248
+					if ($payment_count) {
249
+						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf(_n('Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give'), $payment_count);
250 250
 					}
251 251
 					break;
252 252
 			}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return string
269 269
 	 */
270
-	public static function notice_html( $message, $type = 'updated' ) {
270
+	public static function notice_html($message, $type = 'updated') {
271 271
 		ob_start();
272 272
 		?>
273 273
 		<div class="<?php echo $type; ?> notice">
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
  *
438 438
  * @param int $form_id Give Form ID
439 439
  *
440
- * @return int $earnings Earnings for a certain form
440
+ * @return double $earnings Earnings for a certain form
441 441
  */
442 442
 function give_get_form_earnings_stats( $form_id = 0 ) {
443 443
 	$give_form = new Give_Donate_Form( $form_id );
Please login to merge, or discard this patch.
Spacing   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
261
-	if ( $extras ) {
260
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
261
+	if ($extras) {
262 262
 		$uri .= $extras;
263 263
 	}
264 264
 
265
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
265
+	return apply_filters('give_get_failed_transaction_uri', $uri);
266 266
 }
267 267
 
268 268
 /**
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function give_is_failed_transaction_page() {
275 275
 	$give_options = give_get_settings();
276
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
276
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
277 277
 
278
-	return apply_filters( 'give_is_failure_page', $ret );
278
+	return apply_filters('give_is_failure_page', $ret);
279 279
 }
280 280
 
281 281
 /**
@@ -287,18 +287,18 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function give_listen_for_failed_payments() {
289 289
 
290
-	$failed_page = give_get_option( 'failure_page', 0 );
290
+	$failed_page = give_get_option('failure_page', 0);
291 291
 
292
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
292
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
293 293
 
294
-		$payment_id = absint( $_GET['payment-id'] );
295
-		give_update_payment_status( $payment_id, 'failed' );
294
+		$payment_id = absint($_GET['payment-id']);
295
+		give_update_payment_status($payment_id, 'failed');
296 296
 
297 297
 	}
298 298
 
299 299
 }
300 300
 
301
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
301
+add_action('template_redirect', 'give_listen_for_failed_payments');
302 302
 
303 303
 /**
304 304
  * Retrieve the Donation History page URI
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 function give_get_history_page_uri() {
312 312
 	$give_options = give_get_settings();
313 313
 
314
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
314
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
315 315
 
316
-	return apply_filters( 'give_get_history_page_uri', $history_page );
316
+	return apply_filters('give_get_history_page_uri', $history_page);
317 317
 }
318 318
 
319 319
 /**
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
  * @since       1.0
327 327
  * @return      bool
328 328
  */
329
-function give_field_is_required( $field = '', $form_id ) {
329
+function give_field_is_required($field = '', $form_id) {
330 330
 
331
-	$required_fields = give_get_required_fields( $form_id );
331
+	$required_fields = give_get_required_fields($form_id);
332 332
 
333
-	return array_key_exists( $field, $required_fields );
333
+	return array_key_exists($field, $required_fields);
334 334
 }
335 335
 
336 336
 /**
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
  *
349 349
  * @return void
350 350
  */
351
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
351
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
352 352
 	global $give_logs;
353 353
 
354 354
 	$log_data = array(
355 355
 		'post_parent'   => $give_form_id,
356 356
 		'log_type'      => 'sale',
357
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
358
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null,
357
+		'post_date'     => isset($sale_date) ? $sale_date : null,
358
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null,
359 359
 	);
360 360
 
361 361
 	$log_meta = array(
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		'price_id'   => (int) $price_id,
364 364
 	);
365 365
 
366
-	$give_logs->insert_log( $log_data, $log_meta );
366
+	$give_logs->insert_log($log_data, $log_meta);
367 367
 }
368 368
 
369 369
 
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
  *
378 378
  * @return bool|int
379 379
  */
380
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
380
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
381 381
 	$quantity = (int) $quantity;
382
-	$form     = new Give_Donate_Form( $form_id );
382
+	$form     = new Give_Donate_Form($form_id);
383 383
 
384
-	return $form->increase_sales( $quantity );
384
+	return $form->increase_sales($quantity);
385 385
 }
386 386
 
387 387
 /**
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
  *
395 395
  * @return bool|int
396 396
  */
397
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
397
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
398 398
 	$quantity = (int) $quantity;
399
-	$form     = new Give_Donate_Form( $form_id );
399
+	$form     = new Give_Donate_Form($form_id);
400 400
 
401
-	return $form->decrease_sales( $quantity );
401
+	return $form->decrease_sales($quantity);
402 402
 }
403 403
 
404 404
 /**
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
  *
412 412
  * @return bool|int
413 413
  */
414
-function give_increase_earnings( $give_form_id = 0, $amount ) {
415
-	$form = new Give_Donate_Form( $give_form_id );
414
+function give_increase_earnings($give_form_id = 0, $amount) {
415
+	$form = new Give_Donate_Form($give_form_id);
416 416
 
417
-	return $form->increase_earnings( $amount );
417
+	return $form->increase_earnings($amount);
418 418
 }
419 419
 
420 420
 /**
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
  *
428 428
  * @return bool|int
429 429
  */
430
-function give_decrease_earnings( $form_id = 0, $amount ) {
431
-	$form = new Give_Donate_Form( $form_id );
430
+function give_decrease_earnings($form_id = 0, $amount) {
431
+	$form = new Give_Donate_Form($form_id);
432 432
 
433
-	return $form->decrease_earnings( $amount );
433
+	return $form->decrease_earnings($amount);
434 434
 }
435 435
 
436 436
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
  *
444 444
  * @return int $earnings Earnings for a certain form
445 445
  */
446
-function give_get_form_earnings_stats( $form_id = 0 ) {
447
-	$give_form = new Give_Donate_Form( $form_id );
446
+function give_get_form_earnings_stats($form_id = 0) {
447
+	$give_form = new Give_Donate_Form($form_id);
448 448
 
449 449
 	return $give_form->earnings;
450 450
 }
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
  *
460 460
  * @return int $sales Amount of sales for a certain form
461 461
  */
462
-function give_get_form_sales_stats( $give_form_id = 0 ) {
463
-	$give_form = new Give_Donate_Form( $give_form_id );
462
+function give_get_form_sales_stats($give_form_id = 0) {
463
+	$give_form = new Give_Donate_Form($give_form_id);
464 464
 
465 465
 	return $give_form->sales;
466 466
 }
@@ -475,16 +475,16 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return float $sales Average monthly sales
477 477
  */
478
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
479
-	$sales        = give_get_form_sales_stats( $form_id );
480
-	$release_date = get_post_field( 'post_date', $form_id );
478
+function give_get_average_monthly_form_sales($form_id = 0) {
479
+	$sales        = give_get_form_sales_stats($form_id);
480
+	$release_date = get_post_field('post_date', $form_id);
481 481
 
482
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
482
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
483 483
 
484
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
484
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
485 485
 
486
-	if ( $months > 0 ) {
487
-		$sales = ( $sales / $months );
486
+	if ($months > 0) {
487
+		$sales = ($sales / $months);
488 488
 	}
489 489
 
490 490
 	return $sales;
@@ -500,16 +500,16 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return float $earnings Average monthly earnings
502 502
  */
503
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
504
-	$earnings     = give_get_form_earnings_stats( $form_id );
505
-	$release_date = get_post_field( 'post_date', $form_id );
503
+function give_get_average_monthly_form_earnings($form_id = 0) {
504
+	$earnings     = give_get_form_earnings_stats($form_id);
505
+	$release_date = get_post_field('post_date', $form_id);
506 506
 
507
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
507
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
508 508
 
509
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
509
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
510 510
 
511
-	if ( $months > 0 ) {
512
-		$earnings = ( $earnings / $months );
511
+	if ($months > 0) {
512
+		$earnings = ($earnings / $months);
513 513
 	}
514 514
 
515 515
 	return $earnings < 0 ? 0 : $earnings;
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
  *
530 530
  * @return string $price_name Name of the price option
531 531
  */
532
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
532
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
533 533
 
534
-	$prices     = give_get_variable_prices( $form_id );
534
+	$prices     = give_get_variable_prices($form_id);
535 535
 	$price_name = '';
536 536
 
537
-	foreach ( $prices as $price ) {
537
+	foreach ($prices as $price) {
538 538
 
539
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
539
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
540 540
 
541
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
542
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
543
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
541
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
542
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
543
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
544 544
 
545 545
 		}
546 546
 	}
547 547
 
548
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
548
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
549 549
 }
550 550
 
551 551
 
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
  *
559 559
  * @return string $range A fully formatted price range
560 560
  */
561
-function give_price_range( $form_id = 0 ) {
562
-	$low   = give_get_lowest_price_option( $form_id );
563
-	$high  = give_get_highest_price_option( $form_id );
564
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
561
+function give_price_range($form_id = 0) {
562
+	$low   = give_get_lowest_price_option($form_id);
563
+	$high  = give_get_highest_price_option($form_id);
564
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
565 565
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
566
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
566
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
567 567
 
568
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
568
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
569 569
 }
570 570
 
571 571
 
@@ -580,35 +580,35 @@  discard block
 block discarded – undo
580 580
  *
581 581
  * @return int ID of the lowest price
582 582
  */
583
-function give_get_lowest_price_id( $form_id = 0 ) {
583
+function give_get_lowest_price_id($form_id = 0) {
584 584
 
585
-	if ( empty( $form_id ) ) {
585
+	if (empty($form_id)) {
586 586
 		$form_id = get_the_ID();
587 587
 	}
588 588
 
589
-	if ( ! give_has_variable_prices( $form_id ) ) {
590
-		return give_get_form_price( $form_id );
589
+	if ( ! give_has_variable_prices($form_id)) {
590
+		return give_get_form_price($form_id);
591 591
 	}
592 592
 
593
-	$prices = give_get_variable_prices( $form_id );
593
+	$prices = give_get_variable_prices($form_id);
594 594
 
595 595
 	$min = $min_id = 0;
596 596
 
597
-	if ( ! empty( $prices ) ) {
597
+	if ( ! empty($prices)) {
598 598
 
599
-		foreach ( $prices as $key => $price ) {
599
+		foreach ($prices as $key => $price) {
600 600
 
601
-			if ( empty( $price['_give_amount'] ) ) {
601
+			if (empty($price['_give_amount'])) {
602 602
 				continue;
603 603
 			}
604 604
 
605
-			if ( ! isset( $min ) ) {
605
+			if ( ! isset($min)) {
606 606
 				$min = $price['_give_amount'];
607 607
 			} else {
608
-				$min = min( $min, $price['_give_amount'] );
608
+				$min = min($min, $price['_give_amount']);
609 609
 			}
610 610
 
611
-			if ( $price['_give_amount'] == $min ) {
611
+			if ($price['_give_amount'] == $min) {
612 612
 				$min_id = $price['_give_id']['level_id'];
613 613
 			}
614 614
 		}
@@ -626,45 +626,45 @@  discard block
 block discarded – undo
626 626
  *
627 627
  * @return float Amount of the lowest price
628 628
  */
629
-function give_get_lowest_price_option( $form_id = 0 ) {
630
-	if ( empty( $form_id ) ) {
629
+function give_get_lowest_price_option($form_id = 0) {
630
+	if (empty($form_id)) {
631 631
 		$form_id = get_the_ID();
632 632
 	}
633 633
 
634
-	if ( ! give_has_variable_prices( $form_id ) ) {
635
-		return give_get_form_price( $form_id );
634
+	if ( ! give_has_variable_prices($form_id)) {
635
+		return give_get_form_price($form_id);
636 636
 	}
637 637
 
638
-	$prices = give_get_variable_prices( $form_id );
638
+	$prices = give_get_variable_prices($form_id);
639 639
 
640 640
 	$low = 0;
641 641
 
642
-	if ( ! empty( $prices ) ) {
642
+	if ( ! empty($prices)) {
643 643
 
644 644
 		$min = $min_id = 0;
645 645
 
646
-		foreach ( $prices as $key => $price ) {
646
+		foreach ($prices as $key => $price) {
647 647
 
648
-			if ( empty( $price['_give_amount'] ) ) {
648
+			if (empty($price['_give_amount'])) {
649 649
 				continue;
650 650
 			}
651 651
 
652
-			if ( ! isset( $min ) ) {
652
+			if ( ! isset($min)) {
653 653
 				$min = $price['_give_amount'];
654 654
 			} else {
655
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
655
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
656 656
 			}
657 657
 
658
-			if ( $price['_give_amount'] == $min ) {
658
+			if ($price['_give_amount'] == $min) {
659 659
 				$min_id = $key;
660 660
 			}
661 661
 		}
662 662
 
663
-		$low = $prices[ $min_id ]['_give_amount'];
663
+		$low = $prices[$min_id]['_give_amount'];
664 664
 
665 665
 	}
666 666
 
667
-	return give_sanitize_amount( $low );
667
+	return give_sanitize_amount($low);
668 668
 }
669 669
 
670 670
 /**
@@ -676,41 +676,41 @@  discard block
 block discarded – undo
676 676
  *
677 677
  * @return float Amount of the highest price
678 678
  */
679
-function give_get_highest_price_option( $form_id = 0 ) {
679
+function give_get_highest_price_option($form_id = 0) {
680 680
 
681
-	if ( empty( $form_id ) ) {
681
+	if (empty($form_id)) {
682 682
 		$form_id = get_the_ID();
683 683
 	}
684 684
 
685
-	if ( ! give_has_variable_prices( $form_id ) ) {
686
-		return give_get_form_price( $form_id );
685
+	if ( ! give_has_variable_prices($form_id)) {
686
+		return give_get_form_price($form_id);
687 687
 	}
688 688
 
689
-	$prices = give_get_variable_prices( $form_id );
689
+	$prices = give_get_variable_prices($form_id);
690 690
 
691 691
 	$high = 0.00;
692 692
 
693
-	if ( ! empty( $prices ) ) {
693
+	if ( ! empty($prices)) {
694 694
 
695 695
 		$max_id = $max = 0;
696 696
 
697
-		foreach ( $prices as $key => $price ) {
698
-			if ( empty( $price['_give_amount'] ) ) {
697
+		foreach ($prices as $key => $price) {
698
+			if (empty($price['_give_amount'])) {
699 699
 				continue;
700 700
 			}
701
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
701
+			$give_amount = give_sanitize_amount($price['_give_amount']);
702 702
 
703
-			$max = max( $max, $give_amount );
703
+			$max = max($max, $give_amount);
704 704
 
705
-			if ( $give_amount == $max ) {
705
+			if ($give_amount == $max) {
706 706
 				$max_id = $key;
707 707
 			}
708 708
 		}
709 709
 
710
-		$high = $prices[ $max_id ]['_give_amount'];
710
+		$high = $prices[$max_id]['_give_amount'];
711 711
 	}
712 712
 
713
-	return give_sanitize_amount( $high );
713
+	return give_sanitize_amount($high);
714 714
 }
715 715
 
716 716
 /**
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return mixed string|int Price of the form
724 724
  */
725
-function give_get_form_price( $form_id = 0 ) {
725
+function give_get_form_price($form_id = 0) {
726 726
 
727
-	if ( empty( $form_id ) ) {
727
+	if (empty($form_id)) {
728 728
 		return false;
729 729
 	}
730 730
 
731
-	$form = new Give_Donate_Form( $form_id );
731
+	$form = new Give_Donate_Form($form_id);
732 732
 
733
-	return $form->__get( 'price' );
733
+	return $form->__get('price');
734 734
 }
735 735
 
736 736
 /**
@@ -742,15 +742,15 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @return mixed string|int Minimum price of the form
744 744
  */
745
-function give_get_form_minimum_price( $form_id = 0 ) {
745
+function give_get_form_minimum_price($form_id = 0) {
746 746
 
747
-	if ( empty( $form_id ) ) {
747
+	if (empty($form_id)) {
748 748
 		return false;
749 749
 	}
750 750
 
751
-	$form = new Give_Donate_Form( $form_id );
751
+	$form = new Give_Donate_Form($form_id);
752 752
 
753
-	return $form->__get( 'minimum_price' );
753
+	return $form->__get('minimum_price');
754 754
 
755 755
 }
756 756
 
@@ -765,51 +765,51 @@  discard block
 block discarded – undo
765 765
  *
766 766
  * @return int $formatted_price
767 767
  */
768
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
768
+function give_price($form_id = 0, $echo = true, $price_id = false) {
769 769
 
770
-	if ( empty( $form_id ) ) {
770
+	if (empty($form_id)) {
771 771
 		$form_id = get_the_ID();
772 772
 	}
773 773
 
774
-	if ( give_has_variable_prices( $form_id ) ) {
774
+	if (give_has_variable_prices($form_id)) {
775 775
 
776
-		$prices = give_get_variable_prices( $form_id );
776
+		$prices = give_get_variable_prices($form_id);
777 777
 
778
-		if ( false !== $price_id ) {
778
+		if (false !== $price_id) {
779 779
 
780 780
 			// loop through multi-prices to see which is default
781
-			foreach ( $prices as $price ) {
781
+			foreach ($prices as $price) {
782 782
 				// this is the default price
783
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
783
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
784 784
 					$price = (float) $price['_give_amount'];
785 785
 				};
786 786
 			}
787 787
 		} else {
788 788
 
789
-			$price = give_get_lowest_price_option( $form_id );
789
+			$price = give_get_lowest_price_option($form_id);
790 790
 		}
791 791
 
792
-		$price = give_sanitize_amount( $price );
792
+		$price = give_sanitize_amount($price);
793 793
 
794 794
 	} else {
795 795
 
796
-		$price = give_get_form_price( $form_id );
796
+		$price = give_get_form_price($form_id);
797 797
 
798 798
 	}
799 799
 
800
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
801
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
802
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
800
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
801
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
802
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
803 803
 
804
-	if ( $echo ) {
804
+	if ($echo) {
805 805
 		echo $formatted_price;
806 806
 	} else {
807 807
 		return $formatted_price;
808 808
 	}
809 809
 }
810 810
 
811
-add_filter( 'give_form_price', 'give_format_amount', 10 );
812
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
811
+add_filter('give_form_price', 'give_format_amount', 10);
812
+add_filter('give_form_price', 'give_currency_filter', 20);
813 813
 
814 814
 
815 815
 /**
@@ -822,19 +822,19 @@  discard block
 block discarded – undo
822 822
  *
823 823
  * @return float $amount Amount of the price option
824 824
  */
825
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
826
-	$prices = give_get_variable_prices( $form_id );
825
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
826
+	$prices = give_get_variable_prices($form_id);
827 827
 
828 828
 	$amount = 0.00;
829 829
 
830
-	foreach ( $prices as $price ) {
831
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
832
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
830
+	foreach ($prices as $price) {
831
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
832
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
833 833
 			break;
834 834
 		};
835 835
 	}
836 836
 
837
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
837
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
838 838
 }
839 839
 
840 840
 /**
@@ -846,13 +846,13 @@  discard block
 block discarded – undo
846 846
  *
847 847
  * @return mixed string|int Goal of the form
848 848
  */
849
-function give_get_form_goal( $form_id = 0 ) {
849
+function give_get_form_goal($form_id = 0) {
850 850
 
851
-	if ( empty( $form_id ) ) {
851
+	if (empty($form_id)) {
852 852
 		return false;
853 853
 	}
854 854
 
855
-	$form = new Give_Donate_Form( $form_id );
855
+	$form = new Give_Donate_Form($form_id);
856 856
 
857 857
 	return $form->goal;
858 858
 
@@ -868,27 +868,27 @@  discard block
 block discarded – undo
868 868
  *
869 869
  * @return string $formatted_goal
870 870
  */
871
-function give_goal( $form_id = 0, $echo = true ) {
871
+function give_goal($form_id = 0, $echo = true) {
872 872
 
873
-	if ( empty( $form_id ) ) {
873
+	if (empty($form_id)) {
874 874
 		$form_id = get_the_ID();
875 875
 	}
876 876
 
877
-	$goal = give_get_form_goal( $form_id );
877
+	$goal = give_get_form_goal($form_id);
878 878
 
879
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
880
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
881
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
879
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
880
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
881
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
882 882
 
883
-	if ( $echo ) {
883
+	if ($echo) {
884 884
 		echo $formatted_goal;
885 885
 	} else {
886 886
 		return $formatted_goal;
887 887
 	}
888 888
 }
889 889
 
890
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
891
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
890
+add_filter('give_form_goal', 'give_format_amount', 10);
891
+add_filter('give_form_goal', 'give_currency_filter', 20);
892 892
 
893 893
 
894 894
 /**
@@ -900,12 +900,12 @@  discard block
 block discarded – undo
900 900
  *
901 901
  * @return bool  $ret Whether or not the logged_in_only setting is set
902 902
  */
903
-function give_logged_in_only( $form_id ) {
903
+function give_logged_in_only($form_id) {
904 904
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
905 905
 	// Other wise it is member only donation form.
906
-	$ret = ! give_is_setting_enabled( get_post_meta( $form_id, '_give_logged_in_only', true ) );
906
+	$ret = ! give_is_setting_enabled(get_post_meta($form_id, '_give_logged_in_only', true));
907 907
 
908
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
908
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
909 909
 }
910 910
 
911 911
 
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
  *
919 919
  * @return string
920 920
  */
921
-function give_show_login_register_option( $form_id ) {
921
+function give_show_login_register_option($form_id) {
922 922
 
923
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
923
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
924 924
 
925
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
925
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
926 926
 
927 927
 }
928 928
 
@@ -938,12 +938,12 @@  discard block
 block discarded – undo
938 938
  *
939 939
  * @return array
940 940
  */
941
-function _give_get_prefill_form_field_values( $form_id ) {
941
+function _give_get_prefill_form_field_values($form_id) {
942 942
 	$logged_in_donor_info = array();
943 943
 
944
-	if ( is_user_logged_in() ) :
945
-		$donor_data    = get_userdata( get_current_user_id() );
946
-		$donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
944
+	if (is_user_logged_in()) :
945
+		$donor_data    = get_userdata(get_current_user_id());
946
+		$donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
947 947
 
948 948
 		$logged_in_donor_info = array(
949 949
 			// First name.
@@ -956,42 +956,42 @@  discard block
 block discarded – undo
956 956
 			'give_email'      => $donor_data->user_email,
957 957
 
958 958
 			// Street address 1.
959
-			'card_address'    => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ),
959
+			'card_address'    => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''),
960 960
 
961 961
 			// Street address 2.
962
-			'card_address_2'  => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ),
962
+			'card_address_2'  => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''),
963 963
 
964 964
 			// Country.
965
-			'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ),
965
+			'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''),
966 966
 
967 967
 			// State.
968
-			'card_state'      => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ),
968
+			'card_state'      => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''),
969 969
 
970 970
 			// City.
971
-			'card_city'       => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ),
971
+			'card_city'       => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''),
972 972
 
973 973
 			// Zipcode
974
-			'card_zip'        => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ),
974
+			'card_zip'        => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''),
975 975
 		);
976 976
 	endif;
977 977
 
978 978
 	// Bailout: Auto fill form field values only form form which donor is donating.
979 979
 	if (
980
-		empty( $_GET['form-id'] )
980
+		empty($_GET['form-id'])
981 981
 		|| ! $form_id
982
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
982
+		|| ($form_id !== absint($_GET['form-id']))
983 983
 	) {
984 984
 		return $logged_in_donor_info;
985 985
 	}
986 986
 
987 987
 	// Get purchase data.
988
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
988
+	$give_purchase_data = Give()->session->get('give_purchase');
989 989
 
990 990
 	// Get donor info from form data.
991
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
991
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
992 992
 		? array()
993 993
 		: $give_purchase_data['post_data'];
994 994
 
995 995
 	// Output.
996
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
996
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
997 997
 }
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @param  int|bool $payment_id A given payment
394 394
 	 *
395
-	 * @return mixed void|false
395
+	 * @return false|null void|false
396 396
 	 */
397 397
 	public function __construct( $payment_id = false ) {
398 398
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 *
464 464
 	 * @param  string $name The attribute to get
465 465
 	 *
466
-	 * @return boolean       If the item is set or not
466
+	 * @return boolean|null       If the item is set or not
467 467
 	 */
468 468
 	public function __isset( $name ) {
469 469
 		if ( property_exists( $this, $name ) ) {
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 	 *
1303 1303
 	 * @param  string $note The note to add
1304 1304
 	 *
1305
-	 * @return void
1305
+	 * @return false|null
1306 1306
 	 */
1307 1307
 	public function add_note( $note = false ) {
1308 1308
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1050,7 +1050,7 @@
 block discarded – undo
1050 1050
 					// Find a match between price_id and level_id.
1051 1051
 					// First verify array keys exists THEN make the match.
1052 1052
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1053
-					     && $args['price_id'] == $price['_give_id']['level_id']
1053
+						 && $args['price_id'] == $price['_give_id']['level_id']
1054 1054
 					) {
1055 1055
 						$item_price = $price['_give_amount'];
1056 1056
 					}
Please login to merge, or discard this patch.
Spacing   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed void|false
396 396
 	 */
397
-	public function __construct( $payment_id = false ) {
397
+	public function __construct($payment_id = false) {
398 398
 
399
-		if ( empty( $payment_id ) ) {
399
+		if (empty($payment_id)) {
400 400
 			return false;
401 401
 		}
402 402
 
403
-		$this->setup_payment( $payment_id );
403
+		$this->setup_payment($payment_id);
404 404
 	}
405 405
 
406 406
 	/**
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	 *
414 414
 	 * @return mixed        The value.
415 415
 	 */
416
-	public function __get( $key ) {
416
+	public function __get($key) {
417 417
 
418
-		if ( method_exists( $this, 'get_' . $key ) ) {
418
+		if (method_exists($this, 'get_'.$key)) {
419 419
 
420
-			$value = call_user_func( array( $this, 'get_' . $key ) );
420
+			$value = call_user_func(array($this, 'get_'.$key));
421 421
 
422 422
 		} else {
423 423
 
@@ -439,18 +439,18 @@  discard block
 block discarded – undo
439 439
 	 * @param  string $key   The property name
440 440
 	 * @param  mixed  $value The value of the property
441 441
 	 */
442
-	public function __set( $key, $value ) {
443
-		$ignore = array( '_ID' );
442
+	public function __set($key, $value) {
443
+		$ignore = array('_ID');
444 444
 
445
-		if ( $key === 'status' ) {
445
+		if ($key === 'status') {
446 446
 			$this->old_status = $this->status;
447 447
 		}
448 448
 
449
-		if ( ! in_array( $key, $ignore ) ) {
450
-			$this->pending[ $key ] = $value;
449
+		if ( ! in_array($key, $ignore)) {
450
+			$this->pending[$key] = $value;
451 451
 		}
452 452
 
453
-		if ( '_ID' !== $key ) {
453
+		if ('_ID' !== $key) {
454 454
 			$this->$key = $value;
455 455
 		}
456 456
 	}
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 	 *
466 466
 	 * @return boolean       If the item is set or not
467 467
 	 */
468
-	public function __isset( $name ) {
469
-		if ( property_exists( $this, $name ) ) {
470
-			return false === empty( $this->$name );
468
+	public function __isset($name) {
469
+		if (property_exists($this, $name)) {
470
+			return false === empty($this->$name);
471 471
 		} else {
472 472
 			return null;
473 473
 		}
@@ -483,20 +483,20 @@  discard block
 block discarded – undo
483 483
 	 *
484 484
 	 * @return bool            If the setup was successful or not
485 485
 	 */
486
-	private function setup_payment( $payment_id ) {
486
+	private function setup_payment($payment_id) {
487 487
 		$this->pending = array();
488 488
 
489
-		if ( empty( $payment_id ) ) {
489
+		if (empty($payment_id)) {
490 490
 			return false;
491 491
 		}
492 492
 
493
-		$payment = get_post( $payment_id );
493
+		$payment = get_post($payment_id);
494 494
 
495
-		if ( ! $payment || is_wp_error( $payment ) ) {
495
+		if ( ! $payment || is_wp_error($payment)) {
496 496
 			return false;
497 497
 		}
498 498
 
499
-		if ( 'give_payment' !== $payment->post_type ) {
499
+		if ('give_payment' !== $payment->post_type) {
500 500
 			return false;
501 501
 		}
502 502
 
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
 		 * @param Give_Payment $this       Payment object.
511 511
 		 * @param int          $payment_id The ID of the payment.
512 512
 		 */
513
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
513
+		do_action('give_pre_setup_payment', $this, $payment_id);
514 514
 
515 515
 		// Primary Identifier.
516
-		$this->ID = absint( $payment_id );
516
+		$this->ID = absint($payment_id);
517 517
 
518 518
 		// Protected ID that can never be changed.
519
-		$this->_ID = absint( $payment_id );
519
+		$this->_ID = absint($payment_id);
520 520
 
521 521
 		// We have a payment, get the generic payment_meta item to reduce calls to it.
522 522
 		$this->payment_meta = $this->get_meta();
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		$this->parent_payment = $payment->post_parent;
532 532
 
533 533
 		$all_payment_statuses  = give_get_payment_statuses();
534
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
534
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
535 535
 
536 536
 		// Items.
537 537
 		$this->fees = $this->setup_fees();
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 		 * @param Give_Payment $this       Payment object.
574 574
 		 * @param int          $payment_id The ID of the payment.
575 575
 		 */
576
-		do_action( 'give_setup_payment', $this, $payment_id );
576
+		do_action('give_setup_payment', $this, $payment_id);
577 577
 
578 578
 		return true;
579 579
 	}
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 	 *
592 592
 	 * @return void
593 593
 	 */
594
-	public function update_payment_setup( $payment_id ) {
595
-		$this->setup_payment( $payment_id );
594
+	public function update_payment_setup($payment_id) {
595
+		$this->setup_payment($payment_id);
596 596
 	}
597 597
 
598 598
 	/**
@@ -607,24 +607,24 @@  discard block
 block discarded – undo
607 607
 
608 608
 		// Construct the payment title.
609 609
 		$payment_title = '';
610
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
611
-			$payment_title = $this->first_name . ' ' . $this->last_name;
612
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
610
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
611
+			$payment_title = $this->first_name.' '.$this->last_name;
612
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
613 613
 			$payment_title = $this->first_name;
614
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
614
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
615 615
 			$payment_title = $this->email;
616 616
 		}
617 617
 
618 618
 		// Set Key.
619
-		if ( empty( $this->key ) ) {
619
+		if (empty($this->key)) {
620 620
 
621
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
622
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
621
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
622
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
623 623
 			$this->pending['key'] = $this->key;
624 624
 		}
625 625
 
626 626
 		// Set IP.
627
-		if ( empty( $this->ip ) ) {
627
+		if (empty($this->ip)) {
628 628
 
629 629
 			$this->ip            = give_get_ip();
630 630
 			$this->pending['ip'] = $this->ip;
@@ -651,63 +651,63 @@  discard block
 block discarded – undo
651 651
 			'fees'         => $this->fees,
652 652
 		);
653 653
 
654
-		$args = apply_filters( 'give_insert_payment_args', array(
654
+		$args = apply_filters('give_insert_payment_args', array(
655 655
 			'post_title'    => $payment_title,
656 656
 			'post_status'   => $this->status,
657 657
 			'post_type'     => 'give_payment',
658
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
659
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
658
+			'post_date'     => ! empty($this->date) ? $this->date : null,
659
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
660 660
 			'post_parent'   => $this->parent_payment,
661
-		), $payment_data );
661
+		), $payment_data);
662 662
 
663 663
 		// Create a blank payment
664
-		$payment_id = wp_insert_post( $args );
664
+		$payment_id = wp_insert_post($args);
665 665
 
666
-		if ( ! empty( $payment_id ) ) {
666
+		if ( ! empty($payment_id)) {
667 667
 
668 668
 			$this->ID  = $payment_id;
669 669
 			$this->_ID = $payment_id;
670 670
 
671 671
 			$customer = new stdClass;
672 672
 
673
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
674
-				$customer = new Give_Customer( get_current_user_id(), true );
673
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
674
+				$customer = new Give_Customer(get_current_user_id(), true);
675 675
 
676 676
 				// Customer is logged in but used a different email to purchase with so assign to their customer record
677
-				if ( ! empty( $customer->id ) && $this->email != $customer->email ) {
678
-					$customer->add_email( $this->email );
677
+				if ( ! empty($customer->id) && $this->email != $customer->email) {
678
+					$customer->add_email($this->email);
679 679
 				}
680 680
 			}
681 681
 
682
-			if ( empty( $customer->id ) ) {
683
-				$customer = new Give_Customer( $this->email );
682
+			if (empty($customer->id)) {
683
+				$customer = new Give_Customer($this->email);
684 684
 			}
685 685
 
686
-			if ( empty( $customer->id ) ) {
686
+			if (empty($customer->id)) {
687 687
 
688 688
 				$customer_data = array(
689
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
689
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
690 690
 					'email'   => $this->email,
691 691
 					'user_id' => $this->user_id,
692 692
 				);
693 693
 
694
-				$customer->create( $customer_data );
694
+				$customer->create($customer_data);
695 695
 
696 696
 			}
697 697
 
698 698
 			$this->customer_id            = $customer->id;
699 699
 			$this->pending['customer_id'] = $this->customer_id;
700
-			$customer->attach_payment( $this->ID, false );
700
+			$customer->attach_payment($this->ID, false);
701 701
 
702
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
703
-			if ( ! empty( $this->payment_meta['fees'] ) ) {
704
-				$this->fees = array_merge( $this->fees, $this->payment_meta['fees'] );
705
-				foreach ( $this->fees as $fee ) {
706
-					$this->increase_fees( $fee['amount'] );
702
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
703
+			if ( ! empty($this->payment_meta['fees'])) {
704
+				$this->fees = array_merge($this->fees, $this->payment_meta['fees']);
705
+				foreach ($this->fees as $fee) {
706
+					$this->increase_fees($fee['amount']);
707 707
 				}
708 708
 			}
709 709
 
710
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
710
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
711 711
 			$this->new = true;
712 712
 		}
713 713
 
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 		$saved = false;
730 730
 
731 731
 		// Must have an ID.
732
-		if ( empty( $this->ID ) ) {
732
+		if (empty($this->ID)) {
733 733
 
734 734
 			$payment_id = $this->insert_payment();
735 735
 
736
-			if ( false === $payment_id ) {
736
+			if (false === $payment_id) {
737 737
 				$saved = false;
738 738
 			} else {
739 739
 				$this->ID = $payment_id;
@@ -741,48 +741,48 @@  discard block
 block discarded – undo
741 741
 		}
742 742
 
743 743
 		// Set ID if not matching.
744
-		if ( $this->ID !== $this->_ID ) {
744
+		if ($this->ID !== $this->_ID) {
745 745
 			$this->ID = $this->_ID;
746 746
 		}
747 747
 
748 748
 		// If we have something pending, let's save it.
749
-		if ( ! empty( $this->pending ) ) {
749
+		if ( ! empty($this->pending)) {
750 750
 
751 751
 			$total_increase = 0;
752 752
 			$total_decrease = 0;
753 753
 
754
-			foreach ( $this->pending as $key => $value ) {
754
+			foreach ($this->pending as $key => $value) {
755 755
 
756
-				switch ( $key ) {
756
+				switch ($key) {
757 757
 
758 758
 					case 'donations':
759 759
 						// Update totals for pending donations.
760
-						foreach ( $this->pending[ $key ] as $item ) {
760
+						foreach ($this->pending[$key] as $item) {
761 761
 
762
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
763
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
762
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
763
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
764 764
 
765
-							switch ( $item['action'] ) {
765
+							switch ($item['action']) {
766 766
 
767 767
 								case 'add':
768 768
 
769 769
 									$price = $item['price'];
770 770
 
771
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
771
+									if ('publish' === $this->status || 'complete' === $this->status) {
772 772
 
773 773
 										// Add sales logs.
774
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
774
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
775 775
 
776 776
 										$y = 0;
777
-										while ( $y < $quantity ) {
777
+										while ($y < $quantity) {
778 778
 
779
-											give_record_sale_in_log( $item['id'], $this->ID, $price_id, $log_date );
780
-											$y ++;
779
+											give_record_sale_in_log($item['id'], $this->ID, $price_id, $log_date);
780
+											$y++;
781 781
 										}
782 782
 
783
-										$form = new Give_Donate_Form( $item['id'] );
784
-										$form->increase_sales( $quantity );
785
-										$form->increase_earnings( $price );
783
+										$form = new Give_Donate_Form($item['id']);
784
+										$form->increase_sales($quantity);
785
+										$form->increase_earnings($price);
786 786
 
787 787
 										$total_increase += $price;
788 788
 									}
@@ -807,15 +807,15 @@  discard block
 block discarded – undo
807 807
 										),
808 808
 									);
809 809
 
810
-									$found_logs = get_posts( $log_args );
811
-									foreach ( $found_logs as $log ) {
812
-										wp_delete_post( $log->ID, true );
810
+									$found_logs = get_posts($log_args);
811
+									foreach ($found_logs as $log) {
812
+										wp_delete_post($log->ID, true);
813 813
 									}
814 814
 
815
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
816
-										$form = new Give_Donate_Form( $item['id'] );
817
-										$form->decrease_sales( $quantity );
818
-										$form->decrease_earnings( $item['amount'] );
815
+									if ('publish' === $this->status || 'complete' === $this->status) {
816
+										$form = new Give_Donate_Form($item['id']);
817
+										$form->decrease_sales($quantity);
818
+										$form->decrease_earnings($item['amount']);
819 819
 
820 820
 										$total_decrease += $item['amount'];
821 821
 									}
@@ -827,17 +827,17 @@  discard block
 block discarded – undo
827 827
 
828 828
 					case 'fees':
829 829
 
830
-						if ( 'publish' !== $this->status && 'complete' !== $this->status ) {
830
+						if ('publish' !== $this->status && 'complete' !== $this->status) {
831 831
 							break;
832 832
 						}
833 833
 
834
-						if ( empty( $this->pending[ $key ] ) ) {
834
+						if (empty($this->pending[$key])) {
835 835
 							break;
836 836
 						}
837 837
 
838
-						foreach ( $this->pending[ $key ] as $fee ) {
838
+						foreach ($this->pending[$key] as $fee) {
839 839
 
840
-							switch ( $fee['action'] ) {
840
+							switch ($fee['action']) {
841 841
 
842 842
 								case 'add':
843 843
 									$total_increase += $fee['amount'];
@@ -853,43 +853,43 @@  discard block
 block discarded – undo
853 853
 						break;
854 854
 
855 855
 					case 'status':
856
-						$this->update_status( $this->status );
856
+						$this->update_status($this->status);
857 857
 						break;
858 858
 
859 859
 					case 'gateway':
860
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
860
+						$this->update_meta('_give_payment_gateway', $this->gateway);
861 861
 						break;
862 862
 
863 863
 					case 'mode':
864
-						$this->update_meta( '_give_payment_mode', $this->mode );
864
+						$this->update_meta('_give_payment_mode', $this->mode);
865 865
 						break;
866 866
 
867 867
 					case 'transaction_id':
868
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
868
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
869 869
 						break;
870 870
 
871 871
 					case 'ip':
872
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
872
+						$this->update_meta('_give_payment_user_ip', $this->ip);
873 873
 						break;
874 874
 
875 875
 					case 'customer_id':
876
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
876
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
877 877
 						break;
878 878
 
879 879
 					case 'user_id':
880
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
880
+						$this->update_meta('_give_payment_user_id', $this->user_id);
881 881
 						break;
882 882
 
883 883
 					case 'form_title':
884
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
884
+						$this->update_meta('_give_payment_form_title', $this->form_title);
885 885
 						break;
886 886
 
887 887
 					case 'form_id':
888
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
888
+						$this->update_meta('_give_payment_form_id', $this->form_id);
889 889
 						break;
890 890
 
891 891
 					case 'price_id':
892
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
892
+						$this->update_meta('_give_payment_price_id', $this->price_id);
893 893
 						break;
894 894
 
895 895
 					case 'first_name':
@@ -905,15 +905,15 @@  discard block
 block discarded – undo
905 905
 						break;
906 906
 
907 907
 					case 'email':
908
-						$this->update_meta( '_give_payment_user_email', $this->email );
908
+						$this->update_meta('_give_payment_user_email', $this->email);
909 909
 						break;
910 910
 
911 911
 					case 'key':
912
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
912
+						$this->update_meta('_give_payment_purchase_key', $this->key);
913 913
 						break;
914 914
 
915 915
 					case 'number':
916
-						$this->update_meta( '_give_payment_number', $this->number );
916
+						$this->update_meta('_give_payment_number', $this->number);
917 917
 						break;
918 918
 
919 919
 					case 'date':
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 							'edit_date' => true,
924 924
 						);
925 925
 
926
-						wp_update_post( $args );
926
+						wp_update_post($args);
927 927
 						break;
928 928
 
929 929
 					case 'completed_date':
930
-						$this->update_meta( '_give_completed_date', $this->completed_date );
930
+						$this->update_meta('_give_completed_date', $this->completed_date);
931 931
 						break;
932 932
 
933 933
 					case 'parent_payment':
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 							'post_parent' => $this->parent_payment,
937 937
 						);
938 938
 
939
-						wp_update_post( $args );
939
+						wp_update_post($args);
940 940
 						break;
941 941
 
942 942
 					default:
@@ -947,33 +947,33 @@  discard block
 block discarded – undo
947 947
 						 *
948 948
 						 * @param Give_Payment $this Payment object.
949 949
 						 */
950
-						do_action( 'give_payment_save', $this, $key );
950
+						do_action('give_payment_save', $this, $key);
951 951
 						break;
952 952
 				}
953 953
 			}
954 954
 
955
-			if ( 'pending' !== $this->status ) {
955
+			if ('pending' !== $this->status) {
956 956
 
957
-				$customer = new Give_Customer( $this->customer_id );
957
+				$customer = new Give_Customer($this->customer_id);
958 958
 
959 959
 				$total_change = $total_increase - $total_decrease;
960
-				if ( $total_change < 0 ) {
960
+				if ($total_change < 0) {
961 961
 
962
-					$total_change = - ( $total_change );
962
+					$total_change = - ($total_change);
963 963
 					// Decrease the customer's donation stats.
964
-					$customer->decrease_value( $total_change );
965
-					give_decrease_total_earnings( $total_change );
964
+					$customer->decrease_value($total_change);
965
+					give_decrease_total_earnings($total_change);
966 966
 
967
-				} elseif ( $total_change > 0 ) {
967
+				} elseif ($total_change > 0) {
968 968
 
969 969
 					// Increase the customer's donation stats.
970
-					$customer->increase_value( $total_change );
971
-					give_increase_total_earnings( $total_change );
970
+					$customer->increase_value($total_change);
971
+					give_increase_total_earnings($total_change);
972 972
 
973 973
 				}
974 974
 			}
975 975
 
976
-			$this->update_meta( '_give_payment_total', $this->total );
976
+			$this->update_meta('_give_payment_total', $this->total);
977 977
 
978 978
 			$new_meta = array(
979 979
 				'form_title' => $this->form_title,
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
 			);
986 986
 
987 987
 			$meta        = $this->get_meta();
988
-			$merged_meta = array_merge( $meta, $new_meta );
988
+			$merged_meta = array_merge($meta, $new_meta);
989 989
 
990 990
 			// Only save the payment meta if it's changed.
991
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
992
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
993
-				if ( false !== $updated ) {
991
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
992
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
993
+				if (false !== $updated) {
994 994
 					$saved = true;
995 995
 				}
996 996
 			}
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
 			$saved         = true;
1000 1000
 		}
1001 1001
 
1002
-		if ( true === $saved ) {
1003
-			$this->setup_payment( $this->ID );
1002
+		if (true === $saved) {
1003
+			$this->setup_payment($this->ID);
1004 1004
 		}
1005 1005
 
1006 1006
 		return $saved;
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
 	 *
1019 1019
 	 * @return bool           True when successful, false otherwise
1020 1020
 	 */
1021
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
1021
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
1022 1022
 
1023
-		$donation = new Give_Donate_Form( $form_id );
1023
+		$donation = new Give_Donate_Form($form_id);
1024 1024
 
1025 1025
 		// Bail if this post isn't a give donation form.
1026
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
1026
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
1027 1027
 			return false;
1028 1028
 		}
1029 1029
 
@@ -1034,59 +1034,59 @@  discard block
 block discarded – undo
1034 1034
 			'fees'     => array(),
1035 1035
 		);
1036 1036
 
1037
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1037
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1038 1038
 
1039 1039
 		// Allow overriding the price.
1040
-		if ( false !== $args['price'] ) {
1040
+		if (false !== $args['price']) {
1041 1041
 			$item_price = $args['price'];
1042 1042
 		} else {
1043 1043
 
1044 1044
 			// Deal with variable pricing.
1045
-			if ( give_has_variable_prices( $donation->ID ) ) {
1046
-				$prices     = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1045
+			if (give_has_variable_prices($donation->ID)) {
1046
+				$prices     = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1047 1047
 				$item_price = '';
1048 1048
 				// Loop through prices.
1049
-				foreach ( $prices as $price ) {
1049
+				foreach ($prices as $price) {
1050 1050
 					// Find a match between price_id and level_id.
1051 1051
 					// First verify array keys exists THEN make the match.
1052
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1052
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1053 1053
 					     && $args['price_id'] == $price['_give_id']['level_id']
1054 1054
 					) {
1055 1055
 						$item_price = $price['_give_amount'];
1056 1056
 					}
1057 1057
 				}
1058 1058
 				// Fallback to the lowest price point.
1059
-				if ( $item_price == '' ) {
1060
-					$item_price       = give_get_lowest_price_option( $donation->ID );
1061
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1059
+				if ($item_price == '') {
1060
+					$item_price       = give_get_lowest_price_option($donation->ID);
1061
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1062 1062
 				}
1063 1063
 			} else {
1064 1064
 				// Simple form price.
1065
-				$item_price = give_get_form_price( $donation->ID );
1065
+				$item_price = give_get_form_price($donation->ID);
1066 1066
 			}
1067 1067
 		}
1068 1068
 
1069 1069
 		// Sanitizing the price here so we don't have a dozen calls later.
1070
-		$item_price = give_sanitize_amount( $item_price );
1071
-		$total      = round( $item_price, give_currency_decimal_filter() );
1070
+		$item_price = give_sanitize_amount($item_price);
1071
+		$total      = round($item_price, give_currency_decimal_filter());
1072 1072
 
1073 1073
 		// Add Options.
1074 1074
 		$default_options = array();
1075
-		if ( false !== $args['price_id'] ) {
1075
+		if (false !== $args['price_id']) {
1076 1076
 			$default_options['price_id'] = (int) $args['price_id'];
1077 1077
 		}
1078
-		$options = wp_parse_args( $options, $default_options );
1078
+		$options = wp_parse_args($options, $default_options);
1079 1079
 
1080 1080
 		// Do not allow totals to go negative.
1081
-		if ( $total < 0 ) {
1081
+		if ($total < 0) {
1082 1082
 			$total = 0;
1083 1083
 		}
1084 1084
 
1085 1085
 		$donation = array(
1086 1086
 			'name'     => $donation->post_title,
1087 1087
 			'id'       => $donation->ID,
1088
-			'price'    => round( $total, give_currency_decimal_filter() ),
1089
-			'subtotal' => round( $total, give_currency_decimal_filter() ),
1088
+			'price'    => round($total, give_currency_decimal_filter()),
1089
+			'subtotal' => round($total, give_currency_decimal_filter()),
1090 1090
 			'fees'     => $args['fees'],
1091 1091
 			'price_id' => $args['price_id'],
1092 1092
 			'action'   => 'add',
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 		$this->pending['donations'][] = $donation;
1097 1097
 
1098
-		$this->increase_subtotal( $total );
1098
+		$this->increase_subtotal($total);
1099 1099
 
1100 1100
 		return true;
1101 1101
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 *
1113 1113
 	 * @return bool           If the item was removed or not
1114 1114
 	 */
1115
-	public function remove_donation( $form_id, $args = array() ) {
1115
+	public function remove_donation($form_id, $args = array()) {
1116 1116
 
1117 1117
 		// Set some defaults.
1118 1118
 		$defaults = array(
@@ -1120,12 +1120,12 @@  discard block
 block discarded – undo
1120 1120
 			'price'    => false,
1121 1121
 			'price_id' => false,
1122 1122
 		);
1123
-		$args     = wp_parse_args( $args, $defaults );
1123
+		$args = wp_parse_args($args, $defaults);
1124 1124
 
1125
-		$form = new Give_Donate_Form( $form_id );
1125
+		$form = new Give_Donate_Form($form_id);
1126 1126
 
1127 1127
 		// Bail if this post isn't a valid give donation form.
1128
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1128
+		if ( ! $form || $form->post_type !== 'give_forms') {
1129 1129
 			return false;
1130 1130
 		}
1131 1131
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 
1139 1139
 		$this->pending['donations'][] = $pending_args;
1140 1140
 
1141
-		$this->decrease_subtotal( $this->total );
1141
+		$this->decrease_subtotal($this->total);
1142 1142
 
1143 1143
 		return true;
1144 1144
 	}
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 	 *
1155 1155
 	 * @return bool          If the fee was added
1156 1156
 	 */
1157
-	public function add_fee( $args, $global = true ) {
1157
+	public function add_fee($args, $global = true) {
1158 1158
 
1159 1159
 		$default_args = array(
1160 1160
 			'label'    => '',
@@ -1164,15 +1164,15 @@  discard block
 block discarded – undo
1164 1164
 			'price_id' => 0,
1165 1165
 		);
1166 1166
 
1167
-		$fee          = wp_parse_args( $args, $default_args );
1167
+		$fee          = wp_parse_args($args, $default_args);
1168 1168
 		$this->fees[] = $fee;
1169 1169
 
1170 1170
 		$added_fee               = $fee;
1171 1171
 		$added_fee['action']     = 'add';
1172 1172
 		$this->pending['fees'][] = $added_fee;
1173
-		reset( $this->fees );
1173
+		reset($this->fees);
1174 1174
 
1175
-		$this->increase_fees( $fee['amount'] );
1175
+		$this->increase_fees($fee['amount']);
1176 1176
 
1177 1177
 		return true;
1178 1178
 	}
@@ -1187,11 +1187,11 @@  discard block
 block discarded – undo
1187 1187
 	 *
1188 1188
 	 * @return bool     If the fee was removed successfully
1189 1189
 	 */
1190
-	public function remove_fee( $key ) {
1190
+	public function remove_fee($key) {
1191 1191
 		$removed = false;
1192 1192
 
1193
-		if ( is_numeric( $key ) ) {
1194
-			$removed = $this->remove_fee_by( 'index', $key );
1193
+		if (is_numeric($key)) {
1194
+			$removed = $this->remove_fee_by('index', $key);
1195 1195
 		}
1196 1196
 
1197 1197
 		return $removed;
@@ -1210,55 +1210,55 @@  discard block
 block discarded – undo
1210 1210
 	 *
1211 1211
 	 * @return boolean            If the item is removed
1212 1212
 	 */
1213
-	public function remove_fee_by( $key, $value, $global = false ) {
1213
+	public function remove_fee_by($key, $value, $global = false) {
1214 1214
 
1215
-		$allowed_fee_keys = apply_filters( 'give_payment_fee_keys', array(
1215
+		$allowed_fee_keys = apply_filters('give_payment_fee_keys', array(
1216 1216
 			'index',
1217 1217
 			'label',
1218 1218
 			'amount',
1219 1219
 			'type',
1220
-		) );
1220
+		));
1221 1221
 
1222
-		if ( ! in_array( $key, $allowed_fee_keys ) ) {
1222
+		if ( ! in_array($key, $allowed_fee_keys)) {
1223 1223
 			return false;
1224 1224
 		}
1225 1225
 
1226 1226
 		$removed = false;
1227
-		if ( 'index' === $key && array_key_exists( $value, $this->fees ) ) {
1227
+		if ('index' === $key && array_key_exists($value, $this->fees)) {
1228 1228
 
1229
-			$removed_fee             = $this->fees[ $value ];
1229
+			$removed_fee             = $this->fees[$value];
1230 1230
 			$removed_fee['action']   = 'remove';
1231 1231
 			$this->pending['fees'][] = $removed_fee;
1232 1232
 
1233
-			$this->decrease_fees( $removed_fee['amount'] );
1233
+			$this->decrease_fees($removed_fee['amount']);
1234 1234
 
1235
-			unset( $this->fees[ $value ] );
1235
+			unset($this->fees[$value]);
1236 1236
 			$removed = true;
1237 1237
 
1238
-		} elseif ( 'index' !== $key ) {
1238
+		} elseif ('index' !== $key) {
1239 1239
 
1240
-			foreach ( $this->fees as $index => $fee ) {
1240
+			foreach ($this->fees as $index => $fee) {
1241 1241
 
1242
-				if ( isset( $fee[ $key ] ) && $fee[ $key ] == $value ) {
1242
+				if (isset($fee[$key]) && $fee[$key] == $value) {
1243 1243
 
1244 1244
 					$removed_fee             = $fee;
1245 1245
 					$removed_fee['action']   = 'remove';
1246 1246
 					$this->pending['fees'][] = $removed_fee;
1247 1247
 
1248
-					$this->decrease_fees( $removed_fee['amount'] );
1248
+					$this->decrease_fees($removed_fee['amount']);
1249 1249
 
1250
-					unset( $this->fees[ $index ] );
1250
+					unset($this->fees[$index]);
1251 1251
 					$removed = true;
1252 1252
 
1253
-					if ( false === $global ) {
1253
+					if (false === $global) {
1254 1254
 						break;
1255 1255
 					}
1256 1256
 				}
1257 1257
 			}
1258 1258
 		}
1259 1259
 
1260
-		if ( true === $removed ) {
1261
-			$this->fees = array_values( $this->fees );
1260
+		if (true === $removed) {
1261
+			$this->fees = array_values($this->fees);
1262 1262
 		}
1263 1263
 
1264 1264
 		return $removed;
@@ -1274,14 +1274,14 @@  discard block
 block discarded – undo
1274 1274
 	 *
1275 1275
 	 * @return array        The Fees for the type specified
1276 1276
 	 */
1277
-	public function get_fees( $type = 'all' ) {
1277
+	public function get_fees($type = 'all') {
1278 1278
 		$fees = array();
1279 1279
 
1280
-		if ( ! empty( $this->fees ) && is_array( $this->fees ) ) {
1280
+		if ( ! empty($this->fees) && is_array($this->fees)) {
1281 1281
 
1282
-			foreach ( $this->fees as $fee_id => $fee ) {
1282
+			foreach ($this->fees as $fee_id => $fee) {
1283 1283
 
1284
-				if ( 'all' != $type && ! empty( $fee['type'] ) && $type != $fee['type'] ) {
1284
+				if ('all' != $type && ! empty($fee['type']) && $type != $fee['type']) {
1285 1285
 					continue;
1286 1286
 				}
1287 1287
 
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 			}
1292 1292
 		}
1293 1293
 
1294
-		return apply_filters( 'give_get_payment_fees', $fees, $this->ID, $this );
1294
+		return apply_filters('give_get_payment_fees', $fees, $this->ID, $this);
1295 1295
 	}
1296 1296
 
1297 1297
 	/**
@@ -1304,13 +1304,13 @@  discard block
 block discarded – undo
1304 1304
 	 *
1305 1305
 	 * @return void
1306 1306
 	 */
1307
-	public function add_note( $note = false ) {
1307
+	public function add_note($note = false) {
1308 1308
 		// Bail if no note specified.
1309
-		if ( ! $note ) {
1309
+		if ( ! $note) {
1310 1310
 			return false;
1311 1311
 		}
1312 1312
 
1313
-		give_insert_payment_note( $this->ID, $note );
1313
+		give_insert_payment_note($this->ID, $note);
1314 1314
 	}
1315 1315
 
1316 1316
 	/**
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @return void
1325 1325
 	 */
1326
-	private function increase_subtotal( $amount = 0.00 ) {
1326
+	private function increase_subtotal($amount = 0.00) {
1327 1327
 		$amount = (float) $amount;
1328 1328
 		$this->subtotal += $amount;
1329 1329
 
@@ -1340,11 +1340,11 @@  discard block
 block discarded – undo
1340 1340
 	 *
1341 1341
 	 * @return void
1342 1342
 	 */
1343
-	private function decrease_subtotal( $amount = 0.00 ) {
1343
+	private function decrease_subtotal($amount = 0.00) {
1344 1344
 		$amount = (float) $amount;
1345 1345
 		$this->subtotal -= $amount;
1346 1346
 
1347
-		if ( $this->subtotal < 0 ) {
1347
+		if ($this->subtotal < 0) {
1348 1348
 			$this->subtotal = 0;
1349 1349
 		}
1350 1350
 
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 	 *
1362 1362
 	 * @return void
1363 1363
 	 */
1364
-	private function increase_fees( $amount = 0.00 ) {
1364
+	private function increase_fees($amount = 0.00) {
1365 1365
 		$amount = (float) $amount;
1366 1366
 		$this->fees_total += $amount;
1367 1367
 
@@ -1378,11 +1378,11 @@  discard block
 block discarded – undo
1378 1378
 	 *
1379 1379
 	 * @return void
1380 1380
 	 */
1381
-	private function decrease_fees( $amount = 0.00 ) {
1381
+	private function decrease_fees($amount = 0.00) {
1382 1382
 		$amount = (float) $amount;
1383 1383
 		$this->fees_total -= $amount;
1384 1384
 
1385
-		if ( $this->fees_total < 0 ) {
1385
+		if ($this->fees_total < 0) {
1386 1386
 			$this->fees_total = 0;
1387 1387
 		}
1388 1388
 
@@ -1411,24 +1411,24 @@  discard block
 block discarded – undo
1411 1411
 	 *
1412 1412
 	 * @return bool   $updated Returns if the status was successfully updated.
1413 1413
 	 */
1414
-	public function update_status( $status = false ) {
1414
+	public function update_status($status = false) {
1415 1415
 
1416 1416
 		// standardize the 'complete(d)' status.
1417
-		if ( $status == 'completed' || $status == 'complete' ) {
1417
+		if ($status == 'completed' || $status == 'complete') {
1418 1418
 			$status = 'publish';
1419 1419
 		}
1420 1420
 
1421
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1421
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1422 1422
 
1423
-		if ( $old_status === $status ) {
1423
+		if ($old_status === $status) {
1424 1424
 			return false; // Don't permit status changes that aren't changes.
1425 1425
 		}
1426 1426
 
1427
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1427
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1428 1428
 
1429 1429
 		$updated = false;
1430 1430
 
1431
-		if ( $do_change ) {
1431
+		if ($do_change) {
1432 1432
 
1433 1433
 			/**
1434 1434
 			 * Fires before changing payment status.
@@ -1439,21 +1439,21 @@  discard block
 block discarded – undo
1439 1439
 			 * @param string $status     The new status.
1440 1440
 			 * @param string $old_status The old status.
1441 1441
 			 */
1442
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1442
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1443 1443
 
1444 1444
 			$update_fields = array(
1445 1445
 				'ID'          => $this->ID,
1446 1446
 				'post_status' => $status,
1447
-				'edit_date'   => current_time( 'mysql' ),
1447
+				'edit_date'   => current_time('mysql'),
1448 1448
 			);
1449 1449
 
1450
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1450
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1451 1451
 
1452 1452
 			$all_payment_statuses  = give_get_payment_statuses();
1453
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1453
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1454 1454
 
1455 1455
 			// Process any specific status functions.
1456
-			switch ( $status ) {
1456
+			switch ($status) {
1457 1457
 				case 'refunded':
1458 1458
 					$this->process_refund();
1459 1459
 					break;
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 			 * @param string $status     The new status.
1481 1481
 			 * @param string $old_status The old status.
1482 1482
 			 */
1483
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1483
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1484 1484
 
1485 1485
 		}
1486 1486
 
@@ -1515,32 +1515,32 @@  discard block
 block discarded – undo
1515 1515
 	 *
1516 1516
 	 * @return mixed             The value from the post meta
1517 1517
 	 */
1518
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1518
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1519 1519
 
1520
-		$meta = get_post_meta( $this->ID, $meta_key, $single );
1520
+		$meta = get_post_meta($this->ID, $meta_key, $single);
1521 1521
 
1522
-		if ( $meta_key === '_give_payment_meta' ) {
1522
+		if ($meta_key === '_give_payment_meta') {
1523 1523
 
1524
-			if ( empty( $meta['key'] ) ) {
1524
+			if (empty($meta['key'])) {
1525 1525
 				$meta['key'] = $this->setup_payment_key();
1526 1526
 			}
1527 1527
 
1528
-			if ( empty( $meta['form_title'] ) ) {
1528
+			if (empty($meta['form_title'])) {
1529 1529
 				$meta['form_title'] = $this->setup_form_title();
1530 1530
 			}
1531 1531
 
1532
-			if ( empty( $meta['email'] ) ) {
1532
+			if (empty($meta['email'])) {
1533 1533
 				$meta['email'] = $this->setup_email();
1534 1534
 			}
1535 1535
 
1536
-			if ( empty( $meta['date'] ) ) {
1537
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1536
+			if (empty($meta['date'])) {
1537
+				$meta['date'] = get_post_field('post_date', $this->ID);
1538 1538
 			}
1539 1539
 		}
1540 1540
 
1541
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1541
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1542 1542
 
1543
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1543
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1544 1544
 	}
1545 1545
 
1546 1546
 	/**
@@ -1555,23 +1555,23 @@  discard block
 block discarded – undo
1555 1555
 	 *
1556 1556
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1557 1557
 	 */
1558
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1559
-		if ( empty( $meta_key ) ) {
1558
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1559
+		if (empty($meta_key)) {
1560 1560
 			return false;
1561 1561
 		}
1562 1562
 
1563
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1563
+		if ($meta_key == 'key' || $meta_key == 'date') {
1564 1564
 
1565 1565
 			$current_meta              = $this->get_meta();
1566
-			$current_meta[ $meta_key ] = $meta_value;
1566
+			$current_meta[$meta_key] = $meta_value;
1567 1567
 
1568 1568
 			$meta_key   = '_give_payment_meta';
1569 1569
 			$meta_value = $current_meta;
1570 1570
 
1571
-		} elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1571
+		} elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1572 1572
 
1573
-			$meta_value = apply_filters( "give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1574
-			update_post_meta( $this->ID, '_give_payment_user_email', $meta_value );
1573
+			$meta_value = apply_filters("give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1574
+			update_post_meta($this->ID, '_give_payment_user_email', $meta_value);
1575 1575
 
1576 1576
 			$current_meta                       = $this->get_meta();
1577 1577
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1581,9 +1581,9 @@  discard block
 block discarded – undo
1581 1581
 
1582 1582
 		}
1583 1583
 
1584
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1584
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1585 1585
 
1586
-		return update_post_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1586
+		return update_post_meta($this->ID, $meta_key, $meta_value, $prev_value);
1587 1587
 	}
1588 1588
 
1589 1589
 	/**
@@ -1598,14 +1598,14 @@  discard block
 block discarded – undo
1598 1598
 		$process_refund = true;
1599 1599
 
1600 1600
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1601
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1601
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1602 1602
 			$process_refund = false;
1603 1603
 		}
1604 1604
 
1605 1605
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1606
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1606
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1607 1607
 
1608
-		if ( false === $process_refund ) {
1608
+		if (false === $process_refund) {
1609 1609
 			return;
1610 1610
 		}
1611 1611
 
@@ -1616,17 +1616,17 @@  discard block
 block discarded – undo
1616 1616
 		 *
1617 1617
 		 * @param Give_Payment $this Payment object.
1618 1618
 		 */
1619
-		do_action( 'give_pre_refund_payment', $this );
1619
+		do_action('give_pre_refund_payment', $this);
1620 1620
 
1621
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1622
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1623
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1621
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1622
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1623
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1624 1624
 
1625
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1625
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1626 1626
 		$this->delete_sales_logs();
1627 1627
 
1628 1628
 		// Clear the This Month earnings (this_monththis_month is NOT a typo).
1629
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1629
+		delete_transient(md5('give_earnings_this_monththis_month'));
1630 1630
 
1631 1631
 		/**
1632 1632
 		 * Fires after refunding payment.
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 		 *
1636 1636
 		 * @param Give_Payment $this Payment object.
1637 1637
 		 */
1638
-		do_action( 'give_post_refund_payment', $this );
1638
+		do_action('give_post_refund_payment', $this);
1639 1639
 	}
1640 1640
 
1641 1641
 	/**
@@ -1662,29 +1662,29 @@  discard block
 block discarded – undo
1662 1662
 		$process_pending = true;
1663 1663
 
1664 1664
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1665
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1665
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1666 1666
 			$process_pending = false;
1667 1667
 		}
1668 1668
 
1669 1669
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1670
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1670
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1671 1671
 
1672
-		if ( false === $process_pending ) {
1672
+		if (false === $process_pending) {
1673 1673
 			return;
1674 1674
 		}
1675 1675
 
1676
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_pending', true, $this );
1677
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_pending', true, $this );
1678
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_pending', true, $this );
1676
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_pending', true, $this);
1677
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_pending', true, $this);
1678
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_pending', true, $this);
1679 1679
 
1680
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1680
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1681 1681
 		$this->delete_sales_logs();
1682 1682
 
1683 1683
 		$this->completed_date = false;
1684
-		$this->update_meta( '_give_completed_date', '' );
1684
+		$this->update_meta('_give_completed_date', '');
1685 1685
 
1686 1686
 		// Clear the This Month earnings (this_monththis_month is NOT a typo).
1687
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1687
+		delete_transient(md5('give_earnings_this_monththis_month'));
1688 1688
 	}
1689 1689
 
1690 1690
 	/**
@@ -1699,29 +1699,29 @@  discard block
 block discarded – undo
1699 1699
 		$process_cancelled = true;
1700 1700
 
1701 1701
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1702
-		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1702
+		if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1703 1703
 			$process_cancelled = false;
1704 1704
 		}
1705 1705
 
1706 1706
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1707
-		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1707
+		$process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1708 1708
 
1709
-		if ( false === $process_cancelled ) {
1709
+		if (false === $process_cancelled) {
1710 1710
 			return;
1711 1711
 		}
1712 1712
 
1713
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this );
1714
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this );
1715
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this );
1713
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_cancelled', true, $this);
1714
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_cancelled', true, $this);
1715
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_cancelled', true, $this);
1716 1716
 
1717
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1717
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1718 1718
 		$this->delete_sales_logs();
1719 1719
 
1720 1720
 		$this->completed_date = false;
1721
-		$this->update_meta( '_give_completed_date', '' );
1721
+		$this->update_meta('_give_completed_date', '');
1722 1722
 
1723 1723
 		// Clear the This Month earnings (this_monththis_month is NOT a typo).
1724
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1724
+		delete_transient(md5('give_earnings_this_monththis_month'));
1725 1725
 	}
1726 1726
 
1727 1727
 	/**
@@ -1734,29 +1734,29 @@  discard block
 block discarded – undo
1734 1734
 		$process_revoked = true;
1735 1735
 
1736 1736
 		// If the payment was not in publish, don't decrement stats as they were never incremented.
1737
-		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1737
+		if ('publish' != $this->old_status || 'revoked' != $this->status) {
1738 1738
 			$process_revoked = false;
1739 1739
 		}
1740 1740
 
1741 1741
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1742
-		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1742
+		$process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1743 1743
 
1744
-		if ( false === $process_revoked ) {
1744
+		if (false === $process_revoked) {
1745 1745
 			return;
1746 1746
 		}
1747 1747
 
1748
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this );
1749
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this );
1750
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this );
1748
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_revoked', true, $this);
1749
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_revoked', true, $this);
1750
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_revoked', true, $this);
1751 1751
 
1752
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1752
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1753 1753
 		$this->delete_sales_logs();
1754 1754
 
1755 1755
 		$this->completed_date = false;
1756
-		$this->update_meta( '_give_completed_date', '' );
1756
+		$this->update_meta('_give_completed_date', '');
1757 1757
 
1758 1758
 		// Clear the This Month earnings (this_monththis_month is NOT a typo).
1759
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1759
+		delete_transient(md5('give_earnings_this_monththis_month'));
1760 1760
 	}
1761 1761
 
1762 1762
 	/**
@@ -1771,25 +1771,25 @@  discard block
 block discarded – undo
1771 1771
 	 *
1772 1772
 	 * @return void
1773 1773
 	 */
1774
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1774
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1775 1775
 
1776
-		give_undo_purchase( false, $this->ID );
1776
+		give_undo_purchase(false, $this->ID);
1777 1777
 
1778 1778
 		// Decrease store earnings.
1779
-		if ( true === $alter_store_earnings ) {
1780
-			give_decrease_total_earnings( $this->total );
1779
+		if (true === $alter_store_earnings) {
1780
+			give_decrease_total_earnings($this->total);
1781 1781
 		}
1782 1782
 
1783 1783
 		// Decrement the stats for the customer.
1784
-		if ( ! empty( $this->customer_id ) ) {
1784
+		if ( ! empty($this->customer_id)) {
1785 1785
 
1786
-			$customer = new Give_Customer( $this->customer_id );
1786
+			$customer = new Give_Customer($this->customer_id);
1787 1787
 
1788
-			if ( true === $alter_customer_value ) {
1789
-				$customer->decrease_value( $this->total );
1788
+			if (true === $alter_customer_value) {
1789
+				$customer->decrease_value($this->total);
1790 1790
 			}
1791 1791
 
1792
-			if ( true === $alter_customer_purchase_count ) {
1792
+			if (true === $alter_customer_purchase_count) {
1793 1793
 				$customer->decrease_purchase_count();
1794 1794
 			}
1795 1795
 		}
@@ -1838,13 +1838,13 @@  discard block
 block discarded – undo
1838 1838
 	 * @return string The date the payment was completed
1839 1839
 	 */
1840 1840
 	private function setup_completed_date() {
1841
-		$payment = get_post( $this->ID );
1841
+		$payment = get_post($this->ID);
1842 1842
 
1843
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1843
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1844 1844
 			return false; // This payment was never completed.
1845 1845
 		}
1846 1846
 
1847
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1847
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1848 1848
 
1849 1849
 		return $date;
1850 1850
 	}
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
 	 * @return string The payment mode
1859 1859
 	 */
1860 1860
 	private function setup_mode() {
1861
-		return $this->get_meta( '_give_payment_mode' );
1861
+		return $this->get_meta('_give_payment_mode');
1862 1862
 	}
1863 1863
 
1864 1864
 	/**
@@ -1870,13 +1870,13 @@  discard block
 block discarded – undo
1870 1870
 	 * @return float The payment total
1871 1871
 	 */
1872 1872
 	private function setup_total() {
1873
-		$amount = $this->get_meta( '_give_payment_total', true );
1873
+		$amount = $this->get_meta('_give_payment_total', true);
1874 1874
 
1875
-		if ( empty( $amount ) && '0.00' != $amount ) {
1876
-			$meta = $this->get_meta( '_give_payment_meta', true );
1877
-			$meta = maybe_unserialize( $meta );
1875
+		if (empty($amount) && '0.00' != $amount) {
1876
+			$meta = $this->get_meta('_give_payment_meta', true);
1877
+			$meta = maybe_unserialize($meta);
1878 1878
 
1879
-			if ( isset( $meta['amount'] ) ) {
1879
+			if (isset($meta['amount'])) {
1880 1880
 				$amount = $meta['amount'];
1881 1881
 			}
1882 1882
 		}
@@ -1909,9 +1909,9 @@  discard block
 block discarded – undo
1909 1909
 	private function setup_fees_total() {
1910 1910
 		$fees_total = (float) 0.00;
1911 1911
 
1912
-		$payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array();
1913
-		if ( ! empty( $payment_fees ) ) {
1914
-			foreach ( $payment_fees as $fee ) {
1912
+		$payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array();
1913
+		if ( ! empty($payment_fees)) {
1914
+			foreach ($payment_fees as $fee) {
1915 1915
 				$fees_total += (float) $fee['amount'];
1916 1916
 			}
1917 1917
 		}
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 	 * @return string The currency for the payment
1930 1930
 	 */
1931 1931
 	private function setup_currency() {
1932
-		$currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this );
1932
+		$currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this);
1933 1933
 
1934 1934
 		return $currency;
1935 1935
 	}
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 	 * @return array The Fees
1944 1944
 	 */
1945 1945
 	private function setup_fees() {
1946
-		$payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array();
1946
+		$payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array();
1947 1947
 
1948 1948
 		return $payment_fees;
1949 1949
 	}
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
 	 * @return string The gateway
1958 1958
 	 */
1959 1959
 	private function setup_gateway() {
1960
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1960
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1961 1961
 
1962 1962
 		return $gateway;
1963 1963
 	}
@@ -1971,12 +1971,12 @@  discard block
 block discarded – undo
1971 1971
 	 * @return string The donation ID
1972 1972
 	 */
1973 1973
 	private function setup_transaction_id() {
1974
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1974
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1975 1975
 
1976
-		if ( empty( $transaction_id ) || (int) $transaction_id === (int) $this->ID ) {
1976
+		if (empty($transaction_id) || (int) $transaction_id === (int) $this->ID) {
1977 1977
 
1978 1978
 			$gateway        = $this->gateway;
1979
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1979
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1980 1980
 
1981 1981
 		}
1982 1982
 
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 	 * @return string The IP address for the payment
1993 1993
 	 */
1994 1994
 	private function setup_ip() {
1995
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1995
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1996 1996
 
1997 1997
 		return $ip;
1998 1998
 	}
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 	 * @return int The Customer ID
2007 2007
 	 */
2008 2008
 	private function setup_customer_id() {
2009
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
2009
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
2010 2010
 
2011 2011
 		return $customer_id;
2012 2012
 	}
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 	 * @return int The User ID
2021 2021
 	 */
2022 2022
 	private function setup_user_id() {
2023
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
2023
+		$user_id = $this->get_meta('_give_payment_user_id', true);
2024 2024
 
2025 2025
 		return $user_id;
2026 2026
 	}
@@ -2034,10 +2034,10 @@  discard block
 block discarded – undo
2034 2034
 	 * @return string The email address for the payment
2035 2035
 	 */
2036 2036
 	private function setup_email() {
2037
-		$email = $this->get_meta( '_give_payment_user_email', true );
2037
+		$email = $this->get_meta('_give_payment_user_email', true);
2038 2038
 
2039
-		if ( empty( $email ) ) {
2040
-			$email = Give()->customers->get_column( 'email', $this->customer_id );
2039
+		if (empty($email)) {
2040
+			$email = Give()->customers->get_column('email', $this->customer_id);
2041 2041
 		}
2042 2042
 
2043 2043
 		return $email;
@@ -2057,15 +2057,15 @@  discard block
 block discarded – undo
2057 2057
 			'last_name'  => $this->last_name,
2058 2058
 		);
2059 2059
 
2060
-		$user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array();
2061
-		$user_info = wp_parse_args( $user_info, $defaults );
2060
+		$user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array();
2061
+		$user_info = wp_parse_args($user_info, $defaults);
2062 2062
 
2063
-		if ( empty( $user_info ) ) {
2063
+		if (empty($user_info)) {
2064 2064
 			// Get the customer, but only if it's been created.
2065
-			$customer = new Give_Customer( $this->customer_id );
2065
+			$customer = new Give_Customer($this->customer_id);
2066 2066
 
2067
-			if ( $customer->id > 0 ) {
2068
-				$name      = explode( ' ', $customer->name, 2 );
2067
+			if ($customer->id > 0) {
2068
+				$name      = explode(' ', $customer->name, 2);
2069 2069
 				$user_info = array(
2070 2070
 					'first_name' => $name[0],
2071 2071
 					'last_name'  => $name[1],
@@ -2075,29 +2075,29 @@  discard block
 block discarded – undo
2075 2075
 			}
2076 2076
 		} else {
2077 2077
 			// Get the customer, but only if it's been created.
2078
-			$customer = new Give_Customer( $this->customer_id );
2079
-			if ( $customer->id > 0 ) {
2080
-				foreach ( $user_info as $key => $value ) {
2081
-					if ( ! empty( $value ) ) {
2078
+			$customer = new Give_Customer($this->customer_id);
2079
+			if ($customer->id > 0) {
2080
+				foreach ($user_info as $key => $value) {
2081
+					if ( ! empty($value)) {
2082 2082
 						continue;
2083 2083
 					}
2084 2084
 
2085
-					switch ( $key ) {
2085
+					switch ($key) {
2086 2086
 						case 'first_name':
2087
-							$name = explode( ' ', $customer->name, 2 );
2087
+							$name = explode(' ', $customer->name, 2);
2088 2088
 
2089
-							$user_info[ $key ] = $name[0];
2089
+							$user_info[$key] = $name[0];
2090 2090
 							break;
2091 2091
 
2092 2092
 						case 'last_name':
2093
-							$name      = explode( ' ', $customer->name, 2 );
2094
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
2093
+							$name      = explode(' ', $customer->name, 2);
2094
+							$last_name = ! empty($name[1]) ? $name[1] : '';
2095 2095
 
2096
-							$user_info[ $key ] = $last_name;
2096
+							$user_info[$key] = $last_name;
2097 2097
 							break;
2098 2098
 
2099 2099
 						case 'email':
2100
-							$user_info[ $key ] = $customer->email;
2100
+							$user_info[$key] = $customer->email;
2101 2101
 							break;
2102 2102
 					}
2103 2103
 				}
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 	 */
2119 2119
 	private function setup_address() {
2120 2120
 
2121
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
2121
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
2122 2122
 			'line1'   => '',
2123 2123
 			'line2'   => '',
2124 2124
 			'city'    => '',
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
 	 */
2141 2141
 	private function setup_form_title() {
2142 2142
 
2143
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
2143
+		$form_id = $this->get_meta('_give_payment_form_title', true);
2144 2144
 
2145 2145
 		return $form_id;
2146 2146
 	}
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 	 */
2156 2156
 	private function setup_form_id() {
2157 2157
 
2158
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
2158
+		$form_id = $this->get_meta('_give_payment_form_id', true);
2159 2159
 
2160 2160
 		return $form_id;
2161 2161
 	}
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
 	 * @return int The Form Price ID
2170 2170
 	 */
2171 2171
 	private function setup_price_id() {
2172
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
2172
+		$price_id = $this->get_meta('_give_payment_price_id', true);
2173 2173
 
2174 2174
 		return $price_id;
2175 2175
 	}
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 	 * @return string The Payment Key
2184 2184
 	 */
2185 2185
 	private function setup_payment_key() {
2186
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
2186
+		$key = $this->get_meta('_give_payment_purchase_key', true);
2187 2187
 
2188 2188
 		return $key;
2189 2189
 	}
@@ -2199,11 +2199,11 @@  discard block
 block discarded – undo
2199 2199
 	private function setup_payment_number() {
2200 2200
 		$number = $this->ID;
2201 2201
 
2202
-		if ( give_get_option( 'enable_sequential' ) ) {
2202
+		if (give_get_option('enable_sequential')) {
2203 2203
 
2204
-			$number = $this->get_meta( '_give_payment_number', true );
2204
+			$number = $this->get_meta('_give_payment_number', true);
2205 2205
 
2206
-			if ( ! $number ) {
2206
+			if ( ! $number) {
2207 2207
 
2208 2208
 				$number = $this->ID;
2209 2209
 
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 	 * @return array The payment object as an array
2222 2222
 	 */
2223 2223
 	public function array_convert() {
2224
-		return get_object_vars( $this );
2224
+		return get_object_vars($this);
2225 2225
 	}
2226 2226
 
2227 2227
 
@@ -2234,7 +2234,7 @@  discard block
 block discarded – undo
2234 2234
 	 * @return bool
2235 2235
 	 */
2236 2236
 	public function is_completed() {
2237
-		return ( 'publish' === $this->status && $this->completed_date );
2237
+		return ('publish' === $this->status && $this->completed_date);
2238 2238
 	}
2239 2239
 
2240 2240
 	/**
@@ -2246,7 +2246,7 @@  discard block
 block discarded – undo
2246 2246
 	 * @return string Date payment was completed
2247 2247
 	 */
2248 2248
 	private function get_completed_date() {
2249
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2249
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2250 2250
 	}
2251 2251
 
2252 2252
 	/**
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
 	 * @return float Payment subtotal
2259 2259
 	 */
2260 2260
 	private function get_subtotal() {
2261
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2261
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2262 2262
 	}
2263 2263
 
2264 2264
 	/**
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
 	 * @return string Payment currency code
2271 2271
 	 */
2272 2272
 	private function get_currency() {
2273
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2273
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2274 2274
 	}
2275 2275
 
2276 2276
 	/**
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
 	 * @return string Gateway used
2283 2283
 	 */
2284 2284
 	private function get_gateway() {
2285
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2285
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2286 2286
 	}
2287 2287
 
2288 2288
 	/**
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
 	 * @return string Donation ID from merchant processor
2295 2295
 	 */
2296 2296
 	private function get_transaction_id() {
2297
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2297
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2298 2298
 	}
2299 2299
 
2300 2300
 	/**
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
 	 * @return string Payment IP address
2307 2307
 	 */
2308 2308
 	private function get_ip() {
2309
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2309
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2310 2310
 	}
2311 2311
 
2312 2312
 	/**
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 	 * @return int Payment customer ID
2319 2319
 	 */
2320 2320
 	private function get_customer_id() {
2321
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2321
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2322 2322
 	}
2323 2323
 
2324 2324
 	/**
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 	 * @return int Payment user ID
2331 2331
 	 */
2332 2332
 	private function get_user_id() {
2333
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2333
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2334 2334
 	}
2335 2335
 
2336 2336
 	/**
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 	 * @return string Payment customer email
2343 2343
 	 */
2344 2344
 	private function get_email() {
2345
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2345
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2346 2346
 	}
2347 2347
 
2348 2348
 	/**
@@ -2354,7 +2354,7 @@  discard block
 block discarded – undo
2354 2354
 	 * @return array Payment user info
2355 2355
 	 */
2356 2356
 	private function get_user_info() {
2357
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2357
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2358 2358
 	}
2359 2359
 
2360 2360
 	/**
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 	 * @return array Payment billing address
2367 2367
 	 */
2368 2368
 	private function get_address() {
2369
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2369
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2370 2370
 	}
2371 2371
 
2372 2372
 	/**
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
 	 * @return string Payment key
2379 2379
 	 */
2380 2380
 	private function get_key() {
2381
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2381
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2382 2382
 	}
2383 2383
 
2384 2384
 	/**
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
 	 * @return string Payment form id
2391 2391
 	 */
2392 2392
 	private function get_form_id() {
2393
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2393
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2394 2394
 	}
2395 2395
 
2396 2396
 	/**
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
 	 * @return int|string Payment number
2403 2403
 	 */
2404 2404
 	private function get_number() {
2405
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2405
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2406 2406
 	}
2407 2407
 
2408 2408
 }
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-display.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 								'disabled' => __( 'Disabled', 'give' ),
88 88
 							)
89 89
 						),
90
-                        array(
91
-                            'name'  => esc_html__( 'Display Settings Docs Link', 'give' ),
92
-                            'id'    => 'display_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
-                            'title' => __( 'Display Options Settings', 'give' ),
95
-                            'type'  => 'give_docs_link',
96
-                        ),
90
+						array(
91
+							'name'  => esc_html__( 'Display Settings Docs Link', 'give' ),
92
+							'id'    => 'display_settings_docs_link',
93
+							'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
+							'title' => __( 'Display Options Settings', 'give' ),
95
+							'type'  => 'give_docs_link',
96
+						),
97 97
 						array(
98 98
 							'id'   => 'give_title_display_settings_1',
99 99
 							'type' => 'sectionend'
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 								'disabled' => __( 'Disabled', 'give' ),
171 171
 							)
172 172
 						),
173
-                        array(
174
-                            'name'  => esc_html__( 'Post Types Docs Link', 'give' ),
175
-                            'id'    => 'post_types_settings_docs_link',
176
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
-                            'title' => __( 'Post Types Settings', 'give' ),
178
-                            'type'  => 'give_docs_link',
179
-                        ),
173
+						array(
174
+							'name'  => esc_html__( 'Post Types Docs Link', 'give' ),
175
+							'id'    => 'post_types_settings_docs_link',
176
+							'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
+							'title' => __( 'Post Types Settings', 'give' ),
178
+							'type'  => 'give_docs_link',
179
+						),
180 180
 						array(
181 181
 							'id'   => 'give_title_display_settings_2',
182 182
 							'type' => 'sectionend'
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 								'disabled' => __( 'Disabled', 'give' ),
213 213
 							)
214 214
 						),
215
-                        array(
216
-                            'name'  => esc_html__( 'Taxonomies Docs Link', 'give' ),
217
-                            'id'    => 'taxonomies_settings_docs_link',
218
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
-                            'title' => __( 'Taxonomies Settings', 'give' ),
220
-                            'type'  => 'give_docs_link',
221
-                        ),
215
+						array(
216
+							'name'  => esc_html__( 'Taxonomies Docs Link', 'give' ),
217
+							'id'    => 'taxonomies_settings_docs_link',
218
+							'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
+							'title' => __( 'Taxonomies Settings', 'give' ),
220
+							'type'  => 'give_docs_link',
221
+						),
222 222
 						array(
223 223
 							'id'   => 'give_title_display_settings_3',
224 224
 							'type' => 'sectionend'
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 							'id'   => 'agreement_text',
259 259
 							'type' => 'wysiwyg'
260 260
 						),
261
-                        array(
262
-                            'name'  => esc_html__( 'Terms and Conditions Docs Link', 'give' ),
263
-                            'id'    => 'terms_settings_docs_link',
264
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
-                            'title' => __( 'Terms and Conditions Settings', 'give' ),
266
-                            'type'  => 'give_docs_link',
267
-                        ),
261
+						array(
262
+							'name'  => esc_html__( 'Terms and Conditions Docs Link', 'give' ),
263
+							'id'    => 'terms_settings_docs_link',
264
+							'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
+							'title' => __( 'Terms and Conditions Settings', 'give' ),
266
+							'type'  => 'give_docs_link',
267
+						),
268 268
 						array(
269 269
 							'id'   => 'give_title_display_settings_4',
270 270
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Display' ) ) :
16
+if ( ! class_exists('Give_Settings_Display')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Display.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'display';
30
-			$this->label = esc_html__( 'Display Options', 'give' );
30
+			$this->label = esc_html__('Display Options', 'give');
31 31
 
32 32
 			$this->default_tab = 'display-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'display-settings' :
49 49
 					$settings = array(
50 50
 						// Section 1: Display
@@ -53,45 +53,45 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => esc_html__( 'Default Give Styles', 'give' ),
57
-							'desc'    => esc_html__( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ),
56
+							'name'    => esc_html__('Default Give Styles', 'give'),
57
+							'desc'    => esc_html__('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'),
58 58
 							'id'      => 'css',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'enabled',
61 61
 							'options' => array(
62
-								'enabled' => __( 'Enabled', 'give' ),
63
-								'disabled' => __( 'Disabled', 'give' ),
62
+								'enabled' => __('Enabled', 'give'),
63
+								'disabled' => __('Disabled', 'give'),
64 64
 							)
65 65
 						),
66 66
 						array(
67
-							'name' => esc_html__( 'Floating Labels', 'give' ),
67
+							'name' => esc_html__('Floating Labels', 'give'),
68 68
 							/* translators: %s: http://docs.givewp.com/form-floating-labels */
69
-							'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
69
+							'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')),
70 70
 							'id'   => 'floatlabels',
71 71
 							'type'    => 'radio_inline',
72 72
 							'default' => 'disabled',
73 73
 							'options' => array(
74
-								'enabled' => __( 'Enabled', 'give' ),
75
-								'disabled' => __( 'Disabled', 'give' ),
74
+								'enabled' => __('Enabled', 'give'),
75
+								'disabled' => __('Disabled', 'give'),
76 76
 							)
77 77
 						),
78 78
 						array(
79
-							'name'    => esc_html__( 'Welcome Screen', 'give' ),
79
+							'name'    => esc_html__('Welcome Screen', 'give'),
80 80
 							/* translators: %s: about page URL */
81
-							'desc'    => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
81
+							'desc'    => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
82 82
 							'id'      => 'welcome',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'enabled',
85 85
 							'options' => array(
86
-								'enabled' => __( 'Enabled', 'give' ),
87
-								'disabled' => __( 'Disabled', 'give' ),
86
+								'enabled' => __('Enabled', 'give'),
87
+								'disabled' => __('Disabled', 'give'),
88 88
 							)
89 89
 						),
90 90
                         array(
91
-                            'name'  => esc_html__( 'Display Settings Docs Link', 'give' ),
91
+                            'name'  => esc_html__('Display Settings Docs Link', 'give'),
92 92
                             'id'    => 'display_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
-                            'title' => __( 'Display Options Settings', 'give' ),
93
+                            'url'   => esc_url('http://docs.givewp.com/form-display-options'),
94
+                            'title' => __('Display Options Settings', 'give'),
95 95
                             'type'  => 'give_docs_link',
96 96
                         ),
97 97
 						array(
@@ -108,73 +108,73 @@  discard block
 block discarded – undo
108 108
 							'type' => 'title'
109 109
 						),
110 110
 						array(
111
-							'name'    => esc_html__( 'Form Single Views', 'give' ),
112
-							'desc'    => esc_html__( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
111
+							'name'    => esc_html__('Form Single Views', 'give'),
112
+							'desc'    => esc_html__('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
113 113
 							'id'      => 'forms_singular',
114 114
 							'type'    => 'radio_inline',
115 115
 							'default' => 'enabled',
116 116
 							'options' => array(
117
-								'enabled' => __( 'Enabled', 'give' ),
118
-								'disabled' => __( 'Disabled', 'give' ),
117
+								'enabled' => __('Enabled', 'give'),
118
+								'disabled' => __('Disabled', 'give'),
119 119
 							)
120 120
 						),
121 121
 						array(
122
-							'name'    => esc_html__( 'Form Archives', 'give' ),
123
-							'desc'    => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ),
122
+							'name'    => esc_html__('Form Archives', 'give'),
123
+							'desc'    => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))),
124 124
 							'id'      => 'forms_archives',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'enabled',
127 127
 							'options' => array(
128
-								'enabled' => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' ),
128
+								'enabled' => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give'),
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => esc_html__( 'Form Excerpts', 'give' ),
134
-							'desc'    => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
133
+							'name'    => esc_html__('Form Excerpts', 'give'),
134
+							'desc'    => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
135 135
 							'id'      => 'forms_excerpt',
136 136
 							'type'    => 'radio_inline',
137 137
 							'default' => 'enabled',
138 138
 							'options' => array(
139
-								'enabled' => __( 'Enabled', 'give' ),
140
-								'disabled' => __( 'Disabled', 'give' ),
139
+								'enabled' => __('Enabled', 'give'),
140
+								'disabled' => __('Disabled', 'give'),
141 141
 							)
142 142
 						),
143 143
 						array(
144
-							'name'    => esc_html__( 'Form Featured Image', 'give' ),
145
-							'desc'    => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
144
+							'name'    => esc_html__('Form Featured Image', 'give'),
145
+							'desc'    => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
146 146
 							'id'      => 'form_featured_img',
147 147
 							'type'    => 'radio_inline',
148 148
 							'default' => 'enabled',
149 149
 							'options' => array(
150
-								'enabled' => __( 'Enabled', 'give' ),
151
-								'disabled' => __( 'Disabled', 'give' ),
150
+								'enabled' => __('Enabled', 'give'),
151
+								'disabled' => __('Disabled', 'give'),
152 152
 							)
153 153
 						),
154 154
 						array(
155
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
156
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
155
+							'name'    => esc_html__('Featured Image Size', 'give'),
156
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
157 157
 							'id'      => 'featured_image_size',
158 158
 							'type'    => 'select',
159 159
 							'default' => 'large',
160 160
 							'options' => give_get_featured_image_sizes()
161 161
 						),
162 162
 						array(
163
-							'name'    => esc_html__( 'Single Form Sidebar', 'give' ),
164
-							'desc'    => esc_html__( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
163
+							'name'    => esc_html__('Single Form Sidebar', 'give'),
164
+							'desc'    => esc_html__('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
165 165
 							'id'      => 'form_sidebar',
166 166
 							'type'    => 'radio_inline',
167 167
 							'default' => 'enabled',
168 168
 							'options' => array(
169
-								'enabled' => __( 'Enabled', 'give' ),
170
-								'disabled' => __( 'Disabled', 'give' ),
169
+								'enabled' => __('Enabled', 'give'),
170
+								'disabled' => __('Disabled', 'give'),
171 171
 							)
172 172
 						),
173 173
                         array(
174
-                            'name'  => esc_html__( 'Post Types Docs Link', 'give' ),
174
+                            'name'  => esc_html__('Post Types Docs Link', 'give'),
175 175
                             'id'    => 'post_types_settings_docs_link',
176
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
-                            'title' => __( 'Post Types Settings', 'give' ),
176
+                            'url'   => esc_url('http://docs.givewp.com/settings-post-types'),
177
+                            'title' => __('Post Types Settings', 'give'),
178 178
                             'type'  => 'give_docs_link',
179 179
                         ),
180 180
 						array(
@@ -191,32 +191,32 @@  discard block
 block discarded – undo
191 191
 							'type' => 'title'
192 192
 						),
193 193
 						array(
194
-							'name' => esc_html__( 'Form Categories', 'give' ),
195
-							'desc' => esc_html__( 'Enable Categories for all Give forms.', 'give' ),
194
+							'name' => esc_html__('Form Categories', 'give'),
195
+							'desc' => esc_html__('Enable Categories for all Give forms.', 'give'),
196 196
 							'id'   => 'categories',
197 197
 							'type'    => 'radio_inline',
198 198
 							'default' => 'disabled',
199 199
 							'options' => array(
200
-								'enabled' => __( 'Enabled', 'give' ),
201
-								'disabled' => __( 'Disabled', 'give' ),
200
+								'enabled' => __('Enabled', 'give'),
201
+								'disabled' => __('Disabled', 'give'),
202 202
 							)
203 203
 						),
204 204
 						array(
205
-							'name' => esc_html__( 'Form Tags', 'give' ),
206
-							'desc' => esc_html__( 'Enable Tags for all Give forms.', 'give' ),
205
+							'name' => esc_html__('Form Tags', 'give'),
206
+							'desc' => esc_html__('Enable Tags for all Give forms.', 'give'),
207 207
 							'id'   => 'tags',
208 208
 							'type'    => 'radio_inline',
209 209
 							'default' => 'disabled',
210 210
 							'options' => array(
211
-								'enabled' => __( 'Enabled', 'give' ),
212
-								'disabled' => __( 'Disabled', 'give' ),
211
+								'enabled' => __('Enabled', 'give'),
212
+								'disabled' => __('Disabled', 'give'),
213 213
 							)
214 214
 						),
215 215
                         array(
216
-                            'name'  => esc_html__( 'Taxonomies Docs Link', 'give' ),
216
+                            'name'  => esc_html__('Taxonomies Docs Link', 'give'),
217 217
                             'id'    => 'taxonomies_settings_docs_link',
218
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
-                            'title' => __( 'Taxonomies Settings', 'give' ),
218
+                            'url'   => esc_url('http://docs.givewp.com/settings-taxonomies'),
219
+                            'title' => __('Taxonomies Settings', 'give'),
220 220
                             'type'  => 'give_docs_link',
221 221
                         ),
222 222
 						array(
@@ -233,36 +233,36 @@  discard block
 block discarded – undo
233 233
 							'type' => 'title'
234 234
 						),
235 235
 						array(
236
-							'name'    => esc_html__( 'Terms and Conditions', 'give' ),
237
-							'desc'    => esc_html__( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ),
236
+							'name'    => esc_html__('Terms and Conditions', 'give'),
237
+							'desc'    => esc_html__('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'),
238 238
 							'id'      => 'terms',
239 239
 							'type'    => 'radio_inline',
240 240
 							'default' => 'disabled',
241 241
 							'options' => array(
242
-								'enabled' => __( 'Enabled', 'give' ),
243
-								'disabled' => __( 'Disabled', 'give' ),
242
+								'enabled' => __('Enabled', 'give'),
243
+								'disabled' => __('Disabled', 'give'),
244 244
 							)
245 245
 						),
246 246
 						array(
247
-							'name' => esc_html__( 'Agree to Terms Label', 'give' ),
248
-							'desc' => esc_html__( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ),
247
+							'name' => esc_html__('Agree to Terms Label', 'give'),
248
+							'desc' => esc_html__('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'),
249 249
 							'id'   => 'agree_to_terms_label',
250 250
 							'attributes'  => array(
251
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
251
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
252 252
 							),
253 253
 							'type' => 'text'
254 254
 						),
255 255
 						array(
256
-							'name' => esc_html__( 'Agreement Text', 'give' ),
257
-							'desc' => esc_html__( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ),
256
+							'name' => esc_html__('Agreement Text', 'give'),
257
+							'desc' => esc_html__('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'),
258 258
 							'id'   => 'agreement_text',
259 259
 							'type' => 'wysiwyg'
260 260
 						),
261 261
                         array(
262
-                            'name'  => esc_html__( 'Terms and Conditions Docs Link', 'give' ),
262
+                            'name'  => esc_html__('Terms and Conditions Docs Link', 'give'),
263 263
                             'id'    => 'terms_settings_docs_link',
264
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
-                            'title' => __( 'Terms and Conditions Settings', 'give' ),
264
+                            'url'   => esc_url('http://docs.givewp.com/settings-terms'),
265
+                            'title' => __('Terms and Conditions Settings', 'give'),
266 266
                             'type'  => 'give_docs_link',
267 267
                         ),
268 268
 						array(
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 * Filter the display options settings.
278 278
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
279 279
 			 */
280
-			$settings = apply_filters( 'give_settings_display', $settings );
280
+			$settings = apply_filters('give_settings_display', $settings);
281 281
 
282 282
 			/**
283 283
 			 * Filter the settings.
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			 * @since  1.8
286 286
 			 * @param  array $settings
287 287
 			 */
288
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
288
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
289 289
 
290 290
 			// Output.
291 291
 			return $settings;
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 		 */
300 300
 		public function get_sections() {
301 301
 			$sections = array(
302
-				'display-settings'    => esc_html__( 'Display', 'give' ),
303
-				'post-types'          => esc_html__( 'Post Types', 'give' ),
304
-				'taxonomies'          => esc_html__( 'Taxonomies', 'give' ),
305
-				'term-and-conditions' => esc_html__( 'Terms and Conditions', 'give' )
302
+				'display-settings'    => esc_html__('Display', 'give'),
303
+				'post-types'          => esc_html__('Post Types', 'give'),
304
+				'taxonomies'          => esc_html__('Taxonomies', 'give'),
305
+				'term-and-conditions' => esc_html__('Terms and Conditions', 'give')
306 306
 			);
307 307
 
308
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
308
+			return apply_filters('give_get_sections_'.$this->id, $sections);
309 309
 		}
310 310
 	}
311 311
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 								'disabled' => __( 'Disabled', 'give' ),
87 87
 							)
88 88
 						),
89
-                        array(
90
-                            'name'  => esc_html__( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
-                            'id'    => 'paypal_standard_gateway_settings_docs_link',
92
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
-                            'type'  => 'give_docs_link',
95
-                        ),
89
+						array(
90
+							'name'  => esc_html__( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
+							'id'    => 'paypal_standard_gateway_settings_docs_link',
92
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
+							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
+							'type'  => 'give_docs_link',
95
+						),
96 96
 						array(
97 97
 							'type' => 'sectionend',
98 98
 							'id'   => 'give_title_gateway_settings_2',
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 								'textarea_rows' => 6,
146 146
 							)
147 147
 						),
148
-                        array(
149
-                            'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
150
-                            'id'    => 'offline_gateway_settings_docs_link',
151
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
153
-                            'type'  => 'give_docs_link',
154
-                        ),
148
+						array(
149
+							'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
150
+							'id'    => 'offline_gateway_settings_docs_link',
151
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
+							'title' => __( 'Offline Gateway Settings', 'give' ),
153
+							'type'  => 'give_docs_link',
154
+						),
155 155
 						array(
156 156
 							'type' => 'sectionend',
157 157
 							'id'   => 'give_title_gateway_settings_3',
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 							'id'   => 'default_gateway',
190 190
 							'type' => 'default_gateway'
191 191
 						),
192
-                        array(
193
-                            'name'  => esc_html__( 'Gateways Docs Link', 'give' ),
194
-                            'id'    => 'gateway_settings_docs_link',
195
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
-                            'title' => __( 'Gateway Settings', 'give' ),
197
-                            'type'  => 'give_docs_link',
198
-                        ),
192
+						array(
193
+							'name'  => esc_html__( 'Gateways Docs Link', 'give' ),
194
+							'id'    => 'gateway_settings_docs_link',
195
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
+							'title' => __( 'Gateway Settings', 'give' ),
197
+							'type'  => 'give_docs_link',
198
+						),
199 199
 						array(
200 200
 							'id'   => 'give_title_gateway_settings_1',
201 201
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
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_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'paypal-standard':
49 49
 					$settings = array(
50 50
 						// Section 2: Paypal Standard.
@@ -53,44 +53,44 @@  discard block
 block discarded – undo
53 53
 							'id'   => 'give_title_gateway_settings_2',
54 54
 						),
55 55
 						array(
56
-							'name' => esc_html__( 'PayPal Email', 'give' ),
57
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
56
+							'name' => esc_html__('PayPal Email', 'give'),
57
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
58 58
 							'id'   => 'paypal_email',
59 59
 							'type' => 'email',
60 60
 						),
61 61
 						array(
62
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
63
-							'desc' => esc_html__( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
62
+							'name' => esc_html__('PayPal Page Style', 'give'),
63
+							'desc' => esc_html__('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
64 64
 							'id'   => 'paypal_page_style',
65 65
 							'type' => 'text',
66 66
 						),
67 67
 						array(
68
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
69
-							'desc'    => esc_html__( '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' ),
68
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
69
+							'desc'    => esc_html__('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'),
70 70
 							'id'      => 'paypal_button_type',
71 71
 							'type'    => 'radio_inline',
72 72
 							'options' => array(
73
-								'donation' => esc_html__( 'Donation', 'give' ),
74
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
73
+								'donation' => esc_html__('Donation', 'give'),
74
+								'standard' => esc_html__('Standard Transaction', 'give')
75 75
 							),
76 76
 							'default' => 'donation',
77 77
 						),
78 78
 						array(
79
-							'name'    => esc_html__( 'PayPal IPN Verification', 'give' ),
80
-							'desc'    => esc_html__( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
79
+							'name'    => esc_html__('PayPal IPN Verification', 'give'),
80
+							'desc'    => esc_html__('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
81 81
 							'id'      => 'paypal_verification',
82 82
 							'type'    => 'radio_inline',
83 83
 							'default' => 'enabled',
84 84
 							'options' => array(
85
-								'enabled'  => __( 'Enabled', 'give' ),
86
-								'disabled' => __( 'Disabled', 'give' ),
85
+								'enabled'  => __('Enabled', 'give'),
86
+								'disabled' => __('Disabled', 'give'),
87 87
 							)
88 88
 						),
89 89
                         array(
90
-                            'name'  => esc_html__( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
90
+                            'name'  => esc_html__('PayPal Standard Gateway Settings Docs Link', 'give'),
91 91
                             'id'    => 'paypal_standard_gateway_settings_docs_link',
92
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
92
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
93
+                            'title' => __('PayPal Standard Gateway Settings', 'give'),
94 94
                             'type'  => 'give_docs_link',
95 95
                         ),
96 96
 						array(
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 							'id'   => 'give_title_gateway_settings_3',
109 109
 						),
110 110
 						array(
111
-							'name'    => esc_html__( 'Collect Billing Details', 'give' ),
112
-							'desc'    => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
111
+							'name'    => esc_html__('Collect Billing Details', 'give'),
112
+							'desc'    => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
113 113
 							'id'      => 'give_offline_donation_enable_billing_fields',
114 114
 							'type'    => 'radio_inline',
115 115
 							'default' => 'disabled',
116 116
 							'options' => array(
117
-								'enabled'  => __( 'Enabled', 'give' ),
118
-								'disabled' => __( 'Disabled', 'give' )
117
+								'enabled'  => __('Enabled', 'give'),
118
+								'disabled' => __('Disabled', 'give')
119 119
 							)
120 120
 						),
121 121
 						array(
122
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
123
-							'desc'    => esc_html__( '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' ),
122
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
123
+							'desc'    => esc_html__('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'),
124 124
 							'id'      => 'global_offline_donation_content',
125 125
 							'default' => give_get_default_offline_donation_content(),
126 126
 							'type'    => 'wysiwyg',
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 							)
130 130
 						),
131 131
 						array(
132
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
133
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
132
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
133
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
134 134
 							'id'      => 'offline_donation_subject',
135
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
135
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
136 136
 							'type'    => 'text'
137 137
 						),
138 138
 						array(
139
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
140
-							'desc'    => esc_html__( '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' ),
139
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
140
+							'desc'    => esc_html__('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'),
141 141
 							'id'      => 'global_offline_donation_email',
142 142
 							'default' => give_get_default_offline_donation_email_content(),
143 143
 							'type'    => 'wysiwyg',
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 							)
147 147
 						),
148 148
                         array(
149
-                            'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
149
+                            'name'  => esc_html__('Offline Donations Settings Docs Link', 'give'),
150 150
                             'id'    => 'offline_gateway_settings_docs_link',
151
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
151
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'),
152
+                            'title' => __('Offline Gateway Settings', 'give'),
153 153
                             'type'  => 'give_docs_link',
154 154
                         ),
155 155
 						array(
@@ -167,33 +167,33 @@  discard block
 block discarded – undo
167 167
 							'type' => 'title'
168 168
 						),
169 169
 						array(
170
-							'name'    => esc_html__( 'Test Mode', 'give' ),
171
-							'desc'    => esc_html__( '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' ),
170
+							'name'    => esc_html__('Test Mode', 'give'),
171
+							'desc'    => esc_html__('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'),
172 172
 							'id'      => 'test_mode',
173 173
 							'type'    => 'radio_inline',
174 174
 							'default' => 'disabled',
175 175
 							'options' => array(
176
-								'enabled'  => __( 'Enabled', 'give' ),
177
-								'disabled' => __( 'Disabled', 'give' ),
176
+								'enabled'  => __('Enabled', 'give'),
177
+								'disabled' => __('Disabled', 'give'),
178 178
 							)
179 179
 						),
180 180
 						array(
181
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
182
-							'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
181
+							'name' => esc_html__('Enabled Gateways', 'give'),
182
+							'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'),
183 183
 							'id'   => 'gateways',
184 184
 							'type' => 'enabled_gateways'
185 185
 						),
186 186
 						array(
187
-							'name' => esc_html__( 'Default Gateway', 'give' ),
188
-							'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ),
187
+							'name' => esc_html__('Default Gateway', 'give'),
188
+							'desc' => esc_html__('The gateway that will be selected by default.', 'give'),
189 189
 							'id'   => 'default_gateway',
190 190
 							'type' => 'default_gateway'
191 191
 						),
192 192
                         array(
193
-                            'name'  => esc_html__( 'Gateways Docs Link', 'give' ),
193
+                            'name'  => esc_html__('Gateways Docs Link', 'give'),
194 194
                             'id'    => 'gateway_settings_docs_link',
195
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
-                            'title' => __( 'Gateway Settings', 'give' ),
195
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
196
+                            'title' => __('Gateway Settings', 'give'),
197 197
                             'type'  => 'give_docs_link',
198 198
                         ),
199 199
 						array(
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			 * Filter the payment gateways settings.
209 209
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
210 210
 			 */
211
-			$settings = apply_filters( 'give_settings_gateways', $settings );
211
+			$settings = apply_filters('give_settings_gateways', $settings);
212 212
 
213 213
 			/**
214 214
 			 * Filter the settings.
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			 *
218 218
 			 * @param  array $settings
219 219
 			 */
220
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
220
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
221 221
 
222 222
 			// Output.
223 223
 			return $settings;
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 		 */
232 232
 		public function get_sections() {
233 233
 			$sections = array(
234
-				'gateways-settings' => esc_html__( 'Gateways', 'give' ),
235
-				'paypal-standard'   => esc_html__( 'Paypal Standard', 'give' ),
236
-				'offline-donations' => esc_html__( 'Offline', 'give' )
234
+				'gateways-settings' => esc_html__('Gateways', 'give'),
235
+				'paypal-standard'   => esc_html__('Paypal Standard', 'give'),
236
+				'offline-donations' => esc_html__('Offline', 'give')
237 237
 			);
238 238
 
239
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
239
+			return apply_filters('give_get_sections_'.$this->id, $sections);
240 240
 		}
241 241
 	}
242 242
 
Please login to merge, or discard this patch.