Test Failed
Pull Request — master (#3256)
by Devin
07:52 queued 10s
created
includes/class-give-cli-commands.php 1 patch
Spacing   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
14 14
 // Add give command.
15
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
15
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
16 16
 
17 17
 
18 18
 /**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @subcommand    logo
78 78
 	 */
79
-	public function ascii( $args, $assoc_args ) {
80
-		WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/dist/images/give-ascii-logo.txt' ) );
79
+	public function ascii($args, $assoc_args) {
80
+		WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/dist/images/give-ascii-logo.txt'));
81 81
 	}
82 82
 
83 83
 
@@ -102,54 +102,54 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @subcommand    details
104 104
 	 */
105
-	public function details( $args, $assoc_args ) {
105
+	public function details($args, $assoc_args) {
106 106
 
107 107
 		/**
108 108
 		 * Plugin Information
109 109
 		 */
110
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
110
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
111 111
 
112 112
 		/**
113 113
 		 * General Information.
114 114
 		 */
115
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
115
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
116 116
 
117
-		$success_page = give_get_option( 'success_page' );
118
-		$failure_page = give_get_option( 'failure_page' );
119
-		$history_page = give_get_option( 'history_page' );
117
+		$success_page = give_get_option('success_page');
118
+		$failure_page = give_get_option('failure_page');
119
+		$history_page = give_get_option('history_page');
120 120
 
121
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
122
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
123
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
124
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
121
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
122
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
123
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
124
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
125 125
 
126 126
 		/**
127 127
 		 * Currency Information.
128 128
 		 */
129
-		$default_gateway = give_get_option( 'default_gateway' );
129
+		$default_gateway = give_get_option('default_gateway');
130 130
 
131
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
131
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
132 132
 
133
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
134
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
135
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
136
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
137
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
138
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) );
139
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) );
133
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
134
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
135
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
136
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
137
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
138
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
139
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
140 140
 
141 141
 		// Payment gateways Information.
142
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
143
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
142
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
143
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
144 144
 
