Test Failed
Pull Request — master (#2211)
by Ravinder
05:56 queued 47s
created
templates/emails/body.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
9
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
10 10
 
11 11
 // {email} is replaced by the content entered in Donations > Settings > Emails
12 12
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,10 @@
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
9
+if ( ! defined( 'ABSPATH' ) ) {
10
+	exit;
11
+}
12
+// Exit if accessed directly.
10 13
 
11 14
 // {email} is replaced by the content entered in Donations > Settings > Emails
12 15
 
Please login to merge, or discard this patch.
includes/plugin-compatibility.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' )
42
-	       || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
-	     && class_exists( 'WPSEO_Sitemaps_Cache' )
42
+		   || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
+		 && class_exists( 'WPSEO_Sitemaps_Cache' )
44 44
 	) {
45 45
 
46 46
 		$forms_singular_option = give_get_option( 'forms_singular' );
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @return void
20 20
  */
21 21
 function give_disable_mandrill_nl2br() {
22
-	add_filter( 'mandrill_nl2br', '__return_false' );
22
+	add_filter('mandrill_nl2br', '__return_false');
23 23
 }
24 24
 
25
-add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' );
25
+add_action('give_email_send_before', 'give_disable_mandrill_nl2br');
26 26
 
27 27
 
28 28
 /**
@@ -34,30 +34,30 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function give_clear_seo_sitemap_cache_on_settings_change() {
36 36
 	// Load required file if the fn 'is_plugin_active' doesn't exists.
37
-	if ( ! function_exists( 'is_plugin_active' ) ) {
38
-		require_once ABSPATH . 'wp-admin/includes/plugin.php';
37
+	if ( ! function_exists('is_plugin_active')) {
38
+		require_once ABSPATH.'wp-admin/includes/plugin.php';
39 39
 	}
40 40
 
41
-	if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' )
42
-	       || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
-	     && class_exists( 'WPSEO_Sitemaps_Cache' )
41
+	if ((is_plugin_active('wordpress-seo/wp-seo.php')
42
+	       || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php'))
43
+	     && class_exists('WPSEO_Sitemaps_Cache')
44 44
 	) {
45 45
 
46
-		$forms_singular_option = give_get_option( 'forms_singular' );
47
-		$forms_archive_option  = give_get_option( 'forms_singular' );
46
+		$forms_singular_option = give_get_option('forms_singular');
47
+		$forms_archive_option  = give_get_option('forms_singular');
48 48
 
49 49
 		// If there is change detected for Single Form View and Form Archives options then proceed.
50 50
 		if (
51
-			( isset( $_POST['forms_singular'] ) && $_POST['forms_singular'] !== $forms_singular_option ) ||
52
-			( isset( $_POST['forms_archives'] ) && $_POST['forms_archives'] !== $forms_archive_option )
51
+			(isset($_POST['forms_singular']) && $_POST['forms_singular'] !== $forms_singular_option) ||
52
+			(isset($_POST['forms_archives']) && $_POST['forms_archives'] !== $forms_archive_option)
53 53
 		) {
54 54
 			// If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache.
55 55
 			$yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache();
56
-			if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) {
56
+			if (method_exists($yoast_sitemaps_cache, 'clear')) {
57 57
 				WPSEO_Sitemaps_Cache::clear();
58 58
 			}
59 59
 		}
60 60
 	}
61 61
 }
62 62
 
63
-add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' );
63
+add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change');
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +148 added lines, -148 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'               => __( 'Donation Forms', 'give' ),
42
-		'singular_name'      => __( 'Form', 'give' ),
43
-		'add_new'            => __( 'Add Form', 'give' ),
44
-		'add_new_item'       => __( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => __( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => __( 'New Form', 'give' ),
47
-		'all_items'          => __( 'All Forms', 'give' ),
48
-		'view_item'          => __( 'View Form', 'give' ),
49
-		'search_items'       => __( 'Search Forms', 'give' ),
50
-		'not_found'          => __( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => __('Donation Forms', 'give'),
42
+		'singular_name'      => __('Form', 'give'),
43
+		'add_new'            => __('Add Form', 'give'),
44
+		'add_new_item'       => __('Add New Donation Form', 'give'),
45
+		'edit_item'          => __('Edit Donation Form', 'give'),
46
+		'new_item'           => __('New Form', 'give'),
47
+		'all_items'          => __('All Forms', 'give'),
48
+		'view_item'          => __('View Form', 'give'),
49
+		'search_items'       => __('Search Forms', 'give'),
50
+		'not_found'          => __('No forms found.', 'give'),
51
+		'not_found_in_trash' => __('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ),
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', __('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', __('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(
@@ -86,42 +86,42 @@  discard block
 block discarded – undo
86 86
 		'has_archive'        => $give_forms_archives,
87 87
 		'menu_icon'          => 'dashicons-give',
88 88
 		'hierarchical'       => false,
89
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
89
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
90 90
 	);
91
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
91
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
92 92
 
93 93
 	/** Donation Post Type */
94 94
 	$payment_labels = array(
95
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
96
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
97
-		'add_new'            => __( 'Add New', 'give' ),
98
-		'add_new_item'       => __( 'Add New Donation', 'give' ),
99
-		'edit_item'          => __( 'Edit Donation', 'give' ),
100
-		'new_item'           => __( 'New Donation', 'give' ),
101
-		'all_items'          => __( 'All Donations', 'give' ),
102
-		'view_item'          => __( 'View Donation', 'give' ),
103
-		'search_items'       => __( 'Search Donations', 'give' ),
104
-		'not_found'          => __( 'No donations found.', 'give' ),
105
-		'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ),
95
+		'name'               => _x('Donations', 'post type general name', 'give'),
96
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
97
+		'add_new'            => __('Add New', 'give'),
98
+		'add_new_item'       => __('Add New Donation', 'give'),
99
+		'edit_item'          => __('Edit Donation', 'give'),
100
+		'new_item'           => __('New Donation', 'give'),
101
+		'all_items'          => __('All Donations', 'give'),
102
+		'view_item'          => __('View Donation', 'give'),
103
+		'search_items'       => __('Search Donations', 'give'),
104
+		'not_found'          => __('No donations found.', 'give'),
105
+		'not_found_in_trash' => __('No donations found in Trash.', 'give'),
106 106
 		'parent_item_colon'  => '',
107
-		'menu_name'          => __( 'Donations', 'give' ),
107
+		'menu_name'          => __('Donations', 'give'),
108 108
 	);
109 109
 
110 110
 	$payment_args = array(
111
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
111
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
112 112
 		'public'          => false,
113 113
 		'query_var'       => false,
114 114
 		'rewrite'         => false,
115 115
 		'map_meta_cap'    => true,
116 116
 		'capability_type' => 'give_payment',
117
-		'supports'        => array( 'title' ),
117
+		'supports'        => array('title'),
118 118
 		'can_export'      => true,
119 119
 	);
120
-	register_post_type( 'give_payment', $payment_args );
120
+	register_post_type('give_payment', $payment_args);
121 121
 
122 122
 }
123 123
 
124
-add_action( 'init', 'give_setup_post_types', 1 );
124
+add_action('init', 'give_setup_post_types', 1);
125 125
 
126 126
 
127 127
 /**
@@ -134,30 +134,30 @@  discard block
 block discarded – undo
134 134
  */
