Test Failed
Push — master ( 15dfc4...36ff7d )
by Devin
06:56
created
includes/admin/upgrades/class-give-updates.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -618,8 +618,11 @@
 block discarded – undo
618 618
 				<a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn">
619 619
 					<?php _e( 'Restart the updater', 'give' ); ?>
620 620
 				</a>
621
-			<?php else: ?>
622
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
621
+			<?php else {
622
+	: ?>
623
+				<strong><?php _e( 'Database Update', 'give' );
624
+}
625
+?></strong>
623 626
 				&nbsp;&#8211;&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
624 627
 			<?php
625 628
 			endif;
Please login to merge, or discard this patch.
Spacing   +247 added lines, -254 removed lines patch added patch discarded remove patch
@@ -80,34 +80,34 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param array $args
82 82
 	 */
83
-	public function register( $args ) {
83
+	public function register($args) {
84 84
 		$args_default = array(
85 85
 			'id'       => '',
86 86
 			'version'  => '',
87 87
 			'callback' => '',
88 88
 		);
89 89
 
90
-		$args = wp_parse_args( $args, $args_default );
90
+		$args = wp_parse_args($args, $args_default);
91 91
 
92 92
 		// You can only register database upgrade.
93 93
 		$args['type'] = 'database';
94 94
 
95 95
 		// Bailout.
96 96
 		if (
97
-			empty( $args['id'] ) ||
98
-			empty( $args['version'] ) ||
99
-			empty( $args['callback'] ) ||
100
-			! is_callable( $args['callback'] )
97
+			empty($args['id']) ||
98
+			empty($args['version']) ||
99
+			empty($args['callback']) ||
100
+			! is_callable($args['callback'])
101 101
 		) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// Change depend param to array.
106
-		if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) {
107
-			$args['depend'] = array( $args['depend'] );
106
+		if (isset($args['depend']) && is_string($args['depend'])) {
107
+			$args['depend'] = array($args['depend']);
108 108
 		}
109 109
 
110
-		$this->updates[ $args['type'] ][] = $args;
110
+		$this->updates[$args['type']][] = $args;
111 111
 	}
112 112
 
113 113
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return static
119 119
 	 */
120 120
 	static function get_instance() {
121
-		if ( is_null( self::$instance ) ) {
121
+		if (is_null(self::$instance)) {
122 122
 			self::$instance = new self();
123 123
 		}
124 124
 
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 		/**
137 137
 		 * Load file
138 138
 		 */
139
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php';
140
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
139
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php';
140
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
141 141
 
142 142
 		self::$background_updater = new Give_Background_Updater();
143 143
 
144 144
 		/**
145 145
 		 * Setup hooks.
146 146
 		 */
147
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
148
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
149
-		add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) );
150
-		add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) );
151
-		add_action( 'admin_init', array( $this, '__redirect_admin' ) );
152
-		add_action( 'admin_init', array( $this, '__pause_db_update' ), - 1 );
153
-		add_action( 'admin_init', array( $this, '__restart_db_update' ), - 1 );
154
-		add_action( 'admin_notices', array( $this, '__show_notice' ) );
155
-		add_action( 'give_restart_db_upgrade', array( $this, '__health_background_update' ) );
156
-
157
-		if ( is_admin() ) {
158
-			add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
159
-			add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
147
+		add_action('init', array($this, '__register_upgrade'), 9999);
148
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
149
+		add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info'));
150
+		add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating'));
151
+		add_action('admin_init', array($this, '__redirect_admin'));
152
+		add_action('admin_init', array($this, '__pause_db_update'), - 1);
153
+		add_action('admin_init', array($this, '__restart_db_update'), - 1);
154
+		add_action('admin_notices', array($this, '__show_notice'));
155
+		add_action('give_restart_db_upgrade', array($this, '__health_background_update'));
156
+
157
+		if (is_admin()) {
158
+			add_action('admin_init', array($this, '__change_donations_label'), 9999);
159
+			add_action('admin_menu', array($this, '__register_menu'), 9999);
160 160
 		}
161 161
 	}
162 162
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 		$addons         = give_get_plugins();
171 171
 		$plugin_updates = get_plugin_updates();
172 172
 
173
-		foreach ( $addons as $key => $info ) {
174
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
173
+		foreach ($addons as $key => $info) {
174
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
175 175
 				continue;
176 176
 			}
177 177
 
178
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
178
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
179 179
 		}
180 180
 	}
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @access public
188 188
 	 */
