Test Failed
Pull Request — master (#2482)
by Devin
05:37
created
includes/misc-functions.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -812,10 +812,10 @@  discard block
 block discarded – undo
812 812
 		}
813 813
 
814 814
 		if ( ! is_int( $params[1] )
815
-		     && ! is_float( $params[1] )
816
-		     && ! is_string( $params[1] )
817
-		     && $params[1] !== null
818
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
815
+			 && ! is_float( $params[1] )
816
+			 && ! is_string( $params[1] )
817
+			 && $params[1] !== null
818
+			 && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
819 819
 		) {
820 820
 			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
821 821
 
@@ -823,10 +823,10 @@  discard block
 block discarded – undo
823 823
 		}
824 824
 
825 825
 		if ( isset( $params[2] )
826
-		     && ! is_int( $params[2] )
827
-		     && ! is_float( $params[2] )
828
-		     && ! is_string( $params[2] )
829
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
826
+			 && ! is_int( $params[2] )
827
+			 && ! is_float( $params[2] )
828
+			 && ! is_string( $params[2] )
829
+			 && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
830 830
 		) {
831 831
 			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
832 832
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
  *
213 213
  * @since 1.8.17
214 214
  *
215
- * @return array|string
215
+ * @return boolean
216 216
  */
217 217
 function give_get_history_session() {
218 218
 	return (bool) Give()->session->get( 'history_access' );
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
  *
686 686
  * @todo  Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828).
687 687
  *
688
- * @return bool
688
+ * @return false|null
689 689
  */
690 690
 function give_donation_metabox_menu() {
691 691
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
  * @param int    $id
1085 1085
  * @param string $meta_key
1086 1086
  * @param mixed  $meta_value
1087
- * @param mixed  $prev_value
1087
+ * @param string  $prev_value
1088 1088
  *
1089 1089
  * @return mixed
1090 1090
  */
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
  * @since 1.8.13
1292 1292
  *
1293 1293
  * @param array      $list      List of objects or arrays
1294
- * @param int|string $field     Field from the object to place instead of the entire object
1294
+ * @param string $field     Field from the object to place instead of the entire object
1295 1295
  * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
1296 1296
  *                              Default null.
1297 1297
  *
Please login to merge, or discard this patch.
Spacing   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 
40 40
 	global $wp;
41 41
 
42
-	if ( get_option( 'permalink_structure' ) ) {
43
-		$base = trailingslashit( home_url( $wp->request ) );
42
+	if (get_option('permalink_structure')) {
43
+		$base = trailingslashit(home_url($wp->request));
44 44
 	} else {
45
-		$base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
46
-		$base = remove_query_arg( array( 'post_type', 'name' ), $base );
45
+		$base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
46
+		$base = remove_query_arg(array('post_type', 'name'), $base);
47 47
 	}
48 48
 
49 49
 	$scheme      = is_ssl() ? 'https' : 'http';
50
-	$current_uri = set_url_scheme( $base, $scheme );
50
+	$current_uri = set_url_scheme($base, $scheme);
51 51
 
52
-	if ( is_front_page() ) {
53
-		$current_uri = home_url( '/' );
52
+	if (is_front_page()) {
53
+		$current_uri = home_url('/');
54 54
 	}
55 55
 
56 56
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $current_uri
62 62
 	 */
63
-	return apply_filters( 'give_get_current_page_url', $current_uri );
63
+	return apply_filters('give_get_current_page_url', $current_uri);
64 64
 
65 65
 }
66 66
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	$gateways = give_get_enabled_payment_gateways();
84 84
 
85
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
85
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
86 86
 		$ret = true;
87
-	} elseif ( count( $gateways ) == 1 ) {
87
+	} elseif (count($gateways) == 1) {
88 88
 		$ret = false;
89
-	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
89
+	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
90 90
 		$ret = false;
91 91
 	}
92 92
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param bool $ret
99 99
 	 */
100
-	return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret );
100
+	return (bool) apply_filters('give_is_cc_verify_enabled', $ret);
101 101
 }
102 102
 
103 103
 /**
@@ -109,26 +109,26 @@  discard block
 block discarded – undo
109 109
 function give_get_timezone_id() {
110 110
 
111 111
 	// if site timezone string exists, return it.
112
-	if ( $timezone = get_option( 'timezone_string' ) ) {
112
+	if ($timezone = get_option('timezone_string')) {
113 113
 		return $timezone;
114 114
 	}
115 115
 
116 116
 	// get UTC offset, if it isn't set return UTC.
117
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
117
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
118 118
 		return 'UTC';
119 119
 	}
120 120
 
121 121
 	// attempt to guess the timezone string from the UTC offset.
122
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
122
+	$timezone = timezone_name_from_abbr('', $utc_offset);
123 123
 
124 124
 	// last try, guess timezone string manually.
125
-	if ( $timezone === false ) {
125
+	if ($timezone === false) {
126 126
 
127
-		$is_dst = date( 'I' );
127
+		$is_dst = date('I');
128 128
 
129
-		foreach ( timezone_abbreviations_list() as $abbr ) {
130
-			foreach ( $abbr as $city ) {
131
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
129
+		foreach (timezone_abbreviations_list() as $abbr) {
130
+			foreach ($abbr as $city) {
131
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
132 132
 					return $city['timezone_id'];
133 133
 				}
134 134
 			}
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 
153 153
 	$ip = '127.0.0.1';
154 154
 
155
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
155
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
156 156
 		// check ip from share internet
157 157
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
158
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
158
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
159 159
 		// to check ip is pass from proxy
160 160
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
161
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
161
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
162 162
 		$ip = $_SERVER['REMOTE_ADDR'];
163 163
 	}
164 164
 
165
-	return apply_filters( 'give_get_ip', $ip );
165
+	return apply_filters('give_get_ip', $ip);
166 166
 }
167 167
 
168 168
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @uses  Give()->session->set()
179 179
  */
180
-function give_set_purchase_session( $purchase_data = array() ) {
181
-	Give()->session->set( 'give_purchase', $purchase_data );
182
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
180
+function give_set_purchase_session($purchase_data = array()) {
181
+	Give()->session->set('give_purchase', $purchase_data);
182
+	Give()->session->set('give_email', $purchase_data['user_email']);
183 183
 }
184 184
 
185 185
 /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
  * @return mixed array | false
194 194
  */
195 195
 function give_get_purchase_session() {
196
-	return Give()->session->get( 'give_purchase' );
196
+	return Give()->session->get('give_purchase');
197 197
 }
198 198
 
199 199
 /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
  * @return array|string
205 205
  */
206 206
 function give_get_receipt_session() {
207
-	return Give()->session->get( 'receipt_access' );
207
+	return Give()->session->get('receipt_access');
208 208
 }
209 209
 
210 210
 /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
  * @return array|string
216 216
  */
217 217
 function give_get_history_session() {
218
-	return (bool) Give()->session->get( 'history_access' );
218
+	return (bool) Give()->session->get('history_access');
219 219
 }
220 220
 
221 221
 /**
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return string By default, the name of the form. Then the price level text if any is found.
229 229
  */
230
-function give_payment_gateway_item_title( $payment_data ) {
230
+function give_payment_gateway_item_title($payment_data) {
231 231
 
232
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
233
-	$item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : '';
234
-	$price_id  = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
232
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
233
+	$item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : '';
234
+	$price_id  = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
235 235
 
236 236
 
237 237
 	// Verify has variable prices.
238
-	if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) {
238
+	if (give_has_variable_prices($form_id) && ! empty($price_id)) {
239 239
 
240
-		$item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false );
240
+		$item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false);
241 241
 
242 242
 		/**
243 243
 		 * Output donation level text if:
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 		 */
248 248
 		if (
249 249
 			'custom' !== $price_id
250
-			&& ! empty( $item_price_level_text )
250
+			&& ! empty($item_price_level_text)
251 251
 		) {
252 252
 			// Matches a donation level - append level text.
253
-			$item_name .= ' - ' . $item_price_level_text;
253
+			$item_name .= ' - '.$item_price_level_text;
254 254
 		}
255 255
 	}
256 256
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return string
267 267
 	 */
268
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
268
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
269 269
 }
270 270
 
271 271
 /**
@@ -281,36 +281,36 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @return string
283 283
  */
284
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
285
-	$form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
284
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
285
+	$form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
286 286
 
287 287
 	// Form title.
288
-	$summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) );
288
+	$summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give')));
289 289
 
290 290
 	// Form multilevel if applicable.
291
-	if ( isset( $donation_data['post_data']['give-price-id'] ) ) {
292
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
291
+	if (isset($donation_data['post_data']['give-price-id'])) {
292
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
293 293
 	}
294 294
 
295 295
 	// Add Donor's name + email if requested.
296
-	if ( $name_and_email ) {
296
+	if ($name_and_email) {
297 297
 
298 298
 		// First name
299
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
300
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
299
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
300
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
301 301
 		}
302 302
 
303
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
304
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
303
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
304
+			$summary .= ' '.$donation_data['user_info']['last_name'];
305 305
 		}
306 306
 
307
-		$summary .= ' (' . $donation_data['user_email'] . ')';
307
+		$summary .= ' ('.$donation_data['user_email'].')';
308 308
 	}
309 309
 
310 310
 	// Cut the length
311
-	$summary = substr( $summary, 0, $length );
311
+	$summary = substr($summary, 0, $length);
312 312
 
313
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
313
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
314 314
 }
315 315
 
316 316
 
@@ -325,31 +325,31 @@  discard block
 block discarded – undo
