Test Failed
Push — master ( f5256c...25a383 )
by Devin
07:02
created
includes/admin/tools/export/class-batch-export-donors.php 1 patch
Spacing   +109 added lines, -111 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param int $_step
72 72
 	 */
73
-	public function __construct( $_step = 1 ) {
73
+	public function __construct($_step = 1) {
74 74
 
75
-		parent::__construct( $_step );
75
+		parent::__construct($_step);
76 76
 
77 77
 		// Filter to change the filename.
78
-		add_filter( 'give_export_filename', array( $this, 'give_export_filename' ), 10, 2 );
78
+		add_filter('give_export_filename', array($this, 'give_export_filename'), 10, 2);
79 79
 	}
80 80
 
81 81
 	/**
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return string $filename file name.
90 90
 	 */
91
-	public function give_export_filename( $filename, $export_type ) {
91
+	public function give_export_filename($filename, $export_type) {
92 92
 
93
-		if ( $this->export_type !== $export_type ) {
93
+		if ($this->export_type !== $export_type) {
94 94
 			return $filename;
95 95
 		}
96 96
 
97
-		$forms = empty( $_GET['forms'] ) ? 0 : absint( $_GET['forms'] );
97
+		$forms = empty($_GET['forms']) ? 0 : absint($_GET['forms']);
98 98
 
99
-		if ( $forms ) {
100
-			$slug     = get_post_field( 'post_name', get_post( $forms ) );
101
-			$filename = 'give-export-donors-' . $slug . '-' . date( 'm-d-Y' );
99
+		if ($forms) {
100
+			$slug     = get_post_field('post_name', get_post($forms));
101
+			$filename = 'give-export-donors-'.$slug.'-'.date('m-d-Y');
102 102
 		} else {
103
-			$filename = 'give-export-donors-all-forms-' . date( 'm-d-Y' );
103
+			$filename = 'give-export-donors-all-forms-'.date('m-d-Y');
104 104
 		}
105 105
 
106 106
 		return $filename;
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @param array $request The Form Data passed into the batch processing
115 115
 	 */
116
-	public function set_properties( $request ) {
116
+	public function set_properties($request) {
117 117
 
118 118
 		// Set data from form submission
119
-		if ( isset( $_POST['form'] ) ) {
120
-			parse_str( $_POST['form'], $this->data );
119
+		if (isset($_POST['form'])) {
120
+			parse_str($_POST['form'], $this->data);
121 121
 		}
122 122
 
123 123
 		$this->form = $this->data['forms'];
124 124
 
125 125
 		// Setup donor ids cache.
126
-		if ( ! empty( $this->form ) ) {
126
+		if ( ! empty($this->form)) {
127 127
 			// Cache donor ids to output unique list of donor.
128
-			$this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] );
128
+			$this->query_id = give_clean($_REQUEST['give_export_option']['query_id']);
129 129
 			$this->cache_donor_ids();
130 130
 		}
131 131
 
132
-		$this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
132
+		$this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
133 133
 	}
134 134
 
135 135
 	/**
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 		// Fetch already cached donor ids.
143 143
 		$donor_ids = $this->donor_ids;
144 144
 
145
-		if ( $cached_donor_ids = Give_Cache::get( $this->query_id, true ) ) {
146
-			$donor_ids = array_unique( array_merge( $cached_donor_ids, $this->donor_ids ) );
145
+		if ($cached_donor_ids = Give_Cache::get($this->query_id, true)) {
146
+			$donor_ids = array_unique(array_merge($cached_donor_ids, $this->donor_ids));
147 147
 		}
148 148
 
149
-		$donor_ids = array_values( $donor_ids );
150
-		Give_Cache::set( $this->query_id, $donor_ids, HOUR_IN_SECONDS, true );
149
+		$donor_ids = array_values($donor_ids);
150
+		Give_Cache::set($this->query_id, $donor_ids, HOUR_IN_SECONDS, true);
151 151
 	}
152 152
 
153 153
 	/**
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function csv_cols() {
161 161
 
162
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
162
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
163 163
 
164 164
 		// We need columns.
165
-		if ( empty( $columns ) ) {
165
+		if (empty($columns)) {
166 166
 			return false;
167 167
 		}
168 168
 
169
-		$cols = $this->get_cols( $columns );
169
+		$cols = $this->get_cols($columns);
170 170
 
171 171
 		return $cols;
172 172
 	}
@@ -178,38 +178,38 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return array
180 180
 	 */
181
-	private function get_cols( $columns ) {
181
+	private function get_cols($columns) {
182 182
 
183 183
 		$cols = array();
184 184
 
185
-		foreach ( $columns as $key => $value ) {
185
+		foreach ($columns as $key => $value) {
186 186
 
187
-			switch ( $key ) {
187
+			switch ($key) {
188 188
 				case 'full_name' :
189
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
189
+					$cols['full_name'] = esc_html__('Full Name', 'give');
190 190
 					break;
191 191
 				case 'email' :
192
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
192
+					$cols['email'] = esc_html__('Email Address', 'give');
193 193
 					break;
194 194
 				case 'address' :
195
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
196
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
197
-					$cols['address_city']    = esc_html__( 'City', 'give' );
198
-					$cols['address_state']   = esc_html__( 'State', 'give' );
199
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
200
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
195
+					$cols['address_line1']   = esc_html__('Address', 'give');
196
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
197
+					$cols['address_city']    = esc_html__('City', 'give');
198
+					$cols['address_state']   = esc_html__('State', 'give');
199
+					$cols['address_zip']     = esc_html__('Zip', 'give');
200
+					$cols['address_country'] = esc_html__('Country', 'give');
201 201
 					break;
202 202
 				case 'userid' :
203
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
203
+					$cols['userid'] = esc_html__('User ID', 'give');
204 204
 					break;
205 205
 				case 'donor_created_date' :
206
-					$cols['donor_created_date'] = esc_html__( 'Donor Created Date', 'give' );
206
+					$cols['donor_created_date'] = esc_html__('Donor Created Date', 'give');
207 207
 					break;
208 208
 				case 'donations' :
209
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
209
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
210 210
 					break;
211 211
 				case 'donation_sum' :
212
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
212
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
213 213
 					break;
214 214
 			}
215 215
 		}
@@ -230,29 +230,29 @@  discard block
 block discarded – undo
230 230
 		$i = 0;
231 231
 
232 232
 		$data             = array();
233
-		$cached_donor_ids = Give_Cache::get( $this->query_id, true );
233
+		$cached_donor_ids = Give_Cache::get($this->query_id, true);
234 234
 
235
-		if ( ! empty( $this->form ) ) {
235
+		if ( ! empty($this->form)) {
236 236
 
237 237
 			// Export donors for a specific donation form and also within specified timeframe
238 238
 			$args = array(
239 239
 				'output'     => 'payments', // Use 'posts' to get standard post objects
240
-				'post_type'  => array( 'give_payment' ),
240
+				'post_type'  => array('give_payment'),
241 241
 				'number'     => 30,
242 242
 				'paged'      => $this->step,
243 243
 				'status'     => 'publish',
244 244
 				'meta_key'   => '_give_payment_form_id',
245
-				'meta_value' => absint( $this->form ),
245
+				'meta_value' => absint($this->form),
246 246
 			);
247 247
 
248 248
 			// Check for date option filter
249
-			if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) {
250
-				$args['start_date'] = ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' );
251
-				$args['end_date']   = ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) );
249
+			if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) {
250
+				$args['start_date'] = ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00');
251
+				$args['end_date']   = ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp'));
252 252
 			}
253 253
 
254 254
 			// Check for price option.
255
-			if ( null !== $this->price_id ) {
255
+			if (null !== $this->price_id) {
256 256
 				$args['meta_query'] = array(
257 257
 					array(
258 258
 						'key'   => '_give_payment_price_id',
@@ -261,44 +261,42 @@  discard block
 block discarded – undo
261 261
 				);
262 262
 			}
263 263
 
264
-			$payments_query = new Give_Payments_Query( $args );
264
+			$payments_query = new Give_Payments_Query($args);
265 265
 			$payments       = $payments_query->get_payments();
266 266
 
267
-			if ( $payments ) {
267
+			if ($payments) {
268 268
 				/* @var Give_Payment $payment */
269
-				foreach ( $payments as $payment ) {
269
+				foreach ($payments as $payment) {
270 270
 					// Set donation sum.
271
-					$this->payment_stats[ $payment->customer_id ]['donation_sum'] = isset( $this->payment_stats[ $payment->customer_id ]['donation_sum'] ) ?
272
-						$this->payment_stats[ $payment->customer_id ]['donation_sum'] :
273
-						0;
274
-					$this->payment_stats[ $payment->customer_id ]['donation_sum'] += $payment->total;
271
+					$this->payment_stats[$payment->customer_id]['donation_sum'] = isset($this->payment_stats[$payment->customer_id]['donation_sum']) ?
272
+						$this->payment_stats[$payment->customer_id]['donation_sum'] : 0;
273
+					$this->payment_stats[$payment->customer_id]['donation_sum'] += $payment->total;
275 274
 
276 275
 					// Set donation count.
277
-					$this->payment_stats[ $payment->customer_id ]['donations'] = isset( $this->payment_stats[ $payment->customer_id ]['donations'] ) ?
278
-						++ $this->payment_stats[ $payment->customer_id ]['donations'] :
279
-						1;
276
+					$this->payment_stats[$payment->customer_id]['donations'] = isset($this->payment_stats[$payment->customer_id]['donations']) ?
277
+						++$this->payment_stats[$payment->customer_id]['donations'] : 1;
280 278
 
281 279
 					// Set donation form name.
282
-					$this->payment_stats[ $payment->customer_id ]['form_title'] = $payment->form_title;
280
+					$this->payment_stats[$payment->customer_id]['form_title'] = $payment->form_title;
283 281
 
284 282
 					// Continue if donor already included.
285
-					if ( empty( $payment->customer_id ) ||
286
-					     in_array( $payment->customer_id, $cached_donor_ids )
283
+					if (empty($payment->customer_id) ||
284
+					     in_array($payment->customer_id, $cached_donor_ids)
287 285
 					) {
288 286
 						continue;
289 287
 					}
290 288
 
291 289
 					$this->donor_ids[] = $cached_donor_ids[] = $payment->customer_id;
292 290
 
293
-					$i ++;
291
+					$i++;
294 292
 				}
295 293
 
296
-				if ( ! empty( $this->donor_ids ) ) {
297
-					foreach ( $this->donor_ids as $donor_id ) {
298
-						$donor                 = Give()->donors->get_donor_by( 'id', $donor_id );
299
-						$donor->purchase_count = $this->payment_stats[ $donor_id ]['donations'];
300
-						$donor->purchase_value = $this->payment_stats[ $donor_id ]['donation_sum'];
301
-						$data[]                = $this->set_donor_data( $i, $data, $donor );
294
+				if ( ! empty($this->donor_ids)) {
295
+					foreach ($this->donor_ids as $donor_id) {
296
+						$donor                 = Give()->donors->get_donor_by('id', $donor_id);
297
+						$donor->purchase_count = $this->payment_stats[$donor_id]['donations'];
298
+						$donor->purchase_value = $this->payment_stats[$donor_id]['donation_sum'];
299
+						$data[]                = $this->set_donor_data($i, $data, $donor);
302 300
 					}
303 301
 
304 302
 					// Cache donor ids only if admin export donor for specific form.
@@ -308,7 +306,7 @@  discard block
 block discarded – undo
308 306
 		} else {
309 307
 
310 308
 			// Export all donors.
311
-			$offset = 30 * ( $this->step - 1 );
309
+			$offset = 30 * ($this->step - 1);
312 310
 
313 311
 			$args = array(
314 312
 				'number' => 30,
@@ -316,29 +314,29 @@  discard block
 block discarded – undo
316 314
 			);
317 315
 
318 316
 			// Check for date option filter
319
-			if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) {
317
+			if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) {
320 318
 				$args['date'] = array(
321
-					'start' => ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ),
322
-					'end'   => ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ),
319
+					'start' => ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'),
320
+					'end'   => ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')),
323 321
 				);
324 322
 			}
325 323
 
326
-			$donors = Give()->donors->get_donors( $args );
324
+			$donors = Give()->donors->get_donors($args);
327 325
 
328
-			foreach ( $donors as $donor ) {
326
+			foreach ($donors as $donor) {
329 327
 
330 328
 				// Continue if donor already included.
331
-				if ( empty( $donor->id ) || empty( $donor->payment_ids ) ) {
329
+				if (empty($donor->id) || empty($donor->payment_ids)) {
332 330
 					continue;
333 331
 				}
334 332
 
335
-				$data[] = $this->set_donor_data( $i, $data, $donor );
336
-				$i ++;
333
+				$data[] = $this->set_donor_data($i, $data, $donor);
334
+				$i++;
337 335
 			}
338 336
 		}// End if().
339 337
 
340
-		$data = apply_filters( 'give_export_get_data', $data );
341
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
338
+		$data = apply_filters('give_export_get_data', $data);
339
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
342 340
 
343 341
 		return $data;
344 342
 	}
@@ -354,18 +352,18 @@  discard block
 block discarded – undo
354 352
 		$percentage = 0;
355 353
 
356 354
 		// We can't count the number when getting them for a specific form.
357
-		if ( empty( $this->form ) ) {
355
+		if (empty($this->form)) {
358 356
 
359 357
 			$total = Give()->donors->count();
360 358
 
361
-			if ( $total > 0 ) {
359
+			if ($total > 0) {
362 360
 
363
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
361
+				$percentage = ((30 * $this->step) / $total) * 100;
364 362
 
365 363
 			}
366 364
 		}
367 365
 
368
-		if ( $percentage > 100 ) {
366
+		if ($percentage > 100) {
369 367
 			$percentage = 100;
370 368
 		}
371 369
 
@@ -381,49 +379,49 @@  discard block
 block discarded – undo
381 379
 	 *
382 380
 	 * @return mixed
383 381
 	 */
384
-	private function set_donor_data( $i, $data, $donor ) {
382
+	private function set_donor_data($i, $data, $donor) {
385 383
 
386 384
 		$columns = $this->csv_cols();
387 385
 
388 386
 		// Set address variable.
389 387
 		$address = '';
390
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
391
-			$address = give_get_donor_address( $donor->user_id );
388
+		if (isset($donor->user_id) && $donor->user_id > 0) {
389
+			$address = give_get_donor_address($donor->user_id);
392 390
 		}
393 391
 
394 392
 		// Set columns
395
-		if ( ! empty( $columns['full_name'] ) ) {
396
-			$donor_name              = give_get_donor_name_by( $donor->id, 'donor' );
397
-			$data[ $i ]['full_name'] = $donor_name;
393
+		if ( ! empty($columns['full_name'])) {
394
+			$donor_name              = give_get_donor_name_by($donor->id, 'donor');
395
+			$data[$i]['full_name'] = $donor_name;
398 396
 		}
399
-		if ( ! empty( $columns['email'] ) ) {
400
-			$data[ $i ]['email'] = $donor->email;
397
+		if ( ! empty($columns['email'])) {
398
+			$data[$i]['email'] = $donor->email;
401 399
 		}
402
-		if ( ! empty( $columns['address_line1'] ) ) {
403
-
404
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
405
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
406
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
407
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
408
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
409
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
400
+		if ( ! empty($columns['address_line1'])) {
401
+
402
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
403
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
404
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
405
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
406
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
407
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
410 408
 		}
411
-		if ( ! empty( $columns['userid'] ) ) {
412
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
409
+		if ( ! empty($columns['userid'])) {
410
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
413 411
 		}
414
-		if ( ! empty( $columns['donor_created_date'] ) ) {
415
-			$data[ $i ]['donor_created_date'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
412
+		if ( ! empty($columns['donor_created_date'])) {
413
+			$data[$i]['donor_created_date'] = date_i18n(give_date_format(), strtotime($donor->date_created));
416 414
 		}
417
-		if ( ! empty( $columns['donations'] ) ) {
418
-			$data[ $i ]['donations'] = $donor->purchase_count;
415
+		if ( ! empty($columns['donations'])) {
416
+			$data[$i]['donations'] = $donor->purchase_count;
419 417
 		}
420
-		if ( ! empty( $columns['donation_sum'] ) ) {
421
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) );
418
+		if ( ! empty($columns['donation_sum'])) {
419
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value, array('sanitize' => false));
422 420
 		}
423 421
 
424
-		$data[ $i ] = apply_filters( 'give_export_set_donor_data', $data[ $i ], $donor );
422
+		$data[$i] = apply_filters('give_export_set_donor_data', $data[$i], $donor);
425 423
 
426
-		return $data[ $i ];
424
+		return $data[$i];
427 425
 
428 426
 	}
429 427
 
@@ -433,9 +431,9 @@  discard block
 block discarded – undo
433 431
 	 * @param array $request
434 432
 	 * @param Give_Batch_Export $export
435 433
 	 */
436
-	public function unset_properties( $request, $export ) {
437
-		if ( $export->done ) {
438
-			Give_Cache::delete( "give_cache_{$this->query_id}" );
434
+	public function unset_properties($request, $export) {
435
+		if ($export->done) {
436
+			Give_Cache::delete("give_cache_{$this->query_id}");
439 437
 		}
440 438
 	}
441 439
 }
442 440
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-sales-logs-list-table.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 		global $status, $page;
45 45
 
46 46
 		// Set parent defaults
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
50
-			'ajax'     => false,// Does this table support ajax?
51
-		) );
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
50
+			'ajax'     => false, // Does this table support ajax?
51
+		));
52 52
 
53
-		add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) );
53
+		add_action('give_log_view_actions', array($this, 'give_forms_filter'));
54 54
 	}
55 55
 
56 56
 	/**
@@ -64,69 +64,69 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
67
+	public function column_default($item, $column_name) {
68 68
 
69 69
 		/* @var Give_Payment $payment */
70
-		$payment = give_get_payment_by( 'id', $item['payment_id'] );
70
+		$payment = give_get_payment_by('id', $item['payment_id']);
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form' :
74
-				$form_title = get_the_title( $item[ $column_name ] );
75
-				$form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title;
76
-				return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . esc_html( $form_title ). '</a>';
74
+				$form_title = get_the_title($item[$column_name]);
75
+				$form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title;
76
+				return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.esc_html($form_title).'</a>';
77 77
 
78 78
 			case 'amount' :
79
-				$value = give_currency_filter( give_format_amount( $item['amount'], array( 'sanitize' => false, 'donation_id' => $item['payment_id'] ) ), array( 'currency_code' => give_get_payment_currency_code( $item['payment_id'] ) ) );
80
-				$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
79
+				$value = give_currency_filter(give_format_amount($item['amount'], array('sanitize' => false, 'donation_id' => $item['payment_id'])), array('currency_code' => give_get_payment_currency_code($item['payment_id'])));
80
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
81 81
 
82 82
 				return $value;
83 83
 
84 84
 			case 'status' :
85 85
 
86
-				$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
86
+				$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
87 87
 
88
-				if ( $payment->mode == 'test' ) {
89
-					$value .= Give()->tooltips->render_span( array(
90
-						'label'       => __( 'This donation was made in test mode.', 'give' ),
91
-						'tag_content' => __( 'Test', 'give' ),
88
+				if ($payment->mode == 'test') {
89
+					$value .= Give()->tooltips->render_span(array(
90
+						'label'       => __('This donation was made in test mode.', 'give'),
91
+						'tag_content' => __('Test', 'give'),
92 92
 						'attributes'  => array(
93 93
 							'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label',
94 94
 						),
95
-					) );
95
+					));
96 96
 				}
97 97
 
98 98
 				return $value;
99 99
 
100 100
 			case 'donation' :
101
-				$serial_code = Give()->seq_donation_number->get_serial_code( $payment );
102
-				$value = Give()->tooltips->render_link( array(
101
+				$serial_code = Give()->seq_donation_number->get_serial_code($payment);
102
+				$value = Give()->tooltips->render_link(array(
103 103
 					/* translators: %s Sequential Donation ID. */
104
-					'label'       => sprintf( __( 'View Donation %s', 'give' ), $serial_code ),
104
+					'label'       => sprintf(__('View Donation %s', 'give'), $serial_code),
105 105
 					'tag_content' => $serial_code,
106
-					'link'        => esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ),
107
-				) );
106
+					'link'        => esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))),
107
+				));
108 108
 
109
-				if ( ! empty( $item['donor_id'] ) ) {
110
-					$title_prefix = Give()->donor_meta->get_meta( $item['donor_id'], '_give_donor_title_prefix', true );
109
+				if ( ! empty($item['donor_id'])) {
110
+					$title_prefix = Give()->donor_meta->get_meta($item['donor_id'], '_give_donor_title_prefix', true);
111 111
 
112 112
 					$value .= sprintf(
113 113
 						'&nbsp;%1$s&nbsp;<a href="%2$s">%3$s</a><br>',
114
-						esc_html__( 'by', 'give' ),
115
-						admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . $item['donor_id'] ),
116
-						give_get_donor_name_with_title_prefixes( $title_prefix, $item['donor_name'] )
114
+						esc_html__('by', 'give'),
115
+						admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.$item['donor_id']),
116
+						give_get_donor_name_with_title_prefixes($title_prefix, $item['donor_name'])
117 117
 					);
118 118
 				} else {
119 119
 					$value .= sprintf(
120 120
 						'&nbsp;%1$s&nbsp;%2$s<br>',
121
-						esc_html__( 'by', 'give' ),
122
-						__( 'No donor attached', 'give' )
121
+						esc_html__('by', 'give'),
122
+						__('No donor attached', 'give')
123 123
 					);
124 124
 				}
125 125
 
126 126
 				return $value;
127 127
 
128 128
 			default:
129
-				return $item[ $column_name ];
129
+				return $item[$column_name];
130 130
 		} // End switch().
131 131
 	}
132 132
 
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function get_columns() {
141 141
 		$columns = array(
142
-			'ID'       => __( 'Log ID', 'give' ),
143
-			'donation' => __( 'Donation', 'give' ),
144
-			'form'     => __( 'Form', 'give' ),
145
-			'status'   => __( 'Status', 'give' ),
146
-			'amount'   => __( 'Donation Amount', 'give' ),
147
-			'date'     => __( 'Date', 'give' ),
142
+			'ID'       => __('Log ID', 'give'),
143
+			'donation' => __('Donation', 'give'),
144
+			'form'     => __('Form', 'give'),
145
+			'status'   => __('Status', 'give'),
146
+			'amount'   => __('Donation Amount', 'give'),
147
+			'date'     => __('Date', 'give'),
148 148
 		);
149 149
 
150 150
 		return $columns;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return int Current page number
159 159
 	 */
160 160
 	public function get_paged() {
161
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
161
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
162 162
 	}
163 163
 
164 164
 	/**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return mixed int If User ID, string If Email/Login
170 170
 	 */
171 171
 	public function get_filtered_user() {
172
-		return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false;
172
+		return isset($_GET['user']) ? absint($_GET['user']) : false;
173 173
 	}
174 174
 
175 175
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @return int Download ID
181 181
 	 */
182 182
 	public function get_filtered_give_form() {
183
-		return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false;
183
+		return ! empty($_GET['form']) ? absint($_GET['form']) : false;
184 184
 	}
185 185
 
186 186
 	/**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @return string|bool string If search is present, false otherwise
192 192
 	 */
193 193
 	public function get_search() {
194
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
194
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
195 195
 	}
196 196
 
197 197
 
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
210
+	protected function display_tablenav($which) {
211 211
 		?>
212
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
212
+		<div class="tablenav <?php echo esc_attr($which); ?>">
213 213
 
214
-			<?php if ( 'top' === $which ) : ?>
214
+			<?php if ('top' === $which) : ?>
215 215
 				<div class="alignleft actions bulkactions">
216
-					<?php $this->bulk_actions( $which ); ?>
216
+					<?php $this->bulk_actions($which); ?>
217 217
 				</div>
218 218
 			<?php endif; ?>
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"/>
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 		$meta_query = array();
246 246
 
247
-		if ( $user ) {
247
+		if ($user) {
248 248
 			// Show only logs from a specific user.
249 249
 			$meta_query[] = array(
250 250
 				'key'   => '_give_log_user_id',
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			);
253 253
 		}
254 254
 
255
-		if ( $give_form ) {
255
+		if ($give_form) {
256 256
 			$meta_query[] = array(
257 257
 				'key'   => '_give_log_form_id',
258 258
 				'value' => $give_form,
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 		}
261 261
 
262 262
 		$search = $this->get_search();
263
-		if ( $search ) {
264
-			if ( is_email( $search ) ) {
263
+		if ($search) {
264
+			if (is_email($search)) {
265 265
 				// This is an email search. We use this to ensure it works for guest users and logged-in users.
266 266
 				$key     = '_give_log_user_info';
267 267
 				$compare = 'LIKE';
@@ -270,32 +270,32 @@  discard block
 block discarded – undo
270 270
 				$key     = '_give_log_user_id';
271 271
 				$compare = 'LIKE';
272 272
 
273
-				if ( ! is_numeric( $search ) ) {
273
+				if ( ! is_numeric($search)) {
274 274
 					// Searching for user by username
275
-					$user = get_user_by( 'login', $search );
275
+					$user = get_user_by('login', $search);
276 276
 
277
-					if ( $user ) {
277
+					if ($user) {
278 278
 						// Found one, set meta value to user's ID.
279 279
 						$search = $user->ID;
280 280
 					} else {
281 281
 						// No user found so let's do a real search query.
282
-						$users = new WP_User_Query( array(
282
+						$users = new WP_User_Query(array(
283 283
 							'search'         => $search,
284
-							'search_columns' => array( 'user_url', 'user_nicename' ),
284
+							'search_columns' => array('user_url', 'user_nicename'),
285 285
 							'number'         => 1,
286 286
 							'fields'         => 'ids',
287
-						) );
287
+						));
288 288
 
289 289
 						$found_user = $users->get_results();
290 290
 
291
-						if ( $found_user ) {
291
+						if ($found_user) {
292 292
 							$search = $found_user[0];
293 293
 						}
294 294
 					}
295 295
 				}
296 296
 			}
297 297
 
298
-			if ( ! $this->file_search ) {
298
+			if ( ! $this->file_search) {
299 299
 				// Meta query only works for non file name search.
300 300
 				$meta_query[] = array(
301 301
 					'key'     => $key,
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @param string $which
318 318
 	 * @return void
319 319
 	 */
320
-	function bulk_actions( $which = '' ) {
320
+	function bulk_actions($which = '') {
321 321
 		give_log_views();
322 322
 	}
323 323
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 	 * @return void
330 330
 	 */
331 331
 	public function give_forms_filter() {
332
-		echo Give()->html->forms_dropdown( array(
332
+		echo Give()->html->forms_dropdown(array(
333 333
 			'selected' => $this->get_filtered_give_form(),
334 334
 			'name'   => 'form',
335 335
 			'id'     => 'give-log-form-filter',
336 336
 			'chosen' => true,
337
-		) );
337
+		));
338 338
 	}
339 339
 
340 340
 	/**
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
 	public function get_logs() {
349 349
 		$logs_data = array();
350 350
 		$log_query = $this->get_query_params();
351
-		$logs = Give()->logs->get_connected_logs( $log_query );
351
+		$logs = Give()->logs->get_connected_logs($log_query);
352 352
 
353
-		if ( $logs ) {
354
-			foreach ( $logs as $log ) {
353
+		if ($logs) {
354
+			foreach ($logs as $log) {
355 355
 				/* @var Give_payment $payment */
356
-				$payment = new Give_Payment( $log->log_parent );
356
+				$payment = new Give_Payment($log->log_parent);
357 357
 
358 358
 				// Make sure this payment hasn't been deleted
359
-				if ( get_post( $payment->ID ) ) :
359
+				if (get_post($payment->ID)) :
360 360
 					$logs_data[] = array(
361
-						'ID'         => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>',
361
+						'ID'         => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>',
362 362
 						'payment_id' => $payment->ID,
363 363
 						'form'       => $payment->form_id,
364 364
 						'amount'     => $payment->total,
365 365
 						'donor_id'    => $payment->customer_id,
366
-						'donor_name' => trim( "{$payment->first_name} $payment->last_name" ),
366
+						'donor_name' => trim("{$payment->first_name} $payment->last_name"),
367 367
 						'date'       => $payment->date,
368 368
 					);
369 369
 
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 		$columns               = $this->get_columns();
392 392
 		$hidden                = array();
393 393
 		$sortable              = $this->get_sortable_columns();
394
-		$this->_column_headers = array( $columns, $hidden, $sortable );
394
+		$this->_column_headers = array($columns, $hidden, $sortable);
395 395
 		$current_page          = $this->get_pagenum();
396 396
 		$this->items           = $this->get_logs();
397
-		$total_items           = Give()->logs->get_log_count( 0, 'sale', $this->get_meta_query() );
397
+		$total_items           = Give()->logs->get_log_count(0, 'sale', $this->get_meta_query());
398 398
 
399
-		$this->set_pagination_args( array(
399
+		$this->set_pagination_args(array(
400 400
 				'total_items' => $total_items,
401 401
 				'per_page'    => $this->per_page,
402
-				'total_pages' => ceil( $total_items / $this->per_page ),
402
+				'total_pages' => ceil($total_items / $this->per_page),
403 403
 			)
404 404
 		);
405 405
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +502 added lines, -502 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,39 +98,39 @@  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, false );
107
+			update_option('give_completed_upgrades', $completed_upgrades, false);
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
-		case version_compare( $give_version, '2.2.0', '<' ) :
122
+		case version_compare($give_version, '2.2.0', '<') :
123 123
 			give_v220_upgrades();
124 124
 			$did_upgrade = true;
125 125
 	}
126 126
 
127
-	if ( $did_upgrade ) {
128
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
127
+	if ($did_upgrade) {
128
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
129 129
 	}
130 130
 }
131 131
 
132
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
133
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
132
+add_action('admin_init', 'give_do_automatic_upgrades');
133
+add_action('give_upgrades', 'give_do_automatic_upgrades');
134 134
 
135 135
 /**
136 136
  * Display Upgrade Notices.
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  *
145 145
  * @return void
146 146
  */
147
-function give_show_upgrade_notices( $give_updates ) {
147
+function give_show_upgrade_notices($give_updates) {
148 148
 	// v1.3.2 Upgrades
149 149
 	$give_updates->register(
150 150
 		array(
@@ -210,32 +210,32 @@  discard block
 block discarded – undo
210 210
 	);
211 211
 
212 212
 	// v1.8.17 Upgrades for donations.
213
-	$give_updates->register( array(
213
+	$give_updates->register(array(
214 214
 		'id'       => 'v1817_update_donation_iranian_currency_code',
215 215
 		'version'  => '1.8.17',
216 216
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
217
-	) );
217
+	));
218 218
 
219 219
 	// v1.8.17 Upgrades for cleanup of user roles.
220
-	$give_updates->register( array(
220
+	$give_updates->register(array(
221 221
 		'id'       => 'v1817_cleanup_user_roles',
222 222
 		'version'  => '1.8.17',
223 223
 		'callback' => 'give_v1817_cleanup_user_roles',
224
-	) );
224
+	));
225 225
 
226 226
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
227
-	$give_updates->register( array(
227
+	$give_updates->register(array(
228 228
 		'id'       => 'v1818_assign_custom_amount_set_donation',
229 229
 		'version'  => '1.8.18',
230 230
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
231
-	) );
231
+	));
232 232
 
233 233
 	// v1.8.18 Cleanup the Give Worker Role Caps.
234
-	$give_updates->register( array(
234
+	$give_updates->register(array(
235 235
 		'id'       => 'v1818_give_worker_role_cleanup',
236 236
 		'version'  => '1.8.18',
237 237
 		'callback' => 'give_v1818_give_worker_role_cleanup',
238
-	) );
238
+	));
239 239
 
240 240
 	// v2.0.0 Upgrades
241 241
 	$give_updates->register(
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			'id'       => 'v20_move_metadata_into_new_table',
290 290
 			'version'  => '2.0.0',
291 291
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
292
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
292
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
293 293
 		)
294 294
 	);
295 295
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			'id'       => 'v201_move_metadata_into_new_table',
336 336
 			'version'  => '2.0.1',
337 337
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
338
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
338
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
339 339
 		)
340 340
 	);
341 341
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			'id'       => 'v213_delete_donation_meta',
364 364
 			'version'  => '2.1.3',
365 365
 			'callback' => 'give_v213_delete_donation_meta_callback',
366
-			'depends'  => array( 'v201_move_metadata_into_new_table' )
366
+			'depends'  => array('v201_move_metadata_into_new_table')
367 367
 		)
368 368
 	);
369 369
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			'id'       => 'v213_rename_donation_meta_type',
374 374
 			'version'  => '2.1.3',
375 375
 			'callback' => 'give_v213_rename_donation_meta_type_callback',
376
-			'depend'   => array( 'v20_move_metadata_into_new_table' ),
376
+			'depend'   => array('v20_move_metadata_into_new_table'),
377 377
 		)
378 378
 	);
379 379
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	);
388 388
 }
389 389
 
390
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
390
+add_action('give_register_updates', 'give_show_upgrade_notices');
391 391
 
392 392
 /**
393 393
  * Triggers all upgrade functions
@@ -399,29 +399,29 @@  discard block
 block discarded – undo
399 399
  */
400 400
 function give_trigger_upgrades() {
401 401
 
402
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
403
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
402
+	if ( ! current_user_can('manage_give_settings')) {
403
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
404 404
 			'response' => 403,
405
-		) );
405
+		));
406 406
 	}
407 407
 
408
-	$give_version = get_option( 'give_version' );
408
+	$give_version = get_option('give_version');
409 409
 
410
-	if ( ! $give_version ) {
410
+	if ( ! $give_version) {
411 411
 		// 1.0 is the first version to use this option so we must add it.
412 412
 		$give_version = '1.0';
413
-		add_option( 'give_version', $give_version, '', false );
413
+		add_option('give_version', $give_version, '', false);
414 414
 	}
415 415
 
416
-	update_option( 'give_version', GIVE_VERSION, false );
417
-	delete_option( 'give_doing_upgrade' );
416
+	update_option('give_version', GIVE_VERSION, false);
417
+	delete_option('give_doing_upgrade');
418 418
 
419
-	if ( DOING_AJAX ) {
420
-		die( 'complete' );
419
+	if (DOING_AJAX) {
420
+		die('complete');
421 421
 	} // End if().
422 422
 }
423 423
 
424
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
424
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
425 425
 
426 426
 
427 427
 /**
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
 
440 440
 	// UPDATE DB METAKEYS.
441 441
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
442
-	$query = $wpdb->query( $sql );
442
+	$query = $wpdb->query($sql);
443 443
 
444 444
 	$give_updates->percentage = 100;
445
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
445
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
446 446
 }
447 447
 
448 448
 
@@ -466,24 +466,24 @@  discard block
 block discarded – undo
466 466
 	$where  .= "AND ( p.post_status = 'abandoned' )";
467 467
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
468 468
 
469
-	$sql            = $select . $join . $where;
470
-	$found_payments = $wpdb->get_col( $sql );
469
+	$sql            = $select.$join.$where;
470
+	$found_payments = $wpdb->get_col($sql);
471 471
 
472
-	foreach ( $found_payments as $payment ) {
472
+	foreach ($found_payments as $payment) {
473 473
 
474 474
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
475
-		$modified_time = get_post_modified_time( 'U', false, $payment );
475
+		$modified_time = get_post_modified_time('U', false, $payment);
476 476
 
477 477
 		// 1450124863 =  12/10/2015 20:42:25.
478
-		if ( $modified_time >= 1450124863 ) {
478
+		if ($modified_time >= 1450124863) {
479 479
 
480
-			give_update_payment_status( $payment, 'pending' );
480
+			give_update_payment_status($payment, 'pending');
481 481
 
482 482
 		}
483 483
 	}
484 484
 
485 485
 	$give_updates->percentage = 100;
486
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
486
+	give_set_upgrade_complete('upgrade_give_offline_status');
487 487
 }
488 488
 
489 489
 
@@ -496,17 +496,17 @@  discard block
 block discarded – undo
496 496
  */
497 497
 function give_v152_cleanup_users() {
498 498
 
499
-	$give_version = get_option( 'give_version' );
499
+	$give_version = get_option('give_version');
500 500
 
501
-	if ( ! $give_version ) {
501
+	if ( ! $give_version) {
502 502
 		// 1.0 is the first version to use this option so we must add it.
503 503
 		$give_version = '1.0';
504 504
 	}
505 505
 
506
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
506
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
507 507
 
508 508
 	// v1.5.2 Upgrades
509
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
509
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
510 510
 
511 511
 		// Delete all caps with "ss".
512 512
 		// Also delete all unused "campaign" roles.
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 		);
554 554
 
555 555
 		global $wp_roles;
556
-		foreach ( $delete_caps as $cap ) {
557
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
558
-				$wp_roles->remove_cap( $role, $cap );
556
+		foreach ($delete_caps as $cap) {
557
+			foreach (array_keys($wp_roles->roles) as $role) {
558
+				$wp_roles->remove_cap($role, $cap);
559 559
 			}
560 560
 		}
561 561
 
@@ -565,15 +565,15 @@  discard block
 block discarded – undo
565 565
 		$roles->add_caps();
566 566
 
567 567
 		// The Update Ran.
568
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
569
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
570
-		delete_option( 'give_doing_upgrade' );
568
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
569
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
570
+		delete_option('give_doing_upgrade');
571 571
 
572 572
 	}// End if().
573 573
 
574 574
 }
575 575
 
576
-add_action( 'admin_init', 'give_v152_cleanup_users' );
576
+add_action('admin_init', 'give_v152_cleanup_users');
577 577
 
578 578
 /**
579 579
  * 1.6 Upgrade routine to create the customer meta table.
@@ -616,53 +616,53 @@  discard block
 block discarded – undo
616 616
 
617 617
 	// Get addons license key.
618 618
 	$addons = array();
619
-	foreach ( $give_options as $key => $value ) {
620
-		if ( false !== strpos( $key, '_license_key' ) ) {
621
-			$addons[ $key ] = $value;
619
+	foreach ($give_options as $key => $value) {
620
+		if (false !== strpos($key, '_license_key')) {
621
+			$addons[$key] = $value;
622 622
 		}
623 623
 	}
624 624
 
625 625
 	// Bailout: We do not have any addon license data to upgrade.
626
-	if ( empty( $addons ) ) {
626
+	if (empty($addons)) {
627 627
 		return false;
628 628
 	}
629 629
 
630
-	foreach ( $addons as $key => $addon_license ) {
630
+	foreach ($addons as $key => $addon_license) {
631 631
 
632 632
 		// Get addon shortname.
633
-		$shortname = str_replace( '_license_key', '', $key );
633
+		$shortname = str_replace('_license_key', '', $key);
634 634
 
635 635
 		// Addon license option name.
636
-		$addon_license_option_name = $shortname . '_license_active';
636
+		$addon_license_option_name = $shortname.'_license_active';
637 637
 
638 638
 		// bailout if license is empty.
639
-		if ( empty( $addon_license ) ) {
640
-			delete_option( $addon_license_option_name );
639
+		if (empty($addon_license)) {
640
+			delete_option($addon_license_option_name);
641 641
 			continue;
642 642
 		}
643 643
 
644 644
 		// Get addon name.
645 645
 		$addon_name       = array();
646
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
647
-		foreach ( $addon_name_parts as $name_part ) {
646
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
647
+		foreach ($addon_name_parts as $name_part) {
648 648
 
649 649
 			// Fix addon name
650
-			switch ( $name_part ) {
650
+			switch ($name_part) {
651 651
 				case 'authorizenet' :
652 652
 					$name_part = 'authorize.net';
653 653
 					break;
654 654
 			}
655 655
 
656
-			$addon_name[] = ucfirst( $name_part );
656
+			$addon_name[] = ucfirst($name_part);
657 657
 		}
658 658
 
659
-		$addon_name = implode( ' ', $addon_name );
659
+		$addon_name = implode(' ', $addon_name);
660 660
 
661 661
 		// Data to send to the API.
662 662
 		$api_params = array(
663 663
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
664 664
 			'license'    => $addon_license,
665
-			'item_name'  => urlencode( $addon_name ),
665
+			'item_name'  => urlencode($addon_name),
666 666
 			'url'        => home_url(),
667 667
 		);
668 668
 
@@ -677,17 +677,17 @@  discard block
 block discarded – undo
677 677
 		);
678 678
 
679 679
 		// Make sure there are no errors.
680
-		if ( is_wp_error( $response ) ) {
681
-			delete_option( $addon_license_option_name );
680
+		if (is_wp_error($response)) {
681
+			delete_option($addon_license_option_name);
682 682
 			continue;
683 683
 		}
684 684
 
685 685
 		// Tell WordPress to look for updates.
686
-		set_site_transient( 'update_plugins', null );
686
+		set_site_transient('update_plugins', null);
687 687
 
688 688
 		// Decode license data.
689
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
690
-		update_option( $addon_license_option_name, $license_data, false );
689
+		$license_data = json_decode(wp_remote_retrieve_body($response));
690
+		update_option($addon_license_option_name, $license_data, false);
691 691
 	}// End foreach().
692 692
 }
693 693
 
@@ -717,9 +717,9 @@  discard block
 block discarded – undo
717 717
 	);
718 718
 
719 719
 	global $wp_roles;
720
-	foreach ( $delete_caps as $cap ) {
721
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
722
-			$wp_roles->remove_cap( $role, $cap );
720
+	foreach ($delete_caps as $cap) {
721
+		foreach (array_keys($wp_roles->roles) as $role) {
722
+			$wp_roles->remove_cap($role, $cap);
723 723
 		}
724 724
 	}
725 725
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 function give_v18_upgrades_core_setting() {
754 754
 	// Core settings which changes from checkbox to radio.
755 755
 	$core_setting_names = array_merge(
756
-		array_keys( give_v18_renamed_core_settings() ),
756
+		array_keys(give_v18_renamed_core_settings()),
757 757
 		array(
758 758
 			'uninstall_on_delete',
759 759
 			'scripts_footer',
@@ -765,48 +765,48 @@  discard block
 block discarded – undo
765 765
 	);
766 766
 
767 767
 	// Bailout: If not any setting define.
768
-	if ( $give_settings = get_option( 'give_settings' ) ) {
768
+	if ($give_settings = get_option('give_settings')) {
769 769
 
770 770
 		$setting_changed = false;
771 771
 
772 772
 		// Loop: check each setting field.
773
-		foreach ( $core_setting_names as $setting_name ) {
773
+		foreach ($core_setting_names as $setting_name) {
774 774
 			// New setting name.
775
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
775
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
776 776
 
777 777
 			// Continue: If setting already set.
778 778
 			if (
779
-				array_key_exists( $new_setting_name, $give_settings )
780
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
779
+				array_key_exists($new_setting_name, $give_settings)
780
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
781 781
 			) {
782 782
 				continue;
783 783
 			}
784 784
 
785 785
 			// Set checkbox value to radio value.
786
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
786
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
787 787
 
788 788
 			// @see https://github.com/WordImpress/Give/issues/1063.
789
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
789
+			if (false !== strpos($setting_name, 'disable_')) {
790 790
 
791
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
792
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
791
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
792
+			} elseif (false !== strpos($setting_name, 'enable_')) {
793 793
 
794
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
794
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
795 795
 			}
796 796
 
797 797
 			// Tell bot to update core setting to db.
798
-			if ( ! $setting_changed ) {
798
+			if ( ! $setting_changed) {
799 799
 				$setting_changed = true;
800 800
 			}
801 801
 		}
802 802
 
803 803
 		// Update setting only if they changed.
804
-		if ( $setting_changed ) {
805
-			update_option( 'give_settings', $give_settings, false );
804
+		if ($setting_changed) {
805
+			update_option('give_settings', $give_settings, false);
806 806
 		}
807 807
 	}// End if().
808 808
 
809
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
809
+	give_set_upgrade_complete('v18_upgrades_core_setting');
810 810
 }
811 811
 
812 812
 /**
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 	$give_updates = Give_Updates::get_instance();
821 821
 
822 822
 	// form query
823
-	$forms = new WP_Query( array(
823
+	$forms = new WP_Query(array(
824 824
 			'paged'          => $give_updates->step,
825 825
 			'status'         => 'any',
826 826
 			'order'          => 'ASC',
@@ -829,41 +829,41 @@  discard block
 block discarded – undo
829 829
 		)
830 830
 	);
831 831
 
832
-	if ( $forms->have_posts() ) {
833
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
832
+	if ($forms->have_posts()) {
833
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
834 834
 
835
-		while ( $forms->have_posts() ) {
835
+		while ($forms->have_posts()) {
836 836
 			$forms->the_post();
837 837
 
838 838
 			// Form content.
839 839
 			// Note in version 1.8 display content setting split into display content and content placement setting.
840 840
 			// You can delete _give_content_option in future.
841
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
842
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
843
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
844
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
841
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
842
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
843
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
844
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
845 845
 
846
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
847
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
846
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
847
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
848 848
 			}
849 849
 
850 850
 			// "Disable" Guest Donation. Checkbox.
851 851
 			// See: https://github.com/WordImpress/Give/issues/1470.
852
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
853
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
854
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
852
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
853
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
854
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
855 855
 
856 856
 			// Offline Donations.
857 857
 			// See: https://github.com/WordImpress/Give/issues/1579.
858
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
859
-			if ( 'no' === $offline_donation ) {
858
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
859
+			if ('no' === $offline_donation) {
860 860
 				$offline_donation_newval = 'global';
861
-			} elseif ( 'yes' === $offline_donation ) {
861
+			} elseif ('yes' === $offline_donation) {
862 862
 				$offline_donation_newval = 'enabled';
863 863
 			} else {
864 864
 				$offline_donation_newval = 'disabled';
865 865
 			}
866
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
866
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
867 867
 
868 868
 			// Convert yes/no setting field to enabled/disabled.
869 869
 			$form_radio_settings = array(
@@ -883,15 +883,15 @@  discard block
 block discarded – undo
883 883
 				'_give_offline_donation_enable_billing_fields_single',
884 884
 			);
885 885
 
886
-			foreach ( $form_radio_settings as $meta_key ) {
886
+			foreach ($form_radio_settings as $meta_key) {
887 887
 				// Get value.
888
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
888
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
889 889
 
890 890
 				// Convert meta value only if it is in yes/no/none.
891
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
891
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
892 892
 
893
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
894
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
893
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
894
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
895 895
 				}
896 896
 			}
897 897
 		}// End while().
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 
901 901
 	} else {
902 902
 		// No more forms found, finish up.
903
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
903
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
904 904
 	}
905 905
 }
906 906
 
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 				'%_transient_give_stats_%',
968 968
 				'give_cache%',
969 969
 				'%_transient_give_add_ons_feed%',
970
-				'%_transient__give_ajax_works' .
970
+				'%_transient__give_ajax_works'.
971 971
 				'%_transient_give_total_api_keys%',
972 972
 				'%_transient_give_i18n_give_promo_hide%',
973 973
 				'%_transient_give_contributors%',
@@ -994,24 +994,24 @@  discard block
 block discarded – undo
994 994
 		ARRAY_A
995 995
 	);
996 996
 
997
-	if ( ! empty( $user_apikey_options ) ) {
998
-		foreach ( $user_apikey_options as $user ) {
999
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
1000
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
1001
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
997
+	if ( ! empty($user_apikey_options)) {
998
+		foreach ($user_apikey_options as $user) {
999
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
1000
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
1001
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
1002 1002
 		}
1003 1003
 	}
1004 1004
 
1005
-	if ( ! empty( $cached_options ) ) {
1006
-		foreach ( $cached_options as $option ) {
1007
-			switch ( true ) {
1008
-				case ( false !== strpos( $option, 'transient' ) ):
1009
-					$option = str_replace( '_transient_', '', $option );
1010
-					delete_transient( $option );
1005
+	if ( ! empty($cached_options)) {
1006
+		foreach ($cached_options as $option) {
1007
+			switch (true) {
1008
+				case (false !== strpos($option, 'transient')):
1009
+					$option = str_replace('_transient_', '', $option);
1010
+					delete_transient($option);
1011 1011
 					break;
1012 1012
 
1013 1013
 				default:
1014
-					delete_option( $option );
1014
+					delete_option($option);
1015 1015
 			}
1016 1016
 		}
1017 1017
 	}
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 	global $wp_roles;
1030 1030
 
1031 1031
 	// Get the role object.
1032
-	$give_worker = get_role( 'give_worker' );
1032
+	$give_worker = get_role('give_worker');
1033 1033
 
1034 1034
 	// A list of capabilities to add for give workers.
1035 1035
 	$caps_to_add = array(
@@ -1037,9 +1037,9 @@  discard block
 block discarded – undo
1037 1037
 		'edit_pages',
1038 1038
 	);
1039 1039
 
1040
-	foreach ( $caps_to_add as $cap ) {
1040
+	foreach ($caps_to_add as $cap) {
1041 1041
 		// Add the capability.
1042
-		$give_worker->add_cap( $cap );
1042
+		$give_worker->add_cap($cap);
1043 1043
 	}
1044 1044
 
1045 1045
 }
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	$give_updates = Give_Updates::get_instance();
1057 1057
 
1058 1058
 	// form query.
1059
-	$donation_forms = new WP_Query( array(
1059
+	$donation_forms = new WP_Query(array(
1060 1060
 			'paged'          => $give_updates->step,
1061 1061
 			'status'         => 'any',
1062 1062
 			'order'          => 'ASC',
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
 		)
1066 1066
 	);
1067 1067
 
1068
-	if ( $donation_forms->have_posts() ) {
1069
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1068
+	if ($donation_forms->have_posts()) {
1069
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1070 1070
 
1071
-		while ( $donation_forms->have_posts() ) {
1071
+		while ($donation_forms->have_posts()) {
1072 1072
 			$donation_forms->the_post();
1073 1073
 			$form_id = get_the_ID();
1074 1074
 
@@ -1076,41 +1076,41 @@  discard block
 block discarded – undo
1076 1076
 			update_post_meta(
1077 1077
 				$form_id,
1078 1078
 				'_give_set_price',
1079
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1079
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1080 1080
 			);
1081 1081
 
1082 1082
 			// Remove formatting from _give_custom_amount_minimum.
1083 1083
 			update_post_meta(
1084 1084
 				$form_id,
1085 1085
 				'_give_custom_amount_minimum',
1086
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1086
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1087 1087
 			);
1088 1088
 
1089 1089
 			// Bailout.
1090
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1090
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1091 1091
 				continue;
1092 1092
 			}
1093 1093
 
1094
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1094
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1095 1095
 
1096
-			if ( ! empty( $donation_levels ) ) {
1096
+			if ( ! empty($donation_levels)) {
1097 1097
 
1098
-				foreach ( $donation_levels as $index => $donation_level ) {
1099
-					if ( isset( $donation_level['_give_amount'] ) ) {
1100
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1098
+				foreach ($donation_levels as $index => $donation_level) {
1099
+					if (isset($donation_level['_give_amount'])) {
1100
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1101 1101
 					}
1102 1102
 				}
1103 1103
 
1104
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1104
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1105 1105
 
1106
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1106
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1107 1107
 
1108
-				$min_amount = min( $donation_levels_amounts );
1109
-				$max_amount = max( $donation_levels_amounts );
1108
+				$min_amount = min($donation_levels_amounts);
1109
+				$max_amount = max($donation_levels_amounts);
1110 1110
 
1111 1111
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1112
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1113
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1112
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1113
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1114 1114
 			}
1115 1115
 
1116 1116
 		}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 		wp_reset_postdata();
1120 1120
 	} else {
1121 1121
 		// The Update Ran.
1122
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1122
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1123 1123
 	}
1124 1124
 
1125 1125
 }
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
  */
1170 1170
 function give_v20_upgrades() {
1171 1171
 	// Update cache setting.
1172
-	give_update_option( 'cache', 'enabled' );
1172
+	give_update_option('cache', 'enabled');
1173 1173
 
1174 1174
 	// Upgrade email settings.
1175 1175
 	give_v20_upgrades_email_setting();
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 	$all_setting = give_get_settings();
1189 1189
 
1190 1190
 	// Bailout on fresh install.
1191
-	if ( empty( $all_setting ) ) {
1191
+	if (empty($all_setting)) {
1192 1192
 		return;
1193 1193
 	}
1194 1194
 
@@ -1207,19 +1207,19 @@  discard block
 block discarded – undo
1207 1207
 		'admin_notices'                 => 'new-donation_notification',
1208 1208
 	);
1209 1209
 
1210
-	foreach ( $settings as $old_setting => $new_setting ) {
1210
+	foreach ($settings as $old_setting => $new_setting) {
1211 1211
 		// Do not update already modified
1212
-		if ( ! is_array( $new_setting ) ) {
1213
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1212
+		if ( ! is_array($new_setting)) {
1213
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1214 1214
 				continue;
1215 1215
 			}
1216 1216
 		}
1217 1217
 
1218
-		switch ( $old_setting ) {
1218
+		switch ($old_setting) {
1219 1219
 			case 'admin_notices':
1220
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1220
+				$notification_status = give_get_option($old_setting, 'enabled');
1221 1221
 
1222
-				give_update_option( $new_setting, $notification_status );
1222
+				give_update_option($new_setting, $notification_status);
1223 1223
 
1224 1224
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1225 1225
 				// give_delete_option( $old_setting );
@@ -1230,19 +1230,19 @@  discard block
 block discarded – undo
1230 1230
 			case 'admin_notice_emails':
1231 1231
 				$recipients = give_get_admin_notice_emails();
1232 1232
 
1233
-				foreach ( $new_setting as $setting ) {
1233
+				foreach ($new_setting as $setting) {
1234 1234
 					// bailout if setting already exist.
1235
-					if ( array_key_exists( $setting, $all_setting ) ) {
1235
+					if (array_key_exists($setting, $all_setting)) {
1236 1236
 						continue;
1237 1237
 					}
1238 1238
 
1239
-					give_update_option( $setting, $recipients );
1239
+					give_update_option($setting, $recipients);
1240 1240
 				}
1241 1241
 				break;
1242 1242
 
1243 1243
 			default:
1244
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1245
-				give_delete_option( $old_setting );
1244
+				give_update_option($new_setting, give_get_option($old_setting));
1245
+				give_delete_option($old_setting);
1246 1246
 		}
1247 1247
 	}
1248 1248
 }
@@ -1259,22 +1259,22 @@  discard block
 block discarded – undo
1259 1259
 	$give_settings        = give_get_settings();
1260 1260
 	$give_setting_updated = false;
1261 1261
 
1262
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1262
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1263 1263
 		$give_settings['number_decimals']   = 0;
1264 1264
 		$give_settings['decimal_separator'] = '';
1265 1265
 		$give_setting_updated               = true;
1266 1266
 
1267
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1267
+	} elseif (empty($give_settings['decimal_separator'])) {
1268 1268
 		$give_settings['number_decimals'] = 0;
1269 1269
 		$give_setting_updated             = true;
1270 1270
 
1271
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1271
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1272 1272
 		$give_settings['number_decimals'] = 5;
1273 1273
 		$give_setting_updated             = true;
1274 1274
 	}
1275 1275
 
1276
-	if ( $give_setting_updated ) {
1277
-		update_option( 'give_settings', $give_settings, false );
1276
+	if ($give_setting_updated) {
1277
+		update_option('give_settings', $give_settings, false);
1278 1278
 	}
1279 1279
 }
1280 1280
 
@@ -1293,69 +1293,69 @@  discard block
 block discarded – undo
1293 1293
 	$give_updates = Give_Updates::get_instance();
1294 1294
 
1295 1295
 	// form query.
1296
-	$donation_forms = new WP_Query( array(
1296
+	$donation_forms = new WP_Query(array(
1297 1297
 			'paged'          => $give_updates->step,
1298 1298
 			'status'         => 'any',
1299 1299
 			'order'          => 'ASC',
1300
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1300
+			'post_type'      => array('give_forms', 'give_payment'),
1301 1301
 			'posts_per_page' => 20,
1302 1302
 		)
1303 1303
 	);
1304
-	if ( $donation_forms->have_posts() ) {
1305
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1304
+	if ($donation_forms->have_posts()) {
1305
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1306 1306
 
1307
-		while ( $donation_forms->have_posts() ) {
1307
+		while ($donation_forms->have_posts()) {
1308 1308
 			$donation_forms->the_post();
1309 1309
 			global $post;
1310 1310
 
1311
-			$meta = get_post_meta( $post->ID );
1311
+			$meta = get_post_meta($post->ID);
1312 1312
 
1313
-			switch ( $post->post_type ) {
1313
+			switch ($post->post_type) {
1314 1314
 				case 'give_forms':
1315 1315
 					// _give_set_price.
1316
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1317
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1316
+					if ( ! empty($meta['_give_set_price'][0])) {
1317
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1318 1318
 					}
1319 1319
 
1320 1320
 					// _give_custom_amount_minimum.
1321
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1322
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1321
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1322
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1323 1323
 					}
1324 1324
 
1325 1325
 					// _give_levels_minimum_amount.
1326
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1327
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1326
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1327
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1328 1328
 					}
1329 1329
 
1330 1330
 					// _give_levels_maximum_amount.
1331
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1332
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1331
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1332
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1333 1333
 					}
1334 1334
 
1335 1335
 					// _give_set_goal.
1336
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1337
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1336
+					if ( ! empty($meta['_give_set_goal'][0])) {
1337
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1338 1338
 					}
1339 1339
 
1340 1340
 					// _give_form_earnings.
1341
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1342
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1341
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1342
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1343 1343
 					}
1344 1344
 
1345 1345
 					// _give_custom_amount_minimum.
1346
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1347
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1346
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1347
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1348 1348
 
1349
-						foreach ( $donation_levels as $index => $level ) {
1350
-							if ( empty( $level['_give_amount'] ) ) {
1349
+						foreach ($donation_levels as $index => $level) {
1350
+							if (empty($level['_give_amount'])) {
1351 1351
 								continue;
1352 1352
 							}
1353 1353
 
1354
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1354
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1355 1355
 						}
1356 1356
 
1357 1357
 						$meta['_give_donation_levels'] = $donation_levels;
1358
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1358
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1359 1359
 					}
1360 1360
 
1361 1361
 
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 				case 'give_payment':
1365 1365
 					// _give_payment_total.
1366
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1367
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1366
+					if ( ! empty($meta['_give_payment_total'][0])) {
1367
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1368 1368
 					}
1369 1369
 
1370 1370
 					break;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		wp_reset_postdata();
1376 1376
 	} else {
1377 1377
 		// The Update Ran.
1378
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1378
+		give_set_upgrade_complete('v1812_update_amount_values');
1379 1379
 	}
1380 1380
 }
1381 1381
 
@@ -1394,22 +1394,22 @@  discard block
 block discarded – undo
1394 1394
 	$give_updates = Give_Updates::get_instance();
1395 1395
 
1396 1396
 	// form query.
1397
-	$donors = Give()->donors->get_donors( array(
1397
+	$donors = Give()->donors->get_donors(array(
1398 1398
 			'number' => 20,
1399
-			'offset' => $give_updates->get_offset( 20 ),
1399
+			'offset' => $give_updates->get_offset(20),
1400 1400
 		)
1401 1401
 	);
1402 1402
 
1403
-	if ( ! empty( $donors ) ) {
1404
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1403
+	if ( ! empty($donors)) {
1404
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1405 1405
 
1406 1406
 		/* @var Object $donor */
1407
-		foreach ( $donors as $donor ) {
1408
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1407
+		foreach ($donors as $donor) {
1408
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1409 1409
 		}
1410 1410
 	} else {
1411 1411
 		// The Update Ran.
1412
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1412
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1413 1413
 	}
1414 1414
 }
1415 1415
 
@@ -1423,25 +1423,25 @@  discard block
 block discarded – undo
1423 1423
 	$give_updates = Give_Updates::get_instance();
1424 1424
 
1425 1425
 	// Fetch all the existing donors.
1426
-	$donors = Give()->donors->get_donors( array(
1426
+	$donors = Give()->donors->get_donors(array(
1427 1427
 			'number' => 20,
1428
-			'offset' => $give_updates->get_offset( 20 ),
1428
+			'offset' => $give_updates->get_offset(20),
1429 1429
 		)
1430 1430
 	);
1431 1431
 
1432
-	if ( ! empty( $donors ) ) {
1433
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1432
+	if ( ! empty($donors)) {
1433
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1434 1434
 
1435 1435
 		/* @var Object $donor */
1436
-		foreach ( $donors as $donor ) {
1436
+		foreach ($donors as $donor) {
1437 1437
 			$user_id = $donor->user_id;
1438 1438
 
1439 1439
 			// Proceed, if donor is attached with user.
1440
-			if ( $user_id ) {
1441
-				$user = get_userdata( $user_id );
1440
+			if ($user_id) {
1441
+				$user = get_userdata($user_id);
1442 1442
 
1443 1443
 				// Update user role, if user has subscriber role.
1444
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1444
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1445 1445
 					wp_update_user(
1446 1446
 						array(
1447 1447
 							'ID'   => $user_id,
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 		}
1454 1454
 	} else {
1455 1455
 		// The Update Ran.
1456
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1456
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1457 1457
 	}
1458 1458
 }
1459 1459
 
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
  */
1466 1466
 function give_v1813_upgrades() {
1467 1467
 	// Update admin setting.
1468
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1468
+	give_update_option('donor_default_user_role', 'give_donor');
1469 1469
 
1470 1470
 	// Update Give roles.
1471 1471
 	$roles = new Give_Roles();
@@ -1483,33 +1483,33 @@  discard block
 block discarded – undo
1483 1483
 	$give_updates = Give_Updates::get_instance();
1484 1484
 
1485 1485
 	// form query.
1486
-	$payments = new WP_Query( array(
1486
+	$payments = new WP_Query(array(
1487 1487
 			'paged'          => $give_updates->step,
1488 1488
 			'status'         => 'any',
1489 1489
 			'order'          => 'ASC',
1490
-			'post_type'      => array( 'give_payment' ),
1490
+			'post_type'      => array('give_payment'),
1491 1491
 			'posts_per_page' => 100,
1492 1492
 		)
1493 1493
 	);
1494 1494
 
1495
-	if ( $payments->have_posts() ) {
1496
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1495
+	if ($payments->have_posts()) {
1496
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1497 1497
 
1498
-		while ( $payments->have_posts() ) {
1498
+		while ($payments->have_posts()) {
1499 1499
 			$payments->the_post();
1500 1500
 
1501
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1501
+			$payment_meta = give_get_payment_meta(get_the_ID());
1502 1502
 
1503
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1503
+			if ('RIAL' === $payment_meta['currency']) {
1504 1504
 				$payment_meta['currency'] = 'IRR';
1505
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1505
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1506 1506
 			}
1507 1507
 
1508 1508
 		}
1509 1509
 
1510 1510
 	} else {
1511 1511
 		// The Update Ran.
1512
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1512
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1513 1513
 	}
1514 1514
 }
1515 1515
 
@@ -1522,9 +1522,9 @@  discard block
 block discarded – undo
1522 1522
 function give_v1817_upgrades() {
1523 1523
 	$give_settings = give_get_settings();
1524 1524
 
1525
-	if ( 'RIAL' === $give_settings['currency'] ) {
1525
+	if ('RIAL' === $give_settings['currency']) {
1526 1526
 		$give_settings['currency'] = 'IRR';
1527
-		update_option( 'give_settings', $give_settings, false );
1527
+		update_option('give_settings', $give_settings, false);
1528 1528
 	}
1529 1529
 }
1530 1530
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 
1538 1538
 	global $wp_roles;
1539 1539
 
1540
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1540
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1541 1541
 		return;
1542 1542
 	}
1543 1543
 
@@ -1561,15 +1561,15 @@  discard block
 block discarded – undo
1561 1561
 		),
1562 1562
 	);
1563 1563
 
1564
-	foreach ( $add_caps as $role => $caps ) {
1565
-		foreach ( $caps as $cap ) {
1566
-			$wp_roles->add_cap( $role, $cap );
1564
+	foreach ($add_caps as $role => $caps) {
1565
+		foreach ($caps as $cap) {
1566
+			$wp_roles->add_cap($role, $cap);
1567 1567
 		}
1568 1568
 	}
1569 1569
 
1570
-	foreach ( $remove_caps as $role => $caps ) {
1571
-		foreach ( $caps as $cap ) {
1572
-			$wp_roles->remove_cap( $role, $cap );
1570
+	foreach ($remove_caps as $role => $caps) {
1571
+		foreach ($caps as $cap) {
1572
+			$wp_roles->remove_cap($role, $cap);
1573 1573
 		}
1574 1574
 	}
1575 1575
 
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 	$roles->add_roles();
1594 1594
 	$roles->add_caps();
1595 1595
 
1596
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1596
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1597 1597
 }
1598 1598
 
1599 1599
 /**
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 function give_v1818_upgrades() {
1605 1605
 
1606 1606
 	// Remove email_access_installed from give_settings.
1607
-	give_delete_option( 'email_access_installed' );
1607
+	give_delete_option('email_access_installed');
1608 1608
 }
1609 1609
 
1610 1610
 /**
@@ -1617,23 +1617,23 @@  discard block
 block discarded – undo
1617 1617
 	/* @var Give_Updates $give_updates */
1618 1618
 	$give_updates = Give_Updates::get_instance();
1619 1619
 
1620
-	$donations = new WP_Query( array(
1620
+	$donations = new WP_Query(array(
1621 1621
 			'paged'          => $give_updates->step,
1622 1622
 			'status'         => 'any',
1623 1623
 			'order'          => 'ASC',
1624
-			'post_type'      => array( 'give_payment' ),
1624
+			'post_type'      => array('give_payment'),
1625 1625
 			'posts_per_page' => 100,
1626 1626
 		)
1627 1627
 	);
1628 1628
 
1629
-	if ( $donations->have_posts() ) {
1630
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1629
+	if ($donations->have_posts()) {
1630
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1631 1631
 
1632
-		while ( $donations->have_posts() ) {
1632
+		while ($donations->have_posts()) {
1633 1633
 			$donations->the_post();
1634 1634
 
1635
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1636
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1635
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1636
+			$donation_meta = give_get_payment_meta(get_the_ID());
1637 1637
 
1638 1638
 			// Update Donation meta with price_id set as custom, only if it is:
1639 1639
 			// 1. Donation Type = Set Donation.
@@ -1642,19 +1642,19 @@  discard block
 block discarded – undo
1642 1642
 			if (
1643 1643
 				$form->ID &&
1644 1644
 				$form->is_set_type_donation_form() &&
1645
-				( 'custom' !== $donation_meta['price_id'] ) &&
1646
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1645
+				('custom' !== $donation_meta['price_id']) &&
1646
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1647 1647
 			) {
1648 1648
 				$donation_meta['price_id'] = 'custom';
1649
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1650
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1649
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1650
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654 1654
 		wp_reset_postdata();
1655 1655
 	} else {
1656 1656
 		// Update Ran Successfully.
1657
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1657
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1658 1658
 	}
1659 1659
 }
1660 1660
 
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 	global $wp_roles;
1674 1674
 
1675
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1675
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1676 1676
 		return;
1677 1677
 	}
1678 1678
 
@@ -1690,9 +1690,9 @@  discard block
 block discarded – undo
1690 1690
 		),
1691 1691
 	);
1692 1692
 
1693
-	foreach ( $remove_caps as $role => $caps ) {
1694
-		foreach ( $caps as $cap ) {
1695
-			$wp_roles->remove_cap( $role, $cap );
1693
+	foreach ($remove_caps as $role => $caps) {
1694
+		foreach ($caps as $cap) {
1695
+			$wp_roles->remove_cap($role, $cap);
1696 1696
 		}
1697 1697
 	}
1698 1698
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	$roles->add_roles();
1704 1704
 	$roles->add_caps();
1705 1705
 
1706
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1706
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1707 1707
 }
1708 1708
 
1709 1709
 /**
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	$give_updates = Give_Updates::get_instance();
1718 1718
 
1719 1719
 	// form query
1720
-	$forms = new WP_Query( array(
1720
+	$forms = new WP_Query(array(
1721 1721
 			'paged'          => $give_updates->step,
1722 1722
 			'status'         => 'any',
1723 1723
 			'order'          => 'ASC',
@@ -1726,22 +1726,22 @@  discard block
 block discarded – undo
1726 1726
 		)
1727 1727
 	);
1728 1728
 
1729
-	if ( $forms->have_posts() ) {
1730
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1729
+	if ($forms->have_posts()) {
1730
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1731 1731
 
1732
-		while ( $forms->have_posts() ) {
1732
+		while ($forms->have_posts()) {
1733 1733
 			$forms->the_post();
1734 1734
 			global $post;
1735 1735
 
1736 1736
 			// Update offline instruction email notification status.
1737
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1738
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1737
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1738
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1739 1739
 				'enabled',
1740 1740
 				'global',
1741
-			) )
1741
+			))
1742 1742
 				? $offline_instruction_notification_status
1743 1743
 				: 'global';
1744
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1744
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1745 1745
 
1746 1746
 			// Update offline instruction email message.
1747 1747
 			update_post_meta(
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 		wp_reset_postdata();
1774 1774
 	} else {
1775 1775
 		// No more forms found, finish up.
1776
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1776
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1777 1777
 	}
1778 1778
 }
1779 1779
 
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
 	$give_updates = Give_Updates::get_instance();
1791 1791
 
1792 1792
 	// form query
1793
-	$forms = new WP_Query( array(
1793
+	$forms = new WP_Query(array(
1794 1794
 			'paged'          => $give_updates->step,
1795 1795
 			'status'         => 'any',
1796 1796
 			'order'          => 'ASC',
@@ -1799,19 +1799,19 @@  discard block
 block discarded – undo
1799 1799
 		)
1800 1800
 	);
1801 1801
 
1802
-	if ( $forms->have_posts() ) {
1803
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1802
+	if ($forms->have_posts()) {
1803
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1804 1804
 
1805
-		while ( $forms->have_posts() ) {
1805
+		while ($forms->have_posts()) {
1806 1806
 			$forms->the_post();
1807 1807
 			global $post;
1808 1808
 
1809 1809
 			// Split _give_payment_meta meta.
1810 1810
 			// @todo Remove _give_payment_meta after releases 2.0
1811
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1811
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1812 1812
 
1813
-			if ( ! empty( $payment_meta ) ) {
1814
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1813
+			if ( ! empty($payment_meta)) {
1814
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1815 1815
 			}
1816 1816
 
1817 1817
 			$deprecated_meta_keys = array(
@@ -1820,9 +1820,9 @@  discard block
 block discarded – undo
1820 1820
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1821 1821
 			);
1822 1822
 
1823
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1823
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1824 1824
 				// Do not add new meta key if already exist.
1825
-				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 ) ) ) {
1825
+				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))) {
1826 1826
 					continue;
1827 1827
 				}
1828 1828
 
@@ -1831,25 +1831,25 @@  discard block
 block discarded – undo
1831 1831
 					array(
1832 1832
 						'post_id'    => $post->ID,
1833 1833
 						'meta_key'   => $new_meta_key,
1834
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1834
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1835 1835
 					)
1836 1836
 				);
1837 1837
 			}
1838 1838
 
1839 1839
 			// Bailout
1840
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1840
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1841 1841
 				/* @var Give_Donor $donor */
1842
-				$donor = new Give_Donor( $donor_id );
1842
+				$donor = new Give_Donor($donor_id);
1843 1843
 
1844
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1845
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1846
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1847
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1848
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1849
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1844
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1845
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1846
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1847
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1848
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1849
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1850 1850
 
1851 1851
 				// Save address.
1852
-				$donor->add_address( 'billing[]', $address );
1852
+				$donor->add_address('billing[]', $address);
1853 1853
 			}
1854 1854
 
1855 1855
 		}// End while().
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1861 1861
 
1862 1862
 		// No more forms found, finish up.
1863
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1863
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1864 1864
 	}
1865 1865
 }
1866 1866
 
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 	$give_updates = Give_Updates::get_instance();
1877 1877
 
1878 1878
 	// form query
1879
-	$forms = new WP_Query( array(
1879
+	$forms = new WP_Query(array(
1880 1880
 			'paged'          => $give_updates->step,
1881 1881
 			'order'          => 'DESC',
1882 1882
 			'post_type'      => 'give_log',
@@ -1885,20 +1885,20 @@  discard block
 block discarded – undo
1885 1885
 		)
1886 1886
 	);
1887 1887
 
1888
-	if ( $forms->have_posts() ) {
1889
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1888
+	if ($forms->have_posts()) {
1889
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1890 1890
 
1891
-		while ( $forms->have_posts() ) {
1891
+		while ($forms->have_posts()) {
1892 1892
 			$forms->the_post();
1893 1893
 			global $post;
1894 1894
 
1895
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1895
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1896 1896
 				continue;
1897 1897
 			}
1898 1898
 
1899
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1900
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1901
-			$term_name = ! empty( $term ) ? $term->slug : '';
1899
+			$term      = get_the_terms($post->ID, 'give_log_type');
1900
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1901
+			$term_name = ! empty($term) ? $term->slug : '';
1902 1902
 
1903 1903
 			$log_data = array(
1904 1904
 				'ID'           => $post->ID,
@@ -1911,29 +1911,29 @@  discard block
 block discarded – undo
1911 1911
 			);
1912 1912
 			$log_meta = array();
1913 1913
 
1914
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1915
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1916
-					switch ( $meta_key ) {
1914
+			if ($old_log_meta = get_post_meta($post->ID)) {
1915
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1916
+					switch ($meta_key) {
1917 1917
 						case '_give_log_payment_id':
1918
-							$log_data['log_parent']        = current( $meta_value );
1918
+							$log_data['log_parent']        = current($meta_value);
1919 1919
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1920 1920
 							break;
1921 1921
 
1922 1922
 						default:
1923
-							$log_meta[ $meta_key ] = current( $meta_value );
1923
+							$log_meta[$meta_key] = current($meta_value);
1924 1924
 					}
1925 1925
 				}
1926 1926
 			}
1927 1927
 
1928
-			if ( 'api_request' === $term_name ) {
1928
+			if ('api_request' === $term_name) {
1929 1929
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1930 1930
 			}
1931 1931
 
1932
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1932
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1933 1933
 
1934
-			if ( ! empty( $log_meta ) ) {
1935
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1936
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1934
+			if ( ! empty($log_meta)) {
1935
+				foreach ($log_meta as $meta_key => $meta_value) {
1936
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1937 1937
 				}
1938 1938
 			}
1939 1939
 
@@ -1975,7 +1975,7 @@  discard block
 block discarded – undo
1975 1975
 		Give()->logs->delete_cache();
1976 1976
 
1977 1977
 		// No more forms found, finish up.
1978
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1978
+		give_set_upgrade_complete('v20_logs_upgrades');
1979 1979
 	}
1980 1980
 }
1981 1981
 
@@ -1991,19 +1991,19 @@  discard block
 block discarded – undo
1991 1991
 	$give_updates = Give_Updates::get_instance();
1992 1992
 
1993 1993
 	// form query
1994
-	$payments = new WP_Query( array(
1994
+	$payments = new WP_Query(array(
1995 1995
 			'paged'          => $give_updates->step,
1996 1996
 			'status'         => 'any',
1997 1997
 			'order'          => 'ASC',
1998
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1998
+			'post_type'      => array('give_forms', 'give_payment'),
1999 1999
 			'posts_per_page' => 100,
2000 2000
 		)
2001 2001
 	);
2002 2002
 
2003
-	if ( $payments->have_posts() ) {
2004
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
2003
+	if ($payments->have_posts()) {
2004
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
2005 2005
 
2006
-		while ( $payments->have_posts() ) {
2006
+		while ($payments->have_posts()) {
2007 2007
 			$payments->the_post();
2008 2008
 			global $post;
2009 2009
 
@@ -2015,19 +2015,19 @@  discard block
 block discarded – undo
2015 2015
 				ARRAY_A
2016 2016
 			);
2017 2017
 
2018
-			if ( ! empty( $meta_data ) ) {
2019
-				foreach ( $meta_data as $index => $data ) {
2018
+			if ( ! empty($meta_data)) {
2019
+				foreach ($meta_data as $index => $data) {
2020 2020
 					// Check for duplicate meta values.
2021
-					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 ) ) {
2021
+					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)) {
2022 2022
 						continue;
2023 2023
 					}
2024 2024
 
2025
-					switch ( $post->post_type ) {
2025
+					switch ($post->post_type) {
2026 2026
 						case 'give_forms':
2027 2027
 							$data['form_id'] = $data['post_id'];
2028
-							unset( $data['post_id'] );
2028
+							unset($data['post_id']);
2029 2029
 
2030
-							Give()->form_meta->insert( $data );
2030
+							Give()->form_meta->insert($data);
2031 2031
 							// @todo: delete form meta from post meta table after releases 2.0.
2032 2032
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2033 2033
 
@@ -2035,9 +2035,9 @@  discard block
 block discarded – undo
2035 2035
 
2036 2036
 						case 'give_payment':
2037 2037
 							$data['payment_id'] = $data['post_id'];
2038
-							unset( $data['post_id'] );
2038
+							unset($data['post_id']);
2039 2039
 
2040
-							Give()->payment_meta->insert( $data );
2040
+							Give()->payment_meta->insert($data);
2041 2041
 
2042 2042
 							// @todo: delete donation meta from post meta table after releases 2.0.
2043 2043
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
 		wp_reset_postdata();
2053 2053
 	} else {
2054 2054
 		// No more forms found, finish up.
2055
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2055
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2056 2056
 	}
2057 2057
 
2058 2058
 }
@@ -2068,44 +2068,44 @@  discard block
 block discarded – undo
2068 2068
 	/* @var Give_Updates $give_updates */
2069 2069
 	$give_updates = Give_Updates::get_instance();
2070 2070
 
2071
-	$donors = Give()->donors->get_donors( array(
2071
+	$donors = Give()->donors->get_donors(array(
2072 2072
 		'paged'  => $give_updates->step,
2073 2073
 		'number' => 100,
2074
-	) );
2074
+	));
2075 2075
 
2076
-	if ( $donors ) {
2077
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2076
+	if ($donors) {
2077
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2078 2078
 		// Loop through Donors
2079
-		foreach ( $donors as $donor ) {
2079
+		foreach ($donors as $donor) {
2080 2080
 
2081
-			$donor_name       = explode( ' ', $donor->name, 2 );
2082
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2083
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2081
+			$donor_name       = explode(' ', $donor->name, 2);
2082
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2083
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2084 2084
 
2085 2085
 			// If first name meta of donor is not created, then create it.
2086
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2087
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2086
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2087
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2088 2088
 			}
2089 2089
 
2090 2090
 			// If last name meta of donor is not created, then create it.
2091
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2092
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2091
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2092
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2093 2093
 			}
2094 2094
 
2095 2095
 			// If Donor is connected with WP User then update user meta.
2096
-			if ( $donor->user_id ) {
2097
-				if ( isset( $donor_name[0] ) ) {
2098
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2096
+			if ($donor->user_id) {
2097
+				if (isset($donor_name[0])) {
2098
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2099 2099
 				}
2100
-				if ( isset( $donor_name[1] ) ) {
2101
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2100
+				if (isset($donor_name[1])) {
2101
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2102 2102
 				}
2103 2103
 			}
2104 2104
 		}
2105 2105
 
2106 2106
 	} else {
2107 2107
 		// The Update Ran.
2108
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2108
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2109 2109
 	}
2110 2110
 
2111 2111
 }
@@ -2134,15 +2134,15 @@  discard block
 block discarded – undo
2134 2134
 
2135 2135
 	$users = $user_query->get_results();
2136 2136
 
2137
-	if ( $users ) {
2138
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2137
+	if ($users) {
2138
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2139 2139
 
2140 2140
 		// Loop through Donors
2141
-		foreach ( $users as $user ) {
2141
+		foreach ($users as $user) {
2142 2142
 			/* @var Give_Donor $donor */
2143
-			$donor = new Give_Donor( $user->ID, true );
2143
+			$donor = new Give_Donor($user->ID, true);
2144 2144
 
2145
-			if ( ! $donor->id ) {
2145
+			if ( ! $donor->id) {
2146 2146
 				continue;
2147 2147
 			}
2148 2148
 
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
 				)
2159 2159
 			);
2160 2160
 
2161
-			if ( ! empty( $address ) ) {
2162
-				$address = maybe_unserialize( $address );
2163
-				$donor->add_address( 'personal', $address );
2164
-				$donor->add_address( 'billing[]', $address );
2161
+			if ( ! empty($address)) {
2162
+				$address = maybe_unserialize($address);
2163
+				$donor->add_address('personal', $address);
2164
+				$donor->add_address('billing[]', $address);
2165 2165
 
2166 2166
 
2167 2167
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
 
2172 2172
 	} else {
2173 2173
 		// The Update Ran.
2174
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2174
+		give_set_upgrade_complete('v20_upgrades_user_address');
2175 2175
 	}
2176 2176
 
2177 2177
 }
@@ -2195,15 +2195,15 @@  discard block
 block discarded – undo
2195 2195
 	);
2196 2196
 
2197 2197
 	// Alter customer table
2198
-	foreach ( $tables as $old_table => $new_table ) {
2198
+	foreach ($tables as $old_table => $new_table) {
2199 2199
 		if (
2200
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2201
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2200
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2201
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2202 2202
 		) {
2203
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2203
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2204 2204
 
2205
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2206
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2205
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2206
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2207 2207
 			}
2208 2208
 		}
2209 2209
 	}
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 	$give_updates->percentage = 100;
2212 2212
 
2213 2213
 	// No more forms found, finish up.
2214
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2214
+	give_set_upgrade_complete('v20_rename_donor_tables');
2215 2215
 
2216 2216
 	// Re initiate donor classes.
2217 2217
 	Give()->donors     = new Give_DB_Donors();
@@ -2229,19 +2229,19 @@  discard block
 block discarded – undo
2229 2229
 function give_v201_create_tables() {
2230 2230
 	global $wpdb;
2231 2231
 
2232
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2232
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2233 2233
 		Give()->payment_meta->create_table();
2234 2234
 	}
2235 2235
 
2236
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2236
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2237 2237
 		Give()->form_meta->create_table();
2238 2238
 	}
2239 2239
 
2240
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2240
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2241 2241
 		Give()->logs->log_db->create_table();
2242 2242
 	}
2243 2243
 
2244
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2244
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2245 2245
 		Give()->logs->logmeta_db->create_table();
2246 2246
 	}
2247 2247
 }
@@ -2266,31 +2266,31 @@  discard block
 block discarded – undo
2266 2266
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2267 2267
 			)
2268 2268
 			AND $wpdb->posts.post_type = 'give_payment'
2269
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2269
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2270 2270
 			ORDER BY $wpdb->posts.post_date ASC 
2271 2271
 			LIMIT 100
2272
-			OFFSET " . $give_updates->get_offset( 100 )
2272
+			OFFSET ".$give_updates->get_offset(100)
2273 2273
 	);
2274 2274
 
2275
-	if ( ! empty( $payments ) ) {
2276
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2275
+	if ( ! empty($payments)) {
2276
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2277 2277
 
2278
-		foreach ( $payments as $payment_id ) {
2279
-			$post = get_post( $payment_id );
2280
-			setup_postdata( $post );
2278
+		foreach ($payments as $payment_id) {
2279
+			$post = get_post($payment_id);
2280
+			setup_postdata($post);
2281 2281
 
2282 2282
 			// Do not add new meta keys if already refactored.
2283
-			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' ) ) ) {
2283
+			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'))) {
2284 2284
 				continue;
2285 2285
 			}
2286 2286
 
2287 2287
 
2288 2288
 			// Split _give_payment_meta meta.
2289 2289
 			// @todo Remove _give_payment_meta after releases 2.0
2290
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2290
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2291 2291
 
2292
-			if ( ! empty( $payment_meta ) ) {
2293
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2292
+			if ( ! empty($payment_meta)) {
2293
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2294 2294
 			}
2295 2295
 
2296 2296
 			$deprecated_meta_keys = array(
@@ -2299,9 +2299,9 @@  discard block
 block discarded – undo
2299 2299
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2300 2300
 			);
2301 2301
 
2302
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2302
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2303 2303
 				// Do not add new meta key if already exist.
2304
-				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 ) ) ) {
2304
+				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))) {
2305 2305
 					continue;
2306 2306
 				}
2307 2307
 
@@ -2310,25 +2310,25 @@  discard block
 block discarded – undo
2310 2310
 					array(
2311 2311
 						'post_id'    => $post->ID,
2312 2312
 						'meta_key'   => $new_meta_key,
2313
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2313
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2314 2314
 					)
2315 2315
 				);
2316 2316
 			}
2317 2317
 
2318 2318
 			// Bailout
2319
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2319
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2320 2320
 				/* @var Give_Donor $donor */
2321
-				$donor = new Give_Donor( $donor_id );
2321
+				$donor = new Give_Donor($donor_id);
2322 2322
 
2323
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2324
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2325
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2326
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2327
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2328
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2323
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2324
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2325
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2326
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2327
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2328
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2329 2329
 
2330 2330
 				// Save address.
2331
-				$donor->add_address( 'billing[]', $address );
2331
+				$donor->add_address('billing[]', $address);
2332 2332
 			}
2333 2333
 
2334 2334
 		}// End while().
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2340 2340
 
2341 2341
 		// No more forms found, finish up.
2342
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2342
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2343 2343
 	}
2344 2344
 }
2345 2345
 
@@ -2359,21 +2359,21 @@  discard block
 block discarded – undo
2359 2359
 			SELECT ID FROM $wpdb->posts 
2360 2360
 			WHERE 1=1
2361 2361
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2362
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2362
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2363 2363
 			ORDER BY $wpdb->posts.post_date ASC 
2364 2364
 			LIMIT 100
2365
-			OFFSET " . $give_updates->get_offset( 100 )
2365
+			OFFSET ".$give_updates->get_offset(100)
2366 2366
 	);
2367 2367
 
2368
-	if ( ! empty( $payments ) ) {
2369
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2368
+	if ( ! empty($payments)) {
2369
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2370 2370
 			'give_forms',
2371 2371
 			'give_payment',
2372
-		) ), $give_updates->step * 100 );
2372
+		)), $give_updates->step * 100);
2373 2373
 
2374
-		foreach ( $payments as $payment_id ) {
2375
-			$post = get_post( $payment_id );
2376
-			setup_postdata( $post );
2374
+		foreach ($payments as $payment_id) {
2375
+			$post = get_post($payment_id);
2376
+			setup_postdata($post);
2377 2377
 
2378 2378
 			$meta_data = $wpdb->get_results(
2379 2379
 				$wpdb->prepare(
@@ -2383,19 +2383,19 @@  discard block
 block discarded – undo
2383 2383
 				ARRAY_A
2384 2384
 			);
2385 2385
 
2386
-			if ( ! empty( $meta_data ) ) {
2387
-				foreach ( $meta_data as $index => $data ) {
2386
+			if ( ! empty($meta_data)) {
2387
+				foreach ($meta_data as $index => $data) {
2388 2388
 					// Check for duplicate meta values.
2389
-					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 ) ) {
2389
+					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)) {
2390 2390
 						continue;
2391 2391
 					}
2392 2392
 
2393
-					switch ( $post->post_type ) {
2393
+					switch ($post->post_type) {
2394 2394
 						case 'give_forms':
2395 2395
 							$data['form_id'] = $data['post_id'];
2396
-							unset( $data['post_id'] );
2396
+							unset($data['post_id']);
2397 2397
 
2398
-							Give()->form_meta->insert( $data );
2398
+							Give()->form_meta->insert($data);
2399 2399
 							// @todo: delete form meta from post meta table after releases 2.0.
2400 2400
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2401 2401
 
@@ -2403,9 +2403,9 @@  discard block
 block discarded – undo
2403 2403
 
2404 2404
 						case 'give_payment':
2405 2405
 							$data['payment_id'] = $data['post_id'];
2406
-							unset( $data['post_id'] );
2406
+							unset($data['post_id']);
2407 2407
 
2408
-							Give()->payment_meta->insert( $data );
2408
+							Give()->payment_meta->insert($data);
2409 2409
 
2410 2410
 							// @todo: delete donation meta from post meta table after releases 2.0.
2411 2411
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
 		wp_reset_postdata();
2421 2421
 	} else {
2422 2422
 		// No more forms found, finish up.
2423
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2423
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2424 2424
 	}
2425 2425
 
2426 2426
 }
@@ -2441,26 +2441,26 @@  discard block
 block discarded – undo
2441 2441
 			SELECT ID FROM $wpdb->posts 
2442 2442
 			WHERE 1=1
2443 2443
 			AND $wpdb->posts.post_type = 'give_log'
2444
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2444
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2445 2445
 			ORDER BY $wpdb->posts.post_date ASC 
2446 2446
 			LIMIT 100
2447
-			OFFSET " . $give_updates->get_offset( 100 )
2447
+			OFFSET ".$give_updates->get_offset(100)
2448 2448
 	);
2449 2449
 
2450
-	if ( ! empty( $logs ) ) {
2451
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2450
+	if ( ! empty($logs)) {
2451
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2452 2452
 
2453
-		foreach ( $logs as $log_id ) {
2454
-			$post = get_post( $log_id );
2455
-			setup_postdata( $post );
2453
+		foreach ($logs as $log_id) {
2454
+			$post = get_post($log_id);
2455
+			setup_postdata($post);
2456 2456
 
2457
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2457
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2458 2458
 				continue;
2459 2459
 			}
2460 2460
 
2461
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2462
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2463
-			$term_name = ! empty( $term ) ? $term->slug : '';
2461
+			$term      = get_the_terms($post->ID, 'give_log_type');
2462
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2463
+			$term_name = ! empty($term) ? $term->slug : '';
2464 2464
 
2465 2465
 			$log_data = array(
2466 2466
 				'ID'           => $post->ID,
@@ -2473,29 +2473,29 @@  discard block
 block discarded – undo
2473 2473
 			);
2474 2474
 			$log_meta = array();
2475 2475
 
2476
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2477
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2478
-					switch ( $meta_key ) {
2476
+			if ($old_log_meta = get_post_meta($post->ID)) {
2477
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2478
+					switch ($meta_key) {
2479 2479
 						case '_give_log_payment_id':
2480
-							$log_data['log_parent']        = current( $meta_value );
2480
+							$log_data['log_parent']        = current($meta_value);
2481 2481
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2482 2482
 							break;
2483 2483
 
2484 2484
 						default:
2485
-							$log_meta[ $meta_key ] = current( $meta_value );
2485
+							$log_meta[$meta_key] = current($meta_value);
2486 2486
 					}
2487 2487
 				}
2488 2488
 			}
2489 2489
 
2490
-			if ( 'api_request' === $term_name ) {
2490
+			if ('api_request' === $term_name) {
2491 2491
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2492 2492
 			}
2493 2493
 
2494
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2494
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2495 2495
 
2496
-			if ( ! empty( $log_meta ) ) {
2497
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2498
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2496
+			if ( ! empty($log_meta)) {
2497
+				foreach ($log_meta as $meta_key => $meta_value) {
2498
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2499 2499
 				}
2500 2500
 			}
2501 2501
 
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
 		Give()->logs->delete_cache();
2509 2509
 
2510 2510
 		// No more forms found, finish up.
2511
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2511
+		give_set_upgrade_complete('v201_logs_upgrades');
2512 2512
 	}
2513 2513
 }
2514 2514
 
@@ -2523,51 +2523,51 @@  discard block
 block discarded – undo
2523 2523
 	global $wpdb;
2524 2524
 	give_v201_create_tables();
2525 2525
 
2526
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2527
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2528
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2526
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2527
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2528
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2529 2529
 		$donor_data = array();
2530 2530
 
2531
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2532
-			foreach ( $missing_donors as $donor_id ) {
2531
+		if ($missing_donors = array_diff($customers, $donors)) {
2532
+			foreach ($missing_donors as $donor_id) {
2533 2533
 				$donor_data[] = array(
2534
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2535
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2534
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2535
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2536 2536
 
2537 2537
 				);
2538 2538
 			}
2539 2539
 		}
2540 2540
 
2541
-		if ( ! empty( $donor_data ) ) {
2541
+		if ( ! empty($donor_data)) {
2542 2542
 			$donor_table_name      = Give()->donors->table_name;
2543 2543
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2544 2544
 
2545 2545
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2546 2546
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2547 2547
 
2548
-			foreach ( $donor_data as $donor ) {
2548
+			foreach ($donor_data as $donor) {
2549 2549
 				$donor['info'][0] = (array) $donor['info'][0];
2550 2550
 
2551 2551
 				// Prevent duplicate meta id issue.
2552
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2552
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2553 2553
 					continue;
2554 2554
 				}
2555 2555
 
2556
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2556
+				$donor_id = Give()->donors->add($donor['info'][0]);
2557 2557
 
2558
-				if ( ! empty( $donor['meta'] ) ) {
2559
-					foreach ( $donor['meta'] as $donor_meta ) {
2558
+				if ( ! empty($donor['meta'])) {
2559
+					foreach ($donor['meta'] as $donor_meta) {
2560 2560
 						$donor_meta = (array) $donor_meta;
2561 2561
 
2562 2562
 						// Prevent duplicate meta id issue.
2563
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2564
-							unset( $donor_meta['meta_id'] );
2563
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2564
+							unset($donor_meta['meta_id']);
2565 2565
 						}
2566 2566
 
2567 2567
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2568
-						unset( $donor_meta['customer_id'] );
2568
+						unset($donor_meta['customer_id']);
2569 2569
 
2570
-						Give()->donor_meta->insert( $donor_meta );
2570
+						Give()->donor_meta->insert($donor_meta);
2571 2571
 					}
2572 2572
 				}
2573 2573
 
@@ -2586,35 +2586,35 @@  discard block
 block discarded – undo
2586 2586
 					)
2587 2587
 				);
2588 2588
 
2589
-				$donor = new Give_Donor( $donor_id );
2589
+				$donor = new Give_Donor($donor_id);
2590 2590
 
2591
-				if ( ! empty( $address ) ) {
2592
-					$address = maybe_unserialize( $address );
2593
-					$donor->add_address( 'personal', $address );
2594
-					$donor->add_address( 'billing[]', $address );
2591
+				if ( ! empty($address)) {
2592
+					$address = maybe_unserialize($address);
2593
+					$donor->add_address('personal', $address);
2594
+					$donor->add_address('billing[]', $address);
2595 2595
 				}
2596 2596
 
2597
-				$donor_name       = explode( ' ', $donor->name, 2 );
2598
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2599
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2597
+				$donor_name       = explode(' ', $donor->name, 2);
2598
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2599
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2600 2600
 
2601 2601
 				// If first name meta of donor is not created, then create it.
2602
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2603
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2602
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2603
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2604 2604
 				}
2605 2605
 
2606 2606
 				// If last name meta of donor is not created, then create it.
2607
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2608
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2607
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2608
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2609 2609
 				}
2610 2610
 
2611 2611
 				// If Donor is connected with WP User then update user meta.
2612
-				if ( $donor->user_id ) {
2613
-					if ( isset( $donor_name[0] ) ) {
2614
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2612
+				if ($donor->user_id) {
2613
+					if (isset($donor_name[0])) {
2614
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2615 2615
 					}
2616
-					if ( isset( $donor_name[1] ) ) {
2617
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2616
+					if (isset($donor_name[1])) {
2617
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2618 2618
 					}
2619 2619
 				}
2620 2620
 			}
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
 	}
2626 2626
 
2627 2627
 	Give_Updates::get_instance()->percentage = 100;
2628
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2628
+	give_set_upgrade_complete('v201_add_missing_donors');
2629 2629
 }
2630 2630
 
2631 2631
 
@@ -2638,14 +2638,14 @@  discard block
 block discarded – undo
2638 2638
 	global $wpdb;
2639 2639
 
2640 2640
 	// Do not auto load option.
2641
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2641
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2642 2642
 
2643 2643
 	// Remove from cache.
2644 2644
 	$all_options = wp_load_alloptions();
2645 2645
 
2646
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2647
-		unset( $all_options['give_completed_upgrades'] );
2648
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2646
+	if (isset($all_options['give_completed_upgrades'])) {
2647
+		unset($all_options['give_completed_upgrades']);
2648
+		wp_cache_set('alloptions', $all_options, 'options');
2649 2649
 	}
2650 2650
 
2651 2651
 }
@@ -2656,7 +2656,7 @@  discard block
 block discarded – undo
2656 2656
  *
2657 2657
  * @since 2.2.0
2658 2658
  */
2659
-function give_v220_upgrades(){
2659
+function give_v220_upgrades() {
2660 2660
 	global $wpdb;
2661 2661
 
2662 2662
 	/**
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 		"
2703 2703
 	);
2704 2704
 
2705
-	if( ! empty( $option_like ) ) {
2706
-		$options = array_merge( $options, $option_like );
2705
+	if ( ! empty($option_like)) {
2706
+		$options = array_merge($options, $option_like);
2707 2707
 	}
2708 2708
 
2709
-	$options_str =  '\'' . implode( "','", $options ) . '\'';
2709
+	$options_str = '\''.implode("','", $options).'\'';
2710 2710
 
2711 2711
 	$wpdb->query(
2712 2712
 		"
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
 	$give_updates = Give_Updates::get_instance();
2728 2728
 
2729 2729
 	// form query.
2730
-	$donation_forms = new WP_Query( array(
2730
+	$donation_forms = new WP_Query(array(
2731 2731
 			'paged'          => $give_updates->step,
2732 2732
 			'status'         => 'any',
2733 2733
 			'order'          => 'ASC',
@@ -2736,16 +2736,16 @@  discard block
 block discarded – undo
2736 2736
 		)
2737 2737
 	);
2738 2738
 
2739
-	if ( $donation_forms->have_posts() ) {
2740
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
2739
+	if ($donation_forms->have_posts()) {
2740
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
2741 2741
 
2742
-		while ( $donation_forms->have_posts() ) {
2742
+		while ($donation_forms->have_posts()) {
2743 2743
 			$donation_forms->the_post();
2744 2744
 			$form_id = get_the_ID();
2745 2745
 
2746
-			$form_closed_status = give_get_meta( $form_id, '_give_form_status', true );
2747
-			if ( empty( $form_closed_status ) ) {
2748
-				give_set_form_closed_status( $form_id );
2746
+			$form_closed_status = give_get_meta($form_id, '_give_form_status', true);
2747
+			if (empty($form_closed_status)) {
2748
+				give_set_form_closed_status($form_id);
2749 2749
 			}
2750 2750
 		}
2751 2751
 
@@ -2755,7 +2755,7 @@  discard block
 block discarded – undo
2755 2755
 	} else {
2756 2756
 
2757 2757
 		// The Update Ran.
2758
-		give_set_upgrade_complete( 'v210_verify_form_status_upgrades' );
2758
+		give_set_upgrade_complete('v210_verify_form_status_upgrades');
2759 2759
 	}
2760 2760
 }
2761 2761
 
@@ -2774,22 +2774,22 @@  discard block
 block discarded – undo
2774 2774
 		SELECT DISTINCT payment_id
2775 2775
 		FROM {$donation_meta_table}
2776 2776
 		LIMIT 20
2777
-		OFFSET {$give_updates->get_offset( 20 )}
2777
+		OFFSET {$give_updates->get_offset(20)}
2778 2778
 		"
2779 2779
 	);
2780 2780
 
2781
-	if ( ! empty( $donations ) ) {
2782
-		foreach ( $donations as $donation ) {
2783
-			$donation_obj = get_post( $donation );
2781
+	if ( ! empty($donations)) {
2782
+		foreach ($donations as $donation) {
2783
+			$donation_obj = get_post($donation);
2784 2784
 
2785
-			if ( ! $donation_obj instanceof WP_Post ) {
2786
-				Give()->payment_meta->delete_all_meta( $donation );
2785
+			if ( ! $donation_obj instanceof WP_Post) {
2786
+				Give()->payment_meta->delete_all_meta($donation);
2787 2787
 			}
2788 2788
 		}
2789 2789
 	} else {
2790 2790
 
2791 2791
 		// The Update Ran.
2792
-		give_set_upgrade_complete( 'v213_delete_donation_meta' );
2792
+		give_set_upgrade_complete('v213_delete_donation_meta');
2793 2793
 	}
2794 2794
 }
2795 2795
 
@@ -2800,12 +2800,12 @@  discard block
 block discarded – undo
2800 2800
  *
2801 2801
  * @since 2.1.3
2802 2802
  */
2803
-function give_v213_rename_donation_meta_type_callback(){
2803
+function give_v213_rename_donation_meta_type_callback() {
2804 2804
 	global $wpdb;
2805 2805
 	$give_updates = Give_Updates::get_instance();
2806 2806
 
2807
-	$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)" );
2808
-	$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta" );
2807
+	$wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)");
2808
+	$wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta");
2809 2809
 
2810 2810
 	give_set_upgrade_complete('v213_rename_donation_meta_type');
2811 2811
 	$give_updates->set_percentage(1, 1);
@@ -2818,10 +2818,10 @@  discard block
 block discarded – undo
2818 2818
  */
2819 2819
 function give_v215_update_donor_user_roles_callback() {
2820 2820
 
2821
-	$role = get_role( 'give_manager' );
2822
-	$role->add_cap( 'view_give_payments' );
2821
+	$role = get_role('give_manager');
2822
+	$role->add_cap('view_give_payments');
2823 2823
 
2824
-	give_set_upgrade_complete( 'v215_update_donor_user_roles' );
2824
+	give_set_upgrade_complete('v215_update_donor_user_roles');
2825 2825
 }
2826 2826
 
2827 2827
 
@@ -2833,8 +2833,8 @@  discard block
 block discarded – undo
2833 2833
  *
2834 2834
  * @global wpdb $wpdb
2835 2835
  */
2836
-function give_v220_delete_wp_session_data(){
2836
+function give_v220_delete_wp_session_data() {
2837 2837
 	global $wpdb;
2838 2838
 
2839
-	$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" );
2839
+	$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'");
2840 2840
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +246 added lines, -253 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, false );
347
+		if ( ! $force && self::$background_updater->is_process_running()) {
348
+			update_option('give_pause_upgrade', 1, false);
351 349
 
352 350
 			return true;
353 351
 		}
354 352
 
355
-		update_option( 'give_paused_batches', $batch, false );
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, false);
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, false );
393
+		if ( ! empty($batch)) {
394
+			wp_cache_delete($batch->key, 'options');
395
+			update_option($batch->key, $batch->data, false);
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 ) ), false );
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)), false);
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, false );
517
+			if ( ! empty($batch->key)) {
518
+				wp_cache_delete($batch->key, 'options');
519
+				update_option($batch->key, $batch->data, false);
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, false );
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, false);
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, false );
567
+		if ( ! empty($doing_upgrade_args['update_info'])) {
568
+			update_option('give_doing_upgrade', $doing_upgrade_args, false);
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,90 +585,90 @@  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' ); ?>
621
-				<a href="<?php echo esc_url('http://docs.givewp.com/troubleshooting-db-updates')?>" target="_blank"><?php _e( 'Read More', 'give' ); ?> &raquo;</a>
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'); ?>
619
+				<a href="<?php echo esc_url('http://docs.givewp.com/troubleshooting-db-updates')?>" target="_blank"><?php _e('Read More', 'give'); ?> &raquo;</a>
622 620
 			<?php
623 621
 			endif;
624 622
 			$desc_html = ob_get_clean();
625 623
 
626
-			Give()->notices->register_notice( array(
624
+			Give()->notices->register_notice(array(
627 625
 				'id'          => 'give_upgrade_db',
628 626
 				'type'        => 'error',
629 627
 				'dismissible' => false,
630 628
 				'description' => $desc_html,
631
-			) );
629
+			));
632 630
 		}
633 631
 
634 632
 		// Bailout if doing upgrades.
635
-		if ( $this->is_doing_updates() ) {
633
+		if ($this->is_doing_updates()) {
636 634
 			return;
637 635
 		}
638 636
 
639 637
 		// Show db upgrade completed notice.
640
-		if ( ! empty( $_GET['give-db-update-completed'] ) ) {
641
-			Give()->notices->register_notice( array(
638
+		if ( ! empty($_GET['give-db-update-completed'])) {
639
+			Give()->notices->register_notice(array(
642 640
 				'id'          => 'give_db_upgrade_completed',
643 641
 				'type'        => 'updated',
644
-				'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
642
+				'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
645 643
 				'show'        => true,
646
-			) );
644
+			));
647 645
 
648 646
 			// Start update.
649
-		} elseif ( ! empty( $_GET['give-run-db-update'] ) ) {
647
+		} elseif ( ! empty($_GET['give-run-db-update'])) {
650 648
 			$this->run_db_update();
651 649
 
652 650
 			// Show run the update notice.
653
-		} elseif ( $this->get_total_new_db_update_count() ) {
651
+		} elseif ($this->get_total_new_db_update_count()) {
654 652
 			ob_start();
655 653
 			?>
656 654
 			<p>
657
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
658
-				&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' ); ?>
655
+				<strong><?php _e('Database Update', 'give'); ?></strong>
656
+				&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'); ?>
659 657
 			</p>
660 658
 			<p class="submit">
661
-				<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">
662
-					<?php _e( 'Run the updater', 'give' ); ?>
659
+				<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">
660
+					<?php _e('Run the updater', 'give'); ?>
663 661
 				</a>
664 662
 			</p>
665 663
 			<?php
666 664
 			$desc_html = ob_get_clean();
667 665
 
668
-			Give()->notices->register_notice( array(
666
+			Give()->notices->register_notice(array(
669 667
 				'id'          => 'give_upgrade_db',
670 668
 				'type'        => 'updated',
671 669
 				'dismissible' => false,
672 670
 				'description' => $desc_html,
673
-			) );
671
+			));
674 672
 		}
675 673
 	}
676 674
 
@@ -681,7 +679,7 @@  discard block
 block discarded – undo
681 679
 	 * @access public
682 680
 	 */
683 681
 	public function render_complete_page() {
684
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
682
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
685 683
 	}
686 684
 
687 685
 	/**
@@ -691,7 +689,7 @@  discard block
 block discarded – undo
691 689
 	 * @access public
692 690
 	 */
693 691
 	public function render_page() {
694
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
692
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
695 693
 	}
696 694
 
697 695
 	/**
@@ -702,26 +700,26 @@  discard block
 block discarded – undo
702 700
 	 */
703 701
 	private function run_db_update() {
704 702
 		// Bailout.
705
-		if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) {
703
+		if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) {
706 704
 			return;
707 705
 		}
708 706
 
709
-		$updates = $this->get_updates( 'database', 'new' );
707
+		$updates = $this->get_updates('database', 'new');
710 708
 
711
-		foreach ( $updates as $update ) {
712
-			self::$background_updater->push_to_queue( $update );
709
+		foreach ($updates as $update) {
710
+			self::$background_updater->push_to_queue($update);
713 711
 		}
714 712
 
715
-		add_option( 'give_db_update_count', count( $updates ), '', false );
713
+		add_option('give_db_update_count', count($updates), '', false);
716 714
 
717
-		add_option( 'give_doing_upgrade', array(
715
+		add_option('give_doing_upgrade', array(
718 716
 			'update_info'      => $updates[0],
719 717
 			'step'             => 1,
720 718
 			'update'           => 1,
721
-			'heading'          => sprintf( 'Update %s of %s', 1, count( $updates ) ),
719
+			'heading'          => sprintf('Update %s of %s', 1, count($updates)),
722 720
 			'percentage'       => 0,
723 721
 			'total_percentage' => 0,
724
-		), '', false );
722
+		), '', false);
725 723
 
726 724
 		self::$background_updater->save()->dispatch();
727 725
 	}
@@ -735,14 +733,13 @@  discard block
 block discarded – undo
735 733
 	 */
736 734
 	public function __flush_resume_updates() {
737 735
 		//delete_option( 'give_doing_upgrade' );
738
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
736
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
739 737
 
740 738
 		// Reset counter.
741 739
 		$this->step = $this->percentage = 0;
742 740
 
743
-		$this->update = ( $this->get_total_db_update_count() > $this->update ) ?
744
-			( $this->update + 1 ) :
745
-			$this->update;
741
+		$this->update = ($this->get_total_db_update_count() > $this->update) ?
742
+			($this->update + 1) : $this->update;
746 743
 	}
747 744
 
748 745
 
@@ -757,7 +754,7 @@  discard block
 block discarded – undo
757 754
 	public function __give_start_updating() {
758 755
 		// Check permission.
759 756
 		if (
760
-			! current_user_can( 'manage_give_settings' ) ||
757
+			! current_user_can('manage_give_settings') ||
761 758
 			$this->is_doing_updates()
762 759
 		) {
763 760
 			// Run update via ajax
@@ -768,7 +765,7 @@  discard block
 block discarded – undo
768 765
 
769 766
 		// @todo: validate nonce
770 767
 		// @todo: set http method to post
771
-		if ( empty( $_POST['run_db_update'] ) ) {
768
+		if (empty($_POST['run_db_update'])) {
772 769
 			wp_send_json_error();
773 770
 		}
774 771
 
@@ -787,34 +784,34 @@  discard block
 block discarded – undo
787 784
 	 * @return string
788 785
 	 */
789 786
 	public function __give_db_updates_info() {
790
-		$update_info   = get_option( 'give_doing_upgrade' );
787
+		$update_info   = get_option('give_doing_upgrade');
791 788
 		$response_type = '';
792 789
 
793
-		if ( self::$background_updater->is_paused_process() ) {
790
+		if (self::$background_updater->is_paused_process()) {
794 791
 			$update_info = array(
795
-				'message'    => __( 'The updates have been paused.', 'give' ),
792
+				'message'    => __('The updates have been paused.', 'give'),
796 793
 				'heading'    => '',
797 794
 				'percentage' => 0,
798 795
 			);
799 796
 
800
-			if ( get_option( 'give_upgrade_error' ) ) {
801
-				$update_info['message'] = __( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' );
797
+			if (get_option('give_upgrade_error')) {
798
+				$update_info['message'] = __('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give');
802 799
 			}
803 800
 
804 801
 			$response_type = 'error';
805 802
 
806
-		} elseif ( empty( $update_info ) || ! $this->get_total_new_db_update_count( true ) ) {
803
+		} elseif (empty($update_info) || ! $this->get_total_new_db_update_count(true)) {
807 804
 			$update_info   = array(
808
-				'message'    => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
809
-				'heading'    => __( 'Updates Completed.', 'give' ),
805
+				'message'    => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
806
+				'heading'    => __('Updates Completed.', 'give'),
810 807
 				'percentage' => 0,
811 808
 			);
812 809
 			$response_type = 'success';
813 810
 
814
-			delete_option( 'give_show_db_upgrade_complete_notice' );
811
+			delete_option('give_show_db_upgrade_complete_notice');
815 812
 		}
816 813
 
817
-		$this->send_ajax_response( $update_info, $response_type );
814
+		$this->send_ajax_response($update_info, $response_type);
818 815
 	}
819 816
 
820 817
 	/**
@@ -826,7 +823,7 @@  discard block
 block discarded – undo
826 823
 	 * @param        $data
827 824
 	 * @param string $type
828 825
 	 */
829
-	public function send_ajax_response( $data, $type = '' ) {
826
+	public function send_ajax_response($data, $type = '') {
830 827
 		$default = array(
831 828
 			'message'    => '',
832 829
 			'heading'    => '',
@@ -836,24 +833,24 @@  discard block
 block discarded – undo
836 833
 		);
837 834
 
838 835
 		// Set data.
839
-		$data = wp_parse_args( $data, $default );
836
+		$data = wp_parse_args($data, $default);
840 837
 
841 838
 		// Enable cache.
842 839
 		Give_Cache::enable();
843 840
 
844
-		switch ( $type ) {
841
+		switch ($type) {
845 842
 			case 'success':
846
-				wp_send_json_success( $data );
843
+				wp_send_json_success($data);
847 844
 				break;
848 845
 
849 846
 			case 'error':
850
-				wp_send_json_error( $data );
847
+				wp_send_json_error($data);
851 848
 				break;
852 849
 
853 850
 			default:
854
-				wp_send_json( array(
851
+				wp_send_json(array(
855 852
 					'data' => $data,
856
-				) );
853
+				));
857 854
 				break;
858 855
 		}
859 856
 	}
@@ -867,12 +864,12 @@  discard block
 block discarded – undo
867 864
 	 * @param $total
868 865
 	 * @param $current_total
869 866
 	 */
870
-	public function set_percentage( $total, $current_total ) {
867
+	public function set_percentage($total, $current_total) {
871 868
 		// Set percentage.
872
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
869
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
873 870
 
874 871
 		// Verify percentage.
875
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
872
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
876 873
 	}
877 874
 
878 875
 	/**
@@ -885,22 +882,22 @@  discard block
 block discarded – undo
885 882
 	 *
886 883
 	 * @return bool|null
887 884
 	 */
888
-	public function is_parent_updates_completed( $update ) {
885
+	public function is_parent_updates_completed($update) {
889 886
 		// Bailout.
890
-		if ( empty( $update['depend'] ) ) {
887
+		if (empty($update['depend'])) {
891 888
 			return true;
892 889
 		}
893 890
 
894 891
 		// Check if dependency is valid or not.
895
-		if ( ! $this->has_valid_dependency( $update ) ) {
892
+		if ( ! $this->has_valid_dependency($update)) {
896 893
 			return null;
897 894
 		}
898 895
 
899 896
 		$is_dependency_completed = true;
900 897
 
901
-		foreach ( $update['depend'] as $depend ) {
898
+		foreach ($update['depend'] as $depend) {
902 899
 
903
-			if ( ! give_has_upgrade_completed( $depend ) ) {
900
+			if ( ! give_has_upgrade_completed($depend)) {
904 901
 				$is_dependency_completed = false;
905 902
 				break;
906 903
 			}
@@ -917,7 +914,7 @@  discard block
 block discarded – undo
917 914
 	 * @return bool
918 915
 	 */
919 916
 	public function is_doing_updates() {
920
-		return (bool) get_option( 'give_doing_upgrade' );
917
+		return (bool) get_option('give_doing_upgrade');
921 918
 	}
922 919
 
923 920
 
@@ -931,7 +928,7 @@  discard block
 block discarded – undo
931 928
 	 *
932 929
 	 * @return bool
933 930
 	 */
934
-	public function has_valid_dependency( $update ) {
931
+	public function has_valid_dependency($update) {
935 932
 		$is_valid_dependency = true;
936 933
 		// $update_ids          = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' );
937 934
 		//
@@ -957,33 +954,33 @@  discard block
 block discarded – undo
957 954
 	 *
958 955
 	 * @return array
959 956
 	 */
960
-	public function get_updates( $update_type = '', $status = 'all' ) {
957
+	public function get_updates($update_type = '', $status = 'all') {
961 958
 		// return all updates.
962
-		if ( empty( $update_type ) ) {
959
+		if (empty($update_type)) {
963 960
 			return $this->updates;
964 961
 		}
965 962
 
966 963
 		// Get specific update.
967
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
964
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
968 965
 
969 966
 		// Bailout.
970
-		if ( empty( $updates ) ) {
967
+		if (empty($updates)) {
971 968
 			return $updates;
972 969
 		}
973 970
 
974
-		switch ( $status ) {
971
+		switch ($status) {
975 972
 			case 'new':
976 973
 				// Remove already completed updates.
977
-				wp_cache_delete( 'give_completed_upgrades', 'options' );
974
+				wp_cache_delete('give_completed_upgrades', 'options');
978 975
 				$completed_updates = give_get_completed_upgrades();
979 976
 
980
-				if ( ! empty( $completed_updates ) ) {
981
-					foreach ( $updates as $index => $update ) {
982
-						if ( in_array( $update['id'], $completed_updates ) ) {
983
-							unset( $updates[ $index ] );
977
+				if ( ! empty($completed_updates)) {
978
+					foreach ($updates as $index => $update) {
979
+						if (in_array($update['id'], $completed_updates)) {
980
+							unset($updates[$index]);
984 981
 						}
985 982
 					}
986
-					$updates = array_values( $updates );
983
+					$updates = array_values($updates);
987 984
 				}
988 985
 
989 986
 				break;
@@ -1000,7 +997,7 @@  discard block
 block discarded – undo
1000 997
 	 * @return int
1001 998
 	 */
1002 999
 	public function get_total_plugin_update_count() {
1003
-		return count( $this->get_updates( 'plugin' ) );
1000
+		return count($this->get_updates('plugin'));
1004 1001
 	}
1005 1002
 
1006 1003
 	/**
@@ -1015,7 +1012,7 @@  discard block
 block discarded – undo
1015 1012
 		$db_update_count     = $this->get_pending_db_update_count();
1016 1013
 		$plugin_update_count = $this->get_total_plugin_update_count();
1017 1014
 
1018
-		return ( $db_update_count + $plugin_update_count );
1015
+		return ($db_update_count + $plugin_update_count);
1019 1016
 	}
1020 1017
 
1021 1018
 	/**
@@ -1027,7 +1024,7 @@  discard block
 block discarded – undo
1027 1024
 	 * @return int
1028 1025
 	 */
1029 1026
 	public function get_pending_db_update_count() {
1030
-		return count( $this->get_updates( 'database', 'new' ) );
1027
+		return count($this->get_updates('database', 'new'));
1031 1028
 	}
1032 1029
 
1033 1030
 	/**
@@ -1039,7 +1036,7 @@  discard block
 block discarded – undo
1039 1036
 	 * @return int
1040 1037
 	 */
1041 1038
 	public function get_total_db_update_count() {
1042
-		return count( $this->get_updates( 'database', 'all' ) );
1039
+		return count($this->get_updates('database', 'all'));
1043 1040
 	}
1044 1041
 
1045 1042
 	/**
@@ -1052,10 +1049,9 @@  discard block
 block discarded – undo
1052 1049
 	 *
1053 1050
 	 * @return int
1054 1051
 	 */
1055
-	public function get_total_new_db_update_count( $refresh = false ) {
1052
+	public function get_total_new_db_update_count($refresh = false) {
1056 1053
 		$update_count = $this->is_doing_updates() && ! $refresh ?
1057
-			get_option( 'give_db_update_count' ) :
1058
-			$this->get_pending_db_update_count();
1054
+			get_option('give_db_update_count') : $this->get_pending_db_update_count();
1059 1055
 
1060 1056
 		return $update_count;
1061 1057
 	}
@@ -1070,11 +1066,11 @@  discard block
 block discarded – undo
1070 1066
 	 *
1071 1067
 	 * @return int
1072 1068
 	 */
1073
-	public function get_running_db_update( $refresh = false ) {
1069
+	public function get_running_db_update($refresh = false) {
1074 1070
 		$current_update = 1;
1075 1071
 
1076
-		if ( $this->is_doing_updates() && ! $refresh ) {
1077
-			$current_update = get_option( 'give_doing_upgrade' );
1072
+		if ($this->is_doing_updates() && ! $refresh) {
1073
+			$current_update = get_option('give_doing_upgrade');
1078 1074
 			$current_update = $current_update['update'];
1079 1075
 		}
1080 1076
 
@@ -1091,25 +1087,23 @@  discard block
 block discarded – undo
1091 1087
 	 *
1092 1088
 	 * @return float|int
1093 1089
 	 */
1094
-	public function get_db_update_processing_percentage( $refresh = false ) {
1090
+	public function get_db_update_processing_percentage($refresh = false) {
1095 1091
 		// Bailout.
1096
-		if ( ! $this->get_total_new_db_update_count( $refresh ) ) {
1092
+		if ( ! $this->get_total_new_db_update_count($refresh)) {
1097 1093
 			return 0;
1098 1094
 		}
1099 1095
 
1100
-		$resume_update            = get_option( 'give_doing_upgrade' );
1101
-		$update_count_percentages = ( ( $this->get_running_db_update( $refresh ) - 1 ) / $this->get_total_new_db_update_count( $refresh ) ) * 100;
1102
-		$update_percentage_share  = ( 1 / $this->get_total_new_db_update_count() ) * 100;
1103
-		$upgrade_percentage       = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 );
1096
+		$resume_update            = get_option('give_doing_upgrade');
1097
+		$update_count_percentages = (($this->get_running_db_update($refresh) - 1) / $this->get_total_new_db_update_count($refresh)) * 100;
1098
+		$update_percentage_share  = (1 / $this->get_total_new_db_update_count()) * 100;
1099
+		$upgrade_percentage       = (($resume_update['percentage'] * $update_percentage_share) / 100);
1104 1100
 
1105 1101
 		$final_percentage = $update_count_percentages + $upgrade_percentage;
1106 1102
 
1107 1103
 		return $this->is_doing_updates() ?
1108
-			( absint( $final_percentage ) ?
1109
-				absint( $final_percentage ) :
1110
-				round( $final_percentage, 2 )
1111
-			) :
1112
-			0;
1104
+			(absint($final_percentage) ?
1105
+				absint($final_percentage) : round($final_percentage, 2)
1106
+			) : 0;
1113 1107
 	}
1114 1108
 
1115 1109
 
@@ -1121,8 +1115,8 @@  discard block
 block discarded – undo
1121 1115
 	 * @return array
1122 1116
 	 */
1123 1117
 	public function get_update_ids() {
1124
-		$all_updates    = $this->get_updates( 'database', 'all' );
1125
-		$all_update_ids = wp_list_pluck( $all_updates, 'id' );
1118
+		$all_updates    = $this->get_updates('database', 'all');
1119
+		$all_update_ids = wp_list_pluck($all_updates, 'id');
1126 1120
 
1127 1121
 		return $all_update_ids;
1128 1122
 	}
@@ -1137,10 +1131,9 @@  discard block
 block discarded – undo
1137 1131
 	 *
1138 1132
 	 * @return float|int
1139 1133
 	 */
1140
-	public function get_offset( $process_item_count ) {
1141
-		return ( 1 === $this->step ) ?
1142
-			0 :
1143
-			( $this->step - 1 ) * $process_item_count;
1134
+	public function get_offset($process_item_count) {
1135
+		return (1 === $this->step) ?
1136
+			0 : ($this->step - 1) * $process_item_count;
1144 1137
 	}
1145 1138
 }
1146 1139
 
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 2 patches
Spacing   +36 added lines, -36 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
 
@@ -18,70 +18,70 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
25
-		<?php if ( ! empty( $db_updates ) ) : ?>
25
+		<?php if ( ! empty($db_updates)) : ?>
26 26
 			<?php
27 27
 			$is_doing_updates = $give_updates->is_doing_updates();
28
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
29
-			$resume_updates   = get_option( 'give_doing_upgrade' );
30
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
28
+			$db_update_url    = add_query_arg(array('type' => 'database',));
29
+			$resume_updates   = get_option('give_doing_upgrade');
30
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
31 31
 			?>
32 32
 			<div class="give-update-panel-content">
33
-				<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
33
+				<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
34 34
 			</div>
35 35
 
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43 43
 									<?php
44
-									if( ! give_test_ajax_works() ) {
44
+									if ( ! give_test_ajax_works()) {
45 45
 										echo sprintf(
46 46
 											'<div class="notice notice-warning inline"><p>%s</p></div>',
47
-											__( 'Give is currently updating the database. Please do not refresh or leave this page while the update is in progress.', 'give' )
47
+											__('Give is currently updating the database. Please do not refresh or leave this page while the update is in progress.', 'give')
48 48
 										);
49 49
 									}
50 50
 									?>
51 51
 									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
52 52
 										<?php
53 53
 										echo sprintf(
54
-											__( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ),
54
+											__('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'),
55 55
 											$is_doing_updates
56 56
 												? sprintf(
57 57
 													'%s%s',
58
-													__( 'Give is currently updating the database', 'give' ),
59
-													give_test_ajax_works() ?  ' ' . __( 'in the background.', 'give' ) : '.'
58
+													__('Give is currently updating the database', 'give'),
59
+													give_test_ajax_works() ? ' '.__('in the background.', 'give') : '.'
60 60
 												)
61
-												: __( 'Give needs to update the database.', 'give' ),
61
+												: __('Give needs to update the database.', 'give'),
62 62
 											$db_update_url,
63
-											( $is_doing_updates ? 'give-hidden' : '' ),
64
-											__( 'Update now', 'give' )
63
+											($is_doing_updates ? 'give-hidden' : ''),
64
+											__('Update now', 'give')
65 65
 										);
66 66
 										?>
67 67
 									</span>
68 68
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
69
-										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
70
-											&nbsp<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
69
+										<?php if (get_option('give_upgrade_error')) : ?>
70
+											&nbsp<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
71 71
 										<?php else : ?>
72
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
72
+											<?php _e('The updates have been paused.', 'give'); ?>
73 73
 										<?php endif; ?>
74 74
 									</span>
75 75
 
76
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
77
-										<?php $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?>
76
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
77
+										<?php $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?>
78 78
 										<button id="give-restart-upgrades" class="button button-primary alignright"
79
-										        data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button>
80
-									<?php elseif ( $give_updates->is_doing_updates() ): ?>
81
-										<?php $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?>
79
+										        data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button>
80
+									<?php elseif ($give_updates->is_doing_updates()): ?>
81
+										<?php $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?>
82 82
 										<button id="give-pause-upgrades" class="button button-primary alignright"
83
-										        data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>>
84
-											<?php _e( 'Pause Upgrades', 'give' ); ?>
83
+										        data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>>
84
+											<?php _e('Pause Upgrades', 'give'); ?>
85 85
 										</button>
86 86
 									<?php endif; ?>
87 87
 								</p>
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 									<strong>
92 92
 										<?php
93 93
 										echo sprintf(
94
-											__( 'Update %s of %s', 'give' ),
94
+											__('Update %s of %s', 'give'),
95 95
 											$give_updates->get_running_db_update(),
96 96
 											$give_updates->get_total_new_db_update_count()
97 97
 										);
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 									</strong>
100 100
 								</p>
101 101
 								<div class="progress-content">
102
-									<?php if ( $is_doing_updates ) : ?>
102
+									<?php if ($is_doing_updates) : ?>
103 103
 										<div class="notice-wrap give-clearfix">
104 104
 
105
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?>
105
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?>
106 106
 												<span class="spinner is-active"></span>
107 107
 											<?php endif; ?>
108 108
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 									<?php endif; ?>
114 114
 								</div>
115 115
 							</div>
116
-							<?php if ( ! $is_doing_updates ) : ?>
116
+							<?php if ( ! $is_doing_updates) : ?>
117 117
 								<div class="give-run-database-update"></div>
118 118
 							<?php endif; ?>
119 119
 						</div>
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 					</div><!-- .postbox -->
122 122
 				</div> <!-- .post-container -->
123 123
 			</div>
124
-		<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
124
+		<?php else: include GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
125 125
 		<?php endif; ?>
126 126
 
127 127
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
128
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
129
-			<?php $plugin_update_url = add_query_arg( array(
128
+		<?php if ( ! empty($plugin_updates)) : ?>
129
+			<?php $plugin_update_url = add_query_arg(array(
130 130
 				'plugin_status' => 'give',
131
-			), admin_url( '/plugins.php' ) ); ?>
131
+			), admin_url('/plugins.php')); ?>
132 132
 			<div id="give-plugin-updates">
133 133
 				<div class="postbox-container">
134 134
 					<div class="postbox">
135
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
135
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
136 136
 						<div class="inside">
137 137
 							<div class="panel-content">
138 138
 								<p>
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,8 +68,11 @@  discard block
 block discarded – undo
68 68
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
69 69
 										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
70 70
 											&nbsp<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
71
-										<?php else : ?>
72
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
71
+										<?php else {
72
+	: ?>
73
+											<?php _e( 'The updates have been paused.', 'give' );
74
+}
75
+?>
73 76
 										<?php endif; ?>
74 77
 									</span>
75 78
 
@@ -121,7 +124,10 @@  discard block
 block discarded – undo
121 124
 					</div><!-- .postbox -->
122 125
 				</div> <!-- .post-container -->
123 126
 			</div>
124
-		<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
127
+		<?php else {
128
+	: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';
129
+}
130
+?>
125 131
 		<?php endif; ?>
126 132
 
127 133
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * Class constructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'admin_init', array( $this, 'init'), 999 );
35
+		add_action('admin_init', array($this, 'init'), 999);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @since 2.1.0
42 42
 	 * @access public
43 43
 	 */
44
-	public function init(){
45
-		if ( $this->is_add_button() ) {
46
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
44
+	public function init() {
45
+		if ($this->is_add_button()) {
46
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
47 47
 
48
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
49
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
50
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
48
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
49
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
50
+			add_action('media_buttons', array($this, 'shortcode_button'));
51 51
 		}
52 52
 
53
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
54
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
53
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
54
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	public function mce_external_plugins( $plugin_array ) {
66
+	public function mce_external_plugins($plugin_array) {
67 67
 
68
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
68
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
69 69
 			return false;
70 70
 		}
71 71
 
72
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'includes/admin/shortcodes/mce-plugin.js';
72
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'includes/admin/shortcodes/mce-plugin.js';
73 73
 
74 74
 		return $plugin_array;
75 75
 	}
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @since 1.0
83 83
 	 */
84 84
 	public function admin_enqueue_assets() {
85
-		$direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
85
+		$direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
86 86
 
87 87
 		wp_enqueue_script(
88 88
 			'give_shortcode',
89
-			GIVE_PLUGIN_URL . 'assets/dist/js/admin-shortcodes.js',
90
-			array( 'jquery' ),
89
+			GIVE_PLUGIN_URL.'assets/dist/js/admin-shortcodes.js',
90
+			array('jquery'),
91 91
 			GIVE_VERSION,
92 92
 			true
93 93
 		);
94 94
 
95 95
 		wp_enqueue_style(
96 96
 			'give-admin-shortcode-button-style',
97
-			GIVE_PLUGIN_URL . 'assets/dist/css/admin-shortcode-button' . $direction . '.css',
97
+			GIVE_PLUGIN_URL.'assets/dist/css/admin-shortcode-button'.$direction.'.css',
98 98
 			array(),
99 99
 			GIVE_VERSION
100 100
 		);
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function admin_localize_scripts() {
111 111
 
112
-		if ( ! empty( self::$shortcodes ) ) {
112
+		if ( ! empty(self::$shortcodes)) {
113 113
 
114 114
 			$variables = array();
115 115
 
116
-			foreach ( self::$shortcodes as $shortcode => $values ) {
117
-				if ( ! empty( $values['required'] ) ) {
118
-					$variables[ $shortcode ] = $values['required'];
116
+			foreach (self::$shortcodes as $shortcode => $values) {
117
+				if ( ! empty($values['required'])) {
118
+					$variables[$shortcode] = $values['required'];
119 119
 				}
120 120
 			}
121 121
 
122
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
122
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
123 123
 		}
124 124
 	}
125 125
 
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$shortcodes = array();
136 136
 
137
-		foreach ( self::$shortcodes as $shortcode => $values ) {
137
+		foreach (self::$shortcodes as $shortcode => $values) {
138 138
 
139 139
 			/**
140 140
 			 * Filters the condition for including the current shortcode
141 141
 			 *
142 142
 			 * @since 1.0
143 143
 			 */
144
-			if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
144
+			if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
145 145
 
146
-				$shortcodes[ $shortcode ] = sprintf(
146
+				$shortcodes[$shortcode] = sprintf(
147 147
 					'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>',
148 148
 					$shortcode,
149 149
 					$shortcode,
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 		}
154 154
 
155
-		if ( ! empty( $shortcodes ) ) {
155
+		if ( ! empty($shortcodes)) {
156 156
 
157 157
 			// check current WP version
158
-			$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
159
-				? '<img src="' . GIVE_PLUGIN_URL . 'assets/dist/images/give-media.png" />'
160
-				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
158
+			$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
159
+				? '<img src="'.GIVE_PLUGIN_URL.'assets/dist/images/give-media.png" />'
160
+				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
161 161
 
162
-			reset( $shortcodes );
162
+			reset($shortcodes);
163 163
 
164
-			if ( 1 === count( $shortcodes ) ) {
164
+			if (1 === count($shortcodes)) {
165 165
 
166
-				$shortcode = key( $shortcodes );
166
+				$shortcode = key($shortcodes);
167 167
 
168 168
 				printf(
169 169
 					'<button type="button" class="button sc-shortcode" data-shortcode="%s">%s</button>',
170 170
 					$shortcode,
171
-					sprintf( '%s %s %s',
171
+					sprintf('%s %s %s',
172 172
 						$img,
173
-						__( 'Insert', 'give' ),
174
-						self::$shortcodes[ $shortcode ]['label']
173
+						__('Insert', 'give'),
174
+						self::$shortcodes[$shortcode]['label']
175 175
 					)
176 176
 				);
177 177
 			} else {
178 178
 				printf(
179
-					'<div class="sc-wrap">' .
180
-					'<button class="button sc-button" type="button">%s %s</button>' .
181
-					'<div class="sc-menu mce-menu">%s</div>' .
179
+					'<div class="sc-wrap">'.
180
+					'<button class="button sc-button" type="button">%s %s</button>'.
181
+					'<div class="sc-menu mce-menu">%s</div>'.
182 182
 					'</div>',
183 183
 					$img,
184
-					__( 'Give Shortcodes', 'give' ),
185
-					implode( '', array_values( $shortcodes ) )
184
+					__('Give Shortcodes', 'give'),
185
+					implode('', array_values($shortcodes))
186 186
 				);
187 187
 			}
188 188
 		}
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function shortcode_ajax() {
199 199
 
200
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
200
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
201 201
 		$response  = false;
202 202
 
203
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
203
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
204 204
 
205
-			$data = self::$shortcodes[ $shortcode ];
205
+			$data = self::$shortcodes[$shortcode];
206 206
 
207
-			if ( ! empty( $data['errors'] ) ) {
208
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
207
+			if ( ! empty($data['errors'])) {
208
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
209 209
 			}
210 210
 
211 211
 			$response = array(
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 			);
218 218
 		} else {
219 219
 			// todo: handle error
220
-			error_log( print_r( 'AJAX error!', 1 ) );
220
+			error_log(print_r('AJAX error!', 1));
221 221
 		}
222 222
 
223
-		wp_send_json( $response );
223
+		wp_send_json($response);
224 224
 	}
225 225
 
226 226
 
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 	private function is_add_button() {
235 235
 		global $pagenow;
236 236
 
237
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
237
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
238 238
 			'post.php',
239 239
 			'page.php',
240 240
 			'post-new.php',
241 241
 			'post-edit.php',
242 242
 			'edit.php',
243 243
 			'edit.php?post_type=page',
244
-		) );
244
+		));
245 245
 
246 246
 		$setting_page = give_get_current_setting_page();
247 247
 
248 248
 		// Only run in admin post/page creation and edit screens
249 249
 		if (
250 250
 			! is_admin()
251
-			|| ! in_array( $pagenow, $shortcode_button_pages )
252
-			|| ( 'give-settings' === $setting_page )
251
+			|| ! in_array($pagenow, $shortcode_button_pages)
252
+			|| ('give-settings' === $setting_page)
253 253
 
254 254
 			/**
255 255
 			 * Fire the filter
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 			 * @since 1.0
259 259
 			 *
260 260
 			 */
261
-			|| ! apply_filters( 'give_shortcode_button_condition', true )
262
-			|| empty( self::$shortcodes )
261
+			|| ! apply_filters('give_shortcode_button_condition', true)
262
+			|| empty(self::$shortcodes)
263 263
 		) {
264 264
 			return false;
265 265
 		}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donor-wall.php 1 patch
Spacing   +34 added lines, -34 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,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title'] = esc_html__( 'Donor Wall', 'give' );
28
-		$this->shortcode['label'] = esc_html__( 'Donor Wall', 'give' );
27
+		$this->shortcode['title'] = esc_html__('Donor Wall', 'give');
28
+		$this->shortcode['label'] = esc_html__('Donor Wall', 'give');
29 29
 
30
-		parent::__construct( 'give_donor_wall' );
30
+		parent::__construct('give_donor_wall');
31 31
 	}
32 32
 
33 33
 	/**
@@ -43,90 +43,90 @@  discard block
 block discarded – undo
43 43
 					'post_type' => 'give_forms',
44 44
 				),
45 45
 				'name'        => 'form_id',
46
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
47
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
46
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
47
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
48 48
 			),
49 49
 			array(
50 50
 				'type'        => 'textbox',
51 51
 				'name'        => 'donors_per_page',
52
-				'label'       => esc_attr__( 'Donors Per Page', 'give' ),
52
+				'label'       => esc_attr__('Donors Per Page', 'give'),
53 53
 				'placeholder' => '20',
54 54
 			),
55 55
 			array(
56 56
 				'type'        => 'textbox',
57 57
 				'name'        => 'comment_length',
58
-				'label'       => esc_attr__( 'Comment Length', 'give' ),
58
+				'label'       => esc_attr__('Comment Length', 'give'),
59 59
 				'placeholder' => '20',
60 60
 			),
61 61
 			array(
62 62
 				'type'        => 'textbox',
63 63
 				'name'        => 'readmore_text',
64
-				'label'       => esc_attr__( 'Read More Text', 'give' ),
65
-				'placeholder' => esc_html__( 'Read More', 'give' ),
64
+				'label'       => esc_attr__('Read More Text', 'give'),
65
+				'placeholder' => esc_html__('Read More', 'give'),
66 66
 			),
67 67
 			array(
68 68
 				'type'        => 'textbox',
69 69
 				'name'        => 'loadmore_text',
70
-				'label'       => esc_attr__( 'Load More Text', 'give' ),
71
-				'placeholder' => esc_html__( 'Load More', 'give' ),
70
+				'label'       => esc_attr__('Load More Text', 'give'),
71
+				'placeholder' => esc_html__('Load More', 'give'),
72 72
 			),
73 73
 			array(
74 74
 				'type'        => 'listbox',
75 75
 				'name'        => 'columns',
76
-				'label'       => esc_attr__( 'Columns:', 'give' ),
77
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
76
+				'label'       => esc_attr__('Columns:', 'give'),
77
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
78 78
 				'options'     => array(
79
-					'1' => esc_html__( '1', 'give' ),
80
-					'2' => esc_html__( '2', 'give' ),
81
-					'3' => esc_html__( '3', 'give' ),
82
-					'4' => esc_html__( '4', 'give' ),
79
+					'1' => esc_html__('1', 'give'),
80
+					'2' => esc_html__('2', 'give'),
81
+					'3' => esc_html__('3', 'give'),
82
+					'4' => esc_html__('4', 'give'),
83 83
 				),
84
-				'placeholder' => esc_html__( 'Best Fit', 'give' ),
84
+				'placeholder' => esc_html__('Best Fit', 'give'),
85 85
 			),
86 86
 			array(
87 87
 				'type'        => 'listbox',
88 88
 				'name'        => 'show_avatar',
89
-				'label'       => esc_attr__( 'Show Avatar', 'give' ),
89
+				'label'       => esc_attr__('Show Avatar', 'give'),
90 90
 				'options'     => array(
91
-					'false' => esc_html__( 'Hide', 'give' ),
91
+					'false' => esc_html__('Hide', 'give'),
92 92
 				),
93
-				'placeholder' => esc_html__( 'Show', 'give' ),
93
+				'placeholder' => esc_html__('Show', 'give'),
94 94
 			),
95 95
 			array(
96 96
 				'type'        => 'listbox',
97 97
 				'name'        => 'show_name',
98
-				'label'       => esc_attr__( 'Show Name', 'give' ),
98
+				'label'       => esc_attr__('Show Name', 'give'),
99 99
 				'options'     => array(
100
-					'false' => esc_html__( 'Hide', 'give' ),
100
+					'false' => esc_html__('Hide', 'give'),
101 101
 				),
102
-				'placeholder' => esc_html__( 'Show', 'give' ),
102
+				'placeholder' => esc_html__('Show', 'give'),
103 103
 			),
104 104
 			array(
105 105
 				'type'        => 'listbox',
106 106
 				'name'        => 'show_total',
107
-				'label'       => esc_attr__( 'Show Total', 'give' ),
107
+				'label'       => esc_attr__('Show Total', 'give'),
108 108
 				'options'     => array(
109
-					'false' => esc_html__( 'Hide', 'give' ),
109
+					'false' => esc_html__('Hide', 'give'),
110 110
 				),
111
-				'placeholder' => esc_html__( 'Show', 'give' ),
111
+				'placeholder' => esc_html__('Show', 'give'),
112 112
 			),
113 113
 			array(
114 114
 				'type'        => 'listbox',
115 115
 				'name'        => 'show_time',
116
-				'label'       => esc_attr__( 'Show Date', 'give' ),
116
+				'label'       => esc_attr__('Show Date', 'give'),
117 117
 				'options'     => array(
118
-					'false' => esc_html__( 'Hide', 'give' ),
118
+					'false' => esc_html__('Hide', 'give'),
119 119
 				),
120
-				'placeholder' => esc_html__( 'Show', 'give' ),
120
+				'placeholder' => esc_html__('Show', 'give'),
121 121
 			),
122 122
 			array(
123 123
 				'type'        => 'listbox',
124 124
 				'name'        => 'show_comments',
125
-				'label'       => esc_attr__( 'Show Comments', 'give' ),
125
+				'label'       => esc_attr__('Show Comments', 'give'),
126 126
 				'options'     => array(
127
-					'false' => esc_html__( 'Hide', 'give' ),
127
+					'false' => esc_html__('Hide', 'give'),
128 128
 				),
129
-				'placeholder' => esc_html__( 'Show', 'give' ),
129
+				'placeholder' => esc_html__('Show', 'give'),
130 130
 			)
131 131
 		);
132 132
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-grid.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Grid', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Grid', 'give');
28 28
 
29
-		parent::__construct( 'give_form_grid' );
29
+		parent::__construct('give_form_grid');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,80 +39,80 @@  discard block
 block discarded – undo
39 39
 		return array(
40 40
 			array(
41 41
 				'type' => 'container',
42
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
42
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
43 43
 			),
44 44
 			array(
45 45
 				'type'        => 'textbox',
46 46
 				'name'        => 'ids',
47
-				'label'       => esc_attr__( 'Form IDs:', 'give' ),
48
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ),
49
-				'placeholder' => esc_html__( 'All Forms', 'give' )
47
+				'label'       => esc_attr__('Form IDs:', 'give'),
48
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'),
49
+				'placeholder' => esc_html__('All Forms', 'give')
50 50
 			),
51 51
 			array(
52 52
 				'type'        => 'textbox',
53 53
 				'name'        => 'exclude',
54
-				'label'       => esc_attr__( 'Excluded Form IDs:', 'give' ),
55
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs to exclude those from the grid.', 'give' ),
56
-				'placeholder' => esc_html__( 'Excluded Forms', 'give' )
54
+				'label'       => esc_attr__('Excluded Form IDs:', 'give'),
55
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs to exclude those from the grid.', 'give'),
56
+				'placeholder' => esc_html__('Excluded Forms', 'give')
57 57
 			),
58 58
 			array(
59 59
 				'type'        => 'listbox',
60 60
 				'name'        => 'columns',
61
-				'label'       => esc_attr__( 'Columns:', 'give' ),
62
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
61
+				'label'       => esc_attr__('Columns:', 'give'),
62
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
63 63
 				'options'     => array(
64
-					'1' => esc_html__( '1', 'give' ),
65
-					'2' => esc_html__( '2', 'give' ),
66
-					'3' => esc_html__( '3', 'give' ),
67
-					'4' => esc_html__( '4', 'give' ),
64
+					'1' => esc_html__('1', 'give'),
65
+					'2' => esc_html__('2', 'give'),
66
+					'3' => esc_html__('3', 'give'),
67
+					'4' => esc_html__('4', 'give'),
68 68
 				),
69
-				'placeholder' => esc_html__( 'Best Fit', 'give' )
69
+				'placeholder' => esc_html__('Best Fit', 'give')
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
75
-				'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ),
74
+				'label'   => esc_attr__('Show Goal:', 'give'),
75
+				'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html__( 'Show', 'give' ),
78
-					'false' => esc_html__( 'Hide', 'give' ),
77
+					'true'  => esc_html__('Show', 'give'),
78
+					'false' => esc_html__('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_excerpt',
84
-				'label'   => esc_attr__( 'Show Excerpt:', 'give' ),
85
-				'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ),
84
+				'label'   => esc_attr__('Show Excerpt:', 'give'),
85
+				'tooltip' => esc_attr__('Do you want to display the excerpt?', 'give'),
86 86
 				'options' => array(
87
-					'true'  => esc_html__( 'Show', 'give' ),
88
-					'false' => esc_html__( 'Hide', 'give' ),
87
+					'true'  => esc_html__('Show', 'give'),
88
+					'false' => esc_html__('Hide', 'give'),
89 89
 				),
90 90
 			),
91 91
 			array(
92 92
 				'type'    => 'listbox',
93 93
 				'name'    => 'show_featured_image',
94
-				'label'   => esc_attr__( 'Show Featured Image:', 'give' ),
95
-				'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ),
94
+				'label'   => esc_attr__('Show Featured Image:', 'give'),
95
+				'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'),
96 96
 				'options' => array(
97
-					'true'  => esc_html__( 'Show', 'give' ),
98
-					'false' => esc_html__( 'Hide', 'give' ),
97
+					'true'  => esc_html__('Show', 'give'),
98
+					'false' => esc_html__('Hide', 'give'),
99 99
 				),
100 100
 			),
101 101
 			array(
102 102
 				'type'    => 'listbox',
103 103
 				'name'    => 'display_style',
104
-				'label'   => esc_attr__( 'Display Style:', 'give' ),
105
-				'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ),
104
+				'label'   => esc_attr__('Display Style:', 'give'),
105
+				'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'),
106 106
 				'options' => array(
107
-					'redirect'     => esc_html__( 'Redirect', 'give' ),
108
-					'modal_reveal' => esc_html__( 'Modal', 'give' ),
107
+					'redirect'     => esc_html__('Redirect', 'give'),
108
+					'modal_reveal' => esc_html__('Modal', 'give'),
109 109
 				),
110 110
 			),
111 111
 			array(
112 112
 				'type'    => 'textbox',
113 113
 				'name'    => 'forms_per_page',
114
-				'label'   => esc_attr__( 'Forms Per Page:', 'give' ),
115
-				'tooltip' => esc_attr__( 'Sets the number of forms to display per page.', 'give' ),
114
+				'label'   => esc_attr__('Forms Per Page:', 'give'),
115
+				'tooltip' => esc_attr__('Sets the number of forms to display per page.', 'give'),
116 116
 				'value'   => 12,
117 117
 			),
118 118
 		);
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +60 added lines, -60 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
 
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
  * @global     $wpdb
29 29
  * @return void
30 30
  */
31
-function give_install( $network_wide = false ) {
31
+function give_install($network_wide = false) {
32 32
 
33 33
 	global $wpdb;
34 34
 
35
-	if ( is_multisite() && $network_wide ) {
35
+	if (is_multisite() && $network_wide) {
36 36
 
37
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
37
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
38 38
 
39
-			switch_to_blog( $blog_id );
39
+			switch_to_blog($blog_id);
40 40
 			give_run_install();
41 41
 			restore_current_blog();
42 42
 
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
 	give_setup_post_types();
64 64
 
65 65
 	// Add Upgraded From Option.
66
-	$current_version = get_option( 'give_version' );
67
-	if ( $current_version ) {
68
-		update_option( 'give_version_upgraded_from', $current_version, false );
66
+	$current_version = get_option('give_version');
67
+	if ($current_version) {
68
+		update_option('give_version_upgraded_from', $current_version, false);
69 69
 	}
70 70
 
71 71
 	// Setup some default options.
72 72
 	$options = array();
73 73
 
74 74
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
75
-	if ( empty( $current_version ) ) {
76
-		$options = array_merge( $options, give_get_default_settings() );
75
+	if (empty($current_version)) {
76
+		$options = array_merge($options, give_get_default_settings());
77 77
 	}
78 78
 
79 79
 	// Populate the default values.
80
-	update_option( 'give_settings', array_merge( $give_options, $options ), false );
80
+	update_option('give_settings', array_merge($give_options, $options), false);
81 81
 
82 82
 	/**
83 83
 	 * Run plugin upgrades.
84 84
 	 *
85 85
 	 * @since 1.8
86 86
 	 */
87
-	do_action( 'give_upgrades' );
87
+	do_action('give_upgrades');
88 88
 
89
-	if ( GIVE_VERSION !== get_option( 'give_version' ) ) {
90
-		update_option( 'give_version', GIVE_VERSION, false );
89
+	if (GIVE_VERSION !== get_option('give_version')) {
90
+		update_option('give_version', GIVE_VERSION, false);
91 91
 	}
92 92
 
93 93
 	// Create Give roles.
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	// Set api version, end point and refresh permalink.
99 99
 	$api = new Give_API();
100 100
 	$api->add_endpoint();
101
-	update_option( 'give_default_api_version', 'v' . $api->get_version(), false );
101
+	update_option('give_default_api_version', 'v'.$api->get_version(), false);
102 102
 
103 103
 	flush_rewrite_rules();
104 104
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	$donor_meta->create_table();
110 110
 
111 111
 	// Add a temporary option to note that Give pages have been created.
112
-	Give_Cache::set( '_give_installed', $options, 30, true );
112
+	Give_Cache::set('_give_installed', $options, 30, true);
113 113
 
114
-	if ( ! $current_version ) {
114
+	if ( ! $current_version) {
115 115
 
116
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
116
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
117 117
 
118 118
 		// When new upgrade routines are added, mark them as complete on fresh install.
119 119
 		$upgrade_routines = array(
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 			'v220_delete_wp_session_data'
150 150
 		);
151 151
 
152
-		foreach ( $upgrade_routines as $upgrade ) {
153
-			give_set_upgrade_complete( $upgrade );
152
+		foreach ($upgrade_routines as $upgrade) {
153
+			give_set_upgrade_complete($upgrade);
154 154
 		}
155 155
 	}
156 156
 
157 157
 	// Bail if activating from network, or bulk.
158
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
158
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
159 159
 		return;
160 160
 	}
161 161
 
162 162
 	// Add the transient to redirect.
163
-	Give_Cache::set( '_give_activation_redirect', true, 30, true );
163
+	Give_Cache::set('_give_activation_redirect', true, 30, true);
164 164
 }
165 165
 
166 166
 /**
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
  * @param  int    $site_id The Site ID.
179 179
  * @param  array  $meta    Blog Meta.
180 180
  */
181
-function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
181
+function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
182 182
 
183
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
183
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
184 184
 
185
-		switch_to_blog( $blog_id );
185
+		switch_to_blog($blog_id);
186 186
 		give_install();
187 187
 		restore_current_blog();
188 188
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 }
192 192
 
193
-add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 );
193
+add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6);
194 194
 
195 195
 
196 196
 /**
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return array          The tables to drop.
205 205
  */
206
-function give_wpmu_drop_tables( $tables, $blog_id ) {
206
+function give_wpmu_drop_tables($tables, $blog_id) {
207 207
 
208
-	switch_to_blog( $blog_id );
208
+	switch_to_blog($blog_id);
209 209
 	$donors_db     = new Give_DB_Donors();
210 210
 	$donor_meta_db = new Give_DB_Donor_Meta();
211 211
 
212
-	if ( $donors_db->installed() ) {
212
+	if ($donors_db->installed()) {
213 213
 		$tables[] = $donors_db->table_name;
214 214
 		$tables[] = $donor_meta_db->table_name;
215 215
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 }
221 221
 
222
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
222
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
223 223
 
224 224
 /**
225 225
  * Post-installation
@@ -231,16 +231,16 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function give_after_install() {
233 233
 
234
-	if ( ! is_admin() ) {
234
+	if ( ! is_admin()) {
235 235
 		return;
236 236
 	}
237 237
 
238
-	$give_options     = Give_Cache::get( '_give_installed', true );
239
-	$give_table_check = get_option( '_give_table_check', false );
238
+	$give_options     = Give_Cache::get('_give_installed', true);
239
+	$give_table_check = get_option('_give_table_check', false);
240 240
 
241
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
241
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
242 242
 
243
-		if ( ! @Give()->donor_meta->installed() ) {
243
+		if ( ! @Give()->donor_meta->installed()) {
244 244
 
245 245
 			// Create the donor meta database.
246 246
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		}
250 250
 
251
-		if ( ! @Give()->donors->installed() ) {
251
+		if ( ! @Give()->donors->installed()) {
252 252
 			// Create the donor database.
253 253
 			// (this ensures it creates it on multisite instances where it is network activated).
254 254
 			@Give()->donors->create_table();
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 			 *
261 261
 			 * @param array $give_options Give plugin options.
262 262
 			 */
263
-			do_action( 'give_after_install', $give_options );
263
+			do_action('give_after_install', $give_options);
264 264
 		}
265 265
 
266
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ), false );
266
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS), false);
267 267
 
268 268
 	}
269 269
 
270 270
 	// Delete the transient
271
-	if ( false !== $give_options ) {
272
-		Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) );
271
+	if (false !== $give_options) {
272
+		Give_Cache::delete(Give_Cache::get_key('_give_installed'));
273 273
 	}
274 274
 
275 275
 
276 276
 }
277 277
 
278
-add_action( 'admin_init', 'give_after_install' );
278
+add_action('admin_init', 'give_after_install');
279 279
 
280 280
 
281 281
 /**
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 
291 291
 	global $wp_roles;
292 292
 
293
-	if ( ! is_object( $wp_roles ) ) {
293
+	if ( ! is_object($wp_roles)) {
294 294
 		return;
295 295
 	}
296 296
 
297
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
297
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
298 298
 
299 299
 		// Create Give plugin roles
300 300
 		$roles = new Give_Roles();
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
 }
307 307
 
308
-add_action( 'admin_init', 'give_install_roles_on_network' );
308
+add_action('admin_init', 'give_install_roles_on_network');
309 309
 
310 310
 /**
311 311
  * Default core setting values.
@@ -347,14 +347,14 @@  discard block
 block discarded – undo
347 347
 		'uninstall_on_delete'                         => 'disabled',
348 348
 		'the_content_filter'                          => 'enabled',
349 349
 		'scripts_footer'                              => 'disabled',
350
-		'agree_to_terms_label'                        => __( 'Agree to Terms?', 'give' ),
350
+		'agree_to_terms_label'                        => __('Agree to Terms?', 'give'),
351 351
 		'agreement_text'                              => give_get_default_agreement_text(),
352 352
 
353 353
 		// Paypal IPN verification.
354 354
 		'paypal_verification'                         => 'enabled',
355 355
 
356 356
 		// Default is manual gateway.
357
-		'gateways'                                    => array( 'manual' => 1, 'offline' => 1 ),
357
+		'gateways'                                    => array('manual' => 1, 'offline' => 1),
358 358
 		'default_gateway'                             => 'manual',
359 359
 
360 360
 		// Offline gateway setup.
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
  */
383 383
 function give_get_default_agreement_text() {
384 384
 
385
-	$org_name = get_bloginfo( 'name' );
385
+	$org_name = get_bloginfo('name');
386 386
 
387 387
 	$agreement = sprintf(
388 388
 		'<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The  %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the  %1$s.</p>
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 		$org_name
397 397
 	);
398 398
 
399
-	return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name );
399
+	return apply_filters('give_get_default_agreement_text', $agreement, $org_name);
400 400
 }
401 401
 
402 402
 
@@ -410,19 +410,19 @@  discard block
 block discarded – undo
410 410
 function give_create_pages() {
411 411
 
412 412
 	// Bailout if pages already created.
413
-	if ( get_option( 'give_install_pages_created' ) ) {
413
+	if (get_option('give_install_pages_created')) {
414 414
 		return false;
415 415
 	}
416 416
 
417 417
 	$options = array();
418 418
 
419 419
 	// Checks if the Success Page option exists AND that the page exists.
420
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
420
+	if ( ! get_post(give_get_option('success_page'))) {
421 421
 
422 422
 		// Donation Confirmation (Success) Page
423 423
 		$success = wp_insert_post(
424 424
 			array(
425
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
425
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
426 426
 				'post_content'   => '[give_receipt]',
427 427
 				'post_status'    => 'publish',
428 428
 				'post_author'    => 1,
@@ -436,13 +436,13 @@  discard block
 block discarded – undo
436 436
 	}
437 437
 
438 438
 	// Checks if the Failure Page option exists AND that the page exists.
439
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
439
+	if ( ! get_post(give_get_option('failure_page'))) {
440 440
 
441 441
 		// Failed Donation Page
442 442
 		$failed = wp_insert_post(
443 443
 			array(
444
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
445
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
444
+				'post_title'     => esc_html__('Donation Failed', 'give'),
445
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
446 446
 				'post_status'    => 'publish',
447 447
 				'post_author'    => 1,
448 448
 				'post_type'      => 'page',
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 	}
455 455
 
456 456
 	// Checks if the History Page option exists AND that the page exists.
457
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
457
+	if ( ! get_post(give_get_option('history_page'))) {
458 458
 		// Donation History Page
459 459
 		$history = wp_insert_post(
460 460
 			array(
461
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
461
+				'post_title'     => esc_html__('Donation History', 'give'),
462 462
 				'post_content'   => '[donation_history]',
463 463
 				'post_status'    => 'publish',
464 464
 				'post_author'    => 1,
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
 		$options['history_page'] = $history;
471 471
 	}
472 472
 
473
-	if ( ! empty( $options ) ) {
474
-		update_option( 'give_settings', array_merge( give_get_settings(), $options ), false );
473
+	if ( ! empty($options)) {
474
+		update_option('give_settings', array_merge(give_get_settings(), $options), false);
475 475
 	}
476 476
 
477
-	add_option( 'give_install_pages_created', 1, '', false );
477
+	add_option('give_install_pages_created', 1, '', false);
478 478
 }
479 479
 
480
-add_action( 'admin_init', 'give_create_pages', - 1 );
480
+add_action('admin_init', 'give_create_pages', - 1);
Please login to merge, or discard this patch.