Completed
Pull Request — master (#1248)
by Devin
17:40
created
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Profile Editor', 'give');
25 25
 
26
-		parent::__construct( 'give_profile_editor' );
26
+		parent::__construct('give_profile_editor');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28 28
 		<h1><?php echo get_admin_page_title(); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
33
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
34 34
 		<?php echo give_add_ons_get_feed(); ?>
35 35
 	</div>
36 36
 	<?php
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 function give_add_ons_get_feed() {
49 49
 
50 50
 	$addons_debug = false; //set to true to debug
51
-	$cache        = get_transient( 'give_add_ons_feed' );
51
+	$cache        = get_transient('give_add_ons_feed');
52 52
 
53
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
54
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
53
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
54
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
55 55
 
56
-		if ( ! is_wp_error( $feed ) ) {
57
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
58
-				$cache = wp_remote_retrieve_body( $feed );
59
-				set_transient( 'give_add_ons_feed', $cache, 3600 );
56
+		if ( ! is_wp_error($feed)) {
57
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
58
+				$cache = wp_remote_retrieve_body($feed);
59
+				set_transient('give_add_ons_feed', $cache, 3600);
60 60
 			}
61 61
 		} else {
62
-			$cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>';
62
+			$cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>';
63 63
 		}
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
includes/admin/plugins.php 1 patch
Spacing   +16 added lines, -16 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,19 +23,19 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array An array of updated action links.
25 25
  */
26
-function give_plugin_action_links( $actions ) {
26
+function give_plugin_action_links($actions) {
27 27
 	$new_actions = array(
28 28
 		'settings' => sprintf(
29 29
 			'<a href="%1$s">%2$s</a>',
30
-			admin_url( 'edit.php?post_type=give_forms&page=give-settings' ),
31
-			esc_html__( 'Settings', 'give' )
30
+			admin_url('edit.php?post_type=give_forms&page=give-settings'),
31
+			esc_html__('Settings', 'give')
32 32
 		),
33 33
 	);
34 34
 
35
-	return array_merge( $new_actions, $actions );
35
+	return array_merge($new_actions, $actions);
36 36
 }
37 37
 
38
-add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' );
38
+add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links');
39 39
 
40 40
 
41 41
 /**
@@ -48,35 +48,35 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @return array
50 50
  */
51
-function give_plugin_row_meta( $plugin_meta, $plugin_file ) {
52
-	if ( $plugin_file != GIVE_PLUGIN_BASENAME ) {
51
+function give_plugin_row_meta($plugin_meta, $plugin_file) {
52
+	if ($plugin_file != GIVE_PLUGIN_BASENAME) {
53 53
 		return $plugin_meta;
54 54
 	}
55 55
 
56 56
 	$new_meta_links = array(
57 57
 		sprintf(
58 58
 			'<a href="%1$s" target="_blank">%2$s</a>',
59
-			esc_url( add_query_arg( array(
59
+			esc_url(add_query_arg(array(
60 60
 					'utm_source'   => 'plugins-page',
61 61
 					'utm_medium'   => 'plugin-row',
62 62
 					'utm_campaign' => 'admin',
63
-				), 'https://givewp.com/documentation/' )
63
+				), 'https://givewp.com/documentation/')
64 64
 			),
65
-			esc_html__( 'Documentation', 'give' )
65
+			esc_html__('Documentation', 'give')
66 66
 		),
67 67
 		sprintf(
68 68
 			'<a href="%1$s" target="_blank">%2$s</a>',
69
-			esc_url( add_query_arg( array(
69
+			esc_url(add_query_arg(array(
70 70
 					'utm_source'   => 'plugins-page',
71 71
 					'utm_medium'   => 'plugin-row',
72 72
 					'utm_campaign' => 'admin',
73
-				), 'https://givewp.com/addons/' )
73
+				), 'https://givewp.com/addons/')
74 74
 			),
75
-			esc_html__( 'Add-ons', 'give' )
75
+			esc_html__('Add-ons', 'give')
76 76
 		),
77 77
 	);
78 78
 
79
-	return array_merge( $plugin_meta, $new_meta_links );
79
+	return array_merge($plugin_meta, $new_meta_links);
80 80
 }
81 81
 
82
-add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 );
82
+add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2);
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +51 added lines, -51 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,15 +23,15 @@  discard block
 block discarded – undo
23 23
  * @global $wpdb
24 24
  * @return void
25 25
  */
26
-function give_install( $network_wide = false ) {
26
+function give_install($network_wide = false) {
27 27
 
28 28
 	global $wpdb;
29 29
 
30
-	if ( is_multisite() && $network_wide ) {
30
+	if (is_multisite() && $network_wide) {
31 31
 
32
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
32
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
33 33
 
34
-			switch_to_blog( $blog_id );
34
+			switch_to_blog($blog_id);
35 35
 			give_run_install();
36 36
 			restore_current_blog();
37 37
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 }
47 47
 
48
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
48
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
49 49
 
50 50
 /**
51 51
  * Run the Give Install process.
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
 	give_setup_post_types();
62 62
 
63 63
 	// Clear the permalinks.
64
-	flush_rewrite_rules( false );
64
+	flush_rewrite_rules(false);
65 65
 
66 66
 	// Add Upgraded From Option.
67
-	$current_version = get_option( 'give_version' );
68
-	if ( $current_version ) {
69
-		update_option( 'give_version_upgraded_from', $current_version );
67
+	$current_version = get_option('give_version');
68
+	if ($current_version) {
69
+		update_option('give_version_upgraded_from', $current_version);
70 70
 	}
71 71
 
72 72
 	// Setup some default options.
73 73
 	$options = array();
74 74
 
75 75
 	// Checks if the Success Page option exists AND that the page exists.
76
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
76
+	if ( ! get_post(give_get_option('success_page'))) {
77 77
 
78 78
 		// Donation Confirmation (Success) Page
79 79
 		$success = wp_insert_post(
80 80
 			array(
81
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
81
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
82 82
 				'post_content'   => '[give_receipt]',
83 83
 				'post_status'    => 'publish',
84 84
 				'post_author'    => 1,
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	// Checks if the Failure Page option exists AND that the page exists.
95
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
95
+	if ( ! get_post(give_get_option('failure_page'))) {
96 96
 
97 97
 		// Failed Donation Page
98 98
 		$failed = wp_insert_post(
99 99
 			array(
100
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
101
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
100
+				'post_title'     => esc_html__('Donation Failed', 'give'),
101
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
102 102
 				'post_status'    => 'publish',
103 103
 				'post_author'    => 1,
104 104
 				'post_type'      => 'page',
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	// Checks if the History Page option exists AND that the page exists.
113
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
113
+	if ( ! get_post(give_get_option('history_page'))) {
114 114
 		// Donation History Page
115 115
 		$history = wp_insert_post(
116 116
 			array(
117
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
117
+				'post_title'     => esc_html__('Donation History', 'give'),
118 118
 				'post_content'   => '[donation_history]',
119 119
 				'post_status'    => 'publish',
120 120
 				'post_author'    => 1,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
130
-	if ( empty( $current_version ) ) {
130
+	if (empty($current_version)) {
131 131
 		$options['base_country']       = 'US';
132 132
 		$options['test_mode']          = 1;
133 133
 		$options['currency']           = 'USD';
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	// Populate the default values.
154
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
155
-	update_option( 'give_version', GIVE_VERSION );
154
+	update_option('give_settings', array_merge($give_options, $options));
155
+	update_option('give_version', GIVE_VERSION);
156 156
 
157 157
 	// Create Give roles.
158 158
 	$roles = new Give_Roles();
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	$roles->add_caps();
161 161
 
162 162
 	$api = new Give_API();
163
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
163
+	update_option('give_default_api_version', 'v'.$api->get_version());
164 164
 
165 165
 	// Create the customers databases.
166 166
 	@Give()->customers->create_table();
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	Give()->session->use_php_sessions();
171 171
 
172 172
 	// Add a temporary option to note that Give pages have been created.
173
-	set_transient( '_give_installed', $options, 30 );
173
+	set_transient('_give_installed', $options, 30);
174 174
 
175
-	if ( ! $current_version ) {
175
+	if ( ! $current_version) {
176 176
 
177
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
177
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
178 178
 
179 179
 		// When new upgrade routines are added, mark them as complete on fresh install.
180 180
 		$upgrade_routines = array(
@@ -183,22 +183,22 @@  discard block
 block discarded – undo
183 183
 			'upgrade_give_offline_status'
184 184
 		);
185 185
 
186
-		foreach ( $upgrade_routines as $upgrade ) {
187
-			give_set_upgrade_complete( $upgrade );
186
+		foreach ($upgrade_routines as $upgrade) {
187
+			give_set_upgrade_complete($upgrade);
188 188
 		}
189 189
 	}
190 190
 
191 191
 	// Bail if activating from network, or bulk.
192
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
192
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
193 193
 		return;
194 194
 	}
195 195
 
196 196
 	// Add the transient to redirect.
197
-	set_transient( '_give_activation_redirect', true, 30 );
197
+	set_transient('_give_activation_redirect', true, 30);
198 198
 
199 199
 }
200 200
 
201
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
201
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
202 202
 
203 203
 /**
204 204
  * Network Activated New Site Setup.
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
  * @param  int    $site_id The Site ID.
215 215
  * @param  array  $meta Blog Meta.
216 216
  */
217
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
217
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
218 218
 
219
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
219
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
220 220
 
221
-		switch_to_blog( $blog_id );
221
+		switch_to_blog($blog_id);
222 222
 		give_install();
223 223
 		restore_current_blog();
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 }
228 228
 
229
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
229
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
230 230
 
231 231
 
232 232
 /**
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
  *
240 240
  * @return array          The tables to drop.
241 241
  */
242
-function give_wpmu_drop_tables( $tables, $blog_id ) {
242
+function give_wpmu_drop_tables($tables, $blog_id) {
243 243
 
244
-	switch_to_blog( $blog_id );
244
+	switch_to_blog($blog_id);
245 245
 	$customers_db     = new Give_DB_Customers();
246 246
 	$customer_meta_db = new Give_DB_Customer_Meta();
247 247
 
248
-	if ( $customers_db->installed() ) {
248
+	if ($customers_db->installed()) {
249 249
 		$tables[] = $customers_db->table_name;
250 250
 		$tables[] = $customer_meta_db->table_name;
251 251
 	}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
 }
257 257
 
258
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
258
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
259 259
 
260 260
 /**
261 261
  * Post-installation
@@ -267,16 +267,16 @@  discard block
 block discarded – undo
267 267
  */
268 268
 function give_after_install() {
269 269
 
270
-	if ( ! is_admin() ) {
270
+	if ( ! is_admin()) {
271 271
 		return;
272 272
 	}
273 273
 
274
-	$give_options     = get_transient( '_give_installed' );
275
-	$give_table_check = get_option( '_give_table_check', false );
274
+	$give_options     = get_transient('_give_installed');
275
+	$give_table_check = get_option('_give_table_check', false);
276 276
 
277
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
277
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
278 278
 
279
-		if ( ! @Give()->customer_meta->installed() ) {
279
+		if ( ! @Give()->customer_meta->installed()) {
280 280
 
281 281
 			// Create the customer meta database
282 282
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
 		}
286 286
 
287
-		if ( ! @Give()->customers->installed() ) {
287
+		if ( ! @Give()->customers->installed()) {
288 288
 			// Create the customers database
289 289
 			// (this ensures it creates it on multisite instances where it is network activated).
290 290
 			@Give()->customers->create_table();
@@ -296,22 +296,22 @@  discard block
 block discarded – undo
296 296
 			 *
297 297
 			 * @param array $give_options Give plugin options.
298 298
 			 */
299
-			do_action( 'give_after_install', $give_options );
299
+			do_action('give_after_install', $give_options);
300 300
 		}
301 301
 
302
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
302
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
303 303
 
304 304
 	}
305 305
 
306 306
 	// Delete the transient
307
-	if ( false !== $give_options ) {
308
-		delete_transient( '_give_installed' );
307
+	if (false !== $give_options) {
308
+		delete_transient('_give_installed');
309 309
 	}
310 310
 
311 311
 
312 312
 }
313 313
 
314
-add_action( 'admin_init', 'give_after_install' );
314
+add_action('admin_init', 'give_after_install');
315 315
 
316 316
 
317 317
 /**
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 
327 327
 	global $wp_roles;
328 328
 
329
-	if ( ! is_object( $wp_roles ) ) {
329
+	if ( ! is_object($wp_roles)) {
330 330
 		return;
331 331
 	}
332 332
 
333
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
333
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
334 334
 
335 335
 		// Create Give plugin roles
336 336
 		$roles = new Give_Roles();
@@ -341,4 +341,4 @@  discard block
 block discarded – undo
341 341
 
342 342
 }
343 343
 
344
-add_action( 'admin_init', 'give_install_roles_on_network' );
345 344
\ No newline at end of file
345
+add_action('admin_init', 'give_install_roles_on_network');
346 346
\ No newline at end of file
Please login to merge, or discard this patch.
includes/deprecated/deprecated-functions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return bool $ret True if guest checkout is enabled, false otherwise
30 30
  */
31
-function give_no_guest_checkout( $form_id ) {
31
+function give_no_guest_checkout($form_id) {
32 32
 
33 33
 	$backtrace = debug_backtrace();
34 34
 
35
-	_give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace );
35
+	_give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace);
36 36
 
37
-	$ret = get_post_meta( $form_id, '_give_logged_in_only', true );
37
+	$ret = get_post_meta($form_id, '_give_logged_in_only', true);
38 38
 
39
-	return (bool) apply_filters( 'give_no_guest_checkout', $ret );
39
+	return (bool) apply_filters('give_no_guest_checkout', $ret);
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function transactions_dropdown( $args = array() ) {
38
+	public function transactions_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'transactions',
@@ -45,34 +45,34 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => esc_html__( 'Select a transaction', 'give' )
48
+			'placeholder' => esc_html__('Select a transaction', 'give')
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53 53
 
54
-		$payments = new Give_Payments_Query( array(
54
+		$payments = new Give_Payments_Query(array(
55 55
 			'number' => $args['number']
56
-		) );
56
+		));
57 57
 
58 58
 		$payments = $payments->get_payments();
59 59
 
60 60
 		$options = array();
61 61
 
62 62
 		//Provide nice human readable options.
63
-		if ( $payments ) {
64
-			$options[0] = esc_html__( 'Select a donation', 'give' );
65
-			foreach ( $payments as $payment ) {
63
+		if ($payments) {
64
+			$options[0] = esc_html__('Select a donation', 'give');
65
+			foreach ($payments as $payment) {
66 66
 
67
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title);
67
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
68 68
 
69 69
 			}
70 70
 		} else {
71
-			$options[0] = esc_html__( 'No donations found.', 'give' );
71
+			$options[0] = esc_html__('No donations found.', 'give');
72 72
 		}
73 73
 
74 74
 
75
-		$output = $this->select( array(
75
+		$output = $this->select(array(
76 76
 			'name'             => $args['name'],
77 77
 			'selected'         => $args['selected'],
78 78
 			'id'               => $args['id'],
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			'select_atts'      => $args['select_atts'],
85 85
 			'show_option_all'  => false,
86 86
 			'show_option_none' => false
87
-		) );
87
+		));
88 88
 
89 89
 		return $output;
90 90
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string      Give forms dropdown.
103 103
 	 */
104
-	public function forms_dropdown( $args = array() ) {
104
+	public function forms_dropdown($args = array()) {
105 105
 
106 106
 		$defaults = array(
107 107
 			'name'        => 'forms',
@@ -111,43 +111,43 @@  discard block
 block discarded – undo
111 111
 			'selected'    => 0,
112 112
 			'chosen'      => false,
113 113
 			'number'      => 30,
114
-			'placeholder' => esc_attr__( 'Select a Form', 'give' )
114
+			'placeholder' => esc_attr__('Select a Form', 'give')
115 115
 		);
116 116
 
117
-		$args = wp_parse_args( $args, $defaults );
117
+		$args = wp_parse_args($args, $defaults);
118 118
 
119
-		$forms = get_posts( array(
119
+		$forms = get_posts(array(
120 120
 			'post_type'      => 'give_forms',
121 121
 			'orderby'        => 'title',
122 122
 			'order'          => 'ASC',
123 123
 			'posts_per_page' => $args['number']
124
-		) );
124
+		));
125 125
 
126 126
 		$options = array();
127 127
 
128
-		if ( $forms ) {
129
-			$options[0] = esc_attr__( 'Select a Form', 'give' );
130
-			foreach ( $forms as $form ) {
131
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
128
+		if ($forms) {
129
+			$options[0] = esc_attr__('Select a Form', 'give');
130
+			foreach ($forms as $form) {
131
+				$options[absint($form->ID)] = esc_html($form->post_title);
132 132
 			}
133 133
 		} else {
134
-			$options[0] = esc_html__( 'No forms found.', 'give' );
134
+			$options[0] = esc_html__('No forms found.', 'give');
135 135
 		}
136 136
 
137 137
 		// This ensures that any selected forms are included in the drop down
138
-		if ( is_array( $args['selected'] ) ) {
139
-			foreach ( $args['selected'] as $item ) {
140
-				if ( ! in_array( $item, $options ) ) {
141
-					$options[ $item ] = get_the_title( $item );
138
+		if (is_array($args['selected'])) {
139
+			foreach ($args['selected'] as $item) {
140
+				if ( ! in_array($item, $options)) {
141
+					$options[$item] = get_the_title($item);
142 142
 				}
143 143
 			}
144
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
145
-			if ( ! in_array( $args['selected'], $options ) ) {
146
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
144
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
145
+			if ( ! in_array($args['selected'], $options)) {
146
+				$options[$args['selected']] = get_the_title($args['selected']);
147 147
 			}
148 148
 		}
149 149
 
150
-		$output = $this->select( array(
150
+		$output = $this->select(array(
151 151
 			'name'             => $args['name'],
152 152
 			'selected'         => $args['selected'],
153 153
 			'id'               => $args['id'],
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'placeholder'      => $args['placeholder'],
159 159
 			'show_option_all'  => false,
160 160
 			'show_option_none' => false
161
-		) );
161
+		));
162 162
 
163 163
 		return $output;
164 164
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return string      Donors dropdown.
177 177
 	 */
178
-	public function donor_dropdown( $args = array() ) {
178
+	public function donor_dropdown($args = array()) {
179 179
 
180 180
 		$defaults = array(
181 181
 			'name'        => 'customers',
@@ -184,38 +184,38 @@  discard block
 block discarded – undo
184 184
 			'multiple'    => false,
185 185
 			'selected'    => 0,
186 186
 			'chosen'      => true,
187
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
187
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
188 188
 			'number'      => 30
189 189
 		);
190 190
 
191
-		$args = wp_parse_args( $args, $defaults );
191
+		$args = wp_parse_args($args, $defaults);
192 192
 
193
-		$customers = Give()->customers->get_customers( array(
193
+		$customers = Give()->customers->get_customers(array(
194 194
 			'number' => $args['number']
195
-		) );
195
+		));
196 196
 
197 197
 		$options = array();
198 198
 
199
-		if ( $customers ) {
200
-			$options[0] = esc_html__( 'No donor attached', 'give' );
201
-			foreach ( $customers as $customer ) {
202
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
199
+		if ($customers) {
200
+			$options[0] = esc_html__('No donor attached', 'give');
201
+			foreach ($customers as $customer) {
202
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
203 203
 			}
204 204
 		} else {
205
-			$options[0] = esc_html__( 'No donors found.', 'give' );
205
+			$options[0] = esc_html__('No donors found.', 'give');
206 206
 		}
207 207
 
208
-		if ( ! empty( $args['selected'] ) ) {
208
+		if ( ! empty($args['selected'])) {
209 209
 
210 210
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
211 211
 
212
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
212
+			if ( ! array_key_exists($args['selected'], $options)) {
213 213
 
214
-				$customer = new Give_Customer( $args['selected'] );
214
+				$customer = new Give_Customer($args['selected']);
215 215
 
216
-				if ( $customer ) {
216
+				if ($customer) {
217 217
 
218
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
218
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
219 219
 
220 220
 				}
221 221
 
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 
224 224
 		}
225 225
 
226
-		$output = $this->select( array(
226
+		$output = $this->select(array(
227 227
 			'name'             => $args['name'],
228 228
 			'selected'         => $args['selected'],
229 229
 			'id'               => $args['id'],
230
-			'class'            => $args['class'] . ' give-customer-select',
230
+			'class'            => $args['class'].' give-customer-select',
231 231
 			'options'          => $options,
232 232
 			'multiple'         => $args['multiple'],
233 233
 			'chosen'           => $args['chosen'],
234 234
 			'show_option_all'  => false,
235 235
 			'show_option_none' => false
236
-		) );
236
+		));
237 237
 
238 238
 		return $output;
239 239
 	}
@@ -251,21 +251,21 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return string           Categories dropdown.
253 253
 	 */
254
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
255
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
254
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
255
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
256 256
 		$options    = array();
257 257
 
258
-		foreach ( $categories as $category ) {
259
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
258
+		foreach ($categories as $category) {
259
+			$options[absint($category->term_id)] = esc_html($category->name);
260 260
 		}
261 261
 
262
-		$output = $this->select( array(
262
+		$output = $this->select(array(
263 263
 			'name'             => $name,
264 264
 			'selected'         => $selected,
265 265
 			'options'          => $options,
266
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
266
+			'show_option_all'  => esc_html__('All Categories', 'give'),
267 267
 			'show_option_none' => false
268
-		) );
268
+		));
269 269
 
270 270
 		return $output;
271 271
 	}
@@ -285,25 +285,25 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return string               Years dropdown.
287 287
 	 */
288
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
289
-		$current    = date( 'Y' );
290
-		$start_year = $current - absint( $years_before );
291
-		$end_year   = $current + absint( $years_after );
292
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
288
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
289
+		$current    = date('Y');
290
+		$start_year = $current - absint($years_before);
291
+		$end_year   = $current + absint($years_after);
292
+		$selected   = empty($selected) ? date('Y') : $selected;
293 293
 		$options    = array();
294 294
 
295
-		while ( $start_year <= $end_year ) {
296
-			$options[ absint( $start_year ) ] = $start_year;
297
-			$start_year ++;
295
+		while ($start_year <= $end_year) {
296
+			$options[absint($start_year)] = $start_year;
297
+			$start_year++;
298 298
 		}
299 299
 
300
-		$output = $this->select( array(
300
+		$output = $this->select(array(
301 301
 			'name'             => $name,
302 302
 			'selected'         => $selected,
303 303
 			'options'          => $options,
304 304
 			'show_option_all'  => false,
305 305
 			'show_option_none' => false
306
-		) );
306
+		));
307 307
 
308 308
 		return $output;
309 309
 	}
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return string           Months dropdown.
323 323
 	 */
324
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
324
+	public function month_dropdown($name = 'month', $selected = 0) {
325 325
 		$month    = 1;
326 326
 		$options  = array();
327
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
327
+		$selected = empty($selected) ? date('n') : $selected;
328 328
 
329
-		while ( $month <= 12 ) {
330
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
331
-			$month ++;
329
+		while ($month <= 12) {
330
+			$options[absint($month)] = give_month_num_to_name($month);
331
+			$month++;
332 332
 		}
333 333
 
334
-		$output = $this->select( array(
334
+		$output = $this->select(array(
335 335
 			'name'             => $name,
336 336
 			'selected'         => $selected,
337 337
 			'options'          => $options,
338 338
 			'show_option_all'  => false,
339 339
 			'show_option_none' => false
340
-		) );
340
+		));
341 341
 
342 342
 		return $output;
343 343
 	}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return string      The dropdown.
356 356
 	 */
357
-	public function select( $args = array() ) {
357
+	public function select($args = array()) {
358 358
 		$defaults = array(
359 359
 			'options'          => array(),
360 360
 			'name'             => null,
@@ -365,60 +365,60 @@  discard block
 block discarded – undo
365 365
 			'placeholder'      => null,
366 366
 			'multiple'         => false,
367 367
 			'select_atts'      => false,
368
-			'show_option_all'  => esc_html__( 'All', 'give' ),
369
-			'show_option_none' => esc_html__( 'None', 'give' )
368
+			'show_option_all'  => esc_html__('All', 'give'),
369
+			'show_option_none' => esc_html__('None', 'give')
370 370
 		);
371 371
 
372
-		$args = wp_parse_args( $args, $defaults );
372
+		$args = wp_parse_args($args, $defaults);
373 373
 
374
-		if ( $args['multiple'] ) {
374
+		if ($args['multiple']) {
375 375
 			$multiple = ' MULTIPLE';
376 376
 		} else {
377 377
 			$multiple = '';
378 378
 		}
379 379
 
380
-		if ( $args['chosen'] ) {
380
+		if ($args['chosen']) {
381 381
 			$args['class'] .= ' give-select-chosen';
382 382
 		}
383 383
 
384
-		if ( $args['placeholder'] ) {
384
+		if ($args['placeholder']) {
385 385
 			$placeholder = $args['placeholder'];
386 386
 		} else {
387 387
 			$placeholder = '';
388 388
 		}
389 389
 
390 390
 
391
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">';
391
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">';
392 392
 
393
-		if ( $args['show_option_all'] ) {
394
-			if ( $args['multiple'] ) {
395
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
393
+		if ($args['show_option_all']) {
394
+			if ($args['multiple']) {
395
+				$selected = selected(true, in_array(0, $args['selected']), false);
396 396
 			} else {
397
-				$selected = selected( $args['selected'], 0, false );
397
+				$selected = selected($args['selected'], 0, false);
398 398
 			}
399
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
399
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
400 400
 		}
401 401
 
402
-		if ( ! empty( $args['options'] ) ) {
402
+		if ( ! empty($args['options'])) {
403 403
 
404
-			if ( $args['show_option_none'] ) {
405
-				if ( $args['multiple'] ) {
406
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
404
+			if ($args['show_option_none']) {
405
+				if ($args['multiple']) {
406
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
407 407
 				} else {
408
-					$selected = selected( $args['selected'], - 1, false );
408
+					$selected = selected($args['selected'], - 1, false);
409 409
 				}
410
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
410
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
411 411
 			}
412 412
 
413
-			foreach ( $args['options'] as $key => $option ) {
413
+			foreach ($args['options'] as $key => $option) {
414 414
 
415
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
416
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
415
+				if ($args['multiple'] && is_array($args['selected'])) {
416
+					$selected = selected(true, in_array($key, $args['selected']), false);
417 417
 				} else {
418
-					$selected = selected( $args['selected'], $key, false );
418
+					$selected = selected($args['selected'], $key, false);
419 419
 				}
420 420
 
421
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
421
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
422 422
 			}
423 423
 		}
424 424
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * @return string      The checkbox.
441 441
 	 */
442
-	public function checkbox( $args = array() ) {
442
+	public function checkbox($args = array()) {
443 443
 		$defaults = array(
444 444
 			'name'    => null,
445 445
 			'current' => null,
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
 			)
451 451
 		);
452 452
 
453
-		$args = wp_parse_args( $args, $defaults );
453
+		$args = wp_parse_args($args, $defaults);
454 454
 
455 455
 		$options = '';
456
-		if ( ! empty( $args['options']['disabled'] ) ) {
456
+		if ( ! empty($args['options']['disabled'])) {
457 457
 			$options .= ' disabled="disabled"';
458
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
458
+		} elseif ( ! empty($args['options']['readonly'])) {
459 459
 			$options .= ' readonly';
460 460
 		}
461 461
 
462
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
462
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
463 463
 
464 464
 		return $output;
465 465
 	}
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * @return string      The text field.
478 478
 	 */
479
-	public function text( $args = array() ) {
479
+	public function text($args = array()) {
480 480
 		// Backwards compatibility
481
-		if ( func_num_args() > 1 ) {
481
+		if (func_num_args() > 1) {
482 482
 			$args = func_get_args();
483 483
 
484 484
 			$name  = $args[0];
485
-			$value = isset( $args[1] ) ? $args[1] : '';
486
-			$label = isset( $args[2] ) ? $args[2] : '';
487
-			$desc  = isset( $args[3] ) ? $args[3] : '';
485
+			$value = isset($args[1]) ? $args[1] : '';
486
+			$label = isset($args[2]) ? $args[2] : '';
487
+			$desc  = isset($args[3]) ? $args[3] : '';
488 488
 		}
489 489
 
490 490
 		$defaults = array(
491
-			'name'         => isset( $name ) ? $name : 'text',
492
-			'value'        => isset( $value ) ? $value : null,
493
-			'label'        => isset( $label ) ? $label : null,
494
-			'desc'         => isset( $desc ) ? $desc : null,
491
+			'name'         => isset($name) ? $name : 'text',
492
+			'value'        => isset($value) ? $value : null,
493
+			'label'        => isset($label) ? $label : null,
494
+			'desc'         => isset($desc) ? $desc : null,
495 495
 			'placeholder'  => '',
496 496
 			'class'        => 'regular-text',
497 497
 			'disabled'     => false,
@@ -499,29 +499,29 @@  discard block
 block discarded – undo
499 499
 			'data'         => false
500 500
 		);
501 501
 
502
-		$args = wp_parse_args( $args, $defaults );
502
+		$args = wp_parse_args($args, $defaults);
503 503
 
504 504
 		$disabled = '';
505
-		if ( $args['disabled'] ) {
505
+		if ($args['disabled']) {
506 506
 			$disabled = ' disabled="disabled"';
507 507
 		}
508 508
 
509 509
 		$data = '';
510
-		if ( ! empty( $args['data'] ) ) {
511
-			foreach ( $args['data'] as $key => $value ) {
512
-				$data .= 'data-' . $key . '="' . $value . '" ';
510
+		if ( ! empty($args['data'])) {
511
+			foreach ($args['data'] as $key => $value) {
512
+				$data .= 'data-'.$key.'="'.$value.'" ';
513 513
 			}
514 514
 		}
515 515
 
516
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
516
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
517 517
 
518
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
518
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
519 519
 
520
-		if ( ! empty( $args['desc'] ) ) {
521
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
520
+		if ( ! empty($args['desc'])) {
521
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
522 522
 		}
523 523
 
524
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
524
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
525 525
 
526 526
 		$output .= '</span>';
527 527
 
@@ -540,15 +540,15 @@  discard block
 block discarded – undo
540 540
 	 *
541 541
 	 * @return string      The date picker.
542 542
 	 */
543
-	public function date_field( $args = array() ) {
543
+	public function date_field($args = array()) {
544 544
 
545
-		if ( empty( $args['class'] ) ) {
545
+		if (empty($args['class'])) {
546 546
 			$args['class'] = 'give_datepicker';
547
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
547
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
548 548
 			$args['class'] .= ' give_datepicker';
549 549
 		}
550 550
 
551
-		return $this->text( $args );
551
+		return $this->text($args);
552 552
 	}
553 553
 
554 554
 	/**
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 *
564 564
 	 * @return string      The textarea.
565 565
 	 */
566
-	public function textarea( $args = array() ) {
566
+	public function textarea($args = array()) {
567 567
 		$defaults = array(
568 568
 			'name'     => 'textarea',
569 569
 			'value'    => null,
@@ -573,21 +573,21 @@  discard block
 block discarded – undo
573 573
 			'disabled' => false
574 574
 		);
575 575
 
576
-		$args = wp_parse_args( $args, $defaults );
576
+		$args = wp_parse_args($args, $defaults);
577 577
 
578 578
 		$disabled = '';
579
-		if ( $args['disabled'] ) {
579
+		if ($args['disabled']) {
580 580
 			$disabled = ' disabled="disabled"';
581 581
 		}
582 582
 
583
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
583
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
584 584
 
585
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
585
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
586 586
 
587
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
587
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
588 588
 
589
-		if ( ! empty( $args['desc'] ) ) {
590
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
589
+		if ( ! empty($args['desc'])) {
590
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
591 591
 		}
592 592
 
593 593
 		$output .= '</span>';
@@ -607,12 +607,12 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @return string      The text field with ajax search.
609 609
 	 */
610
-	public function ajax_user_search( $args = array() ) {
610
+	public function ajax_user_search($args = array()) {
611 611
 
612 612
 		$defaults = array(
613 613
 			'name'         => 'user_id',
614 614
 			'value'        => null,
615
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
615
+			'placeholder'  => esc_attr__('Enter username', 'give'),
616 616
 			'label'        => null,
617 617
 			'desc'         => null,
618 618
 			'class'        => '',
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
 			'data'         => false
622 622
 		);
623 623
 
624
-		$args = wp_parse_args( $args, $defaults );
624
+		$args = wp_parse_args($args, $defaults);
625 625
 
626
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
626
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
627 627
 
628 628
 		$output = '<span class="give_user_search_wrap">';
629
-		$output .= $this->text( $args );
630
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
629
+		$output .= $this->text($args);
630
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
631 631
 		$output .= '</span>';
632 632
 
633 633
 		return $output;
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -661,7 +661,7 @@
 block discarded – undo
661 661
  *
662 662
  * @since 1.6.3
663 663
  *
664
- * @param $pending_reason
664
+ * @param string $pending_reason
665 665
  *
666 666
  * @return string
667 667
  */
Please login to merge, or discard this patch.
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Payment.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_payment( $payment_data ) {
35
+function give_process_paypal_payment($payment_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $payment_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($payment_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
42
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
41
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
42
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
43 43
 
44 44
 	// Collect payment data.
45 45
 	$payment_data = array(
@@ -57,101 +57,101 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment.
60
-	$payment_id = give_insert_payment( $payment_data );
60
+	$payment_id = give_insert_payment($payment_data);
61 61
 
62 62
 	// Check payment.
63
-	if ( ! $payment_id ) {
63
+	if ( ! $payment_id) {
64 64
 		// Record the error.
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 			/* translators: %s: payment data */
69
-				esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment_id
73 73
 		);
74 74
 		// Problems? Send back.
75
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
76 76
 
77 77
 	} else {
78 78
 
79 79
 		// Only send to PayPal if the pending payment is created successfully.
80
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
80
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
81 81
 
82 82
 		// Get the success url.
83
-		$return_url = add_query_arg( array(
83
+		$return_url = add_query_arg(array(
84 84
 			'payment-confirmation' => 'paypal',
85 85
 			'payment-id'           => $payment_id
86 86
 
87
-		), get_permalink( give_get_option( 'success_page' ) ) );
87
+		), get_permalink(give_get_option('success_page')));
88 88
 
89 89
 		// Get the PayPal redirect uri.
90
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
90
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
91 91
 
92 92
 		//Item name - pass level name if variable priced.
93 93
 		$item_name = $payment_data['post_data']['give-form-title'];
94 94
 
95 95
 		//Verify has variable prices.
96
-		if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
96
+		if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
97 97
 
98
-			$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
98
+			$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
99 99
 
100
-			$price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
100
+			$price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
101 101
 
102 102
 			//Donation given doesn't match selected level (must be a custom amount).
103
-			if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) {
104
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+			if ($price_level_amount != give_sanitize_amount($payment_data['price'])) {
104
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
105 105
 				//user custom amount text if any, fallback to default if not.
106
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
106
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
107 107
 
108 108
 			} //Is there any donation level text?
109
-			elseif ( ! empty( $item_price_level_text ) ) {
110
-				$item_name .= ' - ' . $item_price_level_text;
109
+			elseif ( ! empty($item_price_level_text)) {
110
+				$item_name .= ' - '.$item_price_level_text;
111 111
 			}
112 112
 
113 113
 		} //Single donation: Custom Amount.
114
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) {
115
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
114
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) {
115
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
116 116
 			//user custom amount text if any, fallback to default if not.
117
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
117
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
118 118
 		}
119 119
 
120 120
 		// Setup PayPal API params.
121 121
 		$paypal_args = array(
122
-			'business'      => give_get_option( 'paypal_email', false ),
122
+			'business'      => give_get_option('paypal_email', false),
123 123
 			'first_name'    => $payment_data['user_info']['first_name'],
124 124
 			'last_name'     => $payment_data['user_info']['last_name'],
125 125
 			'email'         => $payment_data['user_email'],
126 126
 			'invoice'       => $payment_data['purchase_key'],
127 127
 			'amount'        => $payment_data['price'],
128
-			'item_name'     => stripslashes( $item_name ),
128
+			'item_name'     => stripslashes($item_name),
129 129
 			'no_shipping'   => '1',
130 130
 			'shipping'      => '0',
131 131
 			'no_note'       => '1',
132 132
 			'currency_code' => give_get_currency(),
133
-			'charset'       => get_bloginfo( 'charset' ),
133
+			'charset'       => get_bloginfo('charset'),
134 134
 			'custom'        => $payment_id,
135 135
 			'rm'            => '2',
136 136
 			'return'        => $return_url,
137
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
137
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
138 138
 			'notify_url'    => $listener_url,
139 139
 			'page_style'    => give_get_paypal_page_style(),
140
-			'cbt'           => get_bloginfo( 'name' ),
140
+			'cbt'           => get_bloginfo('name'),
141 141
 			'bn'            => 'givewp_SP'
142 142
 		);
143 143
 
144 144
 		//Add user address if present.
145
-		if ( ! empty( $payment_data['user_info']['address'] ) ) {
146
-			$paypal_args['address1'] = isset( $payment_data['user_info']['address']['line1'] ) ? $payment_data['user_info']['address']['line1'] : '';
147
-			$paypal_args['address2'] = isset( $payment_data['user_info']['address']['line2'] ) ? $payment_data['user_info']['address']['line2'] : '';
148
-			$paypal_args['city']     = isset( $payment_data['user_info']['address']['city'] ) ? $payment_data['user_info']['address']['city'] : '';
149
-			$paypal_args['state']    = isset( $payment_data['user_info']['address']['state'] ) ? $payment_data['user_info']['address']['state'] : '';
150
-			$paypal_args['country']  = isset( $payment_data['user_info']['address']['country'] ) ? $payment_data['user_info']['address']['country'] : '';
145
+		if ( ! empty($payment_data['user_info']['address'])) {
146
+			$paypal_args['address1'] = isset($payment_data['user_info']['address']['line1']) ? $payment_data['user_info']['address']['line1'] : '';
147
+			$paypal_args['address2'] = isset($payment_data['user_info']['address']['line2']) ? $payment_data['user_info']['address']['line2'] : '';
148
+			$paypal_args['city']     = isset($payment_data['user_info']['address']['city']) ? $payment_data['user_info']['address']['city'] : '';
149
+			$paypal_args['state']    = isset($payment_data['user_info']['address']['state']) ? $payment_data['user_info']['address']['state'] : '';
150
+			$paypal_args['country']  = isset($payment_data['user_info']['address']['country']) ? $payment_data['user_info']['address']['country'] : '';
151 151
 		}
152 152
 
153 153
 		//Donations or regular transactions?
154
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
154
+		if (give_get_option('paypal_button_type') === 'standard') {
155 155
 			$paypal_extra_args = array(
156 156
 				'cmd' => '_xclick',
157 157
 			);
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 			);
162 162
 		}
163 163
 
164
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
165
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
164
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
165
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
166 166
 
167 167
 		// Build query.
168
-		$paypal_redirect .= http_build_query( $paypal_args );
168
+		$paypal_redirect .= http_build_query($paypal_args);
169 169
 
170 170
 		// Fix for some sites that encode the entities.
171
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
171
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
172 172
 
173 173
 		// Redirect to PayPal.
174
-		wp_redirect( $paypal_redirect );
174
+		wp_redirect($paypal_redirect);
175 175
 		exit;
176 176
 	}
177 177
 
178 178
 }
179 179
 
180
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
180
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
181 181
 
182 182
 /**
183 183
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function give_listen_for_paypal_ipn() {
189 189
 	// Regular PayPal IPN
190
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
190
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
191 191
 		/**
192 192
 		 * Fires while verifying PayPal IPN
193 193
 		 *
194 194
 		 * @since 1.0
195 195
 		 */
196
-		do_action( 'give_verify_paypal_ipn' );
196
+		do_action('give_verify_paypal_ipn');
197 197
 	}
198 198
 }
199 199
 
200
-add_action( 'init', 'give_listen_for_paypal_ipn' );
200
+add_action('init', 'give_listen_for_paypal_ipn');
201 201
 
202 202
 /**
203 203
  * Process PayPal IPN
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 function give_process_paypal_ipn() {
209 209
 
210 210
 	// Check the request method is POST
211
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
211
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
212 212
 		return;
213 213
 	}
214 214
 
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 	$post_data = '';
217 217
 
218 218
 	// Fallback just in case post_max_size is lower than needed
219
-	if ( ini_get( 'allow_url_fopen' ) ) {
220
-		$post_data = file_get_contents( 'php://input' );
219
+	if (ini_get('allow_url_fopen')) {
220
+		$post_data = file_get_contents('php://input');
221 221
 	} else {
222 222
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
223
-		ini_set( 'post_max_size', '12M' );
223
+		ini_set('post_max_size', '12M');
224 224
 	}
225 225
 	// Start the encoded data collection with notification command
226 226
 	$encoded_data = 'cmd=_notify-validate';
@@ -229,40 +229,40 @@  discard block
 block discarded – undo
229 229
 	$arg_separator = give_get_php_arg_separator_output();
230 230
 
231 231
 	// Verify there is a post_data
232
-	if ( $post_data || strlen( $post_data ) > 0 ) {
232
+	if ($post_data || strlen($post_data) > 0) {
233 233
 		// Append the data
234
-		$encoded_data .= $arg_separator . $post_data;
234
+		$encoded_data .= $arg_separator.$post_data;
235 235
 	} else {
236 236
 		// Check if POST is empty
237
-		if ( empty( $_POST ) ) {
237
+		if (empty($_POST)) {
238 238
 			// Nothing to do
239 239
 			return;
240 240
 		} else {
241 241
 			// Loop through each POST
242
-			foreach ( $_POST as $key => $value ) {
242
+			foreach ($_POST as $key => $value) {
243 243
 				// Encode the value and append the data.
244
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
244
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
245 245
 			}
246 246
 		}
247 247
 	}
248 248
 
249 249
 	// Convert collected post data to an array.
250
-	parse_str( $encoded_data, $encoded_data_array );
250
+	parse_str($encoded_data, $encoded_data_array);
251 251
 
252
-	foreach ( $encoded_data_array as $key => $value ) {
252
+	foreach ($encoded_data_array as $key => $value) {
253 253
 
254
-		if ( false !== strpos( $key, 'amp;' ) ) {
255
-			$new_key = str_replace( '&amp;', '&', $key );
256
-			$new_key = str_replace( 'amp;', '&', $new_key );
254
+		if (false !== strpos($key, 'amp;')) {
255
+			$new_key = str_replace('&amp;', '&', $key);
256
+			$new_key = str_replace('amp;', '&', $new_key);
257 257
 
258
-			unset( $encoded_data_array[ $key ] );
259
-			$encoded_data_array[ $new_key ] = $value;
258
+			unset($encoded_data_array[$key]);
259
+			$encoded_data_array[$new_key] = $value;
260 260
 		}
261 261
 
262 262
 	}
263 263
 
264 264
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure.
265
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
265
+	if ( ! give_get_option('disable_paypal_verification')) {
266 266
 
267 267
 		$remote_post_vars = array(
268 268
 			'method'      => 'POST',
@@ -282,28 +282,28 @@  discard block
 block discarded – undo
282 282
 		);
283 283
 
284 284
 		// Validate the IPN.
285
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
285
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
286 286
 
287
-		if ( is_wp_error( $api_response ) ) {
287
+		if (is_wp_error($api_response)) {
288 288
 			give_record_gateway_error(
289
-				esc_html__( 'IPN Error', 'give' ),
289
+				esc_html__('IPN Error', 'give'),
290 290
 				sprintf(
291 291
 				/* translators: %s: Paypal IPN response */
292
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
293
-					json_encode( $api_response )
292
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
293
+					json_encode($api_response)
294 294
 				)
295 295
 			);
296 296
 
297 297
 			return; // Something went wrong
298 298
 		}
299 299
 
300
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
300
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
301 301
 			give_record_gateway_error(
302
-				esc_html__( 'IPN Error', 'give' ),
302
+				esc_html__('IPN Error', 'give'),
303 303
 				sprintf(
304 304
 				/* translators: %s: Paypal IPN response */
305
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
306
-					json_encode( $api_response )
305
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
306
+					json_encode($api_response)
307 307
 				)
308 308
 			);
309 309
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	}
314 314
 
315 315
 	// Check if $post_data_array has been populated
316
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
316
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
317 317
 		return;
318 318
 	}
319 319
 
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 		'payment_status' => ''
323 323
 	);
324 324
 
325
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
325
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
326 326
 
327
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
327
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
328 328
 	$txn_type   = $encoded_data_array['txn_type'];
329 329
 
330
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
330
+	if (has_action('give_paypal_'.$txn_type)) {
331 331
 		/**
332 332
 		 * Fires while processing PayPal IPN $txn_type.
333 333
 		 *
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @param array $encoded_data_array Encoded data.
339 339
 		 * @param int   $payment_id         Payment id.
340 340
 		 */
341
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
341
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
342 342
 	} else {
343 343
 		/**
344 344
 		 * Fires while process PayPal IPN.
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 		 * @param array $encoded_data_array Encoded data.
351 351
 		 * @param int   $payment_id         Payment id.
352 352
 		 */
353
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
353
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
354 354
 	}
355 355
 	exit;
356 356
 }
357 357
 
358
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
358
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
359 359
 
360 360
 /**
361 361
  * Process web accept (one time) payment IPNs.
@@ -367,128 +367,128 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @return void
369 369
  */
370
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
370
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
371 371
 
372 372
 	//Only allow through these transaction types.
373
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) {
373
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') {
374 374
 		return;
375 375
 	}
376 376
 
377 377
 	//Need $payment_id to continue.
378
-	if ( empty( $payment_id ) ) {
378
+	if (empty($payment_id)) {
379 379
 		return;
380 380
 	}
381 381
 
382 382
 	// Collect donation payment details.
383 383
 	$paypal_amount  = $data['mc_gross'];
384
-	$payment_status = strtolower( $data['payment_status'] );
385
-	$currency_code  = strtolower( $data['mc_currency'] );
386
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
387
-	$payment_meta   = give_get_payment_meta( $payment_id );
384
+	$payment_status = strtolower($data['payment_status']);
385
+	$currency_code  = strtolower($data['mc_currency']);
386
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
387
+	$payment_meta   = give_get_payment_meta($payment_id);
388 388
 
389 389
 	// Must be a PayPal standard IPN.
390
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
390
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
391 391
 		return;
392 392
 	}
393 393
 
394 394
 	// Verify payment recipient
395
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
395
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
396 396
 
397 397
 		give_record_gateway_error(
398
-			esc_html__( 'IPN Error', 'give' ),
398
+			esc_html__('IPN Error', 'give'),
399 399
 			sprintf(
400 400
 			/* translators: %s: Paypal IPN response */
401
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
402
-				json_encode( $data )
401
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
402
+				json_encode($data)
403 403
 			),
404 404
 			$payment_id
405 405
 		);
406
-		give_update_payment_status( $payment_id, 'failed' );
407
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
406
+		give_update_payment_status($payment_id, 'failed');
407
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
408 408
 
409 409
 		return;
410 410
 	}
411 411
 
412 412
 	// Verify payment currency.
413
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
413
+	if ($currency_code != strtolower($payment_meta['currency'])) {
414 414
 
415 415
 		give_record_gateway_error(
416
-			esc_html__( 'IPN Error', 'give' ),
416
+			esc_html__('IPN Error', 'give'),
417 417
 			sprintf(
418 418
 			/* translators: %s: Paypal IPN response */
419
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
420
-				json_encode( $data )
419
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
420
+				json_encode($data)
421 421
 			),
422 422
 			$payment_id
423 423
 		);
424
-		give_update_payment_status( $payment_id, 'failed' );
425
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
424
+		give_update_payment_status($payment_id, 'failed');
425
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
426 426
 
427 427
 		return;
428 428
 	}
429 429
 
430 430
 	//Process refunds & reversed.
431
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
432
-		give_process_paypal_refund( $data, $payment_id );
431
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
432
+		give_process_paypal_refund($data, $payment_id);
433 433
 
434 434
 		return;
435 435
 	}
436 436
 
437 437
 	// Only complete payments once.
438
-	if ( get_post_status( $payment_id ) == 'publish' ) {
438
+	if (get_post_status($payment_id) == 'publish') {
439 439
 		return;
440 440
 	}
441 441
 
442 442
 	// Retrieve the total donation amount (before PayPal).
443
-	$payment_amount = give_get_payment_amount( $payment_id );
443
+	$payment_amount = give_get_payment_amount($payment_id);
444 444
 
445 445
 	//Check that the donation PP and local db amounts match.
446
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
446
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
447 447
 		// The prices don't match
448 448
 		give_record_gateway_error(
449
-			esc_html__( 'IPN Error', 'give' ),
449
+			esc_html__('IPN Error', 'give'),
450 450
 			sprintf(
451 451
 			/* translators: %s: Paypal IPN response */
452
-				esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
453
-				json_encode( $data )
452
+				esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
453
+				json_encode($data)
454 454
 			),
455 455
 			$payment_id
456 456
 		);
457
-		give_update_payment_status( $payment_id, 'failed' );
458
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
457
+		give_update_payment_status($payment_id, 'failed');
458
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
459 459
 
460 460
 		return;
461 461
 	}
462 462
 
463 463
 	//Process completed donations.
464
-	if ( $payment_status == 'completed' || give_is_test_mode() ) {
464
+	if ($payment_status == 'completed' || give_is_test_mode()) {
465 465
 
466 466
 		give_insert_payment_note(
467 467
 			$payment_id,
468 468
 			sprintf(
469 469
 			/* translators: %s: Paypal transaction ID */
470
-				esc_html__( 'PayPal Transaction ID: %s', 'give' ),
470
+				esc_html__('PayPal Transaction ID: %s', 'give'),
471 471
 				$data['txn_id']
472 472
 			)
473 473
 		);
474
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
475
-		give_update_payment_status( $payment_id, 'publish' );
474
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
475
+		give_update_payment_status($payment_id, 'publish');
476 476
 
477
-	} elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
477
+	} elseif ('pending' == $payment_status && isset($data['pending_reason'])) {
478 478
 
479 479
 		// Look for possible pending reasons, such as an echeck.
480
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
480
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
481 481
 
482
-		if ( ! empty( $note ) ) {
482
+		if ( ! empty($note)) {
483 483
 
484
-			give_insert_payment_note( $payment_id, $note );
484
+			give_insert_payment_note($payment_id, $note);
485 485
 
486 486
 		}
487 487
 	}
488 488
 
489 489
 }
490 490
 
491
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
491
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
492 492
 
493 493
 /**
494 494
  * Process PayPal IPN Refunds
@@ -500,28 +500,28 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return void
502 502
  */
503
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
503
+function give_process_paypal_refund($data, $payment_id = 0) {
504 504
 
505 505
 	// Collect payment details
506 506
 
507
-	if ( empty( $payment_id ) ) {
507
+	if (empty($payment_id)) {
508 508
 		return;
509 509
 	}
510 510
 
511
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
511
+	if (get_post_status($payment_id) == 'refunded') {
512 512
 		return; // Only refund payments once
513 513
 	}
514 514
 
515
-	$payment_amount = give_get_payment_amount( $payment_id );
515
+	$payment_amount = give_get_payment_amount($payment_id);
516 516
 	$refund_amount  = $data['payment_gross'] * - 1;
517 517
 
518
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
518
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
519 519
 
520 520
 		give_insert_payment_note(
521 521
 			$payment_id,
522 522
 			sprintf(
523 523
 			/* translators: %s: Paypal parent transaction ID */
524
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
524
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
525 525
 				$data['parent_txn_id']
526 526
 			)
527 527
 		);
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		$payment_id,
535 535
 		sprintf(
536 536
 		/* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
537
-			esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ),
537
+			esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'),
538 538
 			$data['parent_txn_id'],
539 539
 			$data['reason_code']
540 540
 		)
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 		$payment_id,
544 544
 		sprintf(
545 545
 		/* translators: %s: Paypal transaction ID */
546
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
546
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
547 547
 			$data['txn_id']
548 548
 		)
549 549
 	);
550
-	give_update_payment_status( $payment_id, 'refunded' );
550
+	give_update_payment_status($payment_id, 'refunded');
551 551
 }
552 552
 
553 553
 /**
@@ -559,24 +559,24 @@  discard block
 block discarded – undo
559 559
  *
560 560
  * @return string
561 561
  */
562
-function give_get_paypal_redirect( $ssl_check = false ) {
562
+function give_get_paypal_redirect($ssl_check = false) {
563 563
 
564
-	if ( is_ssl() || ! $ssl_check ) {
564
+	if (is_ssl() || ! $ssl_check) {
565 565
 		$protocal = 'https://';
566 566
 	} else {
567 567
 		$protocal = 'http://';
568 568
 	}
569 569
 
570 570
 	// Check the current payment mode
571
-	if ( give_is_test_mode() ) {
571
+	if (give_is_test_mode()) {
572 572
 		// Test mode
573
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
573
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
574 574
 	} else {
575 575
 		// Live mode
576
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
576
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
577 577
 	}
578 578
 
579
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
579
+	return apply_filters('give_paypal_uri', $paypal_uri);
580 580
 }
581 581
 
582 582
 /**
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
  * @return string
587 587
  */
588 588
 function give_get_paypal_page_style() {
589
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
589
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
590 590
 
591
-	return apply_filters( 'give_paypal_page_style', $page_style );
591
+	return apply_filters('give_paypal_page_style', $page_style);
592 592
 }
593 593
 
594 594
 /**
@@ -603,26 +603,26 @@  discard block
 block discarded – undo
603 603
  * @return string
604 604
  *
605 605
  */
606
-function give_paypal_success_page_content( $content ) {
606
+function give_paypal_success_page_content($content) {
607 607
 
608
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
608
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
609 609
 		return $content;
610 610
 	}
611 611
 
612
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
612
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
613 613
 
614
-	if ( ! $payment_id ) {
614
+	if ( ! $payment_id) {
615 615
 		$session    = give_get_purchase_session();
616
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
616
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
617 617
 	}
618 618
 
619
-	$payment = get_post( $payment_id );
620
-	if ( $payment && 'pending' == $payment->post_status ) {
619
+	$payment = get_post($payment_id);
620
+	if ($payment && 'pending' == $payment->post_status) {
621 621
 
622 622
 		// Payment is still pending so show processing indicator to fix the race condition.
623 623
 		ob_start();
624 624
 
625
-		give_get_template_part( 'payment', 'processing' );
625
+		give_get_template_part('payment', 'processing');
626 626
 
627 627
 		$content = ob_get_clean();
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 
633 633
 }
634 634
 
635
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
635
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
636 636
 
637 637
 /**
638 638
  * Given a Payment ID, extract the transaction ID
@@ -643,22 +643,22 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return string                   Transaction ID
645 645
  */
646
-function give_paypal_get_payment_transaction_id( $payment_id ) {
646
+function give_paypal_get_payment_transaction_id($payment_id) {
647 647
 
648 648
 	$transaction_id = '';
649
-	$notes          = give_get_payment_notes( $payment_id );
649
+	$notes          = give_get_payment_notes($payment_id);
650 650
 
651
-	foreach ( $notes as $note ) {
652
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
651
+	foreach ($notes as $note) {
652
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
653 653
 			$transaction_id = $match[1];
654 654
 			continue;
655 655
 		}
656 656
 	}
657 657
 
658
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
658
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
659 659
 }
660 660
 
661
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
661
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
662 662
 
663 663
 /**
664 664
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -670,16 +670,16 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return string                 A link to the PayPal transaction details
672 672
  */
673
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
673
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
674 674
 
675 675
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
676
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
676
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
677 677
 
678
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
678
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
679 679
 
680 680
 }
681 681
 
682
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
682
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
683 683
 
684 684
 
685 685
 /**
@@ -691,64 +691,64 @@  discard block
 block discarded – undo
691 691
  *
692 692
  * @return string
693 693
  */
694
-function give_paypal_get_pending_donation_note( $pending_reason ) {
694
+function give_paypal_get_pending_donation_note($pending_reason) {
695 695
 
696 696
 	$note = '';
697 697
 
698
-	switch ( $pending_reason ) {
698
+	switch ($pending_reason) {
699 699
 
700 700
 		case 'echeck' :
701 701
 
702
-			$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
702
+			$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
703 703
 
704 704
 			break;
705 705
 
706 706
 		case 'address' :
707 707
 
708
-			$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
708
+			$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
709 709
 
710 710
 			break;
711 711
 
712 712
 		case 'intl' :
713 713
 
714
-			$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
714
+			$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
715 715
 
716 716
 			break;
717 717
 
718 718
 		case 'multi-currency' :
719 719
 
720
-			$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
720
+			$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
721 721
 
722 722
 			break;
723 723
 
724 724
 		case 'paymentreview' :
725 725
 		case 'regulatory_review' :
726 726
 
727
-			$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
727
+			$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
728 728
 
729 729
 			break;
730 730
 
731 731
 		case 'unilateral' :
732 732
 
733
-			$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
733
+			$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
734 734
 
735 735
 			break;
736 736
 
737 737
 		case 'upgrade' :
738 738
 
739
-			$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
739
+			$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
740 740
 
741 741
 			break;
742 742
 
743 743
 		case 'verify' :
744 744
 
745
-			$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
745
+			$note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
746 746
 
747 747
 			break;
748 748
 
749 749
 		case 'other' :
750 750
 
751
-			$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
751
+			$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
752 752
 
753 753
 			break;
754 754
 
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -731,7 +731,7 @@
 block discarded – undo
731 731
 	 * @param    bool   $colon   Check if add colon between heading and message.
732 732
 	 * @param    string $color   Heading color.
733 733
 	 *
734
-	 * @return    mixed
734
+	 * @return    string
735 735
 	 */
736 736
 	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
737 737
 		// Add colon.
Please login to merge, or discard this 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
 				}
@@ -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
 			}
316 316
 
317
-			$this->display_table( $table_data );
317
+			$this->display_table($table_data);
318 318
 		}
319 319
 	}
320 320
 
@@ -366,37 +366,37 @@  discard block
 block discarded – undo
366 366
 	 *
367 367
 	 * @subcommand    donors
368 368
 	 */
369
-	public function donors( $args, $assoc_args ) {
369
+	public function donors($args, $assoc_args) {
370 370
 		global $wp_query;
371
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
372
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
373
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
374
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
375
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
376
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
377
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
371
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
372
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
373
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
374
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
375
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
376
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
377
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
378 378
 		$start    = time();
379 379
 
380
-		if ( $create ) {
380
+		if ($create) {
381 381
 			$number = 1;
382 382
 
383
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
384
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
383
+			if (isset($assoc_args['email']) && ! is_email($email)) {
384
+				WP_CLI::warning('Wrong email address provided.', 'give');
385 385
 
386 386
 				return;
387 387
 			}
388 388
 
389 389
 			// Create one or more donors.
390
-			if ( ! $email ) {
390
+			if ( ! $email) {
391 391
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
392
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
392
+				$number = is_numeric($create) ? absint($create) : 1;
393 393
 			}
394 394
 
395
-			for ( $i = 0; $i < $number; $i ++ ) {
396
-				if ( ! $email ) {
395
+			for ($i = 0; $i < $number; $i++) {
396
+				if ( ! $email) {
397 397
 
398 398
 					// Generate fake email.
399
-					$email = 'customer-' . uniqid() . '@test.com';
399
+					$email = 'customer-'.uniqid().'@test.com';
400 400
 				}
401 401
 
402 402
 				$args = array(
@@ -404,19 +404,19 @@  discard block
 block discarded – undo
404 404
 					'name'  => $name,
405 405
 				);
406 406
 
407
-				$customer_id = Give()->customers->add( $args );
407
+				$customer_id = Give()->customers->add($args);
408 408
 
409
-				if ( $customer_id ) {
410
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $customer_id ) ) );
409
+				if ($customer_id) {
410
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $customer_id)));
411 411
 				} else {
412
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
412
+					WP_CLI::error(__('Failed to create donor', 'give'));
413 413
 				}
414 414
 
415 415
 				// Reset email to false so it is generated on the next loop (if creating donors).
416 416
 				$email = false;
417 417
 			}
418 418
 
419
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
419
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
420 420
 
421 421
 		} else {
422 422
 			// Counter.
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			 */
431 431
 			// Cache previous number query var.
432 432
 			$is_set_number = $cache_per_page = false;
433
-			if ( isset( $wp_query->query_vars['number'] ) ) {
433
+			if (isset($wp_query->query_vars['number'])) {
434 434
 				$cache_per_page = $wp_query->query_vars['number'];
435 435
 				$is_set_number  = true;
436 436
 			}
@@ -439,24 +439,24 @@  discard block
 block discarded – undo
439 439
 			$wp_query->query_vars['number'] = $number;
440 440
 
441 441
 			// Get donors.
442
-			if ( $form_id ) {
442
+			if ($form_id) {
443 443
 				// @TODO: Allow user to get a list of donors by donation status.
444
-				$donors = $this->get_donors_by_form_id( $form_id );
444
+				$donors = $this->get_donors_by_form_id($form_id);
445 445
 			} else {
446
-				$donors = $this->api->get_customers( $search );
446
+				$donors = $this->api->get_customers($search);
447 447
 			}
448 448
 
449 449
 			// Reset number query var.
450
-			if ( $is_set_number ) {
450
+			if ($is_set_number) {
451 451
 				$wp_query->query_vars['number'] = $cache_per_page;
452 452
 			}
453 453
 
454
-			if ( isset( $donors['error'] ) ) {
455
-				WP_CLI::error( $donors['error'] );
454
+			if (isset($donors['error'])) {
455
+				WP_CLI::error($donors['error']);
456 456
 			}
457 457
 
458
-			if ( empty( $donors ) ) {
459
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
458
+			if (empty($donors)) {
459
+				WP_CLI::error(__('No donors found.', 'give'));
460 460
 
461 461
 				return;
462 462
 			}
@@ -464,24 +464,24 @@  discard block
 block discarded – undo
464 464
 			$table_data             = array();
465 465
 			$is_table_first_row_set = false;
466 466
 
467
-			foreach ( $donors['donors'] as $donor_data ) {
467
+			foreach ($donors['donors'] as $donor_data) {
468 468
 				// Set default table row data.
469
-				$table_first_row = array( __( 's_no', 'give' ) );
470
-				$table_row       = array( self::$counter );
469
+				$table_first_row = array(__('s_no', 'give'));
470
+				$table_row       = array(self::$counter);
471 471
 
472
-				foreach ( $donor_data as $key => $donor ) {
473
-					switch ( $key ) {
472
+				foreach ($donor_data as $key => $donor) {
473
+					switch ($key) {
474 474
 						case 'stats':
475
-							foreach ( $donor as $heading => $data ) {
475
+							foreach ($donor as $heading => $data) {
476 476
 
477 477
 								// Get first row.
478
-								if ( ! $is_table_first_row_set ) {
478
+								if ( ! $is_table_first_row_set) {
479 479
 									$table_first_row[] = $heading;
480 480
 								}
481 481
 
482
-								switch ( $heading ) {
482
+								switch ($heading) {
483 483
 									case 'total_spent':
484
-										$table_row[] = give_currency_filter( $data );
484
+										$table_row[] = give_currency_filter($data);
485 485
 										break;
486 486
 
487 487
 									default:
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 
493 493
 						case 'info':
494 494
 						default:
495
-							foreach ( $donor as $heading => $data ) {
495
+							foreach ($donor as $heading => $data) {
496 496
 
497 497
 								// Get first row.
498
-								if ( ! $is_table_first_row_set ) {
498
+								if ( ! $is_table_first_row_set) {
499 499
 									$table_first_row[] = $heading;
500 500
 								}
501 501
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 				}
506 506
 
507 507
 				// Add first row data to table data.
508
-				if ( ! $is_table_first_row_set ) {
508
+				if ( ! $is_table_first_row_set) {
509 509
 					$table_data[]           = $table_first_row;
510 510
 					$is_table_first_row_set = true;
511 511
 				}
@@ -514,44 +514,44 @@  discard block
 block discarded – undo
514 514
 				$table_data[] = $table_row;
515 515
 
516 516
 				// Increase counter.
517
-				self::$counter ++;
517
+				self::$counter++;
518 518
 			}
519 519
 
520
-			switch ( $format ) {
520
+			switch ($format) {
521 521
 				case 'json':
522 522
 					$table_column_name = $table_data[0];
523
-					unset( $table_data[0] );
523
+					unset($table_data[0]);
524 524
 
525 525
 					$new_table_data = array();
526
-					foreach ( $table_data as $index => $data ) {
527
-						foreach ( $data as $key => $value ) {
528
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
526
+					foreach ($table_data as $index => $data) {
527
+						foreach ($data as $key => $value) {
528
+							$new_table_data[$index][$table_column_name[$key]] = $value;
529 529
 						}
530 530
 					}
531 531
 
532
-					WP_CLI::log( json_encode( $new_table_data ) );
532
+					WP_CLI::log(json_encode($new_table_data));
533 533
 					break;
534 534
 
535 535
 				case 'csv':
536
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
537
-					$fp        = fopen( $file_path, 'w' );
536
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
537
+					$fp        = fopen($file_path, 'w');
538 538
 
539
-					if ( is_writable( $file_path ) ) {
540
-						foreach ( $table_data as $fields ) {
541
-							fputcsv( $fp, $fields );
539
+					if (is_writable($file_path)) {
540
+						foreach ($table_data as $fields) {
541
+							fputcsv($fp, $fields);
542 542
 						}
543 543
 
544
-						fclose( $fp );
544
+						fclose($fp);
545 545
 
546
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
546
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
547 547
 					} else {
548
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
548
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
549 549
 					}
550 550
 
551 551
 					break;
552 552
 
553 553
 				default:
554
-					$this->display_table( $table_data );
554
+					$this->display_table($table_data);
555 555
 			}
556 556
 		}
557 557
 	}
@@ -581,13 +581,13 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @subcommand    donations
583 583
 	 */
584
-	public function donations( $args, $assoc_args ) {
584
+	public function donations($args, $assoc_args) {
585 585
 		global $wp_query;
586
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
586
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
587 587
 
588 588
 		// Cache previous number query var.
589 589
 		$is_set_number = $cache_per_page = false;
590
-		if ( isset( $wp_query->query_vars['number'] ) ) {
590
+		if (isset($wp_query->query_vars['number'])) {
591 591
 			$cache_per_page = $wp_query->query_vars['number'];
592 592
 			$is_set_number  = true;
593 593
 		}
@@ -599,46 +599,46 @@  discard block
 block discarded – undo
599 599
 		$donations = $this->api->get_recent_donations();
600 600
 
601 601
 		// Reset number query var.
602
-		if ( $is_set_number ) {
602
+		if ($is_set_number) {
603 603
 			$wp_query->query_vars['number'] = $cache_per_page;
604 604
 		}
605 605
 
606
-		if ( empty( $donations ) ) {
607
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
606
+		if (empty($donations)) {
607
+			WP_CLI::error(__('No donations found.', 'give'));
608 608
 
609 609
 			return;
610 610
 		}
611 611
 
612 612
 		self::$counter = 1;
613 613
 
614
-		foreach ( $donations['donations'] as $key => $donation ) {
615
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
616
-			self::$counter ++;
614
+		foreach ($donations['donations'] as $key => $donation) {
615
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
616
+			self::$counter++;
617 617
 
618
-			foreach ( $donation as $column => $data ) {
618
+			foreach ($donation as $column => $data) {
619 619
 
620
-				if ( is_array( $data ) ) {
621
-					$this->color_sub_heading( $column );
622
-					foreach ( $data as $subcolumn => $subdata ) {
620
+				if (is_array($data)) {
621
+					$this->color_sub_heading($column);
622
+					foreach ($data as $subcolumn => $subdata) {
623 623
 
624 624
 						// Decode html codes.
625
-						switch ( $subcolumn ) {
625
+						switch ($subcolumn) {
626 626
 							case 'name':
627
-								$subdata = html_entity_decode( $subdata );
627
+								$subdata = html_entity_decode($subdata);
628 628
 								break;
629 629
 						}
630 630
 
631 631
 						// @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.
632
-						if ( is_array( $subdata ) ) {
632
+						if (is_array($subdata)) {
633 633
 							continue;
634 634
 						}
635 635
 
636
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
636
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
637 637
 					}
638 638
 					continue;
639 639
 				}
640 640
 
641
-				WP_CLI::log( $this->color_message( $column, $data ) );
641
+				WP_CLI::log($this->color_message($column, $data));
642 642
 			}
643 643
 		}
644 644
 	}
@@ -677,27 +677,27 @@  discard block
 block discarded – undo
677 677
 	 *
678 678
 	 * @return        void
679 679
 	 */
680
-	public function report( $args, $assoc_args ) {
680
+	public function report($args, $assoc_args) {
681 681
 		$stats      = new Give_Payment_Stats();
682
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
683
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
684
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
685
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
682
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
683
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
684
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
685
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
686 686
 
687
-		if ( ! empty( $date ) ) {
687
+		if ( ! empty($date)) {
688 688
 			$start_date = $date;
689 689
 			$end_date   = false;
690
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
690
+		} elseif (empty($date) && empty($start_date)) {
691 691
 			$start_date = 'this_month';
692 692
 			$end_date   = false;
693 693
 		}
694 694
 
695 695
 		// Get stats.
696
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
697
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
696
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
697
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
698 698
 
699
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) );
700
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
699
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings)));
700
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
701 701
 	}
702 702
 
703 703
 
@@ -724,27 +724,27 @@  discard block
 block discarded – undo
724 724
 	 *
725 725
 	 * @subcommand    cache
726 726
 	 */
727
-	public function cache( $args, $assoc_args ) {
728
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
727
+	public function cache($args, $assoc_args) {
728
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
729 729
 
730 730
 		// Bailout.
731
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
732
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
731
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
732
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
733 733
 
734 734
 			return;
735 735
 		}
736 736
 
737
-		switch ( $action ) {
737
+		switch ($action) {
738 738
 			case 'delete' :
739 739
 				// Reset counter.
740 740
 				self::$counter = 1;
741 741
 
742
-				if ( $this->delete_stats_transients() ) {
742
+				if ($this->delete_stats_transients()) {
743 743
 					// Report .eading.
744
-					WP_CLI::success( 'Give cache deleted.' );
744
+					WP_CLI::success('Give cache deleted.');
745 745
 				} else {
746 746
 					// Report .eading.
747
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
747
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
748 748
 				}
749 749
 				break;
750 750
 		}
@@ -773,27 +773,27 @@  discard block
 block discarded – undo
773 773
 			ARRAY_A
774 774
 		);
775 775
 
776
-		if ( ! empty( $stat_option_names ) ) {
776
+		if ( ! empty($stat_option_names)) {
777 777
 
778
-			foreach ( $stat_option_names as $option_name ) {
778
+			foreach ($stat_option_names as $option_name) {
779 779
 				$error       = false;
780 780
 				$option_name = $option_name['option_name'];
781 781
 
782
-				switch ( true ) {
783
-					case ( false !== strpos( $option_name, 'transient' ) ):
784
-						$option_name = str_replace( '_transient_', '', $option_name );
785
-						$error       = delete_transient( $option_name );
782
+				switch (true) {
783
+					case (false !== strpos($option_name, 'transient')):
784
+						$option_name = str_replace('_transient_', '', $option_name);
785
+						$error       = delete_transient($option_name);
786 786
 						break;
787 787
 
788 788
 					default:
789
-						$error = delete_option( $option_name );
789
+						$error = delete_option($option_name);
790 790
 				}
791 791
 
792
-				if ( $error ) {
793
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
794
-					self::$counter ++;
792
+				if ($error) {
793
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
794
+					self::$counter++;
795 795
 				} else {
796
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
796
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
797 797
 				}
798 798
 			}
799 799
 
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
 	 *
815 815
 	 * @return    mixed
816 816
 	 */
817
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
817
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
818 818
 		// Add colon.
819
-		if ( $colon ) {
820
-			$heading = $heading . ': ';
819
+		if ($colon) {
820
+			$heading = $heading.': ';
821 821
 		}
822 822
 
823
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
823
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
824 824
 	}
825 825
 
826 826
 
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 	 *
836 836
 	 * @return    void
837 837
 	 */
838
-	private function color_main_heading( $heading, $color = 'g' ) {
839
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
838
+	private function color_main_heading($heading, $color = 'g') {
839
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
840 840
 	}
841 841
 
842 842
 	/**
@@ -849,8 +849,8 @@  discard block
 block discarded – undo
849 849
 	 *
850 850
 	 * @return    void
851 851
 	 */
852
-	private function color_sub_heading( $subheading ) {
853
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
852
+	private function color_sub_heading($subheading) {
853
+		WP_CLI::log("\n--->".$subheading.'', '', false);
854 854
 	}
855 855
 
856 856
 
@@ -864,17 +864,17 @@  discard block
 block discarded – undo
864 864
 	 *
865 865
 	 * @return    void
866 866
 	 */
867
-	private function display_table( $data ) {
867
+	private function display_table($data) {
868 868
 		$table = new \cli\Table();
869 869
 
870 870
 		// Set table header.
871
-		$table->setHeaders( $data[0] );
871
+		$table->setHeaders($data[0]);
872 872
 
873 873
 		// Remove table header.
874
-		unset( $data[0] );
874
+		unset($data[0]);
875 875
 
876 876
 		// Set table data.
877
-		$table->setRows( $data );
877
+		$table->setRows($data);
878 878
 
879 879
 		// Display table.
880 880
 		$table->display();
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 	 * @return array
892 892
 	 */
893 893
 
894
-	private function get_donors_by_form_id( $form_id ) {
894
+	private function get_donors_by_form_id($form_id) {
895 895
 		$donors = array();
896 896
 
897 897
 		$donations = new Give_Payments_Query(
898 898
 			array(
899
-				'give_forms' => array( $form_id ),
900
-				'number'     => - 1,
901
-				'status'     => array( 'publish' ),
899
+				'give_forms' => array($form_id),
900
+				'number'     => -1,
901
+				'status'     => array('publish'),
902 902
 			)
903 903
 		);
904 904
 
@@ -906,16 +906,16 @@  discard block
 block discarded – undo
906 906
 		$skip_donors = array();
907 907
 
908 908
 		/* @var Give_Payment|object $donation Payment object. */
909
-		foreach ( $donations as $donation ) {
909
+		foreach ($donations as $donation) {
910 910
 
911
-			if ( in_array( $donation->customer_id, $skip_donors ) ) {
911
+			if (in_array($donation->customer_id, $skip_donors)) {
912 912
 				continue;
913 913
 			}
914 914
 
915
-			if ( ! empty( $donors ) ) {
916
-				$donors['donors'][] = current( current( $this->api->get_customers( (int) $donation->customer_id ) ) );
915
+			if ( ! empty($donors)) {
916
+				$donors['donors'][] = current(current($this->api->get_customers((int) $donation->customer_id)));
917 917
 			} else {
918
-				$donors = array_merge( $donors, $this->api->get_customers( (int) $donation->customer_id ) );
918
+				$donors = array_merge($donors, $this->api->get_customers((int) $donation->customer_id));
919 919
 			}
920 920
 
921 921
 			$skip_donors[] = $donation->customer_id;
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
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @since  1.0
328 328
  *
329
- * @param  int|bool $form_id    Form ID (default: false).
329
+ * @param  boolean $form_id    Form ID (default: false).
330 330
  * @param  int      $payment_id Payment ID.
331 331
  *
332 332
  * @return void
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
  * @param  int $year      Year number. Default is null.
645 645
  * @param  int $hour      Hour number. Default is null.
646 646
  *
647
- * @return int $earnings  Earnings
647
+ * @return double $earnings  Earnings
648 648
  */
649 649
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
650 650
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @param int $payment_id Payment ID.
961 961
  *
962
- * @return int $form_id Form ID.
962
+ * @return string $form_id Form ID.
963 963
  */
964 964
 function give_get_payment_form_id( $payment_id ) {
965 965
 	$payment = new Give_Payment( $payment_id );
Please login to merge, or discard this patch.
Spacing   +395 added lines, -395 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 object $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
 	}
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,23 +132,23 @@  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   = isset( $payment_data['give_price_id'] ) ? $payment_data['give_price_id'] : give_get_price_id( $payment_data['give_form_id'], $payment_data['price'] );
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   = isset($payment_data['give_price_id']) ? $payment_data['give_price_id'] : give_get_price_id($payment_data['give_form_id'], $payment_data['price']);
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;
@@ -162,31 +162,31 @@  discard block
 block discarded – undo
162 162
 	$payment->ip             = give_get_ip();
163 163
 	$payment->key            = $payment_data['purchase_key'];
164 164
 	$payment->mode           = give_is_test_mode() ? 'test' : 'live';
165
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
166 166
 
167 167
 	// Add the donation.
168 168
 	$args = array(
169 169
 		'price'    => $payment->total,
170 170
 		'price_id' => $payment->price_id,
171
-		'fees'     => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array(),
171
+		'fees'     => isset($payment_data['fees']) ? $payment_data['fees'] : array(),
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 	// Set date if present.
177
-	if ( isset( $payment_data['post_date'] ) ) {
177
+	if (isset($payment_data['post_date'])) {
178 178
 		$payment->date = $payment_data['post_date'];
179 179
 	}
180 180
 
181 181
 	// Handle sequential payments.
182
-	if ( give_get_option( 'enable_sequential' ) ) {
182
+	if (give_get_option('enable_sequential')) {
183 183
 		$number          = give_get_next_payment_number();
184
-		$payment->number = give_format_payment_number( $number );
185
-		update_option( 'give_last_payment_number', $number );
184
+		$payment->number = give_format_payment_number($number);
185
+		update_option('give_last_payment_number', $number);
186 186
 	}
187 187
 
188 188
 	// Clear the user's donation cache.
189
-	delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' );
189
+	delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases');
190 190
 
191 191
 	// Save payment.
192 192
 	$payment->save();
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param int   $payment_id   The payment ID.
200 200
 	 * @param array $payment_data Arguments passed.
201 201
 	 */
202
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
202
+	do_action('give_insert_payment', $payment->ID, $payment_data);
203 203
 
204 204
 	// Return payment ID upon success.
205
-	if ( ! empty( $payment->ID ) ) {
205
+	if ( ! empty($payment->ID)) {
206 206
 		return $payment->ID;
207 207
 	}
208 208
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return bool
223 223
  */
224
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
224
+function give_update_payment_status($payment_id, $new_status = 'publish') {
225 225
 
226
-	$payment         = new Give_Payment( $payment_id );
226
+	$payment         = new Give_Payment($payment_id);
227 227
 	$payment->status = $new_status;
228 228
 	$updated         = $payment->save();
229 229
 
@@ -242,37 +242,37 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return void
244 244
  */
245
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
245
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
246 246
 	global $give_logs;
247 247
 
248
-	$payment     = new Give_Payment( $payment_id );
249
-	$amount      = give_get_payment_amount( $payment_id );
248
+	$payment     = new Give_Payment($payment_id);
249
+	$amount      = give_get_payment_amount($payment_id);
250 250
 	$status      = $payment->post_status;
251
-	$customer_id = give_get_payment_customer_id( $payment_id );
252
-	$customer    = new Give_Customer( $customer_id );
251
+	$customer_id = give_get_payment_customer_id($payment_id);
252
+	$customer    = new Give_Customer($customer_id);
253 253
 
254 254
 	// Only undo donations that aren't these statuses.
255
-	$dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array(
255
+	$dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array(
256 256
 		'pending',
257 257
 		'cancelled',
258
-	) );
258
+	));
259 259
 
260
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
261
-		give_undo_purchase( false, $payment_id );
260
+	if ( ! in_array($status, $dont_undo_statuses)) {
261
+		give_undo_purchase(false, $payment_id);
262 262
 	}
263 263
 
264
-	if ( $status == 'publish' ) {
264
+	if ($status == 'publish') {
265 265
 
266 266
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
267
-		give_decrease_total_earnings( $amount );
267
+		give_decrease_total_earnings($amount);
268 268
 		// Clear the This Month earnings (this_monththis_month is NOT a typo).
269
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
269
+		delete_transient(md5('give_earnings_this_monththis_month'));
270 270
 
271
-		if ( $customer->id && $update_customer ) {
271
+		if ($customer->id && $update_customer) {
272 272
 
273 273
 			// Decrement the stats for the donor.
274 274
 			$customer->decrease_purchase_count();
275
-			$customer->decrease_value( $amount );
275
+			$customer->decrease_value($amount);
276 276
 
277 277
 		}
278 278
 	}
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @param int $payment_id Payment ID.
286 286
 	 */
287
-	do_action( 'give_payment_delete', $payment_id );
287
+	do_action('give_payment_delete', $payment_id);
288 288
 
289
-	if ( $customer->id && $update_customer ) {
289
+	if ($customer->id && $update_customer) {
290 290
 
291 291
 		// Remove the payment ID from the donor.
292
-		$customer->remove_payment( $payment_id );
292
+		$customer->remove_payment($payment_id);
293 293
 
294 294
 	}
295 295
 
296 296
 	// Remove the payment.
297
-	wp_delete_post( $payment_id, true );
297
+	wp_delete_post($payment_id, true);
298 298
 
299 299
 	// Remove related sale log entries.
300 300
 	$give_logs->delete_logs(
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @param int $payment_id Payment ID.
317 317
 	 */
318
-	do_action( 'give_payment_deleted', $payment_id );
318
+	do_action('give_payment_deleted', $payment_id);
319 319
 }
320 320
 
321 321
 /**
@@ -331,25 +331,25 @@  discard block
 block discarded – undo
331 331
  *
332 332
  * @return void
333 333
  */
334
-function give_undo_purchase( $form_id = false, $payment_id ) {
334
+function give_undo_purchase($form_id = false, $payment_id) {
335 335
 
336
-	if ( ! empty( $form_id ) ) {
336
+	if ( ! empty($form_id)) {
337 337
 		$form_id = false;
338
-		_give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' );
338
+		_give_deprected_argument('form_id', 'give_undo_purchase', '1.5');
339 339
 	}
340 340
 
341
-	$payment = new Give_Payment( $payment_id );
341
+	$payment = new Give_Payment($payment_id);
342 342
 
343
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
344
-	if ( true === $maybe_decrease_earnings ) {
343
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
344
+	if (true === $maybe_decrease_earnings) {
345 345
 		// Decrease earnings.
346
-		give_decrease_earnings( $payment->form_id, $payment->total );
346
+		give_decrease_earnings($payment->form_id, $payment->total);
347 347
 	}
348 348
 
349
-	$maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id );
350
-	if ( true === $maybe_decrease_sales ) {
349
+	$maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id);
350
+	if (true === $maybe_decrease_sales) {
351 351
 		// Decrease donation count.
352
-		give_decrease_purchase_count( $payment->form_id );
352
+		give_decrease_purchase_count($payment->form_id);
353 353
 	}
354 354
 
355 355
 }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
  *
367 367
  * @return array $count Number of payments sorted by payment status.
368 368
  */
369
-function give_count_payments( $args = array() ) {
369
+function give_count_payments($args = array()) {
370 370
 
371 371
 	global $wpdb;
372 372
 
@@ -378,18 +378,18 @@  discard block
 block discarded – undo
378 378
 		'form_id'    => null,
379 379
 	);
380 380
 
381
-	$args = wp_parse_args( $args, $defaults );
381
+	$args = wp_parse_args($args, $defaults);
382 382
 
383 383
 	$select = 'SELECT p.post_status,count( * ) AS num_posts';
384 384
 	$join   = '';
385 385
 	$where  = "WHERE p.post_type = 'give_payment'";
386 386
 
387 387
 	// Count payments for a specific user.
388
-	if ( ! empty( $args['user'] ) ) {
388
+	if ( ! empty($args['user'])) {
389 389
 
390
-		if ( is_email( $args['user'] ) ) {
390
+		if (is_email($args['user'])) {
391 391
 			$field = 'email';
392
-		} elseif ( is_numeric( $args['user'] ) ) {
392
+		} elseif (is_numeric($args['user'])) {
393 393
 			$field = 'id';
394 394
 		} else {
395 395
 			$field = '';
@@ -397,105 +397,105 @@  discard block
 block discarded – undo
397 397
 
398 398
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
399 399
 
400
-		if ( ! empty( $field ) ) {
400
+		if ( ! empty($field)) {
401 401
 			$where .= "
402 402
 				AND m.meta_key = '_give_payment_user_{$field}'
403 403
 				AND m.meta_value = '{$args['user']}'";
404 404
 		}
405 405
 
406 406
 		// Count payments for a search.
407
-	} elseif ( ! empty( $args['s'] ) ) {
407
+	} elseif ( ! empty($args['s'])) {
408 408
 
409
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
409
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
410 410
 
411
-			if ( is_email( $args['s'] ) ) {
411
+			if (is_email($args['s'])) {
412 412
 				$field = '_give_payment_user_email';
413 413
 			} else {
414 414
 				$field = '_give_payment_purchase_key';
415 415
 			}
416 416
 
417 417
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
418
-			$where .= $wpdb->prepare( '
418
+			$where .= $wpdb->prepare('
419 419
                 AND m.meta_key = %s
420 420
                 AND m.meta_value = %s',
421 421
 				$field,
422 422
 				$args['s']
423 423
 			);
424 424
 
425
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
425
+		} elseif ('#' == substr($args['s'], 0, 1)) {
426 426
 
427
-			$search = str_replace( '#:', '', $args['s'] );
428
-			$search = str_replace( '#', '', $search );
427
+			$search = str_replace('#:', '', $args['s']);
428
+			$search = str_replace('#', '', $search);
429 429
 
430 430
 			$select = 'SELECT p2.post_status,count( * ) AS num_posts ';
431 431
 			$join   = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID ";
432 432
 			$join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID ";
433 433
 			$where = "WHERE p.post_type = 'give_log' ";
434
-			$where .= $wpdb->prepare( 'AND p.post_parent = %d} ', $search );
434
+			$where .= $wpdb->prepare('AND p.post_parent = %d} ', $search);
435 435
 
436
-		} elseif ( is_numeric( $args['s'] ) ) {
436
+		} elseif (is_numeric($args['s'])) {
437 437
 
438 438
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
439
-			$where .= $wpdb->prepare( "
439
+			$where .= $wpdb->prepare("
440 440
 				AND m.meta_key = '_give_payment_user_id'
441 441
 				AND m.meta_value = %d",
442 442
 				$args['s']
443 443
 			);
444 444
 
445 445
 		} else {
446
-			$search = $wpdb->esc_like( $args['s'] );
447
-			$search = '%' . $search . '%';
446
+			$search = $wpdb->esc_like($args['s']);
447
+			$search = '%'.$search.'%';
448 448
 
449
-			$where .= $wpdb->prepare( 'AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search );
449
+			$where .= $wpdb->prepare('AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search);
450 450
 		}
451 451
 	}
452 452
 
453
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
453
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
454 454
 
455
-		$where .= $wpdb->prepare( ' AND p.post_parent = %d', $args['form_id'] );
455
+		$where .= $wpdb->prepare(' AND p.post_parent = %d', $args['form_id']);
456 456
 
457 457
 	}
458 458
 	// Limit payments count by date.
459
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
459
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
460 460
 
461
-		$date_parts = explode( '/', $args['start-date'] );
462
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
463
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
464
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
461
+		$date_parts = explode('/', $args['start-date']);
462
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
463
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
464
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
465 465
 
466
-		$is_date = checkdate( $month, $day, $year );
467
-		if ( false !== $is_date ) {
466
+		$is_date = checkdate($month, $day, $year);
467
+		if (false !== $is_date) {
468 468
 
469
-			$date = new DateTime( $args['start-date'] );
470
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
469
+			$date = new DateTime($args['start-date']);
470
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
471 471
 
472 472
 		}
473 473
 
474 474
 		// Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class).
475
-		if ( empty( $args['end-date'] ) ) {
475
+		if (empty($args['end-date'])) {
476 476
 			$args['end-date'] = $args['start-date'];
477 477
 		}
478 478
 	}
479 479
 
480
-	if ( ! empty( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
480
+	if ( ! empty($args['end-date']) && false !== strpos($args['end-date'], '/')) {
481 481
 
482
-		$date_parts = explode( '/', $args['end-date'] );
482
+		$date_parts = explode('/', $args['end-date']);
483 483
 
484
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
485
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
486
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
484
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
485
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
486
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
487 487
 
488
-		$is_date = checkdate( $month, $day, $year );
489
-		if ( false !== $is_date ) {
488
+		$is_date = checkdate($month, $day, $year);
489
+		if (false !== $is_date) {
490 490
 
491
-			$date = new DateTime( $args['end-date'] );
492
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
491
+			$date = new DateTime($args['end-date']);
492
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
493 493
 
494 494
 		}
495 495
 	}
496 496
 
497
-	$where = apply_filters( 'give_count_payments_where', $where );
498
-	$join  = apply_filters( 'give_count_payments_join', $join );
497
+	$where = apply_filters('give_count_payments_where', $where);
498
+	$join  = apply_filters('give_count_payments_join', $join);
499 499
 
500 500
 	$query = "$select
501 501
 		FROM $wpdb->posts p
@@ -504,36 +504,36 @@  discard block
 block discarded – undo
504 504
 		GROUP BY p.post_status
505 505
 	";
506 506
 
507
-	$cache_key = md5( $query );
507
+	$cache_key = md5($query);
508 508
 
509
-	$count = wp_cache_get( $cache_key, 'counts' );
510
-	if ( false !== $count ) {
509
+	$count = wp_cache_get($cache_key, 'counts');
510
+	if (false !== $count) {
511 511
 		return $count;
512 512
 	}
513 513
 
514
-	$count = $wpdb->get_results( $query, ARRAY_A );
514
+	$count = $wpdb->get_results($query, ARRAY_A);
515 515
 
516 516
 	$stats    = array();
517 517
 	$statuses = get_post_stati();
518
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
519
-		unset( $statuses['private'] );
518
+	if (isset($statuses['private']) && empty($args['s'])) {
519
+		unset($statuses['private']);
520 520
 	}
521 521
 
522
-	foreach ( $statuses as $state ) {
523
-		$stats[ $state ] = 0;
522
+	foreach ($statuses as $state) {
523
+		$stats[$state] = 0;
524 524
 	}
525 525
 
526
-	foreach ( (array) $count as $row ) {
526
+	foreach ((array) $count as $row) {
527 527
 
528
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
528
+		if ('private' == $row['post_status'] && empty($args['s'])) {
529 529
 			continue;
530 530
 		}
531 531
 
532
-		$stats[ $row['post_status'] ] = $row['num_posts'];
532
+		$stats[$row['post_status']] = $row['num_posts'];
533 533
 	}
534 534
 
535 535
 	$stats = (object) $stats;
536
-	wp_cache_set( $cache_key, $stats, 'counts' );
536
+	wp_cache_set($cache_key, $stats, 'counts');
537 537
 
538 538
 	return $stats;
539 539
 }
@@ -548,11 +548,11 @@  discard block
 block discarded – undo
548 548
  *
549 549
  * @return bool $exists True if payment exists, false otherwise.
550 550
  */
551
-function give_check_for_existing_payment( $payment_id ) {
551
+function give_check_for_existing_payment($payment_id) {
552 552
 	$exists  = false;
553
-	$payment = new Give_Payment( $payment_id );
553
+	$payment = new Give_Payment($payment_id);
554 554
 
555
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
555
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
556 556
 		$exists = true;
557 557
 	}
558 558
 
@@ -570,30 +570,30 @@  discard block
 block discarded – undo
570 570
  *
571 571
  * @return bool|mixed True if payment status exists, false otherwise.
572 572
  */
573
-function give_get_payment_status( $payment, $return_label = false ) {
573
+function give_get_payment_status($payment, $return_label = false) {
574 574
 
575
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
575
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
576 576
 		return false;
577 577
 	}
578 578
 
579 579
 	$statuses = give_get_payment_statuses();
580 580
 
581
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
581
+	if ( ! is_array($statuses) || empty($statuses)) {
582 582
 		return false;
583 583
 	}
584 584
 
585
-	$payment = new Give_Payment( $payment->ID );
585
+	$payment = new Give_Payment($payment->ID);
586 586
 
587
-	if ( array_key_exists( $payment->status, $statuses ) ) {
588
-		if ( true === $return_label ) {
587
+	if (array_key_exists($payment->status, $statuses)) {
588
+		if (true === $return_label) {
589 589
 			// Return translated status label.
590
-			return $statuses[ $payment->status ];
590
+			return $statuses[$payment->status];
591 591
 		} else {
592 592
 			// Account that our 'publish' status is labeled 'Complete'
593 593
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
594 594
 
595 595
 			// Make sure we're matching cases, since they matter
596
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
596
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
597 597
 		}
598 598
 	}
599 599
 
@@ -609,17 +609,17 @@  discard block
 block discarded – undo
609 609
  */
610 610
 function give_get_payment_statuses() {
611 611
 	$payment_statuses = array(
612
-		'pending'     => __( 'Pending', 'give' ),
613
-		'publish'     => __( 'Complete', 'give' ),
614
-		'refunded'    => __( 'Refunded', 'give' ),
615
-		'failed'      => __( 'Failed', 'give' ),
616
-		'cancelled'   => __( 'Cancelled', 'give' ),
617
-		'abandoned'   => __( 'Abandoned', 'give' ),
618
-		'preapproval' => __( 'Pre-Approved', 'give' ),
619
-		'revoked'     => __( 'Revoked', 'give' ),
612
+		'pending'     => __('Pending', 'give'),
613
+		'publish'     => __('Complete', 'give'),
614
+		'refunded'    => __('Refunded', 'give'),
615
+		'failed'      => __('Failed', 'give'),
616
+		'cancelled'   => __('Cancelled', 'give'),
617
+		'abandoned'   => __('Abandoned', 'give'),
618
+		'preapproval' => __('Pre-Approved', 'give'),
619
+		'revoked'     => __('Revoked', 'give'),
620 620
 	);
621 621
 
622
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
622
+	return apply_filters('give_payment_statuses', $payment_statuses);
623 623
 }
624 624
 
625 625
 /**
@@ -632,10 +632,10 @@  discard block
 block discarded – undo
632 632
  * @return array $payment_status All the available payment statuses.
633 633
  */
634 634
 function give_get_payment_status_keys() {
635
-	$statuses = array_keys( give_get_payment_statuses() );
636
-	asort( $statuses );
635
+	$statuses = array_keys(give_get_payment_statuses());
636
+	asort($statuses);
637 637
 
638
-	return array_values( $statuses );
638
+	return array_values($statuses);
639 639
 }
640 640
 
641 641
 /**
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
  *
651 651
  * @return int $earnings  Earnings
652 652
  */
653
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
653
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
654 654
 
655 655
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
656 656
 	global $wpdb;
@@ -660,41 +660,41 @@  discard block
 block discarded – undo
660 660
 		'nopaging'               => true,
661 661
 		'year'                   => $year,
662 662
 		'monthnum'               => $month_num,
663
-		'post_status'            => array( 'publish' ),
663
+		'post_status'            => array('publish'),
664 664
 		'fields'                 => 'ids',
665 665
 		'update_post_term_cache' => false,
666 666
 	);
667
-	if ( ! empty( $day ) ) {
667
+	if ( ! empty($day)) {
668 668
 		$args['day'] = $day;
669 669
 	}
670 670
 
671
-	if ( ! empty( $hour ) ) {
671
+	if ( ! empty($hour)) {
672 672
 		$args['hour'] = $hour;
673 673
 	}
674 674
 
675
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
676
-	$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
675
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
676
+	$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
677 677
 
678
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
678
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
679 679
 		$earnings = false;
680 680
 	} else {
681
-		$earnings = get_transient( $key );
681
+		$earnings = get_transient($key);
682 682
 	}
683 683
 
684
-	if ( false === $earnings ) {
685
-		$sales    = get_posts( $args );
684
+	if (false === $earnings) {
685
+		$sales    = get_posts($args);
686 686
 		$earnings = 0;
687
-		if ( $sales ) {
688
-			$sales = implode( ',', $sales );
687
+		if ($sales) {
688
+			$sales = implode(',', $sales);
689 689
 
690
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" );
690
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})");
691 691
 
692 692
 		}
693 693
 		// Cache the results for one hour.
694
-		set_transient( $key, $earnings, HOUR_IN_SECONDS );
694
+		set_transient($key, $earnings, HOUR_IN_SECONDS);
695 695
 	}
696 696
 
697
-	return round( $earnings, 2 );
697
+	return round($earnings, 2);
698 698
 }
699 699
 
700 700
 /**
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return int $count     Sales
711 711
  */
712
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
712
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
713 713
 
714 714
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
715 715
 	$args = array(
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
 		'nopaging'               => true,
718 718
 		'year'                   => $year,
719 719
 		'fields'                 => 'ids',
720
-		'post_status'            => array( 'publish' ),
720
+		'post_status'            => array('publish'),
721 721
 		'update_post_meta_cache' => false,
722 722
 		'update_post_term_cache' => false,
723 723
 	);
724 724
 
725
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
725
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
726 726
 
727
-	if ( false === $show_free ) {
727
+	if (false === $show_free) {
728 728
 		$args['meta_query'] = array(
729 729
 			array(
730 730
 				'key'     => '_give_payment_total',
@@ -735,33 +735,33 @@  discard block
 block discarded – undo
735 735
 		);
736 736
 	}
737 737
 
738
-	if ( ! empty( $month_num ) ) {
738
+	if ( ! empty($month_num)) {
739 739
 		$args['monthnum'] = $month_num;
740 740
 	}
741 741
 
742
-	if ( ! empty( $day ) ) {
742
+	if ( ! empty($day)) {
743 743
 		$args['day'] = $day;
744 744
 	}
745 745
 
746
-	if ( ! empty( $hour ) ) {
746
+	if ( ! empty($hour)) {
747 747
 		$args['hour'] = $hour;
748 748
 	}
749 749
 
750
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
750
+	$args = apply_filters('give_get_sales_by_date_args', $args);
751 751
 
752
-	$key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
752
+	$key = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
753 753
 
754
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
754
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
755 755
 		$count = false;
756 756
 	} else {
757
-		$count = get_transient( $key );
757
+		$count = get_transient($key);
758 758
 	}
759 759
 
760
-	if ( false === $count ) {
761
-		$sales = new WP_Query( $args );
760
+	if (false === $count) {
761
+		$sales = new WP_Query($args);
762 762
 		$count = (int) $sales->post_count;
763 763
 		// Cache the results for one hour.
764
-		set_transient( $key, $count, HOUR_IN_SECONDS );
764
+		set_transient($key, $count, HOUR_IN_SECONDS);
765 765
 	}
766 766
 
767 767
 	return $count;
@@ -776,19 +776,19 @@  discard block
 block discarded – undo
776 776
  *
777 777
  * @return bool $ret True if complete, false otherwise.
778 778
  */
779
-function give_is_payment_complete( $payment_id ) {
780
-	$payment = new Give_Payment( $payment_id );
779
+function give_is_payment_complete($payment_id) {
780
+	$payment = new Give_Payment($payment_id);
781 781
 
782 782
 	$ret = false;
783 783
 
784
-	if ( $payment->ID > 0 ) {
784
+	if ($payment->ID > 0) {
785 785
 
786
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
786
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
787 787
 			$ret = true;
788 788
 		}
789 789
 	}
790 790
 
791
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
791
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
792 792
 }
793 793
 
794 794
 /**
@@ -814,57 +814,57 @@  discard block
 block discarded – undo
814 814
  */
815 815
 function give_get_total_earnings() {
816 816
 
817
-	$total = get_option( 'give_earnings_total', false );
817
+	$total = get_option('give_earnings_total', false);
818 818
 
819 819
 	// If no total stored in DB, use old method of calculating total earnings.
820
-	if ( false === $total ) {
820
+	if (false === $total) {
821 821
 
822 822
 		global $wpdb;
823 823
 
824
-		$total = get_transient( 'give_earnings_total' );
824
+		$total = get_transient('give_earnings_total');
825 825
 
826
-		if ( false === $total ) {
826
+		if (false === $total) {
827 827
 
828 828
 			$total = (float) 0;
829 829
 
830
-			$args = apply_filters( 'give_get_total_earnings_args', array(
830
+			$args = apply_filters('give_get_total_earnings_args', array(
831 831
 				'offset' => 0,
832
-				'number' => - 1,
833
-				'status' => array( 'publish' ),
832
+				'number' => -1,
833
+				'status' => array('publish'),
834 834
 				'fields' => 'ids',
835
-			) );
835
+			));
836 836
 
837
-			$payments = give_get_payments( $args );
838
-			if ( $payments ) {
837
+			$payments = give_get_payments($args);
838
+			if ($payments) {
839 839
 
840 840
 				/**
841 841
 				 * If performing a donation, we need to skip the very last payment in the database,
842 842
 				 * since it calls give_increase_total_earnings() on completion,
843 843
 				 * which results in duplicated earnings for the very first donation.
844 844
 				 */
845
-				if ( did_action( 'give_update_payment_status' ) ) {
846
-					array_pop( $payments );
845
+				if (did_action('give_update_payment_status')) {
846
+					array_pop($payments);
847 847
 				}
848 848
 
849
-				if ( ! empty( $payments ) ) {
850
-					$payments = implode( ',', $payments );
851
-					$total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
849
+				if ( ! empty($payments)) {
850
+					$payments = implode(',', $payments);
851
+					$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
852 852
 				}
853 853
 			}
854 854
 
855 855
 			// Cache results for 1 day. This cache is cleared automatically when a payment is made.
856
-			set_transient( 'give_earnings_total', $total, 86400 );
856
+			set_transient('give_earnings_total', $total, 86400);
857 857
 
858 858
 			// Store the total for the first time.
859
-			update_option( 'give_earnings_total', $total );
859
+			update_option('give_earnings_total', $total);
860 860
 		}
861 861
 	}
862 862
 
863
-	if ( $total < 0 ) {
863
+	if ($total < 0) {
864 864
 		$total = 0; // Don't ever show negative earnings.
865 865
 	}
866 866
 
867
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
867
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
868 868
 }
869 869
 
870 870
 /**
@@ -877,10 +877,10 @@  discard block
 block discarded – undo
877 877
  *
878 878
  * @return float $total  Total earnings.
879 879
  */
880
-function give_increase_total_earnings( $amount = 0 ) {
880
+function give_increase_total_earnings($amount = 0) {
881 881
 	$total = give_get_total_earnings();
882 882
 	$total += $amount;
883
-	update_option( 'give_earnings_total', $total );
883
+	update_option('give_earnings_total', $total);
884 884
 
885 885
 	return $total;
886 886
 }
@@ -894,13 +894,13 @@  discard block
 block discarded – undo
894 894
  *
895 895
  * @return float $total Total earnings.
896 896
  */
897
-function give_decrease_total_earnings( $amount = 0 ) {
897
+function give_decrease_total_earnings($amount = 0) {
898 898
 	$total = give_get_total_earnings();
899 899
 	$total -= $amount;
900
-	if ( $total < 0 ) {
900
+	if ($total < 0) {
901 901
 		$total = 0;
902 902
 	}
903
-	update_option( 'give_earnings_total', $total );
903
+	update_option('give_earnings_total', $total);
904 904
 
905 905
 	return $total;
906 906
 }
@@ -916,10 +916,10 @@  discard block
 block discarded – undo
916 916
  *
917 917
  * @return mixed $meta Payment Meta.
918 918
  */
919
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
920
-	$payment = new Give_Payment( $payment_id );
919
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
920
+	$payment = new Give_Payment($payment_id);
921 921
 
922
-	return $payment->get_meta( $meta_key, $single );
922
+	return $payment->get_meta($meta_key, $single);
923 923
 }
924 924
 
925 925
 /**
@@ -932,10 +932,10 @@  discard block
 block discarded – undo
932 932
  *
933 933
  * @return mixed Meta ID if successful, false if unsuccessful.
934 934
  */
935
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
936
-	$payment = new Give_Payment( $payment_id );
935
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
936
+	$payment = new Give_Payment($payment_id);
937 937
 
938
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
938
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
939 939
 }
940 940
 
941 941
 /**
@@ -947,8 +947,8 @@  discard block
 block discarded – undo
947 947
  *
948 948
  * @return string $user_info User Info Meta Values.
949 949
  */
950
-function give_get_payment_meta_user_info( $payment_id ) {
951
-	$payment = new Give_Payment( $payment_id );
950
+function give_get_payment_meta_user_info($payment_id) {
951
+	$payment = new Give_Payment($payment_id);
952 952
 
953 953
 	return $payment->user_info;
954 954
 }
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
  *
965 965
  * @return int $form_id Form ID.
966 966
  */
967
-function give_get_payment_form_id( $payment_id ) {
968
-	$payment = new Give_Payment( $payment_id );
967
+function give_get_payment_form_id($payment_id) {
968
+	$payment = new Give_Payment($payment_id);
969 969
 
970 970
 	return $payment->form_id;
971 971
 }
@@ -979,8 +979,8 @@  discard block
 block discarded – undo
979 979
  *
980 980
  * @return string $email User email.
981 981
  */
982
-function give_get_payment_user_email( $payment_id ) {
983
-	$payment = new Give_Payment( $payment_id );
982
+function give_get_payment_user_email($payment_id) {
983
+	$payment = new Give_Payment($payment_id);
984 984
 
985 985
 	return $payment->email;
986 986
 }
@@ -994,11 +994,11 @@  discard block
 block discarded – undo
994 994
  *
995 995
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
996 996
  */
997
-function give_is_guest_payment( $payment_id ) {
998
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
999
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
997
+function give_is_guest_payment($payment_id) {
998
+	$payment_user_id  = give_get_payment_user_id($payment_id);
999
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
1000 1000
 
1001
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
1001
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
1002 1002
 }
1003 1003
 
1004 1004
 /**
@@ -1010,8 +1010,8 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @return int $user_id User ID.
1012 1012
  */
1013
-function give_get_payment_user_id( $payment_id ) {
1014
-	$payment = new Give_Payment( $payment_id );
1013
+function give_get_payment_user_id($payment_id) {
1014
+	$payment = new Give_Payment($payment_id);
1015 1015
 
1016 1016
 	return $payment->user_id;
1017 1017
 }
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
  *
1026 1026
  * @return int $customer_id Customer ID.
1027 1027
  */
1028
-function give_get_payment_customer_id( $payment_id ) {
1029
-	$payment = new Give_Payment( $payment_id );
1028
+function give_get_payment_customer_id($payment_id) {
1029
+	$payment = new Give_Payment($payment_id);
1030 1030
 
1031 1031
 	return $payment->customer_id;
1032 1032
 }
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return string $ip User IP.
1042 1042
  */
1043
-function give_get_payment_user_ip( $payment_id ) {
1044
-	$payment = new Give_Payment( $payment_id );
1043
+function give_get_payment_user_ip($payment_id) {
1044
+	$payment = new Give_Payment($payment_id);
1045 1045
 
1046 1046
 	return $payment->ip;
1047 1047
 }
@@ -1055,8 +1055,8 @@  discard block
 block discarded – undo
1055 1055
  *
1056 1056
  * @return string $date The date the payment was completed.
1057 1057
  */
1058
-function give_get_payment_completed_date( $payment_id = 0 ) {
1059
-	$payment = new Give_Payment( $payment_id );
1058
+function give_get_payment_completed_date($payment_id = 0) {
1059
+	$payment = new Give_Payment($payment_id);
1060 1060
 
1061 1061
 	return $payment->completed_date;
1062 1062
 }
@@ -1070,8 +1070,8 @@  discard block
 block discarded – undo
1070 1070
  *
1071 1071
  * @return string $gateway Gateway.
1072 1072
  */
1073
-function give_get_payment_gateway( $payment_id ) {
1074
-	$payment = new Give_Payment( $payment_id );
1073
+function give_get_payment_gateway($payment_id) {
1074
+	$payment = new Give_Payment($payment_id);
1075 1075
 
1076 1076
 	return $payment->gateway;
1077 1077
 }
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
  *
1086 1086
  * @return string $currency The currency code.
1087 1087
  */
1088
-function give_get_payment_currency_code( $payment_id = 0 ) {
1089
-	$payment = new Give_Payment( $payment_id );
1088
+function give_get_payment_currency_code($payment_id = 0) {
1089
+	$payment = new Give_Payment($payment_id);
1090 1090
 
1091 1091
 	return $payment->currency;
1092 1092
 }
@@ -1100,10 +1100,10 @@  discard block
 block discarded – undo
1100 1100
  *
1101 1101
  * @return string $currency The currency name.
1102 1102
  */
1103
-function give_get_payment_currency( $payment_id = 0 ) {
1104
-	$currency = give_get_payment_currency_code( $payment_id );
1103
+function give_get_payment_currency($payment_id = 0) {
1104
+	$currency = give_get_payment_currency_code($payment_id);
1105 1105
 
1106
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1106
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1107 1107
 }
1108 1108
 
1109 1109
 /**
@@ -1115,8 +1115,8 @@  discard block
 block discarded – undo
1115 1115
  *
1116 1116
  * @return string $key Donation key.
1117 1117
  */
1118
-function give_get_payment_key( $payment_id = 0 ) {
1119
-	$payment = new Give_Payment( $payment_id );
1118
+function give_get_payment_key($payment_id = 0) {
1119
+	$payment = new Give_Payment($payment_id);
1120 1120
 
1121 1121
 	return $payment->key;
1122 1122
 }
@@ -1132,8 +1132,8 @@  discard block
 block discarded – undo
1132 1132
  *
1133 1133
  * @return string $number Payment order number.
1134 1134
  */
1135
-function give_get_payment_number( $payment_id = 0 ) {
1136
-	$payment = new Give_Payment( $payment_id );
1135
+function give_get_payment_number($payment_id = 0) {
1136
+	$payment = new Give_Payment($payment_id);
1137 1137
 
1138 1138
 	return $payment->number;
1139 1139
 }
@@ -1147,23 +1147,23 @@  discard block
 block discarded – undo
1147 1147
  *
1148 1148
  * @return string      The formatted payment number.
1149 1149
  */
1150
-function give_format_payment_number( $number ) {
1150
+function give_format_payment_number($number) {
1151 1151
 
1152
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1152
+	if ( ! give_get_option('enable_sequential')) {
1153 1153
 		return $number;
1154 1154
 	}
1155 1155
 
1156
-	if ( ! is_numeric( $number ) ) {
1156
+	if ( ! is_numeric($number)) {
1157 1157
 		return $number;
1158 1158
 	}
1159 1159
 
1160
-	$prefix  = give_get_option( 'sequential_prefix' );
1161
-	$number  = absint( $number );
1162
-	$postfix = give_get_option( 'sequential_postfix' );
1160
+	$prefix  = give_get_option('sequential_prefix');
1161
+	$number  = absint($number);
1162
+	$postfix = give_get_option('sequential_postfix');
1163 1163
 
1164
-	$formatted_number = $prefix . $number . $postfix;
1164
+	$formatted_number = $prefix.$number.$postfix;
1165 1165
 
1166
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1166
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1167 1167
 }
1168 1168
 
1169 1169
 /**
@@ -1176,17 +1176,17 @@  discard block
 block discarded – undo
1176 1176
  */
1177 1177
 function give_get_next_payment_number() {
1178 1178
 
1179
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1179
+	if ( ! give_get_option('enable_sequential')) {
1180 1180
 		return false;
1181 1181
 	}
1182 1182
 
1183
-	$number           = get_option( 'give_last_payment_number' );
1184
-	$start            = give_get_option( 'sequential_start', 1 );
1183
+	$number           = get_option('give_last_payment_number');
1184
+	$start            = give_get_option('sequential_start', 1);
1185 1185
 	$increment_number = true;
1186 1186
 
1187
-	if ( false !== $number ) {
1187
+	if (false !== $number) {
1188 1188
 
1189
-		if ( empty( $number ) ) {
1189
+		if (empty($number)) {
1190 1190
 
1191 1191
 			$number           = $start;
1192 1192
 			$increment_number = false;
@@ -1195,24 +1195,24 @@  discard block
 block discarded – undo
1195 1195
 	} else {
1196 1196
 
1197 1197
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1198
-		$payments     = new Give_Payments_Query( array(
1198
+		$payments = new Give_Payments_Query(array(
1199 1199
 			'number'  => 1,
1200 1200
 			'order'   => 'DESC',
1201 1201
 			'orderby' => 'ID',
1202 1202
 			'output'  => 'posts',
1203 1203
 			'fields'  => 'ids',
1204
-		) );
1204
+		));
1205 1205
 		$last_payment = $payments->get_payments();
1206 1206
 
1207
-		if ( ! empty( $last_payment ) ) {
1207
+		if ( ! empty($last_payment)) {
1208 1208
 
1209
-			$number = give_get_payment_number( $last_payment[0] );
1209
+			$number = give_get_payment_number($last_payment[0]);
1210 1210
 
1211 1211
 		}
1212 1212
 
1213
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1213
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1214 1214
 
1215
-			$number = give_remove_payment_prefix_postfix( $number );
1215
+			$number = give_remove_payment_prefix_postfix($number);
1216 1216
 
1217 1217
 		} else {
1218 1218
 
@@ -1221,13 +1221,13 @@  discard block
 block discarded – undo
1221 1221
 		}
1222 1222
 	}
1223 1223
 
1224
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1224
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1225 1225
 
1226
-	if ( $increment_number ) {
1227
-		$number ++;
1226
+	if ($increment_number) {
1227
+		$number++;
1228 1228
 	}
1229 1229
 
1230
-	return apply_filters( 'give_get_next_payment_number', $number );
1230
+	return apply_filters('give_get_next_payment_number', $number);
1231 1231
 }
1232 1232
 
1233 1233
 /**
@@ -1239,25 +1239,25 @@  discard block
 block discarded – undo
1239 1239
  *
1240 1240
  * @return string The new Payment number without prefix and postfix.
1241 1241
  */
1242
-function give_remove_payment_prefix_postfix( $number ) {
1242
+function give_remove_payment_prefix_postfix($number) {
1243 1243
 
1244
-	$prefix  = give_get_option( 'sequential_prefix' );
1245
-	$postfix = give_get_option( 'sequential_postfix' );
1244
+	$prefix  = give_get_option('sequential_prefix');
1245
+	$postfix = give_get_option('sequential_postfix');
1246 1246
 
1247 1247
 	// Remove prefix.
1248
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1248
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1249 1249
 
1250 1250
 	// Remove the postfix.
1251
-	$length      = strlen( $number );
1252
-	$postfix_pos = strrpos( $number, $postfix );
1253
-	if ( false !== $postfix_pos ) {
1254
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1251
+	$length      = strlen($number);
1252
+	$postfix_pos = strrpos($number, $postfix);
1253
+	if (false !== $postfix_pos) {
1254
+		$number = substr_replace($number, '', $postfix_pos, $length);
1255 1255
 	}
1256 1256
 
1257 1257
 	// Ensure it's a whole number.
1258
-	$number = intval( $number );
1258
+	$number = intval($number);
1259 1259
 
1260
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1260
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1261 1261
 
1262 1262
 }
1263 1263
 
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
  *
1274 1274
  * @return string $amount Fully formatted payment amount.
1275 1275
  */
1276
-function give_payment_amount( $payment_id = 0 ) {
1277
-	$amount = give_get_payment_amount( $payment_id );
1276
+function give_payment_amount($payment_id = 0) {
1277
+	$amount = give_get_payment_amount($payment_id);
1278 1278
 
1279
-	return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) );
1279
+	return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
1280 1280
 }
1281 1281
 
1282 1282
 /**
@@ -1289,11 +1289,11 @@  discard block
 block discarded – undo
1289 1289
  *
1290 1290
  * @return mixed|void
1291 1291
  */
1292
-function give_get_payment_amount( $payment_id ) {
1292
+function give_get_payment_amount($payment_id) {
1293 1293
 
1294
-	$payment = new Give_Payment( $payment_id );
1294
+	$payment = new Give_Payment($payment_id);
1295 1295
 
1296
-	return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id );
1296
+	return apply_filters('give_payment_amount', floatval($payment->total), $payment_id);
1297 1297
 }
1298 1298
 
1299 1299
 /**
@@ -1309,10 +1309,10 @@  discard block
 block discarded – undo
1309 1309
  *
1310 1310
  * @return array Fully formatted payment subtotal.
1311 1311
  */
1312
-function give_payment_subtotal( $payment_id = 0 ) {
1313
-	$subtotal = give_get_payment_subtotal( $payment_id );
1312
+function give_payment_subtotal($payment_id = 0) {
1313
+	$subtotal = give_get_payment_subtotal($payment_id);
1314 1314
 
1315
-	return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) );
1315
+	return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id));
1316 1316
 }
1317 1317
 
1318 1318
 /**
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
  *
1327 1327
  * @return float $subtotal Subtotal for payment (non formatted).
1328 1328
  */
1329
-function give_get_payment_subtotal( $payment_id = 0 ) {
1330
-	$payment = new G_Payment( $payment_id );
1329
+function give_get_payment_subtotal($payment_id = 0) {
1330
+	$payment = new G_Payment($payment_id);
1331 1331
 
1332 1332
 	return $payment->subtotal;
1333 1333
 }
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
  *
1343 1343
  * @return mixed array if payment fees found, false otherwise.
1344 1344
  */
1345
-function give_get_payment_fees( $payment_id = 0, $type = 'all' ) {
1346
-	$payment = new Give_Payment( $payment_id );
1345
+function give_get_payment_fees($payment_id = 0, $type = 'all') {
1346
+	$payment = new Give_Payment($payment_id);
1347 1347
 
1348
-	return $payment->get_fees( $type );
1348
+	return $payment->get_fees($type);
1349 1349
 }
1350 1350
 
1351 1351
 /**
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
  *
1358 1358
  * @return string The donation ID.
1359 1359
  */
1360
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1361
-	$payment = new Give_Payment( $payment_id );
1360
+function give_get_payment_transaction_id($payment_id = 0) {
1361
+	$payment = new Give_Payment($payment_id);
1362 1362
 
1363 1363
 	return $payment->transaction_id;
1364 1364
 }
@@ -1373,15 +1373,15 @@  discard block
 block discarded – undo
1373 1373
  *
1374 1374
  * @return bool|mixed
1375 1375
  */
1376
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1376
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1377 1377
 
1378
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1378
+	if (empty($payment_id) || empty($transaction_id)) {
1379 1379
 		return false;
1380 1380
 	}
1381 1381
 
1382
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1382
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1383 1383
 
1384
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1384
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1385 1385
 }
1386 1386
 
1387 1387
 /**
@@ -1394,12 +1394,12 @@  discard block
 block discarded – undo
1394 1394
  *
1395 1395
  * @return int $purchase Donation ID.
1396 1396
  */
1397
-function give_get_purchase_id_by_key( $key ) {
1397
+function give_get_purchase_id_by_key($key) {
1398 1398
 	global $wpdb;
1399 1399
 
1400
-	$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 ) );
1400
+	$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));
1401 1401
 
1402
-	if ( $purchase != null ) {
1402
+	if ($purchase != null) {
1403 1403
 		return $purchase;
1404 1404
 	}
1405 1405
 
@@ -1417,12 +1417,12 @@  discard block
 block discarded – undo
1417 1417
  *
1418 1418
  * @return int $purchase Donation ID.
1419 1419
  */
1420
-function give_get_purchase_id_by_transaction_id( $key ) {
1420
+function give_get_purchase_id_by_transaction_id($key) {
1421 1421
 	global $wpdb;
1422 1422
 
1423
-	$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 ) );
1423
+	$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));
1424 1424
 
1425
-	if ( $purchase != null ) {
1425
+	if ($purchase != null) {
1426 1426
 		return $purchase;
1427 1427
 	}
1428 1428
 
@@ -1439,19 +1439,19 @@  discard block
 block discarded – undo
1439 1439
  *
1440 1440
  * @return array $notes Donation Notes
1441 1441
  */
1442
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1442
+function give_get_payment_notes($payment_id = 0, $search = '') {
1443 1443
 
1444
-	if ( empty( $payment_id ) && empty( $search ) ) {
1444
+	if (empty($payment_id) && empty($search)) {
1445 1445
 		return false;
1446 1446
 	}
1447 1447
 
1448
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1449
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1448
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1449
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1450 1450
 
1451
-	$notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) );
1451
+	$notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search));
1452 1452
 
1453
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1454
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1453
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1454
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1455 1455
 
1456 1456
 	return $notes;
1457 1457
 }
@@ -1467,8 +1467,8 @@  discard block
 block discarded – undo
1467 1467
  *
1468 1468
  * @return int The new note ID
1469 1469
  */
1470
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1471
-	if ( empty( $payment_id ) ) {
1470
+function give_insert_payment_note($payment_id = 0, $note = '') {
1471
+	if (empty($payment_id)) {
1472 1472
 		return false;
1473 1473
 	}
1474 1474
 
@@ -1480,14 +1480,14 @@  discard block
 block discarded – undo
1480 1480
 	 * @param int    $payment_id Payment ID.
1481 1481
 	 * @param string $note       The note.
1482 1482
 	 */
1483
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1483
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1484 1484
 
1485
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1485
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1486 1486
 		'comment_post_ID'      => $payment_id,
1487 1487
 		'comment_content'      => $note,
1488 1488
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1489
-		'comment_date'         => current_time( 'mysql' ),
1490
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1489
+		'comment_date'         => current_time('mysql'),
1490
+		'comment_date_gmt'     => current_time('mysql', 1),
1491 1491
 		'comment_approved'     => 1,
1492 1492
 		'comment_parent'       => 0,
1493 1493
 		'comment_author'       => '',
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 		'comment_author_email' => '',
1497 1497
 		'comment_type'         => 'give_payment_note',
1498 1498
 
1499
-	) ) );
1499
+	)));
1500 1500
 
1501 1501
 	/**
1502 1502
 	 * Fires after payment note inserted.
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 	 * @param int    $payment_id Payment ID.
1508 1508
 	 * @param string $note       The note.
1509 1509
 	 */
1510
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1510
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1511 1511
 
1512 1512
 	return $note_id;
1513 1513
 }
@@ -1522,8 +1522,8 @@  discard block
 block discarded – undo
1522 1522
  *
1523 1523
  * @return bool True on success, false otherwise.
1524 1524
  */
1525
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1526
-	if ( empty( $comment_id ) ) {
1525
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1526
+	if (empty($comment_id)) {
1527 1527
 		return false;
1528 1528
 	}
1529 1529
 
@@ -1535,9 +1535,9 @@  discard block
 block discarded – undo
1535 1535
 	 * @param int $comment_id Note ID.
1536 1536
 	 * @param int $payment_id Payment ID.
1537 1537
 	 */
1538
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1538
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1539 1539
 
1540
-	$ret = wp_delete_comment( $comment_id, true );
1540
+	$ret = wp_delete_comment($comment_id, true);
1541 1541
 
1542 1542
 	/**
1543 1543
 	 * Fires after donation note deleted.
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
 	 * @param int $comment_id Note ID.
1548 1548
 	 * @param int $payment_id Payment ID.
1549 1549
 	 */
1550
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1550
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1551 1551
 
1552 1552
 	return $ret;
1553 1553
 }
@@ -1562,34 +1562,34 @@  discard block
 block discarded – undo
1562 1562
  *
1563 1563
  * @return string
1564 1564
  */
1565
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1565
+function give_get_payment_note_html($note, $payment_id = 0) {
1566 1566
 
1567
-	if ( is_numeric( $note ) ) {
1568
-		$note = get_comment( $note );
1567
+	if (is_numeric($note)) {
1568
+		$note = get_comment($note);
1569 1569
 	}
1570 1570
 
1571
-	if ( ! empty( $note->user_id ) ) {
1572
-		$user = get_userdata( $note->user_id );
1571
+	if ( ! empty($note->user_id)) {
1572
+		$user = get_userdata($note->user_id);
1573 1573
 		$user = $user->display_name;
1574 1574
 	} else {
1575
-		$user = esc_html__( 'System', 'give' );
1575
+		$user = esc_html__('System', 'give');
1576 1576
 	}
1577 1577
 
1578
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1578
+	$date_format = give_date_format().', '.get_option('time_format');
1579 1579
 
1580
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1580
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1581 1581
 		'give-action' => 'delete_payment_note',
1582 1582
 		'note_id'     => $note->comment_ID,
1583 1583
 		'payment_id'  => $payment_id,
1584
-	) ),
1585
-		'give_delete_payment_note_' . $note->comment_ID
1584
+	)),
1585
+		'give_delete_payment_note_'.$note->comment_ID
1586 1586
 	);
1587 1587
 
1588
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1588
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1589 1589
 	$note_html .= '<p>';
1590
-	$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/>';
1590
+	$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/>';
1591 1591
 	$note_html .= $note->comment_content;
1592
-	$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>';
1592
+	$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>';
1593 1593
 	$note_html .= '</p>';
1594 1594
 	$note_html .= '</div>';
1595 1595
 
@@ -1607,18 +1607,18 @@  discard block
 block discarded – undo
1607 1607
  *
1608 1608
  * @return void
1609 1609
  */
1610
-function give_hide_payment_notes( $query ) {
1611
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1612
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1613
-		if ( ! is_array( $types ) ) {
1614
-			$types = array( $types );
1610
+function give_hide_payment_notes($query) {
1611
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1612
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1613
+		if ( ! is_array($types)) {
1614
+			$types = array($types);
1615 1615
 		}
1616 1616
 		$types[]                           = 'give_payment_note';
1617 1617
 		$query->query_vars['type__not_in'] = $types;
1618 1618
 	}
1619 1619
 }
1620 1620
 
1621
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1621
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1622 1622
 
1623 1623
 /**
1624 1624
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1630,15 +1630,15 @@  discard block
 block discarded – undo
1630 1630
  *
1631 1631
  * @return array $clauses Updated comment clauses.
1632 1632
  */
1633
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1634
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1633
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1634
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1635 1635
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1636 1636
 	}
1637 1637
 
1638 1638
 	return $clauses;
1639 1639
 }
1640 1640
 
1641
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1641
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1642 1642
 
1643 1643
 
1644 1644
 /**
@@ -1651,15 +1651,15 @@  discard block
 block discarded – undo
1651 1651
  *
1652 1652
  * @return string $where
1653 1653
  */
1654
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1654
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1655 1655
 	global $wpdb;
1656 1656
 
1657
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1657
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1658 1658
 
1659 1659
 	return $where;
1660 1660
 }
1661 1661
 
1662
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1662
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1663 1663
 
1664 1664
 
1665 1665
 /**
@@ -1673,32 +1673,32 @@  discard block
 block discarded – undo
1673 1673
  *
1674 1674
  * @return array Array of comment counts.
1675 1675
  */
1676
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1676
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1677 1677
 	global $wpdb, $pagenow;
1678 1678
 
1679
-	if ( 'index.php' != $pagenow ) {
1679
+	if ('index.php' != $pagenow) {
1680 1680
 		return $stats;
1681 1681
 	}
1682 1682
 
1683 1683
 	$post_id = (int) $post_id;
1684 1684
 
1685
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1685
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1686 1686
 		return $stats;
1687 1687
 	}
1688 1688
 
1689
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1689
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1690 1690
 
1691
-	if ( false !== $stats ) {
1691
+	if (false !== $stats) {
1692 1692
 		return $stats;
1693 1693
 	}
1694 1694
 
1695 1695
 	$where = 'WHERE comment_type != "give_payment_note"';
1696 1696
 
1697
-	if ( $post_id > 0 ) {
1698
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1697
+	if ($post_id > 0) {
1698
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1699 1699
 	}
1700 1700
 
1701
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1701
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1702 1702
 
1703 1703
 	$total    = 0;
1704 1704
 	$approved = array(
@@ -1708,30 +1708,30 @@  discard block
 block discarded – undo
1708 1708
 		'trash'        => 'trash',
1709 1709
 		'post-trashed' => 'post-trashed',
1710 1710
 	);
1711
-	foreach ( (array) $count as $row ) {
1711
+	foreach ((array) $count as $row) {
1712 1712
 		// Don't count post-trashed toward totals.
1713
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1713
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1714 1714
 			$total += $row['num_comments'];
1715 1715
 		}
1716
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1717
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1716
+		if (isset($approved[$row['comment_approved']])) {
1717
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1718 1718
 		}
1719 1719
 	}
1720 1720
 
1721 1721
 	$stats['total_comments'] = $total;
1722
-	foreach ( $approved as $key ) {
1723
-		if ( empty( $stats[ $key ] ) ) {
1724
-			$stats[ $key ] = 0;
1722
+	foreach ($approved as $key) {
1723
+		if (empty($stats[$key])) {
1724
+			$stats[$key] = 0;
1725 1725
 		}
1726 1726
 	}
1727 1727
 
1728 1728
 	$stats = (object) $stats;
1729
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1729
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1730 1730
 
1731 1731
 	return $stats;
1732 1732
 }
1733 1733
 
1734
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1734
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1735 1735
 
1736 1736
 
1737 1737
 /**
@@ -1744,9 +1744,9 @@  discard block
 block discarded – undo
1744 1744
  *
1745 1745
  * @return string $where Modified where clause.
1746 1746
  */
1747
-function give_filter_where_older_than_week( $where = '' ) {
1747
+function give_filter_where_older_than_week($where = '') {
1748 1748
 	// Payments older than one week.
1749
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1749
+	$start = date('Y-m-d', strtotime('-7 days'));
1750 1750
 	$where .= " AND post_date <= '{$start}'";
1751 1751
 
1752 1752
 	return $where;
@@ -1766,35 +1766,35 @@  discard block
 block discarded – undo
1766 1766
  *
1767 1767
  * @return string $form_title Returns the full title if $level_title false, otherwise returns the levels title.
1768 1768
  */
1769
-function give_get_payment_form_title( $payment_meta, $level_title = false, $separator = '' ) {
1769
+function give_get_payment_form_title($payment_meta, $level_title = false, $separator = '') {
1770 1770
 
1771
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1772
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1773
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1771
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1772
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1773
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1774 1774
 
1775
-	if ( $level_title == true ) {
1775
+	if ($level_title == true) {
1776 1776
 		$form_title = '';
1777 1777
 	}
1778 1778
 
1779
-	if ( give_has_variable_prices( $form_id ) ) {
1779
+	if (give_has_variable_prices($form_id)) {
1780 1780
 
1781
-		if ( ! empty( $separator ) ) {
1782
-			$form_title .= ' ' . $separator;
1781
+		if ( ! empty($separator)) {
1782
+			$form_title .= ' '.$separator;
1783 1783
 		}
1784 1784
 		$form_title .= ' <span class="donation-level-text-wrap">';
1785 1785
 
1786
-		if ( $price_id == 'custom' ) {
1787
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
1788
-			$form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' );
1786
+		if ($price_id == 'custom') {
1787
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
1788
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give');
1789 1789
 		} else {
1790
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1790
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1791 1791
 		}
1792 1792
 
1793 1793
 		$form_title .= '</span>';
1794 1794
 
1795 1795
 	}
1796 1796
 
1797
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1797
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1798 1798
 
1799 1799
 }
1800 1800
 
@@ -1808,20 +1808,20 @@  discard block
 block discarded – undo
1808 1808
  *
1809 1809
  * @return string $price_id
1810 1810
  */
1811
-function give_get_price_id( $form_id, $price ) {
1811
+function give_get_price_id($form_id, $price) {
1812 1812
 
1813 1813
 	$price_id = 0;
1814 1814
 
1815
-	if ( give_has_variable_prices( $form_id ) ) {
1815
+	if (give_has_variable_prices($form_id)) {
1816 1816
 
1817
-		$levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1817
+		$levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1818 1818
 
1819
-		foreach ( $levels as $level ) {
1819
+		foreach ($levels as $level) {
1820 1820
 
1821
-			$level_amount = (float) give_sanitize_amount( $level['_give_amount'] );
1821
+			$level_amount = (float) give_sanitize_amount($level['_give_amount']);
1822 1822
 
1823 1823
 			// Check that this indeed the recurring price.
1824
-			if ( $level_amount == $price ) {
1824
+			if ($level_amount == $price) {
1825 1825
 
1826 1826
 				$price_id = $level['_give_id']['level_id'];
1827 1827
 
@@ -1846,10 +1846,10 @@  discard block
 block discarded – undo
1846 1846
  *
1847 1847
  * @return string|void
1848 1848
  */
1849
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1850
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1849
+function give_get_form_dropdown($args = array(), $echo = false) {
1850
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1851 1851
 
1852
-	if ( ! $echo ) {
1852
+	if ( ! $echo) {
1853 1853
 		return $form_dropdown_html;
1854 1854
 	}
1855 1855
 
@@ -1866,17 +1866,17 @@  discard block
 block discarded – undo
1866 1866
  *
1867 1867
  * @return string|void
1868 1868
  */
1869
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1869
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1870 1870
 
1871 1871
 	// Check for give form id.
1872
-	if ( empty( $args['id'] ) ) {
1872
+	if (empty($args['id'])) {
1873 1873
 		return false;
1874 1874
 	}
1875 1875
 
1876
-	$form = new Give_Donate_Form( $args['id'] );
1876
+	$form = new Give_Donate_Form($args['id']);
1877 1877
 
1878 1878
 	// Check if form has variable prices or not.
1879
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1879
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1880 1880
 		return false;
1881 1881
 	}
1882 1882
 
@@ -1884,22 +1884,22 @@  discard block
 block discarded – undo
1884 1884
 	$variable_price_options = array();
1885 1885
 
1886 1886
 	// Check if multi donation form support custom donation or not.
1887
-	if ( $form->is_custom_price_mode() ) {
1888
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1887
+	if ($form->is_custom_price_mode()) {
1888
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1889 1889
 	}
1890 1890
 
1891 1891
 	// Get variable price and ID from variable price array.
1892
-	foreach ( $variable_prices as $variable_price ) {
1893
-		$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'] ) );
1892
+	foreach ($variable_prices as $variable_price) {
1893
+		$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']));
1894 1894
 	}
1895 1895
 
1896 1896
 	// Update options.
1897
-	$args = array_merge( $args, array( 'options' => $variable_price_options ) );
1897
+	$args = array_merge($args, array('options' => $variable_price_options));
1898 1898
 
1899 1899
 	// Generate select html.
1900
-	$form_dropdown_html = Give()->html->select( $args );
1900
+	$form_dropdown_html = Give()->html->select($args);
1901 1901
 
1902
-	if ( ! $echo ) {
1902
+	if ( ! $echo) {
1903 1903
 		return $form_dropdown_html;
1904 1904
 	}
1905 1905
 
Please login to merge, or discard this patch.