325 325
 function give_get_host() {
326 326
 	$host = false;
327 327
 
328
-	if ( defined( 'WPE_APIKEY' ) ) {
328
+	if (defined('WPE_APIKEY')) {
329 329
 		$host = 'WP Engine';
330
-	} elseif ( defined( 'PAGELYBIN' ) ) {
330
+	} elseif (defined('PAGELYBIN')) {
331 331
 		$host = 'Pagely';
332
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
332
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
333 333
 		$host = 'ICDSoft';
334
-	} elseif ( DB_HOST == 'mysqlv5' ) {
334
+	} elseif (DB_HOST == 'mysqlv5') {
335 335
 		$host = 'NetworkSolutions';
336
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
336
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
337 337
 		$host = 'iPage';
338
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
338
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
339 339
 		$host = 'IPower';
340
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
340
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
341 341
 		$host = 'MediaTemple Grid';
342
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
342
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
343 343
 		$host = 'pair Networks';
344
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
344
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
345 345
 		$host = 'Rackspace Cloud';
346
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
346
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
347 347
 		$host = 'SysFix.eu Power Hosting';
348
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
348
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
349 349
 		$host = 'Flywheel';
350 350
 	} else {
351 351
 		// Adding a general fallback for data gathering
352
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
352
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
353 353
 	}
354 354
 
355 355
 	return $host;
@@ -365,67 +365,67 @@  discard block
 block discarded – undo
365 365
  *
366 366
  * @return bool true if host matches, false if not
367 367
  */
368
-function give_is_host( $host = false ) {
368
+function give_is_host($host = false) {
369 369
 
370 370
 	$return = false;
371 371
 
372
-	if ( $host ) {
373
-		$host = str_replace( ' ', '', strtolower( $host ) );
372
+	if ($host) {
373
+		$host = str_replace(' ', '', strtolower($host));
374 374
 
375
-		switch ( $host ) {
375
+		switch ($host) {
376 376
 			case 'wpengine':
377
-				if ( defined( 'WPE_APIKEY' ) ) {
377
+				if (defined('WPE_APIKEY')) {
378 378
 					$return = true;
379 379
 				}
380 380
 				break;
381 381
 			case 'pagely':
382
-				if ( defined( 'PAGELYBIN' ) ) {
382
+				if (defined('PAGELYBIN')) {
383 383
 					$return = true;
384 384
 				}
385 385
 				break;
386 386
 			case 'icdsoft':
387
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
387
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
388 388
 					$return = true;
389 389
 				}
390 390
 				break;
391 391
 			case 'networksolutions':
392
-				if ( DB_HOST == 'mysqlv5' ) {
392
+				if (DB_HOST == 'mysqlv5') {
393 393
 					$return = true;
394 394
 				}
395 395
 				break;
396 396
 			case 'ipage':
397
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
397
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
398 398
 					$return = true;
399 399
 				}
400 400
 				break;
401 401
 			case 'ipower':
402
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
402
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
403 403
 					$return = true;
404 404
 				}
405 405
 				break;
406 406
 			case 'mediatemplegrid':
407
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
407
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
408 408
 					$return = true;
409 409
 				}
410 410
 				break;
411 411
 			case 'pairnetworks':
412
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
412
+				if (strpos(DB_HOST, '.pair.com') !== false) {
413 413
 					$return = true;
414 414
 				}
415 415
 				break;
416 416
 			case 'rackspacecloud':
417
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
417
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
418 418
 					$return = true;
419 419
 				}
420 420
 				break;
421 421
 			case 'sysfix.eu':
422 422
 			case 'sysfix.eupowerhosting':
423
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
423
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
424 424
 					$return = true;
425 425
 				}
426 426
 				break;
427 427
 			case 'flywheel':
428
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
428
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
429 429
 					$return = true;
430 430
 				}
431 431
 				break;
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
  * @param string $replacement Optional. The function that should have been called.
459 459
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
460 460
  */
461
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
461
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
462 462
 
463 463
 	/**
464 464
 	 * Fires while give deprecated function call occurs.
@@ -471,19 +471,19 @@  discard block
 block discarded – undo
471 471
 	 * @param string $replacement Optional. The function that should have been called.
472 472
 	 * @param string $version     The plugin version that deprecated the function.
473 473
 	 */
474
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
474
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
475 475
 
476
-	$show_errors = current_user_can( 'manage_options' );
476
+	$show_errors = current_user_can('manage_options');
477 477
 
478 478
 	// Allow plugin to filter the output error trigger.
479
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
480
-		if ( ! is_null( $replacement ) ) {
481
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
482
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
479
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
480
+		if ( ! is_null($replacement)) {
481
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
482
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
483 483
 			// Alternatively we could dump this to a file.
484 484
 		} else {
485
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
486
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
485
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
486
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
487 487
 			// Alternatively we could dump this to a file.
488 488
 		}
489 489
 	}
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
  * @return string $post_id
498 498
  */
499 499
 function give_get_admin_post_id() {
500
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
501
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
500
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
501
+	if ( ! $post_id && isset($_POST['post_id'])) {
502 502
 		$post_id = $_POST['post_id'];
503 503
 	}
504 504
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
  * @return string Arg separator output
513 513
  */
514 514
 function give_get_php_arg_separator_output() {
515
-	return ini_get( 'arg_separator.output' );
515
+	return ini_get('arg_separator.output');
516 516
 }
517 517
 
518 518
 
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
  *
528 528
  * @return string Short month name
529 529
  */
530
-function give_month_num_to_name( $n ) {
531
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
530
+function give_month_num_to_name($n) {
531
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
532 532
 
533
-	return date_i18n( 'M', $timestamp );
533
+	return date_i18n('M', $timestamp);
534 534
 }
535 535
 
536 536
 
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
  *
544 544
  * @return bool Whether or not function is disabled.
545 545
  */
546
-function give_is_func_disabled( $function ) {
547
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
546
+function give_is_func_disabled($function) {
547
+	$disabled = explode(',', ini_get('disable_functions'));
548 548
 
549
-	return in_array( $function, $disabled );
549
+	return in_array($function, $disabled);
550 550
 }
551 551
 
552 552
 /**
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 function give_get_newsletter() {
558 558
 	?>
559 559
 
560
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
560
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
561 561
 
562 562
 	<div class="give-newsletter-form-wrap">
563 563
 
@@ -565,33 +565,33 @@  discard block
 block discarded – undo
565 565
 		      method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
566 566
 		      target="_blank" novalidate>
567 567
 			<div class="give-newsletter-confirmation">
568
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
568
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
569 569
 			</div>
570 570
 
571 571
 			<table class="form-table give-newsletter-form">
572 572
 				<tr valign="middle">
573 573
 					<td>
574 574
 						<label for="mce-EMAIL"
575
-						       class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
575
+						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
576 576
 						<input type="email" name="EMAIL" id="mce-EMAIL"
577
-						       placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
577
+						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
578 578
 						       class="required email" value="">
579 579
 					</td>
580 580
 					<td>
581 581
 						<label for="mce-FNAME"
582
-						       class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
582
+						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
583 583
 						<input type="text" name="FNAME" id="mce-FNAME"
584
-						       placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
584
+						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
585 585
 					</td>
586 586
 					<td>
587 587
 						<label for="mce-LNAME"
588
-						       class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
588
+						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
589 589
 						<input type="text" name="LNAME" id="mce-LNAME"
590
-						       placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
590
+						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
591 591
 					</td>
592 592
 					<td>
593 593
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
594
-						       value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
594
+						       value="<?php esc_attr_e('Subscribe', 'give'); ?>">
595 595
 					</td>
596 596
 				</tr>
597 597
 			</table>
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
  *
645 645
  * @return string
646 646
  */
647
-function give_svg_icons( $icon ) {
647
+function give_svg_icons($icon) {
648 648
 
649 649
 	// Store your SVGs in an associative array
650 650
 	$svgs = array(
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	);
657 657
 
658 658
 	// Return the chosen icon's SVG string
659
-	return $svgs[ $icon ];
659
+	return $svgs[$icon];
660 660
 }
661 661
 
662 662
 /**
@@ -668,15 +668,15 @@  discard block
 block discarded – undo
668 668
  *
669 669
  * @return mixed
670 670
  */
671
-function modify_nav_menu_meta_box_object( $post_type ) {
672
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
673
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
671
+function modify_nav_menu_meta_box_object($post_type) {
672
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
673
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
674 674
 	}
675 675
 
676 676
 	return $post_type;
677 677
 }
678 678
 
679
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
679
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
680 680
 
681 681
 /**
682 682
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -695,35 +695,35 @@  discard block
 block discarded – undo
695 695
 	// Proceed, if current screen is navigation menus.
696 696
 	if (
697 697
 		'nav-menus' === $screen->id &&
698
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) ) &&
699
-		! get_user_option( 'give_is_donation_forms_menu_updated' )
698
+		give_is_setting_enabled(give_get_option('forms_singular')) &&
699
+		! get_user_option('give_is_donation_forms_menu_updated')
700 700
 	) {
701 701
 
702 702
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
703 703
 		if (
704 704
 			! is_admin() ||
705
-			( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) )
705
+			( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))
706 706
 		) {
707 707
 			return false;
708 708
 		}
709 709
 
710 710
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
711
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
711
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
712 712
 			return false;
713 713
 		}
714 714
 
715 715
 		// Exclude 'Donation Form' value from hidden meta box's list.
716
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
716
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
717 717
 
718 718
 		// Get current user ID.
719 719
 		$user = wp_get_current_user();
720 720
 
721
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
722
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
721
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
722
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
723 723
 	}
724 724
 }
725 725
 
726
-add_action( 'current_screen', 'give_donation_metabox_menu' );
726
+add_action('current_screen', 'give_donation_metabox_menu');
727 727
 
728 728
 /**
729 729
  * Array_column backup usage
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
  * @license    https://opensource.org/licenses/MIT MIT
737 737
  */
738 738
 
739
-if ( ! function_exists( 'array_column' ) ) {
739
+if ( ! function_exists('array_column')) {
740 740
 	/**
741 741
 	 * Returns the values from a single column of the input array, identified by
742 742
 	 * the $columnKey.
@@ -755,53 +755,53 @@  discard block
 block discarded – undo
755 755
 	 *
756 756
 	 * @return array
757 757
 	 */
758
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
758
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
759 759
 		// Using func_get_args() in order to check for proper number of
760 760
 		// parameters and trigger errors exactly as the built-in array_column()
761 761
 		// does in PHP 5.5.
762 762
 		$argc   = func_num_args();
763 763
 		$params = func_get_args();
764 764
 
765
-		if ( $argc < 2 ) {
766
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
765
+		if ($argc < 2) {
766
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
767 767
 
768 768
 			return null;
769 769
 		}
770 770
 
771
-		if ( ! is_array( $params[0] ) ) {
772
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
771
+		if ( ! is_array($params[0])) {
772
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
773 773
 
774 774
 			return null;
775 775
 		}
776 776
 
777
-		if ( ! is_int( $params[1] )
778
-		     && ! is_float( $params[1] )
779
-		     && ! is_string( $params[1] )
777
+		if ( ! is_int($params[1])
778
+		     && ! is_float($params[1])
779
+		     && ! is_string($params[1])
780 780
 		     && $params[1] !== null
781
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
781
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
782 782
 		) {
783
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
783
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
784 784
 
785 785
 			return false;
786 786
 		}
787 787
 
788
-		if ( isset( $params[2] )
789
-		     && ! is_int( $params[2] )
790
-		     && ! is_float( $params[2] )
791
-		     && ! is_string( $params[2] )
792
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
788
+		if (isset($params[2])
789
+		     && ! is_int($params[2])
790
+		     && ! is_float($params[2])
791
+		     && ! is_string($params[2])
792
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
793 793
 		) {
794
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
794
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
795 795
 
796 796
 			return false;
797 797
 		}
798 798
 
799 799
 		$paramsInput     = $params[0];
800
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
800
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
801 801
 
802 802
 		$paramsIndexKey = null;
803
-		if ( isset( $params[2] ) ) {
804
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
803
+		if (isset($params[2])) {
804
+			if (is_float($params[2]) || is_int($params[2])) {
805 805
 				$paramsIndexKey = (int) $params[2];
806 806
 			} else {
807 807
 				$paramsIndexKey = (string) $params[2];
@@ -810,26 +810,26 @@  discard block
 block discarded – undo
810 810
 
811 811
 		$resultArray = array();
812 812
 
813
-		foreach ( $paramsInput as $row ) {
813
+		foreach ($paramsInput as $row) {
814 814
 			$key    = $value = null;
815 815
 			$keySet = $valueSet = false;
816 816
 
817
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
817
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
818 818
 				$keySet = true;
819
-				$key    = (string) $row[ $paramsIndexKey ];
819
+				$key    = (string) $row[$paramsIndexKey];
820 820
 			}
821 821
 
822
-			if ( $paramsColumnKey === null ) {
822
+			if ($paramsColumnKey === null) {
823 823
 				$valueSet = true;
824 824
 				$value    = $row;
825
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
825
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
826 826
 				$valueSet = true;
827
-				$value    = $row[ $paramsColumnKey ];
827
+				$value    = $row[$paramsColumnKey];
828 828
 			}
829 829
 
830
-			if ( $valueSet ) {
831
-				if ( $keySet ) {
832
-					$resultArray[ $key ] = $value;
830
+			if ($valueSet) {
831
+				if ($keySet) {
832
+					$resultArray[$key] = $value;
833 833
 				} else {
834 834
 					$resultArray[] = $value;
835 835
 				}
@@ -849,54 +849,54 @@  discard block
 block discarded – undo
849 849
  *
850 850
  * @return bool Whether the receipt is visible or not.
851 851
  */
852
-function give_can_view_receipt( $payment_key = '' ) {
852
+function give_can_view_receipt($payment_key = '') {
853 853
 
854 854
 	$return = false;
855 855
 
856
-	if ( empty( $payment_key ) ) {
856
+	if (empty($payment_key)) {
857 857
 		return $return;
858 858
 	}
859 859
 
860 860
 	global $give_receipt_args;
861 861
 
862
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
862
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
863 863
 
864
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
864
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
865 865
 
866
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
866
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
867 867
 
868
-	if ( is_user_logged_in() ) {
869
-		if ( $user_id === (int) get_current_user_id() ) {
868
+	if (is_user_logged_in()) {
869
+		if ($user_id === (int) get_current_user_id()) {
870 870
 			$return = true;
871
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
871
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
872 872
 			$return = true;
873
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
873
+		} elseif (current_user_can('view_give_sensitive_data')) {
874 874
 			$return = true;
875 875
 		}
876 876
 	}
877 877
 
878 878
 	// Check whether it is purchase session?
879 879
 	$purchase_session = give_get_purchase_session();
880
-	if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) {
881
-		if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) {
880
+	if ( ! empty($purchase_session) && ! is_user_logged_in()) {
881
+		if ($purchase_session['purchase_key'] === $payment_meta['key']) {
882 882
 			$return = true;
883 883
 		}
884 884
 	}
885 885
 
886 886
 	// Check whether it is receipt access session?
887 887
 	$receipt_session = give_get_receipt_session();
888
-	if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) {
889
-		if ( $receipt_session === $payment_meta['key'] ) {
888
+	if ( ! empty($receipt_session) && ! is_user_logged_in()) {
889
+		if ($receipt_session === $payment_meta['key']) {
890 890
 			$return = true;
891 891
 		}
892 892
 	}
893 893
 
894 894
 	// Check whether it is history access session?
895
-	if ( true === give_get_history_session() ) {
895
+	if (true === give_get_history_session()) {
896 896
 		$return = true;
897 897
 	}
898 898
 
899
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
899
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
900 900
 
901 901
 }
902 902
 
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
  *
906 906
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
907 907
  */
908
-if ( ! function_exists( 'cal_days_in_month' ) ) {
908
+if ( ! function_exists('cal_days_in_month')) {
909 909
 	/**
910 910
 	 * cal_days_in_month
911 911
 	 *
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	 *
916 916
 	 * @return bool|string
917 917
 	 */
918
-	function cal_days_in_month( $calendar, $month, $year ) {
919
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
918
+	function cal_days_in_month($calendar, $month, $year) {
919
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
920 920
 	}
921 921
 }
922 922
 
@@ -935,42 +935,42 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function give_get_plugins() {
937 937
 	$plugins             = get_plugins();
938
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
938
+	$active_plugin_paths = (array) get_option('active_plugins', array());
939 939
 
940
-	if ( is_multisite() ) {
941
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
942
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
940
+	if (is_multisite()) {
941
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
942
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
943 943
 	}
944 944
 
945
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
945
+	foreach ($plugins as $plugin_path => $plugin_data) {
946 946
 		// Is plugin active?
947
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
948
-			$plugins[ $plugin_path ]['Status'] = 'active';
947
+		if (in_array($plugin_path, $active_plugin_paths)) {
948
+			$plugins[$plugin_path]['Status'] = 'active';
949 949
 		} else {
950
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
950
+			$plugins[$plugin_path]['Status'] = 'inactive';
951 951
 		}
952 952
 
953
-		$dirname = strtolower( dirname( $plugin_path ) );
953
+		$dirname = strtolower(dirname($plugin_path));
954 954
 
955 955
 		// Is plugin a Give add-on by WordImpress?
956
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
956
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
957 957
 			// Plugin is a Give-addon.
958
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
958
+			$plugins[$plugin_path]['Type'] = 'add-on';
959 959
 
960 960
 			// Get license info from database.
961
-			$plugin_name    = str_replace( 'Give - ', '', $plugin_data['Name'] );
962
-			$db_option      = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';
963
-			$license_active = get_option( $db_option );
961
+			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']);
962
+			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active';
963
+			$license_active = get_option($db_option);
964 964
 
965 965
 			// Does a valid license exist?
966
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
967
-				$plugins[ $plugin_path ]['License'] = true;
966
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
967
+				$plugins[$plugin_path]['License'] = true;
968 968
 			} else {
969
-				$plugins[ $plugin_path ]['License'] = false;
969
+				$plugins[$plugin_path]['License'] = false;
970 970
 			}
971 971
 		} else {
972 972
 			// Plugin is not a Give add-on.
973
-			$plugins[ $plugin_path ]['Type'] = 'other';
973
+			$plugins[$plugin_path]['Type'] = 'other';
974 974
 		}
975 975
 	}
976 976
 
@@ -987,16 +987,16 @@  discard block
 block discarded – undo
987 987
  *
988 988
  * @return bool
989 989
  */
990
-function give_is_terms_enabled( $form_id ) {
991
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
990
+function give_is_terms_enabled($form_id) {
991
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
992 992
 
993 993
 	if (
994
-		give_is_setting_enabled( $form_option, 'global' )
995
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
994
+		give_is_setting_enabled($form_option, 'global')
995
+		&& give_is_setting_enabled(give_get_option('terms'))
996 996
 	) {
997 997
 		return true;
998 998
 
999
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
999
+	} elseif (give_is_setting_enabled($form_option)) {
1000 1000
 		return true;
1001 1001
 
1002 1002
 	} else {
@@ -1021,10 +1021,10 @@  discard block
 block discarded – undo
1021 1021
  *
1022 1022
  * @return WP_Error|bool
1023 1023
  */
1024
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1024
+function give_delete_donation_stats($date_range = '', $args = array()) {
1025 1025
 
1026 1026
 	// Delete all cache.
1027
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1027
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1028 1028
 
1029 1029
 	/**
1030 1030
 	 * Fire the action when donation stats delete.
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 	 * @param string|array $date_range
1035 1035
 	 * @param array        $args
1036 1036
 	 */
1037
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1037
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1038 1038
 
1039 1039
 	return $status;
1040 1040
 }
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
  *
1053 1053
  * @return mixed
1054 1054
  */
1055
-function give_get_meta( $id, $meta_key, $single = false, $default = false ) {
1055
+function give_get_meta($id, $meta_key, $single = false, $default = false) {
1056 1056
 	/**
1057 1057
 	 * Filter the meta value
1058 1058
 	 *
@@ -1060,14 +1060,14 @@  discard block
 block discarded – undo
1060 1060
 	 */
1061 1061
 	$meta_value = apply_filters(
1062 1062
 		'give_get_meta',
1063
-		get_post_meta( $id, $meta_key, $single ),
1063
+		get_post_meta($id, $meta_key, $single),
1064 1064
 		$id,
1065 1065
 		$meta_key,
1066 1066
 		$default
1067 1067
 	);
1068 1068
 
1069 1069
 	if (
1070
-		( empty( $meta_key ) || empty( $meta_value ) )
1070
+		(empty($meta_key) || empty($meta_value))
1071 1071
 		&& $default
1072 1072
 	) {
1073 1073
 		$meta_value = $default;
@@ -1088,15 +1088,15 @@  discard block
 block discarded – undo
1088 1088
  *
1089 1089
  * @return mixed
1090 1090
  */
1091
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1092
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1091
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1092
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1093 1093
 
1094 1094
 	/**
1095 1095
 	 * Filter the meta value update status
1096 1096
 	 *
1097 1097
 	 * @since 1.8.8
1098 1098
 	 */
1099
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1099
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1100 1100
 }
1101 1101
 
1102 1102
 /**
@@ -1110,15 +1110,15 @@  discard block
 block discarded – undo
1110 1110
  *
1111 1111
  * @return mixed
1112 1112
  */
1113
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1114
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1113
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1114
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1115 1115
 
1116 1116
 	/**
1117 1117
 	 * Filter the meta value delete status
1118 1118
 	 *
1119 1119
 	 * @since 1.8.8
1120 1120
 	 */
1121
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1121
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1122 1122
 }
1123 1123
 
1124 1124
 /**
@@ -1130,15 +1130,15 @@  discard block
 block discarded – undo
1130 1130
  *
1131 1131
  * @return bool                   If the action has been added to the completed actions array
1132 1132
  */
1133
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1133
+function give_has_upgrade_completed($upgrade_action = '') {
1134 1134
 
1135
-	if ( empty( $upgrade_action ) ) {
1135
+	if (empty($upgrade_action)) {
1136 1136
 		return false;
1137 1137
 	}
1138 1138
 
1139 1139
 	$completed_upgrades = give_get_completed_upgrades();
1140 1140
 
1141
-	return in_array( $upgrade_action, $completed_upgrades );
1141
+	return in_array($upgrade_action, $completed_upgrades);
1142 1142
 
1143 1143
 }
1144 1144
 
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1151 1151
  */
1152 1152
 function give_maybe_resume_upgrade() {
1153
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1154
-	if ( empty( $doing_upgrade ) ) {
1153
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1154
+	if (empty($doing_upgrade)) {
1155 1155
 		return false;
1156 1156
 	}
1157 1157
 
@@ -1167,9 +1167,9 @@  discard block
 block discarded – undo
1167 1167
  *
1168 1168
  * @return bool                   If the function was successfully added
1169 1169
  */
1170
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1170
+function give_set_upgrade_complete($upgrade_action = '') {
1171 1171
 
1172
-	if ( empty( $upgrade_action ) ) {
1172
+	if (empty($upgrade_action)) {
1173 1173
 		return false;
1174 1174
 	}
1175 1175
 
@@ -1177,16 +1177,16 @@  discard block
 block discarded – undo
1177 1177
 	$completed_upgrades[] = $upgrade_action;
1178 1178
 
1179 1179
 	// Remove any blanks, and only show uniques.
1180
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1180
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1181 1181
 
1182 1182
 	/**
1183 1183
 	 * Fire the action when any upgrade set to complete.
1184 1184
 	 *
1185 1185
 	 * @since 1.8.12
1186 1186
 	 */
1187
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1187
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1188 1188
 
1189
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
1189
+	return update_option('give_completed_upgrades', $completed_upgrades);
1190 1190
 }
1191 1191
 
1192 1192
 /**
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
  * @return array The array of completed upgrades
1197 1197
  */
1198 1198
 function give_get_completed_upgrades() {
1199
-	return (array) get_option( 'give_completed_upgrades' );
1199
+	return (array) get_option('give_completed_upgrades');
1200 1200
 }
1201 1201
 
1202 1202
 /**
@@ -1206,21 +1206,21 @@  discard block
 block discarded – undo
1206 1206
  *
1207 1207
  * @param \WP_Query
1208 1208
  */
1209
-function give_remove_pages_from_search( $query ) {
1210
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1211
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1212
-		$success_page       = give_get_option( 'success_page', 0 );
1209
+function give_remove_pages_from_search($query) {
1210
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1211
+		$transaction_failed = give_get_option('failure_page', 0);
1212
+		$success_page       = give_get_option('success_page', 0);
1213 1213
 		$args               = apply_filters(
1214 1214
 			'give_remove_pages_from_search', array(
1215 1215
 			$transaction_failed,
1216 1216
 			$success_page,
1217 1217
 		), $query
1218 1218
 		);
1219
-		$query->set( 'post__not_in', $args );
1219
+		$query->set('post__not_in', $args);
1220 1220
 	}
1221 1221
 }
1222 1222
 
1223
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1223
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1224 1224
 
1225 1225
 /**
1226 1226
  * Inserts a new key/value before a key in the array.
@@ -1236,14 +1236,14 @@  discard block
 block discarded – undo
1236 1236
  *
1237 1237
  * @see   array_insert_before()
1238 1238
  */
1239
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1240
-	if ( array_key_exists( $key, $array ) ) {
1239
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1240
+	if (array_key_exists($key, $array)) {
1241 1241
 		$new = array();
1242
-		foreach ( $array as $k => $value ) {
1243
-			if ( $k === $key ) {
1244
-				$new[ $new_key ] = $new_value;
1242
+		foreach ($array as $k => $value) {
1243
+			if ($k === $key) {
1244
+				$new[$new_key] = $new_value;
1245 1245
 			}
1246
-			$new[ $k ] = $value;
1246
+			$new[$k] = $value;
1247 1247
 		}
1248 1248
 
1249 1249
 		return $new;
@@ -1266,13 +1266,13 @@  discard block
 block discarded – undo
1266 1266
  *
1267 1267
  * @see   array_insert_before()
1268 1268
  */
1269
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1270
-	if ( array_key_exists( $key, $array ) ) {
1269
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1270
+	if (array_key_exists($key, $array)) {
1271 1271
 		$new = array();
1272
-		foreach ( $array as $k => $value ) {
1273
-			$new[ $k ] = $value;
1274
-			if ( $k === $key ) {
1275
-				$new[ $new_key ] = $new_value;
1272
+		foreach ($array as $k => $value) {
1273
+			$new[$k] = $value;
1274
+			if ($k === $key) {
1275
+				$new[$new_key] = $new_value;
1276 1276
 			}
1277 1277
 		}
1278 1278
 
@@ -1299,21 +1299,21 @@  discard block
 block discarded – undo
1299 1299
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1300 1300
  *               `$list` will be preserved in the results.
1301 1301
  */
1302
-function give_list_pluck( $list, $field, $index_key = null ) {
1302
+function give_list_pluck($list, $field, $index_key = null) {
1303 1303
 
1304
-	if ( ! $index_key ) {
1304
+	if ( ! $index_key) {
1305 1305
 		/*
1306 1306
 		 * This is simple. Could at some point wrap array_column()
1307 1307
 		 * if we knew we had an array of arrays.
1308 1308
 		 */
1309
-		foreach ( $list as $key => $value ) {
1310
-			if ( is_object( $value ) ) {
1311
-				if ( isset( $value->$field ) ) {
1312
-					$list[ $key ] = $value->$field;
1309
+		foreach ($list as $key => $value) {
1310
+			if (is_object($value)) {
1311
+				if (isset($value->$field)) {
1312
+					$list[$key] = $value->$field;
1313 1313
 				}
1314 1314
 			} else {
1315
-				if ( isset( $value[ $field ] ) ) {
1316
-					$list[ $key ] = $value[ $field ];
1315
+				if (isset($value[$field])) {
1316
+					$list[$key] = $value[$field];
1317 1317
 				}
1318 1318
 			}
1319 1319
 		}
@@ -1326,18 +1326,18 @@  discard block
 block discarded – undo
1326 1326
 	 * to the end of the stack. This is how array_column() behaves.
1327 1327
 	 */
1328 1328
 	$newlist = array();
1329
-	foreach ( $list as $value ) {
1330
-		if ( is_object( $value ) ) {
1331
-			if ( isset( $value->$index_key ) ) {
1332
-				$newlist[ $value->$index_key ] = $value->$field;
1329
+	foreach ($list as $value) {
1330
+		if (is_object($value)) {
1331
+			if (isset($value->$index_key)) {
1332
+				$newlist[$value->$index_key] = $value->$field;
1333 1333
 			} else {
1334 1334
 				$newlist[] = $value->$field;
1335 1335
 			}
1336 1336
 		} else {
1337
-			if ( isset( $value[ $index_key ] ) ) {
1338
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1337
+			if (isset($value[$index_key])) {
1338
+				$newlist[$value[$index_key]] = $value[$field];
1339 1339
 			} else {
1340
-				$newlist[] = $value[ $field ];
1340
+				$newlist[] = $value[$field];
1341 1341
 			}
1342 1342
 		}
1343 1343
 	}
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
  *
1361 1361
  * @return int|false Meta ID on success, false on failure.
1362 1362
  */
1363
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1364
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1363
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1364
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1365 1365
 }
1366 1366
 
1367 1367
 /**
@@ -1379,8 +1379,8 @@  discard block
 block discarded – undo
1379 1379
  *
1380 1380
  * @return bool True on success, false on failure.
1381 1381
  */
1382
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1383
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1382
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1383
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1384 1384
 }
1385 1385
 
1386 1386
 /**
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1396 1396
  *  is true.
1397 1397
  */
1398
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1399
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1398
+function get_donor_meta($donor_id, $key = '', $single = false) {
1399
+	return get_metadata('give_customer', $donor_id, $key, $single);
1400 1400
 }
1401 1401
 
1402 1402
 /**
@@ -1413,8 +1413,8 @@  discard block
 block discarded – undo
1413 1413
  *
1414 1414
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1415 1415
  */
1416
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1417
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1416
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1417
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1418 1418
 }
1419 1419
 
1420 1420
 /*
@@ -1424,15 +1424,15 @@  discard block
 block discarded – undo
1424 1424
  *
1425 1425
  * @param int $form_id Form id of which recalculation needs to be done.
1426 1426
  */
1427
-function give_recount_form_income_donation( $form_id = false ) {
1427
+function give_recount_form_income_donation($form_id = false) {
1428 1428
 	// Check if form id is not empty.
1429
-	if ( ! empty( $form_id ) ) {
1429
+	if ( ! empty($form_id)) {
1430 1430
 		/**
1431 1431
 		 * Filter to modify payment status.
1432 1432
 		 *
1433 1433
 		 * @since 1.8.13
1434 1434
 		 */
1435
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1435
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1436 1436
 
1437 1437
 		/**
1438 1438
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 			'give_recount_form_stats_args', array(
1444 1444
 				'give_forms'     => $form_id,
1445 1445
 				'status'         => $accepted_statuses,
1446
-				'posts_per_page' => - 1,
1446
+				'posts_per_page' => -1,
1447 1447
 				'fields'         => 'ids',
1448 1448
 			)
1449 1449
 		);
@@ -1453,28 +1453,28 @@  discard block
 block discarded – undo
1453 1453
 			'earnings' => 0,
1454 1454
 		);
1455 1455
 
1456
-		$payments = new Give_Payments_Query( $args );
1456
+		$payments = new Give_Payments_Query($args);
1457 1457
 		$payments = $payments->get_payments();
1458 1458
 
1459
-		if ( $payments ) {
1460
-			foreach ( $payments as $payment ) {
1459
+		if ($payments) {
1460
+			foreach ($payments as $payment) {
1461 1461
 				// Ensure acceptible status only
1462
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1462
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1463 1463
 					continue;
1464 1464
 				}
1465 1465
 
1466 1466
 				// Ensure only payments for this form are counted
1467
-				if ( $payment->form_id != $form_id ) {
1467
+				if ($payment->form_id != $form_id) {
1468 1468
 					continue;
1469 1469
 				}
1470 1470
 
1471
-				$totals['sales'] ++;
1471
+				$totals['sales']++;
1472 1472
 				$totals['earnings'] += $payment->total;
1473 1473
 
1474 1474
 			}
1475 1475
 		}
1476
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1477
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1476
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1477
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1478 1478
 	}// End if().
1479 1479
 }
1480 1480
 
@@ -1487,18 +1487,18 @@  discard block
 block discarded – undo
1487 1487
  *
1488 1488
  * @return string
1489 1489
  */
1490
-function give_get_attribute_str( $attributes ) {
1490
+function give_get_attribute_str($attributes) {
1491 1491
 	$attribute_str = '';
1492 1492
 
1493
-	if ( empty( $attributes ) ) {
1493
+	if (empty($attributes)) {
1494 1494
 		return $attribute_str;
1495 1495
 	}
1496 1496
 
1497
-	foreach ( $attributes as $tag => $value ) {
1497
+	foreach ($attributes as $tag => $value) {
1498 1498
 		$attribute_str .= " {$tag}=\"{$value}\"";
1499 1499
 	}
1500 1500
 
1501
-	return trim( $attribute_str );
1501
+	return trim($attribute_str);
1502 1502
 }
1503 1503
 
1504 1504
 /**
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 function give_get_wp_upload_dir() {
1512 1512
 	$wp_upload_dir = wp_upload_dir();
1513 1513
 
1514
-	return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false );
1514
+	return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false);
1515 1515
 }
1516 1516
 
1517 1517
 /**
@@ -1523,15 +1523,15 @@  discard block
 block discarded – undo
1523 1523
  *
1524 1524
  * @return string/bool $file_contents File content
1525 1525
  */
1526
-function give_get_core_settings_json( $file_name ) {
1526
+function give_get_core_settings_json($file_name) {
1527 1527
 	$upload_dir = give_get_wp_upload_dir();
1528
-	$file_path  = $upload_dir . '/' . $file_name;
1528
+	$file_path  = $upload_dir.'/'.$file_name;
1529 1529
 
1530
-	if ( is_wp_error( $file_path ) || empty( $file_path ) ) {
1531
-		Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
1530
+	if (is_wp_error($file_path) || empty($file_path)) {
1531
+		Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
1532 1532
 	}
1533 1533
 
1534
-	$file_contents = file_get_contents( $file_path );
1534
+	$file_contents = file_get_contents($file_path);
1535 1535
 
1536 1536
 	return $file_contents;
1537 1537
 }
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
  * @return int $country The two letter country code for the site's base country
1545 1545
  */
1546 1546
 function give_get_limit_display_donations() {
1547
-	return give_get_option( 'limit_display_donations', 1 );
1547
+	return give_get_option('limit_display_donations', 1);
1548 1548
 }
1549 1549
 
1550 1550
 /**
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
  * @since 1.8.17
1554 1554
  */
1555 1555
 function give_donation_history_table_end() {
1556
-	$email = Give()->session->get( 'give_email' );
1556
+	$email = Give()->session->get('give_email');
1557 1557
 	?>
1558 1558
 	<tfoot>
1559 1559
 	<tr>
@@ -1562,16 +1562,16 @@  discard block
 block discarded – undo
1562 1562
 				<div class="give-security-column give-security-description-wrap">
1563 1563
 					<?php
1564 1564
 					echo sprintf(
1565
-						__( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ),
1565
+						__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'),
1566 1566
 						$email
1567 1567
 					);
1568 1568
 					?>
1569 1569
 				</div>
1570 1570
 				<div class="give-security-column give-security-button-wrap">
1571 1571
 					<a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn">
1572
-						<?php _e( 'Confirm Email', 'give' ); ?>
1572
+						<?php _e('Confirm Email', 'give'); ?>
1573 1573
 					</a>
1574
-					<span><?php _e( 'Email Sent!', 'give' ); ?></span>
1574
+					<span><?php _e('Email Sent!', 'give'); ?></span>
1575 1575
 				</div>
1576 1576
 			</div>
1577 1577
 		</td>
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 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
 
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX.
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
  * @return void
39 39
  */
40 40
 function give_load_ajax_gateway() {
41
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
+	if (isset($_POST['give_payment_mode'])) {
42 42
 		/**
43 43
 		 * Fire to render donation form.
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_donation_form', $_POST['give_form_id'] );
47
+		do_action('give_donation_form', $_POST['give_form_id']);
48 48
 
49 49
 		exit();
50 50
 	}
51 51
 }
52 52
 
53
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
54
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
53
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
54
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
55 55
 
56 56
 /**
57 57
  * Sets an error within the donation form if no gateways are enabled.
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 function give_no_gateway_error() {
64 64
 	$gateways = give_get_enabled_payment_gateways();
65 65
 
66
-	if ( empty( $gateways ) ) {
67
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
66
+	if (empty($gateways)) {
67
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
68 68
 	} else {
69
-		give_unset_error( 'no_gateways' );
69
+		give_unset_error('no_gateways');
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'init', 'give_no_gateway_error' );
73
+add_action('init', 'give_no_gateway_error');
Please login to merge, or discard this patch.
includes/emails/class-give-emails.php 1 patch
Spacing   +58 added lines, -58 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
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function __construct() {
89 89
 
90
-		if ( 'none' === $this->get_template() ) {
90
+		if ('none' === $this->get_template()) {
91 91
 			$this->html = false;
92 92
 		}
93 93
 
94
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
95
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
94
+		add_action('give_email_send_before', array($this, 'send_before'));
95
+		add_action('give_email_send_after', array($this, 'send_after'));
96 96
 
97 97
 	}
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param $key
105 105
 	 * @param $value
106 106
 	 */
107
-	public function __set( $key, $value ) {
107
+	public function __set($key, $value) {
108 108
 		$this->$key = $value;
109 109
 	}
110 110
 
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @since 1.0
115 115
 	 */
116 116
 	public function get_from_name() {
117
-		if ( ! $this->from_name ) {
118
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
117
+		if ( ! $this->from_name) {
118
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
119 119
 		}
120 120
 
121
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
121
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @since 1.0
128 128
 	 */
129 129
 	public function get_from_address() {
130
-		if ( ! $this->from_address ) {
131
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
130
+		if ( ! $this->from_address) {
131
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
132 132
 		}
133 133
 
134
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
134
+		return apply_filters('give_email_from_address', $this->from_address, $this);
135 135
 	}
136 136
 
137 137
 	/**
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 * @since 1.0
141 141
 	 */
142 142
 	public function get_content_type() {
143
-		if ( ! $this->content_type && $this->html ) {
144
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
145
-		} else if ( ! $this->html ) {
143
+		if ( ! $this->content_type && $this->html) {
144
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
145
+		} else if ( ! $this->html) {
146 146
 			$this->content_type = 'text/plain';
147 147
 		}
148 148
 
149
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
149
+		return apply_filters('give_email_content_type', $this->content_type, $this);
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @since 1.0
156 156
 	 */
157 157
 	public function get_headers() {
158
-		if ( ! $this->headers ) {
158
+		if ( ! $this->headers) {
159 159
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
160 160
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
161 161
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
162 162
 		}
163 163
 
164
-		return apply_filters( 'give_email_headers', $this->headers, $this );
164
+		return apply_filters('give_email_headers', $this->headers, $this);
165 165
 	}
166 166
 
167 167
 	/**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function get_templates() {
173 173
 		$templates = array(
174
-			'default' => esc_html__( 'Default Template', 'give' ),
175
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
174
+			'default' => esc_html__('Default Template', 'give'),
175
+			'none'    => esc_html__('No template, plain text only', 'give')
176 176
 		);
177 177
 
178
-		return apply_filters( 'give_email_templates', $templates );
178
+		return apply_filters('give_email_templates', $templates);
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 * @since 1.0
185 185
 	 */
186 186
 	public function get_template() {
187
-		if ( ! $this->template ) {
188
-			$this->template = give_get_option( 'email_template', 'default' );
187
+		if ( ! $this->template) {
188
+			$this->template = give_get_option('email_template', 'default');
189 189
 		}
190 190
 
191
-		return apply_filters( 'give_email_template', $this->template );
191
+		return apply_filters('give_email_template', $this->template);
192 192
 	}
193 193
 
194 194
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @since 1.0
198 198
 	 */
199 199
 	public function get_heading() {
200
-		return apply_filters( 'give_email_heading', $this->heading );
200
+		return apply_filters('give_email_heading', $this->heading);
201 201
 	}
202 202
 
203 203
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return mixed
209 209
 	 */
210
-	public function parse_tags( $content ) {
210
+	public function parse_tags($content) {
211 211
 		return $content;
212 212
 	}
213 213
 
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function build_email( $message ) {
223
+	public function build_email($message) {
224 224
 
225
-		if ( false === $this->html ) {
226
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
225
+		if (false === $this->html) {
226
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
227 227
 		}
228 228
 
229
-		$message = $this->text_to_html( $message );
229
+		$message = $this->text_to_html($message);
230 230
 
231 231
 		$template = $this->get_template();
232 232
 
233 233
 		ob_start();
234 234
 
235
-		give_get_template_part( 'emails/header', $template, true );
235
+		give_get_template_part('emails/header', $template, true);
236 236
 
237 237
 		/**
238 238
 		 * Fires in the email head.
@@ -241,17 +241,17 @@  discard block
 block discarded – undo
241 241
 		 *
242 242
 		 * @param Give_Emails $this The email object.
243 243
 		 */
244
-		do_action( 'give_email_header', $this );
244
+		do_action('give_email_header', $this);
245 245
 
246
-		if ( has_action( 'give_email_template_' . $template ) ) {
246
+		if (has_action('give_email_template_'.$template)) {
247 247
 			/**
248 248
 			 * Fires in a specific email template.
249 249
 			 *
250 250
 			 * @since 1.0
251 251
 			 */
252
-			do_action( "give_email_template_{$template}" );
252
+			do_action("give_email_template_{$template}");
253 253
 		} else {
254
-			give_get_template_part( 'emails/body', $template, true );
254
+			give_get_template_part('emails/body', $template, true);
255 255
 		}
256 256
 
257 257
 		/**
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 		 *
262 262
 		 * @param Give_Emails $this The email object.
263 263
 		 */
264
-		do_action( 'give_email_body', $this );
264
+		do_action('give_email_body', $this);
265 265
 
266
-		give_get_template_part( 'emails/footer', $template, true );
266
+		give_get_template_part('emails/footer', $template, true);
267 267
 
268 268
 		/**
269 269
 		 * Fires in the email footer.
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * @param Give_Emails $this The email object.
274 274
 		 */
275
-		do_action( 'give_email_footer', $this );
275
+		do_action('give_email_footer', $this);
276 276
 
277 277
 		$body    = ob_get_clean();
278
-		$message = str_replace( '{email}', $message, $body );
278
+		$message = str_replace('{email}', $message, $body);
279 279
 
280
-		return apply_filters( 'give_email_message', $message, $this );
280
+		return apply_filters('give_email_message', $message, $this);
281 281
 	}
282 282
 
283 283
 	/**
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return bool
292 292
 	 */
293
-	public function send( $to, $subject, $message, $attachments = '' ) {
293
+	public function send($to, $subject, $message, $attachments = '') {
294 294
 
295
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
296
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
295
+		if ( ! did_action('init') && ! did_action('admin_init')) {
296
+			_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
297 297
 
298 298
 			return false;
299 299
 		}
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 		 *
306 306
 		 * @param Give_Emails $this The email object.
307 307
 		 */
308
-		do_action( 'give_email_send_before', $this );
308
+		do_action('give_email_send_before', $this);
309 309
 
310
-		$subject = $this->parse_tags( $subject );
311
-		$message = $this->parse_tags( $message );
310
+		$subject = $this->parse_tags($subject);
311
+		$message = $this->parse_tags($message);
312 312
 
313
-		$message = $this->build_email( $message );
313
+		$message = $this->build_email($message);
314 314
 
315
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
315
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
316 316
 
317
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
317
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
318 318
 
319 319
 		/**
320 320
 		 * Fires after sending an email.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Emails $this The email object.
325 325
 		 */
326
-		do_action( 'give_email_send_after', $this );
326
+		do_action('give_email_send_after', $this);
327 327
 
328 328
 		return $sent;
329 329
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @since 1.0
336 336
 	 */
337 337
 	public function send_before() {
338
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
339
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
340
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
338
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
339
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
340
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
341 341
 	}
342 342
 
343 343
 	/**
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @since 1.0
347 347
 	 */
348 348
 	public function send_after() {
349
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
350
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
351
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
349
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
350
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
351
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
352 352
 
353 353
 		// Reset heading to an empty string
354 354
 		$this->heading = '';
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @since 1.0
361 361
 	 */
362
-	public function text_to_html( $message ) {
362
+	public function text_to_html($message) {
363 363
 
364
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
365
-			$message = wpautop( $message );
364
+		if ('text/html' == $this->content_type || true === $this->html) {
365
+			$message = wpautop($message);
366 366
 		}
367 367
 
368 368
 		return $message;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 								'disabled' => __( 'Disabled', 'give' ),
87 87
 							)
88 88
 						),
89
-                        array(
90
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
-                            'id'    => 'paypal_standard_gateway_settings_docs_link',
92
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
-                            'type'  => 'give_docs_link',
95
-                        ),
89
+						array(
90
+							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
+							'id'    => 'paypal_standard_gateway_settings_docs_link',
92
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
+							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
+							'type'  => 'give_docs_link',
95
+						),
96 96
 						array(
97 97
 							'type' => 'sectionend',
98 98
 							'id'   => 'give_title_gateway_settings_2',
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 								'textarea_rows' => 6,
146 146
 							)
147 147
 						),
148
-                        array(
149
-                            'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
150
-                            'id'    => 'offline_gateway_settings_docs_link',
151
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
153
-                            'type'  => 'give_docs_link',
154
-                        ),
148
+						array(
149
+							'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
150
+							'id'    => 'offline_gateway_settings_docs_link',
151
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
+							'title' => __( 'Offline Gateway Settings', 'give' ),
153
+							'type'  => 'give_docs_link',
154
+						),
155 155
 						array(
156 156
 							'type' => 'sectionend',
157 157
 							'id'   => 'give_title_gateway_settings_3',
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 							'id'   => 'default_gateway',
190 190
 							'type' => 'default_gateway'
191 191
 						),
192
-                        array(
193
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
194
-                            'id'    => 'gateway_settings_docs_link',
195
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
-                            'title' => __( 'Gateway Settings', 'give' ),
197
-                            'type'  => 'give_docs_link',
198
-                        ),
192
+						array(
193
+							'name'  => __( 'Gateways Docs Link', 'give' ),
194
+							'id'    => 'gateway_settings_docs_link',
195
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
+							'title' => __( 'Gateway Settings', 'give' ),
197
+							'type'  => 'give_docs_link',
198
+						),
199 199
 						array(
200 200
 							'id'   => 'give_title_gateway_settings_1',
201 201
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'paypal-standard':
49 49
 					$settings = array(
50 50
 						// Section 2: PayPal Standard.
@@ -53,55 +53,55 @@  discard block
 block discarded – undo
53 53
 							'id'   => 'give_title_gateway_settings_2',
54 54
 						),
55 55
 						array(
56
-							'name' => __( 'PayPal Email', 'give' ),
57
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
56
+							'name' => __('PayPal Email', 'give'),
57
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
58 58
 							'id'   => 'paypal_email',
59 59
 							'type' => 'email',
60 60
 						),
61 61
 						array(
62
-							'name' => __( 'PayPal Page Style', 'give' ),
63
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
62
+							'name' => __('PayPal Page Style', 'give'),
63
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
64 64
 							'id'   => 'paypal_page_style',
65 65
 							'type' => 'text',
66 66
 						),
67 67
 						array(
68
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
69
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
68
+							'name'    => __('PayPal Transaction Type', 'give'),
69
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
70 70
 							'id'      => 'paypal_button_type',
71 71
 							'type'    => 'radio_inline',
72 72
 							'options' => array(
73
-								'donation' => __( 'Donation', 'give' ),
74
-								'standard' => __( 'Standard Transaction', 'give' )
73
+								'donation' => __('Donation', 'give'),
74
+								'standard' => __('Standard Transaction', 'give')
75 75
 							),
76 76
 							'default' => 'donation',
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Billing Details', 'give' ),
80
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
79
+							'name'    => __('Billing Details', 'give'),
80
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
81 81
 							'id'      => 'paypal_standard_billing_details',
82 82
 							'type'    => 'radio_inline',
83 83
 							'default' => 'disabled',
84 84
 							'options' => array(
85
-								'enabled'  => __( 'Enabled', 'give' ),
86
-								'disabled' => __( 'Disabled', 'give' ),
85
+								'enabled'  => __('Enabled', 'give'),
86
+								'disabled' => __('Disabled', 'give'),
87 87
 							)
88 88
 						),
89 89
 						array(
90
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
91
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
90
+							'name'    => __('PayPal IPN Verification', 'give'),
91
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
92 92
 							'id'      => 'paypal_verification',
93 93
 							'type'    => 'radio_inline',
94 94
 							'default' => 'enabled',
95 95
 							'options' => array(
96
-								'enabled'  => __( 'Enabled', 'give' ),
97
-								'disabled' => __( 'Disabled', 'give' ),
96
+								'enabled'  => __('Enabled', 'give'),
97
+								'disabled' => __('Disabled', 'give'),
98 98
 							)
99 99
 						),
100 100
                         array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
101
+                            'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
102 102
                             'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
103
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
104
+                            'title' => __('PayPal Standard Gateway Settings', 'give'),
105 105
                             'type'  => 'give_docs_link',
106 106
                         ),
107 107
 						array(
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 							'id'   => 'give_title_gateway_settings_3',
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Collect Billing Details', 'give' ),
123
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
122
+							'name'    => __('Collect Billing Details', 'give'),
123
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
124 124
 							'id'      => 'give_offline_donation_enable_billing_fields',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'disabled',
127 127
 							'options' => array(
128
-								'enabled'  => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' )
128
+								'enabled'  => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give')
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
134
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
133
+							'name'    => __('Offline Donation Instructions', 'give'),
134
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
135 135
 							'id'      => 'global_offline_donation_content',
136 136
 							'default' => give_get_default_offline_donation_content(),
137 137
 							'type'    => 'wysiwyg',
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 							)
141 141
 						),
142 142
 						array(
143
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
144
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
143
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
144
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
145 145
 							'id'      => 'offline_donation_subject',
146
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
146
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
147 147
 							'type'    => 'text'
148 148
 						),
149 149
 						array(
150
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
151
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(),
150
+							'name'    => __('Offline Donation Email Instructions', 'give'),
151
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(),
152 152
 							'id'      => 'global_offline_donation_email',
153 153
 							'default' => give_get_default_offline_donation_email_content(),
154 154
 							'type'    => 'wysiwyg',
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 							)
158 158
 						),
159 159
                         array(
160
-                            'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
160
+                            'name'  => __('Offline Donations Settings Docs Link', 'give'),
161 161
                             'id'    => 'offline_gateway_settings_docs_link',
162
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
163
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
162
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'),
163
+                            'title' => __('Offline Gateway Settings', 'give'),
164 164
                             'type'  => 'give_docs_link',
165 165
                         ),
166 166
 						array(
@@ -178,33 +178,33 @@  discard block
 block discarded – undo
178 178
 							'type' => 'title'
179 179
 						),
180 180
 						array(
181
-							'name'    => __( 'Test Mode', 'give' ),
182
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
181
+							'name'    => __('Test Mode', 'give'),
182
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
183 183
 							'id'      => 'test_mode',
184 184
 							'type'    => 'radio_inline',
185 185
 							'default' => 'disabled',
186 186
 							'options' => array(
187
-								'enabled'  => __( 'Enabled', 'give' ),
188
-								'disabled' => __( 'Disabled', 'give' ),
187
+								'enabled'  => __('Enabled', 'give'),
188
+								'disabled' => __('Disabled', 'give'),
189 189
 							)
190 190
 						),
191 191
 						array(
192
-							'name' => __( 'Enabled Gateways', 'give' ),
193
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
192
+							'name' => __('Enabled Gateways', 'give'),
193
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
194 194
 							'id'   => 'gateways',
195 195
 							'type' => 'enabled_gateways'
196 196
 						),
197 197
 						array(
198
-							'name' => __( 'Default Gateway', 'give' ),
199
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
198
+							'name' => __('Default Gateway', 'give'),
199
+							'desc' => __('The gateway that will be selected by default.', 'give'),
200 200
 							'id'   => 'default_gateway',
201 201
 							'type' => 'default_gateway'
202 202
 						),
203 203
                         array(
204
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
204
+                            'name'  => __('Gateways Docs Link', 'give'),
205 205
                             'id'    => 'gateway_settings_docs_link',
206
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
207
-                            'title' => __( 'Gateway Settings', 'give' ),
206
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
207
+                            'title' => __('Gateway Settings', 'give'),
208 208
                             'type'  => 'give_docs_link',
209 209
                         ),
210 210
 						array(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			 * Filter the payment gateways settings.
220 220
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
221 221
 			 */
222
-			$settings = apply_filters( 'give_settings_gateways', $settings );
222
+			$settings = apply_filters('give_settings_gateways', $settings);
223 223
 
224 224
 			/**
225 225
 			 * Filter the settings.
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			 *
229 229
 			 * @param  array $settings
230 230
 			 */
231
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
231
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
232 232
 
233 233
 			// Output.
234 234
 			return $settings;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 		 */
243 243
 		public function get_sections() {
244 244
 			$sections = array(
245
-				'gateways-settings' => __( 'Gateways', 'give' ),
246
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
247
-				'offline-donations' => __( 'Offline Donations', 'give' )
245
+				'gateways-settings' => __('Gateways', 'give'),
246
+				'paypal-standard'   => __('PayPal Standard', 'give'),
247
+				'offline-donations' => __('Offline Donations', 'give')
248 248
 			);
249 249
 
250
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
250
+			return apply_filters('give_get_sections_'.$this->id, $sections);
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	 * @uses api_request()
78 78
 	 *
79 79
 	 * @param array   $_transient_data Update array build by WordPress.
80
-	 * @return array Modified update array with custom plugin data.
80
+	 * @return stdClass Modified update array with custom plugin data.
81 81
 	 */
82 82
 	public function check_update( $_transient_data ) {
83 83
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) exit;
4
+if ( ! defined( 'ABSPATH' ) ) {
5
+	exit;
6
+}
5 7
 
6 8
 /**
7 9
  * Allows plugins to use their own update API.
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) exit;
4
+if ( ! defined('ABSPATH')) exit;
5 5
 
6 6
 /**
7 7
  * Allows plugins to use their own update API.
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	 * @param string  $_plugin_file Path to the plugin file.
30 30
 	 * @param array   $_api_data    Optional data to send with API calls.
31 31
 	 */
32
-	public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
32
+	public function __construct($_api_url, $_plugin_file, $_api_data = null) {
33 33
 
34 34
 		global $edd_plugin_data;
35 35
 
36
-		$this->api_url     = trailingslashit( $_api_url );
36
+		$this->api_url     = trailingslashit($_api_url);
37 37
 		$this->api_data    = $_api_data;
38
-		$this->name        = plugin_basename( $_plugin_file );
39
-		$this->slug        = basename( $_plugin_file, '.php' );
38
+		$this->name        = plugin_basename($_plugin_file);
39
+		$this->slug        = basename($_plugin_file, '.php');
40 40
 		$this->version     = $_api_data['version'];
41
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
42
-		$this->beta        = ! empty( $this->api_data['beta'] ) ? true : false;
43
-		$this->cache_key   = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
41
+		$this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false;
42
+		$this->beta        = ! empty($this->api_data['beta']) ? true : false;
43
+		$this->cache_key   = md5(serialize($this->slug.$this->api_data['license'].$this->beta));
44 44
 
45
-		$edd_plugin_data[ $this->slug ] = $this->api_data;
45
+		$edd_plugin_data[$this->slug] = $this->api_data;
46 46
 
47 47
 		// Set up hooks.
48 48
 		$this->init();
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function init() {
60 60
 
61
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
62
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
63
-		remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
64
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
65
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
61
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
62
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
63
+		remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10);
64
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
65
+		add_action('admin_init', array($this, 'show_changelog'));
66 66
 
67 67
 	}
68 68
 
@@ -79,41 +79,41 @@  discard block
 block discarded – undo
79 79
 	 * @param array   $_transient_data Update array build by WordPress.
80 80
 	 * @return array Modified update array with custom plugin data.
81 81
 	 */
82
-	public function check_update( $_transient_data ) {
82
+	public function check_update($_transient_data) {
83 83
 
84 84
 		global $pagenow;
85 85
 
86
-		if ( ! is_object( $_transient_data ) ) {
86
+		if ( ! is_object($_transient_data)) {
87 87
 			$_transient_data = new stdClass;
88 88
 		}
89 89
 
90
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
90
+		if ('plugins.php' == $pagenow && is_multisite()) {
91 91
 			return $_transient_data;
92 92
 		}
93 93
 
94
-		if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
94
+		if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
95 95
 			return $_transient_data;
96 96
 		}
97 97
 
98 98
 		$version_info = $this->get_cached_version_info();
99 99
 
100
-		if ( false === $version_info ) {
101
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
100
+		if (false === $version_info) {
101
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
102 102
 
103
-			$this->set_version_info_cache( $version_info );
103
+			$this->set_version_info_cache($version_info);
104 104
 
105 105
 		}
106 106
 
107
-		if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
107
+		if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
108 108
 
109
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
109
+			if (version_compare($this->version, $version_info->new_version, '<')) {
110 110
 
111
-				$_transient_data->response[ $this->name ] = $version_info;
111
+				$_transient_data->response[$this->name] = $version_info;
112 112
 
113 113
 			}
114 114
 
115
-			$_transient_data->last_checked           = current_time( 'timestamp' );
116
-			$_transient_data->checked[ $this->name ] = $this->version;
115
+			$_transient_data->last_checked           = current_time('timestamp');
116
+			$_transient_data->checked[$this->name] = $this->version;
117 117
 
118 118
 		}
119 119
 
@@ -126,97 +126,97 @@  discard block
 block discarded – undo
126 126
 	 * @param string  $file
127 127
 	 * @param array   $plugin
128 128
 	 */
129
-	public function show_update_notification( $file, $plugin ) {
129
+	public function show_update_notification($file, $plugin) {
130 130
 
131
-		if ( is_network_admin() ) {
131
+		if (is_network_admin()) {
132 132
 			return;
133 133
 		}
134 134
 
135
-		if( ! current_user_can( 'update_plugins' ) ) {
135
+		if ( ! current_user_can('update_plugins')) {
136 136
 			return;
137 137
 		}
138 138
 
139
-		if( ! is_multisite() ) {
139
+		if ( ! is_multisite()) {
140 140
 			return;
141 141
 		}
142 142
 
143
-		if ( $this->name != $file ) {
143
+		if ($this->name != $file) {
144 144
 			return;
145 145
 		}
146 146
 
147 147
 		// Remove our filter on the site transient
148
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
148
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
149 149
 
150
-		$update_cache = get_site_transient( 'update_plugins' );
150
+		$update_cache = get_site_transient('update_plugins');
151 151
 
152
-		$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
152
+		$update_cache = is_object($update_cache) ? $update_cache : new stdClass();
153 153
 
154
-		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
154
+		if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
155 155
 
156 156
 			$version_info = $this->get_cached_version_info();
157 157
 
158
-			if ( false === $version_info ) {
159
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
158
+			if (false === $version_info) {
159
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
160 160
 
161
-				$this->set_version_info_cache( $version_info );
161
+				$this->set_version_info_cache($version_info);
162 162
 			}
163 163
 
164
-			if ( ! is_object( $version_info ) ) {
164
+			if ( ! is_object($version_info)) {
165 165
 				return;
166 166
 			}
167 167
 
168
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
168
+			if (version_compare($this->version, $version_info->new_version, '<')) {
169 169
 
170
-				$update_cache->response[ $this->name ] = $version_info;
170
+				$update_cache->response[$this->name] = $version_info;
171 171
 
172 172
 			}
173 173
 
174
-			$update_cache->last_checked = current_time( 'timestamp' );
175
-			$update_cache->checked[ $this->name ] = $this->version;
174
+			$update_cache->last_checked = current_time('timestamp');
175
+			$update_cache->checked[$this->name] = $this->version;
176 176
 
177
-			set_site_transient( 'update_plugins', $update_cache );
177
+			set_site_transient('update_plugins', $update_cache);
178 178
 
179 179
 		} else {
180 180
 
181
-			$version_info = $update_cache->response[ $this->name ];
181
+			$version_info = $update_cache->response[$this->name];
182 182
 
183 183
 		}
184 184
 
185 185
 		// Restore our filter
186
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
186
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
187 187
 
188
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
188
+		if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
189 189
 
190 190
 			// build a plugin list row, with update notification
191
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
191
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
192 192
 			# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
193
-			echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
193
+			echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">';
194 194
 			echo '<td colspan="3" class="plugin-update colspanchange">';
195 195
 			echo '<div class="update-message notice inline notice-warning notice-alt">';
196 196
 
197
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
197
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
198 198
 
199
-			if ( empty( $version_info->download_link ) ) {
199
+			if (empty($version_info->download_link)) {
200 200
 				printf(
201
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ),
202
-					esc_html( $version_info->name ),
203
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
204
-					esc_html( $version_info->new_version ),
201
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'),
202
+					esc_html($version_info->name),
203
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
204
+					esc_html($version_info->new_version),
205 205
 					'</a>'
206 206
 				);
207 207
 			} else {
208 208
 				printf(
209
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ),
210
-					esc_html( $version_info->name ),
211
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
212
-					esc_html( $version_info->new_version ),
209
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'),
210
+					esc_html($version_info->name),
211
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
212
+					esc_html($version_info->new_version),
213 213
 					'</a>',
214
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
214
+					'<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">',
215 215
 					'</a>'
216 216
 				);
217 217
 			}
218 218
 
219
-			do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
219
+			do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
220 220
 
221 221
 			echo '</div></td></tr>';
222 222
 		}
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
 	 * @param object  $_args
233 233
 	 * @return object $_data
234 234
 	 */
235
-	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
235
+	public function plugins_api_filter($_data, $_action = '', $_args = null) {
236 236
 
237
-		if ( $_action != 'plugin_information' ) {
237
+		if ($_action != 'plugin_information') {
238 238
 
239 239
 			return $_data;
240 240
 
241 241
 		}
242 242
 
243
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
243
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
244 244
 
245 245
 			return $_data;
246 246
 
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
 			)
256 256
 		);
257 257
 
258
-		$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
258
+		$cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta));
259 259
 
260 260
 		// Get the transient where we store the api request for this plugin for 24 hours
261
-		$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
261
+		$edd_api_request_transient = $this->get_cached_version_info($cache_key);
262 262
 
263 263
 		//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
264
-		if ( empty( $edd_api_request_transient ) ) {
264
+		if (empty($edd_api_request_transient)) {
265 265
 
266
-			$api_response = $this->api_request( 'plugin_information', $to_send );
266
+			$api_response = $this->api_request('plugin_information', $to_send);
267 267
 
268 268
 			// Expires in 3 hours
269
-			$this->set_version_info_cache( $api_response, $cache_key );
269
+			$this->set_version_info_cache($api_response, $cache_key);
270 270
 
271
-			if ( false !== $api_response ) {
271
+			if (false !== $api_response) {
272 272
 				$_data = $api_response;
273 273
 			}
274 274
 
@@ -277,20 +277,20 @@  discard block
 block discarded – undo
277 277
 		}
278 278
 
279 279
 		// Convert sections into an associative array, since we're getting an object, but Core expects an array.
280
-		if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
280
+		if (isset($_data->sections) && ! is_array($_data->sections)) {
281 281
 			$new_sections = array();
282
-			foreach ( $_data->sections as $key => $value ) {
283
-				$new_sections[ $key ] = $value;
282
+			foreach ($_data->sections as $key => $value) {
283
+				$new_sections[$key] = $value;
284 284
 			}
285 285
 
286 286
 			$_data->sections = $new_sections;
287 287
 		}
288 288
 
289 289
 		// Convert banners into an associative array, since we're getting an object, but Core expects an array.
290
-		if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
290
+		if (isset($_data->banners) && ! is_array($_data->banners)) {
291 291
 			$new_banners = array();
292
-			foreach ( $_data->banners as $key => $value ) {
293
-				$new_banners[ $key ] = $value;
292
+			foreach ($_data->banners as $key => $value) {
293
+				$new_banners[$key] = $value;
294 294
 			}
295 295
 
296 296
 			$_data->banners = $new_banners;
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 	 * @param string  $url
307 307
 	 * @return object $array
308 308
 	 */
309
-	public function http_request_args( $args, $url ) {
309
+	public function http_request_args($args, $url) {
310 310
 		// If it is an https request and we are performing a package download, disable ssl verification
311
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
311
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
312 312
 			$args['sslverify'] = false;
313 313
 		}
314 314
 		return $args;
@@ -325,50 +325,50 @@  discard block
 block discarded – undo
325 325
 	 * @param array   $_data   Parameters for the API action.
326 326
 	 * @return false|object
327 327
 	 */
328
-	private function api_request( $_action, $_data ) {
328
+	private function api_request($_action, $_data) {
329 329
 
330 330
 		global $wp_version;
331 331
 
332
-		$data = array_merge( $this->api_data, $_data );
332
+		$data = array_merge($this->api_data, $_data);
333 333
 
334
-		if ( $data['slug'] != $this->slug ) {
334
+		if ($data['slug'] != $this->slug) {
335 335
 			return;
336 336
 		}
337 337
 
338
-		if( $this->api_url == trailingslashit (home_url() ) ) {
338
+		if ($this->api_url == trailingslashit(home_url())) {
339 339
 			return false; // Don't allow a plugin to ping itself
340 340
 		}
341 341
 
342 342
 		$api_params = array(
343 343
 			'edd_action' => 'get_version',
344
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
345
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
346
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
347
-			'version'    => isset( $data['version'] ) ? $data['version'] : false,
344
+			'license'    => ! empty($data['license']) ? $data['license'] : '',
345
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
346
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
347
+			'version'    => isset($data['version']) ? $data['version'] : false,
348 348
 			'slug'       => $data['slug'],
349 349
 			'author'     => $data['author'],
350 350
 			'url'        => home_url(),
351
-			'beta'       => ! empty( $data['beta'] ),
351
+			'beta'       => ! empty($data['beta']),
352 352
 		);
353 353
 
354
-		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
354
+		$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
355 355
 
356
-		if ( ! is_wp_error( $request ) ) {
357
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
356
+		if ( ! is_wp_error($request)) {
357
+			$request = json_decode(wp_remote_retrieve_body($request));
358 358
 		}
359 359
 
360
-		if ( $request && isset( $request->sections ) ) {
361
-			$request->sections = maybe_unserialize( $request->sections );
360
+		if ($request && isset($request->sections)) {
361
+			$request->sections = maybe_unserialize($request->sections);
362 362
 		} else {
363 363
 			$request = false;
364 364
 		}
365 365
 
366
-		if ( $request && isset( $request->banners ) ) {
367
-			$request->banners = maybe_unserialize( $request->banners );
366
+		if ($request && isset($request->banners)) {
367
+			$request->banners = maybe_unserialize($request->banners);
368 368
 		}
369 369
 
370
-		if( ! empty( $request->sections ) ) {
371
-			foreach( $request->sections as $key => $section ) {
370
+		if ( ! empty($request->sections)) {
371
+			foreach ($request->sections as $key => $section) {
372 372
 				$request->$key = (array) $section;
373 373
 			}
374 374
 		}
@@ -380,97 +380,97 @@  discard block
 block discarded – undo
380 380
 
381 381
 		global $edd_plugin_data;
382 382
 
383
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
383
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
384 384
 			return;
385 385
 		}
386 386
 
387
-		if( empty( $_REQUEST['plugin'] ) ) {
387
+		if (empty($_REQUEST['plugin'])) {
388 388
 			return;
389 389
 		}
390 390
 
391
-		if( empty( $_REQUEST['slug'] ) ) {
391
+		if (empty($_REQUEST['slug'])) {
392 392
 			return;
393 393
 		}
394 394
 
395
-		if( ! current_user_can( 'update_plugins' ) ) {
396
-			wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
395
+		if ( ! current_user_can('update_plugins')) {
396
+			wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403));
397 397
 		}
398 398
 
399
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
400
-		$beta         = ! empty( $data['beta'] ) ? true : false;
401
-		$cache_key    = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
402
-		$version_info = $this->get_cached_version_info( $cache_key );
399
+		$data         = $edd_plugin_data[$_REQUEST['slug']];
400
+		$beta         = ! empty($data['beta']) ? true : false;
401
+		$cache_key    = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info');
402
+		$version_info = $this->get_cached_version_info($cache_key);
403 403
 
404
-		if( false === $version_info ) {
404
+		if (false === $version_info) {
405 405
 
406 406
 			$api_params = array(
407 407
 				'edd_action' => 'get_version',
408
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
409
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
408
+				'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
409
+				'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
410 410
 				'slug'       => $_REQUEST['slug'],
411 411
 				'author'     => $data['author'],
412 412
 				'url'        => home_url(),
413
-				'beta'       => ! empty( $data['beta'] )
413
+				'beta'       => ! empty($data['beta'])
414 414
 			);
415 415
 
416
-			$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
416
+			$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
417 417
 
418
-			if ( ! is_wp_error( $request ) ) {
419
-				$version_info = json_decode( wp_remote_retrieve_body( $request ) );
418
+			if ( ! is_wp_error($request)) {
419
+				$version_info = json_decode(wp_remote_retrieve_body($request));
420 420
 			}
421 421
 
422 422
 
423
-			if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
424
-				$version_info->sections = maybe_unserialize( $version_info->sections );
423
+			if ( ! empty($version_info) && isset($version_info->sections)) {
424
+				$version_info->sections = maybe_unserialize($version_info->sections);
425 425
 			} else {
426 426
 				$version_info = false;
427 427
 			}
428 428
 
429
-			if( ! empty( $version_info ) ) {
430
-				foreach( $version_info->sections as $key => $section ) {
429
+			if ( ! empty($version_info)) {
430
+				foreach ($version_info->sections as $key => $section) {
431 431
 					$version_info->$key = (array) $section;
432 432
 				}
433 433
 			}
434 434
 
435
-			$this->set_version_info_cache( $version_info, $cache_key );
435
+			$this->set_version_info_cache($version_info, $cache_key);
436 436
 
437 437
 		}
438 438
 
439
-		if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
440
-			echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
439
+		if ( ! empty($version_info) && isset($version_info->sections['changelog'])) {
440
+			echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>';
441 441
 		}
442 442
 
443 443
 		exit;
444 444
 	}
445 445
 
446
-	public function get_cached_version_info( $cache_key = '' ) {
446
+	public function get_cached_version_info($cache_key = '') {
447 447
 
448
-		if( empty( $cache_key ) ) {
448
+		if (empty($cache_key)) {
449 449
 			$cache_key = $this->cache_key;
450 450
 		}
451 451
 
452
-		$cache = get_option( $cache_key );
452
+		$cache = get_option($cache_key);
453 453
 
454
-		if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
454
+		if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) {
455 455
 			return false; // Cache is expired
456 456
 		}
457 457
 
458
-		return json_decode( $cache['value'] );
458
+		return json_decode($cache['value']);
459 459
 
460 460
 	}
461 461
 
462
-	public function set_version_info_cache( $value = '', $cache_key = '' ) {
462
+	public function set_version_info_cache($value = '', $cache_key = '') {
463 463
 
464
-		if( empty( $cache_key ) ) {
464
+		if (empty($cache_key)) {
465 465
 			$cache_key = $this->cache_key;
466 466
 		}
467 467
 
468 468
 		$data = array(
469
-			'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
470
-			'value'   => json_encode( $value )
469
+			'timeout' => strtotime('+3 hours', current_time('timestamp')),
470
+			'value'   => json_encode($value)
471 471
 		);
472 472
 
473
-		update_option( $cache_key, $data );
473
+		update_option($cache_key, $data);
474 474
 
475 475
 	}
476 476
 
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +65 added lines, -65 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @since 1.0
21 21
  */
22
-class Give_Forms_Widget extends WP_Widget{
22
+class Give_Forms_Widget extends WP_Widget {
23 23
 	/**
24 24
 	 * The widget class name
25 25
 	 *
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * Instantiate the class
32 32
 	 */
33
-	public function __construct(){
34
-		$this->self = get_class( $this );
33
+	public function __construct() {
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			esc_html__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			esc_html__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook ){
55
+	public function admin_widget_scripts($hook) {
56 56
 		// Directories of assets
57
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
58
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
59
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
57
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
58
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
59
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
60 60
 
61 61
 		// Use minified libraries if SCRIPT_DEBUG is turned off
62
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
62
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
63 63
 
64 64
 		// Widget Script
65
-		if ( $hook == 'widgets.php' ) {
65
+		if ($hook == 'widgets.php') {
66 66
 
67
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
67
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
68 68
 
69
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
69
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
70 70
 
71
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
71
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
72 72
 		}
73 73
 	}
74 74
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 *                        before_widget, and after_widget.
80 80
 	 * @param array $instance The settings for the particular instance of the widget.
81 81
 	 */
82
-	public function widget( $args, $instance ){
83
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
84
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
82
+	public function widget($args, $instance) {
83
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
84
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
85 85
 
86 86
 		echo $args['before_widget'];
87 87
 
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 		 *
91 91
 		 * @since 1.0
92 92
 		 */
93
-		do_action( 'give_before_forms_widget' );
93
+		do_action('give_before_forms_widget');
94 94
 
95
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
95
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
96 96
 
97
-		give_get_donation_form( $instance );
97
+		give_get_donation_form($instance);
98 98
 
99 99
 		echo $args['after_widget'];
100 100
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 1.0
105 105
 		 */
106
-		do_action( 'give_after_forms_widget' );
106
+		do_action('give_after_forms_widget');
107 107
 	}
108 108
 
109 109
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string
115 115
 	 */
116
-	public function form( $instance ){
116
+	public function form($instance) {
117 117
 		$defaults = array(
118 118
 			'title'         => '',
119 119
 			'id'            => '',
@@ -123,84 +123,84 @@  discard block
 block discarded – undo
123 123
 			'continue_button_title' => '',
124 124
 		);
125 125
 
126
-		$instance = wp_parse_args( (array) $instance, $defaults );
126
+		$instance = wp_parse_args((array) $instance, $defaults);
127 127
 
128 128
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
129
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
129
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
130 130
 
131 131
 		// Query Give Forms
132 132
 		$args = array(
133 133
 			'post_type'      => 'give_forms',
134
-			'posts_per_page' => - 1,
134
+			'posts_per_page' => -1,
135 135
 			'post_status'    => 'publish',
136 136
 		);
137 137
 
138
-		$give_forms = get_posts( $args );
138
+		$give_forms = get_posts($args);
139 139
 		?>
140 140
 		<div class="give_forms_widget_container">
141 141
 
142 142
 			<?php // Widget: widget Title. ?>
143 143
 			<p>
144
-				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
145
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br>
146
-				<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
144
+				<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
145
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br>
146
+				<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
147 147
 			</p>
148 148
 
149 149
 			<?php // Widget: Give Form?>
150 150
 			<p>
151
-				<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
152
-				<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
153
-					<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
154
-					<?php foreach ( $give_forms as $give_form ) { ?>
155
-						<?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?>
156
-						<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option>
151
+				<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
152
+				<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
153
+					<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
154
+					<?php foreach ($give_forms as $give_form) { ?>
155
+						<?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?>
156
+						<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option>
157 157
 					<?php } ?>
158 158
 				</select><br>
159
-				<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
159
+				<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
160 160
 			</p>
161 161
 
162 162
 			<?php // Widget: Display Style ?>
163 163
 			<p class="give_forms_display_style_setting_row">
164
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br>
165
-				<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
166
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
167
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label>
168
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br>
164
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br>
165
+				<label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
166
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
167
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label>
168
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br>
169 169
 				<small class="give-field-description">
170
-					<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
170
+					<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
171 171
 				</small>
172 172
 			</p>
173 173
 
174 174
 			<?php // Widget: Continue Button Title. ?>
175 175
 			<p class="give_forms_continue_button_title_setting_row">
176
-				<label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label>
177
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br>
178
-				<small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small>
176
+				<label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label>
177
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br>
178
+				<small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small>
179 179
 			</p>
180 180
 
181 181
 			<?php // Widget: Floating Labels ?>
182 182
 			<p>
183
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
184
-				<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
185
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
186
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
183
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
184
+				<label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
185
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
186
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
187 187
 				<small class="give-field-description">
188 188
 					<?php
189 189
 					printf(
190 190
 					/* translators: %s: http://docs.givewp.com/form-floating-labels */
191
-						__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
192
-						esc_url( 'http://docs.givewp.com/form-floating-labels' )
191
+						__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
192
+						esc_url('http://docs.givewp.com/form-floating-labels')
193 193
 					);
194 194
 					?></small>
195 195
 			</p>
196 196
 
197 197
 			<?php // Widget: Display Content ?>
198 198
 			<p>
199
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br>
200
-				<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label>
201
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label>
202
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br>
203
-				<small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small>
199
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br>
200
+				<label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label>
201
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label>
202
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br>
203
+				<small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small>
204 204
 		</div>
205 205
 		<?php
206 206
 	}
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 *
211 211
 	 * @return void
212 212
 	 */
213
-	function widget_init(){
214
-		register_widget( $this->self );
213
+	function widget_init() {
214
+		register_widget($this->self);
215 215
 	}
216 216
 
217 217
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return array
224 224
 	 */
225
-	public function update( $new_instance, $old_instance ){
225
+	public function update($new_instance, $old_instance) {
226 226
 		$this->flush_widget_cache();
227 227
 
228 228
 		return $new_instance;
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return void
235 235
 	 */
236
-	public function flush_widget_cache(){
237
-		wp_cache_delete( $this->self, 'widget' );
236
+	public function flush_widget_cache() {
237
+		wp_cache_delete($this->self, 'widget');
238 238
 	}
239 239
 }
240 240
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +32 added lines, -32 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__( 'Donation Form', 'give' );
28
-		$this->shortcode['label'] = esc_html__( 'Donation Form', 'give' );
27
+		$this->shortcode['title'] = esc_html__('Donation Form', 'give');
28
+		$this->shortcode['label'] = esc_html__('Donation Form', 'give');
29 29
 
30
-		parent::__construct( 'give_form' );
30
+		parent::__construct('give_form');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$create_form_link = sprintf(
41 41
 		/* translators: %s: create new form URL */
42
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43
-			admin_url( 'post-new.php?post_type=give_forms' )
42
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
43
+			admin_url('post-new.php?post_type=give_forms')
44 44
 		);
45 45
 
46 46
 		return array(
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
 					'post_type' => 'give_forms',
51 51
 				),
52 52
 				'name'        => 'id',
53
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
54
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
53
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
54
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
55 55
 				'required'    => array(
56
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
56
+					'alert' => esc_html__('You must first select a Form!', 'give'),
57
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
58 58
 				),
59 59
 			),
60 60
 			array(
61 61
 				'type' => 'container',
62
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
62
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_title',
67
-				'label'   => esc_attr__( 'Show Title', 'give' ),
68
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
67
+				'label'   => esc_attr__('Show Title', 'give'),
68
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_goal',
77
-				'label'   => esc_attr__( 'Show Goal', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
77
+				'label'   => esc_attr__('Show Goal', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'     => 'listbox',
86 86
 				'name'     => 'show_content',
87 87
 				'minWidth' => 240,
88
-				'label'    => esc_attr__( 'Display Content', 'give' ),
89
-				'tooltip'  => esc_attr__( 'Do you want to display the form content?', 'give' ),
88
+				'label'    => esc_attr__('Display Content', 'give'),
89
+				'tooltip'  => esc_attr__('Do you want to display the form content?', 'give'),
90 90
 				'options'  => array(
91
-					'none'  => esc_html__( 'No Content', 'give' ),
92
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
93
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
91
+					'none'  => esc_html__('No Content', 'give'),
92
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
93
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
94 94
 				),
95 95
 			),
96 96
 			array(
97 97
 				'type'    => 'listbox',
98 98
 				'name'    => 'display_style',
99 99
 				'classes' => 'give-display-style',
100
-				'label'   => esc_attr__( 'Display Options', 'give' ),
101
-				'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
100
+				'label'   => esc_attr__('Display Options', 'give'),
101
+				'tooltip' => esc_attr__('How would you like to display donation information?', 'give'),
102 102
 				'options' => array(
103
-					'onpage' => esc_html__( 'All Fields', 'give' ),
104
-					'modal'  => esc_html__( 'Modal', 'give' ),
105
-					'reveal' => esc_html__( 'Reveal', 'give' ),
106
-					'button' => esc_html__( 'Button', 'give' ),
103
+					'onpage' => esc_html__('All Fields', 'give'),
104
+					'modal'  => esc_html__('Modal', 'give'),
105
+					'reveal' => esc_html__('Reveal', 'give'),
106
+					'button' => esc_html__('Button', 'give'),
107 107
 				),
108 108
 			),
109 109
 			array(
110 110
 				'type'    => 'textbox',
111 111
 				'classes' => 'give-hidden give-continue-button-title',
112 112
 				'name'    => 'continue_button_title',
113
-				'label'   => esc_attr__( 'Button Text', 'give' ),
114
-				'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ),
113
+				'label'   => esc_attr__('Button Text', 'give'),
114
+				'tooltip' => esc_attr__('The button label for displaying the additional payment fields.', 'give'),
115 115
 			),
116 116
 		);
117 117
 	}
Please login to merge, or discard this patch.
includes/class-give-cache.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@
 block discarded – undo
205 205
 	 *
206 206
 	 * @param bool $force If set to true then all cached values will be delete instead of only expired
207 207
 	 *
208
-	 * @return bool
208
+	 * @return false|null
209 209
 	 */
210 210
 	public static function delete_all_expired( $force = false ) {
211 211
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return static
44 44
 	 */
45 45
 	public static function get_instance() {
46
-		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give_Cache ) ) {
46
+		if ( ! isset(self::$instance) && ! (self::$instance instanceof Give_Cache)) {
47 47
 			self::$instance = new Give_Cache();
48 48
 		}
49 49
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function setup_hooks() {
60 60
 		// weekly delete all expired cache.
61
-		Give_Cron::add_weekly_event( array( $this, 'delete_all_expired' ) );
61
+		Give_Cron::add_weekly_event(array($this, 'delete_all_expired'));
62 62
 	}
63 63
 
64 64
 	/**
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 	 * @return string
73 73
 	 */
74 74
 
75
-	public static function get_key( $action, $query_args = null ) {
75
+	public static function get_key($action, $query_args = null) {
76 76
 		$cache_key = "give_cache_{$action}";
77 77
 
78 78
 		// Bailout.
79
-		if ( ! empty( $query_args ) ) {
80
-			$cache_key = "{$cache_key}_" . substr( md5( serialize( $query_args ) ), 0, 15 );
79
+		if ( ! empty($query_args)) {
80
+			$cache_key = "{$cache_key}_".substr(md5(serialize($query_args)), 0, 15);
81 81
 		}
82 82
 
83 83
 		return $cache_key;
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 	 * @return mixed
96 96
 	 */
97 97
 
98
-	public static function get( $cache_key, $custom_key = false, $query_args = array() ) {
99
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
100
-			if ( ! $custom_key ) {
101
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
98
+	public static function get($cache_key, $custom_key = false, $query_args = array()) {
99
+		if ( ! self::is_valid_cache_key($cache_key)) {
100
+			if ( ! $custom_key) {
101
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
102 102
 			}
103 103
 
104
-			$cache_key = self::get_key( $cache_key, $query_args );
104
+			$cache_key = self::get_key($cache_key, $query_args);
105 105
 		}
106 106
 
107
-		$option = get_option( $cache_key );
107
+		$option = get_option($cache_key);
108 108
 
109 109
 		// Backward compatibility (<1.8.7).
110
-		if ( ! is_array( $option ) || empty( $option ) || ! array_key_exists( 'expiration', $option ) ) {
110
+		if ( ! is_array($option) || empty($option) || ! array_key_exists('expiration', $option)) {
111 111
 			return $option;
112 112
 		}
113 113
 
114 114
 		// Get current time.
115
-		$current_time = current_time( 'timestamp', 1 );
115
+		$current_time = current_time('timestamp', 1);
116 116
 
117
-		if ( empty( $option['expiration'] ) || ( $current_time < $option['expiration'] ) ) {
117
+		if (empty($option['expiration']) || ($current_time < $option['expiration'])) {
118 118
 			$option = $option['data'];
119 119
 		} else {
120 120
 			$option = false;
@@ -137,23 +137,23 @@  discard block
 block discarded – undo
137 137
 	 * @return mixed
138 138
 	 */
139 139
 
140
-	public static function set( $cache_key, $data, $expiration = null, $custom_key = false, $query_args = array() ) {
141
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
142
-			if ( ! $custom_key ) {
143
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
140
+	public static function set($cache_key, $data, $expiration = null, $custom_key = false, $query_args = array()) {
141
+		if ( ! self::is_valid_cache_key($cache_key)) {
142
+			if ( ! $custom_key) {
143
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
144 144
 			}
145 145
 
146
-			$cache_key = self::get_key( $cache_key, $query_args );
146
+			$cache_key = self::get_key($cache_key, $query_args);
147 147
 		}
148 148
 
149 149
 		$option_value = array(
150 150
 			'data'       => $data,
151
-			'expiration' => ! is_null( $expiration )
152
-				? ( $expiration + current_time( 'timestamp', 1 ) )
151
+			'expiration' => ! is_null($expiration)
152
+				? ($expiration + current_time('timestamp', 1))
153 153
 				: null,
154 154
 		);
155 155
 
156
-		$result = update_option( $cache_key, $option_value, 'no' );
156
+		$result = update_option($cache_key, $option_value, 'no');
157 157
 
158 158
 		return $result;
159 159
 	}
@@ -168,27 +168,27 @@  discard block
 block discarded – undo
168 168
 	 * @return bool|WP_Error
169 169
 	 */
170 170
 
171
-	public static function delete( $cache_keys ) {
171
+	public static function delete($cache_keys) {
172 172
 		$result = true;
173 173
 		$invalid_keys = array();
174 174
 
175
-		if ( ! empty( $cache_keys ) ) {
176
-			$cache_keys = is_array( $cache_keys ) ? $cache_keys : array( $cache_keys );
175
+		if ( ! empty($cache_keys)) {
176
+			$cache_keys = is_array($cache_keys) ? $cache_keys : array($cache_keys);
177 177
 
178
-			foreach ( $cache_keys as $cache_key ) {
179
-				if ( ! self::is_valid_cache_key( $cache_key ) ) {
178
+			foreach ($cache_keys as $cache_key) {
179
+				if ( ! self::is_valid_cache_key($cache_key)) {
180 180
 					$invalid_keys[] = $cache_key;
181 181
 					$result = false;
182 182
 				}
183 183
 
184
-				delete_option( $cache_key );
184
+				delete_option($cache_key);
185 185
 			}
186 186
 		}
187 187
 
188
-		if( ! $result ) {
188
+		if ( ! $result) {
189 189
 			$result = new WP_Error(
190 190
 				'give_invalid_cache_key',
191
-					__( 'Cache key format should be give_cache_*', 'give' ),
191
+					__('Cache key format should be give_cache_*', 'give'),
192 192
 					$invalid_keys
193 193
 			);
194 194
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return bool
209 209
 	 */
210
-	public static function delete_all_expired( $force = false ) {
210
+	public static function delete_all_expired($force = false) {
211 211
 		global $wpdb;
212 212
 		$options = $wpdb->get_results(
213 213
 			$wpdb->prepare(
@@ -221,30 +221,30 @@  discard block
 block discarded – undo
221 221
 		);
222 222
 
223 223
 		// Bailout.
224
-		if ( empty( $options ) ) {
224
+		if (empty($options)) {
225 225
 			return false;
226 226
 		}
227 227
 
228
-		$current_time = current_time( 'timestamp', 1 );
228
+		$current_time = current_time('timestamp', 1);
229 229
 
230 230
 		// Delete log cache.
231
-		foreach ( $options as $option ) {
232
-			$option['option_value'] = maybe_unserialize( $option['option_value'] );
231
+		foreach ($options as $option) {
232
+			$option['option_value'] = maybe_unserialize($option['option_value']);
233 233
 
234 234
 			if (
235 235
 				(
236
-					! self::is_valid_cache_key( $option['option_name'] )
237
-					|| ! is_array( $option['option_value'] ) // Backward compatibility (<1.8.7).
238
-					|| ! array_key_exists( 'expiration', $option['option_value'] ) // Backward compatibility (<1.8.7).
239
-					|| empty( $option['option_value']['expiration'] )
240
-					|| ( $current_time < $option['option_value']['expiration'] )
236
+					! self::is_valid_cache_key($option['option_name'])
237
+					|| ! is_array($option['option_value']) // Backward compatibility (<1.8.7).
238
+					|| ! array_key_exists('expiration', $option['option_value']) // Backward compatibility (<1.8.7).
239
+					|| empty($option['option_value']['expiration'])
240
+					|| ($current_time < $option['option_value']['expiration'])
241 241
 				)
242 242
 				&& ! $force
243 243
 			) {
244 244
 				continue;
245 245
 			}
246 246
 
247
-			self::delete( $option['option_name'] );
247
+			self::delete($option['option_name']);
248 248
 		}
249 249
 	}
250 250
 
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return array
262 262
 	 */
263
-	public static function get_options_like( $option_name, $fields = false ) {
263
+	public static function get_options_like($option_name, $fields = false) {
264 264
 		global $wpdb;
265 265
 
266
-		if ( empty( $option_name ) ) {
266
+		if (empty($option_name)) {
267 267
 			return array();
268 268
 		}
269 269
 
270 270
 		$field_names = $fields ? 'option_name, option_value' : 'option_name';
271 271
 
272
-		if ( $fields ) {
272
+		if ($fields) {
273 273
 			$options = $wpdb->get_results(
274 274
 				$wpdb->prepare(
275 275
 					"SELECT {$field_names }
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 			);
294 294
 		}
295 295
 
296
-		if ( ! empty( $options ) && $fields ) {
297
-			foreach ( $options as $index => $option ) {
298
-				$option['option_value'] = maybe_unserialize( $option['option_value'] );
299
-				$options[ $index ]      = $option;
296
+		if ( ! empty($options) && $fields) {
297
+			foreach ($options as $index => $option) {
298
+				$option['option_value'] = maybe_unserialize($option['option_value']);
299
+				$options[$index]      = $option;
300 300
 			}
301 301
 		}
302 302
 
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @return bool|int
315 315
 	 */
316
-	public static function is_valid_cache_key( $cache_key ) {
317
-		return ( false !== strpos( $cache_key, 'give_cache_' ) );
316
+	public static function is_valid_cache_key($cache_key) {
317
+		return (false !== strpos($cache_key, 'give_cache_'));
318 318
 	}
319 319
 }
320 320
 
Please login to merge, or discard this patch.