189 189
 	public function __register_upgrade() {
190
-		if ( ! is_admin() ) {
190
+		if ( ! is_admin()) {
191 191
 			return;
192 192
 		}
193 193
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		 *
197 197
 		 * @since 1.8.12
198 198
 		 */
199
-		do_action( 'give_register_updates', $this );
199
+		do_action('give_register_updates', $this);
200 200
 	}
201 201
 
202 202
 	/**
@@ -209,23 +209,22 @@  discard block
 block discarded – undo
209 209
 		global $menu;
210 210
 
211 211
 		// Bailout.
212
-		if ( empty( $menu ) || ! $this->get_total_update_count() ) {
212
+		if (empty($menu) || ! $this->get_total_update_count()) {
213 213
 			return;
214 214
 		}
215 215
 
216
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
216
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
217 217
 
218
-		foreach ( $menu as $index => $menu_item ) {
219
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
218
+		foreach ($menu as $index => $menu_item) {
219
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
220 220
 				continue;
221 221
 			}
222 222
 
223
-			$menu[ $index ][0] = sprintf(
223
+			$menu[$index][0] = sprintf(
224 224
 				'%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>',
225
-				__( 'Donations', 'give' ),
225
+				__('Donations', 'give'),
226 226
 				$is_update ?
227
-					$this->get_db_update_processing_percentage() :
228
-					$this->get_total_update_count(),
227
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
229 228
 				$is_update ? '%' : ''
230 229
 			);
231 230
 
@@ -244,41 +243,40 @@  discard block
 block discarded – undo
244 243
 		$this->__register_plugin_addon_updates();
245 244
 
246 245
 		// Bailout.
247
-		if ( ! $this->get_total_update_count() ) {
246
+		if ( ! $this->get_total_update_count()) {
248 247
 			// Show complete update message if still on update setting page.
249
-			if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
248
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
250 249
 				// Upgrades
251 250
 				add_submenu_page(
252 251
 					'edit.php?post_type=give_forms',
253
-					esc_html__( 'Give Updates Complete', 'give' ),
254
-					__( 'Updates', 'give' ),
252
+					esc_html__('Give Updates Complete', 'give'),
253
+					__('Updates', 'give'),
255 254
 					'manage_give_settings',
256 255
 					'give-updates',
257
-					array( $this, 'render_complete_page' )
256
+					array($this, 'render_complete_page')
258 257
 				);
259 258
 			}
260 259
 
261 260
 			return;
262 261
 		}
263 262
 
264
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
263
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
265 264
 
266 265
 		// Upgrades
267 266
 		add_submenu_page(
268 267
 			'edit.php?post_type=give_forms',
269
-			esc_html__( 'Give Updates', 'give' ),
268
+			esc_html__('Give Updates', 'give'),
270 269
 			sprintf(
271 270
 				'%1$s <span class="update-plugins"%2$s><span class="plugin-count give-update-progress-count">%3$s%4$s</span></span>',
272
-				__( 'Updates', 'give' ),
273
-				isset( $_GET['give-pause-db-upgrades'] ) ? ' style="display:none;"' : '',
271
+				__('Updates', 'give'),
272
+				isset($_GET['give-pause-db-upgrades']) ? ' style="display:none;"' : '',
274 273
 				$is_update ?
275
-					$this->get_db_update_processing_percentage() :
276
-					$this->get_total_update_count(),
274
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
277 275
 				$is_update ? '%' : ''
278 276
 			),
279 277
 			'manage_give_settings',
280 278
 			'give-updates',
281
-			array( $this, 'render_page' )
279
+			array($this, 'render_page')
282 280
 		);
283 281
 	}
284 282
 
@@ -293,13 +291,13 @@  discard block
 block discarded – undo
293 291
 		// Show db upgrade completed notice.
294 292
 		if (
295 293
 			! wp_doing_ajax() &&
296
-			current_user_can( 'manage_give_settings' ) &&
297
-			get_option( 'give_show_db_upgrade_complete_notice' ) &&
298
-			! isset( $_GET['give-db-update-completed'] )
294
+			current_user_can('manage_give_settings') &&
295
+			get_option('give_show_db_upgrade_complete_notice') &&
296
+			! isset($_GET['give-db-update-completed'])
299 297
 		) {
300
-			delete_option( 'give_show_db_upgrade_complete_notice' );
298
+			delete_option('give_show_db_upgrade_complete_notice');
301 299
 
302
-			wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed' ) );
300
+			wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed'));
303 301
 			exit();
304 302
 		}
305 303
 	}
@@ -315,15 +313,15 @@  discard block
 block discarded – undo
315 313
 	 *
316 314
 	 * @return bool
317 315
 	 */
318
-	public function __pause_db_update( $force = false ) {
316
+	public function __pause_db_update($force = false) {
319 317
 		// Bailout.
320 318
 		if (
321 319
 			! $force &&
322 320
 			(
323 321
 				wp_doing_ajax() ||
324
-				! isset( $_GET['page'] ) ||
322
+				! isset($_GET['page']) ||
325 323
 				'give-updates' !== $_GET['page'] ||
326
-				! isset( $_GET['give-pause-db-upgrades'] ) ||
324
+				! isset($_GET['give-pause-db-upgrades']) ||
327 325
 				self::$background_updater->is_paused_process()
328 326
 			)
329 327
 
@@ -331,13 +329,13 @@  discard block
 block discarded – undo
331 329
 			return false;
332 330
 		}
333 331
 
334
-		delete_option( 'give_upgrade_error' );
332
+		delete_option('give_upgrade_error');
335 333
 
336
-		$this->__health_background_update( $this );
334
+		$this->__health_background_update($this);
337 335
 		$batch = self::$background_updater->get_all_batch();
338 336
 
339 337
 		// Bailout: if batch is empty
340
-		if ( empty( $batch->data ) ) {
338
+		if (empty($batch->data)) {
341 339
 			return false;
342 340
 		}
343 341
 
@@ -346,25 +344,25 @@  discard block
 block discarded – undo
346 344
 
347 345
 		// Do not stop background process immediately if task running.
348 346
 		// @see Give_Background_Updater::lock_process
349
-		if ( ! $force && self::$background_updater->is_process_running() ) {
350
-			update_option( 'give_pause_upgrade', 1 );
347
+		if ( ! $force && self::$background_updater->is_process_running()) {
348
+			update_option('give_pause_upgrade', 1);
351 349
 
352 350
 			return true;
353 351
 		}
354 352
 
355
-		update_option( 'give_paused_batches', $batch, 'no' );
356
-		delete_option( $batch->key );
357
-		delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
358
-		wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
353
+		update_option('give_paused_batches', $batch, 'no');
354
+		delete_option($batch->key);
355
+		delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
356
+		wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
359 357
 
360
-		Give()->logs->add( 'Update Pause', print_r( $batch, true ), 0, 'update' );
358
+		Give()->logs->add('Update Pause', print_r($batch, true), 0, 'update');
361 359
 
362 360
 		/**
363 361
 		 * Fire action when pause db updates
364 362
 		 *
365 363
 		 * @since 2.0.1
366 364
 		 */
367
-		do_action( 'give_pause_db_upgrade', $this );
365
+		do_action('give_pause_db_upgrade', $this);
368 366
 
369 367
 		return true;
370 368
 	}
@@ -381,31 +379,31 @@  discard block
 block discarded – undo
381 379
 		// Bailout.
382 380
 		if (
383 381
 			wp_doing_ajax() ||
384
-			! isset( $_GET['page'] ) ||
382
+			! isset($_GET['page']) ||
385 383
 			'give-updates' !== $_GET['page'] ||
386
-			! isset( $_GET['give-restart-db-upgrades'] ) ||
384
+			! isset($_GET['give-restart-db-upgrades']) ||
387 385
 			! self::$background_updater->is_paused_process()
388 386
 		) {
389 387
 			return false;
390 388
 		}
391 389
 
392 390
 		Give_Background_Updater::flush_cache();
393
-		$batch = get_option( 'give_paused_batches' );
391
+		$batch = get_option('give_paused_batches');
394 392
 
395
-		if ( ! empty( $batch ) ) {
396
-			wp_cache_delete( $batch->key, 'options' );
397
-			update_option( $batch->key, $batch->data );
393
+		if ( ! empty($batch)) {
394
+			wp_cache_delete($batch->key, 'options');
395
+			update_option($batch->key, $batch->data);
398 396
 
399
-			delete_option( 'give_paused_batches' );
397
+			delete_option('give_paused_batches');
400 398
 
401
-			Give()->logs->add( 'Update Restart', print_r( $batch, true ), 0, 'update' );
399
+			Give()->logs->add('Update Restart', print_r($batch, true), 0, 'update');
402 400
 
403 401
 
404 402
 			/** Fire action when restart db updates
405 403
 			 *
406 404
 			 * @since 2.0.1
407 405
 			 */
408
-			do_action( 'give_restart_db_upgrade', $this );
406
+			do_action('give_restart_db_upgrade', $this);
409 407
 
410 408
 			self::$background_updater->dispatch();
411 409
 		}
@@ -421,53 +419,53 @@  discard block
 block discarded – undo
421 419
 	 *
422 420
 	 * @param Give_Updates $give_updates
423 421
 	 */
424
-	public function __health_background_update( $give_updates ) {
425
-		if ( ! $this->is_doing_updates() ) {
422
+	public function __health_background_update($give_updates) {
423
+		if ( ! $this->is_doing_updates()) {
426 424
 			return;
427 425
 		}
428 426
 
429 427
 		Give_Background_Updater::flush_cache();
430 428
 
431 429
 		$batch                = Give_Updates::$background_updater->get_all_batch();
432
-		$batch_data_count     = count( $batch->data );
433
-		$all_updates          = $give_updates->get_updates( 'database', 'all' );
434
-		$all_update_ids       = wp_list_pluck( $all_updates, 'id' );
435
-		$all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array();
430
+		$batch_data_count     = count($batch->data);
431
+		$all_updates          = $give_updates->get_updates('database', 'all');
432
+		$all_update_ids       = wp_list_pluck($all_updates, 'id');
433
+		$all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array();
436 434
 		$log_data             = '';
437
-		$doing_upgrade_args   = get_option( 'give_doing_upgrade' );
435
+		$doing_upgrade_args   = get_option('give_doing_upgrade');
438 436
 
439
-		if ( ! empty( $doing_upgrade_args ) ) {
440
-			$log_data .= 'Doing update:' . "\n";
441
-			$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
437
+		if ( ! empty($doing_upgrade_args)) {
438
+			$log_data .= 'Doing update:'."\n";
439
+			$log_data .= print_r($doing_upgrade_args, true)."\n";
442 440
 		}
443 441
 
444 442
 		/**
445 443
 		 * Add remove upgrade from batch
446 444
 		 */
447
-		if ( ! empty( $batch->data ) ) {
445
+		if ( ! empty($batch->data)) {
448 446
 
449
-			foreach ( $batch->data as $index => $update ) {
450
-				$log_data = print_r( $update, true ) . "\n";
447
+			foreach ($batch->data as $index => $update) {
448
+				$log_data = print_r($update, true)."\n";
451 449
 
452
-				if ( ! is_callable( $update['callback'] ) ) {
453
-					$log_data .= 'Removing missing callback update: ' . "{$update['id']}\n";
454
-					unset( $batch->data[ $index ] );
455
-				} elseif ( give_has_upgrade_completed( $update['id'] ) ) {
456
-					$log_data .= 'Removing already completed update: ' . "{$update['id']}\n";
457
-					unset( $batch->data[ $index ] );
450
+				if ( ! is_callable($update['callback'])) {
451
+					$log_data .= 'Removing missing callback update: '."{$update['id']}\n";
452
+					unset($batch->data[$index]);
453
+				} elseif (give_has_upgrade_completed($update['id'])) {
454
+					$log_data .= 'Removing already completed update: '."{$update['id']}\n";
455
+					unset($batch->data[$index]);
458 456
 				}
459 457
 
460
-				if ( ! empty( $update['depend'] ) ) {
458
+				if ( ! empty($update['depend'])) {
461 459
 
462
-					foreach ( $update['depend'] as $depend ) {
463
-						if ( give_has_upgrade_completed( $depend ) ) {
464
-							$log_data .= 'Completed update: ' . "{$depend}\n";
460
+					foreach ($update['depend'] as $depend) {
461
+						if (give_has_upgrade_completed($depend)) {
462
+							$log_data .= 'Completed update: '."{$depend}\n";
465 463
 							continue;
466 464
 						}
467 465
 
468
-						if ( in_array( $depend, $all_update_ids ) && ! in_array( $depend, $all_batch_update_ids ) ) {
469
-							$log_data .= 'Adding missing update: ' . "{$depend}\n";
470
-							array_unshift( $batch->data, $all_updates[ array_search( $depend, $all_update_ids ) ] );
466
+						if (in_array($depend, $all_update_ids) && ! in_array($depend, $all_batch_update_ids)) {
467
+							$log_data .= 'Adding missing update: '."{$depend}\n";
468
+							array_unshift($batch->data, $all_updates[array_search($depend, $all_update_ids)]);
471 469
 						}
472 470
 					}
473 471
 				}
@@ -477,52 +475,52 @@  discard block
 block discarded – undo
477 475
 		/**
478 476
 		 * Add new upgrade to batch
479 477
 		 */
480
-		if ( $new_updates = $this->get_updates( 'database', 'new' ) ) {
481
-			$all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array();
478
+		if ($new_updates = $this->get_updates('database', 'new')) {
479
+			$all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array();
482 480
 
483
-			foreach ( $new_updates as $index => $new_update ) {
484
-				if ( give_has_upgrade_completed( $new_update['id'] ) || in_array( $new_update['id'], $all_batch_update_ids ) ) {
485
-					unset( $new_updates[ $index ] );
481
+			foreach ($new_updates as $index => $new_update) {
482
+				if (give_has_upgrade_completed($new_update['id']) || in_array($new_update['id'], $all_batch_update_ids)) {
483
+					unset($new_updates[$index]);
486 484
 				}
487 485
 			}
488 486
 
489
-			if ( ! empty( $new_updates ) ) {
490
-				$log_data .= 'Adding new update: ' . "\n";
491
-				$log_data .= print_r( $new_updates, true ) . "\n";
487
+			if ( ! empty($new_updates)) {
488
+				$log_data .= 'Adding new update: '."\n";
489
+				$log_data .= print_r($new_updates, true)."\n";
492 490
 
493
-				$batch->data = array_merge( (array) $batch->data, $new_updates );
494
-				update_option( 'give_db_update_count', ( absint( get_option( 'give_db_update_count' ) ) + count( $new_updates ) ) );
491
+				$batch->data = array_merge((array) $batch->data, $new_updates);
492
+				update_option('give_db_update_count', (absint(get_option('give_db_update_count')) + count($new_updates)));
495 493
 			}
496 494
 		}
497 495
 
498 496
 		/**
499 497
 		 * Fix batch
500 498
 		 */
501
-		if ( empty( $batch->data ) ) {
499
+		if (empty($batch->data)) {
502 500
 			// Complete batch if do not have any data to process.
503
-			self::$background_updater->delete( $batch->key );
501
+			self::$background_updater->delete($batch->key);
504 502
 
505
-			if ( self::$background_updater->has_queue() ) {
506
-				$this->__health_background_update( $this );
503
+			if (self::$background_updater->has_queue()) {
504
+				$this->__health_background_update($this);
507 505
 			} else {
508
-				delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
509
-				wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
506
+				delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
507
+				wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
510 508
 
511 509
 				self::$background_updater->complete();
512 510
 			}
513 511
 
514
-		} elseif ( $batch_data_count !== count( $batch->data ) ) {
512
+		} elseif ($batch_data_count !== count($batch->data)) {
515 513
 
516
-			$log_data .= 'Updating batch' . "\n";
517
-			$log_data .= print_r( $batch, true );
514
+			$log_data .= 'Updating batch'."\n";
515
+			$log_data .= print_r($batch, true);
518 516
 
519
-			if ( ! empty( $batch->key ) ) {
520
-				wp_cache_delete( $batch->key, 'options' );
521
-				update_option( $batch->key, $batch->data );
517
+			if ( ! empty($batch->key)) {
518
+				wp_cache_delete($batch->key, 'options');
519
+				update_option($batch->key, $batch->data);
522 520
 			} else {
523 521
 
524
-				foreach ( $batch->data as $data ) {
525
-					Give_Updates::$background_updater->push_to_queue( $data );
522
+				foreach ($batch->data as $data) {
523
+					Give_Updates::$background_updater->push_to_queue($data);
526 524
 				}
527 525
 
528 526
 				Give_Updates::$background_updater->save();
@@ -533,31 +531,31 @@  discard block
 block discarded – undo
533 531
 		/**
534 532
 		 * Fix give_doing_upgrade option
535 533
 		 */
536
-		if( $fresh_new_db_count = $this->get_total_new_db_update_count( true ) ) {
537
-			update_option( 'give_db_update_count', $fresh_new_db_count );
534
+		if ($fresh_new_db_count = $this->get_total_new_db_update_count(true)) {
535
+			update_option('give_db_update_count', $fresh_new_db_count);
538 536
 		}
539 537
 
540 538
 		$doing_upgrade_args['update']           = 1;
541
-		$doing_upgrade_args['heading']          = sprintf( 'Update %s of %s', 1, $fresh_new_db_count );
542
-		$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true );
539
+		$doing_upgrade_args['heading']          = sprintf('Update %s of %s', 1, $fresh_new_db_count);
540
+		$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage(true);
543 541
 
544 542
 		// Remove already completed update from info.
545 543
 		if (
546
-			empty( $doing_upgrade_args['update_info'] )
547
-			|| give_has_upgrade_completed( $doing_upgrade_args['update_info']['id'] )
544
+			empty($doing_upgrade_args['update_info'])
545
+			|| give_has_upgrade_completed($doing_upgrade_args['update_info']['id'])
548 546
 		) {
549
-			$doing_upgrade_args['update_info'] = current( array_values( $batch->data ) );
547
+			$doing_upgrade_args['update_info'] = current(array_values($batch->data));
550 548
 			$doing_upgrade_args['step']        = 1;
551 549
 		}
552 550
 
553 551
 		// Check if dependency completed or not.
554
-		if ( isset( $doing_upgrade_args['update_info']['depend'] ) ) {
555
-			foreach ( $doing_upgrade_args['update_info']['depend'] as $depend ) {
556
-				if ( give_has_upgrade_completed( $depend ) ) {
552
+		if (isset($doing_upgrade_args['update_info']['depend'])) {
553
+			foreach ($doing_upgrade_args['update_info']['depend'] as $depend) {
554
+				if (give_has_upgrade_completed($depend)) {
557 555
 					continue;
558 556
 				}
559 557
 
560
-				$doing_upgrade_args['update_info']      = $all_updates[ array_search( $depend, $all_update_ids ) ];
558
+				$doing_upgrade_args['update_info']      = $all_updates[array_search($depend, $all_update_ids)];
561 559
 				$doing_upgrade_args['step']             = 1;
562 560
 				$doing_upgrade_args['percentage']       = 0;
563 561
 				$doing_upgrade_args['total_percentage'] = 0;
@@ -566,14 +564,14 @@  discard block
 block discarded – undo
566 564
 			}
567 565
 		}
568 566
 
569
-		if( ! empty( $doing_upgrade_args['update_info'] ) ) {
570
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
567
+		if ( ! empty($doing_upgrade_args['update_info'])) {
568
+			update_option('give_doing_upgrade', $doing_upgrade_args);
571 569
 
572
-			$log_data .= 'Updated doing update:' . "\n";
573
-			$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
570
+			$log_data .= 'Updated doing update:'."\n";
571
+			$log_data .= print_r($doing_upgrade_args, true)."\n";
574 572
 		}
575 573
 
576
-		Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' );
574
+		Give()->logs->add('Update Health Check', $log_data, 0, 'update');
577 575
 	}
578 576
 
579 577
 
@@ -587,61 +585,61 @@  discard block
 block discarded – undo
587 585
 		$current_screen = get_current_screen();
588 586
 
589 587
 		// Bailout.
590
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
588
+		if ( ! current_user_can('manage_give_settings')) {
591 589
 			return;
592 590
 		}
593 591
 
594 592
 		// Run DB updates.
595
-		if ( ! empty( $_GET['give-run-db-update'] ) ) {
593
+		if ( ! empty($_GET['give-run-db-update'])) {
596 594
 			$this->run_db_update();
597 595
 		}
598 596
 
599 597
 
600 598
 		// Bailout.
601
-		if ( in_array( $current_screen->base, array( 'give_forms_page_give-updates', 'update-core' ) ) ) {
599
+		if (in_array($current_screen->base, array('give_forms_page_give-updates', 'update-core'))) {
602 600
 			return;
603 601
 		}
604 602
 
605 603
 		// Show notice if upgrade paused.
606
-		if ( self::$background_updater->is_paused_process() ) {
604
+		if (self::$background_updater->is_paused_process()) {
607 605
 			ob_start();
608 606
 
609
-			$upgrade_error = get_option( 'give_upgrade_error' );
610
-			if ( ! $upgrade_error ) : ?>
611
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
612
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give' ); ?>
607
+			$upgrade_error = get_option('give_upgrade_error');
608
+			if ( ! $upgrade_error) : ?>
609
+				<strong><?php _e('Database Update', 'give'); ?></strong>
610
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give'); ?>
613 611
 				<br>
614 612
 				<br>
615
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn">
616
-					<?php _e( 'Restart the updater', 'give' ); ?>
613
+				<a href="<?php echo esc_url(add_query_arg(array('give-restart-db-upgrades' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-restart-updater-btn">
614
+					<?php _e('Restart the updater', 'give'); ?>
617 615
 				</a>
618 616
 			<?php else: ?>
619
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
620
-				&nbsp;&#8211;&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
617
+				<strong><?php _e('Database Update', 'give'); ?></strong>
618
+				&nbsp;&#8211;&nbsp;<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
621 619
 			<?php
622 620
 			endif;
623 621
 			$desc_html = ob_get_clean();
624 622
 
625
-			Give()->notices->register_notice( array(
623
+			Give()->notices->register_notice(array(
626 624
 				'id'          => 'give_upgrade_db',
627 625
 				'type'        => 'error',
628 626
 				'dismissible' => false,
629 627
 				'description' => $desc_html,
630
-			) );
628
+			));
631 629
 		}
632 630
 
633 631
 		// Bailout if doing upgrades.
634
-		if ( $this->is_doing_updates() ) {
632
+		if ($this->is_doing_updates()) {
635 633
 			return;
636 634
 		}
637 635
 
638 636
 		// Show notice if ajax is not working.
639
-		if ( ! give_test_ajax_works() ) {
637
+		if ( ! give_test_ajax_works()) {
640 638
 			Give()->notices->register_notice(
641 639
 				array(
642 640
 					'id'          => 'give_db_upgrade_ajax_inaccessible',
643 641
 					'type'        => 'error',
644
-					'description' => sprintf( '%1$s <a href="%2$s" target="_blank">%3$s</a>', __( 'Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give' ), 'http://docs.givewp.com/admin-ajax-error', __( 'Read More', 'give' ) . ' &raquo;' ),
642
+					'description' => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give'), 'http://docs.givewp.com/admin-ajax-error', __('Read More', 'give').' &raquo;'),
645 643
 					'show'        => true,
646 644
 				)
647 645
 			);
@@ -650,40 +648,40 @@  discard block
 block discarded – undo
650 648
 		}
651 649
 
652 650
 		// Show db upgrade completed notice.
653
-		if ( ! empty( $_GET['give-db-update-completed'] ) ) {
654
-			Give()->notices->register_notice( array(
651
+		if ( ! empty($_GET['give-db-update-completed'])) {
652
+			Give()->notices->register_notice(array(
655 653
 				'id'          => 'give_db_upgrade_completed',
656 654
 				'type'        => 'updated',
657
-				'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
655
+				'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
658 656
 				'show'        => true,
659
-			) );
657
+			));
660 658
 
661 659
 			// Start update.
662
-		} elseif ( ! empty( $_GET['give-run-db-update'] ) ) {
660
+		} elseif ( ! empty($_GET['give-run-db-update'])) {
663 661
 			$this->run_db_update();
664 662
 
665 663
 			// Show run the update notice.
666
-		} elseif ( $this->get_total_new_db_update_count() ) {
664
+		} elseif ($this->get_total_new_db_update_count()) {
667 665
 			ob_start();
668 666
 			?>
669 667
 			<p>
670
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
671
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?>
668
+				<strong><?php _e('Database Update', 'give'); ?></strong>
669
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?>
672 670
 			</p>
673 671
 			<p class="submit">
674
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now">
675
-					<?php _e( 'Run the updater', 'give' ); ?>
672
+				<a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now">
673
+					<?php _e('Run the updater', 'give'); ?>
676 674
 				</a>
677 675
 			</p>
678 676
 			<?php
679 677
 			$desc_html = ob_get_clean();
680 678
 
681
-			Give()->notices->register_notice( array(
679
+			Give()->notices->register_notice(array(
682 680
 				'id'          => 'give_upgrade_db',
683 681
 				'type'        => 'updated',
684 682
 				'dismissible' => false,
685 683
 				'description' => $desc_html,
686
-			) );
684
+			));
687 685
 		}
688 686
 	}
689 687
 
@@ -694,7 +692,7 @@  discard block
 block discarded – undo
694 692
 	 * @access public
695 693
 	 */
696 694
 	public function render_complete_page() {
697
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
695
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
698 696
 	}
699 697
 
700 698
 	/**
@@ -704,7 +702,7 @@  discard block
 block discarded – undo
704 702
 	 * @access public
705 703
 	 */
706 704
 	public function render_page() {
707
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
705
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
708 706
 	}
709 707
 
710 708
 	/**
@@ -715,26 +713,26 @@  discard block
 block discarded – undo
715 713
 	 */
716 714
 	private function run_db_update() {
717 715
 		// Bailout.
718
-		if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) {
716
+		if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) {
719 717
 			return;
720 718
 		}
721 719
 
722
-		$updates = $this->get_updates( 'database', 'new' );
720
+		$updates = $this->get_updates('database', 'new');
723 721
 
724
-		foreach ( $updates as $update ) {
725
-			self::$background_updater->push_to_queue( $update );
722
+		foreach ($updates as $update) {
723
+			self::$background_updater->push_to_queue($update);
726 724
 		}
727 725
 
728
-		add_option( 'give_db_update_count', count( $updates ), '', 'no' );
726
+		add_option('give_db_update_count', count($updates), '', 'no');
729 727
 
730
-		add_option( 'give_doing_upgrade', array(
728
+		add_option('give_doing_upgrade', array(
731 729
 			'update_info'      => $updates[0],
732 730
 			'step'             => 1,
733 731
 			'update'           => 1,
734
-			'heading'          => sprintf( 'Update %s of %s', 1, count( $updates ) ),
732
+			'heading'          => sprintf('Update %s of %s', 1, count($updates)),
735 733
 			'percentage'       => 0,
736 734
 			'total_percentage' => 0,
737
-		), '', 'no' );
735
+		), '', 'no');
738 736
 
739 737
 		self::$background_updater->save()->dispatch();
740 738
 	}
@@ -748,14 +746,13 @@  discard block
 block discarded – undo
748 746
 	 */
749 747
 	public function __flush_resume_updates() {
750 748
 		//delete_option( 'give_doing_upgrade' );
751
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
749
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
752 750
 
753 751
 		// Reset counter.
754 752
 		$this->step = $this->percentage = 0;
755 753
 
756
-		$this->update = ( $this->get_total_db_update_count() > $this->update ) ?
757
-			( $this->update + 1 ) :
758
-			$this->update;
754
+		$this->update = ($this->get_total_db_update_count() > $this->update) ?
755
+			($this->update + 1) : $this->update;
759 756
 	}
760 757
 
761 758
 
@@ -770,7 +767,7 @@  discard block
 block discarded – undo
770 767
 	public function __give_start_updating() {
771 768
 		// Check permission.
772 769
 		if (
773
-			! current_user_can( 'manage_give_settings' ) ||
770
+			! current_user_can('manage_give_settings') ||
774 771
 			$this->is_doing_updates()
775 772
 		) {
776 773
 			wp_send_json_error();
@@ -778,7 +775,7 @@  discard block
 block discarded – undo
778 775
 
779 776
 		// @todo: validate nonce
780 777
 		// @todo: set http method to post
781
-		if ( empty( $_POST['run_db_update'] ) ) {
778
+		if (empty($_POST['run_db_update'])) {
782 779
 			wp_send_json_error();
783 780
 		}
784 781
 
@@ -797,34 +794,34 @@  discard block
 block discarded – undo
797 794
 	 * @return string
798 795
 	 */
799 796
 	public function __give_db_updates_info() {
800
-		$update_info   = get_option( 'give_doing_upgrade' );
797
+		$update_info   = get_option('give_doing_upgrade');
801 798
 		$response_type = '';
802 799
 
803
-		if ( self::$background_updater->is_paused_process() ) {
800
+		if (self::$background_updater->is_paused_process()) {
804 801
 			$update_info = array(
805
-				'message'    => __( 'The updates have been paused.', 'give' ),
802
+				'message'    => __('The updates have been paused.', 'give'),
806 803
 				'heading'    => '',
807 804
 				'percentage' => 0,
808 805
 			);
809 806
 
810
-			if ( get_option( 'give_upgrade_error' ) ) {
811
-				$update_info['message'] = __( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' );
807
+			if (get_option('give_upgrade_error')) {
808
+				$update_info['message'] = __('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give');
812 809
 			}
813 810
 
814 811
 			$response_type = 'error';
815 812
 
816
-		} elseif ( empty( $update_info ) || ! $this->get_total_new_db_update_count( true ) ) {
813
+		} elseif (empty($update_info) || ! $this->get_total_new_db_update_count(true)) {
817 814
 			$update_info   = array(
818
-				'message'    => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
819
-				'heading'    => __( 'Updates Completed.', 'give' ),
815
+				'message'    => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
816
+				'heading'    => __('Updates Completed.', 'give'),
820 817
 				'percentage' => 0,
821 818
 			);
822 819
 			$response_type = 'success';
823 820
 
824
-			delete_option( 'give_show_db_upgrade_complete_notice' );
821
+			delete_option('give_show_db_upgrade_complete_notice');
825 822
 		}
826 823
 
827
-		$this->send_ajax_response( $update_info, $response_type );
824
+		$this->send_ajax_response($update_info, $response_type);
828 825
 	}
829 826
 
830 827
 	/**
@@ -836,7 +833,7 @@  discard block
 block discarded – undo
836 833
 	 * @param        $data
837 834
 	 * @param string $type
838 835
 	 */
839
-	public function send_ajax_response( $data, $type = '' ) {
836
+	public function send_ajax_response($data, $type = '') {
840 837
 		$default = array(
841 838
 			'message'    => '',
842 839
 			'heading'    => '',
@@ -846,24 +843,24 @@  discard block
 block discarded – undo
846 843
 		);
847 844
 
848 845
 		// Set data.
849
-		$data = wp_parse_args( $data, $default );
846
+		$data = wp_parse_args($data, $default);
850 847
 
851 848
 		// Enable cache.
852 849
 		Give_Cache::enable();
853 850
 
854
-		switch ( $type ) {
851
+		switch ($type) {
855 852
 			case 'success':
856
-				wp_send_json_success( $data );
853
+				wp_send_json_success($data);
857 854
 				break;
858 855
 
859 856
 			case 'error':
860
-				wp_send_json_error( $data );
857
+				wp_send_json_error($data);
861 858
 				break;
862 859
 
863 860
 			default:
864
-				wp_send_json( array(
861
+				wp_send_json(array(
865 862
 					'data' => $data,
866
-				) );
863
+				));
867 864
 				break;
868 865
 		}
869 866
 	}
@@ -877,12 +874,12 @@  discard block
 block discarded – undo
877 874
 	 * @param $total
878 875
 	 * @param $current_total
879 876
 	 */
880
-	public function set_percentage( $total, $current_total ) {
877
+	public function set_percentage($total, $current_total) {
881 878
 		// Set percentage.
882
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
879
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
883 880
 
884 881
 		// Verify percentage.
885
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
882
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
886 883
 	}
887 884
 
888 885
 	/**
@@ -895,22 +892,22 @@  discard block
 block discarded – undo
895 892
 	 *
896 893
 	 * @return bool|null
897 894
 	 */
898
-	public function is_parent_updates_completed( $update ) {
895
+	public function is_parent_updates_completed($update) {
899 896
 		// Bailout.
900
-		if ( empty( $update['depend'] ) ) {
897
+		if (empty($update['depend'])) {
901 898
 			return true;
902 899
 		}
903 900
 
904 901
 		// Check if dependency is valid or not.
905
-		if ( ! $this->has_valid_dependency( $update ) ) {
902
+		if ( ! $this->has_valid_dependency($update)) {
906 903
 			return null;
907 904
 		}
908 905
 
909 906
 		$is_dependency_completed = true;
910 907
 
911
-		foreach ( $update['depend'] as $depend ) {
908
+		foreach ($update['depend'] as $depend) {
912 909
 
913
-			if ( ! give_has_upgrade_completed( $depend ) ) {
910
+			if ( ! give_has_upgrade_completed($depend)) {
914 911
 				$is_dependency_completed = false;
915 912
 				break;
916 913
 			}
@@ -927,7 +924,7 @@  discard block
 block discarded – undo
927 924
 	 * @return bool
928 925
 	 */
929 926
 	public function is_doing_updates() {
930
-		return (bool) get_option( 'give_doing_upgrade' );
927
+		return (bool) get_option('give_doing_upgrade');
931 928
 	}
932 929
 
933 930
 
@@ -941,7 +938,7 @@  discard block
 block discarded – undo
941 938
 	 *
942 939
 	 * @return bool
943 940
 	 */
944
-	public function has_valid_dependency( $update ) {
941
+	public function has_valid_dependency($update) {
945 942
 		$is_valid_dependency = true;
946 943
 		// $update_ids          = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' );
947 944
 		//
@@ -967,33 +964,33 @@  discard block
 block discarded – undo
967 964
 	 *
968 965
 	 * @return array
969 966
 	 */
970
-	public function get_updates( $update_type = '', $status = 'all' ) {
967
+	public function get_updates($update_type = '', $status = 'all') {
971 968
 		// return all updates.
972
-		if ( empty( $update_type ) ) {
969
+		if (empty($update_type)) {
973 970
 			return $this->updates;
974 971
 		}
975 972
 
976 973
 		// Get specific update.
977
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
974
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
978 975
 
979 976
 		// Bailout.
980
-		if ( empty( $updates ) ) {
977
+		if (empty($updates)) {
981 978
 			return $updates;
982 979
 		}
983 980
 
984
-		switch ( $status ) {
981
+		switch ($status) {
985 982
 			case 'new':
986 983
 				// Remove already completed updates.
987
-				wp_cache_delete( 'give_completed_upgrades', 'options' );
984
+				wp_cache_delete('give_completed_upgrades', 'options');
988 985
 				$completed_updates = give_get_completed_upgrades();
989 986
 
990
-				if ( ! empty( $completed_updates ) ) {
991
-					foreach ( $updates as $index => $update ) {
992
-						if ( in_array( $update['id'], $completed_updates ) ) {
993
-							unset( $updates[ $index ] );
987
+				if ( ! empty($completed_updates)) {
988
+					foreach ($updates as $index => $update) {
989
+						if (in_array($update['id'], $completed_updates)) {
990
+							unset($updates[$index]);
994 991
 						}
995 992
 					}
996
-					$updates = array_values( $updates );
993
+					$updates = array_values($updates);
997 994
 				}
998 995
 
999 996
 				break;
@@ -1010,7 +1007,7 @@  discard block
 block discarded – undo
1010 1007
 	 * @return int
1011 1008
 	 */
1012 1009
 	public function get_total_plugin_update_count() {
1013
-		return count( $this->get_updates( 'plugin' ) );
1010
+		return count($this->get_updates('plugin'));
1014 1011
 	}
1015 1012
 
1016 1013
 	/**
@@ -1025,7 +1022,7 @@  discard block
 block discarded – undo
1025 1022
 		$db_update_count     = $this->get_pending_db_update_count();
1026 1023
 		$plugin_update_count = $this->get_total_plugin_update_count();
1027 1024
 
1028
-		return ( $db_update_count + $plugin_update_count );
1025
+		return ($db_update_count + $plugin_update_count);
1029 1026
 	}
1030 1027
 
1031 1028
 	/**
@@ -1037,7 +1034,7 @@  discard block
 block discarded – undo
1037 1034
 	 * @return int
1038 1035
 	 */
1039 1036
 	public function get_pending_db_update_count() {
1040
-		return count( $this->get_updates( 'database', 'new' ) );
1037
+		return count($this->get_updates('database', 'new'));
1041 1038
 	}
1042 1039
 
1043 1040
 	/**
@@ -1049,7 +1046,7 @@  discard block
 block discarded – undo
1049 1046
 	 * @return int
1050 1047
 	 */
1051 1048
 	public function get_total_db_update_count() {
1052
-		return count( $this->get_updates( 'database', 'all' ) );
1049
+		return count($this->get_updates('database', 'all'));
1053 1050
 	}
1054 1051
 
1055 1052
 	/**
@@ -1062,10 +1059,9 @@  discard block
 block discarded – undo
1062 1059
 	 *
1063 1060
 	 * @return int
1064 1061
 	 */
1065
-	public function get_total_new_db_update_count( $refresh = false ) {
1062
+	public function get_total_new_db_update_count($refresh = false) {
1066 1063
 		$update_count = $this->is_doing_updates() && ! $refresh ?
1067
-			get_option( 'give_db_update_count' ) :
1068
-			$this->get_pending_db_update_count();
1064
+			get_option('give_db_update_count') : $this->get_pending_db_update_count();
1069 1065
 
1070 1066
 		return $update_count;
1071 1067
 	}
@@ -1080,11 +1076,11 @@  discard block
 block discarded – undo
1080 1076
 	 *
1081 1077
 	 * @return int
1082 1078
 	 */
1083
-	public function get_running_db_update( $refresh = false ) {
1079
+	public function get_running_db_update($refresh = false) {
1084 1080
 		$current_update = 1;
1085 1081
 
1086
-		if ( $this->is_doing_updates() && ! $refresh ) {
1087
-			$current_update = get_option( 'give_doing_upgrade' );
1082
+		if ($this->is_doing_updates() && ! $refresh) {
1083
+			$current_update = get_option('give_doing_upgrade');
1088 1084
 			$current_update = $current_update['update'];
1089 1085
 		}
1090 1086
 
@@ -1101,25 +1097,23 @@  discard block
 block discarded – undo
1101 1097
 	 *
1102 1098
 	 * @return float|int
1103 1099
 	 */
1104
-	public function get_db_update_processing_percentage( $refresh = false ) {
1100
+	public function get_db_update_processing_percentage($refresh = false) {
1105 1101
 		// Bailout.
1106
-		if ( ! $this->get_total_new_db_update_count( $refresh ) ) {
1102
+		if ( ! $this->get_total_new_db_update_count($refresh)) {
1107 1103
 			return 0;
1108 1104
 		}
1109 1105
 
1110
-		$resume_update            = get_option( 'give_doing_upgrade' );
1111
-		$update_count_percentages = ( ( $this->get_running_db_update( $refresh ) - 1 ) / $this->get_total_new_db_update_count( $refresh ) ) * 100;
1112
-		$update_percentage_share  = ( 1 / $this->get_total_new_db_update_count() ) * 100;
1113
-		$upgrade_percentage       = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 );
1106
+		$resume_update            = get_option('give_doing_upgrade');
1107
+		$update_count_percentages = (($this->get_running_db_update($refresh) - 1) / $this->get_total_new_db_update_count($refresh)) * 100;
1108
+		$update_percentage_share  = (1 / $this->get_total_new_db_update_count()) * 100;
1109
+		$upgrade_percentage       = (($resume_update['percentage'] * $update_percentage_share) / 100);
1114 1110
 
1115 1111
 		$final_percentage = $update_count_percentages + $upgrade_percentage;
1116 1112
 
1117 1113
 		return $this->is_doing_updates() ?
1118
-			( absint( $final_percentage ) ?
1119
-				absint( $final_percentage ) :
1120
-				round( $final_percentage, 2 )
1121
-			) :
1122
-			0;
1114
+			(absint($final_percentage) ?
1115
+				absint($final_percentage) : round($final_percentage, 2)
1116
+			) : 0;
1123 1117
 	}
1124 1118
 
1125 1119
 
@@ -1131,8 +1125,8 @@  discard block
 block discarded – undo
1131 1125
 	 * @return array
1132 1126
 	 */
1133 1127
 	public function get_update_ids() {
1134
-		$all_updates    = $this->get_updates( 'database', 'all' );
1135
-		$all_update_ids = wp_list_pluck( $all_updates, 'id' );
1128
+		$all_updates    = $this->get_updates('database', 'all');
1129
+		$all_update_ids = wp_list_pluck($all_updates, 'id');
1136 1130
 
1137 1131
 		return $all_update_ids;
1138 1132
 	}
@@ -1147,10 +1141,9 @@  discard block
 block discarded – undo
1147 1141
 	 *
1148 1142
 	 * @return float|int
1149 1143
 	 */
1150
-	public function get_offset( $process_item_count ) {
1151
-		return ( 1 === $this->step ) ?
1152
-			0 :
1153
-			( $this->step - 1 ) * $process_item_count;
1144
+	public function get_offset($process_item_count) {
1145
+		return (1 === $this->step) ?
1146
+			0 : ($this->step - 1) * $process_item_count;
1154 1147
 	}
1155 1148
 }
1156 1149
 
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +480 added lines, -480 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
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
 }
357 357
 
358
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
358
+add_action('give_register_updates', 'give_show_upgrade_notices');
359 359
 
360 360
 /**
361 361
  * Triggers all upgrade functions
@@ -367,29 +367,29 @@  discard block
 block discarded – undo
367 367
  */
368 368
 function give_trigger_upgrades() {
369 369
 
370
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
371
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
370
+	if ( ! current_user_can('manage_give_settings')) {
371
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
372 372
 			'response' => 403,
373
-		) );
373
+		));
374 374
 	}
375 375
 
376
-	$give_version = get_option( 'give_version' );
376
+	$give_version = get_option('give_version');
377 377
 
378
-	if ( ! $give_version ) {
378
+	if ( ! $give_version) {
379 379
 		// 1.0 is the first version to use this option so we must add it.
380 380
 		$give_version = '1.0';
381
-		add_option( 'give_version', $give_version );
381
+		add_option('give_version', $give_version);
382 382
 	}
383 383
 
384
-	update_option( 'give_version', GIVE_VERSION );
385
-	delete_option( 'give_doing_upgrade' );
384
+	update_option('give_version', GIVE_VERSION);
385
+	delete_option('give_doing_upgrade');
386 386
 
387
-	if ( DOING_AJAX ) {
388
-		die( 'complete' );
387
+	if (DOING_AJAX) {
388
+		die('complete');
389 389
 	} // End if().
390 390
 }
391 391
 
392
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
392
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
393 393
 
394 394
 
395 395
 /**
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
 
408 408
 	// UPDATE DB METAKEYS.
409 409
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
410
-	$query = $wpdb->query( $sql );
410
+	$query = $wpdb->query($sql);
411 411
 
412 412
 	$give_updates->percentage = 100;
413
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
413
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
414 414
 }
415 415
 
416 416
 
@@ -434,24 +434,24 @@  discard block
 block discarded – undo
434 434
 	$where  .= "AND ( p.post_status = 'abandoned' )";
435 435
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
436 436
 
437
-	$sql            = $select . $join . $where;
438
-	$found_payments = $wpdb->get_col( $sql );
437
+	$sql            = $select.$join.$where;
438
+	$found_payments = $wpdb->get_col($sql);
439 439
 
440
-	foreach ( $found_payments as $payment ) {
440
+	foreach ($found_payments as $payment) {
441 441
 
442 442
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
443
-		$modified_time = get_post_modified_time( 'U', false, $payment );
443
+		$modified_time = get_post_modified_time('U', false, $payment);
444 444
 
445 445
 		// 1450124863 =  12/10/2015 20:42:25.
446
-		if ( $modified_time >= 1450124863 ) {
446
+		if ($modified_time >= 1450124863) {
447 447
 
448
-			give_update_payment_status( $payment, 'pending' );
448
+			give_update_payment_status($payment, 'pending');
449 449
 
450 450
 		}
451 451
 	}
452 452
 
453 453
 	$give_updates->percentage = 100;
454
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
454
+	give_set_upgrade_complete('upgrade_give_offline_status');
455 455
 }
456 456
 
457 457
 
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
  */
465 465
 function give_v152_cleanup_users() {
466 466
 
467
-	$give_version = get_option( 'give_version' );
467
+	$give_version = get_option('give_version');
468 468
 
469
-	if ( ! $give_version ) {
469
+	if ( ! $give_version) {
470 470
 		// 1.0 is the first version to use this option so we must add it.
471 471
 		$give_version = '1.0';
472 472
 	}
473 473
 
474
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
474
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
475 475
 
476 476
 	// v1.5.2 Upgrades
477
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
477
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
478 478
 
479 479
 		// Delete all caps with "ss".
480 480
 		// Also delete all unused "campaign" roles.
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 		);
522 522
 
523 523
 		global $wp_roles;
524
-		foreach ( $delete_caps as $cap ) {
525
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
526
-				$wp_roles->remove_cap( $role, $cap );
524
+		foreach ($delete_caps as $cap) {
525
+			foreach (array_keys($wp_roles->roles) as $role) {
526
+				$wp_roles->remove_cap($role, $cap);
527 527
 			}
528 528
 		}
529 529
 
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
 		$roles->add_caps();
534 534
 
535 535
 		// The Update Ran.
536
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
537
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
538
-		delete_option( 'give_doing_upgrade' );
536
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
537
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
538
+		delete_option('give_doing_upgrade');
539 539
 
540 540
 	}// End if().
541 541
 
542 542
 }
543 543
 
544
-add_action( 'admin_init', 'give_v152_cleanup_users' );
544
+add_action('admin_init', 'give_v152_cleanup_users');
545 545
 
546 546
 /**
547 547
  * 1.6 Upgrade routine to create the customer meta table.
@@ -584,53 +584,53 @@  discard block
 block discarded – undo
584 584
 
585 585
 	// Get addons license key.
586 586
 	$addons = array();
587
-	foreach ( $give_options as $key => $value ) {
588
-		if ( false !== strpos( $key, '_license_key' ) ) {
589
-			$addons[ $key ] = $value;
587
+	foreach ($give_options as $key => $value) {
588
+		if (false !== strpos($key, '_license_key')) {
589
+			$addons[$key] = $value;
590 590
 		}
591 591
 	}
592 592
 
593 593
 	// Bailout: We do not have any addon license data to upgrade.
594
-	if ( empty( $addons ) ) {
594
+	if (empty($addons)) {
595 595
 		return false;
596 596
 	}
597 597
 
598
-	foreach ( $addons as $key => $addon_license ) {
598
+	foreach ($addons as $key => $addon_license) {
599 599
 
600 600
 		// Get addon shortname.
601
-		$shortname = str_replace( '_license_key', '', $key );
601
+		$shortname = str_replace('_license_key', '', $key);
602 602
 
603 603
 		// Addon license option name.
604
-		$addon_license_option_name = $shortname . '_license_active';
604
+		$addon_license_option_name = $shortname.'_license_active';
605 605
 
606 606
 		// bailout if license is empty.
607
-		if ( empty( $addon_license ) ) {
608
-			delete_option( $addon_license_option_name );
607
+		if (empty($addon_license)) {
608
+			delete_option($addon_license_option_name);
609 609
 			continue;
610 610
 		}
611 611
 
612 612
 		// Get addon name.
613 613
 		$addon_name       = array();
614
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
615
-		foreach ( $addon_name_parts as $name_part ) {
614
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
615
+		foreach ($addon_name_parts as $name_part) {
616 616
 
617 617
 			// Fix addon name
618
-			switch ( $name_part ) {
618
+			switch ($name_part) {
619 619
 				case 'authorizenet' :
620 620
 					$name_part = 'authorize.net';
621 621
 					break;
622 622
 			}
623 623
 
624
-			$addon_name[] = ucfirst( $name_part );
624
+			$addon_name[] = ucfirst($name_part);
625 625
 		}
626 626
 
627
-		$addon_name = implode( ' ', $addon_name );
627
+		$addon_name = implode(' ', $addon_name);
628 628
 
629 629
 		// Data to send to the API.
630 630
 		$api_params = array(
631 631
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
632 632
 			'license'    => $addon_license,
633
-			'item_name'  => urlencode( $addon_name ),
633
+			'item_name'  => urlencode($addon_name),
634 634
 			'url'        => home_url(),
635 635
 		);
636 636
 
@@ -645,17 +645,17 @@  discard block
 block discarded – undo
645 645
 		);
646 646
 
647 647
 		// Make sure there are no errors.
648
-		if ( is_wp_error( $response ) ) {
649
-			delete_option( $addon_license_option_name );
648
+		if (is_wp_error($response)) {
649
+			delete_option($addon_license_option_name);
650 650
 			continue;
651 651
 		}
652 652
 
653 653
 		// Tell WordPress to look for updates.
654
-		set_site_transient( 'update_plugins', null );
654
+		set_site_transient('update_plugins', null);
655 655
 
656 656
 		// Decode license data.
657
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
658
-		update_option( $addon_license_option_name, $license_data );
657
+		$license_data = json_decode(wp_remote_retrieve_body($response));
658
+		update_option($addon_license_option_name, $license_data);
659 659
 	}// End foreach().
660 660
 }
661 661
 
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 	);
686 686
 
687 687
 	global $wp_roles;
688
-	foreach ( $delete_caps as $cap ) {
689
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
690
-			$wp_roles->remove_cap( $role, $cap );
688
+	foreach ($delete_caps as $cap) {
689
+		foreach (array_keys($wp_roles->roles) as $role) {
690
+			$wp_roles->remove_cap($role, $cap);
691 691
 		}
692 692
 	}
693 693
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 function give_v18_upgrades_core_setting() {
722 722
 	// Core settings which changes from checkbox to radio.
723 723
 	$core_setting_names = array_merge(
724
-		array_keys( give_v18_renamed_core_settings() ),
724
+		array_keys(give_v18_renamed_core_settings()),
725 725
 		array(
726 726
 			'uninstall_on_delete',
727 727
 			'scripts_footer',
@@ -733,48 +733,48 @@  discard block
 block discarded – undo
733 733
 	);
734 734
 
735 735
 	// Bailout: If not any setting define.
736
-	if ( $give_settings = get_option( 'give_settings' ) ) {
736
+	if ($give_settings = get_option('give_settings')) {
737 737
 
738 738
 		$setting_changed = false;
739 739
 
740 740
 		// Loop: check each setting field.
741
-		foreach ( $core_setting_names as $setting_name ) {
741
+		foreach ($core_setting_names as $setting_name) {
742 742
 			// New setting name.
743
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
743
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
744 744
 
745 745
 			// Continue: If setting already set.
746 746
 			if (
747
-				array_key_exists( $new_setting_name, $give_settings )
748
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
747
+				array_key_exists($new_setting_name, $give_settings)
748
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
749 749
 			) {
750 750
 				continue;
751 751
 			}
752 752
 
753 753
 			// Set checkbox value to radio value.
754
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
754
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
755 755
 
756 756
 			// @see https://github.com/WordImpress/Give/issues/1063.
757
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
757
+			if (false !== strpos($setting_name, 'disable_')) {
758 758
 
759
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
760
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
759
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
760
+			} elseif (false !== strpos($setting_name, 'enable_')) {
761 761
 
762
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
762
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
763 763
 			}
764 764
 
765 765
 			// Tell bot to update core setting to db.
766
-			if ( ! $setting_changed ) {
766
+			if ( ! $setting_changed) {
767 767
 				$setting_changed = true;
768 768
 			}
769 769
 		}
770 770
 
771 771
 		// Update setting only if they changed.
772
-		if ( $setting_changed ) {
773
-			update_option( 'give_settings', $give_settings );
772
+		if ($setting_changed) {
773
+			update_option('give_settings', $give_settings);
774 774
 		}
775 775
 	}// End if().
776 776
 
777
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
777
+	give_set_upgrade_complete('v18_upgrades_core_setting');
778 778
 }
779 779
 
780 780
 /**
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	$give_updates = Give_Updates::get_instance();
789 789
 
790 790
 	// form query
791
-	$forms = new WP_Query( array(
791
+	$forms = new WP_Query(array(
792 792
 			'paged'          => $give_updates->step,
793 793
 			'status'         => 'any',
794 794
 			'order'          => 'ASC',
@@ -797,41 +797,41 @@  discard block
 block discarded – undo
797 797
 		)
798 798
 	);
799 799
 
800
-	if ( $forms->have_posts() ) {
801
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
800
+	if ($forms->have_posts()) {
801
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
802 802
 
803
-		while ( $forms->have_posts() ) {
803
+		while ($forms->have_posts()) {
804 804
 			$forms->the_post();
805 805
 
806 806
 			// Form content.
807 807
 			// Note in version 1.8 display content setting split into display content and content placement setting.
808 808
 			// You can delete _give_content_option in future.
809
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
810
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
811
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
812
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
809
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
810
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
811
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
812
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
813 813
 
814
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
815
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
814
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
815
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
816 816
 			}
817 817
 
818 818
 			// "Disable" Guest Donation. Checkbox.
819 819
 			// See: https://github.com/WordImpress/Give/issues/1470.
820
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
821
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
822
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
820
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
821
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
822
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
823 823
 
824 824
 			// Offline Donations.
825 825
 			// See: https://github.com/WordImpress/Give/issues/1579.
826
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
827
-			if ( 'no' === $offline_donation ) {
826
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
827
+			if ('no' === $offline_donation) {
828 828
 				$offline_donation_newval = 'global';
829
-			} elseif ( 'yes' === $offline_donation ) {
829
+			} elseif ('yes' === $offline_donation) {
830 830
 				$offline_donation_newval = 'enabled';
831 831
 			} else {
832 832
 				$offline_donation_newval = 'disabled';
833 833
 			}
834
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
834
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
835 835
 
836 836
 			// Convert yes/no setting field to enabled/disabled.
837 837
 			$form_radio_settings = array(
@@ -851,15 +851,15 @@  discard block
 block discarded – undo
851 851
 				'_give_offline_donation_enable_billing_fields_single',
852 852
 			);
853 853
 
854
-			foreach ( $form_radio_settings as $meta_key ) {
854
+			foreach ($form_radio_settings as $meta_key) {
855 855
 				// Get value.
856
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
856
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
857 857
 
858 858
 				// Convert meta value only if it is in yes/no/none.
859
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
859
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
860 860
 
861
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
862
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
861
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
862
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
863 863
 				}
864 864
 			}
865 865
 		}// End while().
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 
869 869
 	} else {
870 870
 		// No more forms found, finish up.
871
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
871
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
872 872
 	}
873 873
 }
874 874
 
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 				'%_transient_give_stats_%',
936 936
 				'give_cache%',
937 937
 				'%_transient_give_add_ons_feed%',
938
-				'%_transient__give_ajax_works' .
938
+				'%_transient__give_ajax_works'.
939 939
 				'%_transient_give_total_api_keys%',
940 940
 				'%_transient_give_i18n_give_promo_hide%',
941 941
 				'%_transient_give_contributors%',
@@ -962,24 +962,24 @@  discard block
 block discarded – undo
962 962
 		ARRAY_A
963 963
 	);
964 964
 
965
-	if ( ! empty( $user_apikey_options ) ) {
966
-		foreach ( $user_apikey_options as $user ) {
967
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
968
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
969
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
965
+	if ( ! empty($user_apikey_options)) {
966
+		foreach ($user_apikey_options as $user) {
967
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
968
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
969
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
970 970
 		}
971 971
 	}
972 972
 
973
-	if ( ! empty( $cached_options ) ) {
974
-		foreach ( $cached_options as $option ) {
975
-			switch ( true ) {
976
-				case ( false !== strpos( $option, 'transient' ) ):
977
-					$option = str_replace( '_transient_', '', $option );
978
-					delete_transient( $option );
973
+	if ( ! empty($cached_options)) {
974
+		foreach ($cached_options as $option) {
975
+			switch (true) {
976
+				case (false !== strpos($option, 'transient')):
977
+					$option = str_replace('_transient_', '', $option);
978
+					delete_transient($option);
979 979
 					break;
980 980
 
981 981
 				default:
982
-					delete_option( $option );
982
+					delete_option($option);
983 983
 			}
984 984
 		}
985 985
 	}
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 	global $wp_roles;
998 998
 
999 999
 	// Get the role object.
1000
-	$give_worker = get_role( 'give_worker' );
1000
+	$give_worker = get_role('give_worker');
1001 1001
 
1002 1002
 	// A list of capabilities to add for give workers.
1003 1003
 	$caps_to_add = array(
@@ -1005,9 +1005,9 @@  discard block
 block discarded – undo
1005 1005
 		'edit_pages',
1006 1006
 	);
1007 1007
 
1008
-	foreach ( $caps_to_add as $cap ) {
1008
+	foreach ($caps_to_add as $cap) {
1009 1009
 		// Add the capability.
1010
-		$give_worker->add_cap( $cap );
1010
+		$give_worker->add_cap($cap);
1011 1011
 	}
1012 1012
 
1013 1013
 }
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	$give_updates = Give_Updates::get_instance();
1025 1025
 
1026 1026
 	// form query.
1027
-	$donation_forms = new WP_Query( array(
1027
+	$donation_forms = new WP_Query(array(
1028 1028
 			'paged'          => $give_updates->step,
1029 1029
 			'status'         => 'any',
1030 1030
 			'order'          => 'ASC',
@@ -1033,10 +1033,10 @@  discard block
 block discarded – undo
1033 1033
 		)
1034 1034
 	);
1035 1035
 
1036
-	if ( $donation_forms->have_posts() ) {
1037
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1036
+	if ($donation_forms->have_posts()) {
1037
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1038 1038
 
1039
-		while ( $donation_forms->have_posts() ) {
1039
+		while ($donation_forms->have_posts()) {
1040 1040
 			$donation_forms->the_post();
1041 1041
 			$form_id = get_the_ID();
1042 1042
 
@@ -1044,41 +1044,41 @@  discard block
 block discarded – undo
1044 1044
 			update_post_meta(
1045 1045
 				$form_id,
1046 1046
 				'_give_set_price',
1047
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1047
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1048 1048
 			);
1049 1049
 
1050 1050
 			// Remove formatting from _give_custom_amount_minimum.
1051 1051
 			update_post_meta(
1052 1052
 				$form_id,
1053 1053
 				'_give_custom_amount_minimum',
1054
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1054
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1055 1055
 			);
1056 1056
 
1057 1057
 			// Bailout.
1058
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1058
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1059 1059
 				continue;
1060 1060
 			}
1061 1061
 
1062
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1062
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1063 1063
 
1064
-			if ( ! empty( $donation_levels ) ) {
1064
+			if ( ! empty($donation_levels)) {
1065 1065
 
1066
-				foreach ( $donation_levels as $index => $donation_level ) {
1067
-					if ( isset( $donation_level['_give_amount'] ) ) {
1068
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1066
+				foreach ($donation_levels as $index => $donation_level) {
1067
+					if (isset($donation_level['_give_amount'])) {
1068
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1069 1069
 					}
1070 1070
 				}
1071 1071
 
1072
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1072
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1073 1073
 
1074
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1074
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1075 1075
 
1076
-				$min_amount = min( $donation_levels_amounts );
1077
-				$max_amount = max( $donation_levels_amounts );
1076
+				$min_amount = min($donation_levels_amounts);
1077
+				$max_amount = max($donation_levels_amounts);
1078 1078
 
1079 1079
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1080
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1081
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1080
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1081
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1082 1082
 			}
1083 1083
 
1084 1084
 		}
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 		wp_reset_postdata();
1088 1088
 	} else {
1089 1089
 		// The Update Ran.
1090
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1090
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1091 1091
 	}
1092 1092
 
1093 1093
 }
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
  */
1138 1138
 function give_v20_upgrades() {
1139 1139
 	// Update cache setting.
1140
-	give_update_option( 'cache', 'enabled' );
1140
+	give_update_option('cache', 'enabled');
1141 1141
 
1142 1142
 	// Upgrade email settings.
1143 1143
 	give_v20_upgrades_email_setting();
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 	$all_setting = give_get_settings();
1157 1157
 
1158 1158
 	// Bailout on fresh install.
1159
-	if ( empty( $all_setting ) ) {
1159
+	if (empty($all_setting)) {
1160 1160
 		return;
1161 1161
 	}
1162 1162
 
@@ -1175,19 +1175,19 @@  discard block
 block discarded – undo
1175 1175
 		'admin_notices'                 => 'new-donation_notification',
1176 1176
 	);
1177 1177
 
1178
-	foreach ( $settings as $old_setting => $new_setting ) {
1178
+	foreach ($settings as $old_setting => $new_setting) {
1179 1179
 		// Do not update already modified
1180
-		if ( ! is_array( $new_setting ) ) {
1181
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1180
+		if ( ! is_array($new_setting)) {
1181
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1182 1182
 				continue;
1183 1183
 			}
1184 1184
 		}
1185 1185
 
1186
-		switch ( $old_setting ) {
1186
+		switch ($old_setting) {
1187 1187
 			case 'admin_notices':
1188
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1188
+				$notification_status = give_get_option($old_setting, 'enabled');
1189 1189
 
1190
-				give_update_option( $new_setting, $notification_status );
1190
+				give_update_option($new_setting, $notification_status);
1191 1191
 
1192 1192
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1193 1193
 				// give_delete_option( $old_setting );
@@ -1198,19 +1198,19 @@  discard block
 block discarded – undo
1198 1198
 			case 'admin_notice_emails':
1199 1199
 				$recipients = give_get_admin_notice_emails();
1200 1200
 
1201
-				foreach ( $new_setting as $setting ) {
1201
+				foreach ($new_setting as $setting) {
1202 1202
 					// bailout if setting already exist.
1203
-					if ( array_key_exists( $setting, $all_setting ) ) {
1203
+					if (array_key_exists($setting, $all_setting)) {
1204 1204
 						continue;
1205 1205
 					}
1206 1206
 
1207
-					give_update_option( $setting, $recipients );
1207
+					give_update_option($setting, $recipients);
1208 1208
 				}
1209 1209
 				break;
1210 1210
 
1211 1211
 			default:
1212
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1213
-				give_delete_option( $old_setting );
1212
+				give_update_option($new_setting, give_get_option($old_setting));
1213
+				give_delete_option($old_setting);
1214 1214
 		}
1215 1215
 	}
1216 1216
 }
@@ -1227,22 +1227,22 @@  discard block
 block discarded – undo
1227 1227
 	$give_settings        = give_get_settings();
1228 1228
 	$give_setting_updated = false;
1229 1229
 
1230
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1230
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1231 1231
 		$give_settings['number_decimals']   = 0;
1232 1232
 		$give_settings['decimal_separator'] = '';
1233 1233
 		$give_setting_updated               = true;
1234 1234
 
1235
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1235
+	} elseif (empty($give_settings['decimal_separator'])) {
1236 1236
 		$give_settings['number_decimals'] = 0;
1237 1237
 		$give_setting_updated             = true;
1238 1238
 
1239
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1239
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1240 1240
 		$give_settings['number_decimals'] = 5;
1241 1241
 		$give_setting_updated             = true;
1242 1242
 	}
1243 1243
 
1244
-	if ( $give_setting_updated ) {
1245
-		update_option( 'give_settings', $give_settings );
1244
+	if ($give_setting_updated) {
1245
+		update_option('give_settings', $give_settings);
1246 1246
 	}
1247 1247
 }
1248 1248
 
@@ -1261,69 +1261,69 @@  discard block
 block discarded – undo
1261 1261
 	$give_updates = Give_Updates::get_instance();
1262 1262
 
1263 1263
 	// form query.
1264
-	$donation_forms = new WP_Query( array(
1264
+	$donation_forms = new WP_Query(array(
1265 1265
 			'paged'          => $give_updates->step,
1266 1266
 			'status'         => 'any',
1267 1267
 			'order'          => 'ASC',
1268
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1268
+			'post_type'      => array('give_forms', 'give_payment'),
1269 1269
 			'posts_per_page' => 20,
1270 1270
 		)
1271 1271
 	);
1272
-	if ( $donation_forms->have_posts() ) {
1273
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1272
+	if ($donation_forms->have_posts()) {
1273
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1274 1274
 
1275
-		while ( $donation_forms->have_posts() ) {
1275
+		while ($donation_forms->have_posts()) {
1276 1276
 			$donation_forms->the_post();
1277 1277
 			global $post;
1278 1278
 
1279
-			$meta = get_post_meta( $post->ID );
1279
+			$meta = get_post_meta($post->ID);
1280 1280
 
1281
-			switch ( $post->post_type ) {
1281
+			switch ($post->post_type) {
1282 1282
 				case 'give_forms':
1283 1283
 					// _give_set_price.
1284
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1285
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1284
+					if ( ! empty($meta['_give_set_price'][0])) {
1285
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1286 1286
 					}
1287 1287
 
1288 1288
 					// _give_custom_amount_minimum.
1289
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1290
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1289
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1290
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1291 1291
 					}
1292 1292
 
1293 1293
 					// _give_levels_minimum_amount.
1294
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1295
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1294
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1295
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1296 1296
 					}
1297 1297
 
1298 1298
 					// _give_levels_maximum_amount.
1299
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1300
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1299
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1300
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1301 1301
 					}
1302 1302
 
1303 1303
 					// _give_set_goal.
1304
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1305
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1304
+					if ( ! empty($meta['_give_set_goal'][0])) {
1305
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1306 1306
 					}
1307 1307
 
1308 1308
 					// _give_form_earnings.
1309
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1310
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1309
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1310
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1311 1311
 					}
1312 1312
 
1313 1313
 					// _give_custom_amount_minimum.
1314
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1315
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1314
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1315
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1316 1316
 
1317
-						foreach ( $donation_levels as $index => $level ) {
1318
-							if ( empty( $level['_give_amount'] ) ) {
1317
+						foreach ($donation_levels as $index => $level) {
1318
+							if (empty($level['_give_amount'])) {
1319 1319
 								continue;
1320 1320
 							}
1321 1321
 
1322
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1322
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1323 1323
 						}
1324 1324
 
1325 1325
 						$meta['_give_donation_levels'] = $donation_levels;
1326
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1326
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1327 1327
 					}
1328 1328
 
1329 1329
 
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
 
1332 1332
 				case 'give_payment':
1333 1333
 					// _give_payment_total.
1334
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1335
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1334
+					if ( ! empty($meta['_give_payment_total'][0])) {
1335
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1336 1336
 					}
1337 1337
 
1338 1338
 					break;
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		wp_reset_postdata();
1344 1344
 	} else {
1345 1345
 		// The Update Ran.
1346
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1346
+		give_set_upgrade_complete('v1812_update_amount_values');
1347 1347
 	}
1348 1348
 }
1349 1349
 
@@ -1362,22 +1362,22 @@  discard block
 block discarded – undo
1362 1362
 	$give_updates = Give_Updates::get_instance();
1363 1363
 
1364 1364
 	// form query.
1365
-	$donors = Give()->donors->get_donors( array(
1365
+	$donors = Give()->donors->get_donors(array(
1366 1366
 			'number' => 20,
1367
-			'offset' => $give_updates->get_offset( 20 ),
1367
+			'offset' => $give_updates->get_offset(20),
1368 1368
 		)
1369 1369
 	);
1370 1370
 
1371
-	if ( ! empty( $donors ) ) {
1372
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1371
+	if ( ! empty($donors)) {
1372
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1373 1373
 
1374 1374
 		/* @var Object $donor */
1375
-		foreach ( $donors as $donor ) {
1376
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1375
+		foreach ($donors as $donor) {
1376
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1377 1377
 		}
1378 1378
 	} else {
1379 1379
 		// The Update Ran.
1380
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1380
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1381 1381
 	}
1382 1382
 }
1383 1383
 
@@ -1391,25 +1391,25 @@  discard block
 block discarded – undo
1391 1391
 	$give_updates = Give_Updates::get_instance();
1392 1392
 
1393 1393
 	// Fetch all the existing donors.
1394
-	$donors = Give()->donors->get_donors( array(
1394
+	$donors = Give()->donors->get_donors(array(
1395 1395
 			'number' => 20,
1396
-			'offset' => $give_updates->get_offset( 20 ),
1396
+			'offset' => $give_updates->get_offset(20),
1397 1397
 		)
1398 1398
 	);
1399 1399
 
1400
-	if ( ! empty( $donors ) ) {
1401
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1400
+	if ( ! empty($donors)) {
1401
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1402 1402
 
1403 1403
 		/* @var Object $donor */
1404
-		foreach ( $donors as $donor ) {
1404
+		foreach ($donors as $donor) {
1405 1405
 			$user_id = $donor->user_id;
1406 1406
 
1407 1407
 			// Proceed, if donor is attached with user.
1408
-			if ( $user_id ) {
1409
-				$user = get_userdata( $user_id );
1408
+			if ($user_id) {
1409
+				$user = get_userdata($user_id);
1410 1410
 
1411 1411
 				// Update user role, if user has subscriber role.
1412
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1412
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1413 1413
 					wp_update_user(
1414 1414
 						array(
1415 1415
 							'ID'   => $user_id,
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 		}
1422 1422
 	} else {
1423 1423
 		// The Update Ran.
1424
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1424
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1425 1425
 	}
1426 1426
 }
1427 1427
 
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
  */
1434 1434
 function give_v1813_upgrades() {
1435 1435
 	// Update admin setting.
1436
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1436
+	give_update_option('donor_default_user_role', 'give_donor');
1437 1437
 
1438 1438
 	// Update Give roles.
1439 1439
 	$roles = new Give_Roles();
@@ -1451,33 +1451,33 @@  discard block
 block discarded – undo
1451 1451
 	$give_updates = Give_Updates::get_instance();
1452 1452
 
1453 1453
 	// form query.
1454
-	$payments = new WP_Query( array(
1454
+	$payments = new WP_Query(array(
1455 1455
 			'paged'          => $give_updates->step,
1456 1456
 			'status'         => 'any',
1457 1457
 			'order'          => 'ASC',
1458
-			'post_type'      => array( 'give_payment' ),
1458
+			'post_type'      => array('give_payment'),
1459 1459
 			'posts_per_page' => 100,
1460 1460
 		)
1461 1461
 	);
1462 1462
 
1463
-	if ( $payments->have_posts() ) {
1464
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1463
+	if ($payments->have_posts()) {
1464
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1465 1465
 
1466
-		while ( $payments->have_posts() ) {
1466
+		while ($payments->have_posts()) {
1467 1467
 			$payments->the_post();
1468 1468
 
1469
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1469
+			$payment_meta = give_get_payment_meta(get_the_ID());
1470 1470
 
1471
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1471
+			if ('RIAL' === $payment_meta['currency']) {
1472 1472
 				$payment_meta['currency'] = 'IRR';
1473
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1473
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1474 1474
 			}
1475 1475
 
1476 1476
 		}
1477 1477
 
1478 1478
 	} else {
1479 1479
 		// The Update Ran.
1480
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1480
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1481 1481
 	}
1482 1482
 }
1483 1483
 
@@ -1490,9 +1490,9 @@  discard block
 block discarded – undo
1490 1490
 function give_v1817_upgrades() {
1491 1491
 	$give_settings = give_get_settings();
1492 1492
 
1493
-	if ( 'RIAL' === $give_settings['currency'] ) {
1493
+	if ('RIAL' === $give_settings['currency']) {
1494 1494
 		$give_settings['currency'] = 'IRR';
1495
-		update_option( 'give_settings', $give_settings );
1495
+		update_option('give_settings', $give_settings);
1496 1496
 	}
1497 1497
 }
1498 1498
 
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
 
1506 1506
 	global $wp_roles;
1507 1507
 
1508
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1508
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1509 1509
 		return;
1510 1510
 	}
1511 1511
 
@@ -1529,15 +1529,15 @@  discard block
 block discarded – undo
1529 1529
 		),
1530 1530
 	);
1531 1531
 
1532
-	foreach ( $add_caps as $role => $caps ) {
1533
-		foreach ( $caps as $cap ) {
1534
-			$wp_roles->add_cap( $role, $cap );
1532
+	foreach ($add_caps as $role => $caps) {
1533
+		foreach ($caps as $cap) {
1534
+			$wp_roles->add_cap($role, $cap);
1535 1535
 		}
1536 1536
 	}
1537 1537
 
1538
-	foreach ( $remove_caps as $role => $caps ) {
1539
-		foreach ( $caps as $cap ) {
1540
-			$wp_roles->remove_cap( $role, $cap );
1538
+	foreach ($remove_caps as $role => $caps) {
1539
+		foreach ($caps as $cap) {
1540
+			$wp_roles->remove_cap($role, $cap);
1541 1541
 		}
1542 1542
 	}
1543 1543
 
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 	$roles->add_roles();
1562 1562
 	$roles->add_caps();
1563 1563
 
1564
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1564
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1565 1565
 }
1566 1566
 
1567 1567
 /**
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 function give_v1818_upgrades() {
1573 1573
 
1574 1574
 	// Remove email_access_installed from give_settings.
1575
-	give_delete_option( 'email_access_installed' );
1575
+	give_delete_option('email_access_installed');
1576 1576
 }
1577 1577
 
1578 1578
 /**
@@ -1585,23 +1585,23 @@  discard block
 block discarded – undo
1585 1585
 	/* @var Give_Updates $give_updates */
1586 1586
 	$give_updates = Give_Updates::get_instance();
1587 1587
 
1588
-	$donations = new WP_Query( array(
1588
+	$donations = new WP_Query(array(
1589 1589
 			'paged'          => $give_updates->step,
1590 1590
 			'status'         => 'any',
1591 1591
 			'order'          => 'ASC',
1592
-			'post_type'      => array( 'give_payment' ),
1592
+			'post_type'      => array('give_payment'),
1593 1593
 			'posts_per_page' => 100,
1594 1594
 		)
1595 1595
 	);
1596 1596
 
1597
-	if ( $donations->have_posts() ) {
1598
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1597
+	if ($donations->have_posts()) {
1598
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1599 1599
 
1600
-		while ( $donations->have_posts() ) {
1600
+		while ($donations->have_posts()) {
1601 1601
 			$donations->the_post();
1602 1602
 
1603
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1604
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1603
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1604
+			$donation_meta = give_get_payment_meta(get_the_ID());
1605 1605
 
1606 1606
 			// Update Donation meta with price_id set as custom, only if it is:
1607 1607
 			// 1. Donation Type = Set Donation.
@@ -1610,19 +1610,19 @@  discard block
 block discarded – undo
1610 1610
 			if (
1611 1611
 				$form->ID &&
1612 1612
 				$form->is_set_type_donation_form() &&
1613
-				( 'custom' !== $donation_meta['price_id'] ) &&
1614
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1613
+				('custom' !== $donation_meta['price_id']) &&
1614
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1615 1615
 			) {
1616 1616
 				$donation_meta['price_id'] = 'custom';
1617
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1618
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1617
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1618
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1619 1619
 			}
1620 1620
 		}
1621 1621
 
1622 1622
 		wp_reset_postdata();
1623 1623
 	} else {
1624 1624
 		// Update Ran Successfully.
1625
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1625
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1626 1626
 	}
1627 1627
 }
1628 1628
 
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 
1641 1641
 	global $wp_roles;
1642 1642
 
1643
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1643
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1644 1644
 		return;
1645 1645
 	}
1646 1646
 
@@ -1658,9 +1658,9 @@  discard block
 block discarded – undo
1658 1658
 		),
1659 1659
 	);
1660 1660
 
1661
-	foreach ( $remove_caps as $role => $caps ) {
1662
-		foreach ( $caps as $cap ) {
1663
-			$wp_roles->remove_cap( $role, $cap );
1661
+	foreach ($remove_caps as $role => $caps) {
1662
+		foreach ($caps as $cap) {
1663
+			$wp_roles->remove_cap($role, $cap);
1664 1664
 		}
1665 1665
 	}
1666 1666
 
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 	$roles->add_roles();
1672 1672
 	$roles->add_caps();
1673 1673
 
1674
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1674
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1675 1675
 }
1676 1676
 
1677 1677
 /**
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 	$give_updates = Give_Updates::get_instance();
1686 1686
 
1687 1687
 	// form query
1688
-	$forms = new WP_Query( array(
1688
+	$forms = new WP_Query(array(
1689 1689
 			'paged'          => $give_updates->step,
1690 1690
 			'status'         => 'any',
1691 1691
 			'order'          => 'ASC',
@@ -1694,22 +1694,22 @@  discard block
 block discarded – undo
1694 1694
 		)
1695 1695
 	);
1696 1696
 
1697
-	if ( $forms->have_posts() ) {
1698
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1697
+	if ($forms->have_posts()) {
1698
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1699 1699
 
1700
-		while ( $forms->have_posts() ) {
1700
+		while ($forms->have_posts()) {
1701 1701
 			$forms->the_post();
1702 1702
 			global $post;
1703 1703
 
1704 1704
 			// Update offline instruction email notification status.
1705
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1706
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1705
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1706
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1707 1707
 				'enabled',
1708 1708
 				'global',
1709
-			) )
1709
+			))
1710 1710
 				? $offline_instruction_notification_status
1711 1711
 				: 'global';
1712
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1712
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1713 1713
 
1714 1714
 			// Update offline instruction email message.
1715 1715
 			update_post_meta(
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 		wp_reset_postdata();
1742 1742
 	} else {
1743 1743
 		// No more forms found, finish up.
1744
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1744
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1745 1745
 	}
1746 1746
 }
1747 1747
 
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 	$give_updates = Give_Updates::get_instance();
1759 1759
 
1760 1760
 	// form query
1761
-	$forms = new WP_Query( array(
1761
+	$forms = new WP_Query(array(
1762 1762
 			'paged'          => $give_updates->step,
1763 1763
 			'status'         => 'any',
1764 1764
 			'order'          => 'ASC',
@@ -1767,19 +1767,19 @@  discard block
 block discarded – undo
1767 1767
 		)
1768 1768
 	);
1769 1769
 
1770
-	if ( $forms->have_posts() ) {
1771
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1770
+	if ($forms->have_posts()) {
1771
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1772 1772
 
1773
-		while ( $forms->have_posts() ) {
1773
+		while ($forms->have_posts()) {
1774 1774
 			$forms->the_post();
1775 1775
 			global $post;
1776 1776
 
1777 1777
 			// Split _give_payment_meta meta.
1778 1778
 			// @todo Remove _give_payment_meta after releases 2.0
1779
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1779
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1780 1780
 
1781
-			if ( ! empty( $payment_meta ) ) {
1782
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1781
+			if ( ! empty($payment_meta)) {
1782
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1783 1783
 			}
1784 1784
 
1785 1785
 			$deprecated_meta_keys = array(
@@ -1788,9 +1788,9 @@  discard block
 block discarded – undo
1788 1788
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1789 1789
 			);
1790 1790
 
1791
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1791
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1792 1792
 				// Do not add new meta key if already exist.
1793
-				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 ) ) ) {
1793
+				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))) {
1794 1794
 					continue;
1795 1795
 				}
1796 1796
 
@@ -1799,25 +1799,25 @@  discard block
 block discarded – undo
1799 1799
 					array(
1800 1800
 						'post_id'    => $post->ID,
1801 1801
 						'meta_key'   => $new_meta_key,
1802
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1802
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1803 1803
 					)
1804 1804
 				);
1805 1805
 			}
1806 1806
 
1807 1807
 			// Bailout
1808
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1808
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1809 1809
 				/* @var Give_Donor $donor */
1810
-				$donor = new Give_Donor( $donor_id );
1810
+				$donor = new Give_Donor($donor_id);
1811 1811
 
1812
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1813
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1814
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1815
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1816
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1817
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1812
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1813
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1814
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1815
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1816
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1817
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1818 1818
 
1819 1819
 				// Save address.
1820
-				$donor->add_address( 'billing[]', $address );
1820
+				$donor->add_address('billing[]', $address);
1821 1821
 			}
1822 1822
 
1823 1823
 		}// End while().
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1829 1829
 
1830 1830
 		// No more forms found, finish up.
1831
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1831
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1832 1832
 	}
1833 1833
 }
1834 1834
 
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 	$give_updates = Give_Updates::get_instance();
1845 1845
 
1846 1846
 	// form query
1847
-	$forms = new WP_Query( array(
1847
+	$forms = new WP_Query(array(
1848 1848
 			'paged'          => $give_updates->step,
1849 1849
 			'order'          => 'DESC',
1850 1850
 			'post_type'      => 'give_log',
@@ -1853,20 +1853,20 @@  discard block
 block discarded – undo
1853 1853
 		)
1854 1854
 	);
1855 1855
 
1856
-	if ( $forms->have_posts() ) {
1857
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1856
+	if ($forms->have_posts()) {
1857
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1858 1858
 
1859
-		while ( $forms->have_posts() ) {
1859
+		while ($forms->have_posts()) {
1860 1860
 			$forms->the_post();
1861 1861
 			global $post;
1862 1862
 
1863
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1863
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1864 1864
 				continue;
1865 1865
 			}
1866 1866
 
1867
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1868
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1869
-			$term_name = ! empty( $term ) ? $term->slug : '';
1867
+			$term      = get_the_terms($post->ID, 'give_log_type');
1868
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1869
+			$term_name = ! empty($term) ? $term->slug : '';
1870 1870
 
1871 1871
 			$log_data = array(
1872 1872
 				'ID'           => $post->ID,
@@ -1879,29 +1879,29 @@  discard block
 block discarded – undo
1879 1879
 			);
1880 1880
 			$log_meta = array();
1881 1881
 
1882
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1883
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1884
-					switch ( $meta_key ) {
1882
+			if ($old_log_meta = get_post_meta($post->ID)) {
1883
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1884
+					switch ($meta_key) {
1885 1885
 						case '_give_log_payment_id':
1886
-							$log_data['log_parent']        = current( $meta_value );
1886
+							$log_data['log_parent']        = current($meta_value);
1887 1887
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1888 1888
 							break;
1889 1889
 
1890 1890
 						default:
1891
-							$log_meta[ $meta_key ] = current( $meta_value );
1891
+							$log_meta[$meta_key] = current($meta_value);
1892 1892
 					}
1893 1893
 				}
1894 1894
 			}
1895 1895
 
1896
-			if ( 'api_request' === $term_name ) {
1896
+			if ('api_request' === $term_name) {
1897 1897
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1898 1898
 			}
1899 1899
 
1900
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1900
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1901 1901
 
1902
-			if ( ! empty( $log_meta ) ) {
1903
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1904
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1902
+			if ( ! empty($log_meta)) {
1903
+				foreach ($log_meta as $meta_key => $meta_value) {
1904
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1905 1905
 				}
1906 1906
 			}
1907 1907
 
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 		Give()->logs->delete_cache();
1944 1944
 
1945 1945
 		// No more forms found, finish up.
1946
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1946
+		give_set_upgrade_complete('v20_logs_upgrades');
1947 1947
 	}
1948 1948
 }
1949 1949
 
@@ -1959,19 +1959,19 @@  discard block
 block discarded – undo
1959 1959
 	$give_updates = Give_Updates::get_instance();
1960 1960
 
1961 1961
 	// form query
1962
-	$payments = new WP_Query( array(
1962
+	$payments = new WP_Query(array(
1963 1963
 			'paged'          => $give_updates->step,
1964 1964
 			'status'         => 'any',
1965 1965
 			'order'          => 'ASC',
1966
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1966
+			'post_type'      => array('give_forms', 'give_payment'),
1967 1967
 			'posts_per_page' => 100,
1968 1968
 		)
1969 1969
 	);
1970 1970
 
1971
-	if ( $payments->have_posts() ) {
1972
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1971
+	if ($payments->have_posts()) {
1972
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1973 1973
 
1974
-		while ( $payments->have_posts() ) {
1974
+		while ($payments->have_posts()) {
1975 1975
 			$payments->the_post();
1976 1976
 			global $post;
1977 1977
 
@@ -1983,19 +1983,19 @@  discard block
 block discarded – undo
1983 1983
 				ARRAY_A
1984 1984
 			);
1985 1985
 
1986
-			if ( ! empty( $meta_data ) ) {
1987
-				foreach ( $meta_data as $index => $data ) {
1986
+			if ( ! empty($meta_data)) {
1987
+				foreach ($meta_data as $index => $data) {
1988 1988
 					// Check for duplicate meta values.
1989
-					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 ) ) {
1989
+					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)) {
1990 1990
 						continue;
1991 1991
 					}
1992 1992
 
1993
-					switch ( $post->post_type ) {
1993
+					switch ($post->post_type) {
1994 1994
 						case 'give_forms':
1995 1995
 							$data['form_id'] = $data['post_id'];
1996
-							unset( $data['post_id'] );
1996
+							unset($data['post_id']);
1997 1997
 
1998
-							Give()->form_meta->insert( $data );
1998
+							Give()->form_meta->insert($data);
1999 1999
 							// @todo: delete form meta from post meta table after releases 2.0.
2000 2000
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2001 2001
 
@@ -2003,9 +2003,9 @@  discard block
 block discarded – undo
2003 2003
 
2004 2004
 						case 'give_payment':
2005 2005
 							$data['payment_id'] = $data['post_id'];
2006
-							unset( $data['post_id'] );
2006
+							unset($data['post_id']);
2007 2007
 
2008
-							Give()->payment_meta->insert( $data );
2008
+							Give()->payment_meta->insert($data);
2009 2009
 
2010 2010
 							// @todo: delete donation meta from post meta table after releases 2.0.
2011 2011
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 		wp_reset_postdata();
2021 2021
 	} else {
2022 2022
 		// No more forms found, finish up.
2023
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2023
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2024 2024
 	}
2025 2025
 
2026 2026
 }
@@ -2036,44 +2036,44 @@  discard block
 block discarded – undo
2036 2036
 	/* @var Give_Updates $give_updates */
2037 2037
 	$give_updates = Give_Updates::get_instance();
2038 2038
 
2039
-	$donors = Give()->donors->get_donors( array(
2039
+	$donors = Give()->donors->get_donors(array(
2040 2040
 		'paged'  => $give_updates->step,
2041 2041
 		'number' => 100,
2042
-	) );
2042
+	));
2043 2043
 
2044
-	if ( $donors ) {
2045
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2044
+	if ($donors) {
2045
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2046 2046
 		// Loop through Donors
2047
-		foreach ( $donors as $donor ) {
2047
+		foreach ($donors as $donor) {
2048 2048
 
2049
-			$donor_name       = explode( ' ', $donor->name, 2 );
2050
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2051
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2049
+			$donor_name       = explode(' ', $donor->name, 2);
2050
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2051
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2052 2052
 
2053 2053
 			// If first name meta of donor is not created, then create it.
2054
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2055
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2054
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2055
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2056 2056
 			}
2057 2057
 
2058 2058
 			// If last name meta of donor is not created, then create it.
2059
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2060
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2059
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2060
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2061 2061
 			}
2062 2062
 
2063 2063
 			// If Donor is connected with WP User then update user meta.
2064
-			if ( $donor->user_id ) {
2065
-				if ( isset( $donor_name[0] ) ) {
2066
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2064
+			if ($donor->user_id) {
2065
+				if (isset($donor_name[0])) {
2066
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2067 2067
 				}
2068
-				if ( isset( $donor_name[1] ) ) {
2069
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2068
+				if (isset($donor_name[1])) {
2069
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2070 2070
 				}
2071 2071
 			}
2072 2072
 		}
2073 2073
 
2074 2074
 	} else {
2075 2075
 		// The Update Ran.
2076
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2076
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2077 2077
 	}
2078 2078
 
2079 2079
 }
@@ -2102,15 +2102,15 @@  discard block
 block discarded – undo
2102 2102
 
2103 2103
 	$users = $user_query->get_results();
2104 2104
 
2105
-	if ( $users ) {
2106
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2105
+	if ($users) {
2106
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2107 2107
 
2108 2108
 		// Loop through Donors
2109
-		foreach ( $users as $user ) {
2109
+		foreach ($users as $user) {
2110 2110
 			/* @var Give_Donor $donor */
2111
-			$donor = new Give_Donor( $user->ID, true );
2111
+			$donor = new Give_Donor($user->ID, true);
2112 2112
 
2113
-			if ( ! $donor->id ) {
2113
+			if ( ! $donor->id) {
2114 2114
 				continue;
2115 2115
 			}
2116 2116
 
@@ -2126,10 +2126,10 @@  discard block
 block discarded – undo
2126 2126
 				)
2127 2127
 			);
2128 2128
 
2129
-			if ( ! empty( $address ) ) {
2130
-				$address = maybe_unserialize( $address );
2131
-				$donor->add_address( 'personal', $address );
2132
-				$donor->add_address( 'billing[]', $address );
2129
+			if ( ! empty($address)) {
2130
+				$address = maybe_unserialize($address);
2131
+				$donor->add_address('personal', $address);
2132
+				$donor->add_address('billing[]', $address);
2133 2133
 
2134 2134
 
2135 2135
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
 
2140 2140
 	} else {
2141 2141
 		// The Update Ran.
2142
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2142
+		give_set_upgrade_complete('v20_upgrades_user_address');
2143 2143
 	}
2144 2144
 
2145 2145
 }
@@ -2163,15 +2163,15 @@  discard block
 block discarded – undo
2163 2163
 	);
2164 2164
 
2165 2165
 	// Alter customer table
2166
-	foreach ( $tables as $old_table => $new_table ) {
2166
+	foreach ($tables as $old_table => $new_table) {
2167 2167
 		if (
2168
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2169
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2168
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2169
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2170 2170
 		) {
2171
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2171
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2172 2172
 
2173
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2174
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2173
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2174
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2175 2175
 			}
2176 2176
 		}
2177 2177
 	}
@@ -2179,7 +2179,7 @@  discard block
 block discarded – undo
2179 2179
 	$give_updates->percentage = 100;
2180 2180
 
2181 2181
 	// No more forms found, finish up.
2182
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2182
+	give_set_upgrade_complete('v20_rename_donor_tables');
2183 2183
 
2184 2184
 	// Re initiate donor classes.
2185 2185
 	Give()->donors     = new Give_DB_Donors();
@@ -2197,19 +2197,19 @@  discard block
 block discarded – undo
2197 2197
 function give_v201_create_tables() {
2198 2198
 	global $wpdb;
2199 2199
 
2200
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2200
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2201 2201
 		Give()->payment_meta->create_table();
2202 2202
 	}
2203 2203
 
2204
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2204
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2205 2205
 		Give()->form_meta->create_table();
2206 2206
 	}
2207 2207
 
2208
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2208
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2209 2209
 		Give()->logs->log_db->create_table();
2210 2210
 	}
2211 2211
 
2212
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2212
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2213 2213
 		Give()->logs->logmeta_db->create_table();
2214 2214
 	}
2215 2215
 }
@@ -2234,31 +2234,31 @@  discard block
 block discarded – undo
2234 2234
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2235 2235
 			)
2236 2236
 			AND $wpdb->posts.post_type = 'give_payment'
2237
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2237
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2238 2238
 			ORDER BY $wpdb->posts.post_date ASC 
2239 2239
 			LIMIT 100
2240
-			OFFSET " . $give_updates->get_offset( 100 )
2240
+			OFFSET ".$give_updates->get_offset(100)
2241 2241
 	);
2242 2242
 
2243
-	if ( ! empty( $payments ) ) {
2244
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2243
+	if ( ! empty($payments)) {
2244
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2245 2245
 
2246
-		foreach ( $payments as $payment_id ) {
2247
-			$post = get_post( $payment_id );
2248
-			setup_postdata( $post );
2246
+		foreach ($payments as $payment_id) {
2247
+			$post = get_post($payment_id);
2248
+			setup_postdata($post);
2249 2249
 
2250 2250
 			// Do not add new meta keys if already refactored.
2251
-			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' ) ) ) {
2251
+			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'))) {
2252 2252
 				continue;
2253 2253
 			}
2254 2254
 
2255 2255
 
2256 2256
 			// Split _give_payment_meta meta.
2257 2257
 			// @todo Remove _give_payment_meta after releases 2.0
2258
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2258
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2259 2259
 
2260
-			if ( ! empty( $payment_meta ) ) {
2261
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2260
+			if ( ! empty($payment_meta)) {
2261
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2262 2262
 			}
2263 2263
 
2264 2264
 			$deprecated_meta_keys = array(
@@ -2267,9 +2267,9 @@  discard block
 block discarded – undo
2267 2267
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2268 2268
 			);
2269 2269
 
2270
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2270
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2271 2271
 				// Do not add new meta key if already exist.
2272
-				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 ) ) ) {
2272
+				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))) {
2273 2273
 					continue;
2274 2274
 				}
2275 2275
 
@@ -2278,25 +2278,25 @@  discard block
 block discarded – undo
2278 2278
 					array(
2279 2279
 						'post_id'    => $post->ID,
2280 2280
 						'meta_key'   => $new_meta_key,
2281
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2281
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2282 2282
 					)
2283 2283
 				);
2284 2284
 			}
2285 2285
 
2286 2286
 			// Bailout
2287
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2287
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2288 2288
 				/* @var Give_Donor $donor */
2289
-				$donor = new Give_Donor( $donor_id );
2289
+				$donor = new Give_Donor($donor_id);
2290 2290
 
2291
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2292
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2293
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2294
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2295
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2296
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2291
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2292
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2293
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2294
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2295
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2296
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2297 2297
 
2298 2298
 				// Save address.
2299
-				$donor->add_address( 'billing[]', $address );
2299
+				$donor->add_address('billing[]', $address);
2300 2300
 			}
2301 2301
 
2302 2302
 		}// End while().
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2308 2308
 
2309 2309
 		// No more forms found, finish up.
2310
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2310
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2311 2311
 	}
2312 2312
 }
2313 2313
 
@@ -2327,21 +2327,21 @@  discard block
 block discarded – undo
2327 2327
 			SELECT ID FROM $wpdb->posts 
2328 2328
 			WHERE 1=1
2329 2329
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2330
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2330
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2331 2331
 			ORDER BY $wpdb->posts.post_date ASC 
2332 2332
 			LIMIT 100
2333
-			OFFSET " . $give_updates->get_offset( 100 )
2333
+			OFFSET ".$give_updates->get_offset(100)
2334 2334
 	);
2335 2335
 
2336
-	if ( ! empty( $payments ) ) {
2337
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2336
+	if ( ! empty($payments)) {
2337
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2338 2338
 			'give_forms',
2339 2339
 			'give_payment',
2340
-		) ), $give_updates->step * 100 );
2340
+		)), $give_updates->step * 100);
2341 2341
 
2342
-		foreach ( $payments as $payment_id ) {
2343
-			$post = get_post( $payment_id );
2344
-			setup_postdata( $post );
2342
+		foreach ($payments as $payment_id) {
2343
+			$post = get_post($payment_id);
2344
+			setup_postdata($post);
2345 2345
 
2346 2346
 			$meta_data = $wpdb->get_results(
2347 2347
 				$wpdb->prepare(
@@ -2351,19 +2351,19 @@  discard block
 block discarded – undo
2351 2351
 				ARRAY_A
2352 2352
 			);
2353 2353
 
2354
-			if ( ! empty( $meta_data ) ) {
2355
-				foreach ( $meta_data as $index => $data ) {
2354
+			if ( ! empty($meta_data)) {
2355
+				foreach ($meta_data as $index => $data) {
2356 2356
 					// Check for duplicate meta values.
2357
-					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 ) ) {
2357
+					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)) {
2358 2358
 						continue;
2359 2359
 					}
2360 2360
 
2361
-					switch ( $post->post_type ) {
2361
+					switch ($post->post_type) {
2362 2362
 						case 'give_forms':
2363 2363
 							$data['form_id'] = $data['post_id'];
2364
-							unset( $data['post_id'] );
2364
+							unset($data['post_id']);
2365 2365
 
2366
-							Give()->form_meta->insert( $data );
2366
+							Give()->form_meta->insert($data);
2367 2367
 							// @todo: delete form meta from post meta table after releases 2.0.
2368 2368
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2369 2369
 
@@ -2371,9 +2371,9 @@  discard block
 block discarded – undo
2371 2371
 
2372 2372
 						case 'give_payment':
2373 2373
 							$data['payment_id'] = $data['post_id'];
2374
-							unset( $data['post_id'] );
2374
+							unset($data['post_id']);
2375 2375
 
2376
-							Give()->payment_meta->insert( $data );
2376
+							Give()->payment_meta->insert($data);
2377 2377
 
2378 2378
 							// @todo: delete donation meta from post meta table after releases 2.0.
2379 2379
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
 		wp_reset_postdata();
2389 2389
 	} else {
2390 2390
 		// No more forms found, finish up.
2391
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2391
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2392 2392
 	}
2393 2393
 
2394 2394
 }
@@ -2409,26 +2409,26 @@  discard block
 block discarded – undo
2409 2409
 			SELECT ID FROM $wpdb->posts 
2410 2410
 			WHERE 1=1
2411 2411
 			AND $wpdb->posts.post_type = 'give_log'
2412
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2412
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2413 2413
 			ORDER BY $wpdb->posts.post_date ASC 
2414 2414
 			LIMIT 100
2415
-			OFFSET " . $give_updates->get_offset( 100 )
2415
+			OFFSET ".$give_updates->get_offset(100)
2416 2416
 	);
2417 2417
 
2418
-	if ( ! empty( $logs ) ) {
2419
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2418
+	if ( ! empty($logs)) {
2419
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2420 2420
 
2421
-		foreach ( $logs as $log_id ) {
2422
-			$post = get_post( $log_id );
2423
-			setup_postdata( $post );
2421
+		foreach ($logs as $log_id) {
2422
+			$post = get_post($log_id);
2423
+			setup_postdata($post);
2424 2424
 
2425
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2425
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2426 2426
 				continue;
2427 2427
 			}
2428 2428
 
2429
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2430
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2431
-			$term_name = ! empty( $term ) ? $term->slug : '';
2429
+			$term      = get_the_terms($post->ID, 'give_log_type');
2430
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2431
+			$term_name = ! empty($term) ? $term->slug : '';
2432 2432
 
2433 2433
 			$log_data = array(
2434 2434
 				'ID'           => $post->ID,
@@ -2441,29 +2441,29 @@  discard block
 block discarded – undo
2441 2441
 			);
2442 2442
 			$log_meta = array();
2443 2443
 
2444
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2445
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2446
-					switch ( $meta_key ) {
2444
+			if ($old_log_meta = get_post_meta($post->ID)) {
2445
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2446
+					switch ($meta_key) {
2447 2447
 						case '_give_log_payment_id':
2448
-							$log_data['log_parent']        = current( $meta_value );
2448
+							$log_data['log_parent']        = current($meta_value);
2449 2449
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2450 2450
 							break;
2451 2451
 
2452 2452
 						default:
2453
-							$log_meta[ $meta_key ] = current( $meta_value );
2453
+							$log_meta[$meta_key] = current($meta_value);
2454 2454
 					}
2455 2455
 				}
2456 2456
 			}
2457 2457
 
2458
-			if ( 'api_request' === $term_name ) {
2458
+			if ('api_request' === $term_name) {
2459 2459
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2460 2460
 			}
2461 2461
 
2462
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2462
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2463 2463
 
2464
-			if ( ! empty( $log_meta ) ) {
2465
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2466
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2464
+			if ( ! empty($log_meta)) {
2465
+				foreach ($log_meta as $meta_key => $meta_value) {
2466
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2467 2467
 				}
2468 2468
 			}
2469 2469
 
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
 		Give()->logs->delete_cache();
2477 2477
 
2478 2478
 		// No more forms found, finish up.
2479
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2479
+		give_set_upgrade_complete('v201_logs_upgrades');
2480 2480
 	}
2481 2481
 }
2482 2482
 
@@ -2491,51 +2491,51 @@  discard block
 block discarded – undo
2491 2491
 	global $wpdb;
2492 2492
 	give_v201_create_tables();
2493 2493
 
2494
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2495
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2496
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2494
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2495
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2496
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2497 2497
 		$donor_data = array();
2498 2498
 
2499
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2500
-			foreach ( $missing_donors as $donor_id ) {
2499
+		if ($missing_donors = array_diff($customers, $donors)) {
2500
+			foreach ($missing_donors as $donor_id) {
2501 2501
 				$donor_data[] = array(
2502
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2503
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2502
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2503
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2504 2504
 
2505 2505
 				);
2506 2506
 			}
2507 2507
 		}
2508 2508
 
2509
-		if ( ! empty( $donor_data ) ) {
2509
+		if ( ! empty($donor_data)) {
2510 2510
 			$donor_table_name      = Give()->donors->table_name;
2511 2511
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2512 2512
 
2513 2513
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2514 2514
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2515 2515
 
2516
-			foreach ( $donor_data as $donor ) {
2516
+			foreach ($donor_data as $donor) {
2517 2517
 				$donor['info'][0] = (array) $donor['info'][0];
2518 2518
 
2519 2519
 				// Prevent duplicate meta id issue.
2520
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2520
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2521 2521
 					continue;
2522 2522
 				}
2523 2523
 
2524
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2524
+				$donor_id = Give()->donors->add($donor['info'][0]);
2525 2525
 
2526
-				if ( ! empty( $donor['meta'] ) ) {
2527
-					foreach ( $donor['meta'] as $donor_meta ) {
2526
+				if ( ! empty($donor['meta'])) {
2527
+					foreach ($donor['meta'] as $donor_meta) {
2528 2528
 						$donor_meta = (array) $donor_meta;
2529 2529
 
2530 2530
 						// Prevent duplicate meta id issue.
2531
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2532
-							unset( $donor_meta['meta_id'] );
2531
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2532
+							unset($donor_meta['meta_id']);
2533 2533
 						}
2534 2534
 
2535 2535
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2536
-						unset( $donor_meta['customer_id'] );
2536
+						unset($donor_meta['customer_id']);
2537 2537
 
2538
-						Give()->donor_meta->insert( $donor_meta );
2538
+						Give()->donor_meta->insert($donor_meta);
2539 2539
 					}
2540 2540
 				}
2541 2541
 
@@ -2554,35 +2554,35 @@  discard block
 block discarded – undo
2554 2554
 					)
2555 2555
 				);
2556 2556
 
2557
-				$donor = new Give_Donor( $donor_id );
2557
+				$donor = new Give_Donor($donor_id);
2558 2558
 
2559
-				if ( ! empty( $address ) ) {
2560
-					$address = maybe_unserialize( $address );
2561
-					$donor->add_address( 'personal', $address );
2562
-					$donor->add_address( 'billing[]', $address );
2559
+				if ( ! empty($address)) {
2560
+					$address = maybe_unserialize($address);
2561
+					$donor->add_address('personal', $address);
2562
+					$donor->add_address('billing[]', $address);
2563 2563
 				}
2564 2564
 
2565
-				$donor_name       = explode( ' ', $donor->name, 2 );
2566
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2567
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2565
+				$donor_name       = explode(' ', $donor->name, 2);
2566
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2567
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2568 2568
 
2569 2569
 				// If first name meta of donor is not created, then create it.
2570
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2571
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2570
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2571
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2572 2572
 				}
2573 2573
 
2574 2574
 				// If last name meta of donor is not created, then create it.
2575
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2576
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2575
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2576
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2577 2577
 				}
2578 2578
 
2579 2579
 				// If Donor is connected with WP User then update user meta.
2580
-				if ( $donor->user_id ) {
2581
-					if ( isset( $donor_name[0] ) ) {
2582
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2580
+				if ($donor->user_id) {
2581
+					if (isset($donor_name[0])) {
2582
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2583 2583
 					}
2584
-					if ( isset( $donor_name[1] ) ) {
2585
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2584
+					if (isset($donor_name[1])) {
2585
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2586 2586
 					}
2587 2587
 				}
2588 2588
 			}
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 	}
2594 2594
 
2595 2595
 	Give_Updates::get_instance()->percentage = 100;
2596
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2596
+	give_set_upgrade_complete('v201_add_missing_donors');
2597 2597
 }
2598 2598
 
2599 2599
 
@@ -2606,14 +2606,14 @@  discard block
 block discarded – undo
2606 2606
 	global $wpdb;
2607 2607
 
2608 2608
 	// Do not auto load option.
2609
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2609
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2610 2610
 
2611 2611
 	// Remove from cache.
2612 2612
 	$all_options = wp_load_alloptions();
2613 2613
 
2614
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2615
-		unset( $all_options['give_completed_upgrades'] );
2616
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2614
+	if (isset($all_options['give_completed_upgrades'])) {
2615
+		unset($all_options['give_completed_upgrades']);
2616
+		wp_cache_set('alloptions', $all_options, 'options');
2617 2617
 	}
2618 2618
 
2619 2619
 }
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
 	$give_updates = Give_Updates::get_instance();
2629 2629
 
2630 2630
 	// form query.
2631
-	$donation_forms = new WP_Query( array(
2631
+	$donation_forms = new WP_Query(array(
2632 2632
 			'paged'          => $give_updates->step,
2633 2633
 			'status'         => 'any',
2634 2634
 			'order'          => 'ASC',
@@ -2637,16 +2637,16 @@  discard block
 block discarded – undo
2637 2637
 		)
2638 2638
 	);
2639 2639
 
2640
-	if ( $donation_forms->have_posts() ) {
2641
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
2640
+	if ($donation_forms->have_posts()) {
2641
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
2642 2642
 
2643
-		while ( $donation_forms->have_posts() ) {
2643
+		while ($donation_forms->have_posts()) {
2644 2644
 			$donation_forms->the_post();
2645 2645
 			$form_id = get_the_ID();
2646 2646
 
2647
-			$form_closed_status = give_get_meta( $form_id, '_give_form_status', true );
2648
-			if ( empty( $form_closed_status ) ) {
2649
-				give_set_form_closed_status( $form_id );
2647
+			$form_closed_status = give_get_meta($form_id, '_give_form_status', true);
2648
+			if (empty($form_closed_status)) {
2649
+				give_set_form_closed_status($form_id);
2650 2650
 			}
2651 2651
 		}
2652 2652
 
@@ -2656,7 +2656,7 @@  discard block
 block discarded – undo
2656 2656
 	} else {
2657 2657
 
2658 2658
 		// The Update Ran.
2659
-		give_set_upgrade_complete( 'v210_verify_form_status_upgrades' );
2659
+		give_set_upgrade_complete('v210_verify_form_status_upgrades');
2660 2660
 	}
2661 2661
 
2662 2662
 }
2663 2663
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( 'give_forms' === $typenow ) {
30
+	if ('give_forms' === $typenow) {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +81 added lines, -81 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
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page;
33 33
 
34 34
 	//Payments
35
-	$give_payment       = get_post_type_object( 'give_payment' );
35
+	$give_payment       = get_post_type_object('give_payment');
36 36
 	$give_payments_page = add_submenu_page(
37 37
 		'edit.php?post_type=give_forms',
38 38
 		$give_payment->labels->name,
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	//Donors
46 46
 	$give_donors_page = add_submenu_page(
47 47
 		'edit.php?post_type=give_forms',
48
-		esc_html__( 'Donors', 'give' ),
49
-		esc_html__( 'Donors', 'give' ),
48
+		esc_html__('Donors', 'give'),
49
+		esc_html__('Donors', 'give'),
50 50
 		'view_give_reports',
51 51
 		'give-donors',
52 52
 		'give_donors_page'
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	//Reports`
56 56
 	$give_reports_page = add_submenu_page(
57 57
 		'edit.php?post_type=give_forms',
58
-		esc_html__( 'Donation Reports', 'give' ),
59
-		esc_html__( 'Reports', 'give' ),
58
+		esc_html__('Donation Reports', 'give'),
59
+		esc_html__('Reports', 'give'),
60 60
 		'view_give_reports',
61 61
 		'give-reports',
62 62
 		array(
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	//Settings
69 69
 	$give_settings_page = add_submenu_page(
70 70
 		'edit.php?post_type=give_forms',
71
-		esc_html__( 'Give Settings', 'give' ),
72
-		esc_html__( 'Settings', 'give' ),
71
+		esc_html__('Give Settings', 'give'),
72
+		esc_html__('Settings', 'give'),
73 73
 		'manage_give_settings',
74 74
 		'give-settings',
75 75
 		array(
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	//Tools.
82 82
 	$give_tools_page = add_submenu_page(
83 83
 		'edit.php?post_type=give_forms',
84
-		esc_html__( 'Give Tools', 'give' ),
85
-		esc_html__( 'Tools', 'give' ),
84
+		esc_html__('Give Tools', 'give'),
85
+		esc_html__('Tools', 'give'),
86 86
 		'manage_give_settings',
87 87
 		'give-tools',
88 88
 		array(
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	//Add-ons
95 95
 	$give_add_ons_page = add_submenu_page(
96 96
 		'edit.php?post_type=give_forms',
97
-		esc_html__( 'Give Add-ons', 'give' ),
98
-		esc_html__( 'Add-ons', 'give' ),
97
+		esc_html__('Give Add-ons', 'give'),
98
+		esc_html__('Add-ons', 'give'),
99 99
 		'install_plugins',
100 100
 		'give-addons',
101 101
 		'give_add_ons_page'
102 102
 	);
103 103
 }
104 104
 
105
-add_action( 'admin_menu', 'give_add_options_links', 10 );
105
+add_action('admin_menu', 'give_add_options_links', 10);
106 106
 
107 107
 /**
108 108
  *  Determines whether the current admin page is a Give admin page.
@@ -118,28 +118,28 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @return bool True if Give admin page.
120 120
  */
121
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
121
+function give_is_admin_page($passed_page = '', $passed_view = '') {
122 122
 	global $pagenow, $typenow;
123 123
 
124 124
 	$found          = true;
125
-	$get_query_args = ! empty( $_GET ) ? @array_map( 'strtolower', $_GET ) : array();
125
+	$get_query_args = ! empty($_GET) ? @array_map('strtolower', $_GET) : array();
126 126
 
127 127
 	// Set default argument, if not passed.
128
-	$query_args = wp_parse_args( $get_query_args, array_fill_keys( array( 'post_type', 'action', 'taxonomy', 'page', 'view', 'tab' ), false ) );
128
+	$query_args = wp_parse_args($get_query_args, array_fill_keys(array('post_type', 'action', 'taxonomy', 'page', 'view', 'tab'), false));
129 129
 
130
-	switch ( $passed_page ) {
130
+	switch ($passed_page) {
131 131
 		case 'categories':
132 132
 		case 'tags':
133
-			$has_view = in_array( $passed_view, array( 'list-table', 'edit', 'new' ), true );
133
+			$has_view = in_array($passed_view, array('list-table', 'edit', 'new'), true);
134 134
 
135 135
 			if (
136
-				! in_array( $query_args['taxonomy'], array( 'give_forms_category', 'give_forms_tag' ), true ) &&
136
+				! in_array($query_args['taxonomy'], array('give_forms_category', 'give_forms_tag'), true) &&
137 137
 				'edit-tags.php' !== $pagenow &&
138 138
 				(
139 139
 					$has_view ||
140 140
 					(
141
-						( in_array( $passed_view, array( 'list-table', 'new' ), true ) && 'edit' === $query_args['action'] ) ||
142
-						( 'edit' !== $passed_view && 'edit' !== $query_args['action'] ) &&
141
+						(in_array($passed_view, array('list-table', 'new'), true) && 'edit' === $query_args['action']) ||
142
+						('edit' !== $passed_view && 'edit' !== $query_args['action']) &&
143 143
 						! $has_view
144 144
 					)
145 145
 				)
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 			break;
150 150
 		// Give Donation form page.
151 151
 		case 'give_forms':
152
-			$has_view = in_array( $passed_view, array( 'new', 'list-table', 'edit' ), true );
152
+			$has_view = in_array($passed_view, array('new', 'list-table', 'edit'), true);
153 153
 
154 154
 			if (
155 155
 				'give_forms' !== $typenow &&
156 156
 				(
157
-					( 'list-table' !== $passed_view && 'edit.php' !== $pagenow ) &&
158
-					( 'edit' !== $passed_view && 'post.php' !== $pagenow ) &&
159
-					( 'new' !== $passed_view && 'post-new.php' !== $pagenow )
157
+					('list-table' !== $passed_view && 'edit.php' !== $pagenow) &&
158
+					('edit' !== $passed_view && 'post.php' !== $pagenow) &&
159
+					('new' !== $passed_view && 'post-new.php' !== $pagenow)
160 160
 				) ||
161 161
 				(
162 162
 					! $has_view &&
163
-					( 'post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type'] )
163
+					('post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type'])
164 164
 				)
165 165
 			) {
166 166
 				$found = false;
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 			break;
169 169
 		// Give Donors page.
170 170
 		case 'donors':
171
-			$has_view = array_intersect( array( $passed_view, $query_args['view'] ), array( 'list-table', 'overview', 'notes' ) );
171
+			$has_view = array_intersect(array($passed_view, $query_args['view']), array('list-table', 'overview', 'notes'));
172 172
 
173 173
 			if (
174
-				( 'give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow ) &&
174
+				('give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow) &&
175 175
 				(
176
-					( $passed_view !== $query_args['view'] || ! empty( $has_view ) ) ||
177
-					( false !== $query_args['view'] && 'list-table' !== $passed_view )
176
+					($passed_view !== $query_args['view'] || ! empty($has_view)) ||
177
+					(false !== $query_args['view'] && 'list-table' !== $passed_view)
178 178
 				)
179 179
 			) {
180 180
 				$found = false;
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 		// Give Donations page.
184 184
 		case 'payments':
185 185
 			if (
186
-				( 'give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow ) &&
186
+				('give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow) &&
187 187
 				(
188
-					! in_array( $passed_view, array( 'list-table', 'edit' ), true ) ||
188
+					! in_array($passed_view, array('list-table', 'edit'), true) ||
189 189
 					(
190
-						( 'list-table' !== $passed_view && false !== $query_args['view'] ) ||
191
-						( 'edit' !== $passed_view && 'view-payment-details' !== $query_args['view'] )
190
+						('list-table' !== $passed_view && false !== $query_args['view']) ||
191
+						('edit' !== $passed_view && 'view-payment-details' !== $query_args['view'])
192 192
 					)
193 193
 				)
194 194
 			) {
@@ -199,20 +199,20 @@  discard block
 block discarded – undo
199 199
 		case 'settings':
200 200
 		case 'addons':
201 201
 			// Get current tab.
202
-			$current_tab       = empty( $passed_view ) ? $query_args['tab'] : $passed_view;
203
-			$give_setting_page = in_array( $query_args['page'], array( 'give-reports', 'give-settings', 'give-addons' ), true );
202
+			$current_tab       = empty($passed_view) ? $query_args['tab'] : $passed_view;
203
+			$give_setting_page = in_array($query_args['page'], array('give-reports', 'give-settings', 'give-addons'), true);
204 204
 
205 205
 			// Check if it's Give Setting page or not.
206 206
 			if (
207
-				( 'edit.php' !== $pagenow || ! $give_setting_page ) &&
208
-				! Give_Admin_Settings::is_setting_page( $current_tab )
207
+				('edit.php' !== $pagenow || ! $give_setting_page) &&
208
+				! Give_Admin_Settings::is_setting_page($current_tab)
209 209
 			) {
210 210
 				$found = false;
211 211
 			}
212 212
 			break;
213 213
 		default:
214 214
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page;
215
-			$admin_pages = apply_filters( 'give_admin_pages', array(
215
+			$admin_pages = apply_filters('give_admin_pages', array(
216 216
 				$give_payments_page,
217 217
 				$give_settings_page,
218 218
 				$give_reports_page,
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 				$give_donors_page,
223 223
 				$give_tools_page,
224 224
 				'widgets.php',
225
-			) );
225
+			));
226 226
 
227
-			$found = ( 'give_forms' === $typenow || in_array( $pagenow, array_merge( $admin_pages, array( 'index.php', 'post-new.php', 'post.php' ) ), true ) ) ? true : false;
227
+			$found = ('give_forms' === $typenow || in_array($pagenow, array_merge($admin_pages, array('index.php', 'post-new.php', 'post.php')), true)) ? true : false;
228 228
 	}
229
-	return (bool) apply_filters( 'give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view );
229
+	return (bool) apply_filters('give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view);
230 230
 }
231 231
 
232 232
 /**
@@ -236,37 +236,37 @@  discard block
 block discarded – undo
236 236
  * @param  array $settings
237 237
  * @return array
238 238
  */
239
-function give_settings_page_pages( $settings ) {
240
-	include( 'abstract-admin-settings-page.php' );
241
-	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
239
+function give_settings_page_pages($settings) {
240
+	include('abstract-admin-settings-page.php');
241
+	include('settings/class-settings-cmb2-backward-compatibility.php');
242 242
 
243 243
 	$settings = array(
244 244
 		// General settings.
245
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ),
245
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-general.php'),
246 246
 
247 247
 		// Payment Gateways Settings.
248
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ),
248
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-gateways.php'),
249 249
 
250 250
 		// Display settings.
251
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ),
251
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-display.php'),
252 252
 
253 253
 		// Emails settings.
254
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ),
254
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-email.php'),
255 255
 
256 256
 		// Addons settings.
257
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ),
257
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-addon.php'),
258 258
 
259 259
 		// License settings.
260
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ),
260
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-license.php'),
261 261
 
262 262
 		// Advanced settings.
263
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' ),
263
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-advanced.php'),
264 264
 	);
265 265
 
266 266
 	// Output.
267 267
 	return $settings;
268 268
 }
269
-add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
269
+add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1);
270 270
 
271 271
 
272 272
 /**
@@ -276,25 +276,25 @@  discard block
 block discarded – undo
276 276
  * @param  array $settings
277 277
  * @return array
278 278
  */
279
-function give_reports_page_pages( $settings ) {
280
-	include( 'abstract-admin-settings-page.php' );
279
+function give_reports_page_pages($settings) {
280
+	include('abstract-admin-settings-page.php');
281 281
 
282 282
 	$settings = array(
283 283
 		// Earnings.
284
-		include( 'reports/class-earnings-report.php' ),
284
+		include('reports/class-earnings-report.php'),
285 285
 
286 286
 		// Forms.
287
-		include( 'reports/class-forms-report.php' ),
287
+		include('reports/class-forms-report.php'),
288 288
 
289 289
 		// Gateways.
290
-		include( 'reports/class-gateways-report.php' ),
290
+		include('reports/class-gateways-report.php'),
291 291
 
292 292
 	);
293 293
 
294 294
 	// Output.
295 295
 	return $settings;
296 296
 }
297
-add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 );
297
+add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1);
298 298
 
299 299
 /**
300 300
  * Add setting tab to give-settings page
@@ -303,34 +303,34 @@  discard block
 block discarded – undo
303 303
  * @param  array $settings
304 304
  * @return array
305 305
  */
306
-function give_tools_page_pages( $settings ) {
307
-	include( 'abstract-admin-settings-page.php' );
306
+function give_tools_page_pages($settings) {
307
+	include('abstract-admin-settings-page.php');
308 308
 
309 309
 	$settings = array(
310 310
 
311 311
 		// Export.
312
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ),
312
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-export.php'),
313 313
 
314 314
 		// Import
315
-		include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ),
315
+		include_once(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-import.php'),
316 316
 
317 317
 		// Logs.
318
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ),
318
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-logs.php'),
319 319
 
320 320
 		// API.
321
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ),
321
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-api.php'),
322 322
 
323 323
 		// Data.
324
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ),
324
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-data.php'),
325 325
 
326 326
 		// System Info.
327
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ),
327
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-system-info.php'),
328 328
 	);
329 329
 
330 330
 	// Output.
331 331
 	return $settings;
332 332
 }
333
-add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
333
+add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1);
334 334
 
335 335
 /**
336 336
  * Set default tools page tab.
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
  * @param  string $default_tab Default tab name.
340 340
  * @return string
341 341
  */
342
-function give_set_default_tab_form_tools_page( $default_tab ) {
342
+function give_set_default_tab_form_tools_page($default_tab) {
343 343
 	return 'export';
344 344
 }
345
-add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
345
+add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1);
346 346
 
347 347
 
348 348
 /**
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
  * @param  string $default_tab Default tab name.
353 353
  * @return string
354 354
  */
355
-function give_set_default_tab_form_reports_page( $default_tab ) {
355
+function give_set_default_tab_form_reports_page($default_tab) {
356 356
 	return 'earnings';
357 357
 }
358
-add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 );
358
+add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1);
359 359
 
360 360
 
361 361
 /**
@@ -368,19 +368,19 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return array
370 370
  */
371
-function give_add_display_page_states( $post_states, $post ) {
371
+function give_add_display_page_states($post_states, $post) {
372 372
 
373
-	switch ( $post->ID ) {
374
-		case give_get_option( 'success_page' ):
375
-			$post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' );
373
+	switch ($post->ID) {
374
+		case give_get_option('success_page'):
375
+			$post_states['give_successfully_page'] = __('Donation Success Page', 'give');
376 376
 			break;
377 377
 
378
-		case give_get_option( 'failure_page' ):
379
-			$post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' );
378
+		case give_get_option('failure_page'):
379
+			$post_states['give_failure_page'] = __('Donation Failed Page', 'give');
380 380
 			break;
381 381
 
382
-		case give_get_option( 'history_page' ):
383
-			$post_states['give_history_page'] = __( 'Donation History Page', 'give' );
382
+		case give_get_option('history_page'):
383
+			$post_states['give_history_page'] = __('Donation History Page', 'give');
384 384
 			break;
385 385
 	}
386 386
 
@@ -388,4 +388,4 @@  discard block
 block discarded – undo
388 388
 }
389 389
 
390 390
 // Add a post display state for special Give pages.
391
-add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 );
391
+add_filter('display_post_states', 'give_add_display_page_states', 10, 2);
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59 59
 			'ajax'     => false, // Does this table support ajax?
60
-		) );
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,18 +237,18 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place.
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250 250
 		<?php
251
-		wp_nonce_field( 'give-api-nonce' );
251
+		wp_nonce_field('give-api-nonce');
252 252
 		/**
253 253
 		 * API Key user search.
254 254
 		 */
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 			'name' => 'user_id',
258 258
 		);
259 259
 
260
-		echo Give()->html->ajax_user_search( $args );
260
+		echo Give()->html->ajax_user_search($args);
261 261
 
262
-		submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false );
262
+		submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false);
263 263
 
264 264
 		$give_api_is_bottom = true;
265 265
 	}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @return int Current page number
273 273
 	 */
274 274
 	public function get_paged() {
275
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
275
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
276 276
 	}
277 277
 
278 278
 	/**
@@ -283,21 +283,21 @@  discard block
 block discarded – undo
283 283
 	 * @return array
284 284
 	 */
285 285
 	public function query() {
286
-		$users = get_users( array(
286
+		$users = get_users(array(
287 287
 			'meta_value' => 'give_user_secret_key',
288 288
 			'number'     => $this->per_page,
289
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
290
-		) );
291
-		$keys  = array();
292
-
293
-		foreach ( $users as $user ) {
294
-			$keys[ $user->ID ]['id']    = $user->ID;
295
-			$keys[ $user->ID ]['email'] = $user->user_email;
296
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
297
-
298
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
299
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
300
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
289
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
290
+		));
291
+		$keys = array();
292
+
293
+		foreach ($users as $user) {
294
+			$keys[$user->ID]['id']    = $user->ID;
295
+			$keys[$user->ID]['email'] = $user->user_email;
296
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
297
+
298
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
299
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
300
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
301 301
 		}
302 302
 
303 303
 		return $keys;
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	public function total_items() {
315 315
 		global $wpdb;
316 316
 
317
-		$total_items = Give_Cache::get( 'give_total_api_keys', true );
317
+		$total_items = Give_Cache::get('give_total_api_keys', true);
318 318
 
319
-		if ( ! $total_items ) {
319
+		if ( ! $total_items) {
320 320
 			$total_items = $wpdb->get_var(
321 321
 				$wpdb->prepare(
322 322
 					"SELECT count(user_id)
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 				)
326 326
 			);
327 327
 
328
-			Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true );
328
+			Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true);
329 329
 		}
330 330
 
331 331
 		return $total_items;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 		$hidden   = array(); // No hidden columns
345 345
 		$sortable = array(); // Not sortable... for now
346 346
 
347
-		$this->_column_headers = array( $columns, $hidden, $sortable );
347
+		$this->_column_headers = array($columns, $hidden, $sortable);
348 348
 
349 349
 		$data = $this->query();
350 350
 
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$this->items = $data;
354 354
 
355
-		$this->set_pagination_args( array(
355
+		$this->set_pagination_args(array(
356 356
 			'total_items' => $total_items,
357 357
 			'per_page'    => $this->per_page,
358
-			'total_pages' => ceil( $total_items / $this->per_page ),
359
-		) );
358
+			'total_pages' => ceil($total_items / $this->per_page),
359
+		));
360 360
 	}
361 361
 }
Please login to merge, or discard this patch.
includes/admin/donors/donors.php 2 patches
Spacing   +218 added lines, -218 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
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string
27 27
  */
28
-function __give_get_format_address( $address, $address_args = array() ) {
28
+function __give_get_format_address($address, $address_args = array()) {
29 29
 	$address_html = '';
30 30
 	$address_args = wp_parse_args(
31 31
 		$address_args,
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	$address_id = $address_args['type'];
41 41
 
42 42
 	// Bailout.
43
-	if ( empty( $address ) || ! is_array( $address ) ) {
43
+	if (empty($address) || ! is_array($address)) {
44 44
 		return $address_html;
45 45
 	}
46 46
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 	$address_html .= sprintf(
50 50
 		'<span data-address-type="line1">%1$s</span>%2$s',
51 51
 		$address['line1'],
52
-		( ! empty( $address['line2'] ) ? '<br>' : '' )
52
+		( ! empty($address['line2']) ? '<br>' : '')
53 53
 	);
54 54
 	$address_html .= sprintf(
55 55
 		'<span data-address-type="line2">%1$s</span>%2$s',
56 56
 		$address['line2'],
57
-		( ! empty( $address['city'] ) ? '<br>' : '' )
57
+		( ! empty($address['city']) ? '<br>' : '')
58 58
 	);
59 59
 	$address_html .= sprintf(
60 60
 		'<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s',
61 61
 		$address['city'],
62
-		( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ),
63
-		( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ),
64
-		( ! empty( $address['country'] ) ? '<br>' : '' )
62
+		( ! empty($address['state']) ? ", {$address['state']}" : ''),
63
+		( ! empty($address['zip']) ? " {$address['zip']}" : ''),
64
+		( ! empty($address['country']) ? '<br>' : '')
65 65
 	);
66 66
 	$address_html .= sprintf(
67 67
 		'<span data-address-type="country">%s</span><br>',
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	// Address action.
72 72
 	$address_html .= sprintf(
73 73
 		'<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>',
74
-		__( 'Edit', 'give' ),
75
-		__( 'Remove', 'give' )
74
+		__('Edit', 'give'),
75
+		__('Remove', 'give')
76 76
 	);
77 77
 
78 78
 	/**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @since 2.0
82 82
 	 */
83
-	$address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args );
83
+	$address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args);
84 84
 
85 85
 	// Set unique id and index for multi type address.
86
-	if ( isset( $address_args['index'] ) ) {
86
+	if (isset($address_args['index'])) {
87 87
 		$address_label = "{$address_label} #{$address_args['index']}";
88 88
 	}
89 89
 
90
-	if ( isset( $address_args['id'] ) ) {
90
+	if (isset($address_args['id'])) {
91 91
 		$address_id = "{$address_id}_{$address_args['id']}";
92 92
 	}
93 93
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function give_donors_page() {
114 114
 	$default_views  = give_donor_views();
115
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
116
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
117
-		give_render_donor_view( $requested_view, $default_views );
115
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors';
116
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
117
+		give_render_donor_view($requested_view, $default_views);
118 118
 	} else {
119 119
 		give_donors_list();
120 120
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 	$views = array();
132 132
 
133
-	return apply_filters( 'give_donor_views', $views );
133
+	return apply_filters('give_donor_views', $views);
134 134
 
135 135
 }
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	$tabs = array();
146 146
 
147
-	return apply_filters( 'give_donor_tabs', $tabs );
147
+	return apply_filters('give_donor_tabs', $tabs);
148 148
 
149 149
 }
150 150
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function give_donors_list() {
158 158
 
159
-	include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php';
159
+	include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php';
160 160
 
161 161
 	$donors_table = new Give_Donor_List_Table();
162 162
 	$donors_table->prepare_items();
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 		 *
170 170
 		 * @since 1.0
171 171
 		 */
172
-		do_action( 'give_donors_table_top' );
172
+		do_action('give_donors_table_top');
173 173
 		?>
174 174
 
175 175
 		<hr class="wp-header-end">
176
-		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
177
-			<?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?>
176
+		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
177
+			<?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?>
178 178
 			<input type="hidden" name="post_type" value="give_forms" />
179 179
 			<input type="hidden" name="page" value="give-donors" />
180 180
 			<input type="hidden" name="view" value="donors" />
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		 *
192 192
 		 * @since 1.0
193 193
 		 */
194
-		do_action( 'give_donors_table_bottom' );
194
+		do_action('give_donors_table_bottom');
195 195
 		?>
196 196
 	</div>
197 197
 	<?php
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return void
209 209
  */
210
-function give_render_donor_view( $view, $callbacks ) {
210
+function give_render_donor_view($view, $callbacks) {
211 211
 
212 212
 	$render = true;
213 213
 
214
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
214
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
215 215
 
216
-	if ( ! current_user_can( $donor_view_role ) ) {
217
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
216
+	if ( ! current_user_can($donor_view_role)) {
217
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
218 218
 		$render = false;
219 219
 	}
220 220
 
221
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
222
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
221
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
222
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
223 223
 		$render = false;
224 224
 	}
225 225
 
226 226
 	$donor_id          = (int) $_GET['id'];
227
-	$reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : '';
228
-	$donor             = new Give_Donor( $donor_id );
227
+	$reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : '';
228
+	$donor             = new Give_Donor($donor_id);
229 229
 
230 230
 	// Reconnect User with Donor profile.
231
-	if ( $reconnect_user_id ) {
232
-		give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() );
231
+	if ($reconnect_user_id) {
232
+		give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array());
233 233
 	}
234 234
 
235
-	if ( empty( $donor->id ) ) {
236
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
235
+	if (empty($donor->id)) {
236
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
237 237
 		$render = false;
238 238
 	}
239 239
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 
243 243
 	<div class='wrap'>
244 244
 
245
-		<?php if ( give_get_errors() ) : ?>
245
+		<?php if (give_get_errors()) : ?>
246 246
 			<div class="error settings-error">
247
-				<?php Give()->notices->render_frontend_notices( 0 ); ?>
247
+				<?php Give()->notices->render_frontend_notices(0); ?>
248 248
 			</div>
249 249
 		<?php endif; ?>
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			<?php
253 253
 			printf(
254 254
 			/* translators: %s: donor first name */
255
-				__( 'Edit Donor: %s %s', 'give' ),
255
+				__('Edit Donor: %s %s', 'give'),
256 256
 				$donor->get_first_name(),
257 257
 				$donor->get_last_name()
258 258
 			);
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 
262 262
 		<hr class="wp-header-end">
263 263
 
264
-		<?php if ( $donor && $render ) : ?>
264
+		<?php if ($donor && $render) : ?>
265 265
 
266 266
 			<h2 class="nav-tab-wrapper">
267 267
 				<?php
268
-				foreach ( $donor_tabs as $key => $tab ) :
268
+				foreach ($donor_tabs as $key => $tab) :
269 269
 					$active = $key === $view ? true : false;
270 270
 					$class  = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
271 271
 					printf(
272
-						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n",
273
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
274
-						esc_attr( $class ),
275
-						sanitize_html_class( $tab['dashicon'] ),
276
-						esc_html( $tab['title'] )
272
+						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
273
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)),
274
+						esc_attr($class),
275
+						sanitize_html_class($tab['dashicon']),
276
+						esc_html($tab['title'])
277 277
 					);
278 278
 				endforeach;
279 279
 				?>
280 280
 			</h2>
281 281
 
282 282
 			<div id="give-donor-card-wrapper">
283
-				<?php $callbacks[ $view ]( $donor ) ?>
283
+				<?php $callbacks[$view]($donor) ?>
284 284
 			</div>
285 285
 
286 286
 		<?php endif; ?>
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
  *
301 301
  * @return void
302 302
  */
303
-function give_donor_view( $donor ) {
303
+function give_donor_view($donor) {
304 304
 
305
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
305
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
306 306
 
307 307
 	/**
308 308
 	 * Fires in donor profile screen, above the donor card.
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @param object $donor The donor object being displayed.
313 313
 	 */
314
-	do_action( 'give_donor_card_top', $donor );
314
+	do_action('give_donor_card_top', $donor);
315 315
 
316 316
 	// Set Read only to the fields which needs to be locked.
317 317
 	$read_only = '';
318
-	if ( $donor->user_id ) {
318
+	if ($donor->user_id) {
319 319
 		$read_only = 'readonly="readonly"';
320 320
 	}
321 321
 	?>
@@ -323,32 +323,32 @@  discard block
 block discarded – undo
323 323
 	<div id="donor-summary" class="info-wrapper donor-section postbox">
324 324
 
325 325
 		<form id="edit-donor-info" method="post"
326
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
326
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
327 327
 
328 328
 			<div class="donor-info">
329 329
 
330 330
 				<div class="donor-bio-header clearfix">
331 331
 
332 332
 					<div class="avatar-wrap left" id="donor-avatar">
333
-						<?php echo get_avatar( $donor->email ); ?>
333
+						<?php echo get_avatar($donor->email); ?>
334 334
 					</div>
335 335
 
336 336
 					<div id="donor-name-wrap" class="left">
337 337
 						<span class="donor-name info-item edit-item">
338 338
 							<input <?php echo $read_only; ?> size="15" data-key="first_name"
339 339
 							                                 name="customerinfo[first_name]" type="text"
340
-							                                 value="<?php esc_attr_e( $donor->get_first_name() ); ?>"
341
-							                                 placeholder="<?php _e( 'First Name', 'give' ); ?>"/>
342
-							<?php if ( $donor->user_id ) : ?>
340
+							                                 value="<?php esc_attr_e($donor->get_first_name()); ?>"
341
+							                                 placeholder="<?php _e('First Name', 'give'); ?>"/>
342
+							<?php if ($donor->user_id) : ?>
343 343
 								<a href="#" class="give-lock-block">
344 344
 									<i class="give-icon give-icon-locked"></i>
345 345
 								</a>
346 346
 							<?php endif; ?>
347 347
 							<input <?php echo $read_only; ?> size="15" data-key="last_name"
348 348
 							                                 name="customerinfo[last_name]" type="text"
349
-							                                 value="<?php esc_attr_e( $donor->get_last_name() ); ?>"
350
-							                                 placeholder="<?php _e( 'Last Name', 'give' ); ?>"/>
351
-							<?php if ( $donor->user_id ) : ?>
349
+							                                 value="<?php esc_attr_e($donor->get_last_name()); ?>"
350
+							                                 placeholder="<?php _e('Last Name', 'give'); ?>"/>
351
+							<?php if ($donor->user_id) : ?>
352 352
 								<a href="#" class="give-lock-block">
353 353
 									<i class="give-icon give-icon-locked"></i>
354 354
 								</a>
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 									data-key="name"><?php echo $donor->name; ?></span></span>
359 359
 					</div>
360 360
 					<p class="donor-since info-item">
361
-						<?php _e( 'Donor since', 'give' ); ?>
362
-						<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
361
+						<?php _e('Donor since', 'give'); ?>
362
+						<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
363 363
 					</p>
364
-					<?php if ( current_user_can( $donor_edit_role ) ) : ?>
364
+					<?php if (current_user_can($donor_edit_role)) : ?>
365 365
 						<a href="#" id="edit-donor"
366
-						   class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
366
+						   class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
367 367
 					<?php endif; ?>
368 368
 				</div>
369 369
 				<!-- /donor-bio-header -->
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
 					<table class="widefat striped">
374 374
 						<tbody>
375 375
 						<tr>
376
-							<th scope="col"><label for="tablecell"><?php _e( 'Donor ID:', 'give' ); ?></label></th>
376
+							<th scope="col"><label for="tablecell"><?php _e('Donor ID:', 'give'); ?></label></th>
377 377
 							<td><?php echo $donor->id; ?></td>
378 378
 						</tr>
379 379
 						<tr>
380
-							<th scope="col"><label for="tablecell"><?php _e( 'User ID:', 'give' ); ?></label></th>
380
+							<th scope="col"><label for="tablecell"><?php _e('User ID:', 'give'); ?></label></th>
381 381
 							<td>
382 382
 									<span class="donor-user-id info-item edit-item">
383 383
 										<?php
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 											'data'  => $data_atts,
395 395
 										);
396 396
 
397
-										if ( ! empty( $user_id ) ) {
398
-											$userdata              = get_userdata( $user_id );
397
+										if ( ! empty($user_id)) {
398
+											$userdata              = get_userdata($user_id);
399 399
 											$user_args['selected'] = $user_id;
400 400
 										}
401 401
 
402
-										echo Give()->html->ajax_user_search( $user_args );
402
+										echo Give()->html->ajax_user_search($user_args);
403 403
 										?>
404 404
 									</span>
405 405
 
406 406
 								<span class="donor-user-id info-item editable">
407
-										<?php if ( ! empty( $userdata ) ) : ?>
408
-											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
407
+										<?php if ( ! empty($userdata)) : ?>
408
+											<span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span>
409 409
 										<?php else: ?>
410
-											<span data-key="user_id"><?php _e( 'Unregistered', 'give' ); ?></span>
410
+											<span data-key="user_id"><?php _e('Unregistered', 'give'); ?></span>
411 411
 										<?php endif; ?>
412
-									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
412
+									<?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0):
413 413
 
414 414
 										echo sprintf(
415 415
 											'- <span class="disconnect-user">
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
 				                                       | <span class="view-user-profile">
419 419
  											                <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a>
420 420
  										               </span>',
421
-											__( 'Disconnects the current user ID from this donor record.', 'give' ),
422
-											__( 'Disconnect User', 'give' ),
423
-											'user-edit.php?user_id=' . $donor->user_id,
424
-											__( 'View User Profile of current user ID.', 'give' ),
425
-											__( 'View User Profile', 'give' )
421
+											__('Disconnects the current user ID from this donor record.', 'give'),
422
+											__('Disconnect User', 'give'),
423
+											'user-edit.php?user_id='.$donor->user_id,
424
+											__('View User Profile of current user ID.', 'give'),
425
+											__('View User Profile', 'give')
426 426
 										);
427 427
 
428 428
 										endif; ?>
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
 						</tr>
432 432
 
433 433
 						<?php
434
-						$donor_company = $donor->get_meta( '_give_donor_company', true );
434
+						$donor_company = $donor->get_meta('_give_donor_company', true);
435 435
 
436
-						if ( ! empty( $donor_company ) ) {
436
+						if ( ! empty($donor_company)) {
437 437
 							?>
438 438
 							<tr class="alternate">
439 439
 								<th scope="col">
440
-									<label for="tablecell"><?php _e( 'Company Name:', 'give' ); ?></label>
440
+									<label for="tablecell"><?php _e('Company Name:', 'give'); ?></label>
441 441
 								</th>
442 442
 								<td><?php echo $donor_company; ?></td>
443 443
 							</tr>
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 
454 454
 			<span id="donor-edit-actions" class="edit-item">
455 455
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/>
456
-				<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?>
456
+				<?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?>
457 457
 				<input type="hidden" name="give_action" value="edit-donor"/>
458 458
 				<input type="submit" id="give-edit-donor-save" class="button-secondary"
459
-				       value="<?php _e( 'Update Donor', 'give' ); ?>"/>
460
-				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
459
+				       value="<?php _e('Update Donor', 'give'); ?>"/>
460
+				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
461 461
 			</span>
462 462
 
463 463
 		</form>
@@ -472,24 +472,24 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @param Give_Donor $donor The donor object being displayed.
474 474
 	 */
475
-	do_action( 'give_donor_before_stats', $donor );
475
+	do_action('give_donor_before_stats', $donor);
476 476
 	?>
477 477
 
478 478
 	<div id="donor-stats-wrapper" class="donor-section postbox clear">
479 479
 		<ul>
480 480
 			<li>
481
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>">
481
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>">
482 482
 					<span class="dashicons dashicons-heart"></span>
483 483
 					<?php
484 484
 					// Completed Donations.
485
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count );
486
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor );
485
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count);
486
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor);
487 487
 					?>
488 488
 				</a>
489 489
 			</li>
490 490
 			<li>
491 491
 				<span class="dashicons dashicons-chart-area"></span>
492
-				<?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
492
+				<?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?>
493 493
 			</li>
494 494
 			<?php
495 495
 			/**
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 			 *
502 502
 			 * @param object $donor The donor object being displayed.
503 503
 			 */
504
-			do_action( 'give_donor_stats_list', $donor );
504
+			do_action('give_donor_stats_list', $donor);
505 505
 			?>
506 506
 		</ul>
507 507
 	</div>
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param Give_Donor $donor The donor object being displayed.
516 516
 	 */
517
-	do_action( 'give_donor_before_address', $donor );
517
+	do_action('give_donor_before_address', $donor);
518 518
 	?>
519 519
 
520 520
 	<div id="donor-address-wrapper" class="donor-section clear">
521
-		<h3><?php _e( 'Addresses', 'give' ); ?></h3>
521
+		<h3><?php _e('Addresses', 'give'); ?></h3>
522 522
 
523 523
 		<div class="postbox">
524 524
 			<div class="give-spinner-wrapper">
@@ -528,16 +528,16 @@  discard block
 block discarded – undo
528 528
 				<div class="all-address">
529 529
 					<div class="give-grid-row">
530 530
 						<?php
531
-						if ( ! empty( $donor->address ) ) :
531
+						if ( ! empty($donor->address)) :
532 532
 							// Default address always will be at zero array index.
533 533
 							$is_set_as_default = null;
534 534
 
535
-							foreach ( $donor->address as $address_type => $addresses ) {
535
+							foreach ($donor->address as $address_type => $addresses) {
536 536
 
537
-								switch ( true ) {
538
-									case is_array( end( $addresses ) ):
537
+								switch (true) {
538
+									case is_array(end($addresses)):
539 539
 										$index = 1;
540
-										foreach ( $addresses as $id => $address ) {
540
+										foreach ($addresses as $id => $address) {
541 541
 											echo __give_get_format_address(
542 542
 												$address,
543 543
 												array(
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
 												)
548 548
 											);
549 549
 
550
-											$index ++;
550
+											$index++;
551 551
 										}
552 552
 										break;
553 553
 
554
-									case is_string( end( $addresses ) ):
554
+									case is_string(end($addresses)):
555 555
 										echo __give_get_format_address(
556 556
 											$addresses,
557 557
 											array(
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 						endif;
565 565
 						?>
566 566
 					</div>
567
-					<span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) {
567
+					<span class="give-no-address-message<?php if ( ! empty($donor->address)) {
568 568
 						echo ' give-hidden';
569 569
 					} ?>">
570
-						<?php _e( 'This donor does not have any addresses saved.', 'give' ); ?>
570
+						<?php _e('This donor does not have any addresses saved.', 'give'); ?>
571 571
 					</span>
572 572
 					<button class="button add-new-address">
573
-						<?php _e( 'Add Address', 'give' ); ?>
573
+						<?php _e('Add Address', 'give'); ?>
574 574
 					</button>
575 575
 				</div>
576 576
 
@@ -580,26 +580,26 @@  discard block
 block discarded – undo
580 580
 							<tbody>
581 581
 							<tr>
582 582
 								<th class="col">
583
-									<label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label>
583
+									<label class="country"><?php esc_html_e('Country:', 'give'); ?></label>
584 584
 								</th>
585 585
 								<td>
586 586
 									<?php
587
-									echo Give()->html->select( array(
587
+									echo Give()->html->select(array(
588 588
 										'options'          => give_get_country_list(),
589 589
 										'name'             => 'country',
590
-										'selected'         => give_get_option( 'base_country' ),
590
+										'selected'         => give_get_option('base_country'),
591 591
 										'show_option_all'  => false,
592 592
 										'show_option_none' => false,
593 593
 										'chosen'           => true,
594
-										'placeholder'      => esc_attr__( 'Select a country', 'give' ),
595
-										'data'             => array( 'search-type' => 'no_ajax' ),
596
-									) );
594
+										'placeholder'      => esc_attr__('Select a country', 'give'),
595
+										'data'             => array('search-type' => 'no_ajax'),
596
+									));
597 597
 									?>
598 598
 								</td>
599 599
 							</tr>
600 600
 							<tr>
601 601
 								<th class="col">
602
-									<label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
602
+									<label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label>
603 603
 								</th>
604 604
 								<td>
605 605
 									<input id="line1" name="line1" type="text" class="medium-text"/>
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 							</tr>
608 608
 							<tr>
609 609
 								<th class="col">
610
-									<label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
610
+									<label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label>
611 611
 								</th>
612 612
 								<td>
613 613
 									<input id="line2" type="text" name="line2" value="" class="medium-text"/>
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 							</tr>
617 617
 							<tr>
618 618
 								<th class="col">
619
-									<label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label>
619
+									<label for="city"><?php esc_html_e('City:', 'give'); ?></label>
620 620
 								</th>
621 621
 								<td>
622 622
 									<input id="city" type="text" name="city" value="" class="medium-text"/>
@@ -624,41 +624,41 @@  discard block
 block discarded – undo
624 624
 							</tr>
625 625
 							<?php
626 626
 							$no_states_country = give_no_states_country_list();
627
-							$base_country      = give_get_option( 'base_country' );
628
-							if ( ! array_key_exists( $base_country, $no_states_country ) ) {
627
+							$base_country      = give_get_option('base_country');
628
+							if ( ! array_key_exists($base_country, $no_states_country)) {
629 629
 								?>
630 630
 								<tr class="give-field-wrap">
631 631
 									<th class="col">
632
-										<label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
632
+										<label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
633 633
 									</th>
634 634
 									<td>
635 635
 										<?php
636
-										$states     = give_get_states( $base_country );
636
+										$states     = give_get_states($base_country);
637 637
 										$state_args = array(
638 638
 											'name'  => 'state',
639 639
 											'class' => 'regular-text',
640 640
 										);
641 641
 
642
-										if ( empty( $states ) ) {
642
+										if (empty($states)) {
643 643
 
644 644
 											// Show Text field, if empty states.
645
-											$state_args = wp_parse_args( $state_args, array(
646
-												'value' => give_get_option( 'base_state' ),
647
-											) );
648
-											echo Give()->html->text( $state_args );
645
+											$state_args = wp_parse_args($state_args, array(
646
+												'value' => give_get_option('base_state'),
647
+											));
648
+											echo Give()->html->text($state_args);
649 649
 										} else {
650 650
 
651 651
 											// Show Chosen DropDown, if states are not empty.
652
-											$state_args = wp_parse_args( $state_args, array(
652
+											$state_args = wp_parse_args($state_args, array(
653 653
 												'options'          => $states,
654
-												'selected'         => give_get_option( 'base_state' ),
654
+												'selected'         => give_get_option('base_state'),
655 655
 												'show_option_all'  => false,
656 656
 												'show_option_none' => false,
657 657
 												'chosen'           => true,
658
-												'placeholder'      => __( 'Select a state', 'give' ),
659
-												'data'             => array( 'search-type' => 'no_ajax' ),
660
-											) );
661
-											echo Give()->html->select( $state_args );
658
+												'placeholder'      => __('Select a state', 'give'),
659
+												'data'             => array('search-type' => 'no_ajax'),
660
+											));
661
+											echo Give()->html->select($state_args);
662 662
 										}
663 663
 										?>
664 664
 									</td>
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 							?>
669 669
 							<tr>
670 670
 								<th class="col">
671
-									<label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
671
+									<label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
672 672
 								</th>
673 673
 								<td>
674 674
 									<input id="zip" type="text" name="zip" value="" class="medium-text"/>
@@ -676,12 +676,12 @@  discard block
 block discarded – undo
676 676
 							</tr>
677 677
 							<tr>
678 678
 								<td colspan="2">
679
-									<?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?>
679
+									<?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?>
680 680
 									<input type="hidden" name="address-action" value="add">
681 681
 									<input type="hidden" name="address-id" value="">
682 682
 									<input type="submit" class="button button-primary js-save"
683
-									       value="<?php _e( 'Save', 'give' ); ?>">&nbsp;&nbsp;<button
684
-											class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button>
683
+									       value="<?php _e('Save', 'give'); ?>">&nbsp;&nbsp;<button
684
+											class="button js-cancel"><?php _e('Cancel', 'give'); ?></button>
685 685
 								</td>
686 686
 							</tr>
687 687
 							</tbody>
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @param Give_Donor $donor The donor object being displayed.
702 702
 	 */
703
-	do_action( 'give_donor_before_tables_wrapper', $donor );
703
+	do_action('give_donor_before_tables_wrapper', $donor);
704 704
 	?>
705 705
 
706 706
 	<div id="donor-tables-wrapper" class="donor-section">
@@ -713,46 +713,46 @@  discard block
 block discarded – undo
713 713
 		 *
714 714
 		 * @param object $donor The donor object being displayed.
715 715
 		 */
716
-		do_action( 'give_donor_before_tables', $donor );
716
+		do_action('give_donor_before_tables', $donor);
717 717
 		?>
718 718
 
719
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
719
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
720 720
 
721 721
 		<table class="wp-list-table widefat striped emails">
722 722
 			<thead>
723 723
 			<tr>
724
-				<th><?php _e( 'Email', 'give' ); ?></th>
725
-				<th><?php _e( 'Actions', 'give' ); ?></th>
724
+				<th><?php _e('Email', 'give'); ?></th>
725
+				<th><?php _e('Actions', 'give'); ?></th>
726 726
 			</tr>
727 727
 			</thead>
728 728
 
729 729
 			<tbody>
730
-			<?php if ( ! empty( $donor->emails ) ) { ?>
730
+			<?php if ( ! empty($donor->emails)) { ?>
731 731
 
732
-				<?php foreach ( $donor->emails as $key => $email ) : ?>
732
+				<?php foreach ($donor->emails as $key => $email) : ?>
733 733
 					<tr data-key="<?php echo $key; ?>">
734 734
 						<td>
735 735
 							<?php echo $email; ?>
736
-							<?php if ( 'primary' === $key ) : ?>
736
+							<?php if ('primary' === $key) : ?>
737 737
 								<span class="dashicons dashicons-star-filled primary-email-icon"></span>
738 738
 							<?php endif; ?>
739 739
 						</td>
740 740
 						<td>
741
-							<?php if ( 'primary' !== $key ) : ?>
741
+							<?php if ('primary' !== $key) : ?>
742 742
 								<?php
743
-								$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id );
744
-								$promote_url = wp_nonce_url( add_query_arg( array(
745
-									'email'       => rawurlencode( $email ),
743
+								$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id);
744
+								$promote_url = wp_nonce_url(add_query_arg(array(
745
+									'email'       => rawurlencode($email),
746 746
 									'give_action' => 'set_donor_primary_email',
747
-								), $base_url ), 'give-set-donor-primary-email' );
748
-								$remove_url  = wp_nonce_url( add_query_arg( array(
749
-									'email'       => rawurlencode( $email ),
747
+								), $base_url), 'give-set-donor-primary-email');
748
+								$remove_url = wp_nonce_url(add_query_arg(array(
749
+									'email'       => rawurlencode($email),
750 750
 									'give_action' => 'remove_donor_email',
751
-								), $base_url ), 'give-remove-donor-email' );
751
+								), $base_url), 'give-remove-donor-email');
752 752
 								?>
753
-								<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
753
+								<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
754 754
 								&nbsp;|&nbsp;
755
-								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
755
+								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
756 756
 							<?php endif; ?>
757 757
 						</td>
758 758
 					</tr>
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 					<td colspan="2" class="add-donor-email-td">
763 763
 						<div class="add-donor-email-wrapper">
764 764
 							<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/>
765
-							<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
765
+							<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
766 766
 							<input type="email" name="additional-email" value=""
767
-							       placeholder="<?php _e( 'Email Address', 'give' ); ?>"/>&nbsp;
767
+							       placeholder="<?php _e('Email Address', 'give'); ?>"/>&nbsp;
768 768
 							<input type="checkbox" name="make-additional-primary" value="1"
769 769
 							       id="make-additional-primary"/>&nbsp;<label
770
-									for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
770
+									for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
771 771
 							<button class="button-secondary give-add-donor-email"
772
-							        id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button>
772
+							        id="add-donor-email"><?php _e('Add Email', 'give'); ?></button>
773 773
 							<span class="spinner"></span>
774 774
 						</div>
775 775
 						<div class="notice-wrap"></div>
@@ -777,50 +777,50 @@  discard block
 block discarded – undo
777 777
 				</tr>
778 778
 			<?php } else { ?>
779 779
 				<tr>
780
-					<td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td>
780
+					<td colspan="2"><?php _e('No Emails Found', 'give'); ?></td>
781 781
 				</tr>
782 782
 			<?php }// End if().
783 783
 			?>
784 784
 			</tbody>
785 785
 		</table>
786 786
 
787
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
787
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
788 788
 		<?php
789
-		$payment_ids = explode( ',', $donor->payment_ids );
790
-		$payments    = give_get_payments( array(
789
+		$payment_ids = explode(',', $donor->payment_ids);
790
+		$payments    = give_get_payments(array(
791 791
 			'post__in' => $payment_ids,
792
-		) );
793
-		$payments    = array_slice( $payments, 0, 10 );
792
+		));
793
+		$payments    = array_slice($payments, 0, 10);
794 794
 		?>
795 795
 		<table class="wp-list-table widefat striped payments">
796 796
 			<thead>
797 797
 			<tr>
798
-				<th scope="col"><?php _e( 'ID', 'give' ); ?></th>
799
-				<th scope="col"><?php _e( 'Amount', 'give' ); ?></th>
800
-				<th scope="col"><?php _e( 'Date', 'give' ); ?></th>
801
-				<th scope="col"><?php _e( 'Status', 'give' ); ?></th>
802
-				<th scope="col"><?php _e( 'Actions', 'give' ); ?></th>
798
+				<th scope="col"><?php _e('ID', 'give'); ?></th>
799
+				<th scope="col"><?php _e('Amount', 'give'); ?></th>
800
+				<th scope="col"><?php _e('Date', 'give'); ?></th>
801
+				<th scope="col"><?php _e('Status', 'give'); ?></th>
802
+				<th scope="col"><?php _e('Actions', 'give'); ?></th>
803 803
 			</tr>
804 804
 			</thead>
805 805
 			<tbody>
806
-			<?php if ( ! empty( $payments ) ) { ?>
807
-				<?php foreach ( $payments as $payment ) : ?>
806
+			<?php if ( ! empty($payments)) { ?>
807
+				<?php foreach ($payments as $payment) : ?>
808 808
 					<tr>
809
-						<td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td>
810
-						<td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td>
811
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
812
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
809
+						<td><?php echo Give()->seq_donation_number->get_serial_code($payment->ID); ?></td>
810
+						<td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td>
811
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
812
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
813 813
 						<td>
814 814
 							<?php
815 815
 							printf(
816 816
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
817
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
817
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID),
818 818
 								sprintf(
819 819
 								/* translators: %s: Donation ID */
820
-									esc_attr__( 'View Donation %s.', 'give' ),
820
+									esc_attr__('View Donation %s.', 'give'),
821 821
 									$payment->ID
822 822
 								),
823
-								__( 'View Donation', 'give' )
823
+								__('View Donation', 'give')
824 824
 							);
825 825
 							?>
826 826
 
@@ -835,47 +835,47 @@  discard block
 block discarded – undo
835 835
 							 * @param object $donor   The donor object being displayed.
836 836
 							 * @param object $payment The payment object being displayed.
837 837
 							 */
838
-							do_action( 'give_donor_recent_purchases_actions', $donor, $payment );
838
+							do_action('give_donor_recent_purchases_actions', $donor, $payment);
839 839
 							?>
840 840
 						</td>
841 841
 					</tr>
842 842
 				<?php endforeach; ?>
843 843
 			<?php } else { ?>
844 844
 				<tr>
845
-					<td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td>
845
+					<td colspan="5"><?php _e('No donations found.', 'give'); ?></td>
846 846
 				</tr>
847 847
 			<?php }// End if().
848 848
 			?>
849 849
 			</tbody>
850 850
 		</table>
851 851
 
852
-		<h3><?php _e( 'Completed Forms', 'give' ); ?></h3>
852
+		<h3><?php _e('Completed Forms', 'give'); ?></h3>
853 853
 		<?php
854
-		$donations = give_get_users_completed_donations( $donor->email );
854
+		$donations = give_get_users_completed_donations($donor->email);
855 855
 		?>
856 856
 		<table class="wp-list-table widefat striped donations">
857 857
 			<thead>
858 858
 			<tr>
859
-				<th scope="col"><?php _e( 'Form', 'give' ); ?></th>
860
-				<th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th>
859
+				<th scope="col"><?php _e('Form', 'give'); ?></th>
860
+				<th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th>
861 861
 			</tr>
862 862
 			</thead>
863 863
 			<tbody>
864
-			<?php if ( ! empty( $donations ) ) { ?>
865
-				<?php foreach ( $donations as $donation ) : ?>
864
+			<?php if ( ! empty($donations)) { ?>
865
+				<?php foreach ($donations as $donation) : ?>
866 866
 					<tr>
867 867
 						<td><?php echo $donation->post_title; ?></td>
868 868
 						<td>
869 869
 							<?php
870 870
 							printf(
871 871
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
872
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
872
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
873 873
 								sprintf(
874 874
 								/* translators: %s: form name */
875
-									esc_attr__( 'View Form %s.', 'give' ),
875
+									esc_attr__('View Form %s.', 'give'),
876 876
 									$donation->post_title
877 877
 								),
878
-								__( 'View Form', 'give' )
878
+								__('View Form', 'give')
879 879
 							);
880 880
 							?>
881 881
 						</td>
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 				<?php endforeach; ?>
884 884
 			<?php } else { ?>
885 885
 				<tr>
886
-					<td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td>
886
+					<td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td>
887 887
 				</tr>
888 888
 			<?php } ?>
889 889
 			</tbody>
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		 *
898 898
 		 * @param object $donor The donor object being displayed.
899 899
 		 */
900
-		do_action( 'give_donor_after_tables', $donor );
900
+		do_action('give_donor_after_tables', $donor);
901 901
 		?>
902 902
 
903 903
 	</div>
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	 *
911 911
 	 * @param object $donor The donor object being displayed.
912 912
 	 */
913
-	do_action( 'give_donor_card_bottom', $donor );
913
+	do_action('give_donor_card_bottom', $donor);
914 914
 
915 915
 }
916 916
 
@@ -923,31 +923,31 @@  discard block
 block discarded – undo
923 923
  *
924 924
  * @return void
925 925
  */
926
-function give_donor_notes_view( $donor ) {
926
+function give_donor_notes_view($donor) {
927 927
 
928
-	$paged       = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
929
-	$paged       = absint( $paged );
928
+	$paged       = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
929
+	$paged       = absint($paged);
930 930
 	$note_count  = $donor->get_notes_count();
931
-	$per_page    = apply_filters( 'give_donor_notes_per_page', 20 );
932
-	$total_pages = ceil( $note_count / $per_page );
933
-	$donor_notes = $donor->get_notes( $per_page, $paged );
931
+	$per_page    = apply_filters('give_donor_notes_per_page', 20);
932
+	$total_pages = ceil($note_count / $per_page);
933
+	$donor_notes = $donor->get_notes($per_page, $paged);
934 934
 	?>
935 935
 
936 936
 	<div id="donor-notes-wrapper">
937 937
 		<div class="donor-notes-header">
938
-			<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
938
+			<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
939 939
 		</div>
940
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
940
+		<h3><?php _e('Notes', 'give'); ?></h3>
941 941
 
942
-		<?php if ( 1 == $paged ) : ?>
942
+		<?php if (1 == $paged) : ?>
943 943
 			<div style="display: block; margin-bottom: 55px;">
944 944
 				<form id="give-add-donor-note" method="post"
945
-				      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>">
945
+				      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>">
946 946
 					<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea>
947 947
 					<br/>
948 948
 					<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/>
949 949
 					<input type="hidden" name="give_action" value="add-donor-note"/>
950
-					<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?>
950
+					<?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?>
951 951
 					<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/>
952 952
 				</form>
953 953
 			</div>
@@ -962,26 +962,26 @@  discard block
 block discarded – undo
962 962
 			'show_all' => true,
963 963
 		);
964 964
 
965
-		echo paginate_links( $pagination_args );
965
+		echo paginate_links($pagination_args);
966 966
 		?>
967 967
 
968 968
 		<div id="give-donor-notes" class="postbox">
969
-			<?php if ( count( $donor_notes ) > 0 ) { ?>
970
-				<?php foreach ( $donor_notes as $key => $note ) : ?>
969
+			<?php if (count($donor_notes) > 0) { ?>
970
+				<?php foreach ($donor_notes as $key => $note) : ?>
971 971
 					<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
972 972
 					<span class="note-content-wrap">
973
-						<?php echo stripslashes( $note ); ?>
973
+						<?php echo stripslashes($note); ?>
974 974
 					</span>
975 975
 					</div>
976 976
 				<?php endforeach; ?>
977 977
 			<?php } else { ?>
978 978
 				<div class="give-no-donor-notes">
979
-					<?php _e( 'No donor notes found.', 'give' ); ?>
979
+					<?php _e('No donor notes found.', 'give'); ?>
980 980
 				</div>
981 981
 			<?php } ?>
982 982
 		</div>
983 983
 
984
-		<?php echo paginate_links( $pagination_args ); ?>
984
+		<?php echo paginate_links($pagination_args); ?>
985 985
 
986 986
 	</div>
987 987
 
@@ -997,9 +997,9 @@  discard block
 block discarded – undo
997 997
  *
998 998
  * @return void
999 999
  */
1000
-function give_donor_delete_view( $donor ) {
1000
+function give_donor_delete_view($donor) {
1001 1001
 
1002
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
1002
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
1003 1003
 
1004 1004
 	/**
1005 1005
 	 * Fires in donor delete screen, above the content.
@@ -1008,16 +1008,16 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @param object $donor The donor object being displayed.
1010 1010
 	 */
1011
-	do_action( 'give_donor_delete_top', $donor );
1011
+	do_action('give_donor_delete_top', $donor);
1012 1012
 	?>
1013 1013
 
1014 1014
 	<div class="info-wrapper donor-section">
1015 1015
 
1016 1016
 		<form id="delete-donor" method="post"
1017
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>">
1017
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>">
1018 1018
 
1019 1019
 			<div class="donor-notes-header">
1020
-				<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
1020
+				<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
1021 1021
 			</div>
1022 1022
 
1023 1023
 
@@ -1025,20 +1025,20 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
 				<span class="delete-donor-options">
1027 1027
 					<p>
1028
-						<?php echo Give()->html->checkbox( array(
1028
+						<?php echo Give()->html->checkbox(array(
1029 1029
 							'name' => 'give-donor-delete-confirm',
1030
-						) ); ?>
1031
-						<label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
1030
+						)); ?>
1031
+						<label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
1032 1032
 					</p>
1033 1033
 
1034 1034
 					<p>
1035
-						<?php echo Give()->html->checkbox( array(
1035
+						<?php echo Give()->html->checkbox(array(
1036 1036
 							'name'    => 'give-donor-delete-records',
1037 1037
 							'options' => array(
1038 1038
 								'disabled' => true,
1039 1039
 							),
1040
-						) ); ?>
1041
-						<label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label>
1040
+						)); ?>
1041
+						<label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label>
1042 1042
 					</p>
1043 1043
 
1044 1044
 					<?php
@@ -1051,19 +1051,19 @@  discard block
 block discarded – undo
1051 1051
 					 *
1052 1052
 					 * @param object $donor The donor object being displayed.
1053 1053
 					 */
1054
-					do_action( 'give_donor_delete_inputs', $donor );
1054
+					do_action('give_donor_delete_inputs', $donor);
1055 1055
 					?>
1056 1056
 				</span>
1057 1057
 
1058 1058
 				<span id="donor-edit-actions">
1059 1059
 					<input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/>
1060
-					<?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?>
1060
+					<?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?>
1061 1061
 					<input type="hidden" name="give_action" value="delete-donor"/>
1062 1062
 					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary"
1063
-					       value="<?php _e( 'Delete Donor', 'give' ); ?>"/>
1063
+					       value="<?php _e('Delete Donor', 'give'); ?>"/>
1064 1064
 					<a id="give-delete-donor-cancel"
1065
-					   href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"
1066
-					   class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
1065
+					   href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"
1066
+					   class="delete"><?php _e('Cancel', 'give'); ?></a>
1067 1067
 				</span>
1068 1068
 
1069 1069
 			</div>
@@ -1079,5 +1079,5 @@  discard block
 block discarded – undo
1079 1079
 	 *
1080 1080
 	 * @param object $donor The donor object being displayed.
1081 1081
 	 */
1082
-	do_action( 'give_donor_delete_bottom', $donor );
1082
+	do_action('give_donor_delete_bottom', $donor);
1083 1083
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -406,8 +406,11 @@
 block discarded – undo
406 406
 								<span class="donor-user-id info-item editable">
407 407
 										<?php if ( ! empty( $userdata ) ) : ?>
408 408
 											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
409
-										<?php else: ?>
410
-											<span data-key="user_id"><?php _e( 'Unregistered', 'give' ); ?></span>
409
+										<?php else {
410
+	: ?>
411
+											<span data-key="user_id"><?php _e( 'Unregistered', 'give' );
412
+}
413
+?></span>
411 414
 										<?php endif; ?>
412 415
 									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
413 416
 
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +15 added lines, -15 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
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 function give_add_ons_page() {
26 26
 	?>
27 27
 	<div class="wrap" id="give-add-ons">
28
-		<h1><?php echo esc_html( get_admin_page_title() ); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
28
+		<h1><?php echo esc_html(get_admin_page_title()); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php give_add_ons_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
 function give_add_ons_feed() {
50 50
 
51 51
 	$addons_debug = false; //set to true to debug
52
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
52
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
53 53
 
54
-	if ( false === $cache || ( true === $addons_debug && true === WP_DEBUG ) ) {
55
-		if ( function_exists( 'vip_safe_wp_remote_get' ) ) {
56
-			$feed = vip_safe_wp_remote_get( 'https://givewp.com/downloads/feed/', false, 3, 1, 20, array( 'sslverify' => false ) );
54
+	if (false === $cache || (true === $addons_debug && true === WP_DEBUG)) {
55
+		if (function_exists('vip_safe_wp_remote_get')) {
56
+			$feed = vip_safe_wp_remote_get('https://givewp.com/downloads/feed/', false, 3, 1, 20, array('sslverify' => false));
57 57
 		} else {
58
-			$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
58
+			$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
59 59
 		}
60 60
 
61
-		if ( ! is_wp_error( $feed ) && ! empty( $feed ) ) {
62
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
63
-				$cache = wp_remote_retrieve_body( $feed );
64
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
61
+		if ( ! is_wp_error($feed) && ! empty($feed)) {
62
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
63
+				$cache = wp_remote_retrieve_body($feed);
64
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
65 65
 			}
66 66
 		} else {
67 67
 			$cache = sprintf(
68 68
 				'<div class="error"><p>%s</p></div>',
69
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
69
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
70 70
 			);
71 71
 		}
72 72
 	}
73 73
 
74
-	echo wp_kses_post( $cache );
74
+	echo wp_kses_post($cache);
75 75
 }
Please login to merge, or discard this patch.
includes/admin/class-blank-slate.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8.13
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -75,63 +75,63 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function init() {
77 77
 		// Bail early if screen cannot be detected.
78
-		if ( empty( $this->screen ) ) {
78
+		if (empty($this->screen)) {
79 79
 			return null;
80 80
 		}
81 81
 
82 82
 		$content = array();
83 83
 
84 84
 		// Define content and hook into the appropriate action.
85
-		switch ( $this->screen ) {
85
+		switch ($this->screen) {
86 86
 			// Forms screen.
87 87
 			case 'edit-give_forms':
88
-				$this->form = $this->post_exists( 'give_forms' );
88
+				$this->form = $this->post_exists('give_forms');
89 89
 
90
-				if ( $this->form ) {
90
+				if ($this->form) {
91 91
 					// Form exists. Bail out.
92 92
 					return false;
93 93
 				} else {
94 94
 					// No forms exist.
95
-					$content = $this->get_content( 'no_forms' );
95
+					$content = $this->get_content('no_forms');
96 96
 				}
97 97
 
98
-				add_action( 'manage_posts_extra_tablenav', array( $this, 'render' ) );
98
+				add_action('manage_posts_extra_tablenav', array($this, 'render'));
99 99
 				break;
100 100
 			// Donations screen.
101 101
 			case 'give_forms_page_give-payment-history':
102
-				$this->form     = $this->post_exists( 'give_forms' );
103
-				$this->donation = $this->post_exists( 'give_payment' );
102
+				$this->form     = $this->post_exists('give_forms');
103
+				$this->donation = $this->post_exists('give_payment');
104 104
 
105
-				if ( $this->donation ) {
105
+				if ($this->donation) {
106 106
 					// Donation exists. Bail out.
107 107
 					return false;
108
-				} elseif ( ! $this->form ) {
108
+				} elseif ( ! $this->form) {
109 109
 					// No forms and no donations exist.
110
-					$content = $this->get_content( 'no_donations_or_forms' );
110
+					$content = $this->get_content('no_donations_or_forms');
111 111
 				} else {
112 112
 					// No donations exist but a form does exist.
113
-					$content = $this->get_content( 'no_donations' );
113
+					$content = $this->get_content('no_donations');
114 114
 				}
115 115
 
116
-				add_action( 'give_payments_page_bottom', array( $this, 'render' ) );
116
+				add_action('give_payments_page_bottom', array($this, 'render'));
117 117
 				break;
118 118
 			// Donors screen.
119 119
 			case 'give_forms_page_give-donors':
120
-				$this->form  = $this->post_exists( 'give_forms' );
120
+				$this->form  = $this->post_exists('give_forms');
121 121
 				$this->donor = $this->donor_exists();
122 122
 
123
-				if ( $this->donor ) {
123
+				if ($this->donor) {
124 124
 					// Donor exists. Bail out.
125 125
 					return false;
126
-				} elseif ( ! $this->form ) {
126
+				} elseif ( ! $this->form) {
127 127
 					// No forms and no donors exist.
128
-					$content = $this->get_content( 'no_donors_or_forms' );
128
+					$content = $this->get_content('no_donors_or_forms');
129 129
 				} else {
130 130
 					// No donors exist but a form does exist.
131
-					$content = $this->get_content( 'no_donors' );
131
+					$content = $this->get_content('no_donors');
132 132
 				}
133 133
 
134
-				add_action( 'give_donors_table_bottom', array( $this, 'render' ) );
134
+				add_action('give_donors_table_bottom', array($this, 'render'));
135 135
 				break;
136 136
 			default:
137 137
 				return null;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$this->content = $content;
141 141
 
142 142
 		// Hide non-essential UI elements.
143
-		add_action( 'admin_head', array( $this, 'hide_ui' ) );
143
+		add_action('admin_head', array($this, 'hide_ui'));
144 144
 	}
145 145
 
146 146
 	/**
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param string $which The location of the list table hook: 'top' or 'bottom'.
152 152
 	 */
153
-	public function render( $which = 'bottom' ) {
153
+	public function render($which = 'bottom') {
154 154
 		// Bail out to prevent content from rendering twice.
155
-		if ( 'top' === $which ) {
155
+		if ('top' === $which) {
156 156
 			return null;
157 157
 		}
158 158
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 		 *
178 178
 		 * @param string $screen The current screen ID.
179 179
 		 */
180
-		$content = apply_filters( 'give_blank_slate_content', $this->content, $screen );
180
+		$content = apply_filters('give_blank_slate_content', $this->content, $screen);
181 181
 
182
-		$template_path = GIVE_PLUGIN_DIR . 'includes/admin/views/blank-slate.php';
182
+		$template_path = GIVE_PLUGIN_DIR.'includes/admin/views/blank-slate.php';
183 183
 
184 184
 		include $template_path;
185 185
 	}
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
 	 * @param string $post_type Post type used in the query.
215 215
 	 * @return bool True if post exists, otherwise false.
216 216
 	 */
217
-	private function post_exists( $post_type ) {
217
+	private function post_exists($post_type) {
218 218
 		// Attempt to get a single post of the post type.
219
-		$query = new WP_Query( array(
219
+		$query = new WP_Query(array(
220 220
 			'post_type'              => $post_type,
221 221
 			'posts_per_page'         => 1,
222 222
 			'no_found_rows'          => false,
223 223
 			'update_post_meta_cache' => false,
224 224
 			'update_post_term_cache' => false,
225 225
 			'fields'                 => 'ids',
226
-			'post_status'            => array( 'any', 'trash' ),
227
-		) );
226
+			'post_status'            => array('any', 'trash'),
227
+		));
228 228
 
229 229
 		return $query->have_posts();
230 230
 	}
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	 * @return bool True if donor exists, otherwise false.
238 238
 	 */
239 239
 	private function donor_exists() {
240
-		$donors = Give()->donors->get_donors( array( 'number' => 1 ) );
240
+		$donors = Give()->donors->get_donors(array('number' => 1));
241 241
 
242
-		return ! empty( $donors );
242
+		return ! empty($donors);
243 243
 	}
244 244
 
245 245
 	/**
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 	 * @param string $context The key used to determine which content is returned.
251 251
 	 * @return array Blank slate content.
252 252
 	 */
253
-	private function get_content( $context ) {
253
+	private function get_content($context) {
254 254
 		// Define default content.
255 255
 		$defaults = array(
256
-			'image_url' => GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg',
257
-			'image_alt' => __( 'Give Icon', 'give' ),
258
-			'heading'   => __( 'No donation forms  found.', 'give' ),
259
-			'message'   => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
260
-			'cta_text'  => __( 'Create Donation Form', 'give' ),
261
-			'cta_link'  => admin_url( 'post-new.php?post_type=give_forms' ),
256
+			'image_url' => GIVE_PLUGIN_URL.'assets/dist/images/give-icon-full-circle.svg',
257
+			'image_alt' => __('Give Icon', 'give'),
258
+			'heading'   => __('No donation forms  found.', 'give'),
259
+			'message'   => __('The first step towards accepting online donations is to create a form.', 'give'),
260
+			'cta_text'  => __('Create Donation Form', 'give'),
261
+			'cta_link'  => admin_url('post-new.php?post_type=give_forms'),
262 262
 			'help'      => sprintf(
263 263
 				/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
264
-				__( 'Need help? Get started with %1$sGive 101%2$s.', 'give' ),
264
+				__('Need help? Get started with %1$sGive 101%2$s.', 'give'),
265 265
 				'<a href="http://docs.givewp.com/give101/" target="_blank">',
266 266
 				'</a>'
267 267
 			),
@@ -270,42 +270,42 @@  discard block
 block discarded – undo
270 270
 		// Define contextual content.
271 271
 		$content = array(
272 272
 			'no_donations_or_forms' => array(
273
-				'heading' => __( 'No donations found.', 'give' ),
274
-				'message' => __( 'Your donation history will appear here, but first, you need a donation form!', 'give' ),
273
+				'heading' => __('No donations found.', 'give'),
274
+				'message' => __('Your donation history will appear here, but first, you need a donation form!', 'give'),
275 275
 			),
276 276
 			'no_donations'          => array(
277
-				'heading'  => __( 'No donations found.', 'give' ),
278
-				'message'  => __( 'When your first donation arrives, a record of the donation will appear here.', 'give' ),
279
-				'cta_text' => __( 'View All Forms', 'give' ),
280
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
277
+				'heading'  => __('No donations found.', 'give'),
278
+				'message'  => __('When your first donation arrives, a record of the donation will appear here.', 'give'),
279
+				'cta_text' => __('View All Forms', 'give'),
280
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
281 281
 				'help'     => sprintf(
282 282
 					/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
283
-					__( 'Need help? Learn more about %1$sDonations%2$s.', 'give' ),
283
+					__('Need help? Learn more about %1$sDonations%2$s.', 'give'),
284 284
 					'<a href="http://docs.givewp.com/core-donations/">',
285 285
 					'</a>'
286 286
 				),
287 287
 			),
288 288
 			'no_donors_or_forms'    => array(
289
-				'heading' => __( 'No donors  found.', 'give' ),
290
-				'message' => __( 'Your donor history will appear here, but first, you need a donation form!', 'give' ),
289
+				'heading' => __('No donors  found.', 'give'),
290
+				'message' => __('Your donor history will appear here, but first, you need a donation form!', 'give'),
291 291
 			),
292 292
 			'no_donors'             => array(
293
-				'heading'  => __( 'No donors found.', 'give' ),
294
-				'message'  => __( 'When your first donation arrives, the donor will appear here.', 'give' ),
295
-				'cta_text' => __( 'View All Forms', 'give' ),
296
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
293
+				'heading'  => __('No donors found.', 'give'),
294
+				'message'  => __('When your first donation arrives, the donor will appear here.', 'give'),
295
+				'cta_text' => __('View All Forms', 'give'),
296
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
297 297
 				'help'     => sprintf(
298 298
 					/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
299
-					__( 'Need help? Learn more about %1$sDonors%2$s.', 'give' ),
299
+					__('Need help? Learn more about %1$sDonors%2$s.', 'give'),
300 300
 					'<a href="http://docs.givewp.com/core-donors/">',
301 301
 					'</a>'
302 302
 				),
303 303
 			),
304 304
 		);
305 305
 
306
-		if ( isset( $content[ $context ] ) ) {
306
+		if (isset($content[$context])) {
307 307
 			// Merge contextual content with defaults.
308
-			return wp_parse_args( $content[ $context ], $defaults );
308
+			return wp_parse_args($content[$context], $defaults);
309 309
 		} else {
310 310
 			// Return defaults if context is undefined.
311 311
 			return $defaults;
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * Constructor.
55 55
 	 */
56
-	public function __construct( $_step = 1 ) {
57
-		parent::__construct( $_step );
56
+	public function __construct($_step = 1) {
57
+		parent::__construct($_step);
58 58
 
59 59
 		$this->is_writable = true;
60 60
 	}
@@ -69,43 +69,43 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function get_data() {
71 71
 
72
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
72
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
73 73
 
74
-		if ( $this->step == 1 ) {
75
-			$this->delete_data( 'give_temp_recount_form_stats' );
74
+		if ($this->step == 1) {
75
+			$this->delete_data('give_temp_recount_form_stats');
76 76
 		}
77 77
 
78
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
78
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
79 79
 
80
-		if ( false === $totals ) {
80
+		if (false === $totals) {
81 81
 			$totals = array(
82 82
 				'earnings' => (float) 0,
83 83
 				'sales'    => 0,
84 84
 			);
85
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
85
+			$this->store_data('give_temp_recount_form_stats', $totals);
86 86
 		}
87 87
 
88
-		$args = apply_filters( 'give_recount_form_stats_args', array(
88
+		$args = apply_filters('give_recount_form_stats_args', array(
89 89
 			'give_forms' => $this->form_id,
90 90
 			'number'     => $this->per_step,
91 91
 			'status'     => $accepted_statuses,
92 92
 			'paged'      => $this->step,
93 93
 			'fields'     => 'ids',
94
-		) );
94
+		));
95 95
 
96
-		$payments = new Give_Payments_Query( $args );
96
+		$payments = new Give_Payments_Query($args);
97 97
 		$payments = $payments->get_payments();
98 98
 
99
-		if ( $payments ) {
100
-			foreach ( $payments as $payment ) {
99
+		if ($payments) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Ensure acceptable status only.
103
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
103
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				// Ensure only payments for this form are counted.
108
-				if ( $payment->form_id != $this->form_id ) {
108
+				if ($payment->form_id != $this->form_id) {
109 109
 					continue;
110 110
 				}
111 111
 
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 				 */
117 117
 				$earning_amount = apply_filters(
118 118
 					'give_donation_amount',
119
-					give_format_amount( $payment->total, array( 'donation_id' => $payment->ID ) ),
119
+					give_format_amount($payment->total, array('donation_id' => $payment->ID)),
120 120
 					$payment->total,
121 121
 					$payment->ID,
122
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
122
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
123 123
 				);
124 124
 
125
-				$totals['sales'] ++;
126
-				$totals['earnings'] += (float) give_maybe_sanitize_amount( $earning_amount );
125
+				$totals['sales']++;
126
+				$totals['earnings'] += (float) give_maybe_sanitize_amount($earning_amount);
127 127
 
128 128
 			}
129 129
 
130
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
130
+			$this->store_data('give_temp_recount_form_stats', $totals);
131 131
 
132 132
 			return true;
133 133
 		}
134 134
 
135 135
 
136
-		give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
137
-		give_update_meta( $this->form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
136
+		give_update_meta($this->form_id, '_give_form_sales', $totals['sales']);
137
+		give_update_meta($this->form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
138 138
 
139 139
 		return false;
140 140
 	}
@@ -146,35 +146,35 @@  discard block
 block discarded – undo
146 146
 	 * @return int
147 147
 	 */
148 148
 	public function get_percentage_complete() {
149
-		if ( $this->step == 1 ) {
150
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
149
+		if ($this->step == 1) {
150
+			$this->delete_data('give_recount_total_'.$this->form_id);
151 151
 		}
152 152
 
153
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
154
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
153
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
154
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
155 155
 
156
-		if ( false === $total ) {
156
+		if (false === $total) {
157 157
 			$total = 0;
158
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
158
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
159 159
 				'give_forms' => $this->form_id,
160
-				'number'     => - 1,
160
+				'number'     => -1,
161 161
 				'status'     => $accepted_statuses,
162 162
 				'fields'     => 'ids',
163
-			) );
163
+			));
164 164
 
165
-			$payments = new Give_Payments_Query( $args );
166
-			$total    = count( $payments->get_payments() );
167
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
165
+			$payments = new Give_Payments_Query($args);
166
+			$total    = count($payments->get_payments());
167
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
168 168
 
169 169
 		}
170 170
 
171 171
 		$percentage = 100;
172 172
 
173
-		if ( $total > 0 ) {
174
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
173
+		if ($total > 0) {
174
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
175 175
 		}
176 176
 
177
-		if ( $percentage > 100 ) {
177
+		if ($percentage > 100) {
178 178
 			$percentage = 100;
179 179
 		}
180 180
 
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @param array $request The Form Data passed into the batch processing
190 190
 	 */
191
-	public function set_properties( $request ) {
192
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
191
+	public function set_properties($request) {
192
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
193 193
 	}
194 194
 
195 195
 	/**
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function process_step() {
202 202
 
203
-		if ( ! $this->can_export() ) {
204
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
203
+		if ( ! $this->can_export()) {
204
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
205 205
 		}
206 206
 
207 207
 		$had_data = $this->get_data();
208 208
 
209
-		if ( $had_data ) {
209
+		if ($had_data) {
210 210
 			$this->done = false;
211 211
 
212 212
 			return true;
213 213
 		} else {
214
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
215
-			$this->delete_data( 'give_temp_recount_form_stats' );
214
+			$this->delete_data('give_recount_total_'.$this->form_id);
215
+			$this->delete_data('give_temp_recount_form_stats');
216 216
 			$this->done    = true;
217
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
217
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
218 218
 
219 219
 			return false;
220 220
 		}
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return mixed       Returns the data from the database
250 250
 	 */
251
-	private function get_stored_data( $key ) {
251
+	private function get_stored_data($key) {
252 252
 		global $wpdb;
253
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
253
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
254 254
 
255
-		if ( empty( $value ) ) {
255
+		if (empty($value)) {
256 256
 			return false;
257 257
 		}
258 258
 
259
-		$maybe_json = json_decode( $value );
260
-		if ( ! is_null( $maybe_json ) ) {
261
-			$value = json_decode( $value, true );
259
+		$maybe_json = json_decode($value);
260
+		if ( ! is_null($maybe_json)) {
261
+			$value = json_decode($value, true);
262 262
 		}
263 263
 
264 264
 		return $value;
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return void
276 276
 	 */
277
-	private function store_data( $key, $value ) {
277
+	private function store_data($key, $value) {
278 278
 		global $wpdb;
279 279
 
280
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
280
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
281 281
 
282 282
 		$data = array(
283 283
 			'option_name'  => $key,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			'%s',
292 292
 		);
293 293
 
294
-		$wpdb->replace( $wpdb->options, $data, $formats );
294
+		$wpdb->replace($wpdb->options, $data, $formats);
295 295
 	}
296 296
 
297 297
 	/**
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return void
305 305
 	 */
306
-	private function delete_data( $key ) {
306
+	private function delete_data($key) {
307 307
 		global $wpdb;
308
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
308
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
309 309
 	}
310 310
 
311 311
 }
312 312
\ No newline at end of file
Please login to merge, or discard this patch.