Completed
Pull Request — master (#1686)
by
unknown
23:17
created
includes/ajax-functions.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
 function give_test_ajax_works() {
27 27
 
28 28
 	// Check if the Airplane Mode plugin is installed
29
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31 31
 		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-		if ( method_exists( $airplane, 'enabled' ) ) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-			if ( $airplane->enabled() ) {
35
+			if ($airplane->enabled()) {
36 36
 				return true;
37 37
 			}
38 38
 		} else {
39 39
 
40
-			if ( $airplane->check_status() == 'on' ) {
40
+			if ($airplane->check_status() == 'on') {
41 41
 				return true;
42 42
 			}
43 43
 		}
44 44
 	}
45 45
 
46
-	add_filter( 'block_local_requests', '__return_false' );
46
+	add_filter('block_local_requests', '__return_false');
47 47
 
48
-	if ( Give_Cache::get( '_give_ajax_works', true ) ) {
48
+	if (Give_Cache::get('_give_ajax_works', true)) {
49 49
 		return true;
50 50
 	}
51 51
 
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 		),
58 58
 	);
59 59
 
60
-	$ajax = wp_remote_post( give_get_ajax_url(), $params );
60
+	$ajax = wp_remote_post(give_get_ajax_url(), $params);
61 61
 
62 62
 	$works = true;
63 63
 
64
-	if ( is_wp_error( $ajax ) ) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66 66
 		$works = false;
67 67
 
68 68
 	} else {
69 69
 
70
-		if ( empty( $ajax['response'] ) ) {
70
+		if (empty($ajax['response'])) {
71 71
 			$works = false;
72 72
 		}
73 73
 
74
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
74
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
 			$works = false;
76 76
 		}
77 77
 
78
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79 79
 			$works = false;
80 80
 		}
81 81
 
82
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
82
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
 			$works = false;
84 84
 		}
85 85
 	}
86 86
 
87
-	if ( $works ) {
88
-		Give_Cache::set( '_give_ajax_works', '1', DAY_IN_SECONDS, true );
87
+	if ($works) {
88
+		Give_Cache::set('_give_ajax_works', '1', DAY_IN_SECONDS, true);
89 89
 	}
90 90
 
91 91
 	return $works;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
  * @return string
101 101
  */
102 102
 function give_get_ajax_url() {
103
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
103
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
104 104
 
105 105
 	$current_url = give_get_current_page_url();
106
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
106
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
107 107
 
108
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
109
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
108
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
109
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
110 110
 	}
111 111
 
112
-	return apply_filters( 'give_ajax_url', $ajax_url );
112
+	return apply_filters('give_ajax_url', $ajax_url);
113 113
 }
114 114
 
115 115
 /**
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @since 1.7
127 127
 	 */
128
-	do_action( 'give_donation_form_login_fields' );
128
+	do_action('give_donation_form_login_fields');
129 129
 
130 130
 	give_die();
131 131
 }
132 132
 
133
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
133
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
134 134
 
135 135
 /**
136 136
  * Load Checkout Fields
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * @return void
141 141
  */
142 142
 function give_load_checkout_fields() {
143
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
143
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
144 144
 
145 145
 	ob_start();
146 146
 
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @since 1.7
151 151
 	 */
152
-	do_action( 'give_donation_form_register_login_fields', $form_id );
152
+	do_action('give_donation_form_register_login_fields', $form_id);
153 153
 
154 154
 	$fields = ob_get_clean();
155 155
 
156
-	wp_send_json( array(
157
-		'fields' => wp_json_encode( $fields ),
158
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
159
-	) );
156
+	wp_send_json(array(
157
+		'fields' => wp_json_encode($fields),
158
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
159
+	));
160 160
 }
161 161
 
162
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
163
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
162
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
163
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
164 164
 
165 165
 /**
166 166
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
  * @return void
171 171
  */