145
-		if ( ! empty( $gateways ) ) {
145
+		if ( ! empty($gateways)) {
146 146
 			self::$counter = 1;
147
-			foreach ( $gateways as $gateway ) {
148
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
149
-				self::$counter ++;
147
+			foreach ($gateways as $gateway) {
148
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
149
+				self::$counter++;
150 150
 			}
151 151
 		} else {
152
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
152
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
153 153
 		}
154 154
 	}
155 155
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @subcommand    forms
183 183
 	 */
184
-	public function forms( $args, $assoc_args ) {
184
+	public function forms($args, $assoc_args) {
185 185
 		global $wp_query;
186
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
187
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
186
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
187
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
188 188
 		$start   = time();
189 189
 
190 190
 		// Cache previous number query var.
191 191
 		$is_set_number = $cache_per_page = false;
192
-		if ( isset( $wp_query->query_vars['number'] ) ) {
192
+		if (isset($wp_query->query_vars['number'])) {
193 193
 			$cache_per_page = $wp_query->query_vars['number'];
194 194
 			$is_set_number  = true;
195 195
 		}
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 		$wp_query->query_vars['number'] = $number;
199 199
 
200 200
 		// Get forms.
201
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
201
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
202 202
 
203 203
 		// Reset number query var.
204
-		if ( $is_set_number ) {
204
+		if ($is_set_number) {
205 205
 			$wp_query->query_vars['number'] = $cache_per_page;
206 206
 		}
207 207
 
208 208
 		// Bailout.
209
-		if ( array_key_exists( 'error', $forms ) ) {
209
+		if (array_key_exists('error', $forms)) {
210 210
 
211
-			WP_CLI::warning( $forms['error'] );
211
+			WP_CLI::warning($forms['error']);
212 212
 
213 213
 			return;
214
-		} elseif ( empty( $forms['forms'] ) ) {
214
+		} elseif (empty($forms['forms'])) {
215 215
 
216
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
216
+			WP_CLI::error(__('No forms found.', 'give'));
217 217
 
218 218
 			return;
219 219
 		}
@@ -221,25 +221,25 @@  discard block
 block discarded – undo
221 221
 		// Param to check if form typeis already showed or not.
222 222
 		$is_show_form_type = false;
223 223
 
224
-		if ( 1 === count( $forms ) && $form_id ) {
224
+		if (1 === count($forms) && $form_id) {
225 225
 			// Show single form.
226
-			foreach ( $forms['forms'][0] as $key => $info ) {
227
-				switch ( $key ) {
226
+			foreach ($forms['forms'][0] as $key => $info) {
227
+				switch ($key) {
228 228
 					case 'stats':
229
-						$this->color_main_heading( ucfirst( $key ) );
229
+						$this->color_main_heading(ucfirst($key));
230 230
 
231
-						foreach ( $info as $heading => $data ) {
232
-							$this->color_sub_heading( ucfirst( $heading ) );
233
-							switch ( $heading ) {
231
+						foreach ($info as $heading => $data) {
232
+							$this->color_sub_heading(ucfirst($heading));
233
+							switch ($heading) {
234 234
 								default:
235
-									foreach ( $data as $subheading => $subdata ) {
235
+									foreach ($data as $subheading => $subdata) {
236 236
 
237
-										switch ( $subheading ) {
237
+										switch ($subheading) {
238 238
 											case 'earnings':
239
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
239
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
240 240
 												break;
241 241
 											default:
242
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
242
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
243 243
 										}
244 244
 									}
245 245
 							}
@@ -249,26 +249,26 @@  discard block
 block discarded – undo
249 249
 					case 'pricing':
250 250
 					case 'info':
251 251
 					default:
252
-						$this->color_main_heading( ucfirst( $key ) );
252
+						$this->color_main_heading(ucfirst($key));
253 253
 
254 254
 						// Show form type.
255
-						if ( ! $is_show_form_type ) {
256
-							$form              = new Give_Donate_Form( $form_id );
255
+						if ( ! $is_show_form_type) {
256
+							$form              = new Give_Donate_Form($form_id);
257 257
 							$is_show_form_type = true;
258 258
 
259
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
259
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
260 260
 						}
261 261
 
262
-						foreach ( $info as $heading => $data ) {
262
+						foreach ($info as $heading => $data) {
263 263
 
264
-							switch ( $heading ) {
264
+							switch ($heading) {
265 265
 								case 'id':
266
-									WP_CLI::log( $this->color_message( $heading, $data ) );
266
+									WP_CLI::log($this->color_message($heading, $data));
267 267
 									break;
268 268
 
269 269
 								default:
270
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
271
-									WP_CLI::log( $this->color_message( $heading, $data ) );
270
+									$data = empty($data) ? __('Not set', 'give') : $data;
271
+									WP_CLI::log($this->color_message($heading, $data));
272 272
 							}
273 273
 						}
274 274
 				}// End switch().
@@ -279,37 +279,37 @@  discard block
 block discarded – undo
279 279
 			$is_table_first_row_set = false;
280 280
 			$table_column_count     = 0;
281 281
 
282
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
282
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
283 283
 
284
-			foreach ( $forms['forms'] as $index => $form_data ) {
284
+			foreach ($forms['forms'] as $index => $form_data) {
285 285
 
286 286
 				// Default table data.
287 287
 				$table_first_row = array();
288 288
 				$table_row       = array();
289 289
 
290
-				foreach ( $form_data['info'] as $key => $form ) {
290
+				foreach ($form_data['info'] as $key => $form) {
291 291
 
292 292
 					// Do not show thumbnail, content and link in table.
293
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
293
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
294 294
 						continue;
295 295
 					}
296 296
 
297
-					if ( ! $is_table_first_row_set ) {
297
+					if ( ! $is_table_first_row_set) {
298 298
 						$table_first_row[] = $key;
299 299
 					}
300 300
 
301 301
 					$table_row[] = $form;
302 302
 
303
-					if ( 'status' === $key ) {
303
+					if ('status' === $key) {
304 304
 						// First array item will be an form id in our case.
305
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
305
+						$form = new Give_Donate_Form(absint($table_row[0]));
306 306
 
307 307
 						$table_row[] = $form->get_type();
308 308
 					}
309 309
 				}
310 310
 
311 311
 				// Set table first row.
312
-				if ( ! $is_table_first_row_set ) {
312
+				if ( ! $is_table_first_row_set) {
313 313
 
314 314
 					// Add extra column to table.
315 315
 					$table_first_row[] = 'type';
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 				$table_data[] = $table_row;
323 323
 			}// End foreach().
324 324
 
325
-			$this->display_table( $table_data );
325
+			$this->display_table($table_data);
326 326
 		}// End if().
327 327
 	}
328 328
 
@@ -375,59 +375,59 @@  discard block
 block discarded – undo
375 375
 	 *
376 376
 	 * @subcommand    donors
377 377
 	 */
378
-	public function donors( $args, $assoc_args ) {
378
+	public function donors($args, $assoc_args) {
379 379
 		global $wp_query;
380
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
381
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
382
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
383
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
384
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
385
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
386
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
380
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
381
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
382
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
383
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
384
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
385
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
386
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
387 387
 		$start    = time();
388 388
 
389
-		if ( $create ) {
390
-			if ( 80 < $create ) {
391
-				WP_CLI::warning( 'Currently we can only generate maximum 80 donors.', 'give' );
389
+		if ($create) {
390
+			if (80 < $create) {
391
+				WP_CLI::warning('Currently we can only generate maximum 80 donors.', 'give');
392 392
 				$create = 80;
393 393
 			}
394 394
 
395 395
 			$number = 1;
396 396
 
397
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
398
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
397
+			if (isset($assoc_args['email']) && ! is_email($email)) {
398
+				WP_CLI::warning('Wrong email address provided.', 'give');
399 399
 
400 400
 				return;
401 401
 			}
402 402
 
403 403
 			// Create one or more donors.
404
-			if ( ! $email ) {
404
+			if ( ! $email) {
405 405
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
406
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
406
+				$number = is_numeric($create) ? absint($create) : 1;
407 407
 			}
408 408
 
409
-			for ( $i = 0; $i < $number; $i ++ ) {
409
+			for ($i = 0; $i < $number; $i++) {
410 410
 				$name  = $name ? $name : $this->get_random_name();
411
-				$email = $email ? $email : $this->get_random_email( $name );
411
+				$email = $email ? $email : $this->get_random_email($name);
412 412
 
413 413
 				$args = array(
414 414
 					'email' => $email,
415 415
 					'name'  => $name,
416 416
 				);
417 417
 
418
-				$donor_id = Give()->donors->add( $args );
418
+				$donor_id = Give()->donors->add($args);
419 419
 
420
-				if ( $donor_id ) {
421
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) );
420
+				if ($donor_id) {
421
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id)));
422 422
 				} else {
423
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
423
+					WP_CLI::error(__('Failed to create donor', 'give'));
424 424
 				}
425 425
 
426 426
 				// Reset email and name to false so it is generated on the next loop (if creating donors).
427 427
 				$email = $name = false;
428 428
 			}
429 429
 
430
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
430
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
431 431
 
432 432
 		} else {
433 433
 			// Counter.
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 			 */
442 442
 			// Cache previous number query var.
443 443
 			$is_set_number = $cache_per_page = false;
444
-			if ( isset( $wp_query->query_vars['number'] ) ) {
444
+			if (isset($wp_query->query_vars['number'])) {
445 445
 				$cache_per_page = $wp_query->query_vars['number'];
446 446
 				$is_set_number  = true;
447 447
 			}
@@ -450,24 +450,24 @@  discard block
 block discarded – undo
450 450
 			$wp_query->query_vars['number'] = $number;
451 451
 
452 452
 			// Get donors.
453
-			if ( $form_id ) {
453
+			if ($form_id) {
454 454
 				// @TODO: Allow user to get a list of donors by donation status.
455
-				$donors = $this->get_donors_by_form_id( $form_id );
455
+				$donors = $this->get_donors_by_form_id($form_id);
456 456
 			} else {
457
-				$donors = $this->api->get_donors( $search );
457
+				$donors = $this->api->get_donors($search);
458 458
 			}
459 459
 
460 460
 			// Reset number query var.
461
-			if ( $is_set_number ) {
461
+			if ($is_set_number) {
462 462
 				$wp_query->query_vars['number'] = $cache_per_page;
463 463
 			}
464 464
 
465
-			if ( isset( $donors['error'] ) ) {
466
-				WP_CLI::error( $donors['error'] );
465
+			if (isset($donors['error'])) {
466
+				WP_CLI::error($donors['error']);
467 467
 			}
468 468
 
469
-			if ( empty( $donors ) ) {
470
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
469
+			if (empty($donors)) {
470
+				WP_CLI::error(__('No donors found.', 'give'));
471 471
 
472 472
 				return;
473 473
 			}
@@ -475,24 +475,24 @@  discard block
 block discarded – undo
475 475
 			$table_data             = array();
476 476
 			$is_table_first_row_set = false;
477 477
 
478
-			foreach ( $donors['donors'] as $donor_data ) {
478
+			foreach ($donors['donors'] as $donor_data) {
479 479
 				// Set default table row data.
480
-				$table_first_row = array( __( 's_no', 'give' ) );
481
-				$table_row       = array( self::$counter );
480
+				$table_first_row = array(__('s_no', 'give'));
481
+				$table_row       = array(self::$counter);
482 482
 
483
-				foreach ( $donor_data as $key => $donor ) {
484
-					switch ( $key ) {
483
+				foreach ($donor_data as $key => $donor) {
484
+					switch ($key) {
485 485
 						case 'stats':
486
-							foreach ( $donor as $heading => $data ) {
486
+							foreach ($donor as $heading => $data) {
487 487
 
488 488
 								// Get first row.
489
-								if ( ! $is_table_first_row_set ) {
489
+								if ( ! $is_table_first_row_set) {
490 490
 									$table_first_row[] = $heading;
491 491
 								}
492 492
 
493
-								switch ( $heading ) {
493
+								switch ($heading) {
494 494
 									case 'total_spent':
495
-										$table_row[] = give_currency_filter( $data );
495
+										$table_row[] = give_currency_filter($data);
496 496
 										break;
497 497
 
498 498
 									default:
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 
504 504
 						case 'info':
505 505
 						default:
506
-							foreach ( $donor as $heading => $data ) {
506
+							foreach ($donor as $heading => $data) {
507 507
 
508 508
 								// Get first row.
509
-								if ( ! $is_table_first_row_set ) {
509
+								if ( ! $is_table_first_row_set) {
510 510
 									$table_first_row[] = $heading;
511 511
 								}
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 				}
517 517
 
518 518
 				// Add first row data to table data.
519
-				if ( ! $is_table_first_row_set ) {
519
+				if ( ! $is_table_first_row_set) {
520 520
 					$table_data[]           = $table_first_row;
521 521
 					$is_table_first_row_set = true;
522 522
 				}
@@ -525,44 +525,44 @@  discard block
 block discarded – undo
525 525
 				$table_data[] = $table_row;
526 526
 
527 527
 				// Increase counter.
528
-				self::$counter ++;
528
+				self::$counter++;
529 529
 			}// End foreach().
530 530
 
531
-			switch ( $format ) {
531
+			switch ($format) {
532 532
 				case 'json':
533 533
 					$table_column_name = $table_data[0];
534
-					unset( $table_data[0] );
534
+					unset($table_data[0]);
535 535
 
536 536
 					$new_table_data = array();
537
-					foreach ( $table_data as $index => $data ) {
538
-						foreach ( $data as $key => $value ) {
539
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
537
+					foreach ($table_data as $index => $data) {
538
+						foreach ($data as $key => $value) {
539
+							$new_table_data[$index][$table_column_name[$key]] = $value;
540 540
 						}
541 541
 					}
542 542
 
543
-					WP_CLI::log( json_encode( $new_table_data ) );
543
+					WP_CLI::log(json_encode($new_table_data));
544 544
 					break;
545 545
 
546 546
 				case 'csv':
547
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
548
-					$fp        = fopen( $file_path, 'w' );
547
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
548
+					$fp        = fopen($file_path, 'w');
549 549
 
550
-					if ( is_writable( $file_path ) ) {
551
-						foreach ( $table_data as $fields ) {
552
-							fputcsv( $fp, $fields );
550
+					if (is_writable($file_path)) {
551
+						foreach ($table_data as $fields) {
552
+							fputcsv($fp, $fields);
553 553
 						}
554 554
 
555
-						fclose( $fp );
555
+						fclose($fp);
556 556
 
557
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
557
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
558 558
 					} else {
559
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
559
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
560 560
 					}
561 561
 
562 562
 					break;
563 563
 
564 564
 				default:
565
-					$this->display_table( $table_data );
565
+					$this->display_table($table_data);
566 566
 			}// End switch().
567 567
 		}// End if().
568 568
 	}
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 	 *
593 593
 	 * @subcommand    donations
594 594
 	 */
595
-	public function donations( $args, $assoc_args ) {
595
+	public function donations($args, $assoc_args) {
596 596
 		global $wp_query;
597
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
597
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
598 598
 
599 599
 		// Cache previous number query var.
600 600
 		$is_set_number = $cache_per_page = false;
601
-		if ( isset( $wp_query->query_vars['number'] ) ) {
601
+		if (isset($wp_query->query_vars['number'])) {
602 602
 			$cache_per_page = $wp_query->query_vars['number'];
603 603
 			$is_set_number  = true;
604 604
 		}
@@ -610,46 +610,46 @@  discard block
 block discarded – undo
610 610
 		$donations = $this->api->get_recent_donations();
611 611
 
612 612
 		// Reset number query var.
613
-		if ( $is_set_number ) {
613
+		if ($is_set_number) {
614 614
 			$wp_query->query_vars['number'] = $cache_per_page;
615 615
 		}
616 616
 
617
-		if ( empty( $donations ) ) {
618
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
617
+		if (empty($donations)) {
618
+			WP_CLI::error(__('No donations found.', 'give'));
619 619
 
620 620
 			return;
621 621
 		}
622 622
 
623 623
 		self::$counter = 1;
624 624
 
625
-		foreach ( $donations['donations'] as $key => $donation ) {
626
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
627
-			self::$counter ++;
625
+		foreach ($donations['donations'] as $key => $donation) {
626
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
627
+			self::$counter++;
628 628
 
629
-			foreach ( $donation as $column => $data ) {
629
+			foreach ($donation as $column => $data) {
630 630
 
631
-				if ( is_array( $data ) ) {
632
-					$this->color_sub_heading( $column );
633
-					foreach ( $data as $subcolumn => $subdata ) {
631
+				if (is_array($data)) {
632
+					$this->color_sub_heading($column);
633
+					foreach ($data as $subcolumn => $subdata) {
634 634
 
635 635
 						// Decode html codes.
636
-						switch ( $subcolumn ) {
636
+						switch ($subcolumn) {
637 637
 							case 'name':
638
-								$subdata = html_entity_decode( $subdata );
638
+								$subdata = html_entity_decode($subdata);
639 639
 								break;
640 640
 						}
641 641
 
642 642
 						// @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta.
643
-						if ( is_array( $subdata ) ) {
643
+						if (is_array($subdata)) {
644 644
 							continue;
645 645
 						}
646 646
 
647
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
647
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
648 648
 					}
649 649
 					continue;
650 650
 				}
651 651
 
652
-				WP_CLI::log( $this->color_message( $column, $data ) );
652
+				WP_CLI::log($this->color_message($column, $data));
653 653
 			}
654 654
 		}
655 655
 	}
@@ -689,27 +689,27 @@  discard block
 block discarded – undo
689 689
 	 *
690 690
 	 * @return        void
691 691
 	 */
692
-	public function report( $args, $assoc_args ) {
692
+	public function report($args, $assoc_args) {
693 693
 		$stats      = new Give_Payment_Stats();
694
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
695
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
696
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
697
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
694
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
695
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
696
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
697
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
698 698
 
699
-		if ( ! empty( $date ) ) {
699
+		if ( ! empty($date)) {
700 700
 			$start_date = $date;
701 701
 			$end_date   = false;
702
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
702
+		} elseif (empty($date) && empty($start_date)) {
703 703
 			$start_date = 'this_month';
704 704
 			$end_date   = false;
705 705
 		}
706 706
 
707 707
 		// Get stats.
708
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
709
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
708
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
709
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
710 710
 
711
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings, array( 'decode_currency' => true ) ) ) );
712
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
711
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings, array('decode_currency' => true))));
712
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
713 713
 	}
714 714
 
715 715
 
@@ -736,27 +736,27 @@  discard block
 block discarded – undo
736 736
 	 *
737 737
 	 * @subcommand    cache
738 738
 	 */
739
-	public function cache( $args, $assoc_args ) {
740
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
739
+	public function cache($args, $assoc_args) {
740
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
741 741
 
742 742
 		// Bailout.
743
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
744
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
743
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
744
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
745 745
 
746 746
 			return;
747 747
 		}
748 748
 
749
-		switch ( $action ) {
749
+		switch ($action) {
750 750
 			case 'delete':
751 751
 				// Reset counter.
752 752
 				self::$counter = 1;
753 753
 
754
-				if ( $this->delete_stats_transients() ) {
754
+				if ($this->delete_stats_transients()) {
755 755
 					// Report .eading.
756
-					WP_CLI::success( 'Give cache deleted.' );
756
+					WP_CLI::success('Give cache deleted.');
757 757
 				} else {
758 758
 					// Report .eading.
759
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
759
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
760 760
 				}
761 761
 				break;
762 762
 		}
@@ -785,27 +785,27 @@  discard block
 block discarded – undo
785 785
 			ARRAY_A
786 786
 		);
787 787
 
788
-		if ( ! empty( $stat_option_names ) ) {
788
+		if ( ! empty($stat_option_names)) {
789 789
 
790
-			foreach ( $stat_option_names as $option_name ) {
790
+			foreach ($stat_option_names as $option_name) {
791 791
 				$error       = false;
792 792
 				$option_name = $option_name['option_name'];
793 793
 
794
-				switch ( true ) {
795
-					case ( false !== strpos( $option_name, 'transient' ) ):
796
-						$option_name = str_replace( '_transient_', '', $option_name );
797
-						$error       = delete_transient( $option_name );
794
+				switch (true) {
795
+					case (false !== strpos($option_name, 'transient')):
796
+						$option_name = str_replace('_transient_', '', $option_name);
797
+						$error       = delete_transient($option_name);
798 798
 						break;
799 799
 
800 800
 					default:
801
-						$error = delete_option( $option_name );
801
+						$error = delete_option($option_name);
802 802
 				}
803 803
 
804
-				if ( $error ) {
805
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
806
-					self::$counter ++;
804
+				if ($error) {
805
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
806
+					self::$counter++;
807 807
 				} else {
808
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
808
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
809 809
 				}
810 810
 			}
811 811
 
@@ -826,13 +826,13 @@  discard block
 block discarded – undo
826 826
 	 *
827 827
 	 * @return   string
828 828
 	 */
829
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
829
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
830 830
 		// Add colon.
831
-		if ( $colon ) {
832
-			$heading = $heading . ': ';
831
+		if ($colon) {
832
+			$heading = $heading.': ';
833 833
 		}
834 834
 
835
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
835
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
836 836
 	}
837 837
 
838 838
 
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 	 *
848 848
 	 * @return    void
849 849
 	 */
850
-	private function color_main_heading( $heading, $color = 'g' ) {
851
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
850
+	private function color_main_heading($heading, $color = 'g') {
851
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
852 852
 	}
853 853
 
854 854
 	/**
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	 *
862 862
 	 * @return    void
863 863
 	 */
864
-	private function color_sub_heading( $subheading ) {
865
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
864
+	private function color_sub_heading($subheading) {
865
+		WP_CLI::log("\n--->".$subheading.'', '', false);
866 866
 	}
867 867
 
868 868
 
@@ -876,17 +876,17 @@  discard block
 block discarded – undo
876 876
 	 *
877 877
 	 * @return    void
878 878
 	 */
879
-	private function display_table( $data ) {
879
+	private function display_table($data) {
880 880
 		$table = new \cli\Table();
881 881
 
882 882
 		// Set table header.
883
-		$table->setHeaders( $data[0] );
883
+		$table->setHeaders($data[0]);
884 884
 
885 885
 		// Remove table header.
886
-		unset( $data[0] );
886
+		unset($data[0]);
887 887
 
888 888
 		// Set table data.
889
-		$table->setRows( $data );
889
+		$table->setRows($data);
890 890
 
891 891
 		// Display table.
892 892
 		$table->display();
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 	 * @return array
904 904
 	 */
905 905
 
906
-	private function get_donors_by_form_id( $form_id ) {
906
+	private function get_donors_by_form_id($form_id) {
907 907
 		$donors = array();
908 908
 
909 909
 		$donations = new Give_Payments_Query(
910 910
 			array(
911
-				'give_forms' => array( $form_id ),
912
-				'number'     => - 1,
913
-				'status'     => array( 'publish' ),
911
+				'give_forms' => array($form_id),
912
+				'number'     => -1,
913
+				'status'     => array('publish'),
914 914
 			)
915 915
 		);
916 916
 
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
 		$skip_donors = array();
919 919
 
920 920
 		/* @var Give_Payment|object $donation Payment object. */
921
-		foreach ( $donations as $donation ) {
921
+		foreach ($donations as $donation) {
922 922
 
923
-			if ( in_array( $donation->customer_id, $skip_donors, true ) ) {
923
+			if (in_array($donation->customer_id, $skip_donors, true)) {
924 924
 				continue;
925 925
 			}
926 926
 
927
-			if ( ! empty( $donors ) ) {
928
-				$donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) );
927
+			if ( ! empty($donors)) {
928
+				$donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id)));
929 929
 			} else {
930
-				$donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) );
930
+				$donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id));
931 931
 			}
932 932
 
933 933
 			$skip_donors[] = $donation->customer_id;
@@ -972,15 +972,15 @@  discard block
 block discarded – undo
972 972
 		);
973 973
 
974 974
 		// Generate a random forename.
975
-		$random_name = $names[ mt_rand( 0, sizeof( $names ) - 1 ) ];
975
+		$random_name = $names[mt_rand(0, sizeof($names) - 1)];
976 976
 
977 977
 		// Generate a random surname.
978
-		$random_surname = $surnames[ mt_rand( 0, sizeof( $surnames ) - 1 ) ];
978
+		$random_surname = $surnames[mt_rand(0, sizeof($surnames) - 1)];
979 979
 
980 980
 		// Generate name.
981 981
 		$name = "{$random_name} {$random_surname}";
982 982
 
983
-		if ( in_array( $name, $this->new_donor_names ) ) {
983
+		if (in_array($name, $this->new_donor_names)) {
984 984
 			$name = $this->get_random_name();
985 985
 		}
986 986
 
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
 	 *
1000 1000
 	 * @return string
1001 1001
 	 */
1002
-	private function get_random_email( $name ) {
1003
-		return implode( '.', explode( ' ', strtolower( $name ) ) ) . '@test.com';
1002
+	private function get_random_email($name) {
1003
+		return implode('.', explode(' ', strtolower($name))).'@test.com';
1004 1004
 	}
1005 1005
 
1006 1006
 	/**
@@ -1015,59 +1015,59 @@  discard block
 block discarded – undo
1015 1015
 	 * @when after_wp_load
1016 1016
 	 * @subcommand test-mode
1017 1017
 	 */
1018
-	public function test_mode( $args, $assoc ) {
1018
+	public function test_mode($args, $assoc) {
1019 1019
 
1020 1020
 		// Return if associative arguments are not specified.
1021
-		if ( empty( $assoc ) ) {
1022
-			WP_CLI::error( "--enable or --disable flag is missing." );
1021
+		if (empty($assoc)) {
1022
+			WP_CLI::error("--enable or --disable flag is missing.");
1023 1023
 			return;
1024 1024
 		}
1025 1025
 
1026
-		$enabled_gateways = give_get_option( 'gateways' );
1027
-		$default_gateway  = give_get_option( 'default_gateway' );
1026
+		$enabled_gateways = give_get_option('gateways');
1027
+		$default_gateway  = give_get_option('default_gateway');
1028 1028
 
1029 1029
 
1030 1030
 		// Enable Test Mode.
1031
-		if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'enable' ) ) {
1031
+		if (true === WP_CLI\Utils\get_flag_value($assoc, 'enable')) {
1032 1032
 
1033 1033
 			// Set `Test Mode` to `enabled`.
1034
-			give_update_option( 'test_mode', 'enabled' );
1034
+			give_update_option('test_mode', 'enabled');
1035 1035
 
1036 1036
 
1037 1037
 			// Enable `Test Donation` gateway.
1038 1038
 			$enabled_gateways['manual'] = "1";
1039
-			give_update_option( 'gateways', $enabled_gateways );
1039
+			give_update_option('gateways', $enabled_gateways);
1040 1040
 
1041 1041
 
1042 1042
 			// Set `Test Donation` as default gateway.
1043
-			add_option( 'give_test_mode_default_gateway', $default_gateway );
1044
-			give_update_option( 'default_gateway', 'manual' );
1043
+			add_option('give_test_mode_default_gateway', $default_gateway);
1044
+			give_update_option('default_gateway', 'manual');
1045 1045
 
1046 1046
 
1047 1047
 			// Show success message on completion.
1048
-			WP_CLI::success( 'Give Test mode enabled' );
1048
+			WP_CLI::success('Give Test mode enabled');
1049 1049
 		}
1050 1050
 
1051 1051
 		// Disable Test Mode.
1052
-		if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'disable' ) ) {
1052
+		if (true === WP_CLI\Utils\get_flag_value($assoc, 'disable')) {
1053 1053
 
1054 1054
 			// Set `Test Mode` to `disabled`.
1055
-			give_update_option( 'test_mode', 'disabled' );
1055
+			give_update_option('test_mode', 'disabled');
1056 1056
 
1057 1057
 
1058 1058
 			// Disable `Test Donation` gateway.
1059
-			unset( $enabled_gateways['manual'] );
1060
-			give_update_option( 'gateways', $enabled_gateways );
1059
+			unset($enabled_gateways['manual']);
1060
+			give_update_option('gateways', $enabled_gateways);
1061 1061
 
1062 1062
 
1063 1063
 			// Backup `Default Gateway` setting for restore on test mode disable.
1064
-			$default_gateway_backup = get_option( 'give_test_mode_default_gateway' );
1065
-			give_update_option( 'default_gateway', $default_gateway_backup );
1066
-			delete_option( 'give_test_mode_default_gateway' );
1064
+			$default_gateway_backup = get_option('give_test_mode_default_gateway');
1065
+			give_update_option('default_gateway', $default_gateway_backup);
1066
+			delete_option('give_test_mode_default_gateway');
1067 1067
 
1068 1068
 
1069 1069
 			// Show success message on completion.
1070
-			WP_CLI::success( 'Give Test mode disabled' );
1070
+			WP_CLI::success('Give Test mode disabled');
1071 1071
 		}
1072 1072
 	}
1073 1073
 
@@ -1082,8 +1082,8 @@  discard block
 block discarded – undo
1082 1082
 	 *
1083 1083
 	 * @return boolean
1084 1084
 	 */
1085
-	private function is_git_repo( $repo_path ) {
1086
-		if ( is_dir( "{$repo_path}.git" ) ) {
1085
+	private function is_git_repo($repo_path) {
1086
+		if (is_dir("{$repo_path}.git")) {
1087 1087
 			return true;
1088 1088
 		}
1089 1089
 
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
 	 *
1101 1101
 	 * @return string
1102 1102
 	 */
1103
-	private function get_git_current_branch( $repo_path ) {
1103
+	private function get_git_current_branch($repo_path) {
1104 1104
 
1105
-		exec( "cd $repo_path && git branch | grep '\*'", $branch_names );
1105
+		exec("cd $repo_path && git branch | grep '\*'", $branch_names);
1106 1106
 
1107
-		$branch_name = trim( strtolower( str_replace( '* ', '', $branch_names[0] ) ) );
1107
+		$branch_name = trim(strtolower(str_replace('* ', '', $branch_names[0])));
1108 1108
 
1109 1109
 		return $branch_name;
1110 1110
 	}
@@ -1134,59 +1134,59 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @subcommand addon-update
1136 1136
 	 */
1137
-	public function addon_update( $pos, $assoc ) {
1137
+	public function addon_update($pos, $assoc) {
1138 1138
 
1139 1139
 		/**
1140 1140
 		 * Only 1 associative argument should be passed.
1141 1141
 		 * It can be either `--name` or `--exclude`
1142 1142
 		 */
1143
-		if ( count( $assoc ) > 1 ) {
1144
-			WP_CLI::error( __( 'Too many associative arguments.', 'give' ) );
1143
+		if (count($assoc) > 1) {
1144
+			WP_CLI::error(__('Too many associative arguments.', 'give'));
1145 1145
 		}
1146 1146
 
1147 1147
 		/**
1148 1148
 		 * Update a single Give addon.
1149 1149
 		 */
1150
-		if ( false !== ( $addon_name = WP_CLI\Utils\get_flag_value( $assoc, 'name', false ) ) ) {
1151
-			$give_addon_path = glob( WP_CONTENT_DIR . "/plugins/$addon_name/" , GLOB_ONLYDIR );
1150
+		if (false !== ($addon_name = WP_CLI\Utils\get_flag_value($assoc, 'name', false))) {
1151
+			$give_addon_path = glob(WP_CONTENT_DIR."/plugins/$addon_name/", GLOB_ONLYDIR);
1152 1152
 
1153 1153
 			/**
1154 1154
 			 * Display error if the plugin (addon) name entered does
1155 1155
 			 * not exist.
1156 1156
 			 */
1157
-			if ( empty( $give_addon_path ) ) {
1158
-				WP_CLI::error( sprintf( __( "The Give addon '%s' does not exist.", 'give' ), $addon_name ) );
1157
+			if (empty($give_addon_path)) {
1158
+				WP_CLI::error(sprintf(__("The Give addon '%s' does not exist.", 'give'), $addon_name));
1159 1159
 			}
1160 1160
 
1161 1161
 			/**
1162 1162
 			 * If the directory does not contain a Git
1163 1163
 			 * repository, then display error and halt.
1164 1164
 			 */
1165
-			if ( ! $this->is_git_repo( $give_addon_path[0] ) ) {
1166
-				WP_CLI::error( __( 'This is not a Git repo', 'give' ) );
1165
+			if ( ! $this->is_git_repo($give_addon_path[0])) {
1166
+				WP_CLI::error(__('This is not a Git repo', 'give'));
1167 1167
 			}
1168 1168
 
1169 1169
 			/**
1170 1170
 			 * Get the current branch name. This branch will be updated next.
1171 1171
 			 */
1172
-			$branch_name = $this->get_git_current_branch( $give_addon_path[0] );
1172
+			$branch_name = $this->get_git_current_branch($give_addon_path[0]);
1173 1173
 
1174 1174
 			/**
1175 1175
 			 * Take the latest pull of the current branch, i.e.;
1176 1176
 			 * sync it with origin.
1177 1177
 			 */
1178
-			passthru( "cd $give_addon_path[0] && git pull origin $branch_name", $return_var );
1178
+			passthru("cd $give_addon_path[0] && git pull origin $branch_name", $return_var);
1179 1179
 
1180 1180
 			/**
1181 1181
 			 * Show success/error messages depending on whether the
1182 1182
 			 * current branch of the addon was updated or not.
1183 1183
 			 */
1184
-			if ( 0 === $return_var ) {
1185
-				WP_CLI::success( sprintf( __( "The Give addon '%s' is up-to-date with origin." ), $addon_name ) );
1184
+			if (0 === $return_var) {
1185
+				WP_CLI::success(sprintf(__("The Give addon '%s' is up-to-date with origin."), $addon_name));
1186 1186
 
1187 1187
 				return;
1188
-			} elseif ( 1 === $return_var ) {
1189
-				WP_CLI::error( sprintf( __( "The Give addon '%s' was not updated." ), $addon_name ) );
1188
+			} elseif (1 === $return_var) {
1189
+				WP_CLI::error(sprintf(__("The Give addon '%s' was not updated."), $addon_name));
1190 1190
 			}
1191 1191
 		}
1192 1192
 
@@ -1194,34 +1194,34 @@  discard block
 block discarded – undo
1194 1194
 		 * Convert the comma-separated string of Give-addons in the
1195 1195
 		 * excluded list into array.
1196 1196
 		 */
1197
-		$addon_names = WP_CLI\Utils\get_flag_value( $assoc, 'exclude', array() );
1198
-		if ( ! empty( $addon_names ) ) {
1199
-			$addon_names = array_map( 'trim', explode( ',', $addon_names ) );
1197
+		$addon_names = WP_CLI\Utils\get_flag_value($assoc, 'exclude', array());
1198
+		if ( ! empty($addon_names)) {
1199
+			$addon_names = array_map('trim', explode(',', $addon_names));
1200 1200
 		}
1201 1201
 
1202 1202
 		/**
1203 1203
 		 * Get directory paths of all the addons including
1204 1204
 		 * Give Core.
1205 1205
 		 */
1206
-		$give_addon_directories = glob( WP_CONTENT_DIR . '/plugins/[gG]ive*/' , GLOB_ONLYDIR );
1206
+		$give_addon_directories = glob(WP_CONTENT_DIR.'/plugins/[gG]ive*/', GLOB_ONLYDIR);
1207 1207
 
1208
-		foreach ( $give_addon_directories as $repo ) {
1208
+		foreach ($give_addon_directories as $repo) {
1209 1209
 
1210 1210
 			/**
1211 1211
 			 * Extract the plugin/addon folder name
1212 1212
 			 * from the absolute path.
1213 1213
 			 */
1214
-			$plugin_name = basename( $repo );
1214
+			$plugin_name = basename($repo);
1215 1215
 
1216 1216
 			/**
1217 1217
 			 * If the Give addon directory does not contain
1218 1218
 			 * a Git repo, then continue.
1219 1219
 			 */
1220
-			if ( ! $this->is_git_repo( $repo ) ) {
1220
+			if ( ! $this->is_git_repo($repo)) {
1221 1221
 				WP_CLI::line(
1222 1222
 					sprintf(
1223
-						__( "%s: '%s' does not contain git repo.", 'give' ),
1224
-						WP_CLI::colorize( '%RError%n' ),
1223
+						__("%s: '%s' does not contain git repo.", 'give'),
1224
+						WP_CLI::colorize('%RError%n'),
1225 1225
 						$plugin_name
1226 1226
 					)
1227 1227
 				);
@@ -1232,34 +1232,34 @@  discard block
 block discarded – undo
1232 1232
 			/**
1233 1233
 			 * Continue if the Give addon name is in the exlusion list.
1234 1234
 			 */
1235
-			if ( in_array( $plugin_name, $addon_names, true ) ) {
1235
+			if (in_array($plugin_name, $addon_names, true)) {
1236 1236
 				continue;
1237 1237
 			}
1238 1238
 
1239 1239
 			/* Get the current branch name */
1240
-			$branch_name = $this->get_git_current_branch( $repo );
1240
+			$branch_name = $this->get_git_current_branch($repo);
1241 1241
 
1242 1242
 			/**
1243 1243
 			 * Show a colorized (CYAN) title for each addon/plugin
1244 1244
 			 * before a pull.
1245 1245
 			 */
1246
-			WP_CLI::line( WP_CLI::colorize( "> %CUpdating $plugin_name | $branch_name%n" ) );
1246
+			WP_CLI::line(WP_CLI::colorize("> %CUpdating $plugin_name | $branch_name%n"));
1247 1247
 
1248 1248
 			/**
1249 1249
 			 * Git pull from the current branch using
1250 1250
 			 * remote `origin`.
1251 1251
 			 */
1252
-			if ( ! empty( $branch_name ) ) {
1253
-				passthru( "cd $repo && git pull origin $branch_name", $return_var );
1252
+			if ( ! empty($branch_name)) {
1253
+				passthru("cd $repo && git pull origin $branch_name", $return_var);
1254 1254
 			}
1255 1255
 
1256 1256
 			$items[] = array(
1257 1257
 				'Give Addon' => $plugin_name,
1258 1258
 				'Branch'     => $branch_name,
1259 1259
 				'Remote'     => 'origin',
1260
-				'Status'     => ( 0 === $return_var )
1261
-					? __( 'Success', 'give' )
1262
-					: __( 'Failed', 'give' ),
1260
+				'Status'     => (0 === $return_var)
1261
+					? __('Success', 'give')
1262
+					: __('Failed', 'give'),
1263 1263
 			);
1264 1264
 
1265 1265
 			/**
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-grid.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Grid', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Grid', 'give');
28 28
 
29
-		parent::__construct( 'give_form_grid' );
29
+		parent::__construct('give_form_grid');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,73 +39,73 @@  discard block
 block discarded – undo
39 39
 		return array(
40 40
 			array(
41 41
 				'type' => 'container',
42
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
42
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
43 43
 			),
44 44
 			array(
45 45
 				'type'        => 'textbox',
46 46
 				'name'        => 'ids',
47
-				'label'       => esc_attr__( 'Form IDs:', 'give' ),
48
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ),
49
-				'placeholder' => esc_html__( 'All Forms', 'give' )
47
+				'label'       => esc_attr__('Form IDs:', 'give'),
48
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'),
49
+				'placeholder' => esc_html__('All Forms', 'give')
50 50
 			),
51 51
 			array(
52 52
 				'type'        => 'listbox',
53 53
 				'name'        => 'columns',
54
-				'label'       => esc_attr__( 'Columns:', 'give' ),
55
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
54
+				'label'       => esc_attr__('Columns:', 'give'),
55
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
56 56
 				'options'     => array(
57
-					'1' => esc_html__( '1', 'give' ),
58
-					'2' => esc_html__( '2', 'give' ),
59
-					'3' => esc_html__( '3', 'give' ),
60
-					'4' => esc_html__( '4', 'give' ),
57
+					'1' => esc_html__('1', 'give'),
58
+					'2' => esc_html__('2', 'give'),
59
+					'3' => esc_html__('3', 'give'),
60
+					'4' => esc_html__('4', 'give'),
61 61
 				),
62
-				'placeholder' => esc_html__( 'Best Fit', 'give' )
62
+				'placeholder' => esc_html__('Best Fit', 'give')
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_goal',
67
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
68
-				'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ),
67
+				'label'   => esc_attr__('Show Goal:', 'give'),
68
+				'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_excerpt',
77
-				'label'   => esc_attr__( 'Show Excerpt:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ),
77
+				'label'   => esc_attr__('Show Excerpt:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the excerpt?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'show_featured_image',
87
-				'label'   => esc_attr__( 'Show Featured Image:', 'give' ),
88
-				'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ),
87
+				'label'   => esc_attr__('Show Featured Image:', 'give'),
88
+				'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'),
89 89
 				'options' => array(
90
-					'true'  => esc_html__( 'Show', 'give' ),
91
-					'false' => esc_html__( 'Hide', 'give' ),
90
+					'true'  => esc_html__('Show', 'give'),
91
+					'false' => esc_html__('Hide', 'give'),
92 92
 				),
93 93
 			),
94 94
 			array(
95 95
 				'type'    => 'listbox',
96 96
 				'name'    => 'display_style',
97
-				'label'   => esc_attr__( 'Display Style:', 'give' ),
98
-				'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ),
97
+				'label'   => esc_attr__('Display Style:', 'give'),
98
+				'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'),
99 99
 				'options' => array(
100
-					'redirect'     => esc_html__( 'Redirect', 'give' ),
101
-					'modal_reveal' => esc_html__( 'Modal', 'give' ),
100
+					'redirect'     => esc_html__('Redirect', 'give'),
101
+					'modal_reveal' => esc_html__('Modal', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'textbox',
106 106
 				'name'    => 'forms_per_page',
107
-				'label'   => esc_attr__( 'Forms Per Page:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Sets the number of forms to display per page.', 'give' ),
107
+				'label'   => esc_attr__('Forms Per Page:', 'give'),
108
+				'tooltip' => esc_attr__('Sets the number of forms to display per page.', 'give'),
109 109
 				'value'   => 12,
110 110
 			),
111 111
 		);
Please login to merge, or discard this patch.
includes/admin/plugins.php 1 patch
Spacing   +77 added lines, -78 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array An array of updated action links.
25 25
  */
26
-function give_plugin_action_links( $actions ) {
26
+function give_plugin_action_links($actions) {
27 27
 	$new_actions = array(
28 28
 		'settings' => sprintf(
29 29
 			'<a href="%1$s">%2$s</a>',
30
-			admin_url( 'edit.php?post_type=give_forms&page=give-settings' ),
31
-			__( 'Settings', 'give' )
30
+			admin_url('edit.php?post_type=give_forms&page=give-settings'),
31
+			__('Settings', 'give')
32 32
 		),
33 33
 	);
34 34
 
35
-	return array_merge( $new_actions, $actions );
35
+	return array_merge($new_actions, $actions);
36 36
 }
37 37
 
38
-add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' );
38
+add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links');
39 39
 
40 40
 
41 41
 /**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @return array
50 50
  */
51
-function give_plugin_row_meta( $plugin_meta, $plugin_file ) {
52
-	if ( GIVE_PLUGIN_BASENAME !== $plugin_file ) {
51
+function give_plugin_row_meta($plugin_meta, $plugin_file) {
52
+	if (GIVE_PLUGIN_BASENAME !== $plugin_file) {
53 53
 		return $plugin_meta;
54 54
 	}
55 55
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 					), 'https://givewp.com/documentation/'
66 66
 				)
67 67
 			),
68
-			__( 'Documentation', 'give' )
68
+			__('Documentation', 'give')
69 69
 		),
70 70
 		sprintf(
71 71
 			'<a href="%1$s" target="_blank">%2$s</a>',
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 					), 'https://givewp.com/addons/'
79 79
 				)
80 80
 			),
81
-			__( 'Add-ons', 'give' )
81
+			__('Add-ons', 'give')
82 82
 		),
83 83
 	);
84 84
 
85
-	return array_merge( $plugin_meta, $new_meta_links );
85
+	return array_merge($plugin_meta, $new_meta_links);
86 86
 }
87 87
 
88
-add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 );
88
+add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2);
89 89
 
90 90
 
91 91
 /**
@@ -103,19 +103,18 @@  discard block
 block discarded – undo
103 103
 	$title = '';
104 104
 	global $submenu, $plugin_page;
105 105
 
106
-	foreach ( array_keys( $submenu ) as $parent ) {
107
-		if ( 'edit.php?post_type=give_forms' !== $parent ) {
106
+	foreach (array_keys($submenu) as $parent) {
107
+		if ('edit.php?post_type=give_forms' !== $parent) {
108 108
 			continue;
109 109
 		}
110 110
 
111
-		foreach ( $submenu[ $parent ] as $submenu_array ) {
112
-			if ( $plugin_page !== $submenu_array[2] ) {
111
+		foreach ($submenu[$parent] as $submenu_array) {
112
+			if ($plugin_page !== $submenu_array[2]) {
113 113
 				continue;
114 114
 			}
115 115
 
116
-			$title = isset( $submenu_array[0] ) ?
117
-				$submenu_array[0] :
118
-				$submenu_array[3];
116
+			$title = isset($submenu_array[0]) ?
117
+				$submenu_array[0] : $submenu_array[3];
119 118
 		}
120 119
 	}
121 120
 
@@ -129,11 +128,11 @@  discard block
 block discarded – undo
129 128
  */
130 129
 function give_recently_activated_addons() {
131 130
 	// Check if action is set.
132
-	if ( isset( $_REQUEST['action'] ) ) {
133
-		$plugin_action = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : ( isset( $_REQUEST['action2'] ) ? $_REQUEST['action2'] : '' );
131
+	if (isset($_REQUEST['action'])) {
132
+		$plugin_action = ('-1' !== $_REQUEST['action']) ? $_REQUEST['action'] : (isset($_REQUEST['action2']) ? $_REQUEST['action2'] : '');
134 133
 		$plugins       = array();
135 134
 
136
-		switch ( $plugin_action ) {
135
+		switch ($plugin_action) {
137 136
 			case 'activate': // Single add-on activation.
138 137
 				$plugins[] = $_REQUEST['plugin'];
139 138
 				break;
@@ -143,27 +142,27 @@  discard block
 block discarded – undo
143 142
 		}
144 143
 
145 144
 
146
-		if ( ! empty( $plugins ) ) {
145
+		if ( ! empty($plugins)) {
147 146
 
148 147
 			$give_addons = give_get_recently_activated_addons();
149 148
 
150
-			foreach ( $plugins as $plugin ) {
149
+			foreach ($plugins as $plugin) {
151 150
 				// Get plugins which has 'Give-' as prefix.
152
-				if ( stripos( $plugin, 'Give-' ) !== false ) {
151
+				if (stripos($plugin, 'Give-') !== false) {
153 152
 					$give_addons[] = $plugin;
154 153
 				}
155 154
 			}
156 155
 
157
-			if ( ! empty( $give_addons ) ) {
156
+			if ( ! empty($give_addons)) {
158 157
 				// Update the Give's activated add-ons.
159
-				update_option( 'give_recently_activated_addons', $give_addons );
158
+				update_option('give_recently_activated_addons', $give_addons);
160 159
 			}
161 160
 		}
162 161
 	}
163 162
 }
164 163
 
165 164
 // Add add-on plugins to wp option table.
166
-add_action( 'activated_plugin', 'give_recently_activated_addons', 10 );
165
+add_action('activated_plugin', 'give_recently_activated_addons', 10);
167 166
 
168 167
 /**
169 168
  * Create new menu in plugin section that include all the add-on
@@ -174,19 +173,19 @@  discard block
 block discarded – undo
174 173
  *
175 174
  * @return mixed
176 175
  */
177
-function give_filter_addons_do_filter_addons( $plugin_menu ) {
176
+function give_filter_addons_do_filter_addons($plugin_menu) {
178 177
 	global $plugins;
179 178
 
180
-	foreach ( $plugins['all'] as $plugin_slug => $plugin_data ) {
179
+	foreach ($plugins['all'] as $plugin_slug => $plugin_data) {
181 180
 
182
-		if ( false !== strpos( $plugin_data['Name'], 'Give' ) && false !== strpos( $plugin_data['AuthorName'], 'WordImpress' ) ) {
183
-			$plugins['give'][ $plugin_slug ]           = $plugins['all'][ $plugin_slug ];
184
-			$plugins['give'][ $plugin_slug ]['plugin'] = $plugin_slug;
181
+		if (false !== strpos($plugin_data['Name'], 'Give') && false !== strpos($plugin_data['AuthorName'], 'WordImpress')) {
182
+			$plugins['give'][$plugin_slug]           = $plugins['all'][$plugin_slug];
183
+			$plugins['give'][$plugin_slug]['plugin'] = $plugin_slug;
185 184
 			// replicate the next step.
186
-			if ( current_user_can( 'update_plugins' ) ) {
187
-				$current = get_site_transient( 'update_plugins' );
188
-				if ( isset( $current->response[ $plugin_slug ] ) ) {
189
-					$plugins['give'][ $plugin_slug ]['update'] = true;
185
+			if (current_user_can('update_plugins')) {
186
+				$current = get_site_transient('update_plugins');
187
+				if (isset($current->response[$plugin_slug])) {
188
+					$plugins['give'][$plugin_slug]['update'] = true;
190 189
 				}
191 190
 			}
192 191
 		}
@@ -196,7 +195,7 @@  discard block
 block discarded – undo
196 195
 
197 196
 }
198 197
 
199
-add_filter( 'show_advanced_plugins', 'give_filter_addons_do_filter_addons' );
198
+add_filter('show_advanced_plugins', 'give_filter_addons_do_filter_addons');
200 199
 
201 200
 /**
202 201
  * Make the Give Menu as an default menu and update the Menu Name
@@ -207,29 +206,29 @@  discard block
 block discarded – undo
207 206
  *
208 207
  * @return mixed
209 208
  */
210
-function give_filter_addons_filter_addons( $views ) {
209
+function give_filter_addons_filter_addons($views) {
211 210
 
212 211
 	global $status, $plugins;
213 212
 
214
-	if ( ! empty( $plugins['give'] ) ) {
213
+	if ( ! empty($plugins['give'])) {
215 214
 		$class = '';
216 215
 
217
-		if ( 'give' === $status ) {
216
+		if ('give' === $status) {
218 217
 			$class = 'current';
219 218
 		}
220 219
 
221 220
 		$views['give'] = sprintf(
222 221
 			'<a class="%s" href="plugins.php?plugin_status=give"> %s <span class="count">(%s) </span></a>',
223 222
 			$class,
224
-			__( 'Give', 'give' ),
225
-			count( $plugins['give'] )
223
+			__('Give', 'give'),
224
+			count($plugins['give'])
226 225
 		);
227 226
 	}
228 227
 
229 228
 	return $views;
230 229
 }
231 230
 
232
-add_filter( 'views_plugins', 'give_filter_addons_filter_addons' );
231
+add_filter('views_plugins', 'give_filter_addons_filter_addons');
233 232
 
234 233
 /**
235 234
  * Set the Give as the Main menu when admin click on the Give Menu in Plugin section.
@@ -240,17 +239,17 @@  discard block
 block discarded – undo
240 239
  *
241 240
  * @return mixed
242 241
  */
243
-function give_prepare_filter_addons( $plugins ) {
242
+function give_prepare_filter_addons($plugins) {
244 243
 	global $status;
245 244
 
246
-	if ( isset( $_REQUEST['plugin_status'] ) && 'give' === $_REQUEST['plugin_status'] ) {
245
+	if (isset($_REQUEST['plugin_status']) && 'give' === $_REQUEST['plugin_status']) {
247 246
 		$status = 'give';
248 247
 	}
249 248
 
250 249
 	return $plugins;
251 250
 }
252 251
 
253
-add_filter( 'all_plugins', 'give_prepare_filter_addons' );
252
+add_filter('all_plugins', 'give_prepare_filter_addons');
254 253
 
255 254
 
256 255
 /**
@@ -261,26 +260,26 @@  discard block
 block discarded – undo
261 260
  *
262 261
  * @since 2.1
263 262
  */
264
-function give_in_plugin_update_message( $data, $response ) {
263
+function give_in_plugin_update_message($data, $response) {
265 264
 	$new_version           = $data['new_version'];
266
-	$current_version_parts = explode( '.', GIVE_VERSION );
267
-	$new_version_parts     = explode( '.', $new_version );
265
+	$current_version_parts = explode('.', GIVE_VERSION);
266
+	$new_version_parts     = explode('.', $new_version);
268 267
 
269 268
 	// If it is a minor upgrade then return.
270
-	if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) {
269
+	if (version_compare($current_version_parts[0].'.'.$current_version_parts[1], $new_version_parts[0].'.'.$new_version_parts[1], '=')) {
271 270
 
272 271
 		return;
273 272
 	}
274 273
 
275 274
 	// Get the upgrade notice from the trunk.
276
-	$upgrade_notice = give_get_plugin_upgrade_notice( $new_version );
275
+	$upgrade_notice = give_get_plugin_upgrade_notice($new_version);
277 276
 
278 277
 	// Display upgrade notice.
279
-	echo apply_filters( 'give_in_plugin_update_message', $upgrade_notice ? '</p>' . wp_kses_post( $upgrade_notice ) . '<p class="dummy">' : '' );
278
+	echo apply_filters('give_in_plugin_update_message', $upgrade_notice ? '</p>'.wp_kses_post($upgrade_notice).'<p class="dummy">' : '');
280 279
 }
281 280
 
282 281
 // Display upgrade notice.
283
-add_action( 'in_plugin_update_message-' . GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2 );
282
+add_action('in_plugin_update_message-'.GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2);
284 283
 
285 284
 
286 285
 /**
@@ -294,18 +293,18 @@  discard block
 block discarded – undo
294 293
  *
295 294
  * @return string
296 295
  */
297
-function give_get_plugin_upgrade_notice( $new_version ) {
296
+function give_get_plugin_upgrade_notice($new_version) {
298 297
 
299 298
 	// Cache the upgrade notice.
300 299
 	$transient_name = "give_upgrade_notice_{$new_version}";
301
-	$upgrade_notice = get_transient( $transient_name );
300
+	$upgrade_notice = get_transient($transient_name);
302 301
 
303
-	if ( false === $upgrade_notice ) {
304
-		$response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/give/trunk/readme.txt' );
302
+	if (false === $upgrade_notice) {
303
+		$response = wp_safe_remote_get('https://plugins.svn.wordpress.org/give/trunk/readme.txt');
305 304
 
306
-		if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
307
-			$upgrade_notice = give_parse_plugin_update_notice( $response['body'], $new_version );
308
-			set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS );
305
+		if ( ! is_wp_error($response) && ! empty($response['body'])) {
306
+			$upgrade_notice = give_parse_plugin_update_notice($response['body'], $new_version);
307
+			set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS);
309 308
 		}
310 309
 	}
311 310
 
@@ -325,46 +324,46 @@  discard block
 block discarded – undo
325 324
  *
326 325
  * @return string
327 326
  */
328
-function give_parse_plugin_update_notice( $content, $new_version ) {
329
-	$version_parts     = explode( '.', $new_version );
327
+function give_parse_plugin_update_notice($content, $new_version) {
328
+	$version_parts     = explode('.', $new_version);
330 329
 	$check_for_notices = array(
331
-		$version_parts[0] . '.0',
332
-		$version_parts[0] . '.0.0',
333
-		$version_parts[0] . '.' . $version_parts[1] . '.' . '0',
330
+		$version_parts[0].'.0',
331
+		$version_parts[0].'.0.0',
332
+		$version_parts[0].'.'.$version_parts[1].'.'.'0',
334 333
 	);
335 334
 
336 335
 	// Regex to extract Upgrade notice from the readme.txt file.
337
-	$notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis';
336
+	$notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote($new_version).'\s*=|$)~Uis';
338 337
 
339 338
 	$upgrade_notice = '';
340 339
 
341
-	foreach ( $check_for_notices as $check_version ) {
342
-		if ( version_compare( GIVE_VERSION, $check_version, '>' ) ) {
340
+	foreach ($check_for_notices as $check_version) {
341
+		if (version_compare(GIVE_VERSION, $check_version, '>')) {
343 342
 			continue;
344 343
 		}
345 344
 
346 345
 		$matches = null;
347 346
 
348
-		if ( preg_match( $notice_regexp, $content, $matches ) ) {
349
-			$notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
347
+		if (preg_match($notice_regexp, $content, $matches)) {
348
+			$notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
350 349
 
351
-			if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) {
350
+			if (version_compare(trim($matches[1]), $check_version, '=')) {
352 351
 				$upgrade_notice .= '<p class="give-plugin-upgrade-notice">';
353 352
 
354
-				foreach ( $notices as $index => $line ) {
355
-					$upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line );
353
+				foreach ($notices as $index => $line) {
354
+					$upgrade_notice .= preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line);
356 355
 				}
357 356
 
358 357
 				$upgrade_notice .= '</p>';
359 358
 			}
360 359
 
361
-			if ( ! empty( $upgrade_notice ) ) {
360
+			if ( ! empty($upgrade_notice)) {
362 361
 				break;
363 362
 			}
364 363
 		}
365 364
 	}
366 365
 
367
-	return wp_kses_post( $upgrade_notice );
366
+	return wp_kses_post($upgrade_notice);
368 367
 }
369 368
 
370 369
 
@@ -401,7 +400,7 @@  discard block
 block discarded – undo
401 400
 <?php
402 401
 }
403 402
 
404
-add_action( 'admin_head', 'give_plugin_notice_css' );
403
+add_action('admin_head', 'give_plugin_notice_css');
405 404
 
406 405
 /**
407 406
  * Get list of add-on last activated.
@@ -411,5 +410,5 @@  discard block
 block discarded – undo
411 410
  * @return mixed|array list of recently activated add-on
412 411
  */
413 412
 function give_get_recently_activated_addons() {
414
-	return get_option( 'give_recently_activated_addons', array() );
413
+	return get_option('give_recently_activated_addons', array());
415 414
 }
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
34 34
 			parent::__construct();
35 35
 
36 36
 			// Do not use main form for this tab.
37
-			if ( give_get_current_setting_tab() === $this->id ) {
38
-				add_action( 'give_admin_field_enabled_gateways', array( $this, 'render_enabled_gateways' ), 10, 2 );
37
+			if (give_get_current_setting_tab() === $this->id) {
38
+				add_action('give_admin_field_enabled_gateways', array($this, 'render_enabled_gateways'), 10, 2);
39 39
 			}
40 40
 		}
41 41
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			$settings        = array();
50 50
 			$current_section = give_get_current_setting_section();
51 51
 
52
-			switch ( $current_section ) {
52
+			switch ($current_section) {
53 53
 				case 'paypal-standard':
54 54
 					$settings = array(
55 55
 						// Section 2: PayPal Standard.
@@ -58,55 +58,55 @@  discard block
 block discarded – undo
58 58
 							'id'   => 'give_title_gateway_settings_2',
59 59
 						),
60 60
 						array(
61
-							'name' => __( 'PayPal Email', 'give' ),
62
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
61
+							'name' => __('PayPal Email', 'give'),
62
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
63 63
 							'id'   => 'paypal_email',
64 64
 							'type' => 'email',
65 65
 						),
66 66
 						array(
67
-							'name' => __( 'PayPal Page Style', 'give' ),
68
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
67
+							'name' => __('PayPal Page Style', 'give'),
68
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
69 69
 							'id'   => 'paypal_page_style',
70 70
 							'type' => 'text',
71 71
 						),
72 72
 						array(
73
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
74
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
73
+							'name'    => __('PayPal Transaction Type', 'give'),
74
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
75 75
 							'id'      => 'paypal_button_type',
76 76
 							'type'    => 'radio_inline',
77 77
 							'options' => array(
78
-								'donation' => __( 'Donation', 'give' ),
79
-								'standard' => __( 'Standard Transaction', 'give' )
78
+								'donation' => __('Donation', 'give'),
79
+								'standard' => __('Standard Transaction', 'give')
80 80
 							),
81 81
 							'default' => 'donation',
82 82
 						),
83 83
 						array(
84
-							'name'    => __( 'Billing Details', 'give' ),
85
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
84
+							'name'    => __('Billing Details', 'give'),
85
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
86 86
 							'id'      => 'paypal_standard_billing_details',
87 87
 							'type'    => 'radio_inline',
88 88
 							'default' => 'disabled',
89 89
 							'options' => array(
90
-								'enabled'  => __( 'Enabled', 'give' ),
91
-								'disabled' => __( 'Disabled', 'give' ),
90
+								'enabled'  => __('Enabled', 'give'),
91
+								'disabled' => __('Disabled', 'give'),
92 92
 							)
93 93
 						),
94 94
 						array(
95
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
96
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
95
+							'name'    => __('PayPal IPN Verification', 'give'),
96
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
97 97
 							'id'      => 'paypal_verification',
98 98
 							'type'    => 'radio_inline',
99 99
 							'default' => 'enabled',
100 100
 							'options' => array(
101
-								'enabled'  => __( 'Enabled', 'give' ),
102
-								'disabled' => __( 'Disabled', 'give' ),
101
+								'enabled'  => __('Enabled', 'give'),
102
+								'disabled' => __('Disabled', 'give'),
103 103
 							)
104 104
 						),
105 105
 						array(
106
-							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
106
+							'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
107 107
 							'id'    => 'paypal_standard_gateway_settings_docs_link',
108
-							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
109
-							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
108
+							'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
109
+							'title' => __('PayPal Standard Gateway Settings', 'give'),
110 110
 							'type'  => 'give_docs_link',
111 111
 						),
112 112
 						array(
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 							'id'   => 'give_title_gateway_settings_3',
125 125
 						),
126 126
 						array(
127
-							'name'    => __( 'Collect Billing Details', 'give' ),
128
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
127
+							'name'    => __('Collect Billing Details', 'give'),
128
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
129 129
 							'id'      => 'give_offline_donation_enable_billing_fields',
130 130
 							'type'    => 'radio_inline',
131 131
 							'default' => 'disabled',
132 132
 							'options' => array(
133
-								'enabled'  => __( 'Enabled', 'give' ),
134
-								'disabled' => __( 'Disabled', 'give' )
133
+								'enabled'  => __('Enabled', 'give'),
134
+								'disabled' => __('Disabled', 'give')
135 135
 							)
136 136
 						),
137 137
 						array(
138
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
139
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
138
+							'name'    => __('Offline Donation Instructions', 'give'),
139
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
140 140
 							'id'      => 'global_offline_donation_content',
141 141
 							'default' => give_get_default_offline_donation_content(),
142 142
 							'type'    => 'wysiwyg',
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 							)
146 146
 						),
147 147
 						array(
148
-							'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
148
+							'name'  => esc_html__('Offline Donations Settings Docs Link', 'give'),
149 149
 							'id'    => 'offline_gateway_settings_docs_link',
150
-							'url'   => esc_url( 'http://docs.givewp.com/offlinegateway' ),
151
-							'title' => __( 'Offline Gateway Settings', 'give' ),
150
+							'url'   => esc_url('http://docs.givewp.com/offlinegateway'),
151
+							'title' => __('Offline Gateway Settings', 'give'),
152 152
 							'type'  => 'give_docs_link',
153 153
 						),
154 154
 						array(
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 							'type' => 'title'
167 167
 						),
168 168
 						array(
169
-							'name'    => __( 'Test Mode', 'give' ),
170
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
169
+							'name'    => __('Test Mode', 'give'),
170
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
171 171
 							'id'      => 'test_mode',
172 172
 							'type'    => 'radio_inline',
173 173
 							'default' => 'disabled',
174 174
 							'options' => array(
175
-								'enabled'  => __( 'Enabled', 'give' ),
176
-								'disabled' => __( 'Disabled', 'give' ),
175
+								'enabled'  => __('Enabled', 'give'),
176
+								'disabled' => __('Disabled', 'give'),
177 177
 							)
178 178
 						),
179 179
 						array(
180
-							'name' => __( 'Enabled Gateways', 'give' ),
181
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
180
+							'name' => __('Enabled Gateways', 'give'),
181
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
182 182
 							'id'   => 'gateways',
183 183
 							'type' => 'enabled_gateways'
184 184
 						),
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 						 * This setting will not render on admin setting screen but help internal code to recognize "gateways_label"  setting and add them to give setting when save.
191 191
 						 */
192 192
 						array(
193
-							'name' => __( 'Gateways Label', 'give' ),
193
+							'name' => __('Gateways Label', 'give'),
194 194
 							'desc' => '',
195 195
 							'id'   => 'gateways_label',
196 196
 							'type' => 'gateways_label_hidden'
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 						 * This setting will not render on admin setting screen but help internal code to recognize "default_gateway"  setting and add them to give setting when save.
204 204
 						 */
205 205
 						array(
206
-							'name' => __( 'Default Gateway', 'give' ),
207
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
206
+							'name' => __('Default Gateway', 'give'),
207
+							'desc' => __('The gateway that will be selected by default.', 'give'),
208 208
 							'id'   => 'default_gateway',
209 209
 							'type' => 'default_gateway_hidden'
210 210
 						),
211 211
 
212 212
 						array(
213
-							'name'  => __( 'Gateways Docs Link', 'give' ),
213
+							'name'  => __('Gateways Docs Link', 'give'),
214 214
 							'id'    => 'gateway_settings_docs_link',
215
-							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
216
-							'title' => __( 'Gateway Settings', 'give' ),
215
+							'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
216
+							'title' => __('Gateway Settings', 'give'),
217 217
 							'type'  => 'give_docs_link',
218 218
 						),
219 219
 						array(
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			 * Filter the payment gateways settings.
229 229
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
230 230
 			 */
231
-			$settings = apply_filters( 'give_settings_gateways', $settings );
231
+			$settings = apply_filters('give_settings_gateways', $settings);
232 232
 
233 233
 			/**
234 234
 			 * Filter the settings.
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			 *
238 238
 			 * @param  array $settings
239 239
 			 */
240
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
240
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
241 241
 
242 242
 			// Output.
243 243
 			return $settings;
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 		 */
252 252
 		public function get_sections() {
253 253
 			$sections = array(
254
-				'gateways-settings' => __( 'Gateways', 'give' ),
255
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
256
-				'offline-donations' => __( 'Offline Donations', 'give' )
254
+				'gateways-settings' => __('Gateways', 'give'),
255
+				'paypal-standard'   => __('PayPal Standard', 'give'),
256
+				'offline-donations' => __('Offline Donations', 'give')
257 257
 			);
258 258
 
259
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
259
+			return apply_filters('give_get_sections_'.$this->id, $sections);
260 260
 		}
261 261
 
262 262
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 		 * @param $field
270 270
 		 * @param $settings
271 271
 		 */
272
-		public function render_enabled_gateways( $field, $settings ) {
272
+		public function render_enabled_gateways($field, $settings) {
273 273
 			$id              = $field['id'];
274
-			$gateways        = give_get_ordered_payment_gateways( give_get_payment_gateways() );
275
-			$gateways_label  = give_get_option( 'gateways_label', array() );
276
-			$default_gateway = give_get_option( 'default_gateway', current( array_keys( $gateways ) ) );
274
+			$gateways        = give_get_ordered_payment_gateways(give_get_payment_gateways());
275
+			$gateways_label  = give_get_option('gateways_label', array());
276
+			$default_gateway = give_get_option('default_gateway', current(array_keys($gateways)));
277 277
 
278 278
 			ob_start();
279 279
 
@@ -288,51 +288,51 @@  discard block
 block discarded – undo
288 288
 						<span>%3$s</span>
289 289
 						<span>%4$s</span>
290 290
 						',
291
-				__( 'Gateway', 'give' ),
292
-				__( 'Label', 'give' ),
293
-				__( 'Default', 'give' ),
294
-				__( 'Enabled', 'give' )
291
+				__('Gateway', 'give'),
292
+				__('Label', 'give'),
293
+				__('Default', 'give'),
294
+				__('Enabled', 'give')
295 295
 			);
296 296
 			echo '</div>';
297 297
 
298 298
 			echo '<ul class="give-checklist-fields give-payment-gatways-list">';
299
-			foreach ( $gateways as $key => $option ) :
299
+			foreach ($gateways as $key => $option) :
300 300
 				$enabled = null;
301
-				if ( is_array( $settings ) && array_key_exists( $key, $settings ) ) {
301
+				if (is_array($settings) && array_key_exists($key, $settings)) {
302 302
 					$enabled = '1';
303 303
 				}
304 304
 
305 305
 				echo '<li>';
306
-				printf( '<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>' );
307
-				printf( '<span class="admin-label">%s</span>', esc_html( $option['admin_label'] ) );
306
+				printf('<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>');
307
+				printf('<span class="admin-label">%s</span>', esc_html($option['admin_label']));
308 308
 
309 309
 				$label = '';
310
-				if ( ! empty( $gateways_label[ $key ] ) ) {
311
-					$label = $gateways_label[ $key ];
310
+				if ( ! empty($gateways_label[$key])) {
311
+					$label = $gateways_label[$key];
312 312
 				}
313 313
 
314 314
 				printf(
315 315
 					'<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>',
316 316
 					'gateways_label',
317
-					esc_attr( $key ),
318
-					esc_html( $label ),
319
-					esc_html( $option['checkout_label'] )
317
+					esc_attr($key),
318
+					esc_html($label),
319
+					esc_html($option['checkout_label'])
320 320
 				);
321 321
 
322 322
 				printf(
323 323
 					'<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>',
324 324
 					'default_gateway',
325 325
 					$key,
326
-					checked( $key, $default_gateway, false ),
327
-					disabled( NULL, $enabled, false )
326
+					checked($key, $default_gateway, false),
327
+					disabled(NULL, $enabled, false)
328 328
 				);
329 329
 
330 330
 				printf(
331 331
 					'<input class="gateways-checkbox" name="%1$s[%2$s]" id="%1$s[%2$s]" type="checkbox" value="1" %3$s data-payment-gateway="%4$s"/>',
332
-					esc_attr( $id ),
333
-					esc_attr( $key ),
334
-					checked( '1', $enabled, false ),
335
-					esc_html( $option['admin_label'] )
332
+					esc_attr($id),
333
+					esc_attr($key),
334
+					checked('1', $enabled, false),
335
+					esc_html($option['admin_label'])
336 336
 				);
337 337
 				echo '</li>';
338 338
 			endforeach;
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +488 added lines, -488 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,70 +25,70 @@  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
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ) :
81
+		case version_compare($give_version, '2.0.1', '<') :
82 82
 			// Do nothing on fresh install.
83
-			if ( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 
91
-		case version_compare( $give_version, '2.0.2', '<' ) :
91
+		case version_compare($give_version, '2.0.2', '<') :
92 92
 			// Remove 2.0.1 update to rerun on 2.0.2
93 93
 			$completed_upgrades = give_get_completed_upgrades();
94 94
 			$v201_updates       = array(
@@ -98,35 +98,35 @@  discard block
 block discarded – undo
98 98
 				'v201_logs_upgrades',
99 99
 			);
100 100
 
101
-			foreach ( $v201_updates as $v201_update ) {
102
-				if ( in_array( $v201_update, $completed_upgrades ) ) {
103
-					unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] );
101
+			foreach ($v201_updates as $v201_update) {
102
+				if (in_array($v201_update, $completed_upgrades)) {
103
+					unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]);
104 104
 				}
105 105
 			}
106 106
 
107
-			update_option( 'give_completed_upgrades', $completed_upgrades );
107
+			update_option('give_completed_upgrades', $completed_upgrades);
108 108
 
109 109
 			// Do nothing on fresh install.
110
-			if ( ! doing_action( 'give_upgrades' ) ) {
110
+			if ( ! doing_action('give_upgrades')) {
111 111
 				give_v201_create_tables();
112
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
112
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
113 113
 				Give_Updates::$background_updater->dispatch();
114 114
 			}
115 115
 
116 116
 			$did_upgrade = true;
117 117
 
118
-		case version_compare( $give_version, '2.0.3', '<' ) :
118
+		case version_compare($give_version, '2.0.3', '<') :
119 119
 			give_v203_upgrades();
120 120
 			$did_upgrade = true;
121 121
 	}
122 122
 
123
-	if ( $did_upgrade ) {
124
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
123
+	if ($did_upgrade) {
124
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
125 125
 	}
126 126
 }
127 127
 
128
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
129
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
128
+add_action('admin_init', 'give_do_automatic_upgrades');
129
+add_action('give_upgrades', 'give_do_automatic_upgrades');
130 130
 
131 131
 /**
132 132
  * Display Upgrade Notices.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return void
142 142
  */
143
-function give_show_upgrade_notices( $give_updates ) {
143
+function give_show_upgrade_notices($give_updates) {
144 144
 	// v1.3.2 Upgrades
145 145
 	$give_updates->register(
146 146
 		array(
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 	);
207 207
 
208 208
 	// v1.8.17 Upgrades for donations.
209
-	$give_updates->register( array(
209
+	$give_updates->register(array(
210 210
 		'id'       => 'v1817_update_donation_iranian_currency_code',
211 211
 		'version'  => '1.8.17',
212 212
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
213
-	) );
213
+	));
214 214
 
215 215
 	// v1.8.17 Upgrades for cleanup of user roles.
216
-	$give_updates->register( array(
216
+	$give_updates->register(array(
217 217
 		'id'       => 'v1817_cleanup_user_roles',
218 218
 		'version'  => '1.8.17',
219 219
 		'callback' => 'give_v1817_cleanup_user_roles',
220
-	) );
220
+	));
221 221
 
222 222
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
223
-	$give_updates->register( array(
223
+	$give_updates->register(array(
224 224
 		'id'       => 'v1818_assign_custom_amount_set_donation',
225 225
 		'version'  => '1.8.18',
226 226
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
227
-	) );
227
+	));
228 228
 
229 229
 	// v1.8.18 Cleanup the Give Worker Role Caps.
230
-	$give_updates->register( array(
230
+	$give_updates->register(array(
231 231
 		'id'       => 'v1818_give_worker_role_cleanup',
232 232
 		'version'  => '1.8.18',
233 233
 		'callback' => 'give_v1818_give_worker_role_cleanup',
234
-	) );
234
+	));
235 235
 
236 236
 	// v2.0.0 Upgrades
237 237
 	$give_updates->register(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			'id'       => 'v20_move_metadata_into_new_table',
286 286
 			'version'  => '2.0.0',
287 287
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
288
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
288
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
289 289
 		)
290 290
 	);
291 291
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			'id'       => 'v201_move_metadata_into_new_table',
332 332
 			'version'  => '2.0.1',
333 333
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
334
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
334
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
335 335
 		)
336 336
 	);
337 337
 
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
 			'id'       => 'v213_delete_donation_meta',
360 360
 			'version'  => '2.1.3',
361 361
 			'callback' => 'give_v213_delete_donation_meta_callback',
362
-			'depends'  => array( 'v201_move_metadata_into_new_table' )
362
+			'depends'  => array('v201_move_metadata_into_new_table')
363 363
 		)
364 364
 	);
365 365
 
366 366
 }
367 367
 
368
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
368
+add_action('give_register_updates', 'give_show_upgrade_notices');
369 369
 
370 370
 /**
371 371
  * Triggers all upgrade functions
@@ -377,29 +377,29 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_trigger_upgrades() {
379 379
 
380
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
381
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
380
+	if ( ! current_user_can('manage_give_settings')) {
381
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
382 382
 			'response' => 403,
383
-		) );
383
+		));
384 384
 	}
385 385
 
386
-	$give_version = get_option( 'give_version' );
386
+	$give_version = get_option('give_version');
387 387
 
388
-	if ( ! $give_version ) {
388
+	if ( ! $give_version) {
389 389
 		// 1.0 is the first version to use this option so we must add it.
390 390
 		$give_version = '1.0';
391
-		add_option( 'give_version', $give_version );
391
+		add_option('give_version', $give_version);
392 392
 	}
393 393
 
394
-	update_option( 'give_version', GIVE_VERSION );
395
-	delete_option( 'give_doing_upgrade' );
394
+	update_option('give_version', GIVE_VERSION);
395
+	delete_option('give_doing_upgrade');
396 396
 
397
-	if ( DOING_AJAX ) {
398
-		die( 'complete' );
397
+	if (DOING_AJAX) {
398
+		die('complete');
399 399
 	} // End if().
400 400
 }
401 401
 
402
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
402
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
403 403
 
404 404
 
405 405
 /**
@@ -417,10 +417,10 @@  discard block
 block discarded – undo
417 417
 
418 418
 	// UPDATE DB METAKEYS.
419 419
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
420
-	$query = $wpdb->query( $sql );
420
+	$query = $wpdb->query($sql);
421 421
 
422 422
 	$give_updates->percentage = 100;
423
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
423
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
424 424
 }
425 425
 
426 426
 
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 	$where  .= "AND ( p.post_status = 'abandoned' )";
445 445
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
446 446
 
447
-	$sql            = $select . $join . $where;
448
-	$found_payments = $wpdb->get_col( $sql );
447
+	$sql            = $select.$join.$where;
448
+	$found_payments = $wpdb->get_col($sql);
449 449
 
450
-	foreach ( $found_payments as $payment ) {
450
+	foreach ($found_payments as $payment) {
451 451
 
452 452
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
453
-		$modified_time = get_post_modified_time( 'U', false, $payment );
453
+		$modified_time = get_post_modified_time('U', false, $payment);
454 454
 
455 455
 		// 1450124863 =  12/10/2015 20:42:25.
456
-		if ( $modified_time >= 1450124863 ) {
456
+		if ($modified_time >= 1450124863) {
457 457
 
458
-			give_update_payment_status( $payment, 'pending' );
458
+			give_update_payment_status($payment, 'pending');
459 459
 
460 460
 		}
461 461
 	}
462 462
 
463 463
 	$give_updates->percentage = 100;
464
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
464
+	give_set_upgrade_complete('upgrade_give_offline_status');
465 465
 }
466 466
 
467 467
 
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
  */
475 475
 function give_v152_cleanup_users() {
476 476
 
477
-	$give_version = get_option( 'give_version' );
477
+	$give_version = get_option('give_version');
478 478
 
479
-	if ( ! $give_version ) {
479
+	if ( ! $give_version) {
480 480
 		// 1.0 is the first version to use this option so we must add it.
481 481
 		$give_version = '1.0';
482 482
 	}
483 483
 
484
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
484
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
485 485
 
486 486
 	// v1.5.2 Upgrades
487
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
487
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
488 488
 
489 489
 		// Delete all caps with "ss".
490 490
 		// Also delete all unused "campaign" roles.
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 		);
532 532
 
533 533
 		global $wp_roles;
534
-		foreach ( $delete_caps as $cap ) {
535
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
536
-				$wp_roles->remove_cap( $role, $cap );
534
+		foreach ($delete_caps as $cap) {
535
+			foreach (array_keys($wp_roles->roles) as $role) {
536
+				$wp_roles->remove_cap($role, $cap);
537 537
 			}
538 538
 		}
539 539
 
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 		$roles->add_caps();
544 544
 
545 545
 		// The Update Ran.
546
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
547
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
548
-		delete_option( 'give_doing_upgrade' );
546
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
547
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
548
+		delete_option('give_doing_upgrade');
549 549
 
550 550
 	}// End if().
551 551
 
552 552
 }
553 553
 
554
-add_action( 'admin_init', 'give_v152_cleanup_users' );
554
+add_action('admin_init', 'give_v152_cleanup_users');
555 555
 
556 556
 /**
557 557
  * 1.6 Upgrade routine to create the customer meta table.
@@ -594,53 +594,53 @@  discard block
 block discarded – undo
594 594
 
595 595
 	// Get addons license key.
596 596
 	$addons = array();
597
-	foreach ( $give_options as $key => $value ) {
598
-		if ( false !== strpos( $key, '_license_key' ) ) {
599
-			$addons[ $key ] = $value;
597
+	foreach ($give_options as $key => $value) {
598
+		if (false !== strpos($key, '_license_key')) {
599
+			$addons[$key] = $value;
600 600
 		}
601 601
 	}
602 602
 
603 603
 	// Bailout: We do not have any addon license data to upgrade.
604
-	if ( empty( $addons ) ) {
604
+	if (empty($addons)) {
605 605
 		return false;
606 606
 	}
607 607
 
608
-	foreach ( $addons as $key => $addon_license ) {
608
+	foreach ($addons as $key => $addon_license) {
609 609
 
610 610
 		// Get addon shortname.
611
-		$shortname = str_replace( '_license_key', '', $key );
611
+		$shortname = str_replace('_license_key', '', $key);
612 612
 
613 613
 		// Addon license option name.
614
-		$addon_license_option_name = $shortname . '_license_active';
614
+		$addon_license_option_name = $shortname.'_license_active';
615 615
 
616 616
 		// bailout if license is empty.
617
-		if ( empty( $addon_license ) ) {
618
-			delete_option( $addon_license_option_name );
617
+		if (empty($addon_license)) {
618
+			delete_option($addon_license_option_name);
619 619
 			continue;
620 620
 		}
621 621
 
622 622
 		// Get addon name.
623 623
 		$addon_name       = array();
624
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
625
-		foreach ( $addon_name_parts as $name_part ) {
624
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
625
+		foreach ($addon_name_parts as $name_part) {
626 626
 
627 627
 			// Fix addon name
628
-			switch ( $name_part ) {
628
+			switch ($name_part) {
629 629
 				case 'authorizenet' :
630 630
 					$name_part = 'authorize.net';
631 631
 					break;
632 632
 			}
633 633
 
634
-			$addon_name[] = ucfirst( $name_part );
634
+			$addon_name[] = ucfirst($name_part);
635 635
 		}
636 636
 
637
-		$addon_name = implode( ' ', $addon_name );
637
+		$addon_name = implode(' ', $addon_name);
638 638
 
639 639
 		// Data to send to the API.
640 640
 		$api_params = array(
641 641
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
642 642
 			'license'    => $addon_license,
643
-			'item_name'  => urlencode( $addon_name ),
643
+			'item_name'  => urlencode($addon_name),
644 644
 			'url'        => home_url(),
645 645
 		);
646 646
 
@@ -655,17 +655,17 @@  discard block
 block discarded – undo
655 655
 		);
656 656
 
657 657
 		// Make sure there are no errors.
658
-		if ( is_wp_error( $response ) ) {
659
-			delete_option( $addon_license_option_name );
658
+		if (is_wp_error($response)) {
659
+			delete_option($addon_license_option_name);
660 660
 			continue;
661 661
 		}
662 662
 
663 663
 		// Tell WordPress to look for updates.
664
-		set_site_transient( 'update_plugins', null );
664
+		set_site_transient('update_plugins', null);
665 665
 
666 666
 		// Decode license data.
667
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
668
-		update_option( $addon_license_option_name, $license_data );
667
+		$license_data = json_decode(wp_remote_retrieve_body($response));
668
+		update_option($addon_license_option_name, $license_data);
669 669
 	}// End foreach().
670 670
 }
671 671
 
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 	);
696 696
 
697 697
 	global $wp_roles;
698
-	foreach ( $delete_caps as $cap ) {
699
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
700
-			$wp_roles->remove_cap( $role, $cap );
698
+	foreach ($delete_caps as $cap) {
699
+		foreach (array_keys($wp_roles->roles) as $role) {
700
+			$wp_roles->remove_cap($role, $cap);
701 701
 		}
702 702
 	}
703 703
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 function give_v18_upgrades_core_setting() {
732 732
 	// Core settings which changes from checkbox to radio.
733 733
 	$core_setting_names = array_merge(
734
-		array_keys( give_v18_renamed_core_settings() ),
734
+		array_keys(give_v18_renamed_core_settings()),
735 735
 		array(
736 736
 			'uninstall_on_delete',
737 737
 			'scripts_footer',
@@ -743,48 +743,48 @@  discard block
 block discarded – undo
743 743
 	);
744 744
 
745 745
 	// Bailout: If not any setting define.
746
-	if ( $give_settings = get_option( 'give_settings' ) ) {
746
+	if ($give_settings = get_option('give_settings')) {
747 747
 
748 748
 		$setting_changed = false;
749 749
 
750 750
 		// Loop: check each setting field.
751
-		foreach ( $core_setting_names as $setting_name ) {
751
+		foreach ($core_setting_names as $setting_name) {
752 752
 			// New setting name.
753
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
753
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
754 754
 
755 755
 			// Continue: If setting already set.
756 756
 			if (
757
-				array_key_exists( $new_setting_name, $give_settings )
758
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
757
+				array_key_exists($new_setting_name, $give_settings)
758
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
759 759
 			) {
760 760
 				continue;
761 761
 			}
762 762
 
763 763
 			// Set checkbox value to radio value.
764
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
764
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
765 765
 
766 766
 			// @see https://github.com/WordImpress/Give/issues/1063.
767
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
767
+			if (false !== strpos($setting_name, 'disable_')) {
768 768
 
769
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
770
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
769
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
770
+			} elseif (false !== strpos($setting_name, 'enable_')) {
771 771
 
772
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
772
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
773 773
 			}
774 774
 
775 775
 			// Tell bot to update core setting to db.
776
-			if ( ! $setting_changed ) {
776
+			if ( ! $setting_changed) {
777 777
 				$setting_changed = true;
778 778
 			}
779 779
 		}
780 780
 
781 781
 		// Update setting only if they changed.
782
-		if ( $setting_changed ) {
783
-			update_option( 'give_settings', $give_settings );
782
+		if ($setting_changed) {
783
+			update_option('give_settings', $give_settings);
784 784
 		}
785 785
 	}// End if().
786 786
 
787
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
787
+	give_set_upgrade_complete('v18_upgrades_core_setting');
788 788
 }
789 789
 
790 790
 /**
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	$give_updates = Give_Updates::get_instance();
799 799
 
800 800
 	// form query
801
-	$forms = new WP_Query( array(
801
+	$forms = new WP_Query(array(
802 802
 			'paged'          => $give_updates->step,
803 803
 			'status'         => 'any',
804 804
 			'order'          => 'ASC',
@@ -807,41 +807,41 @@  discard block
 block discarded – undo
807 807
 		)
808 808
 	);
809 809
 
810
-	if ( $forms->have_posts() ) {
811
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
810
+	if ($forms->have_posts()) {
811
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
812 812
 
813
-		while ( $forms->have_posts() ) {
813
+		while ($forms->have_posts()) {
814 814
 			$forms->the_post();
815 815
 
816 816
 			// Form content.
817 817
 			// Note in version 1.8 display content setting split into display content and content placement setting.
818 818
 			// You can delete _give_content_option in future.
819
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
820
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
821
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
822
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
819
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
820
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
821
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
822
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
823 823
 
824
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
825
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
824
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
825
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
826 826
 			}
827 827
 
828 828
 			// "Disable" Guest Donation. Checkbox.
829 829
 			// See: https://github.com/WordImpress/Give/issues/1470.
830
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
831
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
832
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
830
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
831
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
832
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
833 833
 
834 834
 			// Offline Donations.
835 835
 			// See: https://github.com/WordImpress/Give/issues/1579.
836
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
837
-			if ( 'no' === $offline_donation ) {
836
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
837
+			if ('no' === $offline_donation) {
838 838
 				$offline_donation_newval = 'global';
839
-			} elseif ( 'yes' === $offline_donation ) {
839
+			} elseif ('yes' === $offline_donation) {
840 840
 				$offline_donation_newval = 'enabled';
841 841
 			} else {
842 842
 				$offline_donation_newval = 'disabled';
843 843
 			}
844
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
844
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
845 845
 
846 846
 			// Convert yes/no setting field to enabled/disabled.
847 847
 			$form_radio_settings = array(
@@ -861,15 +861,15 @@  discard block
 block discarded – undo
861 861
 				'_give_offline_donation_enable_billing_fields_single',
862 862
 			);
863 863
 
864
-			foreach ( $form_radio_settings as $meta_key ) {
864
+			foreach ($form_radio_settings as $meta_key) {
865 865
 				// Get value.
866
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
866
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
867 867
 
868 868
 				// Convert meta value only if it is in yes/no/none.
869
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
869
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
870 870
 
871
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
872
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
871
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
872
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
873 873
 				}
874 874
 			}
875 875
 		}// End while().
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 
879 879
 	} else {
880 880
 		// No more forms found, finish up.
881
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
881
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
882 882
 	}
883 883
 }
884 884
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 				'%_transient_give_stats_%',
946 946
 				'give_cache%',
947 947
 				'%_transient_give_add_ons_feed%',
948
-				'%_transient__give_ajax_works' .
948
+				'%_transient__give_ajax_works'.
949 949
 				'%_transient_give_total_api_keys%',
950 950
 				'%_transient_give_i18n_give_promo_hide%',
951 951
 				'%_transient_give_contributors%',
@@ -972,24 +972,24 @@  discard block
 block discarded – undo
972 972
 		ARRAY_A
973 973
 	);
974 974
 
975
-	if ( ! empty( $user_apikey_options ) ) {
976
-		foreach ( $user_apikey_options as $user ) {
977
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
978
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
979
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
975
+	if ( ! empty($user_apikey_options)) {
976
+		foreach ($user_apikey_options as $user) {
977
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
978
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
979
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
980 980
 		}
981 981
 	}
982 982
 
983
-	if ( ! empty( $cached_options ) ) {
984
-		foreach ( $cached_options as $option ) {
985
-			switch ( true ) {
986
-				case ( false !== strpos( $option, 'transient' ) ):
987
-					$option = str_replace( '_transient_', '', $option );
988
-					delete_transient( $option );
983
+	if ( ! empty($cached_options)) {
984
+		foreach ($cached_options as $option) {
985
+			switch (true) {
986
+				case (false !== strpos($option, 'transient')):
987
+					$option = str_replace('_transient_', '', $option);
988
+					delete_transient($option);
989 989
 					break;
990 990
 
991 991
 				default:
992
-					delete_option( $option );
992
+					delete_option($option);
993 993
 			}
994 994
 		}
995 995
 	}
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	global $wp_roles;
1008 1008
 
1009 1009
 	// Get the role object.
1010
-	$give_worker = get_role( 'give_worker' );
1010
+	$give_worker = get_role('give_worker');
1011 1011
 
1012 1012
 	// A list of capabilities to add for give workers.
1013 1013
 	$caps_to_add = array(
@@ -1015,9 +1015,9 @@  discard block
 block discarded – undo
1015 1015
 		'edit_pages',
1016 1016
 	);
1017 1017
 
1018
-	foreach ( $caps_to_add as $cap ) {
1018
+	foreach ($caps_to_add as $cap) {
1019 1019
 		// Add the capability.
1020
-		$give_worker->add_cap( $cap );
1020
+		$give_worker->add_cap($cap);
1021 1021
 	}
1022 1022
 
1023 1023
 }
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 	$give_updates = Give_Updates::get_instance();
1035 1035
 
1036 1036
 	// form query.
1037
-	$donation_forms = new WP_Query( array(
1037
+	$donation_forms = new WP_Query(array(
1038 1038
 			'paged'          => $give_updates->step,
1039 1039
 			'status'         => 'any',
1040 1040
 			'order'          => 'ASC',
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
 		)
1044 1044
 	);
1045 1045
 
1046
-	if ( $donation_forms->have_posts() ) {
1047
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1046
+	if ($donation_forms->have_posts()) {
1047
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1048 1048
 
1049
-		while ( $donation_forms->have_posts() ) {
1049
+		while ($donation_forms->have_posts()) {
1050 1050
 			$donation_forms->the_post();
1051 1051
 			$form_id = get_the_ID();
1052 1052
 
@@ -1054,41 +1054,41 @@  discard block
 block discarded – undo
1054 1054
 			update_post_meta(
1055 1055
 				$form_id,
1056 1056
 				'_give_set_price',
1057
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1057
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1058 1058
 			);
1059 1059
 
1060 1060
 			// Remove formatting from _give_custom_amount_minimum.
1061 1061
 			update_post_meta(
1062 1062
 				$form_id,
1063 1063
 				'_give_custom_amount_minimum',
1064
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1064
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1065 1065
 			);
1066 1066
 
1067 1067
 			// Bailout.
1068
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1068
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1069 1069
 				continue;
1070 1070
 			}
1071 1071
 
1072
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1072
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1073 1073
 
1074
-			if ( ! empty( $donation_levels ) ) {
1074
+			if ( ! empty($donation_levels)) {
1075 1075
 
1076
-				foreach ( $donation_levels as $index => $donation_level ) {
1077
-					if ( isset( $donation_level['_give_amount'] ) ) {
1078
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1076
+				foreach ($donation_levels as $index => $donation_level) {
1077
+					if (isset($donation_level['_give_amount'])) {
1078
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1079 1079
 					}
1080 1080
 				}
1081 1081
 
1082
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1082
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1083 1083
 
1084
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1084
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1085 1085
 
1086
-				$min_amount = min( $donation_levels_amounts );
1087
-				$max_amount = max( $donation_levels_amounts );
1086
+				$min_amount = min($donation_levels_amounts);
1087
+				$max_amount = max($donation_levels_amounts);
1088 1088
 
1089 1089
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1090
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1091
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1090
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1091
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1092 1092
 			}
1093 1093
 
1094 1094
 		}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 		wp_reset_postdata();
1098 1098
 	} else {
1099 1099
 		// The Update Ran.
1100
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1100
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1101 1101
 	}
1102 1102
 
1103 1103
 }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
  */
1148 1148
 function give_v20_upgrades() {
1149 1149
 	// Update cache setting.
1150
-	give_update_option( 'cache', 'enabled' );
1150
+	give_update_option('cache', 'enabled');
1151 1151
 
1152 1152
 	// Upgrade email settings.
1153 1153
 	give_v20_upgrades_email_setting();
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 	$all_setting = give_get_settings();
1167 1167
 
1168 1168
 	// Bailout on fresh install.
1169
-	if ( empty( $all_setting ) ) {
1169
+	if (empty($all_setting)) {
1170 1170
 		return;
1171 1171
 	}
1172 1172
 
@@ -1185,19 +1185,19 @@  discard block
 block discarded – undo
1185 1185
 		'admin_notices'                 => 'new-donation_notification',
1186 1186
 	);
1187 1187
 
1188
-	foreach ( $settings as $old_setting => $new_setting ) {
1188
+	foreach ($settings as $old_setting => $new_setting) {
1189 1189
 		// Do not update already modified
1190
-		if ( ! is_array( $new_setting ) ) {
1191
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1190
+		if ( ! is_array($new_setting)) {
1191
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1192 1192
 				continue;
1193 1193
 			}
1194 1194
 		}
1195 1195
 
1196
-		switch ( $old_setting ) {
1196
+		switch ($old_setting) {
1197 1197
 			case 'admin_notices':
1198
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1198
+				$notification_status = give_get_option($old_setting, 'enabled');
1199 1199
 
1200
-				give_update_option( $new_setting, $notification_status );
1200
+				give_update_option($new_setting, $notification_status);
1201 1201
 
1202 1202
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1203 1203
 				// give_delete_option( $old_setting );
@@ -1208,19 +1208,19 @@  discard block
 block discarded – undo
1208 1208
 			case 'admin_notice_emails':
1209 1209
 				$recipients = give_get_admin_notice_emails();
1210 1210
 
1211
-				foreach ( $new_setting as $setting ) {
1211
+				foreach ($new_setting as $setting) {
1212 1212
 					// bailout if setting already exist.
1213
-					if ( array_key_exists( $setting, $all_setting ) ) {
1213
+					if (array_key_exists($setting, $all_setting)) {
1214 1214
 						continue;
1215 1215
 					}
1216 1216
 
1217
-					give_update_option( $setting, $recipients );
1217
+					give_update_option($setting, $recipients);
1218 1218
 				}
1219 1219
 				break;
1220 1220
 
1221 1221
 			default:
1222
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1223
-				give_delete_option( $old_setting );
1222
+				give_update_option($new_setting, give_get_option($old_setting));
1223
+				give_delete_option($old_setting);
1224 1224
 		}
1225 1225
 	}
1226 1226
 }
@@ -1237,22 +1237,22 @@  discard block
 block discarded – undo
1237 1237
 	$give_settings        = give_get_settings();
1238 1238
 	$give_setting_updated = false;
1239 1239
 
1240
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1240
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1241 1241
 		$give_settings['number_decimals']   = 0;
1242 1242
 		$give_settings['decimal_separator'] = '';
1243 1243
 		$give_setting_updated               = true;
1244 1244
 
1245
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1245
+	} elseif (empty($give_settings['decimal_separator'])) {
1246 1246
 		$give_settings['number_decimals'] = 0;
1247 1247
 		$give_setting_updated             = true;
1248 1248
 
1249
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1249
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1250 1250
 		$give_settings['number_decimals'] = 5;
1251 1251
 		$give_setting_updated             = true;
1252 1252
 	}
1253 1253
 
1254
-	if ( $give_setting_updated ) {
1255
-		update_option( 'give_settings', $give_settings );
1254
+	if ($give_setting_updated) {
1255
+		update_option('give_settings', $give_settings);
1256 1256
 	}
1257 1257
 }
1258 1258
 
@@ -1271,69 +1271,69 @@  discard block
 block discarded – undo
1271 1271
 	$give_updates = Give_Updates::get_instance();
1272 1272
 
1273 1273
 	// form query.
1274
-	$donation_forms = new WP_Query( array(
1274
+	$donation_forms = new WP_Query(array(
1275 1275
 			'paged'          => $give_updates->step,
1276 1276
 			'status'         => 'any',
1277 1277
 			'order'          => 'ASC',
1278
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1278
+			'post_type'      => array('give_forms', 'give_payment'),
1279 1279
 			'posts_per_page' => 20,
1280 1280
 		)
1281 1281
 	);
1282
-	if ( $donation_forms->have_posts() ) {
1283
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1282
+	if ($donation_forms->have_posts()) {
1283
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1284 1284
 
1285
-		while ( $donation_forms->have_posts() ) {
1285
+		while ($donation_forms->have_posts()) {
1286 1286
 			$donation_forms->the_post();
1287 1287
 			global $post;
1288 1288
 
1289
-			$meta = get_post_meta( $post->ID );
1289
+			$meta = get_post_meta($post->ID);
1290 1290
 
1291
-			switch ( $post->post_type ) {
1291
+			switch ($post->post_type) {
1292 1292
 				case 'give_forms':
1293 1293
 					// _give_set_price.
1294
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1295
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1294
+					if ( ! empty($meta['_give_set_price'][0])) {
1295
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1296 1296
 					}
1297 1297
 
1298 1298
 					// _give_custom_amount_minimum.
1299
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1300
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1299
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1300
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1301 1301
 					}
1302 1302
 
1303 1303
 					// _give_levels_minimum_amount.
1304
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1305
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1304
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1305
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1306 1306
 					}
1307 1307
 
1308 1308
 					// _give_levels_maximum_amount.
1309
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1310
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1309
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1310
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1311 1311
 					}
1312 1312
 
1313 1313
 					// _give_set_goal.
1314
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1315
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1314
+					if ( ! empty($meta['_give_set_goal'][0])) {
1315
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1316 1316
 					}
1317 1317
 
1318 1318
 					// _give_form_earnings.
1319
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1320
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1319
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1320
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1321 1321
 					}
1322 1322
 
1323 1323
 					// _give_custom_amount_minimum.
1324
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1325
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1324
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1325
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1326 1326
 
1327
-						foreach ( $donation_levels as $index => $level ) {
1328
-							if ( empty( $level['_give_amount'] ) ) {
1327
+						foreach ($donation_levels as $index => $level) {
1328
+							if (empty($level['_give_amount'])) {
1329 1329
 								continue;
1330 1330
 							}
1331 1331
 
1332
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1332
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1333 1333
 						}
1334 1334
 
1335 1335
 						$meta['_give_donation_levels'] = $donation_levels;
1336
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1336
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1337 1337
 					}
1338 1338
 
1339 1339
 
@@ -1341,8 +1341,8 @@  discard block
 block discarded – undo
1341 1341
 
1342 1342
 				case 'give_payment':
1343 1343
 					// _give_payment_total.
1344
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1345
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1344
+					if ( ! empty($meta['_give_payment_total'][0])) {
1345
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1346 1346
 					}
1347 1347
 
1348 1348
 					break;
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		wp_reset_postdata();
1354 1354
 	} else {
1355 1355
 		// The Update Ran.
1356
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1356
+		give_set_upgrade_complete('v1812_update_amount_values');
1357 1357
 	}
1358 1358
 }
1359 1359
 
@@ -1372,22 +1372,22 @@  discard block
 block discarded – undo
1372 1372
 	$give_updates = Give_Updates::get_instance();
1373 1373
 
1374 1374
 	// form query.
1375
-	$donors = Give()->donors->get_donors( array(
1375
+	$donors = Give()->donors->get_donors(array(
1376 1376
 			'number' => 20,
1377
-			'offset' => $give_updates->get_offset( 20 ),
1377
+			'offset' => $give_updates->get_offset(20),
1378 1378
 		)
1379 1379
 	);
1380 1380
 
1381
-	if ( ! empty( $donors ) ) {
1382
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1381
+	if ( ! empty($donors)) {
1382
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1383 1383
 
1384 1384
 		/* @var Object $donor */
1385
-		foreach ( $donors as $donor ) {
1386
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1385
+		foreach ($donors as $donor) {
1386
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1387 1387
 		}
1388 1388
 	} else {
1389 1389
 		// The Update Ran.
1390
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1390
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1391 1391
 	}
1392 1392
 }
1393 1393
 
@@ -1401,25 +1401,25 @@  discard block
 block discarded – undo
1401 1401
 	$give_updates = Give_Updates::get_instance();
1402 1402
 
1403 1403
 	// Fetch all the existing donors.
1404
-	$donors = Give()->donors->get_donors( array(
1404
+	$donors = Give()->donors->get_donors(array(
1405 1405
 			'number' => 20,
1406
-			'offset' => $give_updates->get_offset( 20 ),
1406
+			'offset' => $give_updates->get_offset(20),
1407 1407
 		)
1408 1408
 	);
1409 1409
 
1410
-	if ( ! empty( $donors ) ) {
1411
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1410
+	if ( ! empty($donors)) {
1411
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1412 1412
 
1413 1413
 		/* @var Object $donor */
1414
-		foreach ( $donors as $donor ) {
1414
+		foreach ($donors as $donor) {
1415 1415
 			$user_id = $donor->user_id;
1416 1416
 
1417 1417
 			// Proceed, if donor is attached with user.
1418
-			if ( $user_id ) {
1419
-				$user = get_userdata( $user_id );
1418
+			if ($user_id) {
1419
+				$user = get_userdata($user_id);
1420 1420
 
1421 1421
 				// Update user role, if user has subscriber role.
1422
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1422
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1423 1423
 					wp_update_user(
1424 1424
 						array(
1425 1425
 							'ID'   => $user_id,
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 		}
1432 1432
 	} else {
1433 1433
 		// The Update Ran.
1434
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1434
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1435 1435
 	}
1436 1436
 }
1437 1437
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function give_v1813_upgrades() {
1445 1445
 	// Update admin setting.
1446
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1446
+	give_update_option('donor_default_user_role', 'give_donor');
1447 1447
 
1448 1448
 	// Update Give roles.
1449 1449
 	$roles = new Give_Roles();
@@ -1461,33 +1461,33 @@  discard block
 block discarded – undo
1461 1461
 	$give_updates = Give_Updates::get_instance();
1462 1462
 
1463 1463
 	// form query.
1464
-	$payments = new WP_Query( array(
1464
+	$payments = new WP_Query(array(
1465 1465
 			'paged'          => $give_updates->step,
1466 1466
 			'status'         => 'any',
1467 1467
 			'order'          => 'ASC',
1468
-			'post_type'      => array( 'give_payment' ),
1468
+			'post_type'      => array('give_payment'),
1469 1469
 			'posts_per_page' => 100,
1470 1470
 		)
1471 1471
 	);
1472 1472
 
1473
-	if ( $payments->have_posts() ) {
1474
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1473
+	if ($payments->have_posts()) {
1474
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1475 1475
 
1476
-		while ( $payments->have_posts() ) {
1476
+		while ($payments->have_posts()) {
1477 1477
 			$payments->the_post();
1478 1478
 
1479
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1479
+			$payment_meta = give_get_payment_meta(get_the_ID());
1480 1480
 
1481
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1481
+			if ('RIAL' === $payment_meta['currency']) {
1482 1482
 				$payment_meta['currency'] = 'IRR';
1483
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1483
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1484 1484
 			}
1485 1485
 
1486 1486
 		}
1487 1487
 
1488 1488
 	} else {
1489 1489
 		// The Update Ran.
1490
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1490
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1491 1491
 	}
1492 1492
 }
1493 1493
 
@@ -1500,9 +1500,9 @@  discard block
 block discarded – undo
1500 1500
 function give_v1817_upgrades() {
1501 1501
 	$give_settings = give_get_settings();
1502 1502
 
1503
-	if ( 'RIAL' === $give_settings['currency'] ) {
1503
+	if ('RIAL' === $give_settings['currency']) {
1504 1504
 		$give_settings['currency'] = 'IRR';
1505
-		update_option( 'give_settings', $give_settings );
1505
+		update_option('give_settings', $give_settings);
1506 1506
 	}
1507 1507
 }
1508 1508
 
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 
1516 1516
 	global $wp_roles;
1517 1517
 
1518
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1518
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1519 1519
 		return;
1520 1520
 	}
1521 1521
 
@@ -1539,15 +1539,15 @@  discard block
 block discarded – undo
1539 1539
 		),
1540 1540
 	);
1541 1541
 
1542
-	foreach ( $add_caps as $role => $caps ) {
1543
-		foreach ( $caps as $cap ) {
1544
-			$wp_roles->add_cap( $role, $cap );
1542
+	foreach ($add_caps as $role => $caps) {
1543
+		foreach ($caps as $cap) {
1544
+			$wp_roles->add_cap($role, $cap);
1545 1545
 		}
1546 1546
 	}
1547 1547
 
1548
-	foreach ( $remove_caps as $role => $caps ) {
1549
-		foreach ( $caps as $cap ) {
1550
-			$wp_roles->remove_cap( $role, $cap );
1548
+	foreach ($remove_caps as $role => $caps) {
1549
+		foreach ($caps as $cap) {
1550
+			$wp_roles->remove_cap($role, $cap);
1551 1551
 		}
1552 1552
 	}
1553 1553
 
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
 	$roles->add_roles();
1572 1572
 	$roles->add_caps();
1573 1573
 
1574
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1574
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1575 1575
 }
1576 1576
 
1577 1577
 /**
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
 function give_v1818_upgrades() {
1583 1583
 
1584 1584
 	// Remove email_access_installed from give_settings.
1585
-	give_delete_option( 'email_access_installed' );
1585
+	give_delete_option('email_access_installed');
1586 1586
 }
1587 1587
 
1588 1588
 /**
@@ -1595,23 +1595,23 @@  discard block
 block discarded – undo
1595 1595
 	/* @var Give_Updates $give_updates */
1596 1596
 	$give_updates = Give_Updates::get_instance();
1597 1597
 
1598
-	$donations = new WP_Query( array(
1598
+	$donations = new WP_Query(array(
1599 1599
 			'paged'          => $give_updates->step,
1600 1600
 			'status'         => 'any',
1601 1601
 			'order'          => 'ASC',
1602
-			'post_type'      => array( 'give_payment' ),
1602
+			'post_type'      => array('give_payment'),
1603 1603
 			'posts_per_page' => 100,
1604 1604
 		)
1605 1605
 	);
1606 1606
 
1607
-	if ( $donations->have_posts() ) {
1608
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1607
+	if ($donations->have_posts()) {
1608
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1609 1609
 
1610
-		while ( $donations->have_posts() ) {
1610
+		while ($donations->have_posts()) {
1611 1611
 			$donations->the_post();
1612 1612
 
1613
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1614
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1613
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1614
+			$donation_meta = give_get_payment_meta(get_the_ID());
1615 1615
 
1616 1616
 			// Update Donation meta with price_id set as custom, only if it is:
1617 1617
 			// 1. Donation Type = Set Donation.
@@ -1620,19 +1620,19 @@  discard block
 block discarded – undo
1620 1620
 			if (
1621 1621
 				$form->ID &&
1622 1622
 				$form->is_set_type_donation_form() &&
1623
-				( 'custom' !== $donation_meta['price_id'] ) &&
1624
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1623
+				('custom' !== $donation_meta['price_id']) &&
1624
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1625 1625
 			) {
1626 1626
 				$donation_meta['price_id'] = 'custom';
1627
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1628
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1627
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1628
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1629 1629
 			}
1630 1630
 		}
1631 1631
 
1632 1632
 		wp_reset_postdata();
1633 1633
 	} else {
1634 1634
 		// Update Ran Successfully.
1635
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1635
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1636 1636
 	}
1637 1637
 }
1638 1638
 
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 
1651 1651
 	global $wp_roles;
1652 1652
 
1653
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1653
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1654 1654
 		return;
1655 1655
 	}
1656 1656
 
@@ -1668,9 +1668,9 @@  discard block
 block discarded – undo
1668 1668
 		),
1669 1669
 	);
1670 1670
 
1671
-	foreach ( $remove_caps as $role => $caps ) {
1672
-		foreach ( $caps as $cap ) {
1673
-			$wp_roles->remove_cap( $role, $cap );
1671
+	foreach ($remove_caps as $role => $caps) {
1672
+		foreach ($caps as $cap) {
1673
+			$wp_roles->remove_cap($role, $cap);
1674 1674
 		}
1675 1675
 	}
1676 1676
 
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 	$roles->add_roles();
1682 1682
 	$roles->add_caps();
1683 1683
 
1684
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1684
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1685 1685
 }
1686 1686
 
1687 1687
 /**
@@ -1695,7 +1695,7 @@  discard block
 block discarded – undo
1695 1695
 	$give_updates = Give_Updates::get_instance();
1696 1696
 
1697 1697
 	// form query
1698
-	$forms = new WP_Query( array(
1698
+	$forms = new WP_Query(array(
1699 1699
 			'paged'          => $give_updates->step,
1700 1700
 			'status'         => 'any',
1701 1701
 			'order'          => 'ASC',
@@ -1704,22 +1704,22 @@  discard block
 block discarded – undo
1704 1704
 		)
1705 1705
 	);
1706 1706
 
1707
-	if ( $forms->have_posts() ) {
1708
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1707
+	if ($forms->have_posts()) {
1708
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1709 1709
 
1710
-		while ( $forms->have_posts() ) {
1710
+		while ($forms->have_posts()) {
1711 1711
 			$forms->the_post();
1712 1712
 			global $post;
1713 1713
 
1714 1714
 			// Update offline instruction email notification status.
1715
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1716
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1715
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1716
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1717 1717
 				'enabled',
1718 1718
 				'global',
1719
-			) )
1719
+			))
1720 1720
 				? $offline_instruction_notification_status
1721 1721
 				: 'global';
1722
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1722
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1723 1723
 
1724 1724
 			// Update offline instruction email message.
1725 1725
 			update_post_meta(
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
 		wp_reset_postdata();
1752 1752
 	} else {
1753 1753
 		// No more forms found, finish up.
1754
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1754
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1755 1755
 	}
1756 1756
 }
1757 1757
 
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 	$give_updates = Give_Updates::get_instance();
1769 1769
 
1770 1770
 	// form query
1771
-	$forms = new WP_Query( array(
1771
+	$forms = new WP_Query(array(
1772 1772
 			'paged'          => $give_updates->step,
1773 1773
 			'status'         => 'any',
1774 1774
 			'order'          => 'ASC',
@@ -1777,19 +1777,19 @@  discard block
 block discarded – undo
1777 1777
 		)
1778 1778
 	);
1779 1779
 
1780
-	if ( $forms->have_posts() ) {
1781
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1780
+	if ($forms->have_posts()) {
1781
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1782 1782
 
1783
-		while ( $forms->have_posts() ) {
1783
+		while ($forms->have_posts()) {
1784 1784
 			$forms->the_post();
1785 1785
 			global $post;
1786 1786
 
1787 1787
 			// Split _give_payment_meta meta.
1788 1788
 			// @todo Remove _give_payment_meta after releases 2.0
1789
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1789
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1790 1790
 
1791
-			if ( ! empty( $payment_meta ) ) {
1792
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1791
+			if ( ! empty($payment_meta)) {
1792
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1793 1793
 			}
1794 1794
 
1795 1795
 			$deprecated_meta_keys = array(
@@ -1798,9 +1798,9 @@  discard block
 block discarded – undo
1798 1798
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1799 1799
 			);
1800 1800
 
1801
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1801
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1802 1802
 				// Do not add new meta key if already exist.
1803
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1803
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1804 1804
 					continue;
1805 1805
 				}
1806 1806
 
@@ -1809,25 +1809,25 @@  discard block
 block discarded – undo
1809 1809
 					array(
1810 1810
 						'post_id'    => $post->ID,
1811 1811
 						'meta_key'   => $new_meta_key,
1812
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1812
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1813 1813
 					)
1814 1814
 				);
1815 1815
 			}
1816 1816
 
1817 1817
 			// Bailout
1818
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1818
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1819 1819
 				/* @var Give_Donor $donor */
1820
-				$donor = new Give_Donor( $donor_id );
1820
+				$donor = new Give_Donor($donor_id);
1821 1821
 
1822
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1823
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1824
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1825
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1826
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1827
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1822
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1823
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1824
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1825
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1826
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1827
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1828 1828
 
1829 1829
 				// Save address.
1830
-				$donor->add_address( 'billing[]', $address );
1830
+				$donor->add_address('billing[]', $address);
1831 1831
 			}
1832 1832
 
1833 1833
 		}// End while().
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1839 1839
 
1840 1840
 		// No more forms found, finish up.
1841
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1841
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1842 1842
 	}
1843 1843
 }
1844 1844
 
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 	$give_updates = Give_Updates::get_instance();
1855 1855
 
1856 1856
 	// form query
1857
-	$forms = new WP_Query( array(
1857
+	$forms = new WP_Query(array(
1858 1858
 			'paged'          => $give_updates->step,
1859 1859
 			'order'          => 'DESC',
1860 1860
 			'post_type'      => 'give_log',
@@ -1863,20 +1863,20 @@  discard block
 block discarded – undo
1863 1863
 		)
1864 1864
 	);
1865 1865
 
1866
-	if ( $forms->have_posts() ) {
1867
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1866
+	if ($forms->have_posts()) {
1867
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1868 1868
 
1869
-		while ( $forms->have_posts() ) {
1869
+		while ($forms->have_posts()) {
1870 1870
 			$forms->the_post();
1871 1871
 			global $post;
1872 1872
 
1873
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1873
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1874 1874
 				continue;
1875 1875
 			}
1876 1876
 
1877
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1878
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1879
-			$term_name = ! empty( $term ) ? $term->slug : '';
1877
+			$term      = get_the_terms($post->ID, 'give_log_type');
1878
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1879
+			$term_name = ! empty($term) ? $term->slug : '';
1880 1880
 
1881 1881
 			$log_data = array(
1882 1882
 				'ID'           => $post->ID,
@@ -1889,29 +1889,29 @@  discard block
 block discarded – undo
1889 1889
 			);
1890 1890
 			$log_meta = array();
1891 1891
 
1892
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1893
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1894
-					switch ( $meta_key ) {
1892
+			if ($old_log_meta = get_post_meta($post->ID)) {
1893
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1894
+					switch ($meta_key) {
1895 1895
 						case '_give_log_payment_id':
1896
-							$log_data['log_parent']        = current( $meta_value );
1896
+							$log_data['log_parent']        = current($meta_value);
1897 1897
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1898 1898
 							break;
1899 1899
 
1900 1900
 						default:
1901
-							$log_meta[ $meta_key ] = current( $meta_value );
1901
+							$log_meta[$meta_key] = current($meta_value);
1902 1902
 					}
1903 1903
 				}
1904 1904
 			}
1905 1905
 
1906
-			if ( 'api_request' === $term_name ) {
1906
+			if ('api_request' === $term_name) {
1907 1907
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1908 1908
 			}
1909 1909
 
1910
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1910
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1911 1911
 
1912
-			if ( ! empty( $log_meta ) ) {
1913
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1914
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1912
+			if ( ! empty($log_meta)) {
1913
+				foreach ($log_meta as $meta_key => $meta_value) {
1914
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1915 1915
 				}
1916 1916
 			}
1917 1917
 
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 		Give()->logs->delete_cache();
1954 1954
 
1955 1955
 		// No more forms found, finish up.
1956
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1956
+		give_set_upgrade_complete('v20_logs_upgrades');
1957 1957
 	}
1958 1958
 }
1959 1959
 
@@ -1969,19 +1969,19 @@  discard block
 block discarded – undo
1969 1969
 	$give_updates = Give_Updates::get_instance();
1970 1970
 
1971 1971
 	// form query
1972
-	$payments = new WP_Query( array(
1972
+	$payments = new WP_Query(array(
1973 1973
 			'paged'          => $give_updates->step,
1974 1974
 			'status'         => 'any',
1975 1975
 			'order'          => 'ASC',
1976
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1976
+			'post_type'      => array('give_forms', 'give_payment'),
1977 1977
 			'posts_per_page' => 100,
1978 1978
 		)
1979 1979
 	);
1980 1980
 
1981
-	if ( $payments->have_posts() ) {
1982
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1981
+	if ($payments->have_posts()) {
1982
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1983 1983
 
1984
-		while ( $payments->have_posts() ) {
1984
+		while ($payments->have_posts()) {
1985 1985
 			$payments->the_post();
1986 1986
 			global $post;
1987 1987
 
@@ -1993,19 +1993,19 @@  discard block
 block discarded – undo
1993 1993
 				ARRAY_A
1994 1994
 			);
1995 1995
 
1996
-			if ( ! empty( $meta_data ) ) {
1997
-				foreach ( $meta_data as $index => $data ) {
1996
+			if ( ! empty($meta_data)) {
1997
+				foreach ($meta_data as $index => $data) {
1998 1998
 					// Check for duplicate meta values.
1999
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1999
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2000 2000
 						continue;
2001 2001
 					}
2002 2002
 
2003
-					switch ( $post->post_type ) {
2003
+					switch ($post->post_type) {
2004 2004
 						case 'give_forms':
2005 2005
 							$data['form_id'] = $data['post_id'];
2006
-							unset( $data['post_id'] );
2006
+							unset($data['post_id']);
2007 2007
 
2008
-							Give()->form_meta->insert( $data );
2008
+							Give()->form_meta->insert($data);
2009 2009
 							// @todo: delete form meta from post meta table after releases 2.0.
2010 2010
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2011 2011
 
@@ -2013,9 +2013,9 @@  discard block
 block discarded – undo
2013 2013
 
2014 2014
 						case 'give_payment':
2015 2015
 							$data['payment_id'] = $data['post_id'];
2016
-							unset( $data['post_id'] );
2016
+							unset($data['post_id']);
2017 2017
 
2018
-							Give()->payment_meta->insert( $data );
2018
+							Give()->payment_meta->insert($data);
2019 2019
 
2020 2020
 							// @todo: delete donation meta from post meta table after releases 2.0.
2021 2021
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 		wp_reset_postdata();
2031 2031
 	} else {
2032 2032
 		// No more forms found, finish up.
2033
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2033
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2034 2034
 	}
2035 2035
 
2036 2036
 }
@@ -2046,44 +2046,44 @@  discard block
 block discarded – undo
2046 2046
 	/* @var Give_Updates $give_updates */
2047 2047
 	$give_updates = Give_Updates::get_instance();
2048 2048
 
2049
-	$donors = Give()->donors->get_donors( array(
2049
+	$donors = Give()->donors->get_donors(array(
2050 2050
 		'paged'  => $give_updates->step,
2051 2051
 		'number' => 100,
2052
-	) );
2052
+	));
2053 2053
 
2054
-	if ( $donors ) {
2055
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2054
+	if ($donors) {
2055
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2056 2056
 		// Loop through Donors
2057
-		foreach ( $donors as $donor ) {
2057
+		foreach ($donors as $donor) {
2058 2058
 
2059
-			$donor_name       = explode( ' ', $donor->name, 2 );
2060
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2061
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2059
+			$donor_name       = explode(' ', $donor->name, 2);
2060
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2061
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2062 2062
 
2063 2063
 			// If first name meta of donor is not created, then create it.
2064
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2065
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2064
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2065
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2066 2066
 			}
2067 2067
 
2068 2068
 			// If last name meta of donor is not created, then create it.
2069
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2070
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2069
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2070
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2071 2071
 			}
2072 2072
 
2073 2073
 			// If Donor is connected with WP User then update user meta.
2074
-			if ( $donor->user_id ) {
2075
-				if ( isset( $donor_name[0] ) ) {
2076
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2074
+			if ($donor->user_id) {
2075
+				if (isset($donor_name[0])) {
2076
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2077 2077
 				}
2078
-				if ( isset( $donor_name[1] ) ) {
2079
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2078
+				if (isset($donor_name[1])) {
2079
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2080 2080
 				}
2081 2081
 			}
2082 2082
 		}
2083 2083
 
2084 2084
 	} else {
2085 2085
 		// The Update Ran.
2086
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2086
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2087 2087
 	}
2088 2088
 
2089 2089
 }
@@ -2112,15 +2112,15 @@  discard block
 block discarded – undo
2112 2112
 
2113 2113
 	$users = $user_query->get_results();
2114 2114
 
2115
-	if ( $users ) {
2116
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2115
+	if ($users) {
2116
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2117 2117
 
2118 2118
 		// Loop through Donors
2119
-		foreach ( $users as $user ) {
2119
+		foreach ($users as $user) {
2120 2120
 			/* @var Give_Donor $donor */
2121
-			$donor = new Give_Donor( $user->ID, true );
2121
+			$donor = new Give_Donor($user->ID, true);
2122 2122
 
2123
-			if ( ! $donor->id ) {
2123
+			if ( ! $donor->id) {
2124 2124
 				continue;
2125 2125
 			}
2126 2126
 
@@ -2136,10 +2136,10 @@  discard block
 block discarded – undo
2136 2136
 				)
2137 2137
 			);
2138 2138
 
2139
-			if ( ! empty( $address ) ) {
2140
-				$address = maybe_unserialize( $address );
2141
-				$donor->add_address( 'personal', $address );
2142
-				$donor->add_address( 'billing[]', $address );
2139
+			if ( ! empty($address)) {
2140
+				$address = maybe_unserialize($address);
2141
+				$donor->add_address('personal', $address);
2142
+				$donor->add_address('billing[]', $address);
2143 2143
 
2144 2144
 
2145 2145
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 
2150 2150
 	} else {
2151 2151
 		// The Update Ran.
2152
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2152
+		give_set_upgrade_complete('v20_upgrades_user_address');
2153 2153
 	}
2154 2154
 
2155 2155
 }
@@ -2173,15 +2173,15 @@  discard block
 block discarded – undo
2173 2173
 	);
2174 2174
 
2175 2175
 	// Alter customer table
2176
-	foreach ( $tables as $old_table => $new_table ) {
2176
+	foreach ($tables as $old_table => $new_table) {
2177 2177
 		if (
2178
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2179
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2178
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2179
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2180 2180
 		) {
2181
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2181
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2182 2182
 
2183
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2184
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2183
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2184
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2185 2185
 			}
2186 2186
 		}
2187 2187
 	}
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
 	$give_updates->percentage = 100;
2190 2190
 
2191 2191
 	// No more forms found, finish up.
2192
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2192
+	give_set_upgrade_complete('v20_rename_donor_tables');
2193 2193
 
2194 2194
 	// Re initiate donor classes.
2195 2195
 	Give()->donors     = new Give_DB_Donors();
@@ -2207,19 +2207,19 @@  discard block
 block discarded – undo
2207 2207
 function give_v201_create_tables() {
2208 2208
 	global $wpdb;
2209 2209
 
2210
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2210
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2211 2211
 		Give()->payment_meta->create_table();
2212 2212
 	}
2213 2213
 
2214
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2214
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2215 2215
 		Give()->form_meta->create_table();
2216 2216
 	}
2217 2217
 
2218
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2218
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2219 2219
 		Give()->logs->log_db->create_table();
2220 2220
 	}
2221 2221
 
2222
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2222
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2223 2223
 		Give()->logs->logmeta_db->create_table();
2224 2224
 	}
2225 2225
 }
@@ -2244,31 +2244,31 @@  discard block
 block discarded – undo
2244 2244
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2245 2245
 			)
2246 2246
 			AND $wpdb->posts.post_type = 'give_payment'
2247
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2247
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2248 2248
 			ORDER BY $wpdb->posts.post_date ASC 
2249 2249
 			LIMIT 100
2250
-			OFFSET " . $give_updates->get_offset( 100 )
2250
+			OFFSET ".$give_updates->get_offset(100)
2251 2251
 	);
2252 2252
 
2253
-	if ( ! empty( $payments ) ) {
2254
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2253
+	if ( ! empty($payments)) {
2254
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2255 2255
 
2256
-		foreach ( $payments as $payment_id ) {
2257
-			$post = get_post( $payment_id );
2258
-			setup_postdata( $post );
2256
+		foreach ($payments as $payment_id) {
2257
+			$post = get_post($payment_id);
2258
+			setup_postdata($post);
2259 2259
 
2260 2260
 			// Do not add new meta keys if already refactored.
2261
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2261
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2262 2262
 				continue;
2263 2263
 			}
2264 2264
 
2265 2265
 
2266 2266
 			// Split _give_payment_meta meta.
2267 2267
 			// @todo Remove _give_payment_meta after releases 2.0
2268
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2268
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2269 2269
 
2270
-			if ( ! empty( $payment_meta ) ) {
2271
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2270
+			if ( ! empty($payment_meta)) {
2271
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2272 2272
 			}
2273 2273
 
2274 2274
 			$deprecated_meta_keys = array(
@@ -2277,9 +2277,9 @@  discard block
 block discarded – undo
2277 2277
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2278 2278
 			);
2279 2279
 
2280
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2280
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2281 2281
 				// Do not add new meta key if already exist.
2282
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2282
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2283 2283
 					continue;
2284 2284
 				}
2285 2285
 
@@ -2288,25 +2288,25 @@  discard block
 block discarded – undo
2288 2288
 					array(
2289 2289
 						'post_id'    => $post->ID,
2290 2290
 						'meta_key'   => $new_meta_key,
2291
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2291
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2292 2292
 					)
2293 2293
 				);
2294 2294
 			}
2295 2295
 
2296 2296
 			// Bailout
2297
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2297
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2298 2298
 				/* @var Give_Donor $donor */
2299
-				$donor = new Give_Donor( $donor_id );
2299
+				$donor = new Give_Donor($donor_id);
2300 2300
 
2301
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2302
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2303
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2304
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2305
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2306
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2301
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2302
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2303
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2304
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2305
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2306
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2307 2307
 
2308 2308
 				// Save address.
2309
-				$donor->add_address( 'billing[]', $address );
2309
+				$donor->add_address('billing[]', $address);
2310 2310
 			}
2311 2311
 
2312 2312
 		}// End while().
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2318 2318
 
2319 2319
 		// No more forms found, finish up.
2320
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2320
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2321 2321
 	}
2322 2322
 }
2323 2323
 
@@ -2337,21 +2337,21 @@  discard block
 block discarded – undo
2337 2337
 			SELECT ID FROM $wpdb->posts 
2338 2338
 			WHERE 1=1
2339 2339
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2340
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2340
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2341 2341
 			ORDER BY $wpdb->posts.post_date ASC 
2342 2342
 			LIMIT 100
2343
-			OFFSET " . $give_updates->get_offset( 100 )
2343
+			OFFSET ".$give_updates->get_offset(100)
2344 2344
 	);
2345 2345
 
2346
-	if ( ! empty( $payments ) ) {
2347
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2346
+	if ( ! empty($payments)) {
2347
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2348 2348
 			'give_forms',
2349 2349
 			'give_payment',
2350
-		) ), $give_updates->step * 100 );
2350
+		)), $give_updates->step * 100);
2351 2351
 
2352
-		foreach ( $payments as $payment_id ) {
2353
-			$post = get_post( $payment_id );
2354
-			setup_postdata( $post );
2352
+		foreach ($payments as $payment_id) {
2353
+			$post = get_post($payment_id);
2354
+			setup_postdata($post);
2355 2355
 
2356 2356
 			$meta_data = $wpdb->get_results(
2357 2357
 				$wpdb->prepare(
@@ -2361,19 +2361,19 @@  discard block
 block discarded – undo
2361 2361
 				ARRAY_A
2362 2362
 			);
2363 2363
 
2364
-			if ( ! empty( $meta_data ) ) {
2365
-				foreach ( $meta_data as $index => $data ) {
2364
+			if ( ! empty($meta_data)) {
2365
+				foreach ($meta_data as $index => $data) {
2366 2366
 					// Check for duplicate meta values.
2367
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
2367
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2368 2368
 						continue;
2369 2369
 					}
2370 2370
 
2371
-					switch ( $post->post_type ) {
2371
+					switch ($post->post_type) {
2372 2372
 						case 'give_forms':
2373 2373
 							$data['form_id'] = $data['post_id'];
2374
-							unset( $data['post_id'] );
2374
+							unset($data['post_id']);
2375 2375
 
2376
-							Give()->form_meta->insert( $data );
2376
+							Give()->form_meta->insert($data);
2377 2377
 							// @todo: delete form meta from post meta table after releases 2.0.
2378 2378
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2379 2379
 
@@ -2381,9 +2381,9 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
 						case 'give_payment':
2383 2383
 							$data['payment_id'] = $data['post_id'];
2384
-							unset( $data['post_id'] );
2384
+							unset($data['post_id']);
2385 2385
 
2386
-							Give()->payment_meta->insert( $data );
2386
+							Give()->payment_meta->insert($data);
2387 2387
 
2388 2388
 							// @todo: delete donation meta from post meta table after releases 2.0.
2389 2389
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 		wp_reset_postdata();
2399 2399
 	} else {
2400 2400
 		// No more forms found, finish up.
2401
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2401
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2402 2402
 	}
2403 2403
 
2404 2404
 }
@@ -2419,26 +2419,26 @@  discard block
 block discarded – undo
2419 2419
 			SELECT ID FROM $wpdb->posts 
2420 2420
 			WHERE 1=1
2421 2421
 			AND $wpdb->posts.post_type = 'give_log'
2422
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2422
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2423 2423
 			ORDER BY $wpdb->posts.post_date ASC 
2424 2424
 			LIMIT 100
2425
-			OFFSET " . $give_updates->get_offset( 100 )
2425
+			OFFSET ".$give_updates->get_offset(100)
2426 2426
 	);
2427 2427
 
2428
-	if ( ! empty( $logs ) ) {
2429
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2428
+	if ( ! empty($logs)) {
2429
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2430 2430
 
2431
-		foreach ( $logs as $log_id ) {
2432
-			$post = get_post( $log_id );
2433
-			setup_postdata( $post );
2431
+		foreach ($logs as $log_id) {
2432
+			$post = get_post($log_id);
2433
+			setup_postdata($post);
2434 2434
 
2435
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2435
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2436 2436
 				continue;
2437 2437
 			}
2438 2438
 
2439
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2440
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2441
-			$term_name = ! empty( $term ) ? $term->slug : '';
2439
+			$term      = get_the_terms($post->ID, 'give_log_type');
2440
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2441
+			$term_name = ! empty($term) ? $term->slug : '';
2442 2442
 
2443 2443
 			$log_data = array(
2444 2444
 				'ID'           => $post->ID,
@@ -2451,29 +2451,29 @@  discard block
 block discarded – undo
2451 2451
 			);
2452 2452
 			$log_meta = array();
2453 2453
 
2454
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2455
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2456
-					switch ( $meta_key ) {
2454
+			if ($old_log_meta = get_post_meta($post->ID)) {
2455
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2456
+					switch ($meta_key) {
2457 2457
 						case '_give_log_payment_id':
2458
-							$log_data['log_parent']        = current( $meta_value );
2458
+							$log_data['log_parent']        = current($meta_value);
2459 2459
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2460 2460
 							break;
2461 2461
 
2462 2462
 						default:
2463
-							$log_meta[ $meta_key ] = current( $meta_value );
2463
+							$log_meta[$meta_key] = current($meta_value);
2464 2464
 					}
2465 2465
 				}
2466 2466
 			}
2467 2467
 
2468
-			if ( 'api_request' === $term_name ) {
2468
+			if ('api_request' === $term_name) {
2469 2469
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2470 2470
 			}
2471 2471
 
2472
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2472
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2473 2473
 
2474
-			if ( ! empty( $log_meta ) ) {
2475
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2476
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2474
+			if ( ! empty($log_meta)) {
2475
+				foreach ($log_meta as $meta_key => $meta_value) {
2476
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2477 2477
 				}
2478 2478
 			}
2479 2479
 
@@ -2486,7 +2486,7 @@  discard block
 block discarded – undo
2486 2486
 		Give()->logs->delete_cache();
2487 2487
 
2488 2488
 		// No more forms found, finish up.
2489
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2489
+		give_set_upgrade_complete('v201_logs_upgrades');
2490 2490
 	}
2491 2491
 }
2492 2492
 
@@ -2501,51 +2501,51 @@  discard block
 block discarded – undo
2501 2501
 	global $wpdb;
2502 2502
 	give_v201_create_tables();
2503 2503
 
2504
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2505
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2506
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2504
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2505
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2506
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2507 2507
 		$donor_data = array();
2508 2508
 
2509
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2510
-			foreach ( $missing_donors as $donor_id ) {
2509
+		if ($missing_donors = array_diff($customers, $donors)) {
2510
+			foreach ($missing_donors as $donor_id) {
2511 2511
 				$donor_data[] = array(
2512
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2513
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2512
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2513
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2514 2514
 
2515 2515
 				);
2516 2516
 			}
2517 2517
 		}
2518 2518
 
2519
-		if ( ! empty( $donor_data ) ) {
2519
+		if ( ! empty($donor_data)) {
2520 2520
 			$donor_table_name      = Give()->donors->table_name;
2521 2521
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2522 2522
 
2523 2523
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2524 2524
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2525 2525
 
2526
-			foreach ( $donor_data as $donor ) {
2526
+			foreach ($donor_data as $donor) {
2527 2527
 				$donor['info'][0] = (array) $donor['info'][0];
2528 2528
 
2529 2529
 				// Prevent duplicate meta id issue.
2530
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2530
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2531 2531
 					continue;
2532 2532
 				}
2533 2533
 
2534
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2534
+				$donor_id = Give()->donors->add($donor['info'][0]);
2535 2535
 
2536
-				if ( ! empty( $donor['meta'] ) ) {
2537
-					foreach ( $donor['meta'] as $donor_meta ) {
2536
+				if ( ! empty($donor['meta'])) {
2537
+					foreach ($donor['meta'] as $donor_meta) {
2538 2538
 						$donor_meta = (array) $donor_meta;
2539 2539
 
2540 2540
 						// Prevent duplicate meta id issue.
2541
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2542
-							unset( $donor_meta['meta_id'] );
2541
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2542
+							unset($donor_meta['meta_id']);
2543 2543
 						}
2544 2544
 
2545 2545
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2546
-						unset( $donor_meta['customer_id'] );
2546
+						unset($donor_meta['customer_id']);
2547 2547
 
2548
-						Give()->donor_meta->insert( $donor_meta );
2548
+						Give()->donor_meta->insert($donor_meta);
2549 2549
 					}
2550 2550
 				}
2551 2551
 
@@ -2564,35 +2564,35 @@  discard block
 block discarded – undo
2564 2564
 					)
2565 2565
 				);
2566 2566
 
2567
-				$donor = new Give_Donor( $donor_id );
2567
+				$donor = new Give_Donor($donor_id);
2568 2568
 
2569
-				if ( ! empty( $address ) ) {
2570
-					$address = maybe_unserialize( $address );
2571
-					$donor->add_address( 'personal', $address );
2572
-					$donor->add_address( 'billing[]', $address );
2569
+				if ( ! empty($address)) {
2570
+					$address = maybe_unserialize($address);
2571
+					$donor->add_address('personal', $address);
2572
+					$donor->add_address('billing[]', $address);
2573 2573
 				}
2574 2574
 
2575
-				$donor_name       = explode( ' ', $donor->name, 2 );
2576
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2577
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2575
+				$donor_name       = explode(' ', $donor->name, 2);
2576
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2577
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2578 2578
 
2579 2579
 				// If first name meta of donor is not created, then create it.
2580
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2581
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2580
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2581
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2582 2582
 				}
2583 2583
 
2584 2584
 				// If last name meta of donor is not created, then create it.
2585
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2586
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2585
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2586
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2587 2587
 				}
2588 2588
 
2589 2589
 				// If Donor is connected with WP User then update user meta.
2590
-				if ( $donor->user_id ) {
2591
-					if ( isset( $donor_name[0] ) ) {
2592
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2590
+				if ($donor->user_id) {
2591
+					if (isset($donor_name[0])) {
2592
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2593 2593
 					}
2594
-					if ( isset( $donor_name[1] ) ) {
2595
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2594
+					if (isset($donor_name[1])) {
2595
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2596 2596
 					}
2597 2597
 				}
2598 2598
 			}
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 	}
2604 2604
 
2605 2605
 	Give_Updates::get_instance()->percentage = 100;
2606
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2606
+	give_set_upgrade_complete('v201_add_missing_donors');
2607 2607
 }
2608 2608
 
2609 2609
 
@@ -2616,14 +2616,14 @@  discard block
 block discarded – undo
2616 2616
 	global $wpdb;
2617 2617
 
2618 2618
 	// Do not auto load option.
2619
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2619
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2620 2620
 
2621 2621
 	// Remove from cache.
2622 2622
 	$all_options = wp_load_alloptions();
2623 2623
 
2624
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2625
-		unset( $all_options['give_completed_upgrades'] );
2626
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2624
+	if (isset($all_options['give_completed_upgrades'])) {
2625
+		unset($all_options['give_completed_upgrades']);
2626
+		wp_cache_set('alloptions', $all_options, 'options');
2627 2627
 	}
2628 2628
 
2629 2629
 }
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
 	$give_updates = Give_Updates::get_instance();
2639 2639
 
2640 2640
 	// form query.
2641
-	$donation_forms = new WP_Query( array(
2641
+	$donation_forms = new WP_Query(array(
2642 2642
 			'paged'          => $give_updates->step,
2643 2643
 			'status'         => 'any',
2644 2644
 			'order'          => 'ASC',
@@ -2647,16 +2647,16 @@  discard block
 block discarded – undo
2647 2647
 		)
2648 2648
 	);
2649 2649
 
2650
-	if ( $donation_forms->have_posts() ) {
2651
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
2650
+	if ($donation_forms->have_posts()) {
2651
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
2652 2652
 
2653
-		while ( $donation_forms->have_posts() ) {
2653
+		while ($donation_forms->have_posts()) {
2654 2654
 			$donation_forms->the_post();
2655 2655
 			$form_id = get_the_ID();
2656 2656
 
2657
-			$form_closed_status = give_get_meta( $form_id, '_give_form_status', true );
2658
-			if ( empty( $form_closed_status ) ) {
2659
-				give_set_form_closed_status( $form_id );
2657
+			$form_closed_status = give_get_meta($form_id, '_give_form_status', true);
2658
+			if (empty($form_closed_status)) {
2659
+				give_set_form_closed_status($form_id);
2660 2660
 			}
2661 2661
 		}
2662 2662
 
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
 	} else {
2667 2667
 
2668 2668
 		// The Update Ran.
2669
-		give_set_upgrade_complete( 'v210_verify_form_status_upgrades' );
2669
+		give_set_upgrade_complete('v210_verify_form_status_upgrades');
2670 2670
 	}
2671 2671
 
2672 2672
 }
@@ -2686,22 +2686,22 @@  discard block
 block discarded – undo
2686 2686
 		SELECT DISTINCT payment_id
2687 2687
 		FROM {$donation_meta_table}
2688 2688
 		LIMIT 20
2689
-		OFFSET {$give_updates->get_offset( 20 )}
2689
+		OFFSET {$give_updates->get_offset(20)}
2690 2690
 		"
2691 2691
 	);
2692 2692
 
2693
-	if ( ! empty( $donations ) ) {
2694
-		foreach ( $donations as $donation ) {
2695
-			$donation_obj = get_post( $donation );
2693
+	if ( ! empty($donations)) {
2694
+		foreach ($donations as $donation) {
2695
+			$donation_obj = get_post($donation);
2696 2696
 
2697
-			if ( ! $donation_obj instanceof WP_Post ) {
2698
-				Give()->payment_meta->delete_all_meta( $donation );
2697
+			if ( ! $donation_obj instanceof WP_Post) {
2698
+				Give()->payment_meta->delete_all_meta($donation);
2699 2699
 			}
2700 2700
 		}
2701 2701
 	} else {
2702 2702
 
2703 2703
 		// The Update Ran.
2704
-		give_set_upgrade_complete( 'v213_delete_donation_meta' );
2704
+		give_set_upgrade_complete('v213_delete_donation_meta');
2705 2705
 	}
2706 2706
 
2707 2707
 }
2708 2708
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +149 added lines, -149 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
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number       = $payment->number;
46 46
 $payment_meta = $payment->get_meta();
47 47
 
48
-$company_name   = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
49
-$transaction_id = esc_attr( $payment->transaction_id );
48
+$company_name   = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : '';
49
+$transaction_id = esc_attr($payment->transaction_id);
50 50
 $user_id        = $payment->user_id;
51 51
 $donor_id       = $payment->customer_id;
52
-$payment_date   = strtotime( $payment->date );
53
-$user_info      = give_get_payment_meta_user_info( $payment_id );
52
+$payment_date   = strtotime($payment->date);
53
+$user_info      = give_get_payment_meta_user_info($payment_id);
54 54
 $address        = $payment->address;
55 55
 $currency_code  = $payment->currency;
56 56
 $gateway        = $payment->gateway;
57 57
 $currency_code  = $payment->currency;
58 58
 $payment_mode   = $payment->mode;
59
-$base_url       = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
59
+$base_url       = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
60 60
 
61 61
 ?>
62 62
 <div class="wrap give-wrap">
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	<?php
66 66
 		printf(
67 67
 			/* translators: %s: donation number */
68
-			esc_html__( 'Donation %s', 'give' ),
68
+			esc_html__('Donation %s', 'give'),
69 69
 			$number
70 70
 		);
71
-		if ( $payment_mode == 'test' ) {
71
+		if ($payment_mode == 'test') {
72 72
 			echo Give()->tooltips->render_span(array(
73
-				'label' => __( 'This donation was made in test mode.', 'give' ),
74
-				'tag_content' => __( 'Test Donation', 'give' ),
73
+				'label' => __('This donation was made in test mode.', 'give'),
74
+				'tag_content' => __('Test Donation', 'give'),
75 75
 				'position'=> 'right',
76 76
 				'attributes' => array(
77 77
 					'id' => 'test-payment-label',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param int $payment_id Payment id.
92 92
 	 */
93
-	do_action( 'give_view_donation_details_before', $payment_id );
93
+	do_action('give_view_donation_details_before', $payment_id);
94 94
 	?>
95 95
 
96 96
 	<hr class="wp-header-end">
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *
105 105
 		 * @param int $payment_id Payment id.
106 106
 		 */
107
-		do_action( 'give_view_donation_details_form_top', $payment_id );
107
+		do_action('give_view_donation_details_form_top', $payment_id);
108 108
 		?>
109 109
 		<div id="poststuff">
110 110
 			<div id="give-dashboard-widgets-wrap">
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 							 *
121 121
 							 * @param int $payment_id Payment id.
122 122
 							 */
123
-							do_action( 'give_view_donation_details_sidebar_before', $payment_id );
123
+							do_action('give_view_donation_details_sidebar_before', $payment_id);
124 124
 							?>
125 125
 
126 126
 							<div id="give-order-update" class="postbox give-order-data">
127 127
 
128 128
 								<div class="give-order-top">
129
-									<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
129
+									<h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3>
130 130
 
131 131
 									<?php
132
-									if ( current_user_can( 'view_give_payments' ) ) {
132
+									if (current_user_can('view_give_payments')) {
133 133
 										echo sprintf(
134 134
 											'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
135 135
 											$payment_id,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 													), $base_url
142 142
 												), 'give_donation_nonce'
143 143
 											),
144
-											sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
144
+											sprintf(__('Delete Donation %s', 'give'), $payment_id)
145 145
 										);
146 146
 									}
147 147
 									?>
@@ -158,33 +158,33 @@  discard block
 block discarded – undo
158 158
 										 *
159 159
 										 * @param int $payment_id Payment id.
160 160
 										 */
161
-										do_action( 'give_view_donation_details_totals_before', $payment_id );
161
+										do_action('give_view_donation_details_totals_before', $payment_id);
162 162
 										?>
163 163
 
164 164
 										<div class="give-admin-box-inside">
165 165
 											<p>
166
-												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
166
+												<label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label>&nbsp;
167 167
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
168
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
169
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
168
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
169
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
170 170
 													<?php endforeach; ?>
171 171
 												</select>
172
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
172
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
173 173
 											</p>
174 174
 										</div>
175 175
 
176 176
 										<div class="give-admin-box-inside">
177 177
 											<p>
178
-												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
179
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
178
+												<label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label>&nbsp;
179
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
180 180
 											</p>
181 181
 										</div>
182 182
 
183 183
 										<div class="give-admin-box-inside">
184 184
 											<p>
185
-												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
186
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
187
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
185
+												<label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label>&nbsp;
186
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
187
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
188 188
 											</p>
189 189
 										</div>
190 190
 
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 										 *
199 199
 										 * @param int $payment_id Payment id.
200 200
 										 */
201
-										do_action( 'give_view_donation_details_update_inner', $payment_id );
201
+										do_action('give_view_donation_details_update_inner', $payment_id);
202 202
 										?>
203 203
 
204 204
 										<div class="give-order-payment give-admin-box-inside">
205 205
 											<p>
206
-												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
207
-												<?php echo give_currency_symbol( $payment->currency ); ?>
208
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
206
+												<label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label>&nbsp;
207
+												<?php echo give_currency_symbol($payment->currency); ?>
208
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
209 209
 											</p>
210 210
 										</div>
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 										 *
218 218
 										 * @param int $payment_id Payment id.
219 219
 										 */
220
-										do_action( 'give_view_donation_details_totals_after', $payment_id );
220
+										do_action('give_view_donation_details_totals_after', $payment_id);
221 221
 										?>
222 222
 
223 223
 									</div>
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 									 *
236 236
 									 * @param int $payment_id Payment id.
237 237
 									 */
238
-									do_action( 'give_view_donation_details_update_before', $payment_id );
238
+									do_action('give_view_donation_details_update_before', $payment_id);
239 239
 									?>
240 240
 
241 241
 									<div id="major-publishing-actions">
242 242
 										<div id="publishing-action">
243 243
 
244 244
 											<input type="submit" class="button button-primary right"
245
-											       value="<?php _e( 'Save Donation', 'give' ); ?>"/>
245
+											       value="<?php _e('Save Donation', 'give'); ?>"/>
246 246
 
247 247
 											<?php
248
-											if ( give_is_payment_complete( $payment_id ) ) {
248
+											if (give_is_payment_complete($payment_id)) {
249 249
 												echo sprintf(
250 250
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
251 251
 													esc_url(
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 															)
257 257
 														)
258 258
 													),
259
-													__( 'Resend Receipt', 'give' )
259
+													__('Resend Receipt', 'give')
260 260
 												);
261 261
 											}
262 262
 											?>
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 									 *
272 272
 									 * @param int $payment_id Payment id.
273 273
 									 */
274
-									do_action( 'give_view_donation_details_update_after', $payment_id );
274
+									do_action('give_view_donation_details_update_after', $payment_id);
275 275
 									?>
276 276
 
277 277
 								</div>
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
 							<div id="give-order-details" class="postbox give-order-data">
284 284
 
285
-								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
285
+								<h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3>
286 286
 
287 287
 								<div class="inside">
288 288
 									<div class="give-admin-box">
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
 										 *
296 296
 										 * @param int $payment_id Payment id.
297 297
 										 */
298
-										do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
298
+										do_action('give_view_donation_details_payment_meta_before', $payment_id);
299 299
 
300
-										$gateway = give_get_payment_gateway( $payment_id );
301
-										if ( $gateway ) :
300
+										$gateway = give_get_payment_gateway($payment_id);
301
+										if ($gateway) :
302 302
 										?>
303 303
 											<div class="give-order-gateway give-admin-box-inside">
304 304
 												<p>
305
-													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
306
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
305
+													<strong><?php _e('Gateway:', 'give'); ?></strong>&nbsp;
306
+													<?php echo give_get_gateway_admin_label($gateway); ?>
307 307
 												</p>
308 308
 											</div>
309 309
 										<?php endif; ?>
310 310
 
311 311
 										<div class="give-order-payment-key give-admin-box-inside">
312 312
 											<p>
313
-												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
314
-												<?php echo give_get_payment_key( $payment_id ); ?>
313
+												<strong><?php _e('Key:', 'give'); ?></strong>&nbsp;
314
+												<?php echo give_get_payment_key($payment_id); ?>
315 315
 											</p>
316 316
 										</div>
317 317
 
318 318
 										<div class="give-order-ip give-admin-box-inside">
319 319
 											<p>
320
-												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
321
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
320
+												<strong><?php _e('IP:', 'give'); ?></strong>&nbsp;
321
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
322 322
 											</p>
323 323
 										</div>
324 324
 
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
 										// Display the transaction ID present.
327 327
 										// The transaction ID is the charge ID from the gateway.
328 328
 										// For instance, stripe "ch_BzvwYCchqOy5Nt".
329
-										if ( $transaction_id != $payment_id ) : ?>
329
+										if ($transaction_id != $payment_id) : ?>
330 330
 											<div class="give-order-tx-id give-admin-box-inside">
331 331
 												<p>
332
-													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
333
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
332
+													<strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong>&nbsp;
333
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
334 334
 												</p>
335 335
 											</div>
336 336
 										<?php endif; ?>
337 337
 
338 338
 										<div class="give-admin-box-inside">
339
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
340
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
339
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
340
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor &raquo;', 'give'); ?></a>
341 341
 											</p>
342 342
 										</div>
343 343
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 										 *
350 350
 										 * @param int $payment_id Payment id.
351 351
 										 */
352
-										do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
352
+										do_action('give_view_donation_details_payment_meta_after', $payment_id);
353 353
 										?>
354 354
 
355 355
 									</div>
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 							 *
370 370
 							 * @param int $payment_id Payment id.
371 371
 							 */
372
-							do_action( 'give_view_donation_details_sidebar_after', $payment_id );
372
+							do_action('give_view_donation_details_sidebar_after', $payment_id);
373 373
 							?>
374 374
 
375 375
 						</div>
@@ -389,31 +389,31 @@  discard block
 block discarded – undo
389 389
 							 *
390 390
 							 * @param int $payment_id Payment id.
391 391
 							 */
392
-							do_action( 'give_view_donation_details_main_before', $payment_id );
392
+							do_action('give_view_donation_details_main_before', $payment_id);
393 393
 							?>
394 394
 
395 395
 							<?php $column_count = 'columns-3'; ?>
396 396
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
397
-								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
397
+								<h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3>
398 398
 
399 399
 								<div class="inside">
400 400
 
401 401
 									<div class="column-container">
402 402
 										<div class="column">
403 403
 											<p>
404
-												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
404
+												<strong><?php _e('Donation Form ID:', 'give'); ?></strong><br>
405 405
 												<?php
406
-												if ( $payment_meta['form_id'] ) :
406
+												if ($payment_meta['form_id']) :
407 407
 													printf(
408 408
 														'<a href="%1$s">%2$s</a>',
409
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
409
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
410 410
 														$payment_meta['form_id']
411 411
 													);
412 412
 												endif;
413 413
 												?>
414 414
 											</p>
415 415
 											<p>
416
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
416
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
417 417
 												<?php
418 418
 												echo Give()->html->forms_dropdown(
419 419
 													array(
@@ -429,21 +429,21 @@  discard block
 block discarded – undo
429 429
 										</div>
430 430
 										<div class="column">
431 431
 											<p>
432
-												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
433
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
432
+												<strong><?php _e('Donation Date:', 'give'); ?></strong><br>
433
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
434 434
 											</p>
435 435
 											<p>
436
-												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
436
+												<strong><?php _e('Donation Level:', 'give'); ?></strong><br>
437 437
 												<span class="give-donation-level">
438 438
 													<?php
439
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
440
-													if ( empty( $var_prices ) ) {
441
-														_e( 'n/a', 'give' );
439
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
440
+													if (empty($var_prices)) {
441
+														_e('n/a', 'give');
442 442
 													} else {
443 443
 														$prices_atts = array();
444
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
445
-															foreach ( $variable_prices as $variable_price ) {
446
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
444
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
445
+															foreach ($variable_prices as $variable_price) {
446
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
447 447
 															}
448 448
 														}
449 449
 														// Variable price dropdown options.
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
 															'name'             => 'give-variable-price',
453 453
 															'chosen'           => true,
454 454
 															'show_option_all'  => '',
455
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ),
456
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
455
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
456
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
457 457
 															'selected'         => $payment_meta['price_id'],
458 458
 														);
459 459
 														// Render variable prices select tag html.
460
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
460
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
461 461
 													}
462 462
 													?>
463 463
 												</span>
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 										</div>
466 466
 										<div class="column">
467 467
 											<p>
468
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
469
-												<?php echo give_donation_amount( $payment, true ); ?>
468
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
469
+												<?php echo give_donation_amount($payment, true); ?>
470 470
 											</p>
471 471
 
472 472
 											<p>
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 												 *
481 481
 												 * @param int $payment_id Payment id.
482 482
 												 */
483
-												do_action( 'give_donation_details_thead_before', $payment_id );
483
+												do_action('give_donation_details_thead_before', $payment_id);
484 484
 
485 485
 
486 486
 												/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 												 *
493 493
 												 * @param int $payment_id Payment id.
494 494
 												 */
495
-												do_action( 'give_donation_details_thead_after', $payment_id );
495
+												do_action('give_donation_details_thead_after', $payment_id);
496 496
 
497 497
 												/**
498 498
 												 * Fires in donation details page, in the donation-information metabox, before the body elements.
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 												 *
504 504
 												 * @param int $payment_id Payment id.
505 505
 												 */
506
-												do_action( 'give_donation_details_tbody_before', $payment_id );
506
+												do_action('give_donation_details_tbody_before', $payment_id);
507 507
 
508 508
 												/**
509 509
 												 * Fires in donation details page, in the donation-information metabox, after the body elements.
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 												 *
515 515
 												 * @param int $payment_id Payment id.
516 516
 												 */
517
-												do_action( 'give_donation_details_tbody_after', $payment_id );
517
+												do_action('give_donation_details_tbody_after', $payment_id);
518 518
 												?>
519 519
 											</p>
520 520
 										</div>
@@ -534,59 +534,59 @@  discard block
 block discarded – undo
534 534
 							 *
535 535
 							 * @param int $payment_id Payment id.
536 536
 							 */
537
-							do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
537
+							do_action('give_view_donation_details_donor_detail_before', $payment_id);
538 538
 							?>
539 539
 
540 540
 							<div id="give-donor-details" class="postbox">
541
-								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
541
+								<h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3>
542 542
 
543 543
 								<div class="inside">
544 544
 
545
-									<?php $donor = new Give_Donor( $donor_id ); ?>
545
+									<?php $donor = new Give_Donor($donor_id); ?>
546 546
 
547 547
 									<div class="column-container donor-info">
548 548
 										<div class="column">
549 549
 											<p>
550
-												<strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br>
550
+												<strong><?php _e('Donor ID:', 'give'); ?></strong><br>
551 551
 												<?php
552
-												if ( ! empty( $donor->id ) ) {
552
+												if ( ! empty($donor->id)) {
553 553
 													printf(
554 554
 														'<a href="%1$s">%2$s</a>',
555
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
555
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
556 556
 														$donor->id
557 557
 													);
558 558
 												}
559 559
 												?>
560
-												<span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span>
560
+												<span>(<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>)</span>
561 561
 											</p>
562 562
 											<p>
563
-												<strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br>
564
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
563
+												<strong><?php _e('Donor Since:', 'give'); ?></strong><br>
564
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
565 565
 											</p>
566 566
 										</div>
567 567
 										<div class="column">
568 568
 											<p>
569
-												<strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br>
569
+												<strong><?php _e('Donor Name:', 'give'); ?></strong><br>
570 570
 												<?php
571
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
572
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
571
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
572
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
573 573
 
574 574
 												// Check whether the donor name and WP_User name is same or not.
575
-												if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
576
-													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
575
+												if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
576
+													echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
577 577
 												} else {
578 578
 													echo $donor_name;
579 579
 												}
580 580
 												?>
581 581
 											</p>
582 582
 											<p>
583
-												<strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br>
583
+												<strong><?php _e('Donor Email:', 'give'); ?></strong><br>
584 584
 												<?php echo $donor->email; ?>
585 585
 											</p>
586 586
 										</div>
587 587
 										<div class="column">
588 588
 											<p>
589
-												<strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br>
589
+												<strong><?php _e('Change Donor:', 'give'); ?></strong><br>
590 590
 												<?php
591 591
 												echo Give()->html->donor_dropdown(
592 592
 													array(
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 												?>
598 598
 											</p>
599 599
 											<p>
600
-												<?php if ( ! empty( $company_name ) ) {
600
+												<?php if ( ! empty($company_name)) {
601 601
 													?>
602
-													<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
602
+													<strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br>
603 603
 													<?php
604 604
 													echo $company_name;
605 605
 												} ?>
@@ -610,19 +610,19 @@  discard block
 block discarded – undo
610 610
 									<div class="column-container new-donor" style="display: none">
611 611
 										<div class="column">
612 612
 											<p>
613
-												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
613
+												<label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label>
614 614
 												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
615 615
 											</p>
616 616
 										</div>
617 617
 										<div class="column">
618 618
 											<p>
619
-												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
619
+												<label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label>
620 620
 												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
621 621
 											</p>
622 622
 										</div>
623 623
 										<div class="column">
624 624
 											<p>
625
-												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
625
+												<label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label>
626 626
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
627 627
 											</p>
628 628
 										</div>
@@ -630,9 +630,9 @@  discard block
 block discarded – undo
630 630
 											<p>
631 631
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
632 632
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
633
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
633
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
634 634
 												<br>
635
-												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
635
+												<em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em>
636 636
 											</p>
637 637
 										</div>
638 638
 									</div>
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 									 * @param array $payment_meta Payment meta.
648 648
 									 * @param array $user_info    User information.
649 649
 									 */
650
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
650
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
651 651
 
652 652
 									/**
653 653
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 									 *
657 657
 									 * @param int $payment_id Payment id.
658 658
 									 */
659
-									do_action( 'give_payment_view_details', $payment_id );
659
+									do_action('give_payment_view_details', $payment_id);
660 660
 									?>
661 661
 
662 662
 								</div>
@@ -672,11 +672,11 @@  discard block
 block discarded – undo
672 672
 							 *
673 673
 							 * @param int $payment_id Payment id.
674 674
 							 */
675
-							do_action( 'give_view_donation_details_billing_before', $payment_id );
675
+							do_action('give_view_donation_details_billing_before', $payment_id);
676 676
 							?>
677 677
 
678 678
 							<div id="give-billing-details" class="postbox">
679
-								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
679
+								<h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3>
680 680
 
681 681
 								<div class="inside">
682 682
 
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 											<div class="data column-container">
687 687
 
688 688
 												<?php
689
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
689
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
690 690
 
691
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
691
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
692 692
 
693 693
 												// Get the country list that does not have any states init.
694 694
 												$no_states_country = give_no_states_country_list();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
 												<div class="row">
698 698
 													<div id="give-order-address-country-wrap">
699
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
699
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
700 700
 														<?php
701 701
 														echo Give()->html->select(
702 702
 															array(
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 																'show_option_all'  => false,
707 707
 																'show_option_none' => false,
708 708
 																'chosen'           => true,
709
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
710
-																'data'             => array( 'search-type' => 'no_ajax' ),
709
+																'placeholder'      => esc_attr__('Select a country', 'give'),
710
+																'data'             => array('search-type' => 'no_ajax'),
711 711
 															)
712 712
 														);
713 713
 														?>
@@ -716,35 +716,35 @@  discard block
 block discarded – undo
716 716
 
717 717
 												<div class="row">
718 718
 													<div class="give-wrap-address-line1">
719
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
720
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
719
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label>
720
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
721 721
 													</div>
722 722
 												</div>
723 723
 
724 724
 												<div class="row">
725 725
 													<div class="give-wrap-address-line2">
726
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
727
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
726
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label>
727
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
728 728
 													</div>
729 729
 												</div>
730 730
 
731 731
 												<div class="row">
732 732
 													<div class="give-wrap-address-city">
733
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
734
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
733
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
734
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
735 735
 													</div>
736 736
 												</div>
737 737
 
738 738
 												<?php
739
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
739
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
740 740
 												?>
741 741
 												<div class="row">
742
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
743
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
744
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
742
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
743
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
744
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
745 745
 															<?php
746
-															$states = give_get_states( $address['country'] );
747
-															if ( ! empty( $states ) ) {
746
+															$states = give_get_states($address['country']);
747
+															if ( ! empty($states)) {
748 748
 																echo Give()->html->select(
749 749
 																	array(
750 750
 																		'options'          => $states,
@@ -753,23 +753,23 @@  discard block
 block discarded – undo
753 753
 																		'show_option_all'  => false,
754 754
 																		'show_option_none' => false,
755 755
 																		'chosen'           => true,
756
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
757
-																		'data'             => array( 'search-type' => 'no_ajax' ),
756
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
757
+																		'data'             => array('search-type' => 'no_ajax'),
758 758
 																	)
759 759
 																);
760 760
 															} else {
761 761
 																?>
762
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
762
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
763 763
 																<?php
764 764
 															}
765 765
 															?>
766 766
 														</div>
767 767
 													</div>
768 768
 
769
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
769
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
770 770
 														<div class="give-wrap-address-zip">
771
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
772
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
771
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
772
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
773 773
 														</div>
774 774
 													</div>
775 775
 												</div>
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 									 *
789 789
 									 * @param int $payment_id Payment id.
790 790
 									 */
791
-									do_action( 'give_payment_billing_details', $payment_id );
791
+									do_action('give_payment_billing_details', $payment_id);
792 792
 									?>
793 793
 
794 794
 								</div>
@@ -804,34 +804,34 @@  discard block
 block discarded – undo
804 804
 							 *
805 805
 							 * @param int $payment_id Payment id.
806 806
 							 */
807
-							do_action( 'give_view_donation_details_billing_after', $payment_id );
807
+							do_action('give_view_donation_details_billing_after', $payment_id);
808 808
 							?>
809 809
 
810 810
 							<div id="give-payment-notes" class="postbox">
811
-								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
811
+								<h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3>
812 812
 
813 813
 								<div class="inside">
814 814
 									<div id="give-payment-notes-inner">
815 815
 										<?php
816
-										$notes = give_get_payment_notes( $payment_id );
817
-										if ( ! empty( $notes ) ) {
816
+										$notes = give_get_payment_notes($payment_id);
817
+										if ( ! empty($notes)) {
818 818
 											$no_notes_display = ' style="display:none;"';
819
-											foreach ( $notes as $note ) :
819
+											foreach ($notes as $note) :
820 820
 
821
-												echo give_get_payment_note_html( $note, $payment_id );
821
+												echo give_get_payment_note_html($note, $payment_id);
822 822
 
823 823
 											endforeach;
824 824
 										} else {
825 825
 											$no_notes_display = '';
826 826
 										}
827 827
 
828
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
828
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
829 829
 										?>
830 830
 									</div>
831 831
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
832 832
 
833 833
 									<div class="give-clearfix">
834
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
834
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
835 835
 									</div>
836 836
 
837 837
 								</div>
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 							 *
848 848
 							 * @param int $payment_id Payment id.
849 849
 							 */
850
-							do_action( 'give_view_donation_details_main_after', $payment_id );
850
+							do_action('give_view_donation_details_main_after', $payment_id);
851 851
 							?>
852 852
 
853 853
 						</div>
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 		 *
870 870
 		 * @param int $payment_id Payment id.
871 871
 		 */
872
-		do_action( 'give_view_donation_details_form_bottom', $payment_id );
872
+		do_action('give_view_donation_details_form_bottom', $payment_id);
873 873
 
874
-		wp_nonce_field( 'give_update_payment_details_nonce' );
874
+		wp_nonce_field('give_update_payment_details_nonce');
875 875
 		?>
876
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
876
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
877 877
 		<input type="hidden" name="give_action" value="update_payment_details"/>
878 878
 	</form>
879 879
 	<?php
@@ -884,6 +884,6 @@  discard block
 block discarded – undo
884 884
 	 *
885 885
 	 * @param int $payment_id Payment id.
886 886
 	 */
887
-	do_action( 'give_view_donation_details_after', $payment_id );
887
+	do_action('give_view_donation_details_after', $payment_id);
888 888
 	?>
889 889
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
 		<h2 class="nav-tab-wrapper">
121 121
 			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
 			</a>
125 125
 			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
 			</a>
129 129
 			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
 			</a>
133 133
 			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-			   href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+			   href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
 			</a>
137 137
 		</h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
 		<div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 			<p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: http://docs.givewp.com/docs */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'http://docs.givewp.com/docs' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('http://docs.givewp.com/docs')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			<div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 			<div class="feature-section clearfix introduction">
176 176
 
177 177
 				<div class="video feature-section-item">
178
-					<img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
-						 alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+					<img src="<?php echo GIVE_PLUGIN_URL.'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
+						 alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
 				</div>
181 181
 
182 182
 				<div class="content feature-section-item last-feature">
183 183
 
184
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
 						<span class="dashicons dashicons-external"></span>
190 190
 					</a>
191 191
 
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 
199 199
 				<div class="content feature-section-item">
200 200
 
201
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
 					<h4>Find Out More:</h4>
206 206
 					<ul class="ul-disc">
207 207
 						<li><a href="https://givewp.com/"
208
-							   target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
+							   target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
209 209
 						<li><a href="https://givewp.com/features/"
210
-							   target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
210
+							   target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
211 211
 						<li><a href="https://givewp.com/documentation/"
212
-							   target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
212
+							   target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
213 213
 					</ul>
214 214
 
215 215
 				</div>
216 216
 
217 217
 				<div class="content  feature-section-item last-feature">
218
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>"
219
-						 alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
218
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/dist/images/admin/give-form-mockup.png' ?>"
219
+						 alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
220 220
 				</div>
221 221
 
222 222
 			</div>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return void
236 236
 	 */
237 237
 	public function changelog_screen() {
238
-		list( $display_version ) = explode( '-', GIVE_VERSION );
238
+		list($display_version) = explode('-', GIVE_VERSION);
239 239
 		?>
240 240
 		<div class="wrap about-wrap">
241 241
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 			<p class="about-text"><?php
244 244
 				printf(
245 245
 				/* translators: %s: Give version */
246
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
246
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
247 247
 					$display_version
248 248
 				);
249 249
 				?></p>
250 250
 			<div class="give-badge"><?php
251 251
 				printf(
252 252
 				/* translators: %s: Give version */
253
-					esc_html__( 'Version %s', 'give' ),
253
+					esc_html__('Version %s', 'give'),
254 254
 					$display_version
255 255
 				);
256 256
 				?></div>
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			<?php $this->tabs(); ?>
259 259
 
260 260
 			<div class="changelog">
261
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
261
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
262 262
 
263 263
 				<div class="feature-section">
264 264
 					<?php echo $this->parse_readme(); ?>
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 			</div>
267 267
 
268 268
 			<div class="return-to-dashboard">
269
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
269
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
270 270
 					'post_type' => 'give_forms',
271 271
 					'page'      => 'give-settings'
272
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
272
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
273 273
 			</div>
274 274
 		</div>
275 275
 		<?php
@@ -283,36 +283,36 @@  discard block
 block discarded – undo
283 283
 	 * @return void
284 284
 	 */
285 285
 	public function getting_started_screen() {
286
-		list( $display_version ) = explode( '-', GIVE_VERSION );
286
+		list($display_version) = explode('-', GIVE_VERSION);
287 287
 		?>
288 288
 		<div class="wrap about-wrap get-started">
289 289
 
290 290
 			<?php $this->get_welcome_header() ?>
291 291
 
292
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
292
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
293 293
 
294 294
 			<?php give_get_newsletter(); ?>
295 295
 
296 296
 			<div class="give-badge"><?php
297 297
 				printf(
298 298
 				/* translators: %s: Give version */
299
-					esc_html__( 'Version %s', 'give' ),
299
+					esc_html__('Version %s', 'give'),
300 300
 					$display_version
301 301
 				);
302 302
 				?></div>
303 303
 
304 304
 			<?php $this->tabs(); ?>
305 305
 
306
-			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
306
+			<p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
307 307
 
308 308
 			<div class="feature-section clearfix">
309 309
 
310 310
 				<div class="content feature-section-item">
311
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
311
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
312 312
 
313
-					<p><?php esc_html_e( 'Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
313
+					<p><?php esc_html_e('Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
314 314
 
315
-					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p>
315
+					<p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give'); ?></p>
316 316
 				</div>
317 317
 
318 318
 				<div class="content feature-section-item last-feature">
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 				</div>
330 330
 
331 331
 				<div class="content feature-section-item last-feature">
332
-					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
332
+					<h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
333 333
 
334
-					<p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
334
+					<p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
335 335
 				</div>
336 336
 
337 337
 			</div>
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 			<div class="feature-section clearfix">
341 341
 
342 342
 				<div class="content feature-section-item add-content">
343
-					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
343
+					<h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
344 344
 
345
-					<p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
345
+					<p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
346 346
 
347
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
347
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
348 348
 				</div>
349 349
 
350 350
 				<div class="content feature-section-item last-feature">
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 				</div>
362 362
 
363 363
 				<div class="content feature-section-item last-feature">
364
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
364
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
365 365
 
366
-					<p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
366
+					<p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
367 367
 				</div>
368 368
 
369 369
 
@@ -383,20 +383,20 @@  discard block
 block discarded – undo
383 383
 	 * @return void
384 384
 	 */
385 385
 	public function credits_screen() {
386
-		list( $display_version ) = explode( '-', GIVE_VERSION );
386
+		list($display_version) = explode('-', GIVE_VERSION);
387 387
 		?>
388 388
 		<div class="wrap about-wrap">
389 389
 
390 390
 			<?php $this->get_welcome_header() ?>
391 391
 
392
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
392
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
393 393
 
394 394
 			<?php give_get_newsletter(); ?>
395 395
 
396 396
 			<div class="give-badge"><?php
397 397
 				printf(
398 398
 				/* translators: %s: Give version */
399
-					esc_html__( 'Version %s', 'give' ),
399
+					esc_html__('Version %s', 'give'),
400 400
 					$display_version
401 401
 				);
402 402
 				?></div>
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 			<p class="about-description"><?php
407 407
 				printf(
408 408
 				/* translators: %s: https://github.com/WordImpress/give */
409
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
410
-					esc_url( 'https://github.com/WordImpress/give' )
409
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
410
+					esc_url('https://github.com/WordImpress/give')
411 411
 				);
412 412
 				?></p>
413 413
 
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 	 * @return string $readme HTML formatted readme file
425 425
 	 */
426 426
 	public function parse_readme() {
427
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
427
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
428 428
 
429
-		if ( ! $file ) {
430
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
429
+		if ( ! $file) {
430
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
431 431
 		} else {
432
-			$readme = file_get_contents( $file );
433
-			$readme = nl2br( esc_html( $readme ) );
434
-			$readme = explode( '== Changelog ==', $readme );
435
-			$readme = end( $readme );
436
-
437
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
438
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
439
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
440
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
441
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
432
+			$readme = file_get_contents($file);
433
+			$readme = nl2br(esc_html($readme));
434
+			$readme = explode('== Changelog ==', $readme);
435
+			$readme = end($readme);
436
+
437
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
438
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
439
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
440
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
441
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
442 442
 		}
443 443
 
444 444
 		return $readme;
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
 	public function contributors() {
456 456
 		$contributors = $this->get_contributors();
457 457
 
458
-		if ( empty( $contributors ) ) {
458
+		if (empty($contributors)) {
459 459
 			return '';
460 460
 		}
461 461
 
462 462
 		$contributor_list = '<ul class="wp-people-group">';
463 463
 
464
-		foreach ( $contributors as $contributor ) {
464
+		foreach ($contributors as $contributor) {
465 465
 			$contributor_list .= '<li class="wp-person">';
466 466
 			$contributor_list .= sprintf(
467 467
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
468
-				esc_url( 'https://github.com/' . $contributor->login ),
469
-				esc_url( $contributor->avatar_url ),
470
-				esc_attr( $contributor->login )
468
+				esc_url('https://github.com/'.$contributor->login),
469
+				esc_url($contributor->avatar_url),
470
+				esc_attr($contributor->login)
471 471
 			);
472 472
 			$contributor_list .= sprintf(
473 473
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
474
-				esc_url( 'https://github.com/' . $contributor->login ),
475
-				esc_html( $contributor->login )
474
+				esc_url('https://github.com/'.$contributor->login),
475
+				esc_html($contributor->login)
476 476
 			);
477 477
 			$contributor_list .= '</li>';
478 478
 		}
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 	 * @return array $contributors List of contributors
491 491
 	 */
492 492
 	public function get_contributors() {
493
-		$contributors = Give_Cache::get( 'give_contributors', true );
493
+		$contributors = Give_Cache::get('give_contributors', true);
494 494
 
495
-		if ( false !== $contributors ) {
495
+		if (false !== $contributors) {
496 496
 			return $contributors;
497 497
 		}
498 498
 
499
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
499
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
500 500
 
501
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
501
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
502 502
 			return array();
503 503
 		}
504 504
 
505
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
505
+		$contributors = json_decode(wp_remote_retrieve_body($response));
506 506
 
507
-		if ( ! is_array( $contributors ) ) {
507
+		if ( ! is_array($contributors)) {
508 508
 			return array();
509 509
 		}
510 510
 
511
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
511
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
512 512
 
513 513
 		return $contributors;
514 514
 	}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function get_welcome_header() {
522 522
 		// Badge for welcome page
523
-		$badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png';
523
+		$badge_url = GIVE_PLUGIN_URL.'assets/dist/images/give-badge.png';
524 524
 		?>
525 525
 		<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
526 526
 		<?php $this->social_media_elements(); ?>
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 			<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
614 614
 				printf(
615 615
 				/* translators: %s: Give twitter user @givewp */
616
-					esc_html_e( 'Follow %s', 'give' ),
616
+					esc_html_e('Follow %s', 'give'),
617 617
 					'@givewp'
618 618
 				);
619 619
 				?></a>
@@ -647,27 +647,27 @@  discard block
 block discarded – undo
647 647
 	public function welcome() {
648 648
 
649 649
 		// Bail if no activation redirect
650
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) {
650
+		if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) {
651 651
 			return;
652 652
 		}
653 653
 
654 654
 		// Delete the redirect transient
655
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
655
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
656 656
 
657 657
 		// Bail if activating from network, or bulk
658
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
658
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
659 659
 			return;
660 660
 		}
661 661
 
662
-		$upgrade = get_option( 'give_version_upgraded_from' );
662
+		$upgrade = get_option('give_version_upgraded_from');
663 663
 
664
-		if ( ! $upgrade ) { // First time install
665
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
664
+		if ( ! $upgrade) { // First time install
665
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
666 666
 			exit;
667
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
667
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
668 668
 
669 669
 		} else { // Welcome is NOT disabled in settings
670
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
670
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
671 671
 			exit;
672 672
 		}
673 673
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-donation-receipt-email.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) :
18
+if ( ! class_exists('Give_Donation_Receipt_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Donation_Receipt_Email
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function init() {
37 37
 			// Initialize empty payment.
38
-			$this->payment = new Give_Payment( 0 );
38
+			$this->payment = new Give_Payment(0);
39 39
 
40
-			$this->load( array(
40
+			$this->load(array(
41 41
 				'id'                   => 'donation-receipt',
42
-				'label'                => __( 'Donation Receipt', 'give' ),
43
-				'description'          => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ),
42
+				'label'                => __('Donation Receipt', 'give'),
43
+				'description'          => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'),
44 44
 				'notification_status'  => 'enabled',
45 45
 				'form_metabox_setting' => true,
46
-				'recipient_group_name' => __( 'Donor', 'give' ),
47
-				'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ),
46
+				'recipient_group_name' => __('Donor', 'give'),
47
+				'default_email_subject' => esc_attr__('Donation Receipt', 'give'),
48 48
 				'default_email_message' => give_get_default_donation_receipt_email(),
49
-				'default_email_header'  => __( 'Donation Receipt', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('Donation Receipt', 'give'),
50
+			));
51 51
 
52
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) );
53
-			add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) );
52
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt'));
53
+			add_action('give_email_links', array($this, 'resend_donation_receipt'));
54 54
 		}
55 55
 
56 56
 		/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		 * @param int $form_id
63 63
 		 * @return string
64 64
 		 */
65
-		public function get_email_subject( $form_id = null ) {
65
+		public function get_email_subject($form_id = null) {
66 66
 			$subject = wp_strip_all_tags(
67 67
 				Give_Email_Notification_Util::get_value(
68 68
 					$this,
69
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
69
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
70 70
 					$form_id,
71 71
 					$this->config['default_email_subject']
72 72
 				)
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		 * @param int $form_id
110 110
 		 * @return string
111 111
 		 */
112
-		public function get_email_message( $form_id = null ) {
112
+		public function get_email_message($form_id = null) {
113 113
 			$message = Give_Email_Notification_Util::get_value(
114 114
 				$this,
115
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
115
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
116 116
 				$form_id,
117 117
 				$this->config['default_email_message']
118 118
 			);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			 * @since 1.0
125 125
 			 */
126 126
 			$message = apply_filters(
127
-				'give_donation_receipt_' . Give()->emails->get_template(),
127
+				'give_donation_receipt_'.Give()->emails->get_template(),
128 128
 				$message,
129 129
 				$this->payment->ID,
130 130
 				$this->payment->payment_meta
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		 * @param int $form_id
168 168
 		 * @return array
169 169
 		 */
170
-		public function get_email_attachments( $form_id = null) {
170
+		public function get_email_attachments($form_id = null) {
171 171
 			/**
172 172
 			 * Filter the attachments.
173 173
 			 * Note: this filter will deprecate soon.
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 				$this->payment->payment_meta
237 237
 			);
238 238
 
239
-			Give()->emails->__set( 'from_name', $from_name );
240
-			Give()->emails->__set( 'from_email', $from_email );
241
-			Give()->emails->__set( 'heading', $this->get_email_header() );
239
+			Give()->emails->__set('from_name', $from_name);
240
+			Give()->emails->__set('from_email', $from_email);
241
+			Give()->emails->__set('heading', $this->get_email_header());
242 242
 
243 243
 			/**
244 244
 			 * Filters the donation receipt's email headers.
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				$this->payment->payment_meta
256 256
 			);
257 257
 
258
-			Give()->emails->__set( 'headers', $headers );
258
+			Give()->emails->__set('headers', $headers);
259 259
 		}
260 260
 
261 261
 		/**
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 		 *
267 267
 		 * @param $payment_id
268 268
 		 */
269
-		public function send_donation_receipt( $payment_id ) {
270
-			$this->payment = new Give_Payment( $payment_id );
269
+		public function send_donation_receipt($payment_id) {
270
+			$this->payment = new Give_Payment($payment_id);
271 271
 
272 272
 			// Setup email data.
273 273
 			$this->setup_email_data();
274 274
 
275 275
 			// Send email.
276
-			$this->send_email_notification( array(
276
+			$this->send_email_notification(array(
277 277
 				'payment_id' => $this->payment->ID,
278
-			) );
278
+			));
279 279
 		}
280 280
 
281 281
 		/**
@@ -286,35 +286,35 @@  discard block
 block discarded – undo
286 286
 		 *
287 287
 		 * @param array $data
288 288
 		 */
289
-		public function resend_donation_receipt( $data ) {
290
-			$purchase_id = absint( $data['purchase_id'] );
289
+		public function resend_donation_receipt($data) {
290
+			$purchase_id = absint($data['purchase_id']);
291 291
 
292
-			if ( empty( $purchase_id ) ) {
292
+			if (empty($purchase_id)) {
293 293
 				return;
294 294
 			}
295 295
 
296 296
 			// Get donation payment information.
297
-			$this->payment = new Give_Payment( $purchase_id );
297
+			$this->payment = new Give_Payment($purchase_id);
298 298
 
299
-			if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) {
300
-				wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array(
299
+			if ( ! current_user_can('edit_give_payments', $this->payment->ID)) {
300
+				wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array(
301 301
 					'response' => 403,
302
-				) );
302
+				));
303 303
 			}
304 304
 
305 305
 			// Setup email data.
306 306
 			$this->setup_email_data();
307 307
 
308 308
 			// Send email.
309
-			$this->send_email_notification( array(
309
+			$this->send_email_notification(array(
310 310
 				'payment_id' => $this->payment->ID,
311
-			) );
311
+			));
312 312
 
313
-			wp_redirect( add_query_arg( array(
313
+			wp_redirect(add_query_arg(array(
314 314
 				'give-message' => 'email_sent',
315 315
 				'give-action'  => false,
316 316
 				'purchase_id'  => false,
317
-			) ) );
317
+			)));
318 318
 			exit;
319 319
 		}
320 320
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donor-register-email.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if access directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_New_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_New_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_New_Donor_Register_Email
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
 		 * @since   2.0
32 32
 		 */
33 33
 		public function init() {
34
-			$this->load( array(
34
+			$this->load(array(
35 35
 				'id'                    => 'new-donor-register',
36
-				'label'                 => __( 'New User Registration', 'give' ),
37
-				'description'           => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ),
36
+				'label'                 => __('New User Registration', 'give'),
37
+				'description'           => __('Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give'),
38 38
 				'has_recipient_field'   => true,
39 39
 				'notification_status'   => 'enabled',
40 40
 				'has_preview_header'    => true,
41
-				'email_tag_context'     => array( 'donor', 'general' ),
41
+				'email_tag_context'     => array('donor', 'general'),
42 42
 				'form_metabox_setting'  => false,
43 43
 				'default_email_subject' => sprintf(
44 44
 					/* translators: %s: site name */
45
-					esc_attr__( '[%s] New User Registration', 'give' ),
46
-					get_bloginfo( 'name' )
45
+					esc_attr__('[%s] New User Registration', 'give'),
46
+					get_bloginfo('name')
47 47
 				),
48 48
 				'default_email_message' => $this->get_default_email_message(),
49
-				'default_email_header'  => __( 'New User Registration', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('New User Registration', 'give'),
50
+			));
51 51
 
52 52
 			// Setup action hook.
53 53
 			add_action(
54 54
 				"give_{$this->config['id']}_email_notification",
55
-				array( $this, 'setup_email_notification' ),
55
+				array($this, 'setup_email_notification'),
56 56
 				10,
57 57
 				2
58 58
 			);
59 59
 
60 60
 			add_filter(
61 61
 				'give_email_preview_header',
62
-				array( $this, 'email_preview_header' ),
62
+				array($this, 'email_preview_header'),
63 63
 				10,
64 64
 				2
65 65
 			);
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		 * @return string
75 75
 		 */
76 76
 		function get_default_email_message() {
77
-			$message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n";
78
-			$message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
79
-			$message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n";
77
+			$message = esc_attr__('New user registration on your site {sitename}:', 'give')."\r\n\r\n";
78
+			$message .= esc_attr__('Username: {username}', 'give')."\r\n\r\n";
79
+			$message .= esc_attr__('Email: {user_email}', 'give')."\r\n";
80 80
 
81 81
 			/**
82 82
 			 * Filter the default email message
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * @since 2.0
97 97
 		 */
98 98
 		public function setup_email_data() {
99
-			Give()->emails->__set( 'heading', $this->get_email_header() );
99
+			Give()->emails->__set('heading', $this->get_email_header());
100 100
 		}
101 101
 
102 102
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 		 *
112 112
 		 * @return string
113 113
 		 */
114
-		public function setup_email_notification( $user_id, $user_data ) {
114
+		public function setup_email_notification($user_id, $user_data) {
115 115
 			$this->setup_email_data();
116 116
 
117
-			$this->send_email_notification( array(
117
+			$this->send_email_notification(array(
118 118
 				'user_id' => $user_id,
119
-			) );
119
+			));
120 120
 		}
121 121
 
122 122
 
@@ -130,42 +130,42 @@  discard block
 block discarded – undo
130 130
 		 * @param Give_New_Donor_Register_Email $email
131 131
 		 * @return string
132 132
 		 */
133
-		public function email_preview_header( $email_preview_header, $email ) {
133
+		public function email_preview_header($email_preview_header, $email) {
134 134
 			// Bailout.
135
-			if ( $this->config['id'] !== $email->config['id'] ) {
135
+			if ($this->config['id'] !== $email->config['id']) {
136 136
 				return $email_preview_header;
137 137
 			}
138 138
 
139 139
 			// Payment receipt switcher
140
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
140
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
141 141
 
142 142
 			// Get payments.
143 143
 			$donors  = new Give_API();
144
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
144
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
145 145
 			$options = array();
146 146
 
147 147
 			// Default option.
148
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
148
+			$options[0] = esc_html__('No donor(s) found.', 'give');
149 149
 
150 150
 			// Provide nice human readable options.
151
-			if ( $donors ) {
152
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
153
-				foreach ( $donors as $donor ) {
151
+			if ($donors) {
152
+				$options[0] = esc_html__('- Select a donor -', 'give');
153
+				foreach ($donors as $donor) {
154 154
 					// Exclude customers for which wp user not exist.
155
-					if ( ! $donor['info']['user_id'] ) {
155
+					if ( ! $donor['info']['user_id']) {
156 156
 						continue;
157 157
 					}
158
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
158
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
159 159
 				}
160 160
 			}
161 161
 
162
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
162
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
163 163
 			$query            = $request_url_data['query'];
164 164
 
165 165
 			// Remove user id query param if set from request url.
166
-			$query = remove_query_arg( array( 'user_id' ), $query );
166
+			$query = remove_query_arg(array('user_id'), $query);
167 167
 
168
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
168
+			$request_url = home_url('/?'.str_replace('', '', $query));
169 169
 			?>
170 170
 			<script type="text/javascript">
171 171
 				function change_preview() {
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 			<div class="give_preview_email_user_id_main">
200 200
 
201 201
 				<label for="give_preview_email_user_id" class="give_preview_email_user_id_label">
202
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
202
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
203 203
 				</label>
204 204
 
205 205
 				<?php
206 206
 				// The select field with 100 latest transactions
207
-				echo Give()->html->select( array(
207
+				echo Give()->html->select(array(
208 208
 					'name'             => 'preview_email_user_id',
209 209
 					'selected'         => $user_id,
210 210
 					'id'               => 'give_preview_email_user_id',
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					'select_atts'      => 'onchange="change_preview()"',
215 215
 					'show_option_all'  => false,
216 216
 					'show_option_none' => false,
217
-				) );
217
+				));
218 218
 				?>
219 219
 				<!-- Closing tag-->
220 220
 			</div>
Please login to merge, or discard this patch.