135 135
 function give_setup_taxonomies() {
136 136
 
137
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
137
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
138 138
 
139 139
 	/** Categories */
140 140
 	$category_labels = array(
141
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
142
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
143
-		'search_items'      => __( 'Search Categories', 'give' ),
144
-		'all_items'         => __( 'All Categories', 'give' ),
145
-		'parent_item'       => __( 'Parent Category', 'give' ),
146
-		'parent_item_colon' => __( 'Parent Category:', 'give' ),
147
-		'edit_item'         => __( 'Edit Category', 'give' ),
148
-		'update_item'       => __( 'Update Category', 'give' ),
149
-		'add_new_item'      => __( 'Add New Category', 'give' ),
150
-		'new_item_name'     => __( 'New Category Name', 'give' ),
151
-		'menu_name'         => __( 'Categories', 'give' ),
141
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
142
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
143
+		'search_items'      => __('Search Categories', 'give'),
144
+		'all_items'         => __('All Categories', 'give'),
145
+		'parent_item'       => __('Parent Category', 'give'),
146
+		'parent_item_colon' => __('Parent Category:', 'give'),
147
+		'edit_item'         => __('Edit Category', 'give'),
148
+		'update_item'       => __('Update Category', 'give'),
149
+		'add_new_item'      => __('Add New Category', 'give'),
150
+		'new_item_name'     => __('New Category Name', 'give'),
151
+		'menu_name'         => __('Categories', 'give'),
152 152
 	);
153 153
 
154
-	$category_args = apply_filters( 'give_forms_category_args', array(
154
+	$category_args = apply_filters('give_forms_category_args', array(
155 155
 			'hierarchical' => true,
156
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
156
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
157 157
 			'show_ui'      => true,
158 158
 			'query_var'    => 'give_forms_category',
159 159
 			'rewrite'      => array(
160
-				'slug'         => $slug . '/category',
160
+				'slug'         => $slug.'/category',
161 161
 				'with_front'   => false,
162 162
 				'hierarchical' => true,
163 163
 			),
@@ -171,33 +171,33 @@  discard block
 block discarded – undo
171 171
 	);
172 172
 
173 173
 	// Does the user want categories?
174
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
175
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
176
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
174
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
175
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
176
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
177 177
 	}
178 178
 
179 179
 	/** Tags */
180 180
 	$tag_labels = array(
181
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
182
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
183
-		'search_items'          => __( 'Search Tags', 'give' ),
184
-		'all_items'             => __( 'All Tags', 'give' ),
185
-		'parent_item'           => __( 'Parent Tag', 'give' ),
186
-		'parent_item_colon'     => __( 'Parent Tag:', 'give' ),
187
-		'edit_item'             => __( 'Edit Tag', 'give' ),
188
-		'update_item'           => __( 'Update Tag', 'give' ),
189
-		'add_new_item'          => __( 'Add New Tag', 'give' ),
190
-		'new_item_name'         => __( 'New Tag Name', 'give' ),
191
-		'menu_name'             => __( 'Tags', 'give' ),
192
-		'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ),
181
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
182
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
183
+		'search_items'          => __('Search Tags', 'give'),
184
+		'all_items'             => __('All Tags', 'give'),
185
+		'parent_item'           => __('Parent Tag', 'give'),
186
+		'parent_item_colon'     => __('Parent Tag:', 'give'),
187
+		'edit_item'             => __('Edit Tag', 'give'),
188
+		'update_item'           => __('Update Tag', 'give'),
189
+		'add_new_item'          => __('Add New Tag', 'give'),
190
+		'new_item_name'         => __('New Tag Name', 'give'),
191
+		'menu_name'             => __('Tags', 'give'),
192
+		'choose_from_most_used' => __('Choose from most used tags.', 'give'),
193 193
 	);
194 194
 
195
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
195
+	$tag_args = apply_filters('give_forms_tag_args', array(
196 196
 			'hierarchical' => false,
197
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
197
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
198 198
 			'show_ui'      => true,
199 199
 			'query_var'    => 'give_forms_tag',
200
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
200
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
201 201
 			'capabilities' => array(
202 202
 				'manage_terms' => 'manage_give_form_terms',
203 203
 				'edit_terms'   => 'edit_give_form_terms',
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 		)
208 208
 	);
209 209
 
210
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
211
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
212
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
210
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
211
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
212
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
213 213
 	}
214 214
 
215 215
 }
216 216
 
217
-add_action( 'init', 'give_setup_taxonomies', 0 );
217
+add_action('init', 'give_setup_taxonomies', 0);
218 218
 
219 219
 
220 220
 /**
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
  */
226 226
 function give_get_default_form_labels() {
227 227
 	$defaults = array(
228
-		'singular' => __( 'Form', 'give' ),
229
-		'plural'   => __( 'Forms', 'give' ),
228
+		'singular' => __('Form', 'give'),
229
+		'plural'   => __('Forms', 'give'),
230 230
 	);
231 231
 
232
-	return apply_filters( 'give_default_form_name', $defaults );
232
+	return apply_filters('give_default_form_name', $defaults);
233 233
 }
234 234
 
235 235
 /**
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return string $defaults['singular'] Singular label
243 243
  */
244
-function give_get_forms_label_singular( $lowercase = false ) {
244
+function give_get_forms_label_singular($lowercase = false) {
245 245
 	$defaults = give_get_default_form_labels();
246 246
 
247
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
247
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
248 248
 }
249 249
 
250 250
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  * @since 1.0
254 254
  * @return string $defaults['plural'] Plural label
255 255
  */
256
-function give_get_forms_label_plural( $lowercase = false ) {
256
+function give_get_forms_label_plural($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
259
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
260 260
 }
261 261
 
262 262
 /**
@@ -268,24 +268,24 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return string $title New placeholder text
270 270
  */
271
-function give_change_default_title( $title ) {
271
+function give_change_default_title($title) {
272 272
 	// If a frontend plugin uses this filter (check extensions before changing this function)
273
-	if ( ! is_admin() ) {
274
-		$title = __( 'Enter form title here', 'give' );
273
+	if ( ! is_admin()) {
274
+		$title = __('Enter form title here', 'give');
275 275
 
276 276
 		return $title;
277 277
 	}
278 278
 
279 279
 	$screen = get_current_screen();
280 280
 
281
-	if ( 'give_forms' == $screen->post_type ) {
282
-		$title = __( 'Enter form title here', 'give' );
281
+	if ('give_forms' == $screen->post_type) {
282
+		$title = __('Enter form title here', 'give');
283 283
 	}
284 284
 
285 285
 	return $title;
286 286
 }
287 287
 
288
-add_filter( 'enter_title_here', 'give_change_default_title' );
288
+add_filter('enter_title_here', 'give_change_default_title');
289 289
 
290 290
 /**
291 291
  * Registers Custom Post Statuses which are used by the Payments
@@ -295,67 +295,67 @@  discard block
 block discarded – undo
295 295
  */
296 296
 function give_register_post_type_statuses() {
297 297
 	// Payment Statuses
298
-	register_post_status( 'refunded', array(
299
-		'label'                     => __( 'Refunded', 'give' ),
298
+	register_post_status('refunded', array(
299
+		'label'                     => __('Refunded', 'give'),
300 300
 		'public'                    => true,
301 301
 		'exclude_from_search'       => false,
302 302
 		'show_in_admin_all_list'    => true,
303 303
 		'show_in_admin_status_list' => true,
304
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
305
-	) );
306
-	register_post_status( 'failed', array(
307
-		'label'                     => __( 'Failed', 'give' ),
304
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'),
305
+	));
306
+	register_post_status('failed', array(
307
+		'label'                     => __('Failed', 'give'),
308 308
 		'public'                    => true,
309 309
 		'exclude_from_search'       => false,
310 310
 		'show_in_admin_all_list'    => true,
311 311
 		'show_in_admin_status_list' => true,
312
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
313
-	) );
314
-	register_post_status( 'revoked', array(
315
-		'label'                     => __( 'Revoked', 'give' ),
312
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'),
313
+	));
314
+	register_post_status('revoked', array(
315
+		'label'                     => __('Revoked', 'give'),
316 316
 		'public'                    => true,
317 317
 		'exclude_from_search'       => false,
318 318
 		'show_in_admin_all_list'    => true,
319 319
 		'show_in_admin_status_list' => true,
320
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
321
-	) );
322
-	register_post_status( 'cancelled', array(
323
-		'label'                     => __( 'Cancelled', 'give' ),
320
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'),
321
+	));
322
+	register_post_status('cancelled', array(
323
+		'label'                     => __('Cancelled', 'give'),
324 324
 		'public'                    => true,
325 325
 		'exclude_from_search'       => false,
326 326
 		'show_in_admin_all_list'    => true,
327 327
 		'show_in_admin_status_list' => true,
328
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
329
-	) );
330
-	register_post_status( 'abandoned', array(
331
-		'label'                     => __( 'Abandoned', 'give' ),
328
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'),
329
+	));
330
+	register_post_status('abandoned', array(
331
+		'label'                     => __('Abandoned', 'give'),
332 332
 		'public'                    => true,
333 333
 		'exclude_from_search'       => false,
334 334
 		'show_in_admin_all_list'    => true,
335 335
 		'show_in_admin_status_list' => true,
336
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
337
-	) );
338
-	register_post_status( 'processing', array(
339
-		'label'                     => _x( 'Processing', 'Processing payment status', 'give' ),
336
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'),
337
+	));
338
+	register_post_status('processing', array(
339
+		'label'                     => _x('Processing', 'Processing payment status', 'give'),
340 340
 		'public'                    => true,
341 341
 		'exclude_from_search'       => false,
342 342
 		'show_in_admin_all_list'    => true,
343 343
 		'show_in_admin_status_list' => true,
344
-		'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' )
345
-	)  );
344
+		'label_count'               => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give')
345
+	));
346 346
 
347
-	register_post_status( 'preapproval', array(
348
-		'label'                     => _x( 'Preapproval', 'Preapproval payment status', 'give' ),
347
+	register_post_status('preapproval', array(
348
+		'label'                     => _x('Preapproval', 'Preapproval payment status', 'give'),
349 349
 		'public'                    => true,
350 350
 		'exclude_from_search'       => false,
351 351
 		'show_in_admin_all_list'    => true,
352 352
 		'show_in_admin_status_list' => true,
353
-		'label_count'               => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ),
354
-	) );
353
+		'label_count'               => _n_noop('Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give'),
354
+	));
355 355
 
356 356
 }
357 357
 
358
-add_action( 'init', 'give_register_post_type_statuses' );
358
+add_action('init', 'give_register_post_type_statuses');
359 359
 
360 360
 /**
361 361
  * Updated Messages
@@ -368,27 +368,27 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return array $messages New post updated messages
370 370
  */
371
-function give_updated_messages( $messages ) {
371
+function give_updated_messages($messages) {
372 372
 	global $post, $post_ID;
373 373
 
374
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) {
374
+	if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) {
375 375
 
376 376
 		$messages['give_forms'] = array(
377
-			1 => __( 'Form updated.', 'give' ),
378
-			4 => __( 'Form updated.', 'give' ),
379
-			6 => __( 'Form published.', 'give' ),
380
-			7 => __( 'Form saved.', 'give' ),
381
-			8 => __( 'Form submitted.', 'give' ),
377
+			1 => __('Form updated.', 'give'),
378
+			4 => __('Form updated.', 'give'),
379
+			6 => __('Form published.', 'give'),
380
+			7 => __('Form saved.', 'give'),
381
+			8 => __('Form submitted.', 'give'),
382 382
 		);
383 383
 
384 384
 	} else {
385 385
 
386 386
 		$messages['give_forms'] = array(
387
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
388
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
389
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
390
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
391
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
387
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
388
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
389
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
390
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
391
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
392 392
 		);
393 393
 
394 394
 	}
@@ -396,24 +396,24 @@  discard block
 block discarded – undo
396 396
 	return $messages;
397 397
 }
398 398
 
399
-add_filter( 'post_updated_messages', 'give_updated_messages' );
399
+add_filter('post_updated_messages', 'give_updated_messages');
400 400
 
401 401
 /**
402 402
  * Ensure post thumbnail support is turned on
403 403
  */
404 404
 function give_add_thumbnail_support() {
405
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
405
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
406 406
 		return;
407 407
 	}
408 408
 
409
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
410
-		add_theme_support( 'post-thumbnails' );
409
+	if ( ! current_theme_supports('post-thumbnails')) {
410
+		add_theme_support('post-thumbnails');
411 411
 	}
412 412
 
413
-	add_post_type_support( 'give_forms', 'thumbnail' );
413
+	add_post_type_support('give_forms', 'thumbnail');
414 414
 }
415 415
 
416
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
416
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
417 417
 
418 418
 /**
419 419
  * Give Sidebars
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 
425 425
 	// Single Give Forms (disabled if single turned off in settings)
426 426
 	if (
427
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) )
428
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
427
+		give_is_setting_enabled(give_get_option('forms_singular'))
428
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
429 429
 	) {
430 430
 
431
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
432
-			'name'          => __( 'Give Single Form Sidebar', 'give' ),
431
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
432
+			'name'          => __('Give Single Form Sidebar', 'give'),
433 433
 			'id'            => 'give-forms-sidebar',
434
-			'description'   => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
434
+			'description'   => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
435 435
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
436 436
 			'after_widget'  => '</div>',
437 437
 			'before_title'  => '<h3 class="widgettitle widget-title">',
438 438
 			'after_title'   => '</h3>',
439
-		) ) );
439
+		)));
440 440
 
441 441
 	}
442 442
 }
443 443
 
444
-add_action( 'widgets_init', 'give_widgets_init', 999 );
444
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
         <h2 class="nav-tab-wrapper">
121 121
             <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
             </a>
125 125
             <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
             </a>
129 129
             <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
             </a>
133 133
             <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-               href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+               href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
             </a>
137 137
         </h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
         <div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             <p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: https://givewp.com/documenation/ */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'https://givewp.com/documenation/' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('https://givewp.com/documenation/')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             <div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
             <div class="feature-section clearfix introduction">
176 176
 
177 177
                 <div class="video feature-section-item">
178
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>"
179
-                         alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>"
179
+                         alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
                 </div>
181 181
 
182 182
                 <div class="content feature-section-item last-feature">
183 183
 
184
-                    <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+                    <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-                    <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+                    <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
                     <a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
                         <span class="dashicons dashicons-external"></span>
190 190
                     </a>
191 191
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
                 <div class="content feature-section-item">
200 200
 
201
-                    <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+                    <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-                    <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+                    <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
                     <h4>Find Out More:</h4>
206 206
                     <ul class="ul-disc">
207
-                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
-                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
209
-                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
207
+                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
208
+                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
209
+                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
210 210
                     </ul>
211 211
 
212 212
                 </div>
213 213
 
214 214
                 <div class="content  feature-section-item last-feature">
215
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>"
216
-                         alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
215
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>"
216
+                         alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
217 217
                 </div>
218 218
 
219 219
             </div>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function changelog_screen() {
235
-		list( $display_version ) = explode( '-', GIVE_VERSION );
235
+		list($display_version) = explode('-', GIVE_VERSION);
236 236
 		?>
237 237
         <div class="wrap about-wrap">
238 238
             <h1><?php echo get_admin_page_title(); ?></h1>
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
             <p class="about-text"><?php
241 241
 				printf(
242 242
 				/* translators: %s: Give version */
243
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
243
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
244 244
 					$display_version
245 245
 				);
246 246
 				?></p>
247 247
             <div class="give-badge"><?php
248 248
 				printf(
249 249
 				/* translators: %s: Give version */
250
-					esc_html__( 'Version %s', 'give' ),
250
+					esc_html__('Version %s', 'give'),
251 251
 					$display_version
252 252
 				);
253 253
 				?></div>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			<?php $this->tabs(); ?>
256 256
 
257 257
             <div class="changelog">
258
-                <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
258
+                <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
259 259
 
260 260
                 <div class="feature-section">
261 261
 					<?php echo $this->parse_readme(); ?>
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             </div>
264 264
 
265 265
             <div class="return-to-dashboard">
266
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array(
266
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array(
267 267
 					'post_type' => 'give_forms',
268 268
 					'page'      => 'give-settings'
269
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
269
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
270 270
             </div>
271 271
         </div>
272 272
 		<?php
@@ -280,36 +280,36 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function getting_started_screen() {
283
-		list( $display_version ) = explode( '-', GIVE_VERSION );
283
+		list($display_version) = explode('-', GIVE_VERSION);
284 284
 		?>
285 285
         <div class="wrap about-wrap get-started">
286 286
 
287 287
 			<?php $this->get_welcome_header() ?>
288 288
 
289
-            <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
289
+            <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
290 290
 
291 291
 			<?php give_get_newsletter(); ?>
292 292
 
293 293
             <div class="give-badge"><?php
294 294
 				printf(
295 295
 				/* translators: %s: Give version */
296
-					esc_html__( 'Version %s', 'give' ),
296
+					esc_html__('Version %s', 'give'),
297 297
 					$display_version
298 298
 				);
299 299
 				?></div>
300 300
 
301 301
 			<?php $this->tabs(); ?>
302 302
 
303
-            <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
303
+            <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
304 304
 
305 305
             <div class="feature-section clearfix">
306 306
 
307 307
                 <div class="content feature-section-item">
308
-                    <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
308
+                    <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
309 309
 
310
-                    <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
310
+                    <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
311 311
 
312
-                    <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
312
+                    <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
313 313
                 </div>
314 314
 
315 315
                 <div class="content feature-section-item last-feature">
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
                 </div>
327 327
 
328 328
                 <div class="content feature-section-item last-feature">
329
-                    <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
329
+                    <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
330 330
 
331
-                    <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
331
+                    <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
332 332
                 </div>
333 333
 
334 334
             </div>
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
             <div class="feature-section clearfix">
338 338
 
339 339
                 <div class="content feature-section-item add-content">
340
-                    <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
340
+                    <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
341 341
 
342
-                    <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
342
+                    <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
343 343
 
344
-                    <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
344
+                    <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
345 345
                 </div>
346 346
 
347 347
                 <div class="content feature-section-item last-feature">
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 </div>
359 359
 
360 360
                 <div class="content feature-section-item last-feature">
361
-                    <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
361
+                    <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
362 362
 
363
-                    <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
363
+                    <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
364 364
                 </div>
365 365
 
366 366
 
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function credits_screen() {
383
-		list( $display_version ) = explode( '-', GIVE_VERSION );
383
+		list($display_version) = explode('-', GIVE_VERSION);
384 384
 		?>
385 385
         <div class="wrap about-wrap">
386 386
 
387 387
 			<?php $this->get_welcome_header() ?>
388 388
 
389
-            <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
389
+            <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
390 390
 
391 391
 			<?php give_get_newsletter(); ?>
392 392
 
393 393
             <div class="give-badge"><?php
394 394
 				printf(
395 395
 				/* translators: %s: Give version */
396
-					esc_html__( 'Version %s', 'give' ),
396
+					esc_html__('Version %s', 'give'),
397 397
 					$display_version
398 398
 				);
399 399
 				?></div>
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             <p class="about-description"><?php
404 404
 				printf(
405 405
 				/* translators: %s: https://github.com/WordImpress/give */
406
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
407
-					esc_url( 'https://github.com/WordImpress/give' )
406
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
407
+					esc_url('https://github.com/WordImpress/give')
408 408
 				);
409 409
 				?></p>
410 410
 
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 	 * @return string $readme HTML formatted readme file
422 422
 	 */
423 423
 	public function parse_readme() {
424
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
424
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
425 425
 
426
-		if ( ! $file ) {
427
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
426
+		if ( ! $file) {
427
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
428 428
 		} else {
429
-			$readme = file_get_contents( $file );
430
-			$readme = nl2br( esc_html( $readme ) );
431
-			$readme = explode( '== Changelog ==', $readme );
432
-			$readme = end( $readme );
433
-
434
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
435
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
436
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
437
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
438
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
429
+			$readme = file_get_contents($file);
430
+			$readme = nl2br(esc_html($readme));
431
+			$readme = explode('== Changelog ==', $readme);
432
+			$readme = end($readme);
433
+
434
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
435
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
436
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
437
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
438
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
439 439
 		}
440 440
 
441 441
 		return $readme;
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 	public function contributors() {
453 453
 		$contributors = $this->get_contributors();
454 454
 
455
-		if ( empty( $contributors ) ) {
455
+		if (empty($contributors)) {
456 456
 			return '';
457 457
 		}
458 458
 
459 459
 		$contributor_list = '<ul class="wp-people-group">';
460 460
 
461
-		foreach ( $contributors as $contributor ) {
461
+		foreach ($contributors as $contributor) {
462 462
 			$contributor_list .= '<li class="wp-person">';
463 463
 			$contributor_list .= sprintf(
464 464
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
465
-				esc_url( 'https://github.com/' . $contributor->login ),
466
-				esc_url( $contributor->avatar_url ),
467
-				esc_attr( $contributor->login )
465
+				esc_url('https://github.com/'.$contributor->login),
466
+				esc_url($contributor->avatar_url),
467
+				esc_attr($contributor->login)
468 468
 			);
469 469
 			$contributor_list .= sprintf(
470 470
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
471
-				esc_url( 'https://github.com/' . $contributor->login ),
472
-				esc_html( $contributor->login )
471
+				esc_url('https://github.com/'.$contributor->login),
472
+				esc_html($contributor->login)
473 473
 			);
474 474
 			$contributor_list .= '</li>';
475 475
 		}
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 	 * @return array $contributors List of contributors
488 488
 	 */
489 489
 	public function get_contributors() {
490
-		$contributors = Give_Cache::get( 'give_contributors', true );
490
+		$contributors = Give_Cache::get('give_contributors', true);
491 491
 
492
-		if ( false !== $contributors ) {
492
+		if (false !== $contributors) {
493 493
 			return $contributors;
494 494
 		}
495 495
 
496
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
496
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
497 497
 
498
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
498
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
499 499
 			return array();
500 500
 		}
501 501
 
502
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
502
+		$contributors = json_decode(wp_remote_retrieve_body($response));
503 503
 
504
-		if ( ! is_array( $contributors ) ) {
504
+		if ( ! is_array($contributors)) {
505 505
 			return array();
506 506
 		}
507 507
 
508
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
508
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
509 509
 
510 510
 		return $contributors;
511 511
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function get_welcome_header() {
519 519
 		// Badge for welcome page
520
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
520
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
521 521
 		?>
522 522
         <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
523 523
 		<?php $this->social_media_elements(); ?>
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
611 611
 				printf(
612 612
 				/* translators: %s: Give twitter user @givewp */
613
-					esc_html_e( 'Follow %s', 'give' ),
613
+					esc_html_e('Follow %s', 'give'),
614 614
 					'@givewp'
615 615
 				);
616 616
 				?></a>
@@ -644,27 +644,27 @@  discard block
 block discarded – undo
644 644
 	public function welcome() {
645 645
 
646 646
 		// Bail if no activation redirect
647
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
647
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
648 648
 			return;
649 649
 		}
650 650
 
651 651
 		// Delete the redirect transient
652
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
652
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
653 653
 
654 654
 		// Bail if activating from network, or bulk
655
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
655
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
656 656
 			return;
657 657
 		}
658 658
 
659
-		$upgrade = get_option( 'give_version_upgraded_from' );
659
+		$upgrade = get_option('give_version_upgraded_from');
660 660
 
661
-		if ( ! $upgrade ) { // First time install
662
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
661
+		if ( ! $upgrade) { // First time install
662
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
663 663
 			exit;
664
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
664
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
665 665
 
666 666
 		} else { // Welcome is NOT disabled in settings
667
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
667
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
668 668
 			exit;
669 669
 		}
670 670
 	}
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function get_predefined_dates() {
95 95
 		$predefined = array(
96
-			'today'        => esc_html__( 'Today', 'give' ),
97
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
98
-			'this_week'    => esc_html__( 'This Week', 'give' ),
99
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
100
-			'this_month'   => esc_html__( 'This Month', 'give' ),
101
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
102
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
103
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
104
-			'this_year'    => esc_html__( 'This Year', 'give' ),
105
-			'last_year'    => esc_html__( 'Last Year', 'give' ),
96
+			'today'        => esc_html__('Today', 'give'),
97
+			'yesterday'    => esc_html__('Yesterday', 'give'),
98
+			'this_week'    => esc_html__('This Week', 'give'),
99
+			'last_week'    => esc_html__('Last Week', 'give'),
100
+			'this_month'   => esc_html__('This Month', 'give'),
101
+			'last_month'   => esc_html__('Last Month', 'give'),
102
+			'this_quarter' => esc_html__('This Quarter', 'give'),
103
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
104
+			'this_year'    => esc_html__('This Year', 'give'),
105
+			'last_year'    => esc_html__('Last Year', 'give'),
106 106
 		);
107 107
 
108
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
108
+		return apply_filters('give_stats_predefined_dates', $predefined);
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return void
123 123
 	 */
124
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
124
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
125 125
 
126
-		if ( empty( $_start_date ) ) {
126
+		if (empty($_start_date)) {
127 127
 			$_start_date = 'this_month';
128 128
 		}
129 129
 
130
-		if ( empty( $_end_date ) ) {
130
+		if (empty($_end_date)) {
131 131
 			$_end_date = $_start_date;
132 132
 		}
133 133
 
134
-		$this->start_date = $this->convert_date( $_start_date );
135
-		$this->end_date   = $this->convert_date( $_end_date, true );
134
+		$this->start_date = $this->convert_date($_start_date);
135
+		$this->end_date   = $this->convert_date($_end_date, true);
136 136
 	}
137 137
 
138 138
 	/**
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
150 150
 	 */
151
-	public function convert_date( $date, $end_date = false ) {
151
+	public function convert_date($date, $end_date = false) {
152 152
 
153 153
 		$this->timestamp = false;
154 154
 		$second          = $end_date ? 59 : 0;
155 155
 		$minute          = $end_date ? 59 : 0;
156 156
 		$hour            = $end_date ? 23 : 0;
157 157
 		$day             = 1;
158
-		$month           = date( 'n', current_time( 'timestamp' ) );
159
-		$year            = date( 'Y', current_time( 'timestamp' ) );
158
+		$month           = date('n', current_time('timestamp'));
159
+		$year            = date('Y', current_time('timestamp'));
160 160
 
161
-		if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) {
161
+		if (array_key_exists((string) $date, $this->get_predefined_dates())) {
162 162
 
163 163
 			// This is a predefined date rate, such as last_week
164
-			switch ( $date ) {
164
+			switch ($date) {
165 165
 
166 166
 				case 'this_month' :
167 167
 
168
-					if ( $end_date ) {
168
+					if ($end_date) {
169 169
 
170
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
170
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
171 171
 						$hour   = 23;
172 172
 						$minute = 59;
173 173
 						$second = 59;
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
 
178 178
 				case 'last_month' :
179 179
 
180
-					if ( $month == 1 ) {
180
+					if ($month == 1) {
181 181
 
182 182
 						$month = 12;
183
-						$year --;
183
+						$year--;
184 184
 
185 185
 					} else {
186 186
 
187
-						$month --;
187
+						$month--;
188 188
 
189 189
 					}
190 190
 
191
-					if ( $end_date ) {
192
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
191
+					if ($end_date) {
192
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
193 193
 					}
194 194
 
195 195
 					break;
196 196
 
197 197
 				case 'today' :
198 198
 
199
-					$day = date( 'd', current_time( 'timestamp' ) );
199
+					$day = date('d', current_time('timestamp'));
200 200
 
201
-					if ( $end_date ) {
201
+					if ($end_date) {
202 202
 						$hour   = 23;
203 203
 						$minute = 59;
204 204
 						$second = 59;
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
 
209 209
 				case 'yesterday' :
210 210
 
211
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
211
+					$day = date('d', current_time('timestamp')) - 1;
212 212
 
213 213
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
214
-					if ( $day < 1 ) {
214
+					if ($day < 1) {
215 215
 
216 216
 						// If current month is 1
217
-						if ( 1 == $month ) {
217
+						if (1 == $month) {
218 218
 
219 219
 							$year -= 1; // Today is January 1, so skip back to last day of December
220 220
 							$month = 12;
221
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
221
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
222 222
 
223 223
 						} else {
224 224
 
225 225
 							// Go back one month and get the last day of the month
226 226
 							$month -= 1;
227
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
227
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
228 228
 
229 229
 						}
230 230
 					}
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 
234 234
 				case 'this_week' :
235 235
 
236
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
237
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
236
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
237
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
238 238
 
239
-					if ( $today < $days_to_week_start ) {
239
+					if ($today < $days_to_week_start) {
240 240
 
241
-						if ( $month > 1 ) {
241
+						if ($month > 1) {
242 242
 							$month -= 1;
243 243
 						} else {
244 244
 							$month = 12;
@@ -246,19 +246,19 @@  discard block
 block discarded – undo
246 246
 
247 247
 					}
248 248
 
249
-					if ( ! $end_date ) {
249
+					if ( ! $end_date) {
250 250
 
251 251
 						// Getting the start day
252 252
 
253
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
254
-						$day += get_option( 'start_of_week' );
253
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
254
+						$day += get_option('start_of_week');
255 255
 
256 256
 					} else {
257 257
 
258 258
 						// Getting the end day
259 259
 
260
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
261
-						$day += get_option( 'start_of_week' ) + 6;
260
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
261
+						$day += get_option('start_of_week') + 6;
262 262
 
263 263
 					}
264 264
 
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 
267 267
 				case 'last_week' :
268 268
 
269
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
270
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
269
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
270
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
271 271
 
272
-					if ( $today < $days_to_week_start ) {
272
+					if ($today < $days_to_week_start) {
273 273
 
274
-						if ( $month > 1 ) {
274
+						if ($month > 1) {
275 275
 							$month -= 1;
276 276
 						} else {
277 277
 							$month = 12;
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
 
280 280
 					}
281 281
 
282
-					if ( ! $end_date ) {
282
+					if ( ! $end_date) {
283 283
 
284 284
 						// Getting the start day
285 285
 
286
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
287
-						$day += get_option( 'start_of_week' );
286
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
287
+						$day += get_option('start_of_week');
288 288
 
289 289
 					} else {
290 290
 
291 291
 						// Getting the end day
292 292
 
293
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
294
-						$day += get_option( 'start_of_week' ) + 6;
293
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
294
+						$day += get_option('start_of_week') + 6;
295 295
 
296 296
 					}
297 297
 
@@ -299,39 +299,39 @@  discard block
 block discarded – undo
299 299
 
300 300
 				case 'this_quarter' :
301 301
 
302
-					$month_now = date( 'n', current_time( 'timestamp' ) );
302
+					$month_now = date('n', current_time('timestamp'));
303 303
 
304
-					if ( $month_now <= 3 ) {
304
+					if ($month_now <= 3) {
305 305
 
306
-						if ( ! $end_date ) {
306
+						if ( ! $end_date) {
307 307
 							$month = 1;
308 308
 						} else {
309 309
 							$month  = 3;
310
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
310
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
311 311
 							$hour   = 23;
312 312
 							$minute = 59;
313 313
 							$second = 59;
314 314
 						}
315 315
 
316
-					} else if ( $month_now <= 6 ) {
316
+					} else if ($month_now <= 6) {
317 317
 
318
-						if ( ! $end_date ) {
318
+						if ( ! $end_date) {
319 319
 							$month = 4;
320 320
 						} else {
321 321
 							$month  = 6;
322
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
322
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
323 323
 							$hour   = 23;
324 324
 							$minute = 59;
325 325
 							$second = 59;
326 326
 						}
327 327
 
328
-					} else if ( $month_now <= 9 ) {
328
+					} else if ($month_now <= 9) {
329 329
 
330
-						if ( ! $end_date ) {
330
+						if ( ! $end_date) {
331 331
 							$month = 7;
332 332
 						} else {
333 333
 							$month  = 9;
334
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
334
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
335 335
 							$hour   = 23;
336 336
 							$minute = 59;
337 337
 							$second = 59;
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 
340 340
 					} else {
341 341
 
342
-						if ( ! $end_date ) {
342
+						if ( ! $end_date) {
343 343
 							$month = 10;
344 344
 						} else {
345 345
 							$month  = 12;
346
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
346
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
347 347
 							$hour   = 23;
348 348
 							$minute = 59;
349 349
 							$second = 59;
@@ -355,40 +355,40 @@  discard block
 block discarded – undo
355 355
 
356 356
 				case 'last_quarter' :
357 357
 
358
-					$month_now = date( 'n', current_time( 'timestamp' ) );
358
+					$month_now = date('n', current_time('timestamp'));
359 359
 
360
-					if ( $month_now <= 3 ) {
360
+					if ($month_now <= 3) {
361 361
 
362
-						if ( ! $end_date ) {
362
+						if ( ! $end_date) {
363 363
 							$month = 10;
364 364
 						} else {
365 365
 							$year -= 1;
366 366
 							$month  = 12;
367
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
367
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
368 368
 							$hour   = 23;
369 369
 							$minute = 59;
370 370
 							$second = 59;
371 371
 						}
372 372
 
373
-					} else if ( $month_now <= 6 ) {
373
+					} else if ($month_now <= 6) {
374 374
 
375
-						if ( ! $end_date ) {
375
+						if ( ! $end_date) {
376 376
 							$month = 1;
377 377
 						} else {
378 378
 							$month  = 3;
379
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
379
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
380 380
 							$hour   = 23;
381 381
 							$minute = 59;
382 382
 							$second = 59;
383 383
 						}
384 384
 
385
-					} else if ( $month_now <= 9 ) {
385
+					} else if ($month_now <= 9) {
386 386
 
387
-						if ( ! $end_date ) {
387
+						if ( ! $end_date) {
388 388
 							$month = 4;
389 389
 						} else {
390 390
 							$month  = 6;
391
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
391
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
392 392
 							$hour   = 23;
393 393
 							$minute = 59;
394 394
 							$second = 59;
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 
397 397
 					} else {
398 398
 
399
-						if ( ! $end_date ) {
399
+						if ( ! $end_date) {
400 400
 							$month = 7;
401 401
 						} else {
402 402
 							$month  = 9;
403
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
403
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
404 404
 							$hour   = 23;
405 405
 							$minute = 59;
406 406
 							$second = 59;
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 				case 'this_year' :
414 414
 
415
-					if ( ! $end_date ) {
415
+					if ( ! $end_date) {
416 416
 						$month = 1;
417 417
 					} else {
418 418
 						$month  = 12;
419
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
419
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
420 420
 						$hour   = 23;
421 421
 						$minute = 59;
422 422
 						$second = 59;
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 				case 'last_year' :
428 428
 
429 429
 					$year -= 1;
430
-					if ( ! $end_date ) {
430
+					if ( ! $end_date) {
431 431
 						$month = 1;
432 432
 					} else {
433 433
 						$month  = 12;
434
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
434
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
435 435
 						$hour   = 23;
436 436
 						$minute = 59;
437 437
 						$second = 59;
@@ -442,30 +442,30 @@  discard block
 block discarded – undo
442 442
 			}
443 443
 
444 444
 
445
-		} else if ( is_numeric( $date ) ) {
445
+		} else if (is_numeric($date)) {
446 446
 
447 447
 			// return $date unchanged since it is a timestamp
448 448
 			$this->timestamp = true;
449 449
 
450
-		} else if ( false !== strtotime( $date ) ) {
450
+		} else if (false !== strtotime($date)) {
451 451
 
452
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
453
-			$year  = date( 'Y', $date );
454
-			$month = date( 'm', $date );
455
-			$day   = date( 'd', $date );
452
+			$date  = strtotime($date, current_time('timestamp'));
453
+			$year  = date('Y', $date);
454
+			$month = date('m', $date);
455
+			$day   = date('d', $date);
456 456
 
457 457
 		} else {
458 458
 
459
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
459
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
460 460
 
461 461
 		}
462 462
 
463
-		if ( false === $this->timestamp ) {
463
+		if (false === $this->timestamp) {
464 464
 			// Create an exact timestamp
465
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
465
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
466 466
 		}
467 467
 
468
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
468
+		return apply_filters('give_stats_date', $date, $end_date, $this);
469 469
 
470 470
 	}
471 471
 
@@ -481,33 +481,33 @@  discard block
 block discarded – undo
481 481
 	 * 
482 482
 	 * @return string
483 483
 	 */
484
-	public function count_where( $where = '' ) {
484
+	public function count_where($where = '') {
485 485
 		// Only get payments in our date range
486 486
 
487 487
 		$start_where = '';
488 488
 		$end_where   = '';
489 489
 
490
-		if ( $this->start_date ) {
490
+		if ($this->start_date) {
491 491
 
492
-			if ( $this->timestamp ) {
492
+			if ($this->timestamp) {
493 493
 				$format = 'Y-m-d H:i:s';
494 494
 			} else {
495 495
 				$format = 'Y-m-d 00:00:00';
496 496
 			}
497 497
 
498
-			$start_date  = date( $format, $this->start_date );
498
+			$start_date  = date($format, $this->start_date);
499 499
 			$start_where = " AND p.post_date >= '{$start_date}'";
500 500
 		}
501 501
 
502
-		if ( $this->end_date ) {
502
+		if ($this->end_date) {
503 503
 
504
-			if ( $this->timestamp ) {
504
+			if ($this->timestamp) {
505 505
 				$format = 'Y-m-d H:i:s';
506 506
 			} else {
507 507
 				$format = 'Y-m-d 23:59:59';
508 508
 			}
509 509
 
510
-			$end_date = date( $format, $this->end_date );
510
+			$end_date = date($format, $this->end_date);
511 511
 
512 512
 			$end_where = " AND p.post_date <= '{$end_date}'";
513 513
 		}
@@ -529,34 +529,34 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @return string
531 531
 	 */
532
-	public function payments_where( $where = '' ) {
532
+	public function payments_where($where = '') {
533 533
 
534 534
 		global $wpdb;
535 535
 
536 536
 		$start_where = '';
537 537
 		$end_where   = '';
538 538
 
539
-		if ( ! is_wp_error( $this->start_date ) ) {
539
+		if ( ! is_wp_error($this->start_date)) {
540 540
 
541
-			if ( $this->timestamp ) {
541
+			if ($this->timestamp) {
542 542
 				$format = 'Y-m-d H:i:s';
543 543
 			} else {
544 544
 				$format = 'Y-m-d 00:00:00';
545 545
 			}
546 546
 
547
-			$start_date  = date( $format, $this->start_date );
547
+			$start_date  = date($format, $this->start_date);
548 548
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
549 549
 		}
550 550
 
551
-		if ( ! is_wp_error( $this->end_date ) ) {
551
+		if ( ! is_wp_error($this->end_date)) {
552 552
 
553
-			if ( $this->timestamp ) {
553
+			if ($this->timestamp) {
554 554
 				$format = 'Y-m-d H:i:s';
555 555
 			} else {
556 556
 				$format = 'Y-m-d 23:59:59';
557 557
 			}
558 558
 
559
-			$end_date = date( $format, $this->end_date );
559
+			$end_date = date($format, $this->end_date);
560 560
 
561 561
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
562 562
 		}
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @param  int|bool $payment_id A given payment
371 371
 	 *
372
-	 * @return mixed void|false
372
+	 * @return false|null void|false
373 373
 	 */
374 374
 	public function __construct( $payment_id = false ) {
375 375
 
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 	 *
1089 1089
 	 * @param  string $note The note to add
1090 1090
 	 *
1091
-	 * @return bool           If the note was specified or not
1091
+	 * @return false|null           If the note was specified or not
1092 1092
 	 */
1093 1093
 	public function add_note( $note = false ) {
1094 1094
 		// 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
@@ -1012,7 +1012,7 @@
 block discarded – undo
1012 1012
 					// Find a match between price_id and level_id.
1013 1013
 					// First verify array keys exists THEN make the match.
1014 1014
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1015
-					     && $args['price_id'] == $price['_give_id']['level_id']
1015
+						 && $args['price_id'] == $price['_give_id']['level_id']
1016 1016
 					) {
1017 1017
 						$donation_amount = $price['_give_amount'];
1018 1018
 					}
Please login to merge, or discard this patch.
Spacing   +287 added lines, -287 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
 
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return mixed void|false
394 394
 	 */
395
-	public function __construct( $payment_id = false ) {
395
+	public function __construct($payment_id = false) {
396 396
 
397
-		if ( empty( $payment_id ) ) {
397
+		if (empty($payment_id)) {
398 398
 			return false;
399 399
 		}
400 400
 
401
-		$this->setup_payment( $payment_id );
401
+		$this->setup_payment($payment_id);
402 402
 	}
403 403
 
404 404
 	/**
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @return mixed        The value.
413 413
 	 */
414
-	public function __get( $key ) {
414
+	public function __get($key) {
415 415
 
416
-		if ( method_exists( $this, 'get_' . $key ) ) {
416
+		if (method_exists($this, 'get_'.$key)) {
417 417
 
418
-			$value = call_user_func( array( $this, 'get_' . $key ) );
418
+			$value = call_user_func(array($this, 'get_'.$key));
419 419
 
420 420
 		} else {
421 421
 
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 	 * @param  string $key   The property name
438 438
 	 * @param  mixed  $value The value of the property
439 439
 	 */
440
-	public function __set( $key, $value ) {
441
-		$ignore = array( '_ID' );
440
+	public function __set($key, $value) {
441
+		$ignore = array('_ID');
442 442
 
443
-		if ( 'status' === $key ) {
443
+		if ('status' === $key) {
444 444
 			$this->old_status = $this->status;
445 445
 		}
446 446
 
447
-		if ( ! in_array( $key, $ignore ) ) {
448
-			$this->pending[ $key ] = $value;
447
+		if ( ! in_array($key, $ignore)) {
448
+			$this->pending[$key] = $value;
449 449
 		}
450 450
 
451
-		if ( '_ID' !== $key ) {
451
+		if ('_ID' !== $key) {
452 452
 			$this->$key = $value;
453 453
 		}
454 454
 	}
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
 	 *
464 464
 	 * @return boolean|null       If the item is set or not
465 465
 	 */
466
-	public function __isset( $name ) {
467
-		if ( property_exists( $this, $name ) ) {
468
-			return false === empty( $this->$name );
466
+	public function __isset($name) {
467
+		if (property_exists($this, $name)) {
468
+			return false === empty($this->$name);
469 469
 		} else {
470 470
 			return null;
471 471
 		}
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @return bool            If the setup was successful or not
483 483
 	 */
484
-	private function setup_payment( $payment_id ) {
484
+	private function setup_payment($payment_id) {
485 485
 		$this->pending = array();
486 486
 
487
-		if ( empty( $payment_id ) ) {
487
+		if (empty($payment_id)) {
488 488
 			return false;
489 489
 		}
490 490
 
491
-		$payment = get_post( $payment_id );
491
+		$payment = get_post($payment_id);
492 492
 
493
-		if ( ! $payment || is_wp_error( $payment ) ) {
493
+		if ( ! $payment || is_wp_error($payment)) {
494 494
 			return false;
495 495
 		}
496 496
 
497
-		if ( 'give_payment' !== $payment->post_type ) {
497
+		if ('give_payment' !== $payment->post_type) {
498 498
 			return false;
499 499
 		}
500 500
 
@@ -508,13 +508,13 @@  discard block
 block discarded – undo
508 508
 		 * @param Give_Payment $this       Payment object.
509 509
 		 * @param int          $payment_id The ID of the payment.
510 510
 		 */
511
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
511
+		do_action('give_pre_setup_payment', $this, $payment_id);
512 512
 
513 513
 		// Primary Identifier.
514
-		$this->ID = absint( $payment_id );
514
+		$this->ID = absint($payment_id);
515 515
 
516 516
 		// Protected ID that can never be changed.
517
-		$this->_ID = absint( $payment_id );
517
+		$this->_ID = absint($payment_id);
518 518
 
519 519
 		// We have a payment, get the generic payment_meta item to reduce calls to it.
520 520
 		$this->payment_meta = $this->get_meta();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		$this->parent_payment = $payment->post_parent;
531 531
 
532 532
 		$all_payment_statuses  = give_get_payment_statuses();
533
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
533
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
534 534
 
535 535
 		// Currency Based.
536 536
 		$this->total    = $this->setup_total();
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param Give_Payment $this       Payment object.
569 569
 		 * @param int          $payment_id The ID of the payment.
570 570
 		 */
571
-		do_action( 'give_setup_payment', $this, $payment_id );
571
+		do_action('give_setup_payment', $this, $payment_id);
572 572
 
573 573
 		return true;
574 574
 	}
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @return void
588 588
 	 */
589
-	public function update_payment_setup( $payment_id ) {
590
-		$this->setup_payment( $payment_id );
589
+	public function update_payment_setup($payment_id) {
590
+		$this->setup_payment($payment_id);
591 591
 	}
592 592
 
593 593
 	/**
@@ -602,24 +602,24 @@  discard block
 block discarded – undo
602 602
 
603 603
 		// Construct the payment title.
604 604
 		$payment_title = '';
605
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
606
-			$payment_title = $this->first_name . ' ' . $this->last_name;
607
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
605
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
606
+			$payment_title = $this->first_name.' '.$this->last_name;
607
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
608 608
 			$payment_title = $this->first_name;
609
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
609
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
610 610
 			$payment_title = $this->email;
611 611
 		}
612 612
 
613 613
 		// Set Key.
614
-		if ( empty( $this->key ) ) {
614
+		if (empty($this->key)) {
615 615
 
616
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
617
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
616
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
617
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
618 618
 			$this->pending['key'] = $this->key;
619 619
 		}
620 620
 
621 621
 		// Set IP.
622
-		if ( empty( $this->ip ) ) {
622
+		if (empty($this->ip)) {
623 623
 
624 624
 			$this->ip            = give_get_ip();
625 625
 			$this->pending['ip'] = $this->ip;
@@ -646,19 +646,19 @@  discard block
 block discarded – undo
646 646
 			'status'       => $this->status,
647 647
 		);
648 648
 
649
-		$args = apply_filters( 'give_insert_payment_args', array(
649
+		$args = apply_filters('give_insert_payment_args', array(
650 650
 			'post_title'    => $payment_title,
651 651
 			'post_status'   => $this->status,
652 652
 			'post_type'     => 'give_payment',
653
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
654
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
653
+			'post_date'     => ! empty($this->date) ? $this->date : null,
654
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
655 655
 			'post_parent'   => $this->parent_payment,
656
-		), $payment_data );
656
+		), $payment_data);
657 657
 
658 658
 		// Create a blank payment
659
-		$payment_id = wp_insert_post( $args );
659
+		$payment_id = wp_insert_post($args);
660 660
 
661
-		if ( ! empty( $payment_id ) ) {
661
+		if ( ! empty($payment_id)) {
662 662
 
663 663
 			$this->ID  = $payment_id;
664 664
 			$this->_ID = $payment_id;
@@ -670,40 +670,40 @@  discard block
 block discarded – undo
670 670
 			 *
671 671
 			 * @since 1.8.13
672 672
 			 */
673
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
673
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
674 674
 
675
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
676
-				$donor = new Give_Donor( get_current_user_id(), true );
675
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
676
+				$donor = new Give_Donor(get_current_user_id(), true);
677 677
 
678 678
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
679
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
680
-					$donor->add_email( $this->email );
679
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
680
+					$donor->add_email($this->email);
681 681
 				}
682 682
 			}
683 683
 
684
-			if ( empty( $donor->id ) ) {
685
-				$donor = new Give_Donor( $this->email );
684
+			if (empty($donor->id)) {
685
+				$donor = new Give_Donor($this->email);
686 686
 			}
687 687
 
688
-			if ( empty( $donor->id ) ) {
688
+			if (empty($donor->id)) {
689 689
 
690 690
 				$donor_data = array(
691
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
691
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
692 692
 					'email'   => $this->email,
693 693
 					'user_id' => $this->user_id,
694 694
 				);
695 695
 
696
-				$donor->create( $donor_data );
696
+				$donor->create($donor_data);
697 697
 
698 698
 			}
699 699
 
700 700
 			$this->customer_id            = $donor->id;
701 701
 			$this->pending['customer_id'] = $this->customer_id;
702
-			$donor->attach_payment( $this->ID, false );
702
+			$donor->attach_payment($this->ID, false);
703 703
 
704
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
704
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
705 705
 
706
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
706
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
707 707
 			$this->new = true;
708 708
 		}// End if().
709 709
 
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 		$saved = false;
726 726
 
727 727
 		// Must have an ID.
728
-		if ( empty( $this->ID ) ) {
728
+		if (empty($this->ID)) {
729 729
 
730 730
 			$payment_id = $this->insert_payment();
731 731
 
732
-			if ( false === $payment_id ) {
732
+			if (false === $payment_id) {
733 733
 				$saved = false;
734 734
 			} else {
735 735
 				$this->ID = $payment_id;
@@ -737,42 +737,42 @@  discard block
 block discarded – undo
737 737
 		}
738 738
 
739 739
 		// Set ID if not matching.
740
-		if ( $this->ID !== $this->_ID ) {
740
+		if ($this->ID !== $this->_ID) {
741 741
 			$this->ID = $this->_ID;
742 742
 		}
743 743
 
744 744
 		// If we have something pending, let's save it.
745
-		if ( ! empty( $this->pending ) ) {
745
+		if ( ! empty($this->pending)) {
746 746
 
747 747
 			$total_increase = 0;
748 748
 			$total_decrease = 0;
749 749
 
750
-			foreach ( $this->pending as $key => $value ) {
750
+			foreach ($this->pending as $key => $value) {
751 751
 
752
-				switch ( $key ) {
752
+				switch ($key) {
753 753
 
754 754
 					case 'donations':
755 755
 						// Update totals for pending donations.
756
-						foreach ( $this->pending[ $key ] as $item ) {
756
+						foreach ($this->pending[$key] as $item) {
757 757
 
758
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
759
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
758
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
759
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
760 760
 
761
-							switch ( $item['action'] ) {
761
+							switch ($item['action']) {
762 762
 
763 763
 								case 'add':
764 764
 
765 765
 									$price = $item['price'];
766 766
 
767
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
767
+									if ('publish' === $this->status || 'complete' === $this->status) {
768 768
 
769 769
 										// Add donation to logs.
770
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
771
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
770
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
771
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
772 772
 
773
-										$form = new Give_Donate_Form( $item['id'] );
774
-										$form->increase_sales( $quantity );
775
-										$form->increase_earnings( $price );
773
+										$form = new Give_Donate_Form($item['id']);
774
+										$form->increase_sales($quantity);
775
+										$form->increase_earnings($price);
776 776
 
777 777
 										$total_increase += $price;
778 778
 									}
@@ -797,15 +797,15 @@  discard block
 block discarded – undo
797 797
 										),
798 798
 									);
799 799
 
800
-									$found_logs = get_posts( $log_args );
801
-									foreach ( $found_logs as $log ) {
802
-										wp_delete_post( $log->ID, true );
800
+									$found_logs = get_posts($log_args);
801
+									foreach ($found_logs as $log) {
802
+										wp_delete_post($log->ID, true);
803 803
 									}
804 804
 
805
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
806
-										$form = new Give_Donate_Form( $item['id'] );
807
-										$form->decrease_sales( $quantity );
808
-										$form->decrease_earnings( $item['amount'] );
805
+									if ('publish' === $this->status || 'complete' === $this->status) {
806
+										$form = new Give_Donate_Form($item['id']);
807
+										$form->decrease_sales($quantity);
808
+										$form->decrease_earnings($item['amount']);
809 809
 
810 810
 										$total_decrease += $item['amount'];
811 811
 									}
@@ -816,44 +816,44 @@  discard block
 block discarded – undo
816 816
 						break;
817 817
 
818 818
 					case 'status':
819
-						$this->update_status( $this->status );
819
+						$this->update_status($this->status);
820 820
 						break;
821 821
 
822 822
 					case 'gateway':
823
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
823
+						$this->update_meta('_give_payment_gateway', $this->gateway);
824 824
 						break;
825 825
 
826 826
 					case 'mode':
827
-						$this->update_meta( '_give_payment_mode', $this->mode );
827
+						$this->update_meta('_give_payment_mode', $this->mode);
828 828
 						break;
829 829
 
830 830
 					case 'transaction_id':
831
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
831
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
832 832
 						break;
833 833
 
834 834
 					case 'ip':
835
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
835
+						$this->update_meta('_give_payment_user_ip', $this->ip);
836 836
 						break;
837 837
 
838 838
 					case 'customer_id':
839
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
839
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
840 840
 						break;
841 841
 
842 842
 					case 'user_id':
843
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
843
+						$this->update_meta('_give_payment_user_id', $this->user_id);
844 844
 						$this->user_info['id'] = $this->user_id;
845 845
 						break;
846 846
 
847 847
 					case 'form_title':
848
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
848
+						$this->update_meta('_give_payment_form_title', $this->form_title);
849 849
 						break;
850 850
 
851 851
 					case 'form_id':
852
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
852
+						$this->update_meta('_give_payment_form_id', $this->form_id);
853 853
 						break;
854 854
 
855 855
 					case 'price_id':
856
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
856
+						$this->update_meta('_give_payment_price_id', $this->price_id);
857 857
 						break;
858 858
 
859 859
 					case 'first_name':
@@ -869,15 +869,15 @@  discard block
 block discarded – undo
869 869
 						break;
870 870
 
871 871
 					case 'email':
872
-						$this->update_meta( '_give_payment_user_email', $this->email );
872
+						$this->update_meta('_give_payment_user_email', $this->email);
873 873
 						break;
874 874
 
875 875
 					case 'key':
876
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
876
+						$this->update_meta('_give_payment_purchase_key', $this->key);
877 877
 						break;
878 878
 
879 879
 					case 'number':
880
-						$this->update_meta( '_give_payment_number', $this->number );
880
+						$this->update_meta('_give_payment_number', $this->number);
881 881
 						break;
882 882
 
883 883
 					case 'date':
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
 							'edit_date' => true,
888 888
 						);
889 889
 
890
-						wp_update_post( $args );
890
+						wp_update_post($args);
891 891
 						break;
892 892
 
893 893
 					case 'completed_date':
894
-						$this->update_meta( '_give_completed_date', $this->completed_date );
894
+						$this->update_meta('_give_completed_date', $this->completed_date);
895 895
 						break;
896 896
 
897 897
 					case 'parent_payment':
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 							'post_parent' => $this->parent_payment,
901 901
 						);
902 902
 
903
-						wp_update_post( $args );
903
+						wp_update_post($args);
904 904
 						break;
905 905
 
906 906
 					default:
@@ -911,33 +911,33 @@  discard block
 block discarded – undo
911 911
 						 *
912 912
 						 * @param Give_Payment $this Payment object.
913 913
 						 */
914
-						do_action( 'give_payment_save', $this, $key );
914
+						do_action('give_payment_save', $this, $key);
915 915
 						break;
916 916
 				}// End switch().
917 917
 			}// End foreach().
918 918
 
919
-			if ( 'pending' !== $this->status ) {
919
+			if ('pending' !== $this->status) {
920 920
 
921
-				$donor = new Give_Donor( $this->customer_id );
921
+				$donor = new Give_Donor($this->customer_id);
922 922
 
923 923
 				$total_change = $total_increase - $total_decrease;
924
-				if ( $total_change < 0 ) {
924
+				if ($total_change < 0) {
925 925
 
926
-					$total_change = - ( $total_change );
926
+					$total_change = - ($total_change);
927 927
 					// Decrease the donor's donation stats.
928
-					$donor->decrease_value( $total_change );
929
-					give_decrease_total_earnings( $total_change );
928
+					$donor->decrease_value($total_change);
929
+					give_decrease_total_earnings($total_change);
930 930
 
931
-				} elseif ( $total_change > 0 ) {
931
+				} elseif ($total_change > 0) {
932 932
 
933 933
 					// Increase the donor's donation stats.
934
-					$donor->increase_value( $total_change );
935
-					give_increase_total_earnings( $total_change );
934
+					$donor->increase_value($total_change);
935
+					give_increase_total_earnings($total_change);
936 936
 
937 937
 				}
938 938
 			}
939 939
 
940
-			$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
940
+			$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
941 941
 
942 942
 			$new_meta = array(
943 943
 				'form_title' => $this->form_title,
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 			);
949 949
 
950 950
 			$meta        = $this->get_meta();
951
-			$merged_meta = array_merge( $meta, $new_meta );
951
+			$merged_meta = array_merge($meta, $new_meta);
952 952
 
953 953
 			// Only save the payment meta if it's changed.
954
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
955
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
956
-				if ( false !== $updated ) {
954
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
955
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
956
+				if (false !== $updated) {
957 957
 					$saved = true;
958 958
 				}
959 959
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 			$saved         = true;
963 963
 		}// End if().
964 964
 
965
-		if ( true === $saved ) {
966
-			$this->setup_payment( $this->ID );
965
+		if (true === $saved) {
966
+			$this->setup_payment($this->ID);
967 967
 		}
968 968
 
969 969
 		return $saved;
@@ -981,12 +981,12 @@  discard block
 block discarded – undo
981 981
 	 *
982 982
 	 * @return bool           True when successful, false otherwise
983 983
 	 */
984
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
984
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
985 985
 
986
-		$donation = new Give_Donate_Form( $form_id );
986
+		$donation = new Give_Donate_Form($form_id);
987 987
 
988 988
 		// Bail if this post isn't a give donation form.
989
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
989
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
990 990
 			return false;
991 991
 		}
992 992
 
@@ -996,59 +996,59 @@  discard block
 block discarded – undo
996 996
 			'price_id' => false,
997 997
 		);
998 998
 
999
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
999
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1000 1000
 
1001 1001
 		// Allow overriding the price.
1002
-		if ( false !== $args['price'] ) {
1002
+		if (false !== $args['price']) {
1003 1003
 			$donation_amount = $args['price'];
1004 1004
 		} else {
1005 1005
 
1006 1006
 			// Deal with variable pricing.
1007
-			if ( give_has_variable_prices( $donation->ID ) ) {
1008
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1007
+			if (give_has_variable_prices($donation->ID)) {
1008
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1009 1009
 				$donation_amount = '';
1010 1010
 				// Loop through prices.
1011
-				foreach ( $prices as $price ) {
1011
+				foreach ($prices as $price) {
1012 1012
 					// Find a match between price_id and level_id.
1013 1013
 					// First verify array keys exists THEN make the match.
1014
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1014
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1015 1015
 					     && $args['price_id'] == $price['_give_id']['level_id']
1016 1016
 					) {
1017 1017
 						$donation_amount = $price['_give_amount'];
1018 1018
 					}
1019 1019
 				}
1020 1020
 				// Fallback to the lowest price point.
1021
-				if ( $donation_amount == '' ) {
1022
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1023
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1021
+				if ($donation_amount == '') {
1022
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1023
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1024 1024
 				}
1025 1025
 			} else {
1026 1026
 				// Simple form price.
1027
-				$donation_amount = give_get_form_price( $donation->ID );
1027
+				$donation_amount = give_get_form_price($donation->ID);
1028 1028
 			}
1029 1029
 		}
1030 1030
 
1031 1031
 		// Sanitizing the price here so we don't have a dozen calls later.
1032
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1033
-		$total           = round( $donation_amount, give_currency_decimal_filter() );
1032
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1033
+		$total           = round($donation_amount, give_currency_decimal_filter());
1034 1034
 
1035 1035
 		// Add Options.
1036 1036
 		$default_options = array();
1037
-		if ( false !== $args['price_id'] ) {
1037
+		if (false !== $args['price_id']) {
1038 1038
 			$default_options['price_id'] = (int) $args['price_id'];
1039 1039
 		}
1040
-		$options = wp_parse_args( $options, $default_options );
1040
+		$options = wp_parse_args($options, $default_options);
1041 1041
 
1042 1042
 		// Do not allow totals to go negative.
1043
-		if ( $total < 0 ) {
1043
+		if ($total < 0) {
1044 1044
 			$total = 0;
1045 1045
 		}
1046 1046
 
1047 1047
 		$donation = array(
1048 1048
 			'name'     => $donation->post_title,
1049 1049
 			'id'       => $donation->ID,
1050
-			'price'    => round( $total, give_currency_decimal_filter() ),
1051
-			'subtotal' => round( $total, give_currency_decimal_filter() ),
1050
+			'price'    => round($total, give_currency_decimal_filter()),
1051
+			'subtotal' => round($total, give_currency_decimal_filter()),
1052 1052
 			'price_id' => $args['price_id'],
1053 1053
 			'action'   => 'add',
1054 1054
 			'options'  => $options,
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 		$this->pending['donations'][] = $donation;
1058 1058
 
1059
-		$this->increase_subtotal( $total );
1059
+		$this->increase_subtotal($total);
1060 1060
 
1061 1061
 		return true;
1062 1062
 
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 *
1074 1074
 	 * @return bool           If the item was removed or not
1075 1075
 	 */
1076
-	public function remove_donation( $form_id, $args = array() ) {
1076
+	public function remove_donation($form_id, $args = array()) {
1077 1077
 
1078 1078
 		// Set some defaults.
1079 1079
 		$defaults = array(
@@ -1081,12 +1081,12 @@  discard block
 block discarded – undo
1081 1081
 			'price'    => false,
1082 1082
 			'price_id' => false,
1083 1083
 		);
1084
-		$args     = wp_parse_args( $args, $defaults );
1084
+		$args = wp_parse_args($args, $defaults);
1085 1085
 
1086
-		$form = new Give_Donate_Form( $form_id );
1086
+		$form = new Give_Donate_Form($form_id);
1087 1087
 
1088 1088
 		// Bail if this post isn't a valid give donation form.
1089
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1089
+		if ( ! $form || $form->post_type !== 'give_forms') {
1090 1090
 			return false;
1091 1091
 		}
1092 1092
 
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 		$this->pending['donations'][] = $pending_args;
1101 1101
 
1102
-		$this->decrease_subtotal( $this->total );
1102
+		$this->decrease_subtotal($this->total);
1103 1103
 
1104 1104
 		return true;
1105 1105
 	}
@@ -1115,13 +1115,13 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @return bool           If the note was specified or not
1117 1117
 	 */
1118
-	public function add_note( $note = false ) {
1118
+	public function add_note($note = false) {
1119 1119
 		// Bail if no note specified.
1120
-		if ( ! $note ) {
1120
+		if ( ! $note) {
1121 1121
 			return false;
1122 1122
 		}
1123 1123
 
1124
-		give_insert_payment_note( $this->ID, $note );
1124
+		give_insert_payment_note($this->ID, $note);
1125 1125
 	}
1126 1126
 
1127 1127
 	/**
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @return void
1136 1136
 	 */
1137
-	private function increase_subtotal( $amount = 0.00 ) {
1138
-		$amount         = (float) $amount;
1137
+	private function increase_subtotal($amount = 0.00) {
1138
+		$amount = (float) $amount;
1139 1139
 		$this->subtotal += $amount;
1140 1140
 
1141 1141
 		$this->recalculate_total();
@@ -1151,11 +1151,11 @@  discard block
 block discarded – undo
1151 1151
 	 *
1152 1152
 	 * @return void
1153 1153
 	 */
1154
-	private function decrease_subtotal( $amount = 0.00 ) {
1155
-		$amount         = (float) $amount;
1154
+	private function decrease_subtotal($amount = 0.00) {
1155
+		$amount = (float) $amount;
1156 1156
 		$this->subtotal -= $amount;
1157 1157
 
1158
-		if ( $this->subtotal < 0 ) {
1158
+		if ($this->subtotal < 0) {
1159 1159
 			$this->subtotal = 0;
1160 1160
 		}
1161 1161
 
@@ -1184,24 +1184,24 @@  discard block
 block discarded – undo
1184 1184
 	 *
1185 1185
 	 * @return bool   $updated Returns if the status was successfully updated.
1186 1186
 	 */
1187
-	public function update_status( $status = false ) {
1187
+	public function update_status($status = false) {
1188 1188
 
1189 1189
 		// standardize the 'complete(d)' status.
1190
-		if ( $status == 'completed' || $status == 'complete' ) {
1190
+		if ($status == 'completed' || $status == 'complete') {
1191 1191
 			$status = 'publish';
1192 1192
 		}
1193 1193
 
1194
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1194
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1195 1195
 
1196
-		if ( $old_status === $status ) {
1196
+		if ($old_status === $status) {
1197 1197
 			return false; // Don't permit status changes that aren't changes.
1198 1198
 		}
1199 1199
 
1200
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1200
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1201 1201
 
1202 1202
 		$updated = false;
1203 1203
 
1204
-		if ( $do_change ) {
1204
+		if ($do_change) {
1205 1205
 
1206 1206
 			/**
1207 1207
 			 * Fires before changing payment status.
@@ -1212,21 +1212,21 @@  discard block
 block discarded – undo
1212 1212
 			 * @param string $status     The new status.
1213 1213
 			 * @param string $old_status The old status.
1214 1214
 			 */
1215
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1215
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1216 1216
 
1217 1217
 			$update_fields = array(
1218 1218
 				'ID'          => $this->ID,
1219 1219
 				'post_status' => $status,
1220
-				'edit_date'   => current_time( 'mysql' ),
1220
+				'edit_date'   => current_time('mysql'),
1221 1221
 			);
1222 1222
 
1223
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1223
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1224 1224
 
1225 1225
 			$all_payment_statuses  = give_get_payment_statuses();
1226
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1226
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1227 1227
 
1228 1228
 			// Process any specific status functions.
1229
-			switch ( $status ) {
1229
+			switch ($status) {
1230 1230
 				case 'refunded':
1231 1231
 					$this->process_refund();
1232 1232
 					break;
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 			 * @param string $status     The new status.
1254 1254
 			 * @param string $old_status The old status.
1255 1255
 			 */
1256
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1256
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1257 1257
 
1258 1258
 		}// End if().
1259 1259
 
@@ -1288,41 +1288,41 @@  discard block
 block discarded – undo
1288 1288
 	 *
1289 1289
 	 * @return mixed             The value from the post meta
1290 1290
 	 */
1291
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1291
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1292 1292
 
1293
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1293
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1294 1294
 
1295
-		if ( $meta_key === '_give_payment_meta' ) {
1295
+		if ($meta_key === '_give_payment_meta') {
1296 1296
 			$meta = (array) $meta;
1297 1297
 
1298
-			if ( empty( $meta['key'] ) ) {
1298
+			if (empty($meta['key'])) {
1299 1299
 				$meta['key'] = $this->setup_payment_key();
1300 1300
 			}
1301 1301
 
1302
-			if ( empty( $meta['form_title'] ) ) {
1302
+			if (empty($meta['form_title'])) {
1303 1303
 				$meta['form_title'] = $this->setup_form_title();
1304 1304
 			}
1305 1305
 
1306
-			if ( empty( $meta['email'] ) ) {
1306
+			if (empty($meta['email'])) {
1307 1307
 				$meta['email'] = $this->setup_email();
1308 1308
 			}
1309 1309
 
1310
-			if ( empty( $meta['date'] ) ) {
1311
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1310
+			if (empty($meta['date'])) {
1311
+				$meta['date'] = get_post_field('post_date', $this->ID);
1312 1312
 			}
1313 1313
 		}
1314 1314
 
1315
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1315
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1316 1316
 
1317 1317
 		// Security check.
1318
-		if ( is_serialized( $meta ) ) {
1319
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1320
-			if ( ! empty( $matches ) ) {
1318
+		if (is_serialized($meta)) {
1319
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1320
+			if ( ! empty($matches)) {
1321 1321
 				$meta = array();
1322 1322
 			}
1323 1323
 		}
1324 1324
 
1325
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1325
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1326 1326
 	}
1327 1327
 
1328 1328
 	/**
@@ -1337,23 +1337,23 @@  discard block
 block discarded – undo
1337 1337
 	 *
1338 1338
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1339 1339
 	 */
1340
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1341
-		if ( empty( $meta_key ) ) {
1340
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1341
+		if (empty($meta_key)) {
1342 1342
 			return false;
1343 1343
 		}
1344 1344
 
1345
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1345
+		if ($meta_key == 'key' || $meta_key == 'date') {
1346 1346
 
1347 1347
 			$current_meta              = $this->get_meta();
1348
-			$current_meta[ $meta_key ] = $meta_value;
1348
+			$current_meta[$meta_key] = $meta_value;
1349 1349
 
1350 1350
 			$meta_key   = '_give_payment_meta';
1351 1351
 			$meta_value = $current_meta;
1352 1352
 
1353
-		} elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1353
+		} elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1354 1354
 
1355
-			$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1356
-			give_update_meta( $this->ID, '_give_payment_user_email', $meta_value );
1355
+			$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1356
+			give_update_meta($this->ID, '_give_payment_user_email', $meta_value);
1357 1357
 
1358 1358
 			$current_meta                       = $this->get_meta();
1359 1359
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1363,9 +1363,9 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 		}
1365 1365
 
1366
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1366
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1367 1367
 
1368
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1368
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1369 1369
 	}
1370 1370
 
1371 1371
 	/**
@@ -1380,14 +1380,14 @@  discard block
 block discarded – undo
1380 1380
 		$process_refund = true;
1381 1381
 
1382 1382
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1383
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1383
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1384 1384
 			$process_refund = false;
1385 1385
 		}
1386 1386
 
1387 1387
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1388
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1388
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1389 1389
 
1390
-		if ( false === $process_refund ) {
1390
+		if (false === $process_refund) {
1391 1391
 			return;
1392 1392
 		}
1393 1393
 
@@ -1398,13 +1398,13 @@  discard block
 block discarded – undo
1398 1398
 		 *
1399 1399
 		 * @param Give_Payment $this Payment object.
1400 1400
 		 */
1401
-		do_action( 'give_pre_refund_payment', $this );
1401
+		do_action('give_pre_refund_payment', $this);
1402 1402
 
1403
-		$decrease_earnings       = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1404
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1405
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1403
+		$decrease_earnings       = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1404
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1405
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1406 1406
 
1407
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count );
1407
+		$this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count);
1408 1408
 		$this->delete_sales_logs();
1409 1409
 
1410 1410
 		// @todo: Refresh only range related stat cache
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 		 *
1418 1418
 		 * @param Give_Payment $this Payment object.
1419 1419
 		 */
1420
-		do_action( 'give_post_refund_payment', $this );
1420
+		do_action('give_post_refund_payment', $this);
1421 1421
 	}
1422 1422
 
1423 1423
 	/**
@@ -1444,26 +1444,26 @@  discard block
 block discarded – undo
1444 1444
 		$process_pending = true;
1445 1445
 
1446 1446
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1447
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1447
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1448 1448
 			$process_pending = false;
1449 1449
 		}
1450 1450
 
1451 1451
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1452
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1452
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1453 1453
 
1454
-		if ( false === $process_pending ) {
1454
+		if (false === $process_pending) {
1455 1455
 			return;
1456 1456
 		}
1457 1457
 
1458
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_pending', true, $this );
1459
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_pending', true, $this );
1460
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this );
1458
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_pending', true, $this);
1459
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_pending', true, $this);
1460
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this);
1461 1461
 
1462
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1462
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1463 1463
 		$this->delete_sales_logs();
1464 1464
 
1465 1465
 		$this->completed_date = false;
1466
-		$this->update_meta( '_give_completed_date', '' );
1466
+		$this->update_meta('_give_completed_date', '');
1467 1467
 
1468 1468
 		// @todo: Refresh only range related stat cache
1469 1469
 		give_delete_donation_stats();
@@ -1481,26 +1481,26 @@  discard block
 block discarded – undo
1481 1481
 		$process_cancelled = true;
1482 1482
 
1483 1483
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1484
-		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1484
+		if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1485 1485
 			$process_cancelled = false;
1486 1486
 		}
1487 1487
 
1488 1488
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1489
-		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1489
+		$process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1490 1490
 
1491
-		if ( false === $process_cancelled ) {
1491
+		if (false === $process_cancelled) {
1492 1492
 			return;
1493 1493
 		}
1494 1494
 
1495
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this );
1496
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this );
1497
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this );
1495
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_cancelled', true, $this);
1496
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_cancelled', true, $this);
1497
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this);
1498 1498
 
1499
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1499
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1500 1500
 		$this->delete_sales_logs();
1501 1501
 
1502 1502
 		$this->completed_date = false;
1503
-		$this->update_meta( '_give_completed_date', '' );
1503
+		$this->update_meta('_give_completed_date', '');
1504 1504
 
1505 1505
 		// @todo: Refresh only range related stat cache
1506 1506
 		give_delete_donation_stats();
@@ -1516,26 +1516,26 @@  discard block
 block discarded – undo
1516 1516
 		$process_revoked = true;
1517 1517
 
1518 1518
 		// If the payment was not in publish, don't decrement stats as they were never incremented.
1519
-		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1519
+		if ('publish' != $this->old_status || 'revoked' != $this->status) {
1520 1520
 			$process_revoked = false;
1521 1521
 		}
1522 1522
 
1523 1523
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1524
-		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1524
+		$process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1525 1525
 
1526
-		if ( false === $process_revoked ) {
1526
+		if (false === $process_revoked) {
1527 1527
 			return;
1528 1528
 		}
1529 1529
 
1530
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_revoked', true, $this );
1531
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this );
1532
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this );
1530
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_revoked', true, $this);
1531
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_revoked', true, $this);
1532
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this);
1533 1533
 
1534
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1534
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1535 1535
 		$this->delete_sales_logs();
1536 1536
 
1537 1537
 		$this->completed_date = false;
1538
-		$this->update_meta( '_give_completed_date', '' );
1538
+		$this->update_meta('_give_completed_date', '');
1539 1539
 
1540 1540
 		// @todo: Refresh only range related stat cache
1541 1541
 		give_delete_donation_stats();
@@ -1553,25 +1553,25 @@  discard block
 block discarded – undo
1553 1553
 	 *
1554 1554
 	 * @return void
1555 1555
 	 */
1556
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1556
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1557 1557
 
1558
-		give_undo_donation( $this->ID );
1558
+		give_undo_donation($this->ID);
1559 1559
 
1560 1560
 		// Decrease store earnings.
1561
-		if ( true === $alter_store_earnings ) {
1562
-			give_decrease_total_earnings( $this->total );
1561
+		if (true === $alter_store_earnings) {
1562
+			give_decrease_total_earnings($this->total);
1563 1563
 		}
1564 1564
 
1565 1565
 		// Decrement the stats for the donor.
1566
-		if ( ! empty( $this->customer_id ) ) {
1566
+		if ( ! empty($this->customer_id)) {
1567 1567
 
1568
-			$donor = new Give_Donor( $this->customer_id );
1568
+			$donor = new Give_Donor($this->customer_id);
1569 1569
 
1570
-			if ( true === $alter_customer_value ) {
1571
-				$donor->decrease_value( $this->total );
1570
+			if (true === $alter_customer_value) {
1571
+				$donor->decrease_value($this->total);
1572 1572
 			}
1573 1573
 
1574
-			if ( true === $alter_customer_purchase_count ) {
1574
+			if (true === $alter_customer_purchase_count) {
1575 1575
 				$donor->decrease_donation_count();
1576 1576
 			}
1577 1577
 		}
@@ -1620,13 +1620,13 @@  discard block
 block discarded – undo
1620 1620
 	 * @return string The date the payment was completed
1621 1621
 	 */
1622 1622
 	private function setup_completed_date() {
1623
-		$payment = get_post( $this->ID );
1623
+		$payment = get_post($this->ID);
1624 1624
 
1625
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1625
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1626 1626
 			return false; // This payment was never completed.
1627 1627
 		}
1628 1628
 
1629
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1629
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1630 1630
 
1631 1631
 		return $date;
1632 1632
 	}
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 	 * @return string The payment mode
1641 1641
 	 */
1642 1642
 	private function setup_mode() {
1643
-		return $this->get_meta( '_give_payment_mode' );
1643
+		return $this->get_meta('_give_payment_mode');
1644 1644
 	}
1645 1645
 
1646 1646
 	/**
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 	 * @return bool The payment import
1653 1653
 	 */
1654 1654
 	private function setup_import() {
1655
-		return (bool) $this->get_meta( '_give_payment_import' );
1655
+		return (bool) $this->get_meta('_give_payment_import');
1656 1656
 	}
1657 1657
 
1658 1658
 	/**
@@ -1664,18 +1664,18 @@  discard block
 block discarded – undo
1664 1664
 	 * @return float The payment total
1665 1665
 	 */
1666 1666
 	private function setup_total() {
1667
-		$amount = $this->get_meta( '_give_payment_total', true );
1667
+		$amount = $this->get_meta('_give_payment_total', true);
1668 1668
 
1669
-		if ( empty( $amount ) && '0.00' != $amount ) {
1670
-			$meta = $this->get_meta( '_give_payment_meta', true );
1671
-			$meta = maybe_unserialize( $meta );
1669
+		if (empty($amount) && '0.00' != $amount) {
1670
+			$meta = $this->get_meta('_give_payment_meta', true);
1671
+			$meta = maybe_unserialize($meta);
1672 1672
 
1673
-			if ( isset( $meta['amount'] ) ) {
1673
+			if (isset($meta['amount'])) {
1674 1674
 				$amount = $meta['amount'];
1675 1675
 			}
1676 1676
 		}
1677 1677
 
1678
-		return round( floatval( $amount ), give_currency_decimal_filter() );
1678
+		return round(floatval($amount), give_currency_decimal_filter());
1679 1679
 	}
1680 1680
 
1681 1681
 	/**
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 	 * @return string The currency for the payment
1702 1702
 	 */
1703 1703
 	private function setup_currency() {
1704
-		$currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this );
1704
+		$currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this);
1705 1705
 
1706 1706
 		return $currency;
1707 1707
 	}
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
 	 * @return string The gateway
1716 1716
 	 */
1717 1717
 	private function setup_gateway() {
1718
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1718
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1719 1719
 
1720 1720
 		return $gateway;
1721 1721
 	}
@@ -1729,11 +1729,11 @@  discard block
 block discarded – undo
1729 1729
 	 * @return string The donation ID
1730 1730
 	 */
1731 1731
 	private function setup_transaction_id() {
1732
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1732
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1733 1733
 
1734
-		if ( empty( $transaction_id ) ) {
1734
+		if (empty($transaction_id)) {
1735 1735
 			$gateway        = $this->gateway;
1736
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1736
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1737 1737
 		}
1738 1738
 
1739 1739
 		return $transaction_id;
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 	 * @return string The IP address for the payment
1749 1749
 	 */
1750 1750
 	private function setup_ip() {
1751
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1751
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1752 1752
 
1753 1753
 		return $ip;
1754 1754
 	}
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 	 * @return int The Donor ID.
1763 1763
 	 */
1764 1764
 	private function setup_donor_id() {
1765
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
1765
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
1766 1766
 
1767 1767
 		return $customer_id;
1768 1768
 	}
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 	 * @return int The User ID
1777 1777
 	 */
1778 1778
 	private function setup_user_id() {
1779
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
1779
+		$user_id = $this->get_meta('_give_payment_user_id', true);
1780 1780
 
1781 1781
 		return $user_id;
1782 1782
 	}
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 	 * @return string The email address for the payment.
1791 1791
 	 */
1792 1792
 	private function setup_email() {
1793
-		$email = $this->get_meta( '_give_payment_user_email', true );
1793
+		$email = $this->get_meta('_give_payment_user_email', true);
1794 1794
 
1795
-		if ( empty( $email ) && $this->customer_id ) {
1796
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1795
+		if (empty($email) && $this->customer_id) {
1796
+			$email = Give()->donors->get_column('email', $this->customer_id);
1797 1797
 		}
1798 1798
 
1799 1799
 		return $email;
@@ -1813,23 +1813,23 @@  discard block
 block discarded – undo
1813 1813
 			'last_name'  => $this->last_name,
1814 1814
 		);
1815 1815
 
1816
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1816
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1817 1817
 
1818
-		if ( is_serialized( $user_info ) ) {
1819
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1820
-			if ( ! empty( $matches ) ) {
1818
+		if (is_serialized($user_info)) {
1819
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1820
+			if ( ! empty($matches)) {
1821 1821
 				$user_info = array();
1822 1822
 			}
1823 1823
 		}
1824 1824
 
1825
-		$user_info = wp_parse_args( $user_info, $defaults );
1825
+		$user_info = wp_parse_args($user_info, $defaults);
1826 1826
 
1827
-		if ( empty( $user_info ) ) {
1827
+		if (empty($user_info)) {
1828 1828
 			// Get the donor, but only if it's been created.
1829
-			$donor = new Give_Donor( $this->customer_id );
1829
+			$donor = new Give_Donor($this->customer_id);
1830 1830
 
1831
-			if ( $donor->id > 0 ) {
1832
-				$name      = explode( ' ', $donor->name, 2 );
1831
+			if ($donor->id > 0) {
1832
+				$name      = explode(' ', $donor->name, 2);
1833 1833
 				$user_info = array(
1834 1834
 					'first_name' => $name[0],
1835 1835
 					'last_name'  => $name[1],
@@ -1839,29 +1839,29 @@  discard block
 block discarded – undo
1839 1839
 			}
1840 1840
 		} else {
1841 1841
 			// Get the donor, but only if it's been created.
1842
-			$donor = new Give_Donor( $this->customer_id );
1843
-			if ( $donor->id > 0 ) {
1844
-				foreach ( $user_info as $key => $value ) {
1845
-					if ( ! empty( $value ) ) {
1842
+			$donor = new Give_Donor($this->customer_id);
1843
+			if ($donor->id > 0) {
1844
+				foreach ($user_info as $key => $value) {
1845
+					if ( ! empty($value)) {
1846 1846
 						continue;
1847 1847
 					}
1848 1848
 
1849
-					switch ( $key ) {
1849
+					switch ($key) {
1850 1850
 						case 'first_name':
1851
-							$name = explode( ' ', $donor->name, 2 );
1851
+							$name = explode(' ', $donor->name, 2);
1852 1852
 
1853
-							$user_info[ $key ] = $name[0];
1853
+							$user_info[$key] = $name[0];
1854 1854
 							break;
1855 1855
 
1856 1856
 						case 'last_name':
1857
-							$name      = explode( ' ', $donor->name, 2 );
1858
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
1857
+							$name      = explode(' ', $donor->name, 2);
1858
+							$last_name = ! empty($name[1]) ? $name[1] : '';
1859 1859
 
1860
-							$user_info[ $key ] = $last_name;
1860
+							$user_info[$key] = $last_name;
1861 1861
 							break;
1862 1862
 
1863 1863
 						case 'email':
1864
-							$user_info[ $key ] = $donor->email;
1864
+							$user_info[$key] = $donor->email;
1865 1865
 							break;
1866 1866
 					}
1867 1867
 				}
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
 	 */
1883 1883
 	private function setup_address() {
1884 1884
 
1885
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
1885
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
1886 1886
 			'line1'   => '',
1887 1887
 			'line2'   => '',
1888 1888
 			'city'    => '',
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 	 */
1905 1905
 	private function setup_form_title() {
1906 1906
 
1907
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1907
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1908 1908
 
1909 1909
 		return $form_id;
1910 1910
 	}
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 	 */
1920 1920
 	private function setup_form_id() {
1921 1921
 
1922
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1922
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1923 1923
 
1924 1924
 		return $form_id;
1925 1925
 	}
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 	 * @return int The Form Price ID.
1934 1934
 	 */
1935 1935
 	private function setup_price_id() {
1936
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1936
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1937 1937
 
1938 1938
 		return $price_id;
1939 1939
 	}
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
 	 * @return string The Payment Key.
1948 1948
 	 */
1949 1949
 	private function setup_payment_key() {
1950
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1950
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1951 1951
 
1952 1952
 		return $key;
1953 1953
 	}
@@ -1963,11 +1963,11 @@  discard block
 block discarded – undo
1963 1963
 	private function setup_payment_number() {
1964 1964
 		$number = $this->ID;
1965 1965
 
1966
-		if ( give_get_option( 'enable_sequential' ) ) {
1966
+		if (give_get_option('enable_sequential')) {
1967 1967
 
1968
-			$number = $this->get_meta( '_give_payment_number', true );
1968
+			$number = $this->get_meta('_give_payment_number', true);
1969 1969
 
1970
-			if ( ! $number ) {
1970
+			if ( ! $number) {
1971 1971
 
1972 1972
 				$number = $this->ID;
1973 1973
 
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
 	 * @return array The payment object as an array.
1986 1986
 	 */
1987 1987
 	public function array_convert() {
1988
-		return get_object_vars( $this );
1988
+		return get_object_vars($this);
1989 1989
 	}
1990 1990
 
1991 1991
 
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
 	 * @return bool
1999 1999
 	 */
2000 2000
 	public function is_completed() {
2001
-		return ( 'publish' === $this->status && $this->completed_date );
2001
+		return ('publish' === $this->status && $this->completed_date);
2002 2002
 	}
2003 2003
 
2004 2004
 	/**
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 	 * @return string Date payment was completed.
2011 2011
 	 */
2012 2012
 	private function get_completed_date() {
2013
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2013
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2014 2014
 	}
2015 2015
 
2016 2016
 	/**
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
 	 * @return float Payment subtotal.
2023 2023
 	 */
2024 2024
 	private function get_subtotal() {
2025
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2025
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2026 2026
 	}
2027 2027
 
2028 2028
 	/**
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
 	 * @return string Payment currency code.
2035 2035
 	 */
2036 2036
 	private function get_currency() {
2037
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2037
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2038 2038
 	}
2039 2039
 
2040 2040
 	/**
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 	 * @return string Gateway used.
2047 2047
 	 */
2048 2048
 	private function get_gateway() {
2049
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2049
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2050 2050
 	}
2051 2051
 
2052 2052
 	/**
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 	 * @return string Donation ID from merchant processor.
2059 2059
 	 */
2060 2060
 	private function get_transaction_id() {
2061
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2061
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2062 2062
 	}
2063 2063
 
2064 2064
 	/**
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
 	 * @return string Payment IP address
2071 2071
 	 */
2072 2072
 	private function get_ip() {
2073
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2073
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2074 2074
 	}
2075 2075
 
2076 2076
 	/**
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
 	 * @return int Payment donor ID.
2083 2083
 	 */
2084 2084
 	private function get_donor_id() {
2085
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2085
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2086 2086
 	}
2087 2087
 
2088 2088
 	/**
@@ -2094,7 +2094,7 @@  discard block
 block discarded – undo
2094 2094
 	 * @return int Payment user ID.
2095 2095
 	 */
2096 2096
 	private function get_user_id() {
2097
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2097
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2098 2098
 	}
2099 2099
 
2100 2100
 	/**
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 * @return string Payment donor email.
2107 2107
 	 */
2108 2108
 	private function get_email() {
2109
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2109
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2110 2110
 	}
2111 2111
 
2112 2112
 	/**
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 	 * @return array Payment user info.
2119 2119
 	 */
2120 2120
 	private function get_user_info() {
2121
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2121
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2122 2122
 	}
2123 2123
 
2124 2124
 	/**
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 	 * @return array Payment billing address.
2131 2131
 	 */
2132 2132
 	private function get_address() {
2133
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2133
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2134 2134
 	}
2135 2135
 
2136 2136
 	/**
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 	 * @return string Payment key.
2143 2143
 	 */
2144 2144
 	private function get_key() {
2145
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2145
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2146 2146
 	}
2147 2147
 
2148 2148
 	/**
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 	 * @return string Payment form id
2155 2155
 	 */
2156 2156
 	private function get_form_id() {
2157
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2157
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2158 2158
 	}
2159 2159
 
2160 2160
 	/**
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
 	 * @return int|string Payment number
2167 2167
 	 */
2168 2168
 	private function get_number() {
2169
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2169
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2170 2170
 	}
2171 2171
 
2172 2172
 }
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 1 patch
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
14 14
 // Add give command.
15
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
15
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
16 16
 
17 17
 
18 18
 /**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @subcommand    logo
70 70
 	 */
71
-	public function ascii( $args, $assoc_args ) {
72
-		WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) );
71
+	public function ascii($args, $assoc_args) {
72
+		WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt'));
73 73
 	}
74 74
 
75 75
 
@@ -94,54 +94,54 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @subcommand    details
96 96
 	 */
97
-	public function details( $args, $assoc_args ) {
97
+	public function details($args, $assoc_args) {
98 98
 
99 99
 		/**
100 100
 		 * Plugin Information
101 101
 		 */
102
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
102
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
103 103
 
104 104
 		/**
105 105
 		 * General Information.
106 106
 		 */
107
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
107
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
108 108
 
109
-		$success_page = give_get_option( 'success_page' );
110
-		$failure_page = give_get_option( 'failure_page' );
111
-		$history_page = give_get_option( 'history_page' );
109
+		$success_page = give_get_option('success_page');
110
+		$failure_page = give_get_option('failure_page');
111
+		$history_page = give_get_option('history_page');
112 112
 
113
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
114
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
115
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
116
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
113
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
114
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
115
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
116
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
117 117
 
118 118
 		/**
119 119
 		 * Currency Information.
120 120
 		 */
121
-		$default_gateway = give_get_option( 'default_gateway' );
121
+		$default_gateway = give_get_option('default_gateway');
122 122
 
123
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
123
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
124 124
 
125
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
126
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
127
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
128
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
129
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
130
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) );
131
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) );
125
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
126
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
127
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
128
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
129
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
130
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
131
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
132 132
 
133 133
 		// Payment gateways Information.
134
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
135
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
134
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
135
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
136 136
 
137
-		if ( ! empty( $gateways ) ) {
137
+		if ( ! empty($gateways)) {
138 138
 			self::$counter = 1;
139
-			foreach ( $gateways as $gateway ) {
140
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
141
-				self::$counter ++;
139
+			foreach ($gateways as $gateway) {
140
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
141
+				self::$counter++;
142 142
 			}
143 143
 		} else {
144
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
144
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
145 145
 		}
146 146
 	}
147 147
 
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @subcommand    forms
175 175
 	 */
176
-	public function forms( $args, $assoc_args ) {
176
+	public function forms($args, $assoc_args) {
177 177
 		global $wp_query;
178
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
179
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
178
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
179
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
180 180
 		$start   = time();
181 181
 
182 182
 		// Cache previous number query var.
183 183
 		$is_set_number = $cache_per_page = false;
184
-		if ( isset( $wp_query->query_vars['number'] ) ) {
184
+		if (isset($wp_query->query_vars['number'])) {
185 185
 			$cache_per_page = $wp_query->query_vars['number'];
186 186
 			$is_set_number  = true;
187 187
 		}
@@ -190,22 +190,22 @@  discard block
 block discarded – undo
190 190
 		$wp_query->query_vars['number'] = $number;
191 191
 
192 192
 		// Get forms.
193
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
193
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
194 194
 
195 195
 		// Reset number query var.
196
-		if ( $is_set_number ) {
196
+		if ($is_set_number) {
197 197
 			$wp_query->query_vars['number'] = $cache_per_page;
198 198
 		}
199 199
 
200 200
 		// Bailout.
201
-		if ( array_key_exists( 'error', $forms ) ) {
201
+		if (array_key_exists('error', $forms)) {
202 202
 
203
-			WP_CLI::warning( $forms['error'] );
203
+			WP_CLI::warning($forms['error']);
204 204
 
205 205
 			return;
206
-		} elseif ( empty( $forms['forms'] ) ) {
206
+		} elseif (empty($forms['forms'])) {
207 207
 
208
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
208
+			WP_CLI::error(__('No forms found.', 'give'));
209 209
 
210 210
 			return;
211 211
 		}
@@ -213,25 +213,25 @@  discard block
 block discarded – undo
213 213
 		// Param to check if form typeis already showed or not.
214 214
 		$is_show_form_type = false;
215 215
 
216
-		if ( 1 === count( $forms ) && $form_id ) {
216
+		if (1 === count($forms) && $form_id) {
217 217
 			// Show single form.
218
-			foreach ( $forms['forms'][0] as $key => $info ) {
219
-				switch ( $key ) {
218
+			foreach ($forms['forms'][0] as $key => $info) {
219
+				switch ($key) {
220 220
 					case 'stats':
221
-						$this->color_main_heading( ucfirst( $key ) );
221
+						$this->color_main_heading(ucfirst($key));
222 222
 
223
-						foreach ( $info as $heading => $data ) {
224
-							$this->color_sub_heading( ucfirst( $heading ) );
225
-							switch ( $heading ) {
223
+						foreach ($info as $heading => $data) {
224
+							$this->color_sub_heading(ucfirst($heading));
225
+							switch ($heading) {
226 226
 								default:
227
-									foreach ( $data as $subheading => $subdata ) {
227
+									foreach ($data as $subheading => $subdata) {
228 228
 
229
-										switch ( $subheading ) {
229
+										switch ($subheading) {
230 230
 											case 'earnings':
231
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
231
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
232 232
 												break;
233 233
 											default:
234
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
234
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
235 235
 										}
236 236
 									}
237 237
 							}
@@ -241,26 +241,26 @@  discard block
 block discarded – undo
241 241
 					case 'pricing':
242 242
 					case 'info':
243 243
 					default:
244
-						$this->color_main_heading( ucfirst( $key ) );
244
+						$this->color_main_heading(ucfirst($key));
245 245
 
246 246
 						// Show form type.
247
-						if ( ! $is_show_form_type ) {
248
-							$form              = new Give_Donate_Form( $form_id );
247
+						if ( ! $is_show_form_type) {
248
+							$form              = new Give_Donate_Form($form_id);
249 249
 							$is_show_form_type = true;
250 250
 
251
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
251
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
252 252
 						}
253 253
 
254
-						foreach ( $info as $heading => $data ) {
254
+						foreach ($info as $heading => $data) {
255 255
 
256
-							switch ( $heading ) {
256
+							switch ($heading) {
257 257
 								case 'id':
258
-									WP_CLI::log( $this->color_message( $heading, $data ) );
258
+									WP_CLI::log($this->color_message($heading, $data));
259 259
 									break;
260 260
 
261 261
 								default:
262
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
263
-									WP_CLI::log( $this->color_message( $heading, $data ) );
262
+									$data = empty($data) ? __('Not set', 'give') : $data;
263
+									WP_CLI::log($this->color_message($heading, $data));
264 264
 							}
265 265
 						}
266 266
 				}// End switch().
@@ -271,37 +271,37 @@  discard block
 block discarded – undo
271 271
 			$is_table_first_row_set = false;
272 272
 			$table_column_count     = 0;
273 273
 
274
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
274
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
275 275
 
276
-			foreach ( $forms['forms'] as $index => $form_data ) {
276
+			foreach ($forms['forms'] as $index => $form_data) {
277 277
 
278 278
 				// Default table data.
279 279
 				$table_first_row = array();
280 280
 				$table_row       = array();
281 281
 
282
-				foreach ( $form_data['info'] as $key => $form ) {
282
+				foreach ($form_data['info'] as $key => $form) {
283 283
 
284 284
 					// Do not show thumbnail, content and link in table.
285
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
285
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
286 286
 						continue;
287 287
 					}
288 288
 
289
-					if ( ! $is_table_first_row_set ) {
289
+					if ( ! $is_table_first_row_set) {
290 290
 						$table_first_row[] = $key;
291 291
 					}
292 292
 
293 293
 					$table_row[] = $form;
294 294
 
295
-					if ( 'status' === $key ) {
295
+					if ('status' === $key) {
296 296
 						// First array item will be an form id in our case.
297
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
297
+						$form = new Give_Donate_Form(absint($table_row[0]));
298 298
 
299 299
 						$table_row[] = $form->get_type();
300 300
 					}
301 301
 				}
302 302
 
303 303
 				// Set table first row.
304
-				if ( ! $is_table_first_row_set ) {
304
+				if ( ! $is_table_first_row_set) {
305 305
 
306 306
 					// Add extra column to table.
307 307
 					$table_first_row[] = 'type';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 				$table_data[] = $table_row;
315 315
 			}// End foreach().
316 316
 
317
-			$this->display_table( $table_data );
317
+			$this->display_table($table_data);
318 318
 		}// End if().
319 319
 	}
320 320
 
@@ -367,37 +367,37 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @subcommand    donors
369 369
 	 */
370
-	public function donors( $args, $assoc_args ) {
370
+	public function donors($args, $assoc_args) {
371 371
 		global $wp_query;
372
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
373
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
374
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
375
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
376
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
377
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
378
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
372
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
373
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
374
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
375
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
376
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
377
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
378
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
379 379
 		$start    = time();
380 380
 
381
-		if ( $create ) {
381
+		if ($create) {
382 382
 			$number = 1;
383 383
 
384
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
385
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
384
+			if (isset($assoc_args['email']) && ! is_email($email)) {
385
+				WP_CLI::warning('Wrong email address provided.', 'give');
386 386
 
387 387
 				return;
388 388
 			}
389 389
 
390 390
 			// Create one or more donors.
391
-			if ( ! $email ) {
391
+			if ( ! $email) {
392 392
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
393
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
393
+				$number = is_numeric($create) ? absint($create) : 1;
394 394
 			}
395 395
 
396
-			for ( $i = 0; $i < $number; $i ++ ) {
397
-				if ( ! $email ) {
396
+			for ($i = 0; $i < $number; $i++) {
397
+				if ( ! $email) {
398 398
 
399 399
 					// Generate fake email.
400
-					$email = 'customer-' . uniqid() . '@test.com';
400
+					$email = 'customer-'.uniqid().'@test.com';
401 401
 				}
402 402
 
403 403
 				$args = array(
@@ -405,19 +405,19 @@  discard block
 block discarded – undo
405 405
 					'name'  => $name,
406 406
 				);
407 407
 
408
-				$donor_id = Give()->donors->add( $args );
408
+				$donor_id = Give()->donors->add($args);
409 409
 
410
-				if ( $donor_id ) {
411
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) );
410
+				if ($donor_id) {
411
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id)));
412 412
 				} else {
413
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
413
+					WP_CLI::error(__('Failed to create donor', 'give'));
414 414
 				}
415 415
 
416 416
 				// Reset email to false so it is generated on the next loop (if creating donors).
417 417
 				$email = false;
418 418
 			}
419 419
 
420
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
420
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
421 421
 
422 422
 		} else {
423 423
 			// Counter.
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			 */
432 432
 			// Cache previous number query var.
433 433
 			$is_set_number = $cache_per_page = false;
434
-			if ( isset( $wp_query->query_vars['number'] ) ) {
434
+			if (isset($wp_query->query_vars['number'])) {
435 435
 				$cache_per_page = $wp_query->query_vars['number'];
436 436
 				$is_set_number  = true;
437 437
 			}
@@ -440,24 +440,24 @@  discard block
 block discarded – undo
440 440
 			$wp_query->query_vars['number'] = $number;
441 441
 
442 442
 			// Get donors.
443
-			if ( $form_id ) {
443
+			if ($form_id) {
444 444
 				// @TODO: Allow user to get a list of donors by donation status.
445
-				$donors = $this->get_donors_by_form_id( $form_id );
445
+				$donors = $this->get_donors_by_form_id($form_id);
446 446
 			} else {
447
-				$donors = $this->api->get_donors( $search );
447
+				$donors = $this->api->get_donors($search);
448 448
 			}
449 449
 
450 450
 			// Reset number query var.
451
-			if ( $is_set_number ) {
451
+			if ($is_set_number) {
452 452
 				$wp_query->query_vars['number'] = $cache_per_page;
453 453
 			}
454 454
 
455
-			if ( isset( $donors['error'] ) ) {
456
-				WP_CLI::error( $donors['error'] );
455
+			if (isset($donors['error'])) {
456
+				WP_CLI::error($donors['error']);
457 457
 			}
458 458
 
459
-			if ( empty( $donors ) ) {
460
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
459
+			if (empty($donors)) {
460
+				WP_CLI::error(__('No donors found.', 'give'));
461 461
 
462 462
 				return;
463 463
 			}
@@ -465,24 +465,24 @@  discard block
 block discarded – undo
465 465
 			$table_data             = array();
466 466
 			$is_table_first_row_set = false;
467 467
 
468
-			foreach ( $donors['donors'] as $donor_data ) {
468
+			foreach ($donors['donors'] as $donor_data) {
469 469
 				// Set default table row data.
470
-				$table_first_row = array( __( 's_no', 'give' ) );
471
-				$table_row       = array( self::$counter );
470
+				$table_first_row = array(__('s_no', 'give'));
471
+				$table_row       = array(self::$counter);
472 472
 
473
-				foreach ( $donor_data as $key => $donor ) {
474
-					switch ( $key ) {
473
+				foreach ($donor_data as $key => $donor) {
474
+					switch ($key) {
475 475
 						case 'stats':
476
-							foreach ( $donor as $heading => $data ) {
476
+							foreach ($donor as $heading => $data) {
477 477
 
478 478
 								// Get first row.
479
-								if ( ! $is_table_first_row_set ) {
479
+								if ( ! $is_table_first_row_set) {
480 480
 									$table_first_row[] = $heading;
481 481
 								}
482 482
 
483
-								switch ( $heading ) {
483
+								switch ($heading) {
484 484
 									case 'total_spent':
485
-										$table_row[] = give_currency_filter( $data );
485
+										$table_row[] = give_currency_filter($data);
486 486
 										break;
487 487
 
488 488
 									default:
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
 
494 494
 						case 'info':
495 495
 						default:
496
-							foreach ( $donor as $heading => $data ) {
496
+							foreach ($donor as $heading => $data) {
497 497
 
498 498
 								// Get first row.
499
-								if ( ! $is_table_first_row_set ) {
499
+								if ( ! $is_table_first_row_set) {
500 500
 									$table_first_row[] = $heading;
501 501
 								}
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 				}
507 507
 
508 508
 				// Add first row data to table data.
509
-				if ( ! $is_table_first_row_set ) {
509
+				if ( ! $is_table_first_row_set) {
510 510
 					$table_data[]           = $table_first_row;
511 511
 					$is_table_first_row_set = true;
512 512
 				}
@@ -515,44 +515,44 @@  discard block
 block discarded – undo
515 515
 				$table_data[] = $table_row;
516 516
 
517 517
 				// Increase counter.
518
-				self::$counter ++;
518
+				self::$counter++;
519 519
 			}// End foreach().
520 520
 
521
-			switch ( $format ) {
521
+			switch ($format) {
522 522
 				case 'json':
523 523
 					$table_column_name = $table_data[0];
524
-					unset( $table_data[0] );
524
+					unset($table_data[0]);
525 525
 
526 526
 					$new_table_data = array();
527
-					foreach ( $table_data as $index => $data ) {
528
-						foreach ( $data as $key => $value ) {
529
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
527
+					foreach ($table_data as $index => $data) {
528
+						foreach ($data as $key => $value) {
529
+							$new_table_data[$index][$table_column_name[$key]] = $value;
530 530
 						}
531 531
 					}
532 532
 
533
-					WP_CLI::log( json_encode( $new_table_data ) );
533
+					WP_CLI::log(json_encode($new_table_data));
534 534
 					break;
535 535
 
536 536
 				case 'csv':
537
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
538
-					$fp        = fopen( $file_path, 'w' );
537
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
538
+					$fp        = fopen($file_path, 'w');
539 539
 
540
-					if ( is_writable( $file_path ) ) {
541
-						foreach ( $table_data as $fields ) {
542
-							fputcsv( $fp, $fields );
540
+					if (is_writable($file_path)) {
541
+						foreach ($table_data as $fields) {
542
+							fputcsv($fp, $fields);
543 543
 						}
544 544
 
545
-						fclose( $fp );
545
+						fclose($fp);
546 546
 
547
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
547
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
548 548
 					} else {
549
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
549
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
550 550
 					}
551 551
 
552 552
 					break;
553 553
 
554 554
 				default:
555
-					$this->display_table( $table_data );
555
+					$this->display_table($table_data);
556 556
 			}// End switch().
557 557
 		}// End if().
558 558
 	}
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
 	 *
583 583
 	 * @subcommand    donations
584 584
 	 */
585
-	public function donations( $args, $assoc_args ) {
585
+	public function donations($args, $assoc_args) {
586 586
 		global $wp_query;
587
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
587
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
588 588
 
589 589
 		// Cache previous number query var.
590 590
 		$is_set_number = $cache_per_page = false;
591
-		if ( isset( $wp_query->query_vars['number'] ) ) {
591
+		if (isset($wp_query->query_vars['number'])) {
592 592
 			$cache_per_page = $wp_query->query_vars['number'];
593 593
 			$is_set_number  = true;
594 594
 		}
@@ -600,46 +600,46 @@  discard block
 block discarded – undo
600 600
 		$donations = $this->api->get_recent_donations();
601 601
 
602 602
 		// Reset number query var.
603
-		if ( $is_set_number ) {
603
+		if ($is_set_number) {
604 604
 			$wp_query->query_vars['number'] = $cache_per_page;
605 605
 		}
606 606
 
607
-		if ( empty( $donations ) ) {
608
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
607
+		if (empty($donations)) {
608
+			WP_CLI::error(__('No donations found.', 'give'));
609 609
 
610 610
 			return;
611 611
 		}
612 612
 
613 613
 		self::$counter = 1;
614 614
 
615
-		foreach ( $donations['donations'] as $key => $donation ) {
616
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
617
-			self::$counter ++;
615
+		foreach ($donations['donations'] as $key => $donation) {
616
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
617
+			self::$counter++;
618 618
 
619
-			foreach ( $donation as $column => $data ) {
619
+			foreach ($donation as $column => $data) {
620 620
 
621
-				if ( is_array( $data ) ) {
622
-					$this->color_sub_heading( $column );
623
-					foreach ( $data as $subcolumn => $subdata ) {
621
+				if (is_array($data)) {
622
+					$this->color_sub_heading($column);
623
+					foreach ($data as $subcolumn => $subdata) {
624 624
 
625 625
 						// Decode html codes.
626
-						switch ( $subcolumn ) {
626
+						switch ($subcolumn) {
627 627
 							case 'name':
628
-								$subdata = html_entity_decode( $subdata );
628
+								$subdata = html_entity_decode($subdata);
629 629
 								break;
630 630
 						}
631 631
 
632 632
 						// @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta.
633
-						if ( is_array( $subdata ) ) {
633
+						if (is_array($subdata)) {
634 634
 							continue;
635 635
 						}
636 636
 
637
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
637
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
638 638
 					}
639 639
 					continue;
640 640
 				}
641 641
 
642
-				WP_CLI::log( $this->color_message( $column, $data ) );
642
+				WP_CLI::log($this->color_message($column, $data));
643 643
 			}
644 644
 		}
645 645
 	}
@@ -679,27 +679,27 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @return        void
681 681
 	 */
682
-	public function report( $args, $assoc_args ) {
682
+	public function report($args, $assoc_args) {
683 683
 		$stats      = new Give_Payment_Stats();
684
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
685
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
686
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
687
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
684
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
685
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
686
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
687
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
688 688
 
689
-		if ( ! empty( $date ) ) {
689
+		if ( ! empty($date)) {
690 690
 			$start_date = $date;
691 691
 			$end_date   = false;
692
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
692
+		} elseif (empty($date) && empty($start_date)) {
693 693
 			$start_date = 'this_month';
694 694
 			$end_date   = false;
695 695
 		}
696 696
 
697 697
 		// Get stats.
698
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
699
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
698
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
699
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
700 700
 
701
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) );
702
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
701
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings)));
702
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
703 703
 	}
704 704
 
705 705
 
@@ -726,27 +726,27 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @subcommand    cache
728 728
 	 */
729
-	public function cache( $args, $assoc_args ) {
730
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
729
+	public function cache($args, $assoc_args) {
730
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
731 731
 
732 732
 		// Bailout.
733
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
734
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
733
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
734
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
735 735
 
736 736
 			return;
737 737
 		}
738 738
 
739
-		switch ( $action ) {
739
+		switch ($action) {
740 740
 			case 'delete' :
741 741
 				// Reset counter.
742 742
 				self::$counter = 1;
743 743
 
744
-				if ( $this->delete_stats_transients() ) {
744
+				if ($this->delete_stats_transients()) {
745 745
 					// Report .eading.
746
-					WP_CLI::success( 'Give cache deleted.' );
746
+					WP_CLI::success('Give cache deleted.');
747 747
 				} else {
748 748
 					// Report .eading.
749
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
749
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
750 750
 				}
751 751
 				break;
752 752
 		}
@@ -775,27 +775,27 @@  discard block
 block discarded – undo
775 775
 			ARRAY_A
776 776
 		);
777 777
 
778
-		if ( ! empty( $stat_option_names ) ) {
778
+		if ( ! empty($stat_option_names)) {
779 779
 
780
-			foreach ( $stat_option_names as $option_name ) {
780
+			foreach ($stat_option_names as $option_name) {
781 781
 				$error       = false;
782 782
 				$option_name = $option_name['option_name'];
783 783
 
784
-				switch ( true ) {
785
-					case ( false !== strpos( $option_name, 'transient' ) ):
786
-						$option_name = str_replace( '_transient_', '', $option_name );
787
-						$error       = delete_transient( $option_name );
784
+				switch (true) {
785
+					case (false !== strpos($option_name, 'transient')):
786
+						$option_name = str_replace('_transient_', '', $option_name);
787
+						$error       = delete_transient($option_name);
788 788
 						break;
789 789
 
790 790
 					default:
791
-						$error = delete_option( $option_name );
791
+						$error = delete_option($option_name);
792 792
 				}
793 793
 
794
-				if ( $error ) {
795
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
796
-					self::$counter ++;
794
+				if ($error) {
795
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
796
+					self::$counter++;
797 797
 				} else {
798
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
798
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
799 799
 				}
800 800
 			}
801 801
 
@@ -816,13 +816,13 @@  discard block
 block discarded – undo
816 816
 	 *
817 817
 	 * @return   string
818 818
 	 */
819
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
819
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
820 820
 		// Add colon.
821
-		if ( $colon ) {
822
-			$heading = $heading . ': ';
821
+		if ($colon) {
822
+			$heading = $heading.': ';
823 823
 		}
824 824
 
825
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
825
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
826 826
 	}
827 827
 
828 828
 
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 	 *
838 838
 	 * @return    void
839 839
 	 */
840
-	private function color_main_heading( $heading, $color = 'g' ) {
841
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
840
+	private function color_main_heading($heading, $color = 'g') {
841
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
842 842
 	}
843 843
 
844 844
 	/**
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return    void
853 853
 	 */
854
-	private function color_sub_heading( $subheading ) {
855
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
854
+	private function color_sub_heading($subheading) {
855
+		WP_CLI::log("\n--->".$subheading.'', '', false);
856 856
 	}
857 857
 
858 858
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return    void
868 868
 	 */
869
-	private function display_table( $data ) {
869
+	private function display_table($data) {
870 870
 		$table = new \cli\Table();
871 871
 
872 872
 		// Set table header.
873
-		$table->setHeaders( $data[0] );
873
+		$table->setHeaders($data[0]);
874 874
 
875 875
 		// Remove table header.
876
-		unset( $data[0] );
876
+		unset($data[0]);
877 877
 
878 878
 		// Set table data.
879
-		$table->setRows( $data );
879
+		$table->setRows($data);
880 880
 
881 881
 		// Display table.
882 882
 		$table->display();
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 	 * @return array
894 894
 	 */
895 895
 
896
-	private function get_donors_by_form_id( $form_id ) {
896
+	private function get_donors_by_form_id($form_id) {
897 897
 		$donors = array();
898 898
 
899 899
 		$donations = new Give_Payments_Query(
900 900
 			array(
901
-				'give_forms' => array( $form_id ),
902
-				'number'     => - 1,
903
-				'status'     => array( 'publish' ),
901
+				'give_forms' => array($form_id),
902
+				'number'     => -1,
903
+				'status'     => array('publish'),
904 904
 			)
905 905
 		);
906 906
 
@@ -908,16 +908,16 @@  discard block
 block discarded – undo
908 908
 		$skip_donors = array();
909 909
 
910 910
 		/* @var Give_Payment|object $donation Payment object. */
911
-		foreach ( $donations as $donation ) {
911
+		foreach ($donations as $donation) {
912 912
 
913
-			if ( in_array( $donation->customer_id, $skip_donors ,true ) ) {
913
+			if (in_array($donation->customer_id, $skip_donors, true)) {
914 914
 				continue;
915 915
 			}
916 916
 
917
-			if ( ! empty( $donors ) ) {
918
-				$donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) );
917
+			if ( ! empty($donors)) {
918
+				$donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id)));
919 919
 			} else {
920
-				$donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) );
920
+				$donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id));
921 921
 			}
922 922
 
923 923
 			$skip_donors[] = $donation->customer_id;
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-import-donors.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * Return the calculated completion percentage.
217 217
 	 *
218 218
 	 * @since 1.8.12
219
-	 * @return int
219
+	 * @return double
220 220
 	 */
221 221
 	public function get_percentage_complete() {
222 222
 		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
@@ -353,6 +353,9 @@  discard block
 block discarded – undo
353 353
 		return true;
354 354
 	}
355 355
 
356
+	/**
357
+	 * @param integer $page
358
+	 */
356 359
 	public function get_delete_ids( $donation_ids, $page ) {
357 360
 		$index            = $page --;
358 361
 		$count            = count( $donation_ids );
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -116,34 +116,34 @@  discard block
 block discarded – undo
116 116
 		$donor_ids    = array();
117 117
 
118 118
 		// Check if the ajax request if running for the first time.
119
-		if ( 1 === (int) $this->step ) {
119
+		if (1 === (int) $this->step) {
120 120
 			// Delete all the form ids.
121
-			$this->delete_option( $this->form_key );
121
+			$this->delete_option($this->form_key);
122 122
 			// Delete all the donation ids.
123
-			$this->delete_option( $this->donation_key );
123
+			$this->delete_option($this->donation_key);
124 124
 			// Delete all the donor ids.
125
-			$this->delete_option( $this->donor_key );
125
+			$this->delete_option($this->donor_key);
126 126
 
127 127
 			// Delete all the step and set to 'count' which if the first step in the process of deleting the donors.
128
-			$this->update_option( $this->step_key, 'count' );
128
+			$this->update_option($this->step_key, 'count');
129 129
 
130 130
 			// Delete tha page count of the step.
131
-			$this->update_option( $this->step_on_key, '0' );
131
+			$this->update_option($this->step_on_key, '0');
132 132
 		} else {
133 133
 			// Get the old donors list.
134
-			$donor_ids = $this->get_option( $this->donor_key );
134
+			$donor_ids = $this->get_option($this->donor_key);
135 135
 
136 136
 			// Get the old donation list.
137
-			$donation_ids = $this->get_option( $this->donation_key );
137
+			$donation_ids = $this->get_option($this->donation_key);
138 138
 		}
139 139
 
140 140
 		// Get the step and check for it if it's on the first step( 'count' ) or not.
141 141
 		$step = (int) $this->get_step();
142
-		if ( 1 === $step ) {
142
+		if (1 === $step) {
143 143
 			/**
144 144
 			 * Will add or update the donation and donor data by running wp query.
145 145
 			 */
146
-			$this->count( $step, $donation_ids, $donor_ids );
146
+			$this->count($step, $donation_ids, $donor_ids);
147 147
 		}
148 148
 	}
149 149
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 * @param array $donation_ids Contain the list of all the donation id's that has being add before this
155 155
 	 * @param array $donor_ids Contain the list of all the donors id's that has being add before this
156 156
 	 */
157
-	private function count( $step, $donation_ids = array(), $donor_ids = array() ) {
157
+	private function count($step, $donation_ids = array(), $donor_ids = array()) {
158 158
 
159 159
 		// Get the Page count by default it's zero.
160 160
 		$paged = (int) $this->get_step_page();
161 161
 		// Incresed the page count by one.
162
-		++ $paged;
162
+		++$paged;
163 163
 
164 164
 		/**
165 165
 		 * Filter add to alter the argument before the wp quest run
166 166
 		 */
167
-		$args = apply_filters( 'give_tools_reset_stats_total_args', array(
167
+		$args = apply_filters('give_tools_reset_stats_total_args', array(
168 168
 			'post_type'      => 'give_payment',
169 169
 			'post_status'    => 'any',
170 170
 			'posts_per_page' => $this->per_step,
@@ -172,40 +172,40 @@  discard block
 block discarded – undo
172 172
 			'meta_key'       => '_give_payment_import',
173 173
 			'meta_value_num' => 1,
174 174
 			'meta_compare'   => '=',
175
-		) );
175
+		));
176 176
 
177 177
 		// Reset the post data.
178 178
 		wp_reset_postdata();
179 179
 		// Getting the new donation.
180
-		$donation_posts = new WP_Query( $args );
180
+		$donation_posts = new WP_Query($args);
181 181
 
182 182
 		// The Loop.
183
-		if ( $donation_posts->have_posts() ) {
184
-			while ( $donation_posts->have_posts() ) {
183
+		if ($donation_posts->have_posts()) {
184
+			while ($donation_posts->have_posts()) {
185 185
 				$add_author = true;
186 186
 				$donation_posts->the_post();
187 187
 				global $post;
188 188
 				// Add the donation id in side the array.
189 189
 				$donation_ids[] = $post->ID;
190 190
 
191
-				$donor_id = (int) get_post_meta( $post->ID, '_give_payment_customer_id', true );
192
-				if ( ! empty( $donor_id ) ) {
193
-					$donor = new Give_Donor( $donor_id );
194
-					if ( ! empty( $donor->id ) ) {
195
-						if ( empty( $donor->user_id ) && ! empty( $donor->payment_ids ) ) {
191
+				$donor_id = (int) get_post_meta($post->ID, '_give_payment_customer_id', true);
192
+				if ( ! empty($donor_id)) {
193
+					$donor = new Give_Donor($donor_id);
194
+					if ( ! empty($donor->id)) {
195
+						if (empty($donor->user_id) && ! empty($donor->payment_ids)) {
196 196
 							$add_author = false;
197
-							$count      = (int) count( $donor->payment_ids );
198
-							if ( 1 === $count ) {
199
-								Give()->donors->delete( $donor->id );
197
+							$count      = (int) count($donor->payment_ids);
198
+							if (1 === $count) {
199
+								Give()->donors->delete($donor->id);
200 200
 							} else {
201
-								$donor->remove_payment( $post->ID );
201
+								$donor->remove_payment($post->ID);
202 202
 								$donor->decrease_donation_count();
203 203
 							}
204 204
 						}
205 205
 					}
206 206
 				}
207 207
 
208
-				if ( ! empty( $add_author ) ) {
208
+				if ( ! empty($add_author)) {
209 209
 					// Add the donor id in side the array.
210 210
 					$donor_ids[] = (int) $post->post_author;
211 211
 				}
@@ -220,23 +220,23 @@  discard block
 block discarded – undo
220 220
 		$max_num_pages = (int) $donation_posts->max_num_pages;
221 221
 
222 222
 		// Check current page is less then max number of page or not
223
-		if ( $paged < $max_num_pages ) {
223
+		if ($paged < $max_num_pages) {
224 224
 			// Update the curretn page virable for the next step
225
-			$this->update_option( $this->step_on_key, $paged );
225
+			$this->update_option($this->step_on_key, $paged);
226 226
 
227 227
 			// Calculating percentage.
228 228
 			$page_remain          = $max_num_pages - $paged;
229
-			$this->total_step     = (int) $max_num_pages + ( $total_donation / $this->per_step ) + ( ( $page_remain * 2 ) * count( $donor_ids ) );
229
+			$this->total_step     = (int) $max_num_pages + ($total_donation / $this->per_step) + (($page_remain * 2) * count($donor_ids));
230 230
 			$this->step_completed = $paged;
231 231
 		} else {
232
-			$donation_ids_count = count( $donor_ids );
233
-			$this->update_option( $this->step_key, 'donation' );
234
-			$this->update_option( $this->step_on_key, '0' );
232
+			$donation_ids_count = count($donor_ids);
233
+			$this->update_option($this->step_key, 'donation');
234
+			$this->update_option($this->step_on_key, '0');
235 235
 		}
236 236
 
237
-		$donor_ids = array_unique( $donor_ids );
238
-		$this->update_option( $this->donor_key, $donor_ids );
239
-		$this->update_option( $this->donation_key, $donation_ids );
237
+		$donor_ids = array_unique($donor_ids);
238
+		$this->update_option($this->donor_key, $donor_ids);
239
+		$this->update_option($this->donation_key, $donation_ids);
240 240
 
241 241
 		wp_reset_postdata();
242 242
 	}
@@ -248,34 +248,34 @@  discard block
 block discarded – undo
248 248
 	 * @return int
249 249
 	 */
250 250
 	public function get_percentage_complete() {
251
-		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
251
+		return ceil((100 * $this->step_completed) / $this->total_step);
252 252
 	}
253 253
 
254 254
 	public function process_step() {
255 255
 
256
-		if ( ! $this->can_export() ) {
257
-			wp_die( __( 'You do not have permission to delete Import transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
256
+		if ( ! $this->can_export()) {
257
+			wp_die(__('You do not have permission to delete Import transactions.', 'give'), __('Error', 'give'), array('response' => 403));
258 258
 		}
259 259
 
260 260
 		$had_data = $this->get_data();
261 261
 
262
-		if ( $had_data ) {
262
+		if ($had_data) {
263 263
 			$this->done = false;
264 264
 
265 265
 			return true;
266 266
 		} else {
267
-			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
268
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
267
+			update_option('give_earnings_total', give_get_total_earnings(true));
268
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
269 269
 
270
-			$this->delete_option( $this->donation_key );
270
+			$this->delete_option($this->donation_key);
271 271
 
272 272
 			// Reset the sequential order numbers
273
-			if ( give_get_option( 'enable_sequential' ) ) {
274
-				delete_option( 'give_last_payment_number' );
273
+			if (give_get_option('enable_sequential')) {
274
+				delete_option('give_last_payment_number');
275 275
 			}
276 276
 
277 277
 			$this->done    = true;
278
-			$this->message = __( 'Imported donor and transactions successfully deleted.', 'give' );
278
+			$this->message = __('Imported donor and transactions successfully deleted.', 'give');
279 279
 
280 280
 			return false;
281 281
 		}
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 	public function get_data() {
294 294
 
295 295
 		// Get the donation id's.
296
-		$donation_ids = $this->get_option( $this->donation_key );
296
+		$donation_ids = $this->get_option($this->donation_key);
297 297
 
298 298
 		/**
299 299
 		 * Return false id not Import donation is found.
300 300
 		 */
301
-		if ( empty( $donation_ids ) ) {
301
+		if (empty($donation_ids)) {
302 302
 			$this->is_empty   = true;
303 303
 			$this->total_step = 1;
304 304
 
@@ -309,108 +309,108 @@  discard block
 block discarded – undo
309 309
 		$step = (int) $this->get_step();
310 310
 
311 311
 		// get teh donor ids.
312
-		$donor_ids = $this->get_option( $this->donor_key );
312
+		$donor_ids = $this->get_option($this->donor_key);
313 313
 
314 314
 		// In step to we delete all the donation in loop.
315
-		if ( 2 === $step ) {
315
+		if (2 === $step) {
316 316
 			$pass_to_donor = false;
317 317
 			$page          = (int) $this->get_step_page();
318
-			$page ++;
319
-			$count = count( $donation_ids );
318
+			$page++;
319
+			$count = count($donation_ids);
320 320
 
321
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
321
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
322 322
 			$this->step_completed = $page;
323 323
 
324 324
 
325
-			if ( $count > $this->per_step ) {
325
+			if ($count > $this->per_step) {
326 326
 
327
-				$this->update_option( $this->step_on_key, $page );
328
-				$donation_ids = $this->get_delete_ids( $donation_ids, $page );
329
-				$current_page = (int) ceil( $count / $this->per_step );
327
+				$this->update_option($this->step_on_key, $page);
328
+				$donation_ids = $this->get_delete_ids($donation_ids, $page);
329
+				$current_page = (int) ceil($count / $this->per_step);
330 330
 
331
-				if ( $page === $current_page ) {
331
+				if ($page === $current_page) {
332 332
 					$pass_to_donor = true;
333 333
 				}
334 334
 			} else {
335 335
 				$pass_to_donor = true;
336 336
 			}
337 337
 
338
-			if ( true === $pass_to_donor ) {
339
-				$this->update_option( $this->step_key, 'donor' );
340
-				$this->update_option( $this->step_on_key, '0' );
338
+			if (true === $pass_to_donor) {
339
+				$this->update_option($this->step_key, 'donor');
340
+				$this->update_option($this->step_on_key, '0');
341 341
 			}
342 342
 
343 343
 			// Get the old form list.
344
-			$form_ids = (array) $this->get_option( $this->form_key );
344
+			$form_ids = (array) $this->get_option($this->form_key);
345 345
 
346
-			foreach ( $donation_ids as $item ) {
347
-				$form_ids[] = get_post_meta( $item, '_give_payment_form_id', true );
348
-				wp_delete_post( $item, true );
346
+			foreach ($donation_ids as $item) {
347
+				$form_ids[] = get_post_meta($item, '_give_payment_form_id', true);
348
+				wp_delete_post($item, true);
349 349
 			}
350 350
 
351 351
 			// update the new form list.
352
-			$this->update_option( $this->form_key, $form_ids );
352
+			$this->update_option($this->form_key, $form_ids);
353 353
 		}
354 354
 
355 355
 
356 356
 		// Here we delete all the donor
357
-		if ( 3 === $step ) {
357
+		if (3 === $step) {
358 358
 
359 359
 			// Get the old form list.
360
-			$form_ids = (array) $this->get_option( $this->form_key );
361
-			if ( ! empty( $form_ids ) ) {
362
-				$form_ids = array_unique( $form_ids );
363
-				foreach ( $form_ids as $form_id ) {
364
-					give_recount_form_income_donation( (int) $form_id );
360
+			$form_ids = (array) $this->get_option($this->form_key);
361
+			if ( ! empty($form_ids)) {
362
+				$form_ids = array_unique($form_ids);
363
+				foreach ($form_ids as $form_id) {
364
+					give_recount_form_income_donation((int) $form_id);
365 365
 				}
366 366
 			}
367 367
 			// update the new form list.
368
-			$this->update_option( $this->form_key, array() );
368
+			$this->update_option($this->form_key, array());
369 369
 
370 370
 			$page  = (int) $this->get_step_page();
371
-			$count = count( $donor_ids );
371
+			$count = count($donor_ids);
372 372
 
373
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
374
-			$this->step_completed = $page + ( count( $donation_ids ) / $this->per_step );
373
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
374
+			$this->step_completed = $page + (count($donation_ids) / $this->per_step);
375 375
 
376
-			if ( ! empty( $donor_ids[ $page ] ) ) {
377
-				$args = apply_filters( 'give_tools_reset_stats_total_args', array(
376
+			if ( ! empty($donor_ids[$page])) {
377
+				$args = apply_filters('give_tools_reset_stats_total_args', array(
378 378
 					'post_status'    => 'any',
379 379
 					'posts_per_page' => 1,
380
-					'author'         => $donor_ids[ $page ]
381
-				) );
380
+					'author'         => $donor_ids[$page]
381
+				));
382 382
 
383 383
 				$donations = array();
384
-				$payments  = new Give_Payments_Query( $args );
384
+				$payments  = new Give_Payments_Query($args);
385 385
 				$payments  = $payments->get_payments();
386
-				if ( empty( $payments ) ) {
387
-					Give()->donors->delete_by_user_id( $donor_ids[ $page ] );
386
+				if (empty($payments)) {
387
+					Give()->donors->delete_by_user_id($donor_ids[$page]);
388 388
 
389 389
 					/**
390 390
 					 * If Checked then delete WP user.
391 391
 					 *
392 392
 					 * @since 1.8.14
393 393
 					 */
394
-					if ( 'on' === (string) $_REQUEST['delete-import-donors'] ) {
395
-						wp_delete_user( $donor_ids[ $page ] );
394
+					if ('on' === (string) $_REQUEST['delete-import-donors']) {
395
+						wp_delete_user($donor_ids[$page]);
396 396
 					}
397 397
 				} else {
398
-					foreach ( $payments as $payment ) {
398
+					foreach ($payments as $payment) {
399 399
 						$donations[] = $payment->ID;
400 400
 					}
401 401
 
402
-					$donor          = new Give_Donor( $donor_ids[ $page ], true );
402
+					$donor          = new Give_Donor($donor_ids[$page], true);
403 403
 					$data_to_update = array(
404
-						'purchase_count' => count( $donations ),
405
-						'payment_ids'    => implode( ',', $donations ),
404
+						'purchase_count' => count($donations),
405
+						'payment_ids'    => implode(',', $donations),
406 406
 					);
407
-					$donor->update( $data_to_update );
407
+					$donor->update($data_to_update);
408 408
 				}
409 409
 			}
410 410
 
411
-			$page ++;
412
-			$this->update_option( $this->step_on_key, $page );
413
-			if ( $count === $page ) {
411
+			$page++;
412
+			$this->update_option($this->step_on_key, $page);
413
+			if ($count === $page) {
414 414
 				$this->is_empty = false;
415 415
 
416 416
 				return false;
@@ -422,24 +422,24 @@  discard block
 block discarded – undo
422 422
 		return true;
423 423
 	}
424 424
 
425
-	public function get_delete_ids( $donation_ids, $page ) {
426
-		$index            = $page --;
427
-		$count            = count( $donation_ids );
425
+	public function get_delete_ids($donation_ids, $page) {
426
+		$index            = $page--;
427
+		$count            = count($donation_ids);
428 428
 		$temp             = 0;
429 429
 		$current_page     = 0;
430 430
 		$post_delete      = $this->per_step;
431 431
 		$page_donation_id = array();
432 432
 
433
-		foreach ( $donation_ids as $item ) {
434
-			$temp ++;
435
-			$page_donation_id[ $current_page ][] = $item;
436
-			if ( $temp === $post_delete ) {
437
-				$current_page ++;
433
+		foreach ($donation_ids as $item) {
434
+			$temp++;
435
+			$page_donation_id[$current_page][] = $item;
436
+			if ($temp === $post_delete) {
437
+				$current_page++;
438 438
 				$temp = 0;
439 439
 			}
440 440
 		}
441 441
 
442
-		return $page_donation_id[ $page ];
442
+		return $page_donation_id[$page];
443 443
 	}
444 444
 
445 445
 	/**
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @return mixed       Returns the data from the database
453 453
 	 */
454
-	public function get_option( $key, $defalut_value = false ) {
455
-		return get_option( $key, $defalut_value );
454
+	public function get_option($key, $defalut_value = false) {
455
+		return get_option($key, $defalut_value);
456 456
 	}
457 457
 
458 458
 	/**
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 *
466 466
 	 * @return void
467 467
 	 */
468
-	public function update_option( $key, $value ) {
469
-		update_option( $key, $value, false );
468
+	public function update_option($key, $value) {
469
+		update_option($key, $value, false);
470 470
 	}
471 471
 
472 472
 	/**
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @return void
480 480
 	 */
481
-	public function delete_option( $key ) {
482
-		delete_option( $key );
481
+	public function delete_option($key) {
482
+		delete_option($key);
483 483
 	}
484 484
 
485 485
 	/**
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 	 * @return int|string
491 491
 	 */
492 492
 	private function get_step() {
493
-		$step_key = (string) $this->get_option( $this->step_key, false );
494
-		if ( 'count' === $step_key ) {
493
+		$step_key = (string) $this->get_option($this->step_key, false);
494
+		if ('count' === $step_key) {
495 495
 			return 1;
496
-		} elseif ( 'donation' === $step_key ) {
496
+		} elseif ('donation' === $step_key) {
497 497
 			return 2;
498
-		} elseif ( 'donor' === $step_key ) {
498
+		} elseif ('donor' === $step_key) {
499 499
 			return 3;
500 500
 		} else {
501 501
 			return $step_key;
@@ -506,6 +506,6 @@  discard block
 block discarded – undo
506 506
 	 * Get the current $page value in the ajax.
507 507
 	 */
508 508
 	private function get_step_page() {
509
-		return $this->get_option( $this->step_on_key, false );
509
+		return $this->get_option($this->step_on_key, false);
510 510
 	}
511 511
 }
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
  * @param  int $year Year number. Default is null.
698 698
  * @param  int $hour Hour number. Default is null.
699 699
  *
700
- * @return int $earnings  Earnings
700
+ * @return double $earnings  Earnings
701 701
  */
702 702
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
703 703
 
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
  *
987 987
  * @param int $payment_id Payment ID.
988 988
  *
989
- * @return array $user_info User Info Meta Values.
989
+ * @return string $user_info User Info Meta Values.
990 990
  */
991 991
 function give_get_payment_meta_user_info( $payment_id ) {
992 992
 	$payment = new Give_Payment( $payment_id );
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
  *
1004 1004
  * @param int $payment_id Payment ID.
1005 1005
  *
1006
- * @return int $form_id Form ID.
1006
+ * @return string $form_id Form ID.
1007 1007
  */
1008 1008
 function give_get_payment_form_id( $payment_id ) {
1009 1009
 	$payment = new Give_Payment( $payment_id );
Please login to merge, or discard this patch.
Spacing   +416 added lines, -416 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return array $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility.
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}// End switch().
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,29 +132,29 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise.
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	$payment    = new Give_Payment();
142
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
143
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
144
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
145
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
146
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
142
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
143
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
144
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
145
+	$price_id   = give_get_payment_meta_price_id($payment_data);
146
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
147 147
 
148 148
 	// Set properties.
149 149
 	$payment->total          = $payment_data['price'];
150
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
151
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency();
150
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
151
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency();
152 152
 	$payment->user_info      = $payment_data['user_info'];
153 153
 	$payment->gateway        = $gateway;
154 154
 	$payment->form_title     = $form_title;
155 155
 	$payment->form_id        = $form_id;
156 156
 	$payment->price_id       = $price_id;
157
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
157
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
158 158
 	$payment->user_id        = $payment_data['user_info']['id'];
159 159
 	$payment->email          = $payment_data['user_email'];
160 160
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	$payment->email          = $payment_data['user_info']['email'];
163 163
 	$payment->ip             = give_get_ip();
164 164
 	$payment->key            = $payment_data['purchase_key'];
165
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
166
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
166
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
167 167
 
168 168
 	// Add the donation.
169 169
 	$args = array(
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
 		'price_id' => $payment->price_id,
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 
177 177
 	// Set date if present.
178
-	if ( isset( $payment_data['post_date'] ) ) {
178
+	if (isset($payment_data['post_date'])) {
179 179
 		$payment->date = $payment_data['post_date'];
180 180
 	}
181 181
 
182 182
 	// Handle sequential payments.
183
-	if ( give_get_option( 'enable_sequential' ) ) {
183
+	if (give_get_option('enable_sequential')) {
184 184
 		$number          = give_get_next_payment_number();
185
-		$payment->number = give_format_payment_number( $number );
186
-		update_option( 'give_last_payment_number', $number );
185
+		$payment->number = give_format_payment_number($number);
186
+		update_option('give_last_payment_number', $number);
187 187
 	}
188 188
 
189 189
 	// Save payment.
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 	 * @param int $payment_id The payment ID.
198 198
 	 * @param array $payment_data Arguments passed.
199 199
 	 */
200
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
200
+	do_action('give_insert_payment', $payment->ID, $payment_data);
201 201
 
202 202
 	// Return payment ID upon success.
203
-	if ( ! empty( $payment->ID ) ) {
203
+	if ( ! empty($payment->ID)) {
204 204
 		return $payment->ID;
205 205
 	}
206 206
 
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
  *
217 217
  * @return bool|int
218 218
  */
219
-function give_create_payment( $payment_data ) {
219
+function give_create_payment($payment_data) {
220 220
 
221
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
222
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
221
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
222
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
223 223
 
224 224
 	// Collect payment data.
225 225
 	$insert_payment_data = array(
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @param array $insert_payment_data
245 245
 	 */
246
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
246
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
247 247
 
248 248
 	// Record the pending payment.
249
-	return give_insert_payment( $insert_payment_data );
249
+	return give_insert_payment($insert_payment_data);
250 250
 }
251 251
 
252 252
 /**
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return bool
261 261
  */
262
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
262
+function give_update_payment_status($payment_id, $new_status = 'publish') {
263 263
 
264 264
 	$updated = false;
265
-	$payment = new Give_Payment( $payment_id );
265
+	$payment = new Give_Payment($payment_id);
266 266
 
267
-	if ( $payment && $payment->ID > 0 ) {
267
+	if ($payment && $payment->ID > 0) {
268 268
 
269 269
 		$payment->status = $new_status;
270 270
 		$updated         = $payment->save();
@@ -286,38 +286,38 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @return void
288 288
  */
289
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
289
+function give_delete_donation($payment_id = 0, $update_donor = true) {
290 290
 	global $give_logs;
291 291
 
292
-	$payment  = new Give_Payment( $payment_id );
293
-	$amount   = give_get_payment_amount( $payment_id );
292
+	$payment  = new Give_Payment($payment_id);
293
+	$amount   = give_get_payment_amount($payment_id);
294 294
 	$status   = $payment->post_status;
295
-	$donor_id = give_get_payment_donor_id( $payment_id );
296
-	$donor    = new Give_Donor( $donor_id );
295
+	$donor_id = give_get_payment_donor_id($payment_id);
296
+	$donor    = new Give_Donor($donor_id);
297 297
 
298 298
 	// Only undo donations that aren't these statuses.
299
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
299
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
300 300
 		'pending',
301 301
 		'cancelled',
302
-	) );
302
+	));
303 303
 
304
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
305
-		give_undo_donation( $payment_id );
304
+	if ( ! in_array($status, $dont_undo_statuses)) {
305
+		give_undo_donation($payment_id);
306 306
 	}
307 307
 
308
-	if ( $status == 'publish' ) {
308
+	if ($status == 'publish') {
309 309
 
310 310
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
311
-		give_decrease_total_earnings( $amount );
311
+		give_decrease_total_earnings($amount);
312 312
 
313 313
 		// @todo: Refresh only range related stat cache
314 314
 		give_delete_donation_stats();
315 315
 
316
-		if ( $donor->id && $update_donor ) {
316
+		if ($donor->id && $update_donor) {
317 317
 
318 318
 			// Decrement the stats for the donor.
319 319
 			$donor->decrease_donation_count();
320
-			$donor->decrease_value( $amount );
320
+			$donor->decrease_value($amount);
321 321
 
322 322
 		}
323 323
 	}
@@ -329,25 +329,25 @@  discard block
 block discarded – undo
329 329
 	 *
330 330
 	 * @param int $payment_id Payment ID.
331 331
 	 */
332
-	do_action( 'give_payment_delete', $payment_id );
332
+	do_action('give_payment_delete', $payment_id);
333 333
 
334
-	if ( $donor->id && $update_donor ) {
334
+	if ($donor->id && $update_donor) {
335 335
 
336 336
 		// Remove the payment ID from the donor.
337
-		$donor->remove_payment( $payment_id );
337
+		$donor->remove_payment($payment_id);
338 338
 
339 339
 	}
340 340
 
341 341
 	// Remove the payment.
342
-	wp_delete_post( $payment_id, true );
342
+	wp_delete_post($payment_id, true);
343 343
 
344 344
 	// Remove related sale log entries.
345
-	$give_logs->delete_logs( null, 'sale', array(
345
+	$give_logs->delete_logs(null, 'sale', array(
346 346
 		array(
347 347
 			'key'   => '_give_log_payment_id',
348 348
 			'value' => $payment_id,
349 349
 		),
350
-	) );
350
+	));
351 351
 
352 352
 	/**
353 353
 	 * Fires after payment deleted.
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @param int $payment_id Payment ID.
358 358
 	 */
359
-	do_action( 'give_payment_deleted', $payment_id );
359
+	do_action('give_payment_deleted', $payment_id);
360 360
 }
361 361
 
362 362
 /**
@@ -371,20 +371,20 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @return void
373 373
  */
374
-function give_undo_donation( $payment_id ) {
374
+function give_undo_donation($payment_id) {
375 375
 
376
-	$payment = new Give_Payment( $payment_id );
376
+	$payment = new Give_Payment($payment_id);
377 377
 
378
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
379
-	if ( true === $maybe_decrease_earnings ) {
378
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
379
+	if (true === $maybe_decrease_earnings) {
380 380
 		// Decrease earnings.
381
-		give_decrease_earnings( $payment->form_id, $payment->total );
381
+		give_decrease_earnings($payment->form_id, $payment->total);
382 382
 	}
383 383
 
384
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
385
-	if ( true === $maybe_decrease_donations ) {
384
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
385
+	if (true === $maybe_decrease_donations) {
386 386
 		// Decrease donation count.
387
-		give_decrease_donation_count( $payment->form_id );
387
+		give_decrease_donation_count($payment->form_id);
388 388
 	}
389 389
 
390 390
 }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
  *
402 402
  * @return object $stats Contains the number of payments per payment status.
403 403
  */
404
-function give_count_payments( $args = array() ) {
404
+function give_count_payments($args = array()) {
405 405
 
406 406
 	global $wpdb;
407 407
 
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 		'form_id'    => null,
414 414
 	);
415 415
 
416
-	$args = wp_parse_args( $args, $defaults );
416
+	$args = wp_parse_args($args, $defaults);
417 417
 
418 418
 	$select = 'SELECT p.post_status,count( * ) AS num_posts';
419 419
 	$join   = '';
420
-	$where  = "WHERE p.post_type = 'give_payment' AND p.post_status IN ('" . implode( "','", give_get_payment_status_keys() ) . "')";
420
+	$where  = "WHERE p.post_type = 'give_payment' AND p.post_status IN ('".implode("','", give_get_payment_status_keys())."')";
421 421
 
422 422
 	// Count payments for a specific user.
423
-	if ( ! empty( $args['user'] ) ) {
423
+	if ( ! empty($args['user'])) {
424 424
 
425
-		if ( is_email( $args['user'] ) ) {
425
+		if (is_email($args['user'])) {
426 426
 			$field = 'email';
427
-		} elseif ( is_numeric( $args['user'] ) ) {
427
+		} elseif (is_numeric($args['user'])) {
428 428
 			$field = 'id';
429 429
 		} else {
430 430
 			$field = '';
@@ -432,107 +432,107 @@  discard block
 block discarded – undo
432 432
 
433 433
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
434 434
 
435
-		if ( ! empty( $field ) ) {
435
+		if ( ! empty($field)) {
436 436
 			$where .= "
437 437
 				AND m.meta_key = '_give_payment_user_{$field}'
438 438
 				AND m.meta_value = '{$args['user']}'";
439 439
 		}
440
-	} elseif ( ! empty( $args['donor'] ) ) {
440
+	} elseif ( ! empty($args['donor'])) {
441 441
 
442
-		$join  = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
442
+		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
443 443
 		$where .= "
444 444
 			AND m.meta_key = '_give_payment_customer_id'
445 445
 			AND m.meta_value = '{$args['donor']}'";
446 446
 
447 447
 		// Count payments for a search.
448
-	} elseif ( ! empty( $args['s'] ) ) {
448
+	} elseif ( ! empty($args['s'])) {
449 449
 
450
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
450
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
451 451
 
452
-			if ( is_email( $args['s'] ) ) {
452
+			if (is_email($args['s'])) {
453 453
 				$field = '_give_payment_user_email';
454 454
 			} else {
455 455
 				$field = '_give_payment_purchase_key';
456 456
 			}
457 457
 
458
-			$join  = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
459
-			$where .= $wpdb->prepare( '
458
+			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
459
+			$where .= $wpdb->prepare('
460 460
                 AND m.meta_key = %s
461
-                AND m.meta_value = %s', $field, $args['s'] );
461
+                AND m.meta_value = %s', $field, $args['s']);
462 462
 
463
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
463
+		} elseif ('#' == substr($args['s'], 0, 1)) {
464 464
 
465
-			$search = str_replace( '#:', '', $args['s'] );
466
-			$search = str_replace( '#', '', $search );
465
+			$search = str_replace('#:', '', $args['s']);
466
+			$search = str_replace('#', '', $search);
467 467
 
468 468
 			$select = 'SELECT p.post_status,count( * ) AS num_posts ';
469 469
 			$join   = '';
470
-			$where  = $wpdb->prepare( 'WHERE p.post_type=%s  AND p.ID = %d ', 'give_payment', $search );
470
+			$where  = $wpdb->prepare('WHERE p.post_type=%s  AND p.ID = %d ', 'give_payment', $search);
471 471
 
472
-		} elseif ( is_numeric( $args['s'] ) ) {
472
+		} elseif (is_numeric($args['s'])) {
473 473
 
474
-			$join  = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
475
-			$where .= $wpdb->prepare( "
474
+			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
475
+			$where .= $wpdb->prepare("
476 476
 				AND m.meta_key = '_give_payment_user_id'
477
-				AND m.meta_value = %d", $args['s'] );
477
+				AND m.meta_value = %d", $args['s']);
478 478
 
479 479
 		} else {
480
-			$search = $wpdb->esc_like( $args['s'] );
481
-			$search = '%' . $search . '%';
480
+			$search = $wpdb->esc_like($args['s']);
481
+			$search = '%'.$search.'%';
482 482
 
483
-			$where .= $wpdb->prepare( 'AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search );
483
+			$where .= $wpdb->prepare('AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search);
484 484
 		}// End if().
485 485
 	}// End if().
486 486
 
487
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
487
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
488 488
 
489
-		$join  = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
490
-		$where .= $wpdb->prepare( '
489
+		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
490
+		$where .= $wpdb->prepare('
491 491
                 AND m.meta_key = %s
492
-                AND m.meta_value = %s', '_give_payment_form_id', $args['form_id'] );
492
+                AND m.meta_value = %s', '_give_payment_form_id', $args['form_id']);
493 493
 	}
494 494
 
495 495
 	// Limit payments count by date.
496
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
496
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
497 497
 
498
-		$date_parts = explode( '/', $args['start-date'] );
499
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
500
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
501
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
498
+		$date_parts = explode('/', $args['start-date']);
499
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
500
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
501
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
502 502
 
503
-		$is_date = checkdate( $month, $day, $year );
504
-		if ( false !== $is_date ) {
503
+		$is_date = checkdate($month, $day, $year);
504
+		if (false !== $is_date) {
505 505
 
506
-			$date  = new DateTime( $args['start-date'] );
507
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
506
+			$date = new DateTime($args['start-date']);
507
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
508 508
 
509 509
 		}
510 510
 
511 511
 		// Fixes an issue with the payments list table counts when no end date is specified (with stats class).
512
-		if ( empty( $args['end-date'] ) ) {
512
+		if (empty($args['end-date'])) {
513 513
 			$args['end-date'] = $args['start-date'];
514 514
 		}
515 515
 	}
516 516
 
517
-	if ( ! empty( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
517
+	if ( ! empty($args['end-date']) && false !== strpos($args['end-date'], '/')) {
518 518
 
519
-		$date_parts = explode( '/', $args['end-date'] );
519
+		$date_parts = explode('/', $args['end-date']);
520 520
 
521
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
522
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
523
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
521
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
522
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
523
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
524 524
 
525
-		$is_date = checkdate( $month, $day, $year );
526
-		if ( false !== $is_date ) {
525
+		$is_date = checkdate($month, $day, $year);
526
+		if (false !== $is_date) {
527 527
 
528
-			$date  = new DateTime( $args['end-date'] );
529
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
528
+			$date = new DateTime($args['end-date']);
529
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
530 530
 
531 531
 		}
532 532
 	}
533 533
 
534
-	$where = apply_filters( 'give_count_payments_where', $where );
535
-	$join  = apply_filters( 'give_count_payments_join', $join );
534
+	$where = apply_filters('give_count_payments_where', $where);
535
+	$join  = apply_filters('give_count_payments_join', $join);
536 536
 
537 537
 	$query = "$select
538 538
 		FROM $wpdb->posts p
@@ -541,36 +541,36 @@  discard block
 block discarded – undo
541 541
 		GROUP BY p.post_status
542 542
 	";
543 543
 
544
-	$cache_key = md5( $query );
544
+	$cache_key = md5($query);
545 545
 
546
-	$count = wp_cache_get( $cache_key, 'counts' );
547
-	if ( false !== $count ) {
546
+	$count = wp_cache_get($cache_key, 'counts');
547
+	if (false !== $count) {
548 548
 		return $count;
549 549
 	}
550 550
 
551
-	$count = $wpdb->get_results( $query, ARRAY_A );
551
+	$count = $wpdb->get_results($query, ARRAY_A);
552 552
 
553 553
 	$stats    = array();
554 554
 	$statuses = get_post_stati();
555
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
556
-		unset( $statuses['private'] );
555
+	if (isset($statuses['private']) && empty($args['s'])) {
556
+		unset($statuses['private']);
557 557
 	}
558 558
 
559
-	foreach ( $statuses as $state ) {
560
-		$stats[ $state ] = 0;
559
+	foreach ($statuses as $state) {
560
+		$stats[$state] = 0;
561 561
 	}
562 562
 
563
-	foreach ( (array) $count as $row ) {
563
+	foreach ((array) $count as $row) {
564 564
 
565
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
565
+		if ('private' == $row['post_status'] && empty($args['s'])) {
566 566
 			continue;
567 567
 		}
568 568
 
569
-		$stats[ $row['post_status'] ] = $row['num_posts'];
569
+		$stats[$row['post_status']] = $row['num_posts'];
570 570
 	}
571 571
 
572 572
 	$stats = (object) $stats;
573
-	wp_cache_set( $cache_key, $stats, 'counts' );
573
+	wp_cache_set($cache_key, $stats, 'counts');
574 574
 
575 575
 	return $stats;
576 576
 }
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
  *
586 586
  * @return bool $exists True if payment exists, false otherwise.
587 587
  */
588
-function give_check_for_existing_payment( $payment_id ) {
588
+function give_check_for_existing_payment($payment_id) {
589 589
 	$exists  = false;
590
-	$payment = new Give_Payment( $payment_id );
590
+	$payment = new Give_Payment($payment_id);
591 591
 
592
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
592
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
593 593
 		$exists = true;
594 594
 	}
595 595
 
@@ -607,41 +607,41 @@  discard block
 block discarded – undo
607 607
  *
608 608
  * @return bool|mixed True if payment status exists, false otherwise.
609 609
  */
610
-function give_get_payment_status( $payment, $return_label = false ) {
610
+function give_get_payment_status($payment, $return_label = false) {
611 611
 
612
-	if ( is_numeric( $payment ) ) {
612
+	if (is_numeric($payment)) {
613 613
 
614
-		$payment = new Give_Payment( $payment );
614
+		$payment = new Give_Payment($payment);
615 615
 
616
-		if ( ! $payment->ID > 0 ) {
616
+		if ( ! $payment->ID > 0) {
617 617
 			return false;
618 618
 		}
619 619
 
620 620
 	}
621 621
 
622
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
622
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
623 623
 		return false;
624 624
 	}
625 625
 
626 626
 	$statuses = give_get_payment_statuses();
627 627
 
628
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
628
+	if ( ! is_array($statuses) || empty($statuses)) {
629 629
 		return false;
630 630
 	}
631 631
 
632 632
 	// Get payment object if not already given.
633
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
633
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
634 634
 
635
-	if ( array_key_exists( $payment->status, $statuses ) ) {
636
-		if ( true === $return_label ) {
635
+	if (array_key_exists($payment->status, $statuses)) {
636
+		if (true === $return_label) {
637 637
 			// Return translated status label.
638
-			return $statuses[ $payment->status ];
638
+			return $statuses[$payment->status];
639 639
 		} else {
640 640
 			// Account that our 'publish' status is labeled 'Complete'
641 641
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
642 642
 
643 643
 			// Make sure we're matching cases, since they matter
644
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
644
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
645 645
 		}
646 646
 	}
647 647
 
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
  */
658 658
 function give_get_payment_statuses() {
659 659
 	$payment_statuses = array(
660
-		'pending'     => __( 'Pending', 'give' ),
661
-		'publish'     => __( 'Complete', 'give' ),
662
-		'refunded'    => __( 'Refunded', 'give' ),
663
-		'failed'      => __( 'Failed', 'give' ),
664
-		'cancelled'   => __( 'Cancelled', 'give' ),
665
-		'abandoned'   => __( 'Abandoned', 'give' ),
666
-		'preapproval' => __( 'Pre-Approved', 'give' ),
667
-		'processing'  => __( 'Processing', 'give' ),
668
-		'revoked'     => __( 'Revoked', 'give' ),
660
+		'pending'     => __('Pending', 'give'),
661
+		'publish'     => __('Complete', 'give'),
662
+		'refunded'    => __('Refunded', 'give'),
663
+		'failed'      => __('Failed', 'give'),
664
+		'cancelled'   => __('Cancelled', 'give'),
665
+		'abandoned'   => __('Abandoned', 'give'),
666
+		'preapproval' => __('Pre-Approved', 'give'),
667
+		'processing'  => __('Processing', 'give'),
668
+		'revoked'     => __('Revoked', 'give'),
669 669
 	);
670 670
 
671
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
671
+	return apply_filters('give_payment_statuses', $payment_statuses);
672 672
 }
673 673
 
674 674
 /**
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
  * @return array $payment_status All the available payment statuses.
682 682
  */
683 683
 function give_get_payment_status_keys() {
684
-	$statuses = array_keys( give_get_payment_statuses() );
685
-	asort( $statuses );
684
+	$statuses = array_keys(give_get_payment_statuses());
685
+	asort($statuses);
686 686
 
687
-	return array_values( $statuses );
687
+	return array_values($statuses);
688 688
 }
689 689
 
690 690
 /**
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
  *
700 700
  * @return int $earnings  Earnings
701 701
  */
702
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
702
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
703 703
 
704 704
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
705 705
 	global $wpdb;
@@ -709,41 +709,41 @@  discard block
 block discarded – undo
709 709
 		'nopaging'               => true,
710 710
 		'year'                   => $year,
711 711
 		'monthnum'               => $month_num,
712
-		'post_status'            => array( 'publish' ),
712
+		'post_status'            => array('publish'),
713 713
 		'fields'                 => 'ids',
714 714
 		'update_post_term_cache' => false,
715 715
 	);
716
-	if ( ! empty( $day ) ) {
716
+	if ( ! empty($day)) {
717 717
 		$args['day'] = $day;
718 718
 	}
719 719
 
720
-	if ( ! empty( $hour ) ) {
720
+	if ( ! empty($hour)) {
721 721
 		$args['hour'] = $hour;
722 722
 	}
723 723
 
724
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
725
-	$key  = Give_Cache::get_key( 'give_stats', $args );
724
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
725
+	$key  = Give_Cache::get_key('give_stats', $args);
726 726
 
727
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
727
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
728 728
 		$earnings = false;
729 729
 	} else {
730
-		$earnings = Give_Cache::get( $key );
730
+		$earnings = Give_Cache::get($key);
731 731
 	}
732 732
 
733
-	if ( false === $earnings ) {
734
-		$donations = get_posts( $args );
733
+	if (false === $earnings) {
734
+		$donations = get_posts($args);
735 735
 		$earnings  = 0;
736
-		if ( $donations ) {
737
-			$donations = implode( ',', $donations );
736
+		if ($donations) {
737
+			$donations = implode(',', $donations);
738 738
 
739
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
739
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
740 740
 
741 741
 		}
742 742
 		// Cache the results for one hour.
743
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
743
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
744 744
 	}
745 745
 
746
-	return round( $earnings, 2 );
746
+	return round($earnings, 2);
747 747
 }
748 748
 
749 749
 /**
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
  *
759 759
  * @return int $count     Sales
760 760
  */
761
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
761
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
762 762
 
763 763
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
764 764
 	$args = array(
@@ -766,14 +766,14 @@  discard block
 block discarded – undo
766 766
 		'nopaging'               => true,
767 767
 		'year'                   => $year,
768 768
 		'fields'                 => 'ids',
769
-		'post_status'            => array( 'publish' ),
769
+		'post_status'            => array('publish'),
770 770
 		'update_post_meta_cache' => false,
771 771
 		'update_post_term_cache' => false,
772 772
 	);
773 773
 
774
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
774
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
775 775
 
776
-	if ( false === $show_free ) {
776
+	if (false === $show_free) {
777 777
 		$args['meta_query'] = array(
778 778
 			array(
779 779
 				'key'     => '_give_payment_total',
@@ -784,33 +784,33 @@  discard block
 block discarded – undo
784 784
 		);
785 785
 	}
786 786
 
787
-	if ( ! empty( $month_num ) ) {
787
+	if ( ! empty($month_num)) {
788 788
 		$args['monthnum'] = $month_num;
789 789
 	}
790 790
 
791
-	if ( ! empty( $day ) ) {
791
+	if ( ! empty($day)) {
792 792
 		$args['day'] = $day;
793 793
 	}
794 794
 
795
-	if ( ! empty( $hour ) ) {
795
+	if ( ! empty($hour)) {
796 796
 		$args['hour'] = $hour;
797 797
 	}
798 798
 
799
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
799
+	$args = apply_filters('give_get_sales_by_date_args', $args);
800 800
 
801
-	$key = Give_Cache::get_key( 'give_stats', $args );
801
+	$key = Give_Cache::get_key('give_stats', $args);
802 802
 
803
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
803
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
804 804
 		$count = false;
805 805
 	} else {
806
-		$count = Give_Cache::get( $key );
806
+		$count = Give_Cache::get($key);
807 807
 	}
808 808
 
809
-	if ( false === $count ) {
810
-		$donations = new WP_Query( $args );
809
+	if (false === $count) {
810
+		$donations = new WP_Query($args);
811 811
 		$count     = (int) $donations->post_count;
812 812
 		// Cache the results for one hour.
813
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
813
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
814 814
 	}
815 815
 
816 816
 	return $count;
@@ -825,19 +825,19 @@  discard block
 block discarded – undo
825 825
  *
826 826
  * @return bool $ret True if complete, false otherwise.
827 827
  */
828
-function give_is_payment_complete( $payment_id ) {
829
-	$payment = new Give_Payment( $payment_id );
828
+function give_is_payment_complete($payment_id) {
829
+	$payment = new Give_Payment($payment_id);
830 830
 
831 831
 	$ret = false;
832 832
 
833
-	if ( $payment->ID > 0 ) {
833
+	if ($payment->ID > 0) {
834 834
 
835
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
835
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
836 836
 			$ret = true;
837 837
 		}
838 838
 	}
839 839
 
840
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
840
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
841 841
 }
842 842
 
843 843
 /**
@@ -863,49 +863,49 @@  discard block
 block discarded – undo
863 863
  *
864 864
  * @return float $total Total earnings.
865 865
  */
866
-function give_get_total_earnings( $recalculate = false ) {
866
+function give_get_total_earnings($recalculate = false) {
867 867
 
868
-	$total = get_option( 'give_earnings_total', 0 );
868
+	$total = get_option('give_earnings_total', 0);
869 869
 
870 870
 	// Calculate total earnings.
871
-	if ( ! $total || $recalculate ) {
871
+	if ( ! $total || $recalculate) {
872 872
 		global $wpdb;
873 873
 
874 874
 		$total = (float) 0;
875 875
 
876
-		$args = apply_filters( 'give_get_total_earnings_args', array(
876
+		$args = apply_filters('give_get_total_earnings_args', array(
877 877
 			'offset' => 0,
878
-			'number' => - 1,
879
-			'status' => array( 'publish' ),
878
+			'number' => -1,
879
+			'status' => array('publish'),
880 880
 			'fields' => 'ids',
881
-		) );
881
+		));
882 882
 
883
-		$payments = give_get_payments( $args );
884
-		if ( $payments ) {
883
+		$payments = give_get_payments($args);
884
+		if ($payments) {
885 885
 
886 886
 			/**
887 887
 			 * If performing a donation, we need to skip the very last payment in the database,
888 888
 			 * since it calls give_increase_total_earnings() on completion,
889 889
 			 * which results in duplicated earnings for the very first donation.
890 890
 			 */
891
-			if ( did_action( 'give_update_payment_status' ) ) {
892
-				array_pop( $payments );
891
+			if (did_action('give_update_payment_status')) {
892
+				array_pop($payments);
893 893
 			}
894 894
 
895
-			if ( ! empty( $payments ) ) {
896
-				$payments = implode( ',', $payments );
897
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
895
+			if ( ! empty($payments)) {
896
+				$payments = implode(',', $payments);
897
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
898 898
 			}
899 899
 		}
900 900
 
901
-		update_option( 'give_earnings_total', $total, 'no' );
901
+		update_option('give_earnings_total', $total, 'no');
902 902
 	}
903 903
 
904
-	if ( $total < 0 ) {
904
+	if ($total < 0) {
905 905
 		$total = 0; // Don't ever show negative earnings.
906 906
 	}
907 907
 
908
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
908
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
909 909
 }
910 910
 
911 911
 /**
@@ -918,10 +918,10 @@  discard block
 block discarded – undo
918 918
  *
919 919
  * @return float $total  Total earnings.
920 920
  */
921
-function give_increase_total_earnings( $amount = 0 ) {
921
+function give_increase_total_earnings($amount = 0) {
922 922
 	$total = give_get_total_earnings();
923 923
 	$total += $amount;
924
-	update_option( 'give_earnings_total', $total );
924
+	update_option('give_earnings_total', $total);
925 925
 
926 926
 	return $total;
927 927
 }
@@ -935,13 +935,13 @@  discard block
 block discarded – undo
935 935
  *
936 936
  * @return float $total Total earnings.
937 937
  */
938
-function give_decrease_total_earnings( $amount = 0 ) {
938
+function give_decrease_total_earnings($amount = 0) {
939 939
 	$total = give_get_total_earnings();
940 940
 	$total -= $amount;
941
-	if ( $total < 0 ) {
941
+	if ($total < 0) {
942 942
 		$total = 0;
943 943
 	}
944
-	update_option( 'give_earnings_total', $total );
944
+	update_option('give_earnings_total', $total);
945 945
 
946 946
 	return $total;
947 947
 }
@@ -957,10 +957,10 @@  discard block
 block discarded – undo
957 957
  *
958 958
  * @return mixed $meta Payment Meta.
959 959
  */
960
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
961
-	$payment = new Give_Payment( $payment_id );
960
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
961
+	$payment = new Give_Payment($payment_id);
962 962
 
963
-	return $payment->get_meta( $meta_key, $single );
963
+	return $payment->get_meta($meta_key, $single);
964 964
 }
965 965
 
966 966
 /**
@@ -973,10 +973,10 @@  discard block
 block discarded – undo
973 973
  *
974 974
  * @return mixed Meta ID if successful, false if unsuccessful.
975 975
  */
976
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
977
-	$payment = new Give_Payment( $payment_id );
976
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
977
+	$payment = new Give_Payment($payment_id);
978 978
 
979
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
979
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
980 980
 }
981 981
 
982 982
 /**
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
  *
989 989
  * @return array $user_info User Info Meta Values.
990 990
  */
991
-function give_get_payment_meta_user_info( $payment_id ) {
992
-	$payment = new Give_Payment( $payment_id );
991
+function give_get_payment_meta_user_info($payment_id) {
992
+	$payment = new Give_Payment($payment_id);
993 993
 
994 994
 	return $payment->user_info;
995 995
 }
@@ -1005,8 +1005,8 @@  discard block
 block discarded – undo
1005 1005
  *
1006 1006
  * @return int $form_id Form ID.
1007 1007
  */
1008
-function give_get_payment_form_id( $payment_id ) {
1009
-	$payment = new Give_Payment( $payment_id );
1008
+function give_get_payment_form_id($payment_id) {
1009
+	$payment = new Give_Payment($payment_id);
1010 1010
 
1011 1011
 	return $payment->form_id;
1012 1012
 }
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
  *
1021 1021
  * @return string $email User email.
1022 1022
  */
1023
-function give_get_payment_user_email( $payment_id ) {
1024
-	$payment = new Give_Payment( $payment_id );
1023
+function give_get_payment_user_email($payment_id) {
1024
+	$payment = new Give_Payment($payment_id);
1025 1025
 
1026 1026
 	return $payment->email;
1027 1027
 }
@@ -1035,11 +1035,11 @@  discard block
 block discarded – undo
1035 1035
  *
1036 1036
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
1037 1037
  */
1038
-function give_is_guest_payment( $payment_id ) {
1039
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
1040
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
1038
+function give_is_guest_payment($payment_id) {
1039
+	$payment_user_id  = give_get_payment_user_id($payment_id);
1040
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
1041 1041
 
1042
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
1042
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
1043 1043
 }
1044 1044
 
1045 1045
 /**
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return int $user_id User ID.
1053 1053
  */
1054
-function give_get_payment_user_id( $payment_id ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_user_id($payment_id) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->user_id;
1058 1058
 }
@@ -1066,8 +1066,8 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return int $payment->customer_id Donor ID.
1068 1068
  */
1069
-function give_get_payment_donor_id( $payment_id ) {
1070
-	$payment = new Give_Payment( $payment_id );
1069
+function give_get_payment_donor_id($payment_id) {
1070
+	$payment = new Give_Payment($payment_id);
1071 1071
 
1072 1072
 	return $payment->customer_id;
1073 1073
 }
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
  *
1082 1082
  * @return string $ip User IP.
1083 1083
  */
1084
-function give_get_payment_user_ip( $payment_id ) {
1085
-	$payment = new Give_Payment( $payment_id );
1084
+function give_get_payment_user_ip($payment_id) {
1085
+	$payment = new Give_Payment($payment_id);
1086 1086
 
1087 1087
 	return $payment->ip;
1088 1088
 }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
  *
1097 1097
  * @return string $date The date the payment was completed.
1098 1098
  */
1099
-function give_get_payment_completed_date( $payment_id = 0 ) {
1100
-	$payment = new Give_Payment( $payment_id );
1099
+function give_get_payment_completed_date($payment_id = 0) {
1100
+	$payment = new Give_Payment($payment_id);
1101 1101
 
1102 1102
 	return $payment->completed_date;
1103 1103
 }
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
  *
1112 1112
  * @return string $gateway Gateway.
1113 1113
  */
1114
-function give_get_payment_gateway( $payment_id ) {
1115
-	$payment = new Give_Payment( $payment_id );
1114
+function give_get_payment_gateway($payment_id) {
1115
+	$payment = new Give_Payment($payment_id);
1116 1116
 
1117 1117
 	return $payment->gateway;
1118 1118
 }
@@ -1126,8 +1126,8 @@  discard block
 block discarded – undo
1126 1126
  *
1127 1127
  * @return string $currency The currency code.
1128 1128
  */
1129
-function give_get_payment_currency_code( $payment_id = 0 ) {
1130
-	$payment = new Give_Payment( $payment_id );
1129
+function give_get_payment_currency_code($payment_id = 0) {
1130
+	$payment = new Give_Payment($payment_id);
1131 1131
 
1132 1132
 	return $payment->currency;
1133 1133
 }
@@ -1141,10 +1141,10 @@  discard block
 block discarded – undo
1141 1141
  *
1142 1142
  * @return string $currency The currency name.
1143 1143
  */
1144
-function give_get_payment_currency( $payment_id = 0 ) {
1145
-	$currency = give_get_payment_currency_code( $payment_id );
1144
+function give_get_payment_currency($payment_id = 0) {
1145
+	$currency = give_get_payment_currency_code($payment_id);
1146 1146
 
1147
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1147
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1148 1148
 }
1149 1149
 
1150 1150
 /**
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
  *
1157 1157
  * @return string $key Donation key.
1158 1158
  */
1159
-function give_get_payment_key( $payment_id = 0 ) {
1160
-	$payment = new Give_Payment( $payment_id );
1159
+function give_get_payment_key($payment_id = 0) {
1160
+	$payment = new Give_Payment($payment_id);
1161 1161
 
1162 1162
 	return $payment->key;
1163 1163
 }
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
  *
1174 1174
  * @return string $number Payment order number.
1175 1175
  */
1176
-function give_get_payment_number( $payment_id = 0 ) {
1177
-	$payment = new Give_Payment( $payment_id );
1176
+function give_get_payment_number($payment_id = 0) {
1177
+	$payment = new Give_Payment($payment_id);
1178 1178
 
1179 1179
 	return $payment->number;
1180 1180
 }
@@ -1188,23 +1188,23 @@  discard block
 block discarded – undo
1188 1188
  *
1189 1189
  * @return string      The formatted payment number.
1190 1190
  */
1191
-function give_format_payment_number( $number ) {
1191
+function give_format_payment_number($number) {
1192 1192
 
1193
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1193
+	if ( ! give_get_option('enable_sequential')) {
1194 1194
 		return $number;
1195 1195
 	}
1196 1196
 
1197
-	if ( ! is_numeric( $number ) ) {
1197
+	if ( ! is_numeric($number)) {
1198 1198
 		return $number;
1199 1199
 	}
1200 1200
 
1201
-	$prefix  = give_get_option( 'sequential_prefix' );
1202
-	$number  = absint( $number );
1203
-	$postfix = give_get_option( 'sequential_postfix' );
1201
+	$prefix  = give_get_option('sequential_prefix');
1202
+	$number  = absint($number);
1203
+	$postfix = give_get_option('sequential_postfix');
1204 1204
 
1205
-	$formatted_number = $prefix . $number . $postfix;
1205
+	$formatted_number = $prefix.$number.$postfix;
1206 1206
 
1207
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1207
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1208 1208
 }
1209 1209
 
1210 1210
 /**
@@ -1217,17 +1217,17 @@  discard block
 block discarded – undo
1217 1217
  */
1218 1218
 function give_get_next_payment_number() {
1219 1219
 
1220
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1220
+	if ( ! give_get_option('enable_sequential')) {
1221 1221
 		return false;
1222 1222
 	}
1223 1223
 
1224
-	$number           = get_option( 'give_last_payment_number' );
1225
-	$start            = give_get_option( 'sequential_start', 1 );
1224
+	$number           = get_option('give_last_payment_number');
1225
+	$start            = give_get_option('sequential_start', 1);
1226 1226
 	$increment_number = true;
1227 1227
 
1228
-	if ( false !== $number ) {
1228
+	if (false !== $number) {
1229 1229
 
1230
-		if ( empty( $number ) ) {
1230
+		if (empty($number)) {
1231 1231
 
1232 1232
 			$number           = $start;
1233 1233
 			$increment_number = false;
@@ -1236,24 +1236,24 @@  discard block
 block discarded – undo
1236 1236
 	} else {
1237 1237
 
1238 1238
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1239
-		$payments     = new Give_Payments_Query( array(
1239
+		$payments = new Give_Payments_Query(array(
1240 1240
 			'number'  => 1,
1241 1241
 			'order'   => 'DESC',
1242 1242
 			'orderby' => 'ID',
1243 1243
 			'output'  => 'posts',
1244 1244
 			'fields'  => 'ids',
1245
-		) );
1245
+		));
1246 1246
 		$last_payment = $payments->get_payments();
1247 1247
 
1248
-		if ( ! empty( $last_payment ) ) {
1248
+		if ( ! empty($last_payment)) {
1249 1249
 
1250
-			$number = give_get_payment_number( $last_payment[0] );
1250
+			$number = give_get_payment_number($last_payment[0]);
1251 1251
 
1252 1252
 		}
1253 1253
 
1254
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1254
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1255 1255
 
1256
-			$number = give_remove_payment_prefix_postfix( $number );
1256
+			$number = give_remove_payment_prefix_postfix($number);
1257 1257
 
1258 1258
 		} else {
1259 1259
 
@@ -1262,13 +1262,13 @@  discard block
 block discarded – undo
1262 1262
 		}
1263 1263
 	}// End if().
1264 1264
 
1265
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1265
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1266 1266
 
1267
-	if ( $increment_number ) {
1268
-		$number ++;
1267
+	if ($increment_number) {
1268
+		$number++;
1269 1269
 	}
1270 1270
 
1271
-	return apply_filters( 'give_get_next_payment_number', $number );
1271
+	return apply_filters('give_get_next_payment_number', $number);
1272 1272
 }
1273 1273
 
1274 1274
 /**
@@ -1280,25 +1280,25 @@  discard block
 block discarded – undo
1280 1280
  *
1281 1281
  * @return string The new Payment number without prefix and postfix.
1282 1282
  */
1283
-function give_remove_payment_prefix_postfix( $number ) {
1283
+function give_remove_payment_prefix_postfix($number) {
1284 1284
 
1285
-	$prefix  = give_get_option( 'sequential_prefix' );
1286
-	$postfix = give_get_option( 'sequential_postfix' );
1285
+	$prefix  = give_get_option('sequential_prefix');
1286
+	$postfix = give_get_option('sequential_postfix');
1287 1287
 
1288 1288
 	// Remove prefix.
1289
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1289
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1290 1290
 
1291 1291
 	// Remove the postfix.
1292
-	$length      = strlen( $number );
1293
-	$postfix_pos = strrpos( $number, $postfix );
1294
-	if ( false !== $postfix_pos ) {
1295
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1292
+	$length      = strlen($number);
1293
+	$postfix_pos = strrpos($number, $postfix);
1294
+	if (false !== $postfix_pos) {
1295
+		$number = substr_replace($number, '', $postfix_pos, $length);
1296 1296
 	}
1297 1297
 
1298 1298
 	// Ensure it's a whole number.
1299
-	$number = intval( $number );
1299
+	$number = intval($number);
1300 1300
 
1301
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1301
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1302 1302
 
1303 1303
 }
1304 1304
 
@@ -1315,10 +1315,10 @@  discard block
 block discarded – undo
1315 1315
  *
1316 1316
  * @return string $amount Fully formatted payment amount.
1317 1317
  */
1318
-function give_payment_amount( $payment_id = 0 ) {
1319
-	$amount = give_get_payment_amount( $payment_id );
1318
+function give_payment_amount($payment_id = 0) {
1319
+	$amount = give_get_payment_amount($payment_id);
1320 1320
 
1321
-	return give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment_id ) );
1321
+	return give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment_id));
1322 1322
 }
1323 1323
 
1324 1324
 /**
@@ -1331,11 +1331,11 @@  discard block
 block discarded – undo
1331 1331
  *
1332 1332
  * @return mixed
1333 1333
  */
1334
-function give_get_payment_amount( $payment_id ) {
1334
+function give_get_payment_amount($payment_id) {
1335 1335
 
1336
-	$payment = new Give_Payment( $payment_id );
1336
+	$payment = new Give_Payment($payment_id);
1337 1337
 
1338
-	return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id );
1338
+	return apply_filters('give_payment_amount', floatval($payment->total), $payment_id);
1339 1339
 }
1340 1340
 
1341 1341
 /**
@@ -1352,10 +1352,10 @@  discard block
 block discarded – undo
1352 1352
  *
1353 1353
  * @return array Fully formatted payment subtotal.
1354 1354
  */
1355
-function give_payment_subtotal( $payment_id = 0 ) {
1356
-	$subtotal = give_get_payment_subtotal( $payment_id );
1355
+function give_payment_subtotal($payment_id = 0) {
1356
+	$subtotal = give_get_payment_subtotal($payment_id);
1357 1357
 
1358
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment_id ) );
1358
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), give_get_payment_currency_code($payment_id));
1359 1359
 }
1360 1360
 
1361 1361
 /**
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
  *
1370 1370
  * @return float $subtotal Subtotal for payment (non formatted).
1371 1371
  */
1372
-function give_get_payment_subtotal( $payment_id = 0 ) {
1373
-	$payment = new Give_Payment( $payment_id );
1372
+function give_get_payment_subtotal($payment_id = 0) {
1373
+	$payment = new Give_Payment($payment_id);
1374 1374
 
1375 1375
 	return $payment->subtotal;
1376 1376
 }
@@ -1384,8 +1384,8 @@  discard block
 block discarded – undo
1384 1384
  *
1385 1385
  * @return string The donation ID.
1386 1386
  */
1387
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1388
-	$payment = new Give_Payment( $payment_id );
1387
+function give_get_payment_transaction_id($payment_id = 0) {
1388
+	$payment = new Give_Payment($payment_id);
1389 1389
 
1390 1390
 	return $payment->transaction_id;
1391 1391
 }
@@ -1400,15 +1400,15 @@  discard block
 block discarded – undo
1400 1400
  *
1401 1401
  * @return bool|mixed
1402 1402
  */
1403
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1403
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1404 1404
 
1405
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1405
+	if (empty($payment_id) || empty($transaction_id)) {
1406 1406
 		return false;
1407 1407
 	}
1408 1408
 
1409
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1409
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1410 1410
 
1411
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1411
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1412 1412
 }
1413 1413
 
1414 1414
 /**
@@ -1421,12 +1421,12 @@  discard block
 block discarded – undo
1421 1421
  *
1422 1422
  * @return int $purchase Donation ID.
1423 1423
  */
1424
-function give_get_purchase_id_by_key( $key ) {
1424
+function give_get_purchase_id_by_key($key) {
1425 1425
 	global $wpdb;
1426 1426
 
1427
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) );
1427
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key));
1428 1428
 
1429
-	if ( $purchase != null ) {
1429
+	if ($purchase != null) {
1430 1430
 		return $purchase;
1431 1431
 	}
1432 1432
 
@@ -1444,12 +1444,12 @@  discard block
 block discarded – undo
1444 1444
  *
1445 1445
  * @return int $purchase Donation ID.
1446 1446
  */
1447
-function give_get_purchase_id_by_transaction_id( $key ) {
1447
+function give_get_purchase_id_by_transaction_id($key) {
1448 1448
 	global $wpdb;
1449 1449
 
1450
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1450
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1451 1451
 
1452
-	if ( $purchase != null ) {
1452
+	if ($purchase != null) {
1453 1453
 		return $purchase;
1454 1454
 	}
1455 1455
 
@@ -1466,23 +1466,23 @@  discard block
 block discarded – undo
1466 1466
  *
1467 1467
  * @return array $notes Donation Notes
1468 1468
  */
1469
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1469
+function give_get_payment_notes($payment_id = 0, $search = '') {
1470 1470
 
1471
-	if ( empty( $payment_id ) && empty( $search ) ) {
1471
+	if (empty($payment_id) && empty($search)) {
1472 1472
 		return false;
1473 1473
 	}
1474 1474
 
1475
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1476
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1475
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1476
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1477 1477
 
1478
-	$notes = get_comments( array(
1478
+	$notes = get_comments(array(
1479 1479
 		'post_id' => $payment_id,
1480 1480
 		'order'   => 'ASC',
1481 1481
 		'search'  => $search,
1482
-	) );
1482
+	));
1483 1483
 
1484
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1485
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1484
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1485
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1486 1486
 
1487 1487
 	return $notes;
1488 1488
 }
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
  *
1499 1499
  * @return int The new note ID
1500 1500
  */
1501
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1502
-	if ( empty( $payment_id ) ) {
1501
+function give_insert_payment_note($payment_id = 0, $note = '') {
1502
+	if (empty($payment_id)) {
1503 1503
 		return false;
1504 1504
 	}
1505 1505
 
@@ -1511,14 +1511,14 @@  discard block
 block discarded – undo
1511 1511
 	 * @param int $payment_id Payment ID.
1512 1512
 	 * @param string $note The note.
1513 1513
 	 */
1514
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1514
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1515 1515
 
1516
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1516
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1517 1517
 		'comment_post_ID'      => $payment_id,
1518 1518
 		'comment_content'      => $note,
1519 1519
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1520
-		'comment_date'         => current_time( 'mysql' ),
1521
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1520
+		'comment_date'         => current_time('mysql'),
1521
+		'comment_date_gmt'     => current_time('mysql', 1),
1522 1522
 		'comment_approved'     => 1,
1523 1523
 		'comment_parent'       => 0,
1524 1524
 		'comment_author'       => '',
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 		'comment_author_email' => '',
1528 1528
 		'comment_type'         => 'give_payment_note',
1529 1529
 
1530
-	) ) );
1530
+	)));
1531 1531
 
1532 1532
 	/**
1533 1533
 	 * Fires after payment note inserted.
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 	 * @param int $payment_id Payment ID.
1539 1539
 	 * @param string $note The note.
1540 1540
 	 */
1541
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1541
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1542 1542
 
1543 1543
 	return $note_id;
1544 1544
 }
@@ -1553,8 +1553,8 @@  discard block
 block discarded – undo
1553 1553
  *
1554 1554
  * @return bool True on success, false otherwise.
1555 1555
  */
1556
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1557
-	if ( empty( $comment_id ) ) {
1556
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1557
+	if (empty($comment_id)) {
1558 1558
 		return false;
1559 1559
 	}
1560 1560
 
@@ -1566,9 +1566,9 @@  discard block
 block discarded – undo
1566 1566
 	 * @param int $comment_id Note ID.
1567 1567
 	 * @param int $payment_id Payment ID.
1568 1568
 	 */
1569
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1569
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1570 1570
 
1571
-	$ret = wp_delete_comment( $comment_id, true );
1571
+	$ret = wp_delete_comment($comment_id, true);
1572 1572
 
1573 1573
 	/**
1574 1574
 	 * Fires after donation note deleted.
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 	 * @param int $comment_id Note ID.
1579 1579
 	 * @param int $payment_id Payment ID.
1580 1580
 	 */
1581
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1581
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1582 1582
 
1583 1583
 	return $ret;
1584 1584
 }
@@ -1593,32 +1593,32 @@  discard block
 block discarded – undo
1593 1593
  *
1594 1594
  * @return string
1595 1595
  */
1596
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1596
+function give_get_payment_note_html($note, $payment_id = 0) {
1597 1597
 
1598
-	if ( is_numeric( $note ) ) {
1599
-		$note = get_comment( $note );
1598
+	if (is_numeric($note)) {
1599
+		$note = get_comment($note);
1600 1600
 	}
1601 1601
 
1602
-	if ( ! empty( $note->user_id ) ) {
1603
-		$user = get_userdata( $note->user_id );
1602
+	if ( ! empty($note->user_id)) {
1603
+		$user = get_userdata($note->user_id);
1604 1604
 		$user = $user->display_name;
1605 1605
 	} else {
1606
-		$user = esc_html__( 'System', 'give' );
1606
+		$user = esc_html__('System', 'give');
1607 1607
 	}
1608 1608
 
1609
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1609
+	$date_format = give_date_format().', '.get_option('time_format');
1610 1610
 
1611
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1611
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1612 1612
 		'give-action' => 'delete_payment_note',
1613 1613
 		'note_id'     => $note->comment_ID,
1614 1614
 		'payment_id'  => $payment_id,
1615
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1615
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1616 1616
 
1617
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1617
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1618 1618
 	$note_html .= '<p>';
1619
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1619
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1620 1620
 	$note_html .= $note->comment_content;
1621
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . esc_attr__( 'Delete this donation note.', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
1621
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.esc_attr__('Delete this donation note.', 'give').'">'.esc_html__('Delete', 'give').'</a>';
1622 1622
 	$note_html .= '</p>';
1623 1623
 	$note_html .= '</div>';
1624 1624
 
@@ -1636,18 +1636,18 @@  discard block
 block discarded – undo
1636 1636
  *
1637 1637
  * @return void
1638 1638
  */
1639
-function give_hide_payment_notes( $query ) {
1640
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1641
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1642
-		if ( ! is_array( $types ) ) {
1643
-			$types = array( $types );
1639
+function give_hide_payment_notes($query) {
1640
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1641
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1642
+		if ( ! is_array($types)) {
1643
+			$types = array($types);
1644 1644
 		}
1645 1645
 		$types[]                           = 'give_payment_note';
1646 1646
 		$query->query_vars['type__not_in'] = $types;
1647 1647
 	}
1648 1648
 }
1649 1649
 
1650
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1650
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1651 1651
 
1652 1652
 /**
1653 1653
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1659,15 +1659,15 @@  discard block
 block discarded – undo
1659 1659
  *
1660 1660
  * @return array $clauses Updated comment clauses.
1661 1661
  */
1662
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1663
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1662
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1663
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1664 1664
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1665 1665
 	}
1666 1666
 
1667 1667
 	return $clauses;
1668 1668
 }
1669 1669
 
1670
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1670
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1671 1671
 
1672 1672
 
1673 1673
 /**
@@ -1680,15 +1680,15 @@  discard block
 block discarded – undo
1680 1680
  *
1681 1681
  * @return string $where
1682 1682
  */
1683
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1683
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1684 1684
 	global $wpdb;
1685 1685
 
1686
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1686
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1687 1687
 
1688 1688
 	return $where;
1689 1689
 }
1690 1690
 
1691
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1691
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1692 1692
 
1693 1693
 
1694 1694
 /**
@@ -1702,32 +1702,32 @@  discard block
 block discarded – undo
1702 1702
  *
1703 1703
  * @return array Array of comment counts.
1704 1704
  */
1705
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1705
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1706 1706
 	global $wpdb, $pagenow;
1707 1707
 
1708
-	if ( 'index.php' != $pagenow ) {
1708
+	if ('index.php' != $pagenow) {
1709 1709
 		return $stats;
1710 1710
 	}
1711 1711
 
1712 1712
 	$post_id = (int) $post_id;
1713 1713
 
1714
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1714
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1715 1715
 		return $stats;
1716 1716
 	}
1717 1717
 
1718
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1718
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1719 1719
 
1720
-	if ( false !== $stats ) {
1720
+	if (false !== $stats) {
1721 1721
 		return $stats;
1722 1722
 	}
1723 1723
 
1724 1724
 	$where = 'WHERE comment_type != "give_payment_note"';
1725 1725
 
1726
-	if ( $post_id > 0 ) {
1727
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1726
+	if ($post_id > 0) {
1727
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1728 1728
 	}
1729 1729
 
1730
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1730
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1731 1731
 
1732 1732
 	$total    = 0;
1733 1733
 	$approved = array(
@@ -1737,30 +1737,30 @@  discard block
 block discarded – undo
1737 1737
 		'trash'        => 'trash',
1738 1738
 		'post-trashed' => 'post-trashed',
1739 1739
 	);
1740
-	foreach ( (array) $count as $row ) {
1740
+	foreach ((array) $count as $row) {
1741 1741
 		// Don't count post-trashed toward totals.
1742
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1742
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1743 1743
 			$total += $row['num_comments'];
1744 1744
 		}
1745
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1746
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1745
+		if (isset($approved[$row['comment_approved']])) {
1746
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1747 1747
 		}
1748 1748
 	}
1749 1749
 
1750 1750
 	$stats['total_comments'] = $total;
1751
-	foreach ( $approved as $key ) {
1752
-		if ( empty( $stats[ $key ] ) ) {
1753
-			$stats[ $key ] = 0;
1751
+	foreach ($approved as $key) {
1752
+		if (empty($stats[$key])) {
1753
+			$stats[$key] = 0;
1754 1754
 		}
1755 1755
 	}
1756 1756
 
1757 1757
 	$stats = (object) $stats;
1758
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1758
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1759 1759
 
1760 1760
 	return $stats;
1761 1761
 }
1762 1762
 
1763
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1763
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1764 1764
 
1765 1765
 
1766 1766
 /**
@@ -1773,9 +1773,9 @@  discard block
 block discarded – undo
1773 1773
  *
1774 1774
  * @return string $where Modified where clause.
1775 1775
  */
1776
-function give_filter_where_older_than_week( $where = '' ) {
1776
+function give_filter_where_older_than_week($where = '') {
1777 1777
 	// Payments older than one week.
1778
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1778
+	$start = date('Y-m-d', strtotime('-7 days'));
1779 1779
 	$where .= " AND post_date <= '{$start}'";
1780 1780
 
1781 1781
 	return $where;
@@ -1795,38 +1795,38 @@  discard block
 block discarded – undo
1795 1795
  *
1796 1796
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1797 1797
  */
1798
-function give_get_payment_form_title( $payment_meta, $only_level = false, $separator = '' ) {
1798
+function give_get_payment_form_title($payment_meta, $only_level = false, $separator = '') {
1799 1799
 
1800
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1801
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1802
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1800
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1801
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1802
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1803 1803
 
1804
-	if ( $only_level == true ) {
1804
+	if ($only_level == true) {
1805 1805
 		$form_title = '';
1806 1806
 	}
1807 1807
 
1808 1808
 	// If multi-level, append to the form title.
1809
-	if ( give_has_variable_prices( $form_id ) ) {
1809
+	if (give_has_variable_prices($form_id)) {
1810 1810
 
1811 1811
 		// Only add separator if there is a form title.
1812
-		if ( ! empty( $form_title ) ) {
1813
-			$form_title .= ' ' . $separator . ' ';
1812
+		if ( ! empty($form_title)) {
1813
+			$form_title .= ' '.$separator.' ';
1814 1814
 		}
1815 1815
 
1816 1816
 		$form_title .= '<span class="donation-level-text-wrap">';
1817 1817
 
1818
-		if ( $price_id == 'custom' ) {
1819
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1820
-			$form_title         .= ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1818
+		if ($price_id == 'custom') {
1819
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1820
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1821 1821
 		} else {
1822
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1822
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1823 1823
 		}
1824 1824
 
1825 1825
 		$form_title .= '</span>';
1826 1826
 
1827 1827
 	}
1828 1828
 
1829
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1829
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1830 1830
 
1831 1831
 }
1832 1832
 
@@ -1840,19 +1840,19 @@  discard block
 block discarded – undo
1840 1840
  *
1841 1841
  * @return string $price_id
1842 1842
  */
1843
-function give_get_price_id( $form_id, $price ) {
1843
+function give_get_price_id($form_id, $price) {
1844 1844
 	$price_id = null;
1845 1845
 
1846
-	if ( give_has_variable_prices( $form_id ) ) {
1846
+	if (give_has_variable_prices($form_id)) {
1847 1847
 
1848
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1848
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1849 1849
 
1850
-		foreach ( $levels as $level ) {
1850
+		foreach ($levels as $level) {
1851 1851
 
1852
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1852
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1853 1853
 
1854 1854
 			// Check that this indeed the recurring price.
1855
-			if ( $level_amount == $price ) {
1855
+			if ($level_amount == $price) {
1856 1856
 
1857 1857
 				$price_id = $level['_give_id']['level_id'];
1858 1858
 				break;
@@ -1860,13 +1860,13 @@  discard block
 block discarded – undo
1860 1860
 			}
1861 1861
 		}
1862 1862
 
1863
-		if( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1863
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1864 1864
 			$price_id = 'custom';
1865 1865
 		}
1866 1866
 	}
1867 1867
 
1868 1868
 	// Price ID must be numeric or string.
1869
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1869
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1870 1870
 
1871 1871
 	return $price_id;
1872 1872
 }
@@ -1884,10 +1884,10 @@  discard block
 block discarded – undo
1884 1884
  *
1885 1885
  * @return string
1886 1886
  */
1887
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1888
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1887
+function give_get_form_dropdown($args = array(), $echo = false) {
1888
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1889 1889
 
1890
-	if ( ! $echo ) {
1890
+	if ( ! $echo) {
1891 1891
 		return $form_dropdown_html;
1892 1892
 	}
1893 1893
 
@@ -1904,17 +1904,17 @@  discard block
 block discarded – undo
1904 1904
  *
1905 1905
  * @return string|bool
1906 1906
  */
1907
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1907
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1908 1908
 
1909 1909
 	// Check for give form id.
1910
-	if ( empty( $args['id'] ) ) {
1910
+	if (empty($args['id'])) {
1911 1911
 		return false;
1912 1912
 	}
1913 1913
 
1914
-	$form = new Give_Donate_Form( $args['id'] );
1914
+	$form = new Give_Donate_Form($args['id']);
1915 1915
 
1916 1916
 	// Check if form has variable prices or not.
1917
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1917
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1918 1918
 		return false;
1919 1919
 	}
1920 1920
 
@@ -1922,24 +1922,24 @@  discard block
 block discarded – undo
1922 1922
 	$variable_price_options = array();
1923 1923
 
1924 1924
 	// Check if multi donation form support custom donation or not.
1925
-	if ( $form->is_custom_price_mode() ) {
1926
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1925
+	if ($form->is_custom_price_mode()) {
1926
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1927 1927
 	}
1928 1928
 
1929 1929
 	// Get variable price and ID from variable price array.
1930
-	foreach ( $variable_prices as $variable_price ) {
1931
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1930
+	foreach ($variable_prices as $variable_price) {
1931
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1932 1932
 	}
1933 1933
 
1934 1934
 	// Update options.
1935
-	$args = array_merge( $args, array(
1935
+	$args = array_merge($args, array(
1936 1936
 		'options' => $variable_price_options,
1937
-	) );
1937
+	));
1938 1938
 
1939 1939
 	// Generate select html.
1940
-	$form_dropdown_html = Give()->html->select( $args );
1940
+	$form_dropdown_html = Give()->html->select($args);
1941 1941
 
1942
-	if ( ! $echo ) {
1942
+	if ( ! $echo) {
1943 1943
 		return $form_dropdown_html;
1944 1944
 	}
1945 1945
 
@@ -1958,16 +1958,16 @@  discard block
 block discarded – undo
1958 1958
  *
1959 1959
  * @return string
1960 1960
  */
1961
-function give_get_payment_meta_price_id( $payment_meta ) {
1961
+function give_get_payment_meta_price_id($payment_meta) {
1962 1962
 
1963
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1963
+	if (isset($payment_meta['give_price_id'])) {
1964 1964
 		$price_id = $payment_meta['give_price_id'];
1965
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1965
+	} elseif (isset($payment_meta['price_id'])) {
1966 1966
 		$price_id = $payment_meta['price_id'];
1967 1967
 	} else {
1968
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1968
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1969 1969
 	}
1970 1970
 
1971
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id );
1971
+	return apply_filters('give_get_payment_meta_price_id', $price_id);
1972 1972
 
1973 1973
 }
Please login to merge, or discard this patch.