172 172
 function give_ajax_get_form_title() {
173
-	if ( isset( $_POST['form_id'] ) ) {
174
-		$title = get_the_title( $_POST['form_id'] );
175
-		if ( $title ) {
173
+	if (isset($_POST['form_id'])) {
174
+		$title = get_the_title($_POST['form_id']);
175
+		if ($title) {
176 176
 			echo $title;
177 177
 		} else {
178 178
 			echo 'fail';
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	give_die();
182 182
 }
183 183
 
184
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
185
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
184
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
185
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
186 186
 
187 187
 /**
188 188
  * Retrieve a states drop down
@@ -193,23 +193,23 @@  discard block
 block discarded – undo
193 193
  */
194 194
 function give_ajax_get_states_field() {
195 195
 
196
-	if ( empty( $_POST['country'] ) ) {
196
+	if (empty($_POST['country'])) {
197 197
 		$_POST['country'] = give_get_country();
198 198
 	}
199
-	$states = give_get_states( $_POST['country'] );
199
+	$states = give_get_states($_POST['country']);
200 200
 
201
-	if ( ! empty( $states ) ) {
201
+	if ( ! empty($states)) {
202 202
 
203 203
 		$args = array(
204 204
 			'name'             => $_POST['field_name'],
205 205
 			'id'               => $_POST['field_name'],
206
-			'class'            => $_POST['field_name'] . '  give-select',
207
-			'options'          => give_get_states( $_POST['country'] ),
206
+			'class'            => $_POST['field_name'].'  give-select',
207
+			'options'          => give_get_states($_POST['country']),
208 208
 			'show_option_all'  => false,
209 209
 			'show_option_none' => false,
210 210
 		);
211 211
 
212
-		$response = Give()->html->select( $args );
212
+		$response = Give()->html->select($args);
213 213
 
214 214
 	} else {
215 215
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	give_die();
222 222
 }
223 223
 
224
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
225
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
224
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
225
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
226 226
 
227 227
 /**
228 228
  * Retrieve a states drop down
@@ -234,17 +234,17 @@  discard block
 block discarded – undo
234 234
 function give_ajax_form_search() {
235 235
 	global $wpdb;
236 236
 
237
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
237
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
238 238
 	$results = array();
239
-	if ( current_user_can( 'edit_give_forms' ) ) {
240
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
239
+	if (current_user_can('edit_give_forms')) {
240
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
241 241
 	} else {
242
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
242
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
243 243
 	}
244 244
 
245
-	if ( $items ) {
245
+	if ($items) {
246 246
 
247
-		foreach ( $items as $item ) {
247
+		foreach ($items as $item) {
248 248
 
249 249
 			$results[] = array(
250 250
 				'id'   => $item->ID,
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$items[] = array(
257 257
 			'id'   => 0,
258
-			'name' => esc_html__( 'No forms found.', 'give' ),
258
+			'name' => esc_html__('No forms found.', 'give'),
259 259
 		);
260 260
 
261 261
 	}
262 262
 
263
-	echo json_encode( $results );
263
+	echo json_encode($results);
264 264
 
265 265
 	give_die();
266 266
 }
267 267
 
268
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
269
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
268
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
269
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
270 270
 
271 271
 /**
272 272
  * Search the donors database via Ajax
@@ -278,38 +278,38 @@  discard block
 block discarded – undo
278 278
 function give_ajax_donor_search() {
279 279
 	global $wpdb;
280 280
 
281
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
281
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
282 282
 	$results = array();
283
-	if ( ! current_user_can( 'view_give_reports' ) ) {
283
+	if ( ! current_user_can('view_give_reports')) {
284 284
 		$donors = array();
285 285
 	} else {
286
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
286
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
287 287
 	}
288 288
 
289
-	if ( $donors ) {
289
+	if ($donors) {
290 290
 
291
-		foreach ( $donors as $donor ) {
291
+		foreach ($donors as $donor) {
292 292
 
293 293
 			$results[] = array(
294 294
 				'id'   => $donor->id,
295
-				'name' => $donor->name . '(' . $donor->email . ')',
295
+				'name' => $donor->name.'('.$donor->email.')',
296 296
 			);
297 297
 		}
298 298
 	} else {
299 299
 
300 300
 		$donors[] = array(
301 301
 			'id'   => 0,
302
-			'name' => esc_html__( 'No donors found.', 'give' ),
302
+			'name' => esc_html__('No donors found.', 'give'),
303 303
 		);
304 304
 
305 305
 	}
306 306
 
307
-	echo json_encode( $results );
307
+	echo json_encode($results);
308 308
 
309 309
 	give_die();
310 310
 }
311 311
 
312
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
312
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
313 313
 
314 314
 
315 315
 /**
@@ -321,42 +321,42 @@  discard block
 block discarded – undo
321 321
  */
322 322
 function give_ajax_search_users() {
323 323
 
324
-	if ( current_user_can( 'manage_give_settings' ) ) {
324
+	if (current_user_can('manage_give_settings')) {
325 325
 
326
-		$search_query = trim( $_POST['user_name'] );
327
-		$exclude      = trim( $_POST['exclude'] );
326
+		$search_query = trim($_POST['user_name']);
327
+		$exclude      = trim($_POST['exclude']);
328 328
 
329 329
 		$get_users_args = array(
330 330
 			'number' => 9999,
331
-			'search' => $search_query . '*',
331
+			'search' => $search_query.'*',
332 332
 		);
333 333
 
334
-		if ( ! empty( $exclude ) ) {
335
-			$exclude_array             = explode( ',', $exclude );
334
+		if ( ! empty($exclude)) {
335
+			$exclude_array             = explode(',', $exclude);
336 336
 			$get_users_args['exclude'] = $exclude_array;
337 337
 		}
338 338
 
339
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
339
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
340 340
 
341
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
341
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
342 342
 
343 343
 		$user_list = '<ul>';
344
-		if ( $found_users ) {
345
-			foreach ( $found_users as $user ) {
346
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
344
+		if ($found_users) {
345
+			foreach ($found_users as $user) {
346
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
347 347
 			}
348 348
 		} else {
349
-			$user_list .= '<li>' . esc_html__( 'No users found.', 'give' ) . '</li>';
349
+			$user_list .= '<li>'.esc_html__('No users found.', 'give').'</li>';
350 350
 		}
351 351
 		$user_list .= '</ul>';
352 352
 
353
-		echo json_encode( array( 'results' => $user_list ) );
353
+		echo json_encode(array('results' => $user_list));
354 354
 
355 355
 	}
356 356
 	die();
357 357
 }
358 358
 
359
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
359
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
360 360
 
361 361
 
362 362
 /**
@@ -368,32 +368,32 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function give_check_for_form_price_variations() {
370 370
 
371
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
372
-		die( '-1' );
371
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
372
+		die('-1');
373 373
 	}
374 374
 
375
-	$form_id = intval( $_POST['form_id'] );
376
-	$form    = get_post( $form_id );
375
+	$form_id = intval($_POST['form_id']);
376
+	$form    = get_post($form_id);
377 377
 
378
-	if ( 'give_forms' != $form->post_type ) {
379
-		die( '-2' );
378
+	if ('give_forms' != $form->post_type) {
379
+		die('-2');
380 380
 	}
381 381
 
382
-	if ( give_has_variable_prices( $form_id ) ) {
383
-		$variable_prices = give_get_variable_prices( $form_id );
382
+	if (give_has_variable_prices($form_id)) {
383
+		$variable_prices = give_get_variable_prices($form_id);
384 384
 
385
-		if ( $variable_prices ) {
385
+		if ($variable_prices) {
386 386
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
387 387
 
388
-			if ( isset( $_POST['all_prices'] ) ) {
389
-				$ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>';
388
+			if (isset($_POST['all_prices'])) {
389
+				$ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>';
390 390
 			}
391 391
 
392
-			foreach ( $variable_prices as $key => $price ) {
392
+			foreach ($variable_prices as $key => $price) {
393 393
 
394
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
394
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
395 395
 
396
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
396
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
397 397
 			}
398 398
 			$ajax_response .= '</select>';
399 399
 			echo $ajax_response;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	give_die();
404 404
 }
405 405
 
406
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
406
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
407 407
 
408 408
 
409 409
 /**
@@ -414,25 +414,25 @@  discard block
 block discarded – undo
414 414
  * @return void
415 415
  */
416 416
 function give_check_for_form_price_variations_html() {
417
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
417
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
418 418
 		wp_die();
419 419
 	}
420 420
 
421
-	$form_id    = ! empty( $_POST['form_id']  ) ? intval( $_POST['form_id'] ) : 0;
422
-	$payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : 0;
423
-	$form       = get_post( $form_id );
421
+	$form_id    = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : 0;
422
+	$payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : 0;
423
+	$form       = get_post($form_id);
424 424
 
425
-	if ( 'give_forms' != $form->post_type ) {
425
+	if ('give_forms' != $form->post_type) {
426 426
 		wp_die();
427 427
 	}
428 428
 
429
-	if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) {
430
-		esc_html_e( 'n/a', 'give' );
429
+	if ( ! give_has_variable_prices($form_id) || ! $form_id) {
430
+		esc_html_e('n/a', 'give');
431 431
 	} else {
432 432
 		$prices_atts = '';
433
-		if( $variable_prices = give_get_variable_prices( $form_id ) ) {
434
-			foreach ( $variable_prices as $variable_price ) {
435
-				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] );
433
+		if ($variable_prices = give_get_variable_prices($form_id)) {
434
+			foreach ($variable_prices as $variable_price) {
435
+				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']);
436 436
 			}
437 437
 		}
438 438
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 			'chosen'           => true,
444 444
 			'show_option_all'  => '',
445 445
 			'show_option_none' => '',
446
-			'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
446
+			'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
447 447
 		);
448 448
 
449
-		if( $payment_id ) {
449
+		if ($payment_id) {
450 450
 			// Payment object.
451
-			$payment = new Give_Payment( $payment_id );
451
+			$payment = new Give_Payment($payment_id);
452 452
 
453 453
 			// Payment meta.
454 454
 			$payment_meta = $payment->get_meta();
@@ -456,10 +456,10 @@  discard block
 block discarded – undo
456 456
 		}
457 457
 
458 458
 		// Render variable prices select tag html.
459
-		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
459
+		give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
460 460
 	}
461 461
 
462 462
 	give_die();
463 463
 }
464 464
 
465
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
465
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
59
-			'ajax'     => false,// Does this table support ajax?
60
-		) );
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59
+			'ajax'     => false, // Does this table support ajax?
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250
-		<?php wp_nonce_field( 'give-api-nonce' ); ?>
250
+		<?php wp_nonce_field('give-api-nonce'); ?>
251 251
 		<?php echo Give()->html->ajax_user_search(); ?>
252
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
252
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
253 253
 		<?php
254 254
 		$give_api_is_bottom = true;
255 255
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int Current page number
263 263
 	 */
264 264
 	public function get_paged() {
265
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
265
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
266 266
 	}
267 267
 
268 268
 	/**
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
 	 * @return array
274 274
 	 */
275 275
 	public function query() {
276
-		$users = get_users( array(
276
+		$users = get_users(array(
277 277
 			'meta_value' => 'give_user_secret_key',
278 278
 			'number'     => $this->per_page,
279
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
280
-		) );
281
-		$keys  = array();
282
-
283
-		foreach ( $users as $user ) {
284
-			$keys[ $user->ID ]['id']    = $user->ID;
285
-			$keys[ $user->ID ]['email'] = $user->user_email;
286
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
287
-
288
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
289
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
290
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
279
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
280
+		));
281
+		$keys = array();
282
+
283
+		foreach ($users as $user) {
284
+			$keys[$user->ID]['id']    = $user->ID;
285
+			$keys[$user->ID]['email'] = $user->user_email;
286
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
287
+
288
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
289
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
290
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
291 291
 		}
292 292
 
293 293
 		return $keys;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	public function total_items() {
305 305
 		global $wpdb;
306 306
 
307
-		if ( ! ( $total_items = Give_Cache::get( 'give_total_api_keys', true ) ) ) {
307
+		if ( ! ($total_items = Give_Cache::get('give_total_api_keys', true))) {
308 308
 			$total_items = $wpdb->get_var(
309 309
 				$wpdb->prepare(
310 310
 					"SELECT count(user_id)
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				)
314 314
 			);
315 315
 
316
-			Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true );
316
+			Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true);
317 317
 		}
318 318
 
319 319
 		return $total_items;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		$hidden   = array(); // No hidden columns
333 333
 		$sortable = array(); // Not sortable... for now
334 334
 
335
-		$this->_column_headers = array( $columns, $hidden, $sortable );
335
+		$this->_column_headers = array($columns, $hidden, $sortable);
336 336
 
337 337
 		$data = $this->query();
338 338
 
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 
341 341
 		$this->items = $data;
342 342
 
343
-		$this->set_pagination_args( array(
343
+		$this->set_pagination_args(array(
344 344
 				'total_items' => $total_items,
345 345
 				'per_page'    => $this->per_page,
346
-				'total_pages' => ceil( $total_items / $this->per_page ),
346
+				'total_pages' => ceil($total_items / $this->per_page),
347 347
 			)
348 348
 		);
349 349
 	}
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,20 +48,20 @@  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        = Give_Cache::get( 'give_add_ons_feed', true );
51
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
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
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
56
+		if ( ! is_wp_error($feed)) {
57
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
58
+				$cache = wp_remote_retrieve_body($feed);
59
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
60 60
 			}
61 61
 		} else {
62 62
 			$cache = sprintf(
63 63
 				'<div class="error"><p>%s</p></div>',
64
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
64
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
65 65
 			);
66 66
 		}
67 67
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +181 added lines, -181 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
 
@@ -25,39 +25,39 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 	}
53 53
 
54
-	if ( $did_upgrade ) {
55
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
54
+	if ($did_upgrade) {
55
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
56 56
 	}
57 57
 }
58 58
 
59
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
60
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
59
+add_action('admin_init', 'give_do_automatic_upgrades');
60
+add_action('give_upgrades', 'give_do_automatic_upgrades');
61 61
 
62 62
 /**
63 63
  * Display Upgrade Notices
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function give_show_upgrade_notices() {
69 69
 	// Don't show notices on the upgrades page.
70
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
70
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
71 71
 		return;
72 72
 	}
73 73
 
74
-	$give_version = get_option( 'give_version' );
74
+	$give_version = get_option('give_version');
75 75
 
76
-	if ( ! $give_version ) {
76
+	if ( ! $give_version) {
77 77
 		// 1.0 is the first version to use this option so we must add it.
78 78
 		$give_version = '1.0';
79 79
 	}
80 80
 
81
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
81
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
82 82
 
83 83
 	/*
84 84
 	 *  NOTICE:
@@ -89,31 +89,31 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 
91 91
 	// v1.3.2 Upgrades
92
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
92
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
93 93
 		printf(
94 94
 			/* translators: %s: upgrade URL */
95
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
96
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
95
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
96
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
97 97
 		);
98 98
 	}
99 99
 
100 100
 	// v1.3.4 Upgrades //ensure the user has gone through 1.3.4.
101
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
101
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
102 102
 		printf(
103 103
 			/* translators: %s: upgrade URL */
104
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
105
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
104
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
105
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
106 106
 		);
107 107
 	}
108 108
 
109 109
 	// Check if we have a stalled upgrade.
110 110
 	$resume_upgrade = give_maybe_resume_upgrade();
111
-	if ( ! empty( $resume_upgrade ) ) {
112
-		$resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) );
111
+	if ( ! empty($resume_upgrade)) {
112
+		$resume_url = add_query_arg($resume_upgrade, admin_url('index.php'));
113 113
 		echo Give_Notices::notice_html(
114 114
 			sprintf(
115
-				__( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ),
116
-				esc_url( $resume_url )
115
+				__('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'),
116
+				esc_url($resume_url)
117 117
 			)
118 118
 		);
119 119
 
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	// v1.8 form metadata upgrades.
124
-	if ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) {
124
+	if (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) {
125 125
 		echo Give_Notices::notice_html(
126 126
 			sprintf(
127
-				esc_html__( 'Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give' ),
128
-				'<a class="give-upgrade-link" href="' . esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) . '">',
127
+				esc_html__('Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give'),
128
+				'<a class="give-upgrade-link" href="'.esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')).'">',
129 129
 				'</a>'
130 130
 			)
131 131
 		);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				$upgrade_links.on( 'click', function(e){
141 141
 					e.preventDefault();
142 142
 
143
-					if( ! window.confirm( '<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>' ) ) {
143
+					if( ! window.confirm( '<?php _e('Please make sure to create a database backup before initiating the upgrade.', 'give'); ?>' ) ) {
144 144
 						return;
145 145
 					}
146 146
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	<?php
154 154
 }
155 155
 
156
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
156
+add_action('admin_notices', 'give_show_upgrade_notices');
157 157
 
158 158
 /**
159 159
  * Triggers all upgrade functions
@@ -165,29 +165,29 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function give_trigger_upgrades() {
167 167
 
168
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
169
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
168
+	if ( ! current_user_can('manage_give_settings')) {
169
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
170 170
 			'response' => 403,
171
-		) );
171
+		));
172 172
 	}
173 173
 
174
-	$give_version = get_option( 'give_version' );
174
+	$give_version = get_option('give_version');
175 175
 
176
-	if ( ! $give_version ) {
176
+	if ( ! $give_version) {
177 177
 		// 1.0 is the first version to use this option so we must add it.
178 178
 		$give_version = '1.0';
179
-		add_option( 'give_version', $give_version );
179
+		add_option('give_version', $give_version);
180 180
 	}
181 181
 
182
-	update_option( 'give_version', GIVE_VERSION );
183
-	delete_option( 'give_doing_upgrade' );
182
+	update_option('give_version', GIVE_VERSION);
183
+	delete_option('give_doing_upgrade');
184 184
 
185
-	if ( DOING_AJAX ) {
186
-		die( 'complete' );
185
+	if (DOING_AJAX) {
186
+		die('complete');
187 187
 	} // End if().
188 188
 }
189 189
 
190
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
190
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
191 191
 
192 192
 /**
193 193
  * Check if the upgrade routine has been run for a specific action
@@ -198,15 +198,15 @@  discard block
 block discarded – undo
198 198
  *
199 199
  * @return bool                   If the action has been added to the completed actions array
200 200
  */
201
-function give_has_upgrade_completed( $upgrade_action = '' ) {
201
+function give_has_upgrade_completed($upgrade_action = '') {
202 202
 
203
-	if ( empty( $upgrade_action ) ) {
203
+	if (empty($upgrade_action)) {
204 204
 		return false;
205 205
 	}
206 206
 
207 207
 	$completed_upgrades = give_get_completed_upgrades();
208 208
 
209
-	return in_array( $upgrade_action, $completed_upgrades );
209
+	return in_array($upgrade_action, $completed_upgrades);
210 210
 
211 211
 }
212 212
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
219 219
  */
220 220
 function give_maybe_resume_upgrade() {
221
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
222
-	if ( empty( $doing_upgrade ) ) {
221
+	$doing_upgrade = get_option('give_doing_upgrade', false);
222
+	if (empty($doing_upgrade)) {
223 223
 		return false;
224 224
 	}
225 225
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
  *
236 236
  * @return bool                   If the function was successfully added
237 237
  */
238
-function give_set_upgrade_complete( $upgrade_action = '' ) {
238
+function give_set_upgrade_complete($upgrade_action = '') {
239 239
 
240
-	if ( empty( $upgrade_action ) ) {
240
+	if (empty($upgrade_action)) {
241 241
 		return false;
242 242
 	}
243 243
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 	$completed_upgrades[] = $upgrade_action;
246 246
 
247 247
 	// Remove any blanks, and only show uniques.
248
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
248
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
249 249
 
250
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
250
+	return update_option('give_completed_upgrades', $completed_upgrades);
251 251
 }
252 252
 
253 253
 /**
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
  */
259 259
 function give_get_completed_upgrades() {
260 260
 
261
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
261
+	$completed_upgrades = get_option('give_completed_upgrades');
262 262
 
263
-	if ( false === $completed_upgrades ) {
263
+	if (false === $completed_upgrades) {
264 264
 		$completed_upgrades = array();
265 265
 	}
266 266
 
@@ -277,31 +277,31 @@  discard block
 block discarded – undo
277 277
  */
278 278
 function give_v132_upgrade_give_payment_customer_id() {
279 279
 	global $wpdb;
280
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
281
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
280
+	if ( ! current_user_can('manage_give_settings')) {
281
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
282 282
 			'response' => 403,
283
-		) );
283
+		));
284 284
 	}
285 285
 
286
-	ignore_user_abort( true );
286
+	ignore_user_abort(true);
287 287
 
288
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
289
-		@set_time_limit( 0 );
288
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
289
+		@set_time_limit(0);
290 290
 	}
291 291
 
292 292
 	// UPDATE DB METAKEYS.
293 293
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
294
-	$query = $wpdb->query( $sql );
294
+	$query = $wpdb->query($sql);
295 295
 
296
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
297
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
298
-	delete_option( 'give_doing_upgrade' );
299
-	wp_redirect( admin_url() );
296
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
297
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
298
+	delete_option('give_doing_upgrade');
299
+	wp_redirect(admin_url());
300 300
 	exit;
301 301
 
302 302
 }
303 303
 
304
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
304
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
305 305
 
306 306
 /**
307 307
  * Upgrades the Offline Status
@@ -314,16 +314,16 @@  discard block
 block discarded – undo
314 314
 
315 315
 	global $wpdb;
316 316
 
317
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
318
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
317
+	if ( ! current_user_can('manage_give_settings')) {
318
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
319 319
 			'response' => 403,
320
-		) );
320
+		));
321 321
 	}
322 322
 
323
-	ignore_user_abort( true );
323
+	ignore_user_abort(true);
324 324
 
325
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
326
-		@set_time_limit( 0 );
325
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
326
+		@set_time_limit(0);
327 327
 	}
328 328
 
329 329
 	// Get abandoned offline payments.
@@ -333,31 +333,31 @@  discard block
 block discarded – undo
333 333
 	$where .= "AND ( p.post_status = 'abandoned' )";
334 334
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
335 335
 
336
-	$sql            = $select . $join . $where;
337
-	$found_payments = $wpdb->get_col( $sql );
336
+	$sql            = $select.$join.$where;
337
+	$found_payments = $wpdb->get_col($sql);
338 338
 
339
-	foreach ( $found_payments as $payment ) {
339
+	foreach ($found_payments as $payment) {
340 340
 
341 341
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
342
-		$modified_time = get_post_modified_time( 'U', false, $payment );
342
+		$modified_time = get_post_modified_time('U', false, $payment);
343 343
 
344 344
 		// 1450124863 =  12/10/2015 20:42:25.
345
-		if ( $modified_time >= 1450124863 ) {
345
+		if ($modified_time >= 1450124863) {
346 346
 
347
-			give_update_payment_status( $payment, 'pending' );
347
+			give_update_payment_status($payment, 'pending');
348 348
 
349 349
 		}
350 350
 	}
351 351
 
352
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
353
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
354
-	delete_option( 'give_doing_upgrade' );
355
-	wp_redirect( admin_url() );
352
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
353
+	give_set_upgrade_complete('upgrade_give_offline_status');
354
+	delete_option('give_doing_upgrade');
355
+	wp_redirect(admin_url());
356 356
 	exit;
357 357
 
358 358
 }
359 359
 
360
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
360
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
361 361
 
362 362
 /**
363 363
  * Cleanup User Roles
@@ -368,17 +368,17 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function give_v152_cleanup_users() {
370 370
 
371
-	$give_version = get_option( 'give_version' );
371
+	$give_version = get_option('give_version');
372 372
 
373
-	if ( ! $give_version ) {
373
+	if ( ! $give_version) {
374 374
 		// 1.0 is the first version to use this option so we must add it.
375 375
 		$give_version = '1.0';
376 376
 	}
377 377
 
378
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
378
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
379 379
 
380 380
 	// v1.5.2 Upgrades
381
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
381
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
382 382
 
383 383
 		// Delete all caps with "ss".
384 384
 		// Also delete all unused "campaign" roles.
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 		);
426 426
 
427 427
 		global $wp_roles;
428
-		foreach ( $delete_caps as $cap ) {
429
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
430
-				$wp_roles->remove_cap( $role, $cap );
428
+		foreach ($delete_caps as $cap) {
429
+			foreach (array_keys($wp_roles->roles) as $role) {
430
+				$wp_roles->remove_cap($role, $cap);
431 431
 			}
432 432
 		}
433 433
 
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
 		$roles->add_caps();
438 438
 
439 439
 		// The Update Ran.
440
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
441
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
442
-		delete_option( 'give_doing_upgrade' );
440
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
441
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
442
+		delete_option('give_doing_upgrade');
443 443
 
444 444
 	}// End if().
445 445
 
446 446
 }
447 447
 
448
-add_action( 'admin_init', 'give_v152_cleanup_users' );
448
+add_action('admin_init', 'give_v152_cleanup_users');
449 449
 
450 450
 /**
451 451
  * 1.6 Upgrade routine to create the customer meta table.
@@ -485,53 +485,53 @@  discard block
 block discarded – undo
485 485
 
486 486
 	// Get addons license key.
487 487
 	$addons = array();
488
-	foreach ( $give_options as $key => $value ) {
489
-		if ( false !== strpos( $key, '_license_key' ) ) {
490
-			$addons[ $key ] = $value;
488
+	foreach ($give_options as $key => $value) {
489
+		if (false !== strpos($key, '_license_key')) {
490
+			$addons[$key] = $value;
491 491
 		}
492 492
 	}
493 493
 
494 494
 	// Bailout: We do not have any addon license data to upgrade.
495
-	if ( empty( $addons ) ) {
495
+	if (empty($addons)) {
496 496
 		return false;
497 497
 	}
498 498
 
499
-	foreach ( $addons as $key => $addon_license ) {
499
+	foreach ($addons as $key => $addon_license) {
500 500
 
501 501
 		// Get addon shortname.
502
-		$shortname = str_replace( '_license_key', '', $key );
502
+		$shortname = str_replace('_license_key', '', $key);
503 503
 
504 504
 		// Addon license option name.
505
-		$addon_license_option_name = $shortname . '_license_active';
505
+		$addon_license_option_name = $shortname.'_license_active';
506 506
 
507 507
 		// bailout if license is empty.
508
-		if ( empty( $addon_license ) ) {
509
-			delete_option( $addon_license_option_name );
508
+		if (empty($addon_license)) {
509
+			delete_option($addon_license_option_name);
510 510
 			continue;
511 511
 		}
512 512
 
513 513
 		// Get addon name.
514 514
 		$addon_name       = array();
515
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
516
-		foreach ( $addon_name_parts as $name_part ) {
515
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
516
+		foreach ($addon_name_parts as $name_part) {
517 517
 
518 518
 			// Fix addon name
519
-			switch ( $name_part ) {
519
+			switch ($name_part) {
520 520
 				case 'authorizenet' :
521 521
 					$name_part = 'authorize.net';
522 522
 					break;
523 523
 			}
524 524
 
525
-			$addon_name[] = ucfirst( $name_part );
525
+			$addon_name[] = ucfirst($name_part);
526 526
 		}
527 527
 
528
-		$addon_name = implode( ' ', $addon_name );
528
+		$addon_name = implode(' ', $addon_name);
529 529
 
530 530
 		// Data to send to the API
531 531
 		$api_params = array(
532 532
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
533 533
 			'license'    => $addon_license,
534
-			'item_name'  => urlencode( $addon_name ),
534
+			'item_name'  => urlencode($addon_name),
535 535
 			'url'        => home_url(),
536 536
 		);
537 537
 
@@ -546,17 +546,17 @@  discard block
 block discarded – undo
546 546
 		);
547 547
 
548 548
 		// Make sure there are no errors.
549
-		if ( is_wp_error( $response ) ) {
550
-			delete_option( $addon_license_option_name );
549
+		if (is_wp_error($response)) {
550
+			delete_option($addon_license_option_name);
551 551
 			continue;
552 552
 		}
553 553
 
554 554
 		// Tell WordPress to look for updates.
555
-		set_site_transient( 'update_plugins', null );
555
+		set_site_transient('update_plugins', null);
556 556
 
557 557
 		// Decode license data.
558
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
559
-		update_option( $addon_license_option_name, $license_data );
558
+		$license_data = json_decode(wp_remote_retrieve_body($response));
559
+		update_option($addon_license_option_name, $license_data);
560 560
 	}// End foreach().
561 561
 }
562 562
 
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 	);
587 587
 
588 588
 	global $wp_roles;
589
-	foreach ( $delete_caps as $cap ) {
590
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
591
-			$wp_roles->remove_cap( $role, $cap );
589
+	foreach ($delete_caps as $cap) {
590
+		foreach (array_keys($wp_roles->roles) as $role) {
591
+			$wp_roles->remove_cap($role, $cap);
592 592
 		}
593 593
 	}
594 594
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 function give_v18_upgrades_core_setting() {
623 623
 	// Core settings which changes from checkbox to radio.
624 624
 	$core_setting_names = array_merge(
625
-		array_keys( give_v18_renamed_core_settings() ),
625
+		array_keys(give_v18_renamed_core_settings()),
626 626
 		array(
627 627
 			'uninstall_on_delete',
628 628
 			'scripts_footer',
@@ -634,48 +634,48 @@  discard block
 block discarded – undo
634 634
 	);
635 635
 
636 636
 	// Bailout: If not any setting define.
637
-	if ( $give_settings = get_option( 'give_settings' ) ) {
637
+	if ($give_settings = get_option('give_settings')) {
638 638
 
639 639
 		$setting_changed = false;
640 640
 
641 641
 		// Loop: check each setting field.
642
-		foreach ( $core_setting_names as $setting_name ) {
642
+		foreach ($core_setting_names as $setting_name) {
643 643
 			// New setting name.
644
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
644
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
645 645
 
646 646
 			// Continue: If setting already set.
647 647
 			if (
648
-				array_key_exists( $new_setting_name, $give_settings )
649
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
648
+				array_key_exists($new_setting_name, $give_settings)
649
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
650 650
 			) {
651 651
 				continue;
652 652
 			}
653 653
 
654 654
 			// Set checkbox value to radio value.
655
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
655
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
656 656
 
657 657
 			// @see https://github.com/WordImpress/Give/issues/1063
658
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
658
+			if (false !== strpos($setting_name, 'disable_')) {
659 659
 
660
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
661
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
660
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
661
+			} elseif (false !== strpos($setting_name, 'enable_')) {
662 662
 
663
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
663
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
664 664
 			}
665 665
 
666 666
 			// Tell bot to update core setting to db.
667
-			if ( ! $setting_changed ) {
667
+			if ( ! $setting_changed) {
668 668
 				$setting_changed = true;
669 669
 			}
670 670
 		}
671 671
 
672 672
 		// Update setting only if they changed.
673
-		if ( $setting_changed ) {
674
-			update_option( 'give_settings', $give_settings );
673
+		if ($setting_changed) {
674
+			update_option('give_settings', $give_settings);
675 675
 		}
676 676
 	}// End if().
677 677
 
678
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
678
+	give_set_upgrade_complete('v18_upgrades_core_setting');
679 679
 }
680 680
 
681 681
 /**
@@ -685,22 +685,22 @@  discard block
 block discarded – undo
685 685
  * @return void
686 686
  */
687 687
 function give_v18_upgrades_form_metadata() {
688
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
689
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
688
+	if ( ! current_user_can('manage_give_settings')) {
689
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
690 690
 			'response' => 403,
691
-		) );
691
+		));
692 692
 	}
693 693
 
694
-	ignore_user_abort( true );
694
+	ignore_user_abort(true);
695 695
 
696
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
697
-		@set_time_limit( 0 );
696
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
697
+		@set_time_limit(0);
698 698
 	}
699 699
 
700
-	$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
700
+	$step = isset($_GET['step']) ? absint($_GET['step']) : 1;
701 701
 
702 702
 	// form query
703
-	$forms = new WP_Query( array(
703
+	$forms = new WP_Query(array(
704 704
 			'paged'          => $step,
705 705
 			'status'         => 'any',
706 706
 			'order'          => 'ASC',
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 		)
710 710
 	);
711 711
 
712
-	if ( $forms->have_posts() ) {
713
-		while ( $forms->have_posts() ) {
712
+	if ($forms->have_posts()) {
713
+		while ($forms->have_posts()) {
714 714
 			$forms->the_post();
715 715
 
716 716
 			// Form content.
717 717
 			// Note in version 1.8 display content setting split into display content and content placement setting.
718 718
 			// You can delete _give_content_option in future
719
-			$show_content = get_post_meta( get_the_ID(), '_give_content_option', true );
720
-			if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) {
721
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
722
-				update_post_meta( get_the_ID(), '_give_display_content', $field_value );
719
+			$show_content = get_post_meta(get_the_ID(), '_give_content_option', true);
720
+			if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) {
721
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
722
+				update_post_meta(get_the_ID(), '_give_display_content', $field_value);
723 723
 
724
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
725
-				update_post_meta( get_the_ID(), '_give_content_placement', $field_value );
724
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
725
+				update_post_meta(get_the_ID(), '_give_content_placement', $field_value);
726 726
 			}
727 727
 
728 728
 			// "Disable" Guest Donation. Checkbox
729 729
 			// See: https://github.com/WordImpress/Give/issues/1470
730
-			$guest_donation = get_post_meta( get_the_ID(), '_give_logged_in_only', true );
731
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
732
-			update_post_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
730
+			$guest_donation = get_post_meta(get_the_ID(), '_give_logged_in_only', true);
731
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
732
+			update_post_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
733 733
 
734 734
 			// Offline Donations
735 735
 			// See: https://github.com/WordImpress/Give/issues/1579
736
-			$offline_donation = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
737
-			if ( 'no' === $offline_donation ) {
736
+			$offline_donation = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
737
+			if ('no' === $offline_donation) {
738 738
 				$offline_donation_newval = 'global';
739
-			} elseif ( 'yes' === $offline_donation ) {
739
+			} elseif ('yes' === $offline_donation) {
740 740
 				$offline_donation_newval = 'enabled';
741 741
 			} else {
742 742
 				$offline_donation_newval = 'disabled';
743 743
 			}
744
-			update_post_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
744
+			update_post_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
745 745
 
746 746
 			// Convert yes/no setting field to enabled/disabled.
747 747
 			$form_radio_settings = array(
@@ -761,15 +761,15 @@  discard block
 block discarded – undo
761 761
 				'_give_offline_donation_enable_billing_fields_single',
762 762
 			);
763 763
 
764
-			foreach ( $form_radio_settings as $meta_key ) {
764
+			foreach ($form_radio_settings as $meta_key) {
765 765
 				// Get value.
766
-				$field_value = get_post_meta( get_the_ID(), $meta_key, true );
766
+				$field_value = get_post_meta(get_the_ID(), $meta_key, true);
767 767
 
768 768
 				// Convert meta value only if it is in yes/no/none.
769
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
769
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
770 770
 
771
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
772
-					update_post_meta( get_the_ID(), $meta_key, $field_value );
771
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
772
+					update_post_meta(get_the_ID(), $meta_key, $field_value);
773 773
 				}
774 774
 			}
775 775
 		}// End while().
@@ -777,27 +777,27 @@  discard block
 block discarded – undo
777 777
 		wp_reset_postdata();
778 778
 
779 779
 		// Forms found so upgrade them
780
-		$step ++;
781
-		$redirect = add_query_arg( array(
780
+		$step++;
781
+		$redirect = add_query_arg(array(
782 782
 			'page'         => 'give-upgrades',
783 783
 			'give-upgrade' => 'give_v18_upgrades_form_metadata',
784 784
 			'step'         => $step,
785
-		), admin_url( 'index.php' ) );
786
-		wp_redirect( $redirect );
785
+		), admin_url('index.php'));
786
+		wp_redirect($redirect);
787 787
 		exit();
788 788
 
789 789
 	} else {
790 790
 		// No more forms found, finish up.
791
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
792
-		delete_option( 'give_doing_upgrade' );
793
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
791
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
792
+		delete_option('give_doing_upgrade');
793
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
794 794
 
795
-		wp_redirect( admin_url() );
795
+		wp_redirect(admin_url());
796 796
 		exit;
797 797
 	}
798 798
 }
799 799
 
800
-add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' );
800
+add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata');
801 801
 
802 802
 /**
803 803
  * Get list of core setting renamed in version 1.8.
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
  * @since  1.8.7
831 831
  * @return void
832 832
  */
833
-function give_v187_upgrades(){
833
+function give_v187_upgrades() {
834 834
 	global $wpdb;
835 835
 
836 836
 	/**
@@ -870,24 +870,24 @@  discard block
 block discarded – undo
870 870
 		ARRAY_A
871 871
 	);
872 872
 
873
-	if( ! empty( $user_apikey_options ) ) {
874
-		foreach ( $user_apikey_options as $user ) {
875
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
876
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
877
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
873
+	if ( ! empty($user_apikey_options)) {
874
+		foreach ($user_apikey_options as $user) {
875
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
876
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
877
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
878 878
 		}
879 879
 	}
880 880
 
881
-	if ( ! empty( $cached_options ) ) {
882
-		foreach ( $cached_options as $option ) {
883
-			switch ( true ) {
884
-				case ( false !== strpos( $option, 'transient' ) ):
885
-					$option = str_replace( '_transient_', '', $option );
886
-					delete_transient( $option );
881
+	if ( ! empty($cached_options)) {
882
+		foreach ($cached_options as $option) {
883
+			switch (true) {
884
+				case (false !== strpos($option, 'transient')):
885
+					$option = str_replace('_transient_', '', $option);
886
+					delete_transient($option);
887 887
 					break;
888 888
 
889 889
 				default:
890
-					delete_option( $option );
890
+					delete_option($option);
891 891
 			}
892 892
 		}
893 893
 	}
Please login to merge, or discard this patch.
includes/admin/class-i18n-module.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param $args
67 67
 	 */
68
-	public function __construct( $args ) {
68
+	public function __construct($args) {
69 69
 
70 70
 		// Only for admins.
71
-		if ( ! is_admin() ) {
71
+		if ( ! is_admin()) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		// This plugin is en_US native.
76 76
 		$this->locale = get_locale();
77
-		if ( 'en_US' === $this->locale ) {
77
+		if ('en_US' === $this->locale) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->init( $args );
81
+		$this->init($args);
82 82
 
83
-		if ( ! $this->hide_promo() ) {
84
-			add_action( $this->hook, array( $this, 'promo' ) );
83
+		if ( ! $this->hide_promo()) {
84
+			add_action($this->hook, array($this, 'promo'));
85 85
 		}
86 86
 	}
87 87
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @param array $args
94 94
 	 */
95
-	private function init( $args ) {
96
-		foreach ( $args as $key => $arg ) {
95
+	private function init($args) {
96
+		foreach ($args as $key => $arg) {
97 97
 			$this->$key = $arg;
98 98
 		}
99 99
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 * @return bool
108 108
 	 */
109 109
 	private function hide_promo() {
110
-		$hide_promo = Give_Cache::get( 'give_i18n_give_promo_hide', true );
111
-		if ( ! $hide_promo ) {
112
-			if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) {
110
+		$hide_promo = Give_Cache::get('give_i18n_give_promo_hide', true);
111
+		if ( ! $hide_promo) {
112
+			if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) {
113 113
 				// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
114
-				Give_Cache::set( 'give_i18n_give_promo_hide', true, null, true );
114
+				Give_Cache::set('give_i18n_give_promo_hide', true, null, true);
115 115
 				$hide_promo = true;
116 116
 			}
117 117
 		}
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
 		$message = false;
131 131
 
132 132
 		// Using a translation less than 90% complete.
133
-		if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) {
134
-			$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' );
135
-		} elseif ( ! $this->translation_loaded && $this->translation_exists ) {
136
-			$message = __( 'You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' );
137
-		} elseif ( ! $this->translation_exists ) {
138
-			$message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' );
133
+		if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) {
134
+			$message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give');
135
+		} elseif ( ! $this->translation_loaded && $this->translation_exists) {
136
+			$message = __('You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give');
137
+		} elseif ( ! $this->translation_exists) {
138
+			$message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give');
139 139
 		}
140 140
 
141 141
 		// Links.
142
-		$registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) );
143
-		$translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) );
142
+		$registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give'));
143
+		$translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give'));
144 144
 
145 145
 		// Message.
146
-		$message = sprintf( $message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link );
146
+		$message = sprintf($message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link);
147 147
 
148 148
 		return $message;
149 149
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		$this->translation_details();
158 158
 		$message = $this->promo_message();
159 159
 
160
-		if ( $message ) { ?>
160
+		if ($message) { ?>
161 161
 
162 162
 			<style>
163 163
 				/* Banner specific styles */
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 				<a href="https://wordpress.org/support/register.php" class="alignleft give-i18n-icon" style="margin:0" target="_blank"><span class="dashicons dashicons-translation" style="font-size: 110px; text-decoration: none;"></span></a>
221 221
 
222 222
 				<div class="give-i18n-notice-content">
223
-					<a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
223
+					<a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
224 224
 
225
-					<h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2>
225
+					<h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2>
226 226
 					<p><?php echo $message; ?></p>
227 227
 					<p>
228
-						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now &raquo;', 'give' ); ?></a>
228
+						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now &raquo;', 'give'); ?></a>
229 229
 					</p>
230 230
 				</div>
231 231
 			</div>
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	private function find_or_initialize_translation_details() {
244 244
 
245
-		$set = Give_Cache::get( "give_i18n_give_{$this->locale}", true );
245
+		$set = Give_Cache::get("give_i18n_give_{$this->locale}", true);
246 246
 
247
-		if ( ! $set ) {
247
+		if ( ! $set) {
248 248
 			$set = $this->retrieve_translation_details();
249
-			Give_Cache::set( "give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true );
249
+			Give_Cache::set("give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true);
250 250
 		}
251 251
 
252 252
 		return $set;
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 	private function translation_details() {
261 261
 		$set = $this->find_or_initialize_translation_details();
262 262
 
263
-		$this->translation_exists = ! is_null( $set );
264
-		$this->translation_loaded = is_textdomain_loaded( 'give' );
263
+		$this->translation_exists = ! is_null($set);
264
+		$this->translation_loaded = is_textdomain_loaded('give');
265 265
 
266
-		$this->parse_translation_set( $set );
266
+		$this->parse_translation_set($set);
267 267
 	}
268 268
 
269 269
 	/**
@@ -275,26 +275,26 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	private function retrieve_translation_details() {
277 277
 
278
-		$api_url = trailingslashit( $this->glotpress_url );
278
+		$api_url = trailingslashit($this->glotpress_url);
279 279
 
280
-		$resp = wp_remote_get( $api_url );
280
+		$resp = wp_remote_get($api_url);
281 281
 
282
-		if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) {
282
+		if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') {
283 283
 			return null;
284 284
 		}
285 285
 
286
-		$body = wp_remote_retrieve_body( $resp );
287
-		unset( $resp );
286
+		$body = wp_remote_retrieve_body($resp);
287
+		unset($resp);
288 288
 
289
-		if ( $body ) {
290
-			$body = json_decode( $body );
289
+		if ($body) {
290
+			$body = json_decode($body);
291 291
 
292
-			foreach ( $body->translation_sets as $set ) {
293
-				if ( ! property_exists( $set, 'wp_locale' ) ) {
292
+			foreach ($body->translation_sets as $set) {
293
+				if ( ! property_exists($set, 'wp_locale')) {
294 294
 					continue;
295 295
 				}
296 296
 
297
-				if ( $this->locale == $set->wp_locale ) {
297
+				if ($this->locale == $set->wp_locale) {
298 298
 					return $set;
299 299
 				}
300 300
 			}
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @access private
312 312
 	 */
313
-	private function parse_translation_set( $set ) {
314
-		if ( $this->translation_exists && is_object( $set ) ) {
313
+	private function parse_translation_set($set) {
314
+		if ($this->translation_exists && is_object($set)) {
315 315
 			$this->locale_name        = $set->name;
316 316
 			$this->percent_translated = $set->percent_translated;
317 317
 		} else {
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-reset-stats.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	public function get_data() {
59 59
 		global $wpdb;
60 60
 
61
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
61
+		$items = $this->get_stored_data('give_temp_reset_ids');
62 62
 
63
-		if ( ! is_array( $items ) ) {
63
+		if ( ! is_array($items)) {
64 64
 			return false;
65 65
 		}
66 66
 
67
-		$offset     = ( $this->step - 1 ) * $this->per_step;
68
-		$step_items = array_slice( $items, $offset, $this->per_step );
67
+		$offset     = ($this->step - 1) * $this->per_step;
68
+		$step_items = array_slice($items, $offset, $this->per_step);
69 69
 
70
-		if ( $step_items ) {
70
+		if ($step_items) {
71 71
 
72 72
 			$step_ids = array(
73 73
 				'customers' => array(),
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 				'other'     => array(),
76 76
 			);
77 77
 
78
-			foreach ( $step_items as $item ) {
78
+			foreach ($step_items as $item) {
79 79
 
80
-				switch ( $item['type'] ) {
80
+				switch ($item['type']) {
81 81
 					case 'customer':
82 82
 						$step_ids['customers'][] = $item['id'];
83 83
 						break;
@@ -85,25 +85,25 @@  discard block
 block discarded – undo
85 85
 						$step_ids['give_forms'][] = $item['id'];
86 86
 						break;
87 87
 					default:
88
-						$item_type                = apply_filters( 'give_reset_item_type', 'other', $item );
89
-						$step_ids[ $item_type ][] = $item['id'];
88
+						$item_type                = apply_filters('give_reset_item_type', 'other', $item);
89
+						$step_ids[$item_type][] = $item['id'];
90 90
 						break;
91 91
 				}
92 92
 			}
93 93
 
94 94
 			$sql = array();
95 95
 
96
-			foreach ( $step_ids as $type => $ids ) {
96
+			foreach ($step_ids as $type => $ids) {
97 97
 
98
-				if ( empty( $ids ) ) {
98
+				if (empty($ids)) {
99 99
 					continue;
100 100
 				}
101 101
 
102
-				$ids = implode( ',', $ids );
102
+				$ids = implode(',', $ids);
103 103
 
104
-				switch ( $type ) {
104
+				switch ($type) {
105 105
 					case 'customers':
106
-						$table_name = $wpdb->prefix . 'give_customers';
106
+						$table_name = $wpdb->prefix.'give_customers';
107 107
 						$sql[]      = "DELETE FROM $table_name WHERE id IN ($ids)";
108 108
 						break;
109 109
 					case 'forms':
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 						break;
119 119
 				}
120 120
 
121
-				if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) {
121
+				if ( ! in_array($type, array('customers', 'forms', 'other'))) {
122 122
 					// Allows other types of custom post types to filter on their own post_type
123 123
 					// and add items to the query list, for the IDs found in their post type.
124
-					$sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids );
124
+					$sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids);
125 125
 				}
126 126
 			}
127 127
 
128
-			if ( ! empty( $sql ) ) {
129
-				foreach ( $sql as $query ) {
130
-					$wpdb->query( $query );
128
+			if ( ! empty($sql)) {
129
+				foreach ($sql as $query) {
130
+					$wpdb->query($query);
131 131
 				}
132 132
 			}
133 133
 
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function get_percentage_complete() {
149 149
 
150
-		$items = $this->get_stored_data( 'give_temp_reset_ids', false );
151
-		$total = count( $items );
150
+		$items = $this->get_stored_data('give_temp_reset_ids', false);
151
+		$total = count($items);
152 152
 
153 153
 		$percentage = 100;
154 154
 
155
-		if ( $total > 0 ) {
156
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
155
+		if ($total > 0) {
156
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
157 157
 		}
158 158
 
159
-		if ( $percentage > 100 ) {
159
+		if ($percentage > 100) {
160 160
 			$percentage = 100;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param array $request The Form Data passed into the batch processing
172 172
 	 */
173
-	public function set_properties( $request ) {
173
+	public function set_properties($request) {
174 174
 	}
175 175
 
176 176
 	/**
@@ -181,29 +181,29 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function process_step() {
183 183
 
184
-		if ( ! $this->can_export() ) {
185
-			wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
184
+		if ( ! $this->can_export()) {
185
+			wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
186 186
 		}
187 187
 
188 188
 		$had_data = $this->get_data();
189 189
 
190
-		if ( $had_data ) {
190
+		if ($had_data) {
191 191
 			$this->done = false;
192 192
 
193 193
 			return true;
194 194
 		} else {
195
-			update_option( 'give_earnings_total', 0 );
196
-			Give_Cache::delete( Give_Cache::get_key('give_estimated_monthly_stats' ) );
195
+			update_option('give_earnings_total', 0);
196
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
197 197
 
198
-			$this->delete_data( 'give_temp_reset_ids' );
198
+			$this->delete_data('give_temp_reset_ids');
199 199
 
200 200
 			// Reset the sequential order numbers
201
-			if ( give_get_option( 'enable_sequential' ) ) {
202
-				delete_option( 'give_last_payment_number' );
201
+			if (give_get_option('enable_sequential')) {
202
+				delete_option('give_last_payment_number');
203 203
 			}
204 204
 
205 205
 			$this->done    = true;
206
-			$this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' );
206
+			$this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give');
207 207
 
208 208
 			return false;
209 209
 		}
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 	 * Headers
214 214
 	 */
215 215
 	public function headers() {
216
-		ignore_user_abort( true );
216
+		ignore_user_abort(true);
217 217
 
218
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
219
-			set_time_limit( 0 );
218
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
219
+			set_time_limit(0);
220 220
 		}
221 221
 	}
222 222
 
@@ -240,35 +240,35 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function pre_fetch() {
242 242
 
243
-		if ( $this->step == 1 ) {
244
-			$this->delete_data( 'give_temp_reset_ids' );
243
+		if ($this->step == 1) {
244
+			$this->delete_data('give_temp_reset_ids');
245 245
 		}
246 246
 
247
-		$items = get_option( 'give_temp_reset_ids', false );
247
+		$items = get_option('give_temp_reset_ids', false);
248 248
 
249
-		if ( false === $items ) {
249
+		if (false === $items) {
250 250
 			$items = array();
251 251
 
252
-			$give_types_for_reset = array( 'give_forms', 'give_log', 'give_payment' );
253
-			$give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset );
252
+			$give_types_for_reset = array('give_forms', 'give_log', 'give_payment');
253
+			$give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset);
254 254
 
255
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
255
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
256 256
 				'post_type'      => $give_types_for_reset,
257 257
 				'post_status'    => 'any',
258
-				'posts_per_page' => - 1,
259
-			) );
258
+				'posts_per_page' => -1,
259
+			));
260 260
 
261
-			$posts = get_posts( $args );
262
-			foreach ( $posts as $post ) {
261
+			$posts = get_posts($args);
262
+			foreach ($posts as $post) {
263 263
 				$items[] = array(
264 264
 					'id'   => (int) $post->ID,
265 265
 					'type' => $post->post_type,
266 266
 				);
267 267
 			}
268 268
 
269
-			$customer_args = array( 'number' => - 1 );
270
-			$customers     = Give()->customers->get_customers( $customer_args );
271
-			foreach ( $customers as $customer ) {
269
+			$customer_args = array('number' => -1);
270
+			$customers     = Give()->customers->get_customers($customer_args);
271
+			foreach ($customers as $customer) {
272 272
 				$items[] = array(
273 273
 					'id'   => (int) $customer->id,
274 274
 					'type' => 'customer',
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 
278 278
 			// Allow filtering of items to remove with an unassociative array for each item
279 279
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
280
-			$items = apply_filters( 'give_reset_items', $items );
280
+			$items = apply_filters('give_reset_items', $items);
281 281
 
282
-			$this->store_data( 'give_temp_reset_ids', $items );
282
+			$this->store_data('give_temp_reset_ids', $items);
283 283
 		}
284 284
 
285 285
 	}
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return mixed       Returns the data from the database.
295 295
 	 */
296
-	private function get_stored_data( $key ) {
296
+	private function get_stored_data($key) {
297 297
 		global $wpdb;
298
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
298
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
299 299
 
300
-		return empty( $value ) ? false : maybe_unserialize( $value );
300
+		return empty($value) ? false : maybe_unserialize($value);
301 301
 	}
302 302
 
303 303
 	/**
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @return void
312 312
 	 */
313
-	private function store_data( $key, $value ) {
313
+	private function store_data($key, $value) {
314 314
 		global $wpdb;
315 315
 
316
-		$value = maybe_serialize( $value );
316
+		$value = maybe_serialize($value);
317 317
 
318 318
 		$data = array(
319 319
 			'option_name'  => $key,
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			'%s',
328 328
 		);
329 329
 
330
-		$wpdb->replace( $wpdb->options, $data, $formats );
330
+		$wpdb->replace($wpdb->options, $data, $formats);
331 331
 	}
332 332
 
333 333
 	/**
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return void
341 341
 	 */
342
-	private function delete_data( $key ) {
342
+	private function delete_data($key) {
343 343
 		global $wpdb;
344
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
344
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
345 345
 	}
346 346
 
347 347
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,49 +53,49 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function get_data() {
55 55
 
56
-		if ( $this->step == 1 ) {
57
-			$this->delete_data( 'give_temp_recount_earnings' );
56
+		if ($this->step == 1) {
57
+			$this->delete_data('give_temp_recount_earnings');
58 58
 		}
59 59
 
60
-		$total = get_option( 'give_temp_recount_earnings', false );
60
+		$total = get_option('give_temp_recount_earnings', false);
61 61
 
62
-		if ( false === $total ) {
62
+		if (false === $total) {
63 63
 			$total = (float) 0;
64
-			$this->store_data( 'give_temp_recount_earnings', $total );
64
+			$this->store_data('give_temp_recount_earnings', $total);
65 65
 		}
66 66
 
67
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
67
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
68 68
 
69
-		$args = apply_filters( 'give_recount_earnings_args', array(
69
+		$args = apply_filters('give_recount_earnings_args', array(
70 70
 			'number' => $this->per_step,
71 71
 			'page'   => $this->step,
72 72
 			'status' => $accepted_statuses,
73 73
 			'fields' => 'ids'
74
-		) );
74
+		));
75 75
 
76
-		$payments = give_get_payments( $args );
76
+		$payments = give_get_payments($args);
77 77
 
78
-		if ( ! empty( $payments ) ) {
78
+		if ( ! empty($payments)) {
79 79
 
80
-			foreach ( $payments as $payment ) {
80
+			foreach ($payments as $payment) {
81 81
 
82
-				$total += give_get_payment_amount( $payment );
82
+				$total += give_get_payment_amount($payment);
83 83
 
84 84
 			}
85 85
 
86
-			if ( $total < 0 ) {
86
+			if ($total < 0) {
87 87
 				$totals = 0;
88 88
 			}
89 89
 
90
-			$total = round( $total, give_currency_decimal_filter() );
90
+			$total = round($total, give_currency_decimal_filter());
91 91
 
92
-			$this->store_data( 'give_temp_recount_earnings', $total );
92
+			$this->store_data('give_temp_recount_earnings', $total);
93 93
 
94 94
 			return true;
95 95
 
96 96
 		}
97 97
 
98
-		update_option( 'give_earnings_total', $total );
98
+		update_option('give_earnings_total', $total);
99 99
 
100 100
 		return false;
101 101
 
@@ -109,25 +109,25 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function get_percentage_complete() {
111 111
 
112
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
112
+		$total = $this->get_stored_data('give_recount_earnings_total');
113 113
 
114
-		if ( false === $total ) {
115
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
114
+		if (false === $total) {
115
+			$args = apply_filters('give_recount_earnings_total_args', array());
116 116
 
117
-			$counts = give_count_payments( $args );
118
-			$total  = absint( $counts->publish );
119
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
117
+			$counts = give_count_payments($args);
118
+			$total  = absint($counts->publish);
119
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
120 120
 
121
-			$this->store_data( 'give_recount_earnings_total', $total );
121
+			$this->store_data('give_recount_earnings_total', $total);
122 122
 		}
123 123
 
124 124
 		$percentage = 100;
125 125
 
126
-		if ( $total > 0 ) {
127
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
126
+		if ($total > 0) {
127
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
128 128
 		}
129 129
 
130
-		if ( $percentage > 100 ) {
130
+		if ($percentage > 100) {
131 131
 			$percentage = 100;
132 132
 		}
133 133
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @param array $request The Form Data passed into the batch processing
143 143
 	 */
144
-	public function set_properties( $request ) {
144
+	public function set_properties($request) {
145 145
 	}
146 146
 
147 147
 	/**
@@ -152,31 +152,31 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function process_step() {
154 154
 
155
-		if ( ! $this->can_export() ) {
156
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
155
+		if ( ! $this->can_export()) {
156
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
157 157
 		}
158 158
 
159 159
 		$had_data = $this->get_data();
160 160
 
161
-		if ( $had_data ) {
161
+		if ($had_data) {
162 162
 			$this->done = false;
163 163
 
164 164
 			return true;
165 165
 		} else {
166
-			$this->delete_data( 'give_recount_earnings_total' );
167
-			$this->delete_data( 'give_temp_recount_earnings' );
166
+			$this->delete_data('give_recount_earnings_total');
167
+			$this->delete_data('give_temp_recount_earnings');
168 168
 			$this->done    = true;
169
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
169
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
170 170
 
171 171
 			return false;
172 172
 		}
173 173
 	}
174 174
 
175 175
 	public function headers() {
176
-		ignore_user_abort( true );
176
+		ignore_user_abort(true);
177 177
 
178
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
179
-			set_time_limit( 0 );
178
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
179
+			set_time_limit(0);
180 180
 		}
181 181
 	}
182 182
 
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return mixed       Returns the data from the database
206 206
 	 */
207
-	private function get_stored_data( $key ) {
207
+	private function get_stored_data($key) {
208 208
 		global $wpdb;
209
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
209
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
210 210
 
211
-		return empty( $value ) ? false : maybe_unserialize( $value );
211
+		return empty($value) ? false : maybe_unserialize($value);
212 212
 	}
213 213
 
214 214
 	/**
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return void
223 223
 	 */
224
-	private function store_data( $key, $value ) {
224
+	private function store_data($key, $value) {
225 225
 		global $wpdb;
226 226
 
227
-		$value = maybe_serialize( $value );
227
+		$value = maybe_serialize($value);
228 228
 
229 229
 		$data = array(
230 230
 			'option_name'  => $key,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			'%s',
239 239
 		);
240 240
 
241
-		$wpdb->replace( $wpdb->options, $data, $formats );
241
+		$wpdb->replace($wpdb->options, $data, $formats);
242 242
 	}
243 243
 
244 244
 	/**
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return void
252 252
 	 */
253
-	private function delete_data( $key ) {
253
+	private function delete_data($key) {
254 254
 		global $wpdb;
255
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
255
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
256 256
 	}
257 257
 
258 258
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-customers.php 1 patch
Spacing   +75 added lines, -75 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
 
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @param array $request The Form Data passed into the batch processing
64 64
 	 */
65
-	public function set_properties( $request ) {
65
+	public function set_properties($request) {
66 66
 
67 67
 		// Set data from form submission
68
-		if ( isset( $_POST['form'] ) ) {
69
-			parse_str( $_POST['form'], $this->data );
68
+		if (isset($_POST['form'])) {
69
+			parse_str($_POST['form'], $this->data);
70 70
 		}
71 71
 
72 72
 		$this->form = $this->data['forms'];
73 73
 
74 74
 		// Setup donor ids cache.
75
-		if( ! empty( $this->form ) ) {
75
+		if ( ! empty($this->form)) {
76 76
 			// Cache donor ids to output unique list of donor.
77
-			$this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] );
78
-			if( ! ( $this->donor_ids = Give_Cache::get( $this->query_id, true ) ) ) {
77
+			$this->query_id = give_clean($_REQUEST['give_export_option']['query_id']);
78
+			if ( ! ($this->donor_ids = Give_Cache::get($this->query_id, true))) {
79 79
 				$this->donor_ids = array();
80
-				Give_Cache::set( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true );
80
+				Give_Cache::set($this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true);
81 81
 			}
82 82
 		}
83 83
 
84
-		$this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
84
+		$this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
85 85
 
86 86
 	}
87 87
 
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function csv_cols() {
96 96
 
97
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
97
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
98 98
 
99 99
 		// We need columns.
100
-		if ( empty( $columns ) ) {
100
+		if (empty($columns)) {
101 101
 			return false;
102 102
 		}
103 103
 
104
-		$cols = $this->get_cols( $columns );
104
+		$cols = $this->get_cols($columns);
105 105
 
106 106
 		return $cols;
107 107
 	}
@@ -113,38 +113,38 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return array
115 115
 	 */
116
-	private function get_cols( $columns ) {
116
+	private function get_cols($columns) {
117 117
 
118 118
 		$cols = array();
119 119
 
120
-		foreach ( $columns as $key => $value ) {
120
+		foreach ($columns as $key => $value) {
121 121
 
122
-			switch ( $key ) {
122
+			switch ($key) {
123 123
 				case 'full_name' :
124
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
124
+					$cols['full_name'] = esc_html__('Full Name', 'give');
125 125
 					break;
126 126
 				case 'email' :
127
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
127
+					$cols['email'] = esc_html__('Email Address', 'give');
128 128
 					break;
129 129
 				case 'address' :
130
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
131
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
132
-					$cols['address_city']    = esc_html__( 'City', 'give' );
133
-					$cols['address_state']   = esc_html__( 'State', 'give' );
134
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
135
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
130
+					$cols['address_line1']   = esc_html__('Address', 'give');
131
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
132
+					$cols['address_city']    = esc_html__('City', 'give');
133
+					$cols['address_state']   = esc_html__('State', 'give');
134
+					$cols['address_zip']     = esc_html__('Zip', 'give');
135
+					$cols['address_country'] = esc_html__('Country', 'give');
136 136
 					break;
137 137
 				case 'userid' :
138
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
138
+					$cols['userid'] = esc_html__('User ID', 'give');
139 139
 					break;
140 140
 				case 'date_first_donated' :
141
-					$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
141
+					$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
142 142
 					break;
143 143
 				case 'donations' :
144
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
144
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
145 145
 					break;
146 146
 				case 'donation_sum' :
147
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
147
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
148 148
 					break;
149 149
 			}
150 150
 		}
@@ -167,20 +167,20 @@  discard block
 block discarded – undo
167 167
 
168 168
 		$i = 0;
169 169
 
170
-		if ( ! empty( $this->form ) ) {
170
+		if ( ! empty($this->form)) {
171 171
 
172 172
 			// Export donors of a specific product
173 173
 			global $give_logs;
174 174
 
175 175
 			$args = array(
176
-				'post_parent'    => absint( $this->form ),
176
+				'post_parent'    => absint($this->form),
177 177
 				'log_type'       => 'sale',
178 178
 				'posts_per_page' => 30,
179 179
 				'paged'          => $this->step,
180 180
 			);
181 181
 
182 182
 			// Check for price option
183
-			if ( null !== $this->price_id ) {
183
+			if (null !== $this->price_id) {
184 184
 				$args['meta_query'] = array(
185 185
 					array(
186 186
 						'key'   => '_give_log_price_id',
@@ -189,44 +189,44 @@  discard block
 block discarded – undo
189 189
 				);
190 190
 			}
191 191
 
192
-			$logs = $give_logs->get_connected_logs( $args );
192
+			$logs = $give_logs->get_connected_logs($args);
193 193
 
194
-			if ( $logs ) {
195
-				foreach ( $logs as $log ) {
196
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
197
-					$payment    = new Give_Payment( $payment_id );
194
+			if ($logs) {
195
+				foreach ($logs as $log) {
196
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
197
+					$payment    = new Give_Payment($payment_id);
198 198
 
199 199
 					// Continue if donor already included.
200
-					if( in_array( $payment->customer_id , $this->donor_ids ) ) {
200
+					if (in_array($payment->customer_id, $this->donor_ids)) {
201 201
 						continue;
202 202
 					}
203 203
 
204 204
 					$this->donor_ids[] = $payment->customer_id;
205 205
 
206
-					$donor      = Give()->customers->get_customer_by( 'id', $payment->customer_id );
207
-					$data[]     = $this->set_donor_data( $i, $data, $donor );
208
-					$i ++;
206
+					$donor      = Give()->customers->get_customer_by('id', $payment->customer_id);
207
+					$data[]     = $this->set_donor_data($i, $data, $donor);
208
+					$i++;
209 209
 				}
210 210
 
211 211
 				// Cache donor ids only if admin export donor for specific form.
212
-				Give_Cache::set( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS, true );
212
+				Give_Cache::set($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS, true);
213 213
 			}
214 214
 		} else {
215 215
 
216 216
 			// Export all donors.
217
-			$offset = 30 * ( $this->step - 1 );
218
-			$donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
217
+			$offset = 30 * ($this->step - 1);
218
+			$donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset));
219 219
 
220
-			foreach ( $donors as $donor ) {
220
+			foreach ($donors as $donor) {
221 221
 
222
-				$data[] = $this->set_donor_data( $i, $data, $donor );
223
-				$i ++;
222
+				$data[] = $this->set_donor_data($i, $data, $donor);
223
+				$i++;
224 224
 			}
225 225
 		}
226 226
 
227 227
 
228
-		$data = apply_filters( 'give_export_get_data', $data );
229
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
228
+		$data = apply_filters('give_export_get_data', $data);
229
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
230 230
 
231 231
 		return $data;
232 232
 	}
@@ -242,18 +242,18 @@  discard block
 block discarded – undo
242 242
 		$percentage = 0;
243 243
 
244 244
 		// We can't count the number when getting them for a specific form
245
-		if ( empty( $this->form ) ) {
245
+		if (empty($this->form)) {
246 246
 
247 247
 			$total = Give()->customers->count();
248 248
 
249
-			if ( $total > 0 ) {
249
+			if ($total > 0) {
250 250
 
251
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
251
+				$percentage = ((30 * $this->step) / $total) * 100;
252 252
 
253 253
 			}
254 254
 		}
255 255
 
256
-		if ( $percentage > 100 ) {
256
+		if ($percentage > 100) {
257 257
 			$percentage = 100;
258 258
 		}
259 259
 
@@ -269,46 +269,46 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return mixed
271 271
 	 */
272
-	private function set_donor_data( $i, $data, $donor ) {
272
+	private function set_donor_data($i, $data, $donor) {
273 273
 
274 274
 		$columns = $this->csv_cols();
275 275
 
276 276
 		// Set address variable
277 277
 		$address = '';
278
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
279
-			$address = give_get_donor_address( $donor->user_id );
278
+		if (isset($donor->user_id) && $donor->user_id > 0) {
279
+			$address = give_get_donor_address($donor->user_id);
280 280
 		}
281 281
 
282 282
 		// Set columns
283
-		if ( ! empty( $columns['full_name'] ) ) {
284
-			$data[ $i ]['full_name'] = $donor->name;
283
+		if ( ! empty($columns['full_name'])) {
284
+			$data[$i]['full_name'] = $donor->name;
285 285
 		}
286
-		if ( ! empty( $columns['email'] ) ) {
287
-			$data[ $i ]['email'] = $donor->email;
286
+		if ( ! empty($columns['email'])) {
287
+			$data[$i]['email'] = $donor->email;
288 288
 		}
289
-		if ( ! empty( $columns['address_line1'] ) ) {
290
-
291
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
292
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
293
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
294
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
295
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
296
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
289
+		if ( ! empty($columns['address_line1'])) {
290
+
291
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
292
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
293
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
294
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
295
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
296
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
297 297
 		}
298
-		if ( ! empty( $columns['userid'] ) ) {
299
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
298
+		if ( ! empty($columns['userid'])) {
299
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
300 300
 		}
301
-		if ( ! empty( $columns['date_first_donated'] ) ) {
302
-			$data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
301
+		if ( ! empty($columns['date_first_donated'])) {
302
+			$data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created));
303 303
 		}
304
-		if ( ! empty( $columns['donations'] ) ) {
305
-			$data[ $i ]['donations'] = $donor->purchase_count;
304
+		if ( ! empty($columns['donations'])) {
305
+			$data[$i]['donations'] = $donor->purchase_count;
306 306
 		}
307
-		if ( ! empty( $columns['donation_sum'] ) ) {
308
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value );
307
+		if ( ! empty($columns['donation_sum'])) {
308
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value);
309 309
 		}
310 310
 
311
-		return $data[ $i ];
311
+		return $data[$i];
312 312
 
313 313
 	}
314 314
 
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly.
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
34 34
 	$views        = give_reports_default_views();
35 35
 	?>
36 36
 	<div class="wrap give-settings-page">
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 		<h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1>
39 39
 
40 40
 		<h2 class="nav-tab-wrapper">
41
-			<?php foreach ( $views as $tab => $label ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
41
+			<?php foreach ($views as $tab => $label) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => $tab,
44 44
 					'settings-updated' => false,
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a>
46 46
 			<?php } ?>
47
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
48
-				<a href="<?php echo esc_url( add_query_arg( array(
47
+			<?php if (current_user_can('export_give_reports')) { ?>
48
+				<a href="<?php echo esc_url(add_query_arg(array(
49 49
 					'tab'              => 'export',
50 50
 					'settings-updated' => false,
51
-				), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
51
+				), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
52 52
 			<?php }
53 53
 			/**
54 54
 			 * Fires in the report tabs.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			 *
58 58
 			 * @since 1.0
59 59
 			 */
60
-			do_action( 'give_reports_tabs' );
60
+			do_action('give_reports_tabs');
61 61
 			?>
62 62
 		</h2>
63 63
 
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.0
69 69
 		 */
70
-		do_action( 'give_reports_page_top' );
70
+		do_action('give_reports_page_top');
71 71
 
72 72
 		// Set $active_tab prior to hook firing.
73
-		if ( in_array( $active_tab, array_keys( $views ) ) ) {
73
+		if (in_array($active_tab, array_keys($views))) {
74 74
 			$active_tab = 'reports';
75 75
 		}
76 76
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @since 1.0
81 81
 		 */
82
-		do_action( "give_reports_tab_{$active_tab}" );
82
+		do_action("give_reports_tab_{$active_tab}");
83 83
 
84 84
 		/**
85 85
 		 * Fires after the report page.
86 86
 		 *
87 87
 		 * @since 1.0
88 88
 		 */
89
-		do_action( 'give_reports_page_bottom' );
89
+		do_action('give_reports_page_bottom');
90 90
 		?>
91 91
 	</div><!-- .wrap -->
92 92
 	<?php
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function give_reports_default_views() {
102 102
 	$views = array(
103
-		'earnings' => esc_html__( 'Income', 'give' ),
104
-		'forms'    => esc_html__( 'Forms', 'give' ),
105
-		'donors'   => esc_html__( 'Donors', 'give' ),
106
-		'gateways' => esc_html__( 'Donation Methods', 'give' ),
103
+		'earnings' => esc_html__('Income', 'give'),
104
+		'forms'    => esc_html__('Forms', 'give'),
105
+		'donors'   => esc_html__('Donors', 'give'),
106
+		'gateways' => esc_html__('Donation Methods', 'give'),
107 107
 	);
108 108
 
109
-	$views = apply_filters( 'give_report_views', $views );
109
+	$views = apply_filters('give_report_views', $views);
110 110
 
111 111
 	return $views;
112 112
 }
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
  * @since 1.0
122 122
  * @return string $view Report View
123 123
  */
124
-function give_get_reporting_view( $default = 'earnings' ) {
124
+function give_get_reporting_view($default = 'earnings') {
125 125
 
126
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
126
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
127 127
 		$view = $default;
128 128
 	} else {
129 129
 		$view = $_GET['view'];
130 130
 	}
131 131
 
132
-	return apply_filters( 'give_get_reporting_view', $view );
132
+	return apply_filters('give_get_reporting_view', $view);
133 133
 }
134 134
 
135 135
 /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	$current_view = 'earnings';
143 143
 	$views        = give_reports_default_views();
144 144
 
145
-	if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) {
145
+	if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) {
146 146
 		$current_view = $_GET['tab'];
147 147
 	}
148 148
 
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @since 1.0
153 153
 	 */
154
-	do_action( "give_reports_view_{$current_view}" );
154
+	do_action("give_reports_view_{$current_view}");
155 155
 }
156 156
 
157
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
157
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
158 158
 
159 159
 /**
160 160
  * Renders the Reports Page Views Drop Downs
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
  */
165 165
 function give_report_views() {
166 166
 	$views        = give_reports_default_views();
167
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
167
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
168 168
 	/**
169 169
 	 * Fires before the report page actions form.
170 170
 	 *
171 171
 	 * @since 1.0
172 172
 	 */
173
-	do_action( 'give_report_view_actions_before' );
173
+	do_action('give_report_view_actions_before');
174 174
 	?>
175 175
 	<form id="give-reports-filter" method="get">
176 176
 		<select id="give-reports-view" name="view">
177
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
178
-			<?php foreach ( $views as $view_id => $label ) : ?>
179
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
177
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
178
+			<?php foreach ($views as $view_id => $label) : ?>
179
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
180 180
 			<?php endforeach; ?>
181 181
 		</select>
182 182
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 		 *
189 189
 		 * @since 1.0
190 190
 		 */
191
-		do_action( 'give_report_view_actions' );
191
+		do_action('give_report_view_actions');
192 192
 		?>
193 193
 
194 194
 		<input type="hidden" name="post_type" value="give_forms"/>
195 195
 		<input type="hidden" name="page" value="give-reports"/>
196
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
196
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
197 197
 	</form>
198 198
 	<?php
199 199
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @since 1.0
203 203
 	 */
204
-	do_action( 'give_report_view_actions_after' );
204
+	do_action('give_report_view_actions_after');
205 205
 }
206 206
 
207 207
 /**
@@ -214,18 +214,18 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function give_reports_forms_table() {
216 216
 
217
-	if ( isset( $_GET['form-id'] ) ) {
217
+	if (isset($_GET['form-id'])) {
218 218
 		return;
219 219
 	}
220 220
 
221
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
221
+	include(dirname(__FILE__).'/class-form-reports-table.php');
222 222
 
223 223
 	$give_table = new Give_Form_Reports_Table();
224 224
 	$give_table->prepare_items();
225 225
 	$give_table->display();
226 226
 }
227 227
 
228
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
228
+add_action('give_reports_view_forms', 'give_reports_forms_table');
229 229
 
230 230
 /**
231 231
  * Renders the detailed report for a specific give form
@@ -234,20 +234,20 @@  discard block
 block discarded – undo
234 234
  * @return void
235 235
  */
236 236
 function give_reports_form_details() {
237
-	if ( ! isset( $_GET['form-id'] ) ) {
237
+	if ( ! isset($_GET['form-id'])) {
238 238
 		return;
239 239
 	}
240 240
 	?>
241 241
 	<div class="tablenav top reports-forms-details-wrap">
242 242
 		<div class="actions bulkactions">
243
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
243
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
244 244
 		</div>
245 245
 	</div>
246 246
 	<?php
247
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
247
+	give_reports_graph_of_form(absint($_GET['form-id']));
248 248
 }
249 249
 
250
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
250
+add_action('give_reports_view_forms', 'give_reports_form_details');
251 251
 
252 252
 /**
253 253
  * Renders the Reports Donors Table
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @return void
259 259
  */
260 260
 function give_reports_donors_table() {
261
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
261
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
262 262
 
263 263
 	$give_table = new Give_Donor_Reports_Table();
264 264
 	$give_table->prepare_items();
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 		 *
271 271
 		 * @since 1.0
272 272
 		 */
273
-		do_action( 'give_logs_donors_table_top' );
273
+		do_action('give_logs_donors_table_top');
274 274
 		?>
275 275
 		<form id="give-donors-filter" method="get">
276 276
 			<?php
277
-			$give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' );
277
+			$give_table->search_box(esc_html__('Search', 'give'), 'give-donors');
278 278
 			$give_table->display();
279 279
 			?>
280 280
 			<input type="hidden" name="post_type" value="give_forms"/>
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 		 *
288 288
 		 * @since 1.0
289 289
 		 */
290
-		do_action( 'give_logs_donors_table_bottom' );
290
+		do_action('give_logs_donors_table_bottom');
291 291
 		?>
292 292
 	</div>
293 293
 	<?php
294 294
 }
295 295
 
296
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
296
+add_action('give_reports_view_donors', 'give_reports_donors_table');
297 297
 
298 298
 
299 299
 /**
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
  * @return void
306 306
  */
307 307
 function give_reports_gateways_table() {
308
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
308
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
309 309
 
310 310
 	$give_table = new Give_Gateawy_Reports_Table();
311 311
 	$give_table->prepare_items();
312 312
 	$give_table->display();
313 313
 }
314 314
 
315
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
315
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
316 316
 
317 317
 
318 318
 /**
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 function give_reports_earnings() {
325 325
 	?>
326 326
 	<div class="tablenav top reports-table-nav">
327
-		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3>
327
+		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3>
328 328
 	</div>
329 329
 	<?php
330 330
 	give_reports_graph();
331 331
 }
332 332
 
333
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
333
+add_action('give_reports_view_earnings', 'give_reports_earnings');
334 334
 
335 335
 
336 336
 /**
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
 				 *
352 352
 				 * @since 1.0
353 353
 				 */
354
-				do_action( 'give_reports_tab_export_content_top' );
354
+				do_action('give_reports_tab_export_content_top');
355 355
 				?>
356 356
 
357 357
 				<table class="widefat export-options-table give-table">
358 358
 					<thead>
359 359
 						<tr>
360
-							<th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
361
-							<th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th>
360
+							<th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th>
361
+							<th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th>
362 362
 						</tr>
363 363
 					</thead>
364 364
 					<tbody>
@@ -370,42 +370,42 @@  discard block
 block discarded – undo
370 370
 						 *
371 371
 						 * @since 1.0
372 372
 						 */
373
-						do_action( 'give_reports_tab_export_table_top' );
373
+						do_action('give_reports_tab_export_table_top');
374 374
 						?>
375 375
 						<tr class="give-export-pdf-sales-earnings">
376 376
 							<td scope="row" class="row-title">
377
-								<h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span>
377
+								<h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span>
378 378
 								</h3>
379
-								<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
379
+								<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
380 380
 							</td>
381 381
 							<td>
382
-								<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a>
382
+								<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a>
383 383
 							</td>
384 384
 						</tr>
385 385
 						<tr class="alternate give-export-sales-earnings">
386 386
 							<td scope="row" class="row-title">
387
-								<h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
388
-								<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
387
+								<h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3>
388
+								<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
389 389
 							</td>
390 390
 							<td>
391 391
 								<form method="post">
392 392
 									<?php
393 393
 									printf(
394 394
 									/* translators: 1: start date dropdown 2: end date dropdown */
395
-										esc_html__( '%1$s to %2$s', 'give' ),
396
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
397
-										Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' )
395
+										esc_html__('%1$s to %2$s', 'give'),
396
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
397
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
398 398
 									);
399 399
 									?>
400 400
 									<input type="hidden" name="give-action" value="earnings_export"/>
401
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
401
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
402 402
 								</form>
403 403
 							</td>
404 404
 						</tr>
405 405
 						<tr class="give-export-payment-history">
406 406
 							<td scope="row" class="row-title">
407
-								<h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3>
408
-								<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
407
+								<h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3>
408
+								<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
409 409
 							</td>
410 410
 							<td>
411 411
 								<form id="give-export-payments" class="give-export-form" method="post">
@@ -413,27 +413,27 @@  discard block
 block discarded – undo
413 413
 									$args = array(
414 414
 										'id'          => 'give-payment-export-start',
415 415
 										'name'        => 'start',
416
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
416
+										'placeholder' => esc_attr__('Start date', 'give'),
417 417
 									);
418
-									echo Give()->html->date_field( $args ); ?>
418
+									echo Give()->html->date_field($args); ?>
419 419
 									<?php
420 420
 									$args = array(
421 421
 										'id'          => 'give-payment-export-end',
422 422
 										'name'        => 'end',
423
-										'placeholder' => esc_attr__( 'End date', 'give' ),
423
+										'placeholder' => esc_attr__('End date', 'give'),
424 424
 									);
425
-									echo Give()->html->date_field( $args ); ?>
425
+									echo Give()->html->date_field($args); ?>
426 426
 									<select name="status">
427
-										<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
427
+										<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
428 428
 										<?php
429 429
 										$statuses = give_get_payment_statuses();
430
-										foreach ( $statuses as $status => $label ) {
431
-											echo '<option value="' . $status . '">' . $label . '</option>';
430
+										foreach ($statuses as $status => $label) {
431
+											echo '<option value="'.$status.'">'.$label.'</option>';
432 432
 										}
433 433
 										?>
434 434
 									</select>
435 435
 									<?php
436
-									if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
436
+									if (give_is_setting_enabled(give_get_option('categories'))) {
437 437
 										echo Give()->html->category_dropdown(
438 438
 											'give_forms_categories[]',
439 439
 											0,
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 												'multiple'        => true,
444 444
 												'selected'        => array(),
445 445
 												'show_option_all' => false,
446
-												'placeholder'     => __( 'Choose one or more from categories', 'give' ),
446
+												'placeholder'     => __('Choose one or more from categories', 'give'),
447 447
 											)
448 448
 										);
449 449
 									}
450 450
 
451
-									if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
451
+									if (give_is_setting_enabled(give_get_option('tags'))) {
452 452
 										echo Give()->html->tags_dropdown(
453 453
 											'give_forms_tags[]',
454 454
 											0,
@@ -458,16 +458,16 @@  discard block
 block discarded – undo
458 458
 												'multiple'        => true,
459 459
 												'selected'        => array(),
460 460
 												'show_option_all' => false,
461
-												'placeholder'     => __( 'Choose one or more from tags', 'give' ),
461
+												'placeholder'     => __('Choose one or more from tags', 'give'),
462 462
 											)
463 463
 										);
464 464
 									}
465 465
 
466
-									wp_nonce_field( 'give_ajax_export', 'give_ajax_export' );
466
+									wp_nonce_field('give_ajax_export', 'give_ajax_export');
467 467
 									?>
468 468
 									<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
469 469
 									<span>
470
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
470
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
471 471
 									<span class="spinner"></span>
472 472
 								</span>
473 473
 								</form>
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
 						</tr>
476 476
 						<tr class="alternate give-export-donors">
477 477
 							<td scope="row" class="row-title">
478
-								<h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3>
479
-								<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
478
+								<h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3>
479
+								<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
480 480
 							</td>
481 481
 							<td>
482 482
 								<form method="post" id="give_donor_export" class="give-export-form">
@@ -487,46 +487,46 @@  discard block
 block discarded – undo
487 487
 										'id'     => 'give_customer_export_form',
488 488
 										'chosen' => true,
489 489
 									);
490
-									echo Give()->html->forms_dropdown( $args ); ?>
490
+									echo Give()->html->forms_dropdown($args); ?>
491 491
 
492
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
492
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
493 493
 
494 494
 									<div id="export-donor-options-wrap" class="give-clearfix">
495
-										<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
495
+										<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
496 496
 										<ul id="give-export-option-ul">
497 497
 											<li>
498
-												<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
498
+												<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
499 499
 												</label>
500 500
 											</li>
501 501
 											<li>
502
-												<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
502
+												<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
503 503
 												</label>
504 504
 											</li>
505 505
 											<li>
506
-												<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
506
+												<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
507 507
 												</label>
508 508
 											</li>
509 509
 											<li>
510
-												<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
510
+												<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
511 511
 												</label>
512 512
 											</li>
513 513
 											<li>
514
-												<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
514
+												<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
515 515
 												</label>
516 516
 											</li>
517 517
 											<li>
518
-												<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
518
+												<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
519 519
 												</label>
520 520
 											</li>
521 521
 											<li>
522
-												<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
522
+												<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
523 523
 												</label>
524 524
 											</li>
525 525
 										</ul>
526 526
 									</div>
527
-									<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
527
+									<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
528 528
 									<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
529
-									<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/>
529
+									<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/>
530 530
 								</form>
531 531
 							</td>
532 532
 						</tr>
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						 *
539 539
 						 * @since 1.0
540 540
 						 */
541
-						do_action( 'give_reports_tab_export_table_bottom' );
541
+						do_action('give_reports_tab_export_table_bottom');
542 542
 						?>
543 543
 					</tbody>
544 544
 				</table>
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 				 *
550 550
 				 * @since 1.0
551 551
 				 */
552
-				do_action( 'give_reports_tab_export_content_bottom' );
552
+				do_action('give_reports_tab_export_content_bottom');
553 553
 				?>
554 554
 
555 555
 			</div>
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	<?php
561 561
 }
562 562
 
563
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
563
+add_action('give_reports_tab_export', 'give_reports_tab_export');
564 564
 
565 565
 /**
566 566
  * Renders the Reports page
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
  */
571 571
 function give_reports_tab_logs() {
572 572
 
573
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
573
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
574 574
 
575 575
 	// Get current section.
576 576
 	$current_section = $_GET['section'] = give_get_current_setting_section();
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 *
581 581
 	 * @since 1.0
582 582
 	 */
583
-	do_action( "give_logs_view_{$current_section}" );
583
+	do_action("give_logs_view_{$current_section}");
584 584
 }
585 585
 
586 586
 /**
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
  */
592 592
 function give_estimated_monthly_stats() {
593 593
 
594
-	$estimated = Give_Cache::get( 'give_estimated_monthly_stats', true );
594
+	$estimated = Give_Cache::get('give_estimated_monthly_stats', true);
595 595
 
596
-	if ( false === $estimated ) {
596
+	if (false === $estimated) {
597 597
 
598 598
 		$estimated = array(
599 599
 			'earnings' => 0,
@@ -602,22 +602,22 @@  discard block
 block discarded – undo
602 602
 
603 603
 		$stats = new Give_Payment_Stats;
604 604
 
605
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
606
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
605
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
606
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
607 607
 
608
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
609
-		$current_month = date( 'n', current_time( 'timestamp' ) );
610
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
611
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
608
+		$current_day   = date('d', current_time('timestamp'));
609
+		$current_month = date('n', current_time('timestamp'));
610
+		$current_year  = date('Y', current_time('timestamp'));
611
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
612 612
 
613
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
614
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
613
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
614
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
615 615
 
616 616
 		// Cache for one day
617
-		Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true );
617
+		Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true);
618 618
 	}
619 619
 
620
-	return maybe_unserialize( $estimated );
620
+	return maybe_unserialize($estimated);
621 621
 }
622 622
 
623 623
 // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file.
Please login to merge, or discard this patch.