Test Failed
Push — master ( 35678a...7fea6f )
by Devin
07:20
created
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Register', 'give');
25
+		$this->shortcode['label'] = esc_html__('Register', 'give');
26 26
 
27
-		parent::__construct( 'give_register' );
27
+		parent::__construct('give_register');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
47 47
 			),
48 48
 		);
49 49
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 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,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Donation History', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Donation History', 'give');
25 25
 
26
-		parent::__construct( 'donation_history' );
26
+		parent::__construct('donation_history');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/misc-functions.php 4 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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1738,7 +1738,7 @@
 block discarded – undo
1738 1738
 
1739 1739
 		if( is_array( $post_type ) ) {
1740 1740
 			$where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'";
1741
-		}else{
1741
+		} else{
1742 1742
 			$where .= " post_type='{$post_type}'";
1743 1743
 		}
1744 1744
 	}
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
  *
229 229
  * @since 1.8.17
230 230
  *
231
- * @return array|string
231
+ * @return boolean
232 232
  */
233 233
 function give_get_history_session() {
234 234
 	return (bool) Give()->session->get( 'history_access' );
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
  *
712 712
  * @todo  Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828).
713 713
  *
714
- * @return bool
714
+ * @return false|null
715 715
  */
716 716
 function give_donation_metabox_menu() {
717 717
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
  *
1007 1007
  * @since 1.8
1008 1008
  *
1009
- * @param $form_id
1009
+ * @param integer $form_id
1010 1010
  *
1011 1011
  * @return bool
1012 1012
  */
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
  * @param int    $id
1126 1126
  * @param string $meta_key
1127 1127
  * @param mixed  $meta_value
1128
- * @param mixed  $prev_value
1128
+ * @param string  $prev_value
1129 1129
  *
1130 1130
  * @return mixed
1131 1131
  */
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
  * @since 1.8.13
1387 1387
  *
1388 1388
  * @param array      $list      List of objects or arrays
1389
- * @param int|string $field     Field from the object to place instead of the entire object
1389
+ * @param string $field     Field from the object to place instead of the entire object
1390 1390
  * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
1391 1391
  *                              Default null.
1392 1392
  *
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
  *
1814 1814
  * @since 2.1.0
1815 1815
  *
1816
- * @param $form_id
1816
+ * @param integer $form_id
1817 1817
  *
1818 1818
  * @return bool
1819 1819
  */
Please login to merge, or discard this patch.
Spacing   +383 added lines, -383 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,13 +152,13 @@  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
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @since 1.0
169 169
 	 */
170
-	$ip = apply_filters( 'give_get_ip', $ip );
170
+	$ip = apply_filters('give_get_ip', $ip);
171 171
 
172 172
 	// Filter empty values.
173
-	if( false !== strpos( $ip, ',' ) ) {
174
-		$ip = give_clean( explode( ',', $ip ) );
175
-		$ip = array_filter( $ip );
176
-		$ip = implode( ',', $ip );
177
-	} else{
178
-		$ip = give_clean( $ip );
173
+	if (false !== strpos($ip, ',')) {
174
+		$ip = give_clean(explode(',', $ip));
175
+		$ip = array_filter($ip);
176
+		$ip = implode(',', $ip);
177
+	} else {
178
+		$ip = give_clean($ip);
179 179
 	}
180 180
 
181 181
 	return $ip;
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @uses  Give()->session->set()
195 195
  */
196
-function give_set_purchase_session( $purchase_data = array() ) {
197
-	Give()->session->set( 'give_purchase', $purchase_data );
198
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
196
+function give_set_purchase_session($purchase_data = array()) {
197
+	Give()->session->set('give_purchase', $purchase_data);
198
+	Give()->session->set('give_email', $purchase_data['user_email']);
199 199
 }
200 200
 
201 201
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  * @return mixed array | false
210 210
  */
211 211
 function give_get_purchase_session() {
212
-	return Give()->session->get( 'give_purchase' );
212
+	return Give()->session->get('give_purchase');
213 213
 }
214 214
 
215 215
 /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  * @return array|string
221 221
  */
222 222
 function give_get_receipt_session() {
223
-	return Give()->session->get( 'receipt_access' );
223
+	return Give()->session->get('receipt_access');
224 224
 }
225 225
 
226 226
 /**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  * @return array|string
232 232
  */
233 233
 function give_get_history_session() {
234
-	return (bool) Give()->session->get( 'history_access' );
234
+	return (bool) Give()->session->get('history_access');
235 235
 }
236 236
 
237 237
 /**
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return string By default, the name of the form. Then the price level text if any is found.
245 245
  */
246
-function give_payment_gateway_item_title( $payment_data ) {
246
+function give_payment_gateway_item_title($payment_data) {
247 247
 
248
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
249
-	$item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : '';
250
-	$price_id  = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
248
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
249
+	$item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : '';
250
+	$price_id  = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
251 251
 
252 252
 
253 253
 	// Verify has variable prices.
254
-	if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) {
254
+	if (give_has_variable_prices($form_id) && ! empty($price_id)) {
255 255
 
256
-		$item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false );
256
+		$item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false);
257 257
 
258 258
 		/**
259 259
 		 * Output donation level text if:
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 		 */
264 264
 		if (
265 265
 			'custom' !== $price_id
266
-			&& ! empty( $item_price_level_text )
266
+			&& ! empty($item_price_level_text)
267 267
 		) {
268 268
 			// Matches a donation level - append level text.
269
-			$item_name .= ' - ' . $item_price_level_text;
269
+			$item_name .= ' - '.$item_price_level_text;
270 270
 		}
271 271
 	}
272 272
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return string
283 283
 	 */
284
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
284
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
285 285
 }
286 286
 
287 287
 /**
@@ -297,38 +297,38 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return string
299 299
  */
300
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
300
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
301 301
 
302
-	$form_id  = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
303
-	$price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : '';
302
+	$form_id  = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
303
+	$price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : '';
304 304
 
305 305
 	// Form title.
306
-	$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' ) ) );
306
+	$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')));
307 307
 
308 308
 	// Form multilevel if applicable.
309
-	if ( ! empty( $price_id ) && 'custom' !== $price_id ) {
310
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
309
+	if ( ! empty($price_id) && 'custom' !== $price_id) {
310
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
311 311
 	}
312 312
 
313 313
 	// Add Donor's name + email if requested.
314
-	if ( $name_and_email ) {
314
+	if ($name_and_email) {
315 315
 
316 316
 		// First name
317
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
318
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
317
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
318
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
319 319
 		}
320 320
 
321
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
322
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
321
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
322
+			$summary .= ' '.$donation_data['user_info']['last_name'];
323 323
 		}
324 324
 
325
-		$summary .= ' (' . $donation_data['user_email'] . ')';
325
+		$summary .= ' ('.$donation_data['user_email'].')';
326 326
 	}
327 327
 
328 328
 	// Cut the length
329
-	$summary = substr( $summary, 0, $length );
329
+	$summary = substr($summary, 0, $length);
330 330
 
331
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
331
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
332 332
 }
333 333
 
334 334
 
@@ -343,31 +343,31 @@  discard block
 block discarded – undo
343 343
 function give_get_host() {
344 344
 	$host = false;
345 345
 
346
-	if ( defined( 'WPE_APIKEY' ) ) {
346
+	if (defined('WPE_APIKEY')) {
347 347
 		$host = 'WP Engine';
348
-	} elseif ( defined( 'PAGELYBIN' ) ) {
348
+	} elseif (defined('PAGELYBIN')) {
349 349
 		$host = 'Pagely';
350
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
350
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
351 351
 		$host = 'ICDSoft';
352
-	} elseif ( DB_HOST == 'mysqlv5' ) {
352
+	} elseif (DB_HOST == 'mysqlv5') {
353 353
 		$host = 'NetworkSolutions';
354
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
354
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
355 355
 		$host = 'iPage';
356
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
356
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
357 357
 		$host = 'IPower';
358
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
358
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
359 359
 		$host = 'MediaTemple Grid';
360
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
360
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
361 361
 		$host = 'pair Networks';
362
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
362
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
363 363
 		$host = 'Rackspace Cloud';
364
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
364
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
365 365
 		$host = 'SysFix.eu Power Hosting';
366
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
366
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
367 367
 		$host = 'Flywheel';
368 368
 	} else {
369 369
 		// Adding a general fallback for data gathering
370
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
370
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
371 371
 	}
372 372
 
373 373
 	return $host;
@@ -383,67 +383,67 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return bool true if host matches, false if not
385 385
  */
386
-function give_is_host( $host = false ) {
386
+function give_is_host($host = false) {
387 387
 
388 388
 	$return = false;
389 389
 
390
-	if ( $host ) {
391
-		$host = str_replace( ' ', '', strtolower( $host ) );
390
+	if ($host) {
391
+		$host = str_replace(' ', '', strtolower($host));
392 392
 
393
-		switch ( $host ) {
393
+		switch ($host) {
394 394
 			case 'wpengine':
395
-				if ( defined( 'WPE_APIKEY' ) ) {
395
+				if (defined('WPE_APIKEY')) {
396 396
 					$return = true;
397 397
 				}
398 398
 				break;
399 399
 			case 'pagely':
400
-				if ( defined( 'PAGELYBIN' ) ) {
400
+				if (defined('PAGELYBIN')) {
401 401
 					$return = true;
402 402
 				}
403 403
 				break;
404 404
 			case 'icdsoft':
405
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
405
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
406 406
 					$return = true;
407 407
 				}
408 408
 				break;
409 409
 			case 'networksolutions':
410
-				if ( DB_HOST == 'mysqlv5' ) {
410
+				if (DB_HOST == 'mysqlv5') {
411 411
 					$return = true;
412 412
 				}
413 413
 				break;
414 414
 			case 'ipage':
415
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
415
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
416 416
 					$return = true;
417 417
 				}
418 418
 				break;
419 419
 			case 'ipower':
420
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
420
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
421 421
 					$return = true;
422 422
 				}
423 423
 				break;
424 424
 			case 'mediatemplegrid':
425
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
425
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
426 426
 					$return = true;
427 427
 				}
428 428
 				break;
429 429
 			case 'pairnetworks':
430
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
430
+				if (strpos(DB_HOST, '.pair.com') !== false) {
431 431
 					$return = true;
432 432
 				}
433 433
 				break;
434 434
 			case 'rackspacecloud':
435
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
435
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
436 436
 					$return = true;
437 437
 				}
438 438
 				break;
439 439
 			case 'sysfix.eu':
440 440
 			case 'sysfix.eupowerhosting':
441
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
441
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'flywheel':
446
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
446
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
  * @param string $replacement Optional. The function that should have been called.
477 477
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
478 478
  */
479
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
479
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
480 480
 
481 481
 	/**
482 482
 	 * Fires while give deprecated function call occurs.
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param string $replacement Optional. The function that should have been called.
490 490
 	 * @param string $version     The plugin version that deprecated the function.
491 491
 	 */
492
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
492
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
493 493
 
494
-	$show_errors = current_user_can( 'manage_options' );
494
+	$show_errors = current_user_can('manage_options');
495 495
 
496 496
 	// Allow plugin to filter the output error trigger.
497
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
498
-		if ( ! is_null( $replacement ) ) {
499
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
500
-			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.
497
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
498
+		if ( ! is_null($replacement)) {
499
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
500
+			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.
501 501
 			// Alternatively we could dump this to a file.
502 502
 		} else {
503
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
504
-			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.
503
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
504
+			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.
505 505
 			// Alternatively we could dump this to a file.
506 506
 		}
507 507
 	}
@@ -515,17 +515,17 @@  discard block
 block discarded – undo
515 515
  * @return string $post_id
516 516
  */
517 517
 function give_get_admin_post_id() {
518
-	$post_id = isset( $_REQUEST['post'] )
519
-		? absint( $_REQUEST['post'] )
518
+	$post_id = isset($_REQUEST['post'])
519
+		? absint($_REQUEST['post'])
520 520
 		: null;
521 521
 
522
-	$post_id = ! empty( $post_id )
522
+	$post_id = ! empty($post_id)
523 523
 		? $post_id
524
-		: ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null );
524
+		: (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null);
525 525
 
526
-	$post_id = ! empty( $post_id )
526
+	$post_id = ! empty($post_id)
527 527
 		? $post_id
528
-		: ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null );
528
+		: (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null);
529 529
 
530 530
 	return $post_id;
531 531
 }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
  * @return string Arg separator output
538 538
  */
539 539
 function give_get_php_arg_separator_output() {
540
-	return ini_get( 'arg_separator.output' );
540
+	return ini_get('arg_separator.output');
541 541
 }
542 542
 
543 543
 
@@ -552,10 +552,10 @@  discard block
 block discarded – undo
552 552
  *
553 553
  * @return string Short month name
554 554
  */
555
-function give_month_num_to_name( $n ) {
556
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
555
+function give_month_num_to_name($n) {
556
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
557 557
 
558
-	return date_i18n( 'M', $timestamp );
558
+	return date_i18n('M', $timestamp);
559 559
 }
560 560
 
561 561
 
@@ -568,10 +568,10 @@  discard block
 block discarded – undo
568 568
  *
569 569
  * @return bool Whether or not function is disabled.
570 570
  */
571
-function give_is_func_disabled( $function ) {
572
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
571
+function give_is_func_disabled($function) {
572
+	$disabled = explode(',', ini_get('disable_functions'));
573 573
 
574
-	return in_array( $function, $disabled );
574
+	return in_array($function, $disabled);
575 575
 }
576 576
 
577 577
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 function give_get_newsletter() {
584 584
 	?>
585 585
 
586
-	<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>
586
+	<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>
587 587
 
588 588
 	<div class="give-newsletter-form-wrap">
589 589
 
@@ -591,33 +591,33 @@  discard block
 block discarded – undo
591 591
 		      method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
592 592
 		      target="_blank" novalidate>
593 593
 			<div class="give-newsletter-confirmation">
594
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
594
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
595 595
 			</div>
596 596
 
597 597
 			<table class="form-table give-newsletter-form">
598 598
 				<tr valign="middle">
599 599
 					<td>
600 600
 						<label for="mce-EMAIL"
601
-						       class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
601
+						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
602 602
 						<input type="email" name="EMAIL" id="mce-EMAIL"
603
-						       placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
603
+						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
604 604
 						       class="required email" value="">
605 605
 					</td>
606 606
 					<td>
607 607
 						<label for="mce-FNAME"
608
-						       class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
608
+						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
609 609
 						<input type="text" name="FNAME" id="mce-FNAME"
610
-						       placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
610
+						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
611 611
 					</td>
612 612
 					<td>
613 613
 						<label for="mce-LNAME"
614
-						       class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
614
+						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
615 615
 						<input type="text" name="LNAME" id="mce-LNAME"
616
-						       placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
616
+						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
617 617
 					</td>
618 618
 					<td>
619 619
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
620
-						       value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
620
+						       value="<?php esc_attr_e('Subscribe', 'give'); ?>">
621 621
 					</td>
622 622
 				</tr>
623 623
 			</table>
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return string
672 672
  */
673
-function give_svg_icons( $icon ) {
673
+function give_svg_icons($icon) {
674 674
 
675 675
 	// Store your SVGs in an associative array
676 676
 	$svgs = array(
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	);
683 683
 
684 684
 	// Return the chosen icon's SVG string
685
-	return $svgs[ $icon ];
685
+	return $svgs[$icon];
686 686
 }
687 687
 
688 688
 /**
@@ -694,15 +694,15 @@  discard block
 block discarded – undo
694 694
  *
695 695
  * @return mixed
696 696
  */
697
-function modify_nav_menu_meta_box_object( $post_type ) {
698
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
699
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
697
+function modify_nav_menu_meta_box_object($post_type) {
698
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
699
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
700 700
 	}
701 701
 
702 702
 	return $post_type;
703 703
 }
704 704
 
705
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
705
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
706 706
 
707 707
 /**
708 708
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -721,35 +721,35 @@  discard block
 block discarded – undo
721 721
 	// Proceed, if current screen is navigation menus.
722 722
 	if (
723 723
 		'nav-menus' === $screen->id &&
724
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) ) &&
725
-		! get_user_option( 'give_is_donation_forms_menu_updated' )
724
+		give_is_setting_enabled(give_get_option('forms_singular')) &&
725
+		! get_user_option('give_is_donation_forms_menu_updated')
726 726
 	) {
727 727
 
728 728
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
729 729
 		if (
730 730
 			! is_admin() ||
731
-			( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) )
731
+			( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))
732 732
 		) {
733 733
 			return false;
734 734
 		}
735 735
 
736 736
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
737
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
737
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
738 738
 			return false;
739 739
 		}
740 740
 
741 741
 		// Exclude 'Donation Form' value from hidden meta box's list.
742
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
742
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
743 743
 
744 744
 		// Get current user ID.
745 745
 		$user = wp_get_current_user();
746 746
 
747
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
748
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
747
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
748
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
749 749
 	}
750 750
 }
751 751
 
752
-add_action( 'current_screen', 'give_donation_metabox_menu' );
752
+add_action('current_screen', 'give_donation_metabox_menu');
753 753
 
754 754
 /**
755 755
  * Array_column backup usage
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
  * @license    https://opensource.org/licenses/MIT MIT
763 763
  */
764 764
 
765
-if ( ! function_exists( 'array_column' ) ) {
765
+if ( ! function_exists('array_column')) {
766 766
 	/**
767 767
 	 * Returns the values from a single column of the input array, identified by
768 768
 	 * the $columnKey.
@@ -781,53 +781,53 @@  discard block
 block discarded – undo
781 781
 	 *
782 782
 	 * @return array
783 783
 	 */
784
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
784
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
785 785
 		// Using func_get_args() in order to check for proper number of
786 786
 		// parameters and trigger errors exactly as the built-in array_column()
787 787
 		// does in PHP 5.5.
788 788
 		$argc   = func_num_args();
789 789
 		$params = func_get_args();
790 790
 
791
-		if ( $argc < 2 ) {
792
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
791
+		if ($argc < 2) {
792
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
793 793
 
794 794
 			return null;
795 795
 		}
796 796
 
797
-		if ( ! is_array( $params[0] ) ) {
798
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
797
+		if ( ! is_array($params[0])) {
798
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
799 799
 
800 800
 			return null;
801 801
 		}
802 802
 
803
-		if ( ! is_int( $params[1] )
804
-		     && ! is_float( $params[1] )
805
-		     && ! is_string( $params[1] )
803
+		if ( ! is_int($params[1])
804
+		     && ! is_float($params[1])
805
+		     && ! is_string($params[1])
806 806
 		     && $params[1] !== null
807
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
807
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
808 808
 		) {
809
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
809
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
810 810
 
811 811
 			return false;
812 812
 		}
813 813
 
814
-		if ( isset( $params[2] )
815
-		     && ! is_int( $params[2] )
816
-		     && ! is_float( $params[2] )
817
-		     && ! is_string( $params[2] )
818
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
814
+		if (isset($params[2])
815
+		     && ! is_int($params[2])
816
+		     && ! is_float($params[2])
817
+		     && ! is_string($params[2])
818
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
819 819
 		) {
820
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
820
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
821 821
 
822 822
 			return false;
823 823
 		}
824 824
 
825 825
 		$paramsInput     = $params[0];
826
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
826
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
827 827
 
828 828
 		$paramsIndexKey = null;
829
-		if ( isset( $params[2] ) ) {
830
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
829
+		if (isset($params[2])) {
830
+			if (is_float($params[2]) || is_int($params[2])) {
831 831
 				$paramsIndexKey = (int) $params[2];
832 832
 			} else {
833 833
 				$paramsIndexKey = (string) $params[2];
@@ -836,26 +836,26 @@  discard block
 block discarded – undo
836 836
 
837 837
 		$resultArray = array();
838 838
 
839
-		foreach ( $paramsInput as $row ) {
839
+		foreach ($paramsInput as $row) {
840 840
 			$key    = $value = null;
841 841
 			$keySet = $valueSet = false;
842 842
 
843
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
843
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
844 844
 				$keySet = true;
845
-				$key    = (string) $row[ $paramsIndexKey ];
845
+				$key    = (string) $row[$paramsIndexKey];
846 846
 			}
847 847
 
848
-			if ( $paramsColumnKey === null ) {
848
+			if ($paramsColumnKey === null) {
849 849
 				$valueSet = true;
850 850
 				$value    = $row;
851
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
851
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
852 852
 				$valueSet = true;
853
-				$value    = $row[ $paramsColumnKey ];
853
+				$value    = $row[$paramsColumnKey];
854 854
 			}
855 855
 
856
-			if ( $valueSet ) {
857
-				if ( $keySet ) {
858
-					$resultArray[ $key ] = $value;
856
+			if ($valueSet) {
857
+				if ($keySet) {
858
+					$resultArray[$key] = $value;
859 859
 				} else {
860 860
 					$resultArray[] = $value;
861 861
 				}
@@ -875,54 +875,54 @@  discard block
 block discarded – undo
875 875
  *
876 876
  * @return bool Whether the receipt is visible or not.
877 877
  */
878
-function give_can_view_receipt( $payment_key = '' ) {
878
+function give_can_view_receipt($payment_key = '') {
879 879
 
880 880
 	$return = false;
881 881
 
882
-	if ( empty( $payment_key ) ) {
882
+	if (empty($payment_key)) {
883 883
 		return $return;
884 884
 	}
885 885
 
886 886
 	global $give_receipt_args;
887 887
 
888
-	$give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key );
888
+	$give_receipt_args['id'] = give_get_donation_id_by_key($payment_key);
889 889
 
890
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
890
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
891 891
 
892
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
892
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
893 893
 
894
-	if ( is_user_logged_in() ) {
895
-		if ( $user_id === (int) get_current_user_id() ) {
894
+	if (is_user_logged_in()) {
895
+		if ($user_id === (int) get_current_user_id()) {
896 896
 			$return = true;
897
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
897
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
898 898
 			$return = true;
899
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
899
+		} elseif (current_user_can('view_give_sensitive_data')) {
900 900
 			$return = true;
901 901
 		}
902 902
 	}
903 903
 
904 904
 	// Check whether it is purchase session?
905 905
 	$purchase_session = give_get_purchase_session();
906
-	if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) {
907
-		if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) {
906
+	if ( ! empty($purchase_session) && ! is_user_logged_in()) {
907
+		if ($purchase_session['purchase_key'] === $payment_meta['key']) {
908 908
 			$return = true;
909 909
 		}
910 910
 	}
911 911
 
912 912
 	// Check whether it is receipt access session?
913 913
 	$receipt_session = give_get_receipt_session();
914
-	if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) {
915
-		if ( $receipt_session === $payment_meta['key'] ) {
914
+	if ( ! empty($receipt_session) && ! is_user_logged_in()) {
915
+		if ($receipt_session === $payment_meta['key']) {
916 916
 			$return = true;
917 917
 		}
918 918
 	}
919 919
 
920 920
 	// Check whether it is history access session?
921
-	if ( true === give_get_history_session() ) {
921
+	if (true === give_get_history_session()) {
922 922
 		$return = true;
923 923
 	}
924 924
 
925
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
925
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
926 926
 
927 927
 }
928 928
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
  *
932 932
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
933 933
  */
934
-if ( ! function_exists( 'cal_days_in_month' ) ) {
934
+if ( ! function_exists('cal_days_in_month')) {
935 935
 	/**
936 936
 	 * cal_days_in_month
937 937
 	 *
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
 	 *
942 942
 	 * @return bool|string
943 943
 	 */
944
-	function cal_days_in_month( $calendar, $month, $year ) {
945
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
944
+	function cal_days_in_month($calendar, $month, $year) {
945
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
946 946
 	}
947 947
 }
948 948
 
@@ -961,40 +961,40 @@  discard block
 block discarded – undo
961 961
  */
962 962
 function give_get_plugins() {
963 963
 	$plugins             = get_plugins();
964
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
964
+	$active_plugin_paths = (array) get_option('active_plugins', array());
965 965
 
966
-	if ( is_multisite() ) {
967
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
968
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
966
+	if (is_multisite()) {
967
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
968
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
969 969
 	}
970 970
 
971
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
971
+	foreach ($plugins as $plugin_path => $plugin_data) {
972 972
 		// Is plugin active?
973
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
974
-			$plugins[ $plugin_path ]['Status'] = 'active';
973
+		if (in_array($plugin_path, $active_plugin_paths)) {
974
+			$plugins[$plugin_path]['Status'] = 'active';
975 975
 		} else {
976
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
976
+			$plugins[$plugin_path]['Status'] = 'inactive';
977 977
 		}
978 978
 
979
-		$dirname = strtolower( dirname( $plugin_path ) );
979
+		$dirname = strtolower(dirname($plugin_path));
980 980
 
981 981
 		// Is plugin a Give add-on by WordImpress?
982
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
982
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
983 983
 			// Plugin is a Give-addon.
984
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
984
+			$plugins[$plugin_path]['Type'] = 'add-on';
985 985
 
986 986
 			/* @var stdClass $license_active */
987
-			$license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) );
987
+			$license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name']));
988 988
 
989 989
 			// Does a valid license exist?
990
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
991
-				$plugins[ $plugin_path ]['License'] = true;
990
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
991
+				$plugins[$plugin_path]['License'] = true;
992 992
 			} else {
993
-				$plugins[ $plugin_path ]['License'] = false;
993
+				$plugins[$plugin_path]['License'] = false;
994 994
 			}
995 995
 		} else {
996 996
 			// Plugin is not a Give add-on.
997
-			$plugins[ $plugin_path ]['Type'] = 'other';
997
+			$plugins[$plugin_path]['Type'] = 'other';
998 998
 		}
999 999
 	}
1000 1000
 
@@ -1010,16 +1010,16 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @return bool
1012 1012
  */
1013
-function give_is_terms_enabled( $form_id ) {
1014
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1013
+function give_is_terms_enabled($form_id) {
1014
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1015 1015
 
1016 1016
 	if (
1017
-		give_is_setting_enabled( $form_option, 'global' )
1018
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1017
+		give_is_setting_enabled($form_option, 'global')
1018
+		&& give_is_setting_enabled(give_get_option('terms'))
1019 1019
 	) {
1020 1020
 		return true;
1021 1021
 
1022
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1022
+	} elseif (give_is_setting_enabled($form_option)) {
1023 1023
 		return true;
1024 1024
 
1025 1025
 	} else {
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
  *
1044 1044
  * @return WP_Error|bool
1045 1045
  */
1046
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1046
+function give_delete_donation_stats($date_range = '', $args = array()) {
1047 1047
 
1048 1048
 	// Delete all cache.
1049
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1049
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1050 1050
 
1051 1051
 	/**
1052 1052
 	 * Fire the action when donation stats delete.
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	 * @param string|array $date_range
1057 1057
 	 * @param array        $args
1058 1058
 	 */
1059
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1059
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1060 1060
 
1061 1061
 	return $status;
1062 1062
 }
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 function give_is_add_new_form_page() {
1071 1071
 	$status = false;
1072 1072
 
1073
-	if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) {
1073
+	if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) {
1074 1074
 		$status = true;
1075 1075
 	}
1076 1076
 
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
  *
1094 1094
  * @return mixed
1095 1095
  */
1096
-function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) {
1096
+function give_get_meta($id, $meta_key = '', $single = false, $default = false) {
1097 1097
 	/**
1098 1098
 	 * Filter the meta value
1099 1099
 	 *
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 	 */
1102 1102
 	$meta_value = apply_filters(
1103 1103
 		'give_get_meta',
1104
-		get_post_meta( $id, $meta_key, $single ),
1104
+		get_post_meta($id, $meta_key, $single),
1105 1105
 		$id,
1106 1106
 		$meta_key,
1107 1107
 		$default
1108 1108
 	);
1109 1109
 
1110 1110
 	if (
1111
-		( empty( $meta_key ) || empty( $meta_value ) )
1111
+		(empty($meta_key) || empty($meta_value))
1112 1112
 		&& $default
1113 1113
 	) {
1114 1114
 		$meta_value = $default;
@@ -1129,15 +1129,15 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return mixed
1131 1131
  */
1132
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1133
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1132
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1133
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1134 1134
 
1135 1135
 	/**
1136 1136
 	 * Filter the meta value update status
1137 1137
 	 *
1138 1138
 	 * @since 1.8.8
1139 1139
 	 */
1140
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1140
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1151,15 +1151,15 @@  discard block
 block discarded – undo
1151 1151
  *
1152 1152
  * @return mixed
1153 1153
  */
1154
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1155
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1154
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1155
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1156 1156
 
1157 1157
 	/**
1158 1158
 	 * Filter the meta value delete status
1159 1159
 	 *
1160 1160
 	 * @since 1.8.8
1161 1161
 	 */
1162
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1162
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1163 1163
 }
1164 1164
 
1165 1165
 /**
@@ -1171,23 +1171,23 @@  discard block
 block discarded – undo
1171 1171
  *
1172 1172
  * @return bool                   If the action has been added to the completed actions array
1173 1173
  */
1174
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1174
+function give_has_upgrade_completed($upgrade_action = '') {
1175 1175
 	// Bailout.
1176
-	if ( empty( $upgrade_action ) ) {
1176
+	if (empty($upgrade_action)) {
1177 1177
 		return false;
1178 1178
 	}
1179 1179
 
1180 1180
 	// Fresh install?
1181 1181
 	// If fresh install then all upgrades will be consider as completed.
1182
-	$is_fresh_install = ! get_option( 'give_version' );
1183
-	if ( $is_fresh_install ) {
1182
+	$is_fresh_install = ! get_option('give_version');
1183
+	if ($is_fresh_install) {
1184 1184
 		return true;
1185 1185
 	}
1186 1186
 
1187 1187
 
1188 1188
 	$completed_upgrades = give_get_completed_upgrades();
1189 1189
 
1190
-	return in_array( $upgrade_action, $completed_upgrades );
1190
+	return in_array($upgrade_action, $completed_upgrades);
1191 1191
 
1192 1192
 }
1193 1193
 
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1200 1200
  */
1201 1201
 function give_maybe_resume_upgrade() {
1202
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1203
-	if ( empty( $doing_upgrade ) ) {
1202
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1203
+	if (empty($doing_upgrade)) {
1204 1204
 		return false;
1205 1205
 	}
1206 1206
 
@@ -1216,9 +1216,9 @@  discard block
 block discarded – undo
1216 1216
  *
1217 1217
  * @return bool                   If the function was successfully added
1218 1218
  */
1219
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1219
+function give_set_upgrade_complete($upgrade_action = '') {
1220 1220
 
1221
-	if ( empty( $upgrade_action ) ) {
1221
+	if (empty($upgrade_action)) {
1222 1222
 		return false;
1223 1223
 	}
1224 1224
 
@@ -1226,16 +1226,16 @@  discard block
 block discarded – undo
1226 1226
 	$completed_upgrades[] = $upgrade_action;
1227 1227
 
1228 1228
 	// Remove any blanks, and only show uniques.
1229
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1229
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1230 1230
 
1231 1231
 	/**
1232 1232
 	 * Fire the action when any upgrade set to complete.
1233 1233
 	 *
1234 1234
 	 * @since 1.8.12
1235 1235
 	 */
1236
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1236
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1237 1237
 
1238
-	return update_option( 'give_completed_upgrades', $completed_upgrades, 'no' );
1238
+	return update_option('give_completed_upgrades', $completed_upgrades, 'no');
1239 1239
 }
1240 1240
 
1241 1241
 /**
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
  * @return array The array of completed upgrades
1246 1246
  */
1247 1247
 function give_get_completed_upgrades() {
1248
-	return (array) get_option( 'give_completed_upgrades' );
1248
+	return (array) get_option('give_completed_upgrades');
1249 1249
 }
1250 1250
 
1251 1251
 /**
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
  *
1261 1261
  * @return null|array
1262 1262
  */
1263
-function __give_v20_bc_table_details( $type ) {
1263
+function __give_v20_bc_table_details($type) {
1264 1264
 	global $wpdb;
1265 1265
 	$table = array();
1266 1266
 
1267 1267
 	// Bailout.
1268
-	if ( empty( $type ) ) {
1268
+	if (empty($type)) {
1269 1269
 		return null;
1270 1270
 	}
1271 1271
 
1272
-	switch ( $type ) {
1272
+	switch ($type) {
1273 1273
 		case 'form':
1274 1274
 			$table['name']         = $wpdb->formmeta;
1275 1275
 			$table['column']['id'] = 'form_id';
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 	}
1283 1283
 
1284 1284
 	// Backward compatibility.
1285
-	if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) {
1285
+	if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) {
1286 1286
 		$table['name']         = $wpdb->postmeta;
1287 1287
 		$table['column']['id'] = 'post_id';
1288 1288
 	}
@@ -1298,12 +1298,12 @@  discard block
 block discarded – undo
1298 1298
  *
1299 1299
  * @param WP_Query $query
1300 1300
  */
1301
-function give_remove_pages_from_search( $query ) {
1301
+function give_remove_pages_from_search($query) {
1302 1302
 
1303
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1303
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1304 1304
 
1305
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1306
-		$success_page       = give_get_option( 'success_page', 0 );
1305
+		$transaction_failed = give_get_option('failure_page', 0);
1306
+		$success_page       = give_get_option('success_page', 0);
1307 1307
 
1308 1308
 		$args               = apply_filters(
1309 1309
 			'give_remove_pages_from_search', array(
@@ -1311,11 +1311,11 @@  discard block
 block discarded – undo
1311 1311
 			$success_page,
1312 1312
 		), $query
1313 1313
 		);
1314
-		$query->set( 'post__not_in', $args );
1314
+		$query->set('post__not_in', $args);
1315 1315
 	}
1316 1316
 }
1317 1317
 
1318
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1318
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1319 1319
 
1320 1320
 /**
1321 1321
  * Inserts a new key/value before a key in the array.
@@ -1331,14 +1331,14 @@  discard block
 block discarded – undo
1331 1331
  *
1332 1332
  * @see   array_insert_before()
1333 1333
  */
1334
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1335
-	if ( array_key_exists( $key, $array ) ) {
1334
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1335
+	if (array_key_exists($key, $array)) {
1336 1336
 		$new = array();
1337
-		foreach ( $array as $k => $value ) {
1338
-			if ( $k === $key ) {
1339
-				$new[ $new_key ] = $new_value;
1337
+		foreach ($array as $k => $value) {
1338
+			if ($k === $key) {
1339
+				$new[$new_key] = $new_value;
1340 1340
 			}
1341
-			$new[ $k ] = $value;
1341
+			$new[$k] = $value;
1342 1342
 		}
1343 1343
 
1344 1344
 		return $new;
@@ -1361,13 +1361,13 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @see   array_insert_before()
1363 1363
  */
1364
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1365
-	if ( array_key_exists( $key, $array ) ) {
1364
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1365
+	if (array_key_exists($key, $array)) {
1366 1366
 		$new = array();
1367
-		foreach ( $array as $k => $value ) {
1368
-			$new[ $k ] = $value;
1369
-			if ( $k === $key ) {
1370
-				$new[ $new_key ] = $new_value;
1367
+		foreach ($array as $k => $value) {
1368
+			$new[$k] = $value;
1369
+			if ($k === $key) {
1370
+				$new[$new_key] = $new_value;
1371 1371
 			}
1372 1372
 		}
1373 1373
 
@@ -1394,21 +1394,21 @@  discard block
 block discarded – undo
1394 1394
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1395 1395
  *               `$list` will be preserved in the results.
1396 1396
  */
1397
-function give_list_pluck( $list, $field, $index_key = null ) {
1397
+function give_list_pluck($list, $field, $index_key = null) {
1398 1398
 
1399
-	if ( ! $index_key ) {
1399
+	if ( ! $index_key) {
1400 1400
 		/**
1401 1401
 		 * This is simple. Could at some point wrap array_column()
1402 1402
 		 * if we knew we had an array of arrays.
1403 1403
 		 */
1404
-		foreach ( $list as $key => $value ) {
1405
-			if ( is_object( $value ) ) {
1406
-				if ( isset( $value->$field ) ) {
1407
-					$list[ $key ] = $value->$field;
1404
+		foreach ($list as $key => $value) {
1405
+			if (is_object($value)) {
1406
+				if (isset($value->$field)) {
1407
+					$list[$key] = $value->$field;
1408 1408
 				}
1409 1409
 			} else {
1410
-				if ( isset( $value[ $field ] ) ) {
1411
-					$list[ $key ] = $value[ $field ];
1410
+				if (isset($value[$field])) {
1411
+					$list[$key] = $value[$field];
1412 1412
 				}
1413 1413
 			}
1414 1414
 		}
@@ -1421,18 +1421,18 @@  discard block
 block discarded – undo
1421 1421
 	 * to the end of the stack. This is how array_column() behaves.
1422 1422
 	 */
1423 1423
 	$newlist = array();
1424
-	foreach ( $list as $value ) {
1425
-		if ( is_object( $value ) ) {
1426
-			if ( isset( $value->$index_key ) ) {
1427
-				$newlist[ $value->$index_key ] = $value->$field;
1424
+	foreach ($list as $value) {
1425
+		if (is_object($value)) {
1426
+			if (isset($value->$index_key)) {
1427
+				$newlist[$value->$index_key] = $value->$field;
1428 1428
 			} else {
1429 1429
 				$newlist[] = $value->$field;
1430 1430
 			}
1431 1431
 		} else {
1432
-			if ( isset( $value[ $index_key ] ) ) {
1433
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1432
+			if (isset($value[$index_key])) {
1433
+				$newlist[$value[$index_key]] = $value[$field];
1434 1434
 			} else {
1435
-				$newlist[] = $value[ $field ];
1435
+				$newlist[] = $value[$field];
1436 1436
 			}
1437 1437
 		}
1438 1438
 	}
@@ -1455,8 +1455,8 @@  discard block
 block discarded – undo
1455 1455
  *
1456 1456
  * @return int|false Meta ID on success, false on failure.
1457 1457
  */
1458
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1459
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1458
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1459
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1460 1460
 }
1461 1461
 
1462 1462
 /**
@@ -1474,8 +1474,8 @@  discard block
 block discarded – undo
1474 1474
  *
1475 1475
  * @return bool True on success, false on failure.
1476 1476
  */
1477
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1478
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1477
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1478
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1479 1479
 }
1480 1480
 
1481 1481
 /**
@@ -1490,8 +1490,8 @@  discard block
 block discarded – undo
1490 1490
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1491 1491
  *  is true.
1492 1492
  */
1493
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1494
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1493
+function get_donor_meta($donor_id, $key = '', $single = false) {
1494
+	return get_metadata('give_customer', $donor_id, $key, $single);
1495 1495
 }
1496 1496
 
1497 1497
 /**
@@ -1508,8 +1508,8 @@  discard block
 block discarded – undo
1508 1508
  *
1509 1509
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1510 1510
  */
1511
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1512
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1511
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1512
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1513 1513
 }
1514 1514
 
1515 1515
 
@@ -1522,15 +1522,15 @@  discard block
 block discarded – undo
1522 1522
  *
1523 1523
  * @return void
1524 1524
  */
1525
-function give_recount_form_income_donation( $form_id = 0 ) {
1525
+function give_recount_form_income_donation($form_id = 0) {
1526 1526
 	// Check if form id is not empty.
1527
-	if ( ! empty( $form_id ) ) {
1527
+	if ( ! empty($form_id)) {
1528 1528
 		/**
1529 1529
 		 * Filter to modify payment status.
1530 1530
 		 *
1531 1531
 		 * @since 1.8.13
1532 1532
 		 */
1533
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1533
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1534 1534
 
1535 1535
 		/**
1536 1536
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 			'give_recount_form_stats_args', array(
1542 1542
 				'give_forms'     => $form_id,
1543 1543
 				'status'         => $accepted_statuses,
1544
-				'posts_per_page' => - 1,
1544
+				'posts_per_page' => -1,
1545 1545
 				'fields'         => 'ids',
1546 1546
 			)
1547 1547
 		);
@@ -1551,28 +1551,28 @@  discard block
 block discarded – undo
1551 1551
 			'earnings' => 0,
1552 1552
 		);
1553 1553
 
1554
-		$payments = new Give_Payments_Query( $args );
1554
+		$payments = new Give_Payments_Query($args);
1555 1555
 		$payments = $payments->get_payments();
1556 1556
 
1557
-		if ( $payments ) {
1558
-			foreach ( $payments as $payment ) {
1557
+		if ($payments) {
1558
+			foreach ($payments as $payment) {
1559 1559
 				// Ensure acceptible status only
1560
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1560
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1561 1561
 					continue;
1562 1562
 				}
1563 1563
 
1564 1564
 				// Ensure only payments for this form are counted
1565
-				if ( $payment->form_id != $form_id ) {
1565
+				if ($payment->form_id != $form_id) {
1566 1566
 					continue;
1567 1567
 				}
1568 1568
 
1569
-				$totals['sales'] ++;
1569
+				$totals['sales']++;
1570 1570
 				$totals['earnings'] += $payment->total;
1571 1571
 
1572 1572
 			}
1573 1573
 		}
1574
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1575
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1574
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1575
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1576 1576
 	}// End if().
1577 1577
 }
1578 1578
 
@@ -1586,18 +1586,18 @@  discard block
 block discarded – undo
1586 1586
  *
1587 1587
  * @return string
1588 1588
  */
1589
-function give_get_attribute_str( $attributes ) {
1589
+function give_get_attribute_str($attributes) {
1590 1590
 	$attribute_str = '';
1591 1591
 
1592
-	if ( empty( $attributes ) ) {
1592
+	if (empty($attributes)) {
1593 1593
 		return $attribute_str;
1594 1594
 	}
1595 1595
 
1596
-	foreach ( $attributes as $tag => $value ) {
1596
+	foreach ($attributes as $tag => $value) {
1597 1597
 		$attribute_str .= " {$tag}=\"{$value}\"";
1598 1598
 	}
1599 1599
 
1600
-	return trim( $attribute_str );
1600
+	return trim($attribute_str);
1601 1601
 }
1602 1602
 
1603 1603
 /**
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 function give_get_wp_upload_dir() {
1611 1611
 	$wp_upload_dir = wp_upload_dir();
1612 1612
 
1613
-	return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false );
1613
+	return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false);
1614 1614
 }
1615 1615
 
1616 1616
 /**
@@ -1622,15 +1622,15 @@  discard block
 block discarded – undo
1622 1622
  *
1623 1623
  * @return string|bool $file_contents File content
1624 1624
  */
1625
-function give_get_core_settings_json( $file_name ) {
1625
+function give_get_core_settings_json($file_name) {
1626 1626
 	$upload_dir = give_get_wp_upload_dir();
1627
-	$file_path  = $upload_dir . '/' . $file_name;
1627
+	$file_path  = $upload_dir.'/'.$file_name;
1628 1628
 
1629
-	if ( is_wp_error( $file_path ) || empty( $file_path ) ) {
1630
-		Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
1629
+	if (is_wp_error($file_path) || empty($file_path)) {
1630
+		Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
1631 1631
 	}
1632 1632
 
1633
-	$file_contents = file_get_contents( $file_path );
1633
+	$file_contents = file_get_contents($file_path);
1634 1634
 
1635 1635
 	return $file_contents;
1636 1636
 }
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
  * @return int $country The two letter country code for the site's base country
1644 1644
  */
1645 1645
 function give_get_limit_display_donations() {
1646
-	return give_get_option( 'limit_display_donations', 1 );
1646
+	return give_get_option('limit_display_donations', 1);
1647 1647
 }
1648 1648
 
1649 1649
 /**
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
  * @since 1.8.17
1653 1653
  */
1654 1654
 function give_donation_history_table_end() {
1655
-	$email = Give()->session->get( 'give_email' );
1655
+	$email = Give()->session->get('give_email');
1656 1656
 	?>
1657 1657
 	<tfoot>
1658 1658
 	<tr>
@@ -1661,16 +1661,16 @@  discard block
 block discarded – undo
1661 1661
 				<div class="give-security-column give-security-description-wrap">
1662 1662
 					<?php
1663 1663
 					echo sprintf(
1664
-						__( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ),
1664
+						__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'),
1665 1665
 						$email
1666 1666
 					);
1667 1667
 					?>
1668 1668
 				</div>
1669 1669
 				<div class="give-security-column give-security-button-wrap">
1670 1670
 					<a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn">
1671
-						<?php _e( 'Confirm Email', 'give' ); ?>
1671
+						<?php _e('Confirm Email', 'give'); ?>
1672 1672
 					</a>
1673
-					<span><?php _e( 'Email Sent!', 'give' ); ?></span>
1673
+					<span><?php _e('Email Sent!', 'give'); ?></span>
1674 1674
 				</div>
1675 1675
 			</div>
1676 1676
 		</td>
@@ -1690,10 +1690,10 @@  discard block
 block discarded – undo
1690 1690
  *
1691 1691
  * @return void
1692 1692
  */
1693
-function give_doing_it_wrong( $function, $message, $version ) {
1694
-	$message .= "\nBacktrace:" . wp_debug_backtrace_summary();
1693
+function give_doing_it_wrong($function, $message, $version) {
1694
+	$message .= "\nBacktrace:".wp_debug_backtrace_summary();
1695 1695
 
1696
-	_doing_it_wrong( $function, $message , $version );
1696
+	_doing_it_wrong($function, $message, $version);
1697 1697
 }
1698 1698
 
1699 1699
 
@@ -1702,11 +1702,11 @@  discard block
 block discarded – undo
1702 1702
  *
1703 1703
  * @since 1.8.18
1704 1704
  */
1705
-function give_ignore_user_abort(){
1706
-	ignore_user_abort( true );
1705
+function give_ignore_user_abort() {
1706
+	ignore_user_abort(true);
1707 1707
 
1708
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
1709
-		set_time_limit( 0 );
1708
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
1709
+		set_time_limit(0);
1710 1710
 	}
1711 1711
 }
1712 1712
 
@@ -1720,28 +1720,28 @@  discard block
 block discarded – undo
1720 1720
  *
1721 1721
  * @return int
1722 1722
  */
1723
-function give_get_total_post_type_count( $post_type = '', $args = array() ){
1723
+function give_get_total_post_type_count($post_type = '', $args = array()) {
1724 1724
 	global $wpdb;
1725 1725
 	$where = '';
1726 1726
 
1727
-	if( ! $post_type ) {
1727
+	if ( ! $post_type) {
1728 1728
 		return 0;
1729 1729
 	}
1730 1730
 
1731 1731
 	// Bulit where query
1732
-	if( ! empty( $post_type ) ) {
1733
-		$where.=' WHERE';
1732
+	if ( ! empty($post_type)) {
1733
+		$where .= ' WHERE';
1734 1734
 
1735
-		if( is_array( $post_type ) ) {
1736
-			$where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'";
1737
-		}else{
1735
+		if (is_array($post_type)) {
1736
+			$where .= " post_type='".implode("' OR post_type='", $post_type)."'";
1737
+		} else {
1738 1738
 			$where .= " post_type='{$post_type}'";
1739 1739
 		}
1740 1740
 	}
1741 1741
 
1742 1742
 	$result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}");
1743 1743
 
1744
-	return absint( $result );
1744
+	return absint($result);
1745 1745
 }
1746 1746
 
1747 1747
 /**
@@ -1753,9 +1753,9 @@  discard block
 block discarded – undo
1753 1753
  *
1754 1754
  * @credit WooCommerce
1755 1755
  */
1756
-function give_maybe_define_constant( $name, $value ) {
1757
-	if ( ! defined( $name ) ) {
1758
-		define( $name, $value );
1756
+function give_maybe_define_constant($name, $value) {
1757
+	if ( ! defined($name)) {
1758
+		define($name, $value);
1759 1759
 	}
1760 1760
 }
1761 1761
 
@@ -1769,8 +1769,8 @@  discard block
 block discarded – undo
1769 1769
  *
1770 1770
  * @return string
1771 1771
  */
1772
-function give_time_do_tags( $string, $timestamp = 0 ) {
1773
-	$current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' );
1772
+function give_time_do_tags($string, $timestamp = 0) {
1773
+	$current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp');
1774 1774
 
1775 1775
 	$formatted_string = str_replace(
1776 1776
 		array(
@@ -1786,15 +1786,15 @@  discard block
 block discarded – undo
1786 1786
 			'{S}'
1787 1787
 		),
1788 1788
 		array(
1789
-			date( 'j', $current_time ),
1790
-			date( 'd', $current_time ),
1791
-			date( 'n', $current_time ),
1792
-			date( 'm', $current_time ),
1793
-			date( 'Y', $current_time ),
1794
-			date( 'Y', $current_time ),
1795
-			date( 'G', $current_time ),
1796
-			date( 'H', $current_time ),
1797
-			date( 's', $current_time )
1789
+			date('j', $current_time),
1790
+			date('d', $current_time),
1791
+			date('n', $current_time),
1792
+			date('m', $current_time),
1793
+			date('Y', $current_time),
1794
+			date('Y', $current_time),
1795
+			date('G', $current_time),
1796
+			date('H', $current_time),
1797
+			date('s', $current_time)
1798 1798
 		),
1799 1799
 		$string
1800 1800
 	);
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 	 *
1805 1805
 	 * @since 2.1.0
1806 1806
 	 */
1807
-	return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp );
1807
+	return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp);
1808 1808
 }
1809 1809
 
1810 1810
 
@@ -1817,20 +1817,20 @@  discard block
 block discarded – undo
1817 1817
  *
1818 1818
  * @return bool
1819 1819
  */
1820
-function give_is_company_field_enabled( $form_id ) {
1821
-	$form_setting_val           = give_get_meta( $form_id, '_give_company_field', true );
1822
-	$global_setting_val = give_get_option( 'company_field' );
1820
+function give_is_company_field_enabled($form_id) {
1821
+	$form_setting_val = give_get_meta($form_id, '_give_company_field', true);
1822
+	$global_setting_val = give_get_option('company_field');
1823 1823
 
1824
-	if ( ! empty( $form_setting_val ) ) {
1825
-		if( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) {
1824
+	if ( ! empty($form_setting_val)) {
1825
+		if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) {
1826 1826
 			return true;
1827
-		} elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) {
1827
+		} elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val, array('required', 'optional'))) {
1828 1828
 			return true;
1829
-		} else{
1829
+		} else {
1830 1830
 			return false;
1831 1831
 		}
1832 1832
 
1833
-	} elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) {
1833
+	} elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) {
1834 1834
 		return true;
1835 1835
 
1836 1836
 	} else {
@@ -1848,13 +1848,13 @@  discard block
 block discarded – undo
1848 1848
  *
1849 1849
  * @return array
1850 1850
  */
1851
-function __give_get_active_license_info( $license_id ) {
1851
+function __give_get_active_license_info($license_id) {
1852 1852
 	global $wpdb;
1853 1853
 	$option_name = "{$license_id}_license_active";
1854 1854
 	$data        = array();
1855 1855
 
1856
-	if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) {
1857
-		$GLOBALS['give_active_licenses_info']  = array();
1856
+	if ( ! isset($GLOBALS['give_active_licenses_info'])) {
1857
+		$GLOBALS['give_active_licenses_info'] = array();
1858 1858
 
1859 1859
 		$licenses_info = $wpdb->get_results(
1860 1860
 			"
@@ -1866,16 +1866,16 @@  discard block
 block discarded – undo
1866 1866
 			ARRAY_A
1867 1867
 		);
1868 1868
 
1869
-		if ( ! empty( $licenses_info ) ) {
1869
+		if ( ! empty($licenses_info)) {
1870 1870
 			$GLOBALS['give_active_licenses_info'] = array_combine(
1871
-				wp_list_pluck( $licenses_info, 'option_name' ),
1872
-				wp_list_pluck( $licenses_info, 'option_value' )
1871
+				wp_list_pluck($licenses_info, 'option_name'),
1872
+				wp_list_pluck($licenses_info, 'option_value')
1873 1873
 			);
1874 1874
 		}
1875 1875
 	}
1876 1876
 
1877
-	if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) {
1878
-		$data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] );
1877
+	if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) {
1878
+		$data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]);
1879 1879
 	}
1880 1880
 
1881 1881
 	return $data;
@@ -1891,18 +1891,18 @@  discard block
 block discarded – undo
1891 1891
  *
1892 1892
  * @return array
1893 1893
  */
1894
-function __give_get_active_by_user_meta( $banner_addon_name ) {
1894
+function __give_get_active_by_user_meta($banner_addon_name) {
1895 1895
 	global $wpdb;
1896 1896
 
1897 1897
 	// Get the option key.
1898
-	$option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name );
1898
+	$option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name);
1899 1899
 	$data        = array();
1900 1900
 
1901 1901
 	if (
1902
-		! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] )
1903
-		|| empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] )
1902
+		! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name])
1903
+		|| empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name])
1904 1904
 	) {
1905
-		$GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array();
1905
+		$GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array();
1906 1906
 
1907 1907
 		// Get the meta of activation banner by user.
1908 1908
 		$activation_banners = $wpdb->get_results(
@@ -1915,16 +1915,16 @@  discard block
 block discarded – undo
1915 1915
 			ARRAY_A
1916 1916
 		);
1917 1917
 
1918
-		if ( ! empty( $activation_banners ) ) {
1918
+		if ( ! empty($activation_banners)) {
1919 1919
 			$GLOBALS['give_addon_activated_by_user'] = array_combine(
1920
-				wp_list_pluck( $activation_banners, 'option_name' ),
1921
-				wp_list_pluck( $activation_banners, 'option_value' )
1920
+				wp_list_pluck($activation_banners, 'option_name'),
1921
+				wp_list_pluck($activation_banners, 'option_value')
1922 1922
 			);
1923 1923
 		}
1924 1924
 	}
1925 1925
 
1926
-	if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) {
1927
-		$data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] );
1926
+	if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) {
1927
+		$data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]);
1928 1928
 	}
1929 1929
 
1930 1930
 	return $data;
@@ -1937,13 +1937,13 @@  discard block
 block discarded – undo
1937 1937
  *
1938 1938
  * @return int
1939 1939
  */
1940
-function give_get_nonce_life(){
1940
+function give_get_nonce_life() {
1941 1941
 	/**
1942 1942
 	 * Filters the lifespan of nonces in seconds.
1943 1943
 	 *
1944 1944
 	 * @see wp-inlucdes/pluggable.php:wp_nonce_tick
1945 1945
 	 */
1946
-	return (int) apply_filters( 'nonce_life', DAY_IN_SECONDS );
1946
+	return (int) apply_filters('nonce_life', DAY_IN_SECONDS);
1947 1947
 }
1948 1948
 
1949 1949
 /**
@@ -1957,11 +1957,11 @@  discard block
 block discarded – undo
1957 1957
  *
1958 1958
  * @return string
1959 1959
  */
1960
-function give_get_nonce_field( $action, $name, $referer = false ) {
1960
+function give_get_nonce_field($action, $name, $referer = false) {
1961 1961
 	return str_replace(
1962 1962
 		"id=\"{$name}\"",
1963 1963
 		'',
1964
-		wp_nonce_field( $action, $name, $referer, false )
1964
+		wp_nonce_field($action, $name, $referer, false)
1965 1965
 	);
1966 1966
 }
1967 1967
 
@@ -1974,31 +1974,31 @@  discard block
 block discarded – undo
1974 1974
  *
1975 1975
  * @return array
1976 1976
  */
1977
-function give_goal_progress_stats( $form ) {
1977
+function give_goal_progress_stats($form) {
1978 1978
 
1979
-	if ( ! $form instanceof Give_Donate_Form ) {
1980
-		$form = new Give_Donate_Form( $form );
1979
+	if ( ! $form instanceof Give_Donate_Form) {
1980
+		$form = new Give_Donate_Form($form);
1981 1981
 	}
1982 1982
 
1983 1983
 	$donors = '';
1984 1984
 
1985
-	$goal_format = give_get_form_goal_format( $form->ID );
1985
+	$goal_format = give_get_form_goal_format($form->ID);
1986 1986
 
1987 1987
 	/**
1988 1988
 	 * Filter the form.
1989 1989
 	 *
1990 1990
 	 * @since 1.8.8
1991 1991
 	 */
1992
-	$total_goal = apply_filters( 'give_goal_amount_target_output', round( give_maybe_sanitize_amount( $form->goal ) ), $form->ID, $form );
1992
+	$total_goal = apply_filters('give_goal_amount_target_output', round(give_maybe_sanitize_amount($form->goal)), $form->ID, $form);
1993 1993
 
1994
-	switch ( $goal_format ) {
1994
+	switch ($goal_format) {
1995 1995
 		case  'donation':
1996 1996
 			/**
1997 1997
 			 * Filter the form donations.
1998 1998
 			 *
1999 1999
 			 * @since 2.1
2000 2000
 			 */
2001
-			$actual = $donations = apply_filters( 'give_goal_donations_raised_output', $form->sales, $form->ID, $form );
2001
+			$actual = $donations = apply_filters('give_goal_donations_raised_output', $form->sales, $form->ID, $form);
2002 2002
 			break;
2003 2003
 		case 'donors':
2004 2004
 			/**
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
 			 *
2013 2013
 			 * @return int $donors Total number of donors that donated to the form.
2014 2014
 			 */
2015
-			$actual = $donors = apply_filters( 'give_goal_donors_target_output', give_get_form_donor_count( $form->ID ), $form->ID, $form );
2015
+			$actual = $donors = apply_filters('give_goal_donors_target_output', give_get_form_donor_count($form->ID), $form->ID, $form);
2016 2016
 			break;
2017 2017
 		default :
2018 2018
 			/**
@@ -2020,11 +2020,11 @@  discard block
 block discarded – undo
2020 2020
 			 *
2021 2021
 			 * @since 1.8.8
2022 2022
 			 */
2023
-			$actual = $income = apply_filters( 'give_goal_amount_raised_output', $form->earnings, $form->ID, $form );
2023
+			$actual = $income = apply_filters('give_goal_amount_raised_output', $form->earnings, $form->ID, $form);
2024 2024
 			break;
2025 2025
 	}
2026 2026
 
2027
-	$progress = round( ( $actual / $total_goal ) * 100, 2 );
2027
+	$progress = round(($actual / $total_goal) * 100, 2);
2028 2028
 
2029 2029
 	$stats_array = array(
2030 2030
 		'raw_actual' => $actual,
@@ -2036,20 +2036,20 @@  discard block
 block discarded – undo
2036 2036
 	 *
2037 2037
 	 * @since 1.8.8
2038 2038
 	 */
2039
-	$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form->ID, $form );
2039
+	$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form->ID, $form);
2040 2040
 
2041 2041
 	// Define Actual Goal based on the goal format.
2042
-	if ( 'percentage' === $goal_format ) {
2042
+	if ('percentage' === $goal_format) {
2043 2043
 		$actual = "{$actual}%";
2044
-	} else if ( 'amount' === $goal_format ) {
2045
-		$actual = give_currency_filter( give_format_amount( $actual ) );
2044
+	} else if ('amount' === $goal_format) {
2045
+		$actual = give_currency_filter(give_format_amount($actual));
2046 2046
 	}
2047 2047
 
2048 2048
 	// Define Total Goal based on the goal format.
2049
-	if ( 'percentage' === $goal_format ) {
2049
+	if ('percentage' === $goal_format) {
2050 2050
 		$total_goal = '';
2051
-	} else if ( 'amount' === $goal_format ) {
2052
-		$total_goal = give_currency_filter( give_format_amount( $total_goal ) );
2051
+	} else if ('amount' === $goal_format) {
2052
+		$total_goal = give_currency_filter(give_format_amount($total_goal));
2053 2053
 	}
2054 2054
 
2055 2055
 	$stats_array = array_merge(
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
 	 *
2068 2068
 	 * @since 2.1
2069 2069
 	 */
2070
-	return apply_filters( 'give_goal_progress_stats', $stats_array );
2070
+	return apply_filters('give_goal_progress_stats', $stats_array);
2071 2071
 
2072 2072
 }
2073 2073
 
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
  * @return array $message admin message key.
2080 2080
  */
2081 2081
 function give_get_admin_messages_key() {
2082
-	$messages = empty( $_GET['give-messages'] ) ? array() : give_clean( $_GET['give-messages'] );
2082
+	$messages = empty($_GET['give-messages']) ? array() : give_clean($_GET['give-messages']);
2083 2083
 
2084 2084
 	// backward compatibility.
2085
-	if ( ! empty( $_GET['give-message'] ) ) {
2086
-		$messages[] = give_clean( $_GET['give-message'] );
2085
+	if ( ! empty($_GET['give-message'])) {
2086
+		$messages[] = give_clean($_GET['give-message']);
2087 2087
 	}
2088 2088
 
2089 2089
 	/**
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 	 *
2096 2096
 	 * @return array $message admin message key.
2097 2097
 	 */
2098
-	return (array) apply_filters( 'give_get_admin_messages_key', $messages );
2098
+	return (array) apply_filters('give_get_admin_messages_key', $messages);
2099 2099
 }
2100 2100
 
2101 2101
 /**
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 function give_get_user_agent() {
2109 2109
 
2110 2110
 	// Get User Agent.
2111
-	$user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? give_clean( $_SERVER['HTTP_USER_AGENT'] ) : ''; // WPCS: input var ok.
2111
+	$user_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? give_clean($_SERVER['HTTP_USER_AGENT']) : ''; // WPCS: input var ok.
2112 2112
 
2113 2113
 	return $user_agent;
2114 2114
 
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/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/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/admin/tools/logs/class-sales-logs-list-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 	 *
158 158
 	 * @access public
159 159
 	 * @since  1.0
160
-	 * @return string|bool string If search is present, false otherwise
160
+	 * @return string|false string If search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163 163
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 		global $status, $page;
45 45
 
46 46
 		// Set parent defaults
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
50
-			'ajax'     => false,// Does this table support ajax?
51
-		) );
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
50
+			'ajax'     => false, // Does this table support ajax?
51
+		));
52 52
 
53
-		add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) );
53
+		add_action('give_log_view_actions', array($this, 'give_forms_filter'));
54 54
 	}
55 55
 
56 56
 	/**
@@ -64,66 +64,66 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
67
+	public function column_default($item, $column_name) {
68 68
 
69 69
 		/* @var Give_Payment $payment */
70
-		$payment = give_get_payment_by( 'id', $item['payment_id'] );
70
+		$payment = give_get_payment_by('id', $item['payment_id']);
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form' :
74
-				$form_title = get_the_title( $item[ $column_name ] );
75
-				$form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title;
76
-				return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . esc_html( $form_title ). '</a>';
74
+				$form_title = get_the_title($item[$column_name]);
75
+				$form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title;
76
+				return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.esc_html($form_title).'</a>';
77 77
 
78 78
 			case 'amount' :
79
-				$value = give_currency_filter( give_format_amount( $item['amount'], array( 'sanitize' => false, 'donation_id' => $item['payment_id'] ) ), array( 'currency_code' => give_get_payment_currency_code( $item['payment_id'] ) ) );
80
-				$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
79
+				$value = give_currency_filter(give_format_amount($item['amount'], array('sanitize' => false, 'donation_id' => $item['payment_id'])), array('currency_code' => give_get_payment_currency_code($item['payment_id'])));
80
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
81 81
 
82 82
 				return $value;
83 83
 
84 84
 			case 'status' :
85 85
 
86
-				$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
86
+				$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
87 87
 
88
-				if ( $payment->mode == 'test' ) {
89
-					$value .= Give()->tooltips->render_span( array(
90
-						'label'       => __( 'This donation was made in test mode.', 'give' ),
91
-						'tag_content' => __( 'Test', 'give' ),
88
+				if ($payment->mode == 'test') {
89
+					$value .= Give()->tooltips->render_span(array(
90
+						'label'       => __('This donation was made in test mode.', 'give'),
91
+						'tag_content' => __('Test', 'give'),
92 92
 						'attributes'  => array(
93 93
 							'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label',
94 94
 						),
95
-					) );
95
+					));
96 96
 				}
97 97
 
98 98
 				return $value;
99 99
 
100 100
 			case 'donation' :
101
-				$serial_code = Give()->seq_donation_number->get_serial_code( $payment );
102
-				$value = Give()->tooltips->render_link( array(
103
-					'label'       => sprintf( __( 'View Donation %s', 'give' ), $serial_code ),
101
+				$serial_code = Give()->seq_donation_number->get_serial_code($payment);
102
+				$value = Give()->tooltips->render_link(array(
103
+					'label'       => sprintf(__('View Donation %s', 'give'), $serial_code),
104 104
 					'tag_content' => $serial_code,
105
-					'link'        => esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ),
106
-				) );
105
+					'link'        => esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))),
106
+				));
107 107
 
108
-				if ( ! empty( $item['donor_id'] ) ) {
108
+				if ( ! empty($item['donor_id'])) {
109 109
 					$value .= sprintf(
110 110
 						'&nbsp;%1$s&nbsp;<a href="%2$s">%3$s</a><br>',
111
-						esc_html__( 'by', 'give' ),
112
-						admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . $item['donor_id'] ),
111
+						esc_html__('by', 'give'),
112
+						admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.$item['donor_id']),
113 113
 						$item['donor_name']
114 114
 					);
115 115
 				} else {
116 116
 					$value .= sprintf(
117 117
 						'&nbsp;%1$s&nbsp;%2$s<br>',
118
-						esc_html__( 'by', 'give' ),
119
-						__( 'No donor attached', 'give' )
120
-					);;
118
+						esc_html__('by', 'give'),
119
+						__('No donor attached', 'give')
120
+					); ;
121 121
 				}
122 122
 
123 123
 				return $value;
124 124
 
125 125
 			default:
126
-				return $item[ $column_name ];
126
+				return $item[$column_name];
127 127
 		}
128 128
 	}
129 129
 
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function get_columns() {
138 138
 		$columns = array(
139
-			'ID'       => __( 'Log ID', 'give' ),
140
-			'donation' => __( 'Donation', 'give' ),
141
-			'form'     => __( 'Form', 'give' ),
142
-			'status'   => __( 'Status', 'give' ),
143
-			'amount'   => __( 'Donation Amount', 'give' ),
144
-			'date'     => __( 'Date', 'give' ),
139
+			'ID'       => __('Log ID', 'give'),
140
+			'donation' => __('Donation', 'give'),
141
+			'form'     => __('Form', 'give'),
142
+			'status'   => __('Status', 'give'),
143
+			'amount'   => __('Donation Amount', 'give'),
144
+			'date'     => __('Date', 'give'),
145 145
 		);
146 146
 
147 147
 		return $columns;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return int Current page number
156 156
 	 */
157 157
 	public function get_paged() {
158
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
158
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return mixed int If User ID, string If Email/Login
167 167
 	 */
168 168
 	public function get_filtered_user() {
169
-		return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false;
169
+		return isset($_GET['user']) ? absint($_GET['user']) : false;
170 170
 	}
171 171
 
172 172
 	/**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return int Download ID
178 178
 	 */
179 179
 	public function get_filtered_give_form() {
180
-		return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false;
180
+		return ! empty($_GET['form']) ? absint($_GET['form']) : false;
181 181
 	}
182 182
 
183 183
 	/**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @return string|bool string If search is present, false otherwise
189 189
 	 */
190 190
 	public function get_search() {
191
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
191
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
192 192
 	}
193 193
 
194 194
 
@@ -204,19 +204,19 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @param string $which
206 206
 	 */
207
-	protected function display_tablenav( $which ) {
207
+	protected function display_tablenav($which) {
208 208
 		?>
209
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
209
+		<div class="tablenav <?php echo esc_attr($which); ?>">
210 210
 
211
-			<?php if ( 'top' === $which ) : ?>
211
+			<?php if ('top' === $which) : ?>
212 212
 				<div class="alignleft actions bulkactions">
213
-					<?php $this->bulk_actions( $which ); ?>
213
+					<?php $this->bulk_actions($which); ?>
214 214
 				</div>
215 215
 			<?php endif; ?>
216 216
 
217 217
 			<?php
218
-			$this->extra_tablenav( $which );
219
-			$this->pagination( $which );
218
+			$this->extra_tablenav($which);
219
+			$this->pagination($which);
220 220
 			?>
221 221
 
222 222
 			<br class="clear"/>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 		$meta_query = array();
243 243
 
244
-		if ( $user ) {
244
+		if ($user) {
245 245
 			// Show only logs from a specific user.
246 246
 			$meta_query[] = array(
247 247
 				'key'   => '_give_log_user_id',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			);
250 250
 		}
251 251
 
252
-		if ( $give_form ) {
252
+		if ($give_form) {
253 253
 			$meta_query[] = array(
254 254
 				'key'   => '_give_log_form_id',
255 255
 				'value' => $give_form,
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		}
258 258
 
259 259
 		$search = $this->get_search();
260
-		if ( $search ) {
261
-			if ( is_email( $search ) ) {
260
+		if ($search) {
261
+			if (is_email($search)) {
262 262
 				// This is an email search. We use this to ensure it works for guest users and logged-in users.
263 263
 				$key     = '_give_log_user_info';
264 264
 				$compare = 'LIKE';
@@ -267,32 +267,32 @@  discard block
 block discarded – undo
267 267
 				$key     = '_give_log_user_id';
268 268
 				$compare = 'LIKE';
269 269
 
270
-				if ( ! is_numeric( $search ) ) {
270
+				if ( ! is_numeric($search)) {
271 271
 					// Searching for user by username
272
-					$user = get_user_by( 'login', $search );
272
+					$user = get_user_by('login', $search);
273 273
 
274
-					if ( $user ) {
274
+					if ($user) {
275 275
 						// Found one, set meta value to user's ID.
276 276
 						$search = $user->ID;
277 277
 					} else {
278 278
 						// No user found so let's do a real search query.
279
-						$users = new WP_User_Query( array(
279
+						$users = new WP_User_Query(array(
280 280
 							'search'         => $search,
281
-							'search_columns' => array( 'user_url', 'user_nicename' ),
281
+							'search_columns' => array('user_url', 'user_nicename'),
282 282
 							'number'         => 1,
283 283
 							'fields'         => 'ids',
284
-						) );
284
+						));
285 285
 
286 286
 						$found_user = $users->get_results();
287 287
 
288
-						if ( $found_user ) {
288
+						if ($found_user) {
289 289
 							$search = $found_user[0];
290 290
 						}
291 291
 					}
292 292
 				}
293 293
 			}
294 294
 
295
-			if ( ! $this->file_search ) {
295
+			if ( ! $this->file_search) {
296 296
 				// Meta query only works for non file name search.
297 297
 				$meta_query[] = array(
298 298
 					'key'     => $key,
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * @param string $which
315 315
 	 * @return void
316 316
 	 */
317
-	function bulk_actions( $which = '' ) {
317
+	function bulk_actions($which = '') {
318 318
 		give_log_views();
319 319
 	}
320 320
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * @return void
327 327
 	 */
328 328
 	public function give_forms_filter() {
329
-		echo Give()->html->forms_dropdown( array(
329
+		echo Give()->html->forms_dropdown(array(
330 330
 			'selected' => $this->get_filtered_give_form(),
331 331
 			'name'   => 'form',
332 332
 			'id'     => 'give-log-form-filter',
333 333
 			'chosen' => true,
334
-		) );
334
+		));
335 335
 	}
336 336
 
337 337
 	/**
@@ -345,22 +345,22 @@  discard block
 block discarded – undo
345 345
 	public function get_logs() {
346 346
 		$logs_data = array();
347 347
 		$log_query = $this->get_query_params();
348
-		$logs = Give()->logs->get_connected_logs( $log_query );
348
+		$logs = Give()->logs->get_connected_logs($log_query);
349 349
 
350
-		if ( $logs ) {
351
-			foreach ( $logs as $log ) {
350
+		if ($logs) {
351
+			foreach ($logs as $log) {
352 352
 				/* @var Give_payment $payment */
353
-				$payment = new Give_Payment( $log->log_parent );
353
+				$payment = new Give_Payment($log->log_parent);
354 354
 
355 355
 				// Make sure this payment hasn't been deleted
356
-				if ( get_post( $payment->ID ) ) :
356
+				if (get_post($payment->ID)) :
357 357
 					$logs_data[] = array(
358
-						'ID'         => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>',
358
+						'ID'         => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>',
359 359
 						'payment_id' => $payment->ID,
360 360
 						'form'       => $payment->form_id,
361 361
 						'amount'     => $payment->total,
362 362
 						'donor_id'    => $payment->customer_id,
363
-						'donor_name' => trim( "{$payment->first_name} $payment->last_name" ),
363
+						'donor_name' => trim("{$payment->first_name} $payment->last_name"),
364 364
 						'date'       => $payment->date,
365 365
 					);
366 366
 
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
 		$columns               = $this->get_columns();
389 389
 		$hidden                = array();
390 390
 		$sortable              = $this->get_sortable_columns();
391
-		$this->_column_headers = array( $columns, $hidden, $sortable );
391
+		$this->_column_headers = array($columns, $hidden, $sortable);
392 392
 		$current_page          = $this->get_pagenum();
393 393
 		$this->items           = $this->get_logs();
394
-		$total_items           = Give()->logs->get_log_count( 0, 'sale', $this->get_meta_query() );
394
+		$total_items           = Give()->logs->get_log_count(0, 'sale', $this->get_meta_query());
395 395
 
396
-		$this->set_pagination_args( array(
396
+		$this->set_pagination_args(array(
397 397
 				'total_items' => $total_items,
398 398
 				'per_page'    => $this->per_page,
399
-				'total_pages' => ceil( $total_items / $this->per_page ),
399
+				'total_pages' => ceil($total_items / $this->per_page),
400 400
 			)
401 401
 		);
402 402
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-forms.php 1 patch
Spacing   +51 added lines, -51 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
 
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	public function csv_cols() {
42 42
 
43 43
 		$cols = array(
44
-			'ID'                      => __( 'ID', 'give' ),
45
-			'post_name'               => __( 'Slug', 'give' ),
46
-			'post_title'              => __( 'Name', 'give' ),
47
-			'post_date'               => __( 'Date Created', 'give' ),
48
-			'post_author'             => __( 'Author', 'give' ),
49
-			'post_content'            => __( 'Description', 'give' ),
50
-			'post_excerpt'            => __( 'Excerpt', 'give' ),
51
-			'post_status'             => __( 'Status', 'give' ),
52
-			'categories'              => __( 'Categories', 'give' ),
53
-			'tags'                    => __( 'Tags', 'give' ),
54
-			'give_price'              => __( 'Price', 'give' ),
55
-			'_thumbnail_id'           => __( 'Featured Image', 'give' ),
56
-			'_give_form_sales'        => __( 'Donations', 'give' ),
57
-			'_give_download_earnings' => __( 'Income', 'give' ),
44
+			'ID'                      => __('ID', 'give'),
45
+			'post_name'               => __('Slug', 'give'),
46
+			'post_title'              => __('Name', 'give'),
47
+			'post_date'               => __('Date Created', 'give'),
48
+			'post_author'             => __('Author', 'give'),
49
+			'post_content'            => __('Description', 'give'),
50
+			'post_excerpt'            => __('Excerpt', 'give'),
51
+			'post_status'             => __('Status', 'give'),
52
+			'categories'              => __('Categories', 'give'),
53
+			'tags'                    => __('Tags', 'give'),
54
+			'give_price'              => __('Price', 'give'),
55
+			'_thumbnail_id'           => __('Featured Image', 'give'),
56
+			'_give_form_sales'        => __('Donations', 'give'),
57
+			'_give_download_earnings' => __('Income', 'give'),
58 58
 		);
59 59
 
60 60
 		return $cols;
@@ -84,43 +84,43 @@  discard block
 block discarded – undo
84 84
 			'paged'          => $this->step
85 85
 		);
86 86
 
87
-		$forms = new WP_Query( $args );
87
+		$forms = new WP_Query($args);
88 88
 
89
-		if ( $forms->posts ) {
90
-			foreach ( $forms->posts as $form ) {
89
+		if ($forms->posts) {
90
+			foreach ($forms->posts as $form) {
91 91
 
92 92
 				$row = [];
93 93
 
94
-				foreach ( $this->csv_cols() as $key => $value ) {
94
+				foreach ($this->csv_cols() as $key => $value) {
95 95
 
96 96
 					// Setup default value/
97
-					$row[ $key ] = '';
97
+					$row[$key] = '';
98 98
 
99
-					if ( in_array( $key, $meta ) ) {
99
+					if (in_array($key, $meta)) {
100 100
 
101
-						switch ( $key ) {
101
+						switch ($key) {
102 102
 
103 103
 							case '_thumbnail_id' :
104 104
 
105
-								$image_id    = get_post_thumbnail_id( $form->ID );
106
-								$row[ $key ] = wp_get_attachment_url( $image_id );
105
+								$image_id    = get_post_thumbnail_id($form->ID);
106
+								$row[$key] = wp_get_attachment_url($image_id);
107 107
 
108 108
 								break;
109 109
 
110 110
 							case 'give_price' :
111 111
 
112
-								if ( give_has_variable_prices( $form->ID ) ) {
112
+								if (give_has_variable_prices($form->ID)) {
113 113
 
114 114
 									$prices = [];
115
-									foreach ( give_get_variable_prices( $form->ID ) as $price ) {
116
-										$prices[] = $price['name'] . ': ' . $price['amount'];
115
+									foreach (give_get_variable_prices($form->ID) as $price) {
116
+										$prices[] = $price['name'].': '.$price['amount'];
117 117
 									}
118 118
 
119
-									$row[ $key ] = implode( ' | ', $prices );
119
+									$row[$key] = implode(' | ', $prices);
120 120
 
121 121
 								} else {
122 122
 
123
-									$row[ $key ] = give_get_form_price( $form->ID );
123
+									$row[$key] = give_get_form_price($form->ID);
124 124
 
125 125
 								}
126 126
 
@@ -128,44 +128,44 @@  discard block
 block discarded – undo
128 128
 
129 129
 							default :
130 130
 
131
-								$row[ $key ] = give_get_meta( $form->ID, $key, TRUE );
131
+								$row[$key] = give_get_meta($form->ID, $key, TRUE);
132 132
 
133 133
 								break;
134 134
 
135 135
 						}
136 136
 
137
-					} elseif ( isset( $form->$key ) ) {
137
+					} elseif (isset($form->$key)) {
138 138
 
139
-						switch ( $key ) {
139
+						switch ($key) {
140 140
 
141 141
 							case 'post_author' :
142 142
 
143
-								$row[ $key ] = get_the_author_meta( 'user_login', $form->post_author );
143
+								$row[$key] = get_the_author_meta('user_login', $form->post_author);
144 144
 
145 145
 								break;
146 146
 
147 147
 							default :
148 148
 
149
-								$row[ $key ] = $form->$key;
149
+								$row[$key] = $form->$key;
150 150
 
151 151
 								break;
152 152
 						}
153 153
 
154
-					} elseif ( 'tags' == $key ) {
154
+					} elseif ('tags' == $key) {
155 155
 
156
-						$terms = get_the_terms( $form->ID, 'form_tag' );
157
-						if ( $terms ) {
158
-							$terms       = wp_list_pluck( $terms, 'name' );
159
-							$row[ $key ] = implode( ' | ', $terms );
156
+						$terms = get_the_terms($form->ID, 'form_tag');
157
+						if ($terms) {
158
+							$terms       = wp_list_pluck($terms, 'name');
159
+							$row[$key] = implode(' | ', $terms);
160 160
 						}
161 161
 
162 162
 
163
-					} elseif ( 'categories' == $key ) {
163
+					} elseif ('categories' == $key) {
164 164
 
165
-						$terms = get_the_terms( $form->ID, 'form_category' );
166
-						if ( $terms ) {
167
-							$terms       = wp_list_pluck( $terms, 'name' );
168
-							$row[ $key ] = implode( ' | ', $terms );
165
+						$terms = get_the_terms($form->ID, 'form_category');
166
+						if ($terms) {
167
+							$terms       = wp_list_pluck($terms, 'name');
168
+							$row[$key] = implode(' | ', $terms);
169 169
 						}
170 170
 
171 171
 					}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
 			}
178 178
 
179
-			$data = apply_filters( 'give_export_get_data', $data );
180
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
179
+			$data = apply_filters('give_export_get_data', $data);
180
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
181 181
 
182 182
 			return $data;
183 183
 
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$args = array(
199 199
 			'post_type'      => 'give_forms',
200
-			'posts_per_page' => - 1,
200
+			'posts_per_page' => -1,
201 201
 			'post_status'    => 'any',
202 202
 			'fields'         => 'ids',
203 203
 		);
204 204
 
205
-		$forms  = new WP_Query( $args );
205
+		$forms = new WP_Query($args);
206 206
 		$total      = (int) $forms->post_count;
207 207
 		$percentage = 100;
208 208
 
209
-		if ( $total > 0 ) {
210
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
209
+		if ($total > 0) {
210
+			$percentage = ((30 * $this->step) / $total) * 100;
211 211
 		}
212 212
 
213
-		if ( $percentage > 100 ) {
213
+		if ($percentage > 100) {
214 214
 			$percentage = 100;
215 215
 		}
216 216
 
Please login to merge, or discard this patch.
includes/class-give-license-handler.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 		 * @access private
704 704
 		 * @since  1.7
705 705
 		 *
706
-		 * @return bool
706
+		 * @return false|null
707 707
 		 */
708 708
 		private function __remove_license_key_from_subscriptions() {
709 709
 			$subscriptions = get_option( 'give_subscriptions', array() );
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		 * @param $plugin_data
737 737
 		 * @param $status
738 738
 		 *
739
-		 * @return bool
739
+		 * @return false|null
740 740
 		 */
741 741
 		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
742 742
 			// Bailout.
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		 *
759 759
 		 * @since  1.8.7
760 760
 		 * @access public
761
-		 * @return array
761
+		 * @return string
762 762
 		 */
763 763
 		public function license_state_message() {
764 764
 			$message_data = array();
Please login to merge, or discard this patch.
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_License' ) ) :
17
+if ( ! class_exists('Give_License')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_License Class
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
 		 * @param string $_checkout_url
154 154
 		 * @param string $_account_url
155 155
 		 */
156
-		public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null ) {
156
+		public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null) {
157 157
 
158 158
 			$give_options = give_get_settings();
159 159
 
160 160
 			$this->file             = $_file;
161 161
 			$this->item_name        = $_item_name;
162
-			$this->item_shortname   = self::get_short_name( $this->item_name );
162
+			$this->item_shortname   = self::get_short_name($this->item_name);
163 163
 			$this->version          = $_version;
164
-			$this->license          = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : '';
165
-			$this->license_data     = __give_get_active_license_info( $this->item_shortname );
164
+			$this->license          = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : '';
165
+			$this->license_data     = __give_get_active_license_info($this->item_shortname);
166 166
 			$this->author           = $_author;
167
-			$this->api_url          = is_null( $_api_url ) ? $this->api_url : $_api_url;
168
-			$this->checkout_url     = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url;
169
-			$this->account_url      = is_null( $_account_url ) ? $this->account_url : $_account_url;
167
+			$this->api_url          = is_null($_api_url) ? $this->api_url : $_api_url;
168
+			$this->checkout_url     = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url;
169
+			$this->account_url      = is_null($_account_url) ? $this->account_url : $_account_url;
170 170
 			$this->auto_updater_obj = null;
171 171
 
172 172
 			// Add Setting for Give Add-on activation status.
173
-			$is_addon_activated = get_option( 'give_is_addon_activated' );
174
-			if ( ! $is_addon_activated && is_object( $this ) ) {
175
-				update_option( 'give_is_addon_activated', true );
176
-				Give_Cache::set( 'give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS );
173
+			$is_addon_activated = get_option('give_is_addon_activated');
174
+			if ( ! $is_addon_activated && is_object($this)) {
175
+				update_option('give_is_addon_activated', true);
176
+				Give_Cache::set('give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS);
177 177
 			}
178 178
 
179 179
 			// Add plugin to registered licenses list.
180
-			array_push( self::$licensed_addons, plugin_basename( $this->file ) );
180
+			array_push(self::$licensed_addons, plugin_basename($this->file));
181 181
 
182 182
 			// Setup hooks
183 183
 			$this->includes();
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 		 *
197 197
 		 * @return string
198 198
 		 */
199
-		public static function get_short_name( $plugin_name ) {
200
-			$plugin_name = trim( str_replace( 'Give - ', '', $plugin_name ) );
201
-			$plugin_name = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) );
199
+		public static function get_short_name($plugin_name) {
200
+			$plugin_name = trim(str_replace('Give - ', '', $plugin_name));
201
+			$plugin_name = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name)));
202 202
 
203 203
 			return $plugin_name;
204 204
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 */
216 216
 		private function includes() {
217 217
 
218
-			if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
218
+			if ( ! class_exists('EDD_SL_Plugin_Updater')) {
219 219
 				require_once 'admin/EDD_SL_Plugin_Updater.php';
220 220
 			}
221 221
 		}
@@ -233,30 +233,30 @@  discard block
 block discarded – undo
233 233
 		private function hooks() {
234 234
 
235 235
 			// Register settings.
236
-			add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 );
236
+			add_filter('give_settings_licenses', array($this, 'settings'), 1);
237 237
 
238 238
 			// Activate license key on settings save.
239
-			add_action( 'admin_init', array( $this, 'activate_license' ), 10 );
239
+			add_action('admin_init', array($this, 'activate_license'), 10);
240 240
 
241 241
 			// Deactivate license key.
242
-			add_action( 'admin_init', array( $this, 'deactivate_license' ), 11 );
242
+			add_action('admin_init', array($this, 'deactivate_license'), 11);
243 243
 
244 244
 			// Updater.
245
-			add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
246
-			add_action( 'admin_notices', array( $this, 'notices' ) );
245
+			add_action('admin_init', array($this, 'auto_updater'), 0);
246
+			add_action('admin_notices', array($this, 'notices'));
247 247
 
248 248
 			// Check license weekly.
249
-			Give_Cron::add_weekly_event( array( $this, 'weekly_license_check' ) );
250
-			add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_license_check' ) );
249
+			Give_Cron::add_weekly_event(array($this, 'weekly_license_check'));
250
+			add_action('give_validate_license_when_site_migrated', array($this, 'weekly_license_check'));
251 251
 
252 252
 			// Check subscription weekly.
253
-			Give_Cron::add_weekly_event( array( $this, 'weekly_subscription_check' ) );
254
-			add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_subscription_check' ) );
253
+			Give_Cron::add_weekly_event(array($this, 'weekly_subscription_check'));
254
+			add_action('give_validate_license_when_site_migrated', array($this, 'weekly_subscription_check'));
255 255
 
256 256
 			// Show addon notice on plugin page.
257
-			$plugin_name = explode( 'plugins/', $this->file );
258
-			$plugin_name = end( $plugin_name );
259
-			add_action( "after_plugin_row_{$plugin_name}", array( $this, 'plugin_page_notices' ), 10, 3 );
257
+			$plugin_name = explode('plugins/', $this->file);
258
+			$plugin_name = end($plugin_name);
259
+			add_action("after_plugin_row_{$plugin_name}", array($this, 'plugin_page_notices'), 10, 3);
260 260
 
261 261
 		}
262 262
 
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
 		 *
297 297
 		 * @return array           License settings.
298 298
 		 */
299
-		public function settings( $settings ) {
299
+		public function settings($settings) {
300 300
 
301 301
 			$give_license_settings = array(
302 302
 				array(
303 303
 					'name'    => $this->item_name,
304
-					'id'      => $this->item_shortname . '_license_key',
304
+					'id'      => $this->item_shortname.'_license_key',
305 305
 					'desc'    => '',
306 306
 					'type'    => 'license_key',
307 307
 					'options' => array(
308
-						'license'      => get_option( $this->item_shortname . '_license_active' ),
308
+						'license'      => get_option($this->item_shortname.'_license_active'),
309 309
 						'shortname'    => $this->item_shortname,
310 310
 						'item_name'    => $this->item_name,
311 311
 						'api_url'      => $this->api_url,
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 				),
317 317
 			);
318 318
 
319
-			return array_merge( $settings, $give_license_settings );
319
+			return array_merge($settings, $give_license_settings);
320 320
 		}
321 321
 
322 322
 		/**
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 		 *
332 332
 		 * @return array           License settings content.
333 333
 		 */
334
-		public function license_settings_content( $settings ) {
334
+		public function license_settings_content($settings) {
335 335
 
336 336
 			$give_license_settings = array(
337 337
 				array(
338
-					'name' => __( 'Add-on Licenses', 'give' ),
338
+					'name' => __('Add-on Licenses', 'give'),
339 339
 					'desc' => '<hr>',
340 340
 					'type' => 'give_title',
341 341
 					'id'   => 'give_title',
342 342
 				),
343 343
 			);
344 344
 
345
-			return array_merge( $settings, $give_license_settings );
345
+			return array_merge($settings, $give_license_settings);
346 346
 		}
347 347
 
348 348
 		/**
@@ -357,62 +357,62 @@  discard block
 block discarded – undo
357 357
 		 */
358 358
 		public function activate_license() {
359 359
 			// Bailout.
360
-			if ( ! $this->__is_user_can_edit_license() ) {
360
+			if ( ! $this->__is_user_can_edit_license()) {
361 361
 				return;
362 362
 			}
363 363
 
364 364
 			// Allow third party addon developers to handle license activation.
365
-			if ( $this->__is_third_party_addon() ) {
366
-				do_action( 'give_activate_license', $this );
365
+			if ($this->__is_third_party_addon()) {
366
+				do_action('give_activate_license', $this);
367 367
 
368 368
 				return;
369 369
 			}
370 370
 
371 371
 			// Delete previous license setting if a empty license key submitted.
372
-			if ( empty( $_POST["{$this->item_shortname}_license_key"] ) ) {
372
+			if (empty($_POST["{$this->item_shortname}_license_key"])) {
373 373
 				$this->unset_license();
374 374
 
375 375
 				return;
376 376
 			}
377 377
 
378 378
 			// Do not simultaneously activate add-ons if the user want to deactivate a specific add-on.
379
-			if( $this->is_deactivating_license() ) {
379
+			if ($this->is_deactivating_license()) {
380 380
 				return;
381 381
 			}
382 382
 
383 383
 			// Check if plugin previously installed.
384
-			if ( $this->is_valid_license() ) {
384
+			if ($this->is_valid_license()) {
385 385
 				return;
386 386
 			}
387 387
 
388 388
 			// Get license key.
389
-			$this->license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] );
389
+			$this->license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']);
390 390
 
391 391
 			// Delete previous license key from subscription if previously added.
392 392
 			$this->__remove_license_key_from_subscriptions();
393 393
 
394 394
 			// Make sure there are no api errors.
395
-			if ( ! ( $license_data = $this->get_license_info( 'activate_license' ) ) ) {
395
+			if ( ! ($license_data = $this->get_license_info('activate_license'))) {
396 396
 				return;
397 397
 			}
398 398
 
399 399
 			// Make sure license is valid.
400 400
 			// return because admin will want to activate license again.
401
-			if ( ! $this->is_license( $license_data ) ) {
401
+			if ( ! $this->is_license($license_data)) {
402 402
 				// Add license key.
403
-				give_update_option( "{$this->item_shortname}_license_key", $this->license );
403
+				give_update_option("{$this->item_shortname}_license_key", $this->license);
404 404
 
405 405
 				return;
406 406
 			}
407 407
 
408 408
 			// Tell WordPress to look for updates.
409
-			set_site_transient( 'update_plugins', null );
409
+			set_site_transient('update_plugins', null);
410 410
 
411 411
 			// Add license data.
412
-			update_option( "{$this->item_shortname}_license_active", $license_data );
412
+			update_option("{$this->item_shortname}_license_active", $license_data);
413 413
 
414 414
 			// Add license key.
415
-			give_update_option( "{$this->item_shortname}_license_key", $this->license );
415
+			give_update_option("{$this->item_shortname}_license_key", $this->license);
416 416
 
417 417
 			// Check subscription for license key and store this to db (if any).
418 418
 			$this->__single_subscription_check();
@@ -430,19 +430,19 @@  discard block
 block discarded – undo
430 430
 		 */
431 431
 		public function deactivate_license() {
432 432
 			// Bailout.
433
-			if ( ! $this->__is_user_can_edit_license() ) {
433
+			if ( ! $this->__is_user_can_edit_license()) {
434 434
 				return;
435 435
 			}
436 436
 
437 437
 			// Allow third party add-on developers to handle license deactivation.
438
-			if ( $this->__is_third_party_addon() ) {
439
-				do_action( 'give_deactivate_license', $this );
438
+			if ($this->__is_third_party_addon()) {
439
+				do_action('give_deactivate_license', $this);
440 440
 
441 441
 				return;
442 442
 			}
443 443
 
444 444
 			// Run on deactivate button press.
445
-			if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) {
445
+			if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) {
446 446
 				$this->unset_license();
447 447
 			}
448 448
 		}
@@ -458,30 +458,30 @@  discard block
 block discarded – undo
458 458
 		public function weekly_license_check() {
459 459
 
460 460
 			if (
461
-				! empty( $_POST['give_settings'] ) ||
462
-				empty( $this->license )
461
+				! empty($_POST['give_settings']) ||
462
+				empty($this->license)
463 463
 			) {
464 464
 				return;
465 465
 			}
466 466
 
467 467
 			// Allow third party add-on developers to handle their license check.
468
-			if ( $this->__is_third_party_addon() ) {
469
-				do_action( 'give_weekly_license_check', $this );
468
+			if ($this->__is_third_party_addon()) {
469
+				do_action('give_weekly_license_check', $this);
470 470
 
471 471
 				return;
472 472
 			}
473 473
 
474 474
 			// Make sure there are no api errors.
475
-			if ( ! ( $license_data = $this->get_license_info( 'check_license' ) ) ) {
475
+			if ( ! ($license_data = $this->get_license_info('check_license'))) {
476 476
 				return;
477 477
 			}
478 478
 
479 479
 			// Bailout.
480
-			if ( ! $this->is_license( $license_data ) ) {
480
+			if ( ! $this->is_license($license_data)) {
481 481
 				return;
482 482
 			}
483 483
 
484
-			update_option( $this->item_shortname . '_license_active', $license_data );
484
+			update_option($this->item_shortname.'_license_active', $license_data);
485 485
 
486 486
 			return;
487 487
 		}
@@ -497,21 +497,21 @@  discard block
 block discarded – undo
497 497
 		public function weekly_subscription_check() {
498 498
 			// Bailout.
499 499
 			if (
500
-				! empty( $_POST['give_settings'] ) ||
501
-				empty( $this->license )
500
+				! empty($_POST['give_settings']) ||
501
+				empty($this->license)
502 502
 			) {
503 503
 				return;
504 504
 			}
505 505
 
506 506
 			// Remove old subscription data.
507
-			if ( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp', 1 ) ) {
508
-				delete_option( 'give_subscriptions' );
509
-				update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp', 1 ) ) );
507
+			if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) {
508
+				delete_option('give_subscriptions');
509
+				update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1)));
510 510
 			}
511 511
 
512 512
 			// Allow third party add-on developers to handle their subscription check.
513
-			if ( $this->__is_third_party_addon() ) {
514
-				do_action( 'give_weekly_subscription_check', $this );
513
+			if ($this->__is_third_party_addon()) {
514
+				do_action('give_weekly_subscription_check', $this);
515 515
 
516 516
 				return;
517 517
 			}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 		 * @return void
529 529
 		 */
530 530
 		private function __single_subscription_check() {
531
-			if ( empty( $this->license ) ) {
531
+			if (empty($this->license)) {
532 532
 				return;
533 533
 			}
534 534
 
@@ -539,26 +539,26 @@  discard block
 block discarded – undo
539 539
 			 * By default edd software licensing api does not have api to check subscription.
540 540
 			 * This is a custom feature to check subscriptions.
541 541
 			 */
542
-			$subscription_data = $this->get_license_info( 'check_subscription', true );
542
+			$subscription_data = $this->get_license_info('check_subscription', true);
543 543
 
544
-			if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) {
544
+			if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) {
545 545
 
546
-				$subscriptions = get_option( 'give_subscriptions', array() );
546
+				$subscriptions = get_option('give_subscriptions', array());
547 547
 
548 548
 				// Update subscription data only if subscription does not exist already.
549
-				$subscriptions[ $subscription_data['id'] ] = $subscription_data;
549
+				$subscriptions[$subscription_data['id']] = $subscription_data;
550 550
 
551 551
 				// Initiate default set of license for subscription.
552
-				if ( ! isset( $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
553
-					$subscriptions[ $subscription_data['id'] ]['licenses'] = array();
552
+				if ( ! isset($subscriptions[$subscription_data['id']]['licenses'])) {
553
+					$subscriptions[$subscription_data['id']]['licenses'] = array();
554 554
 				}
555 555
 
556 556
 				// Store licenses for subscription.
557
-				if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
558
-					$subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license;
557
+				if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) {
558
+					$subscriptions[$subscription_data['id']]['licenses'][] = $this->license;
559 559
 				}
560 560
 
561
-				update_option( 'give_subscriptions', $subscriptions );
561
+				update_option('give_subscriptions', $subscriptions);
562 562
 			}
563 563
 		}
564 564
 
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 		 */
573 573
 		public function notices() {
574 574
 
575
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
575
+			if ( ! current_user_can('manage_give_settings')) {
576 576
 				return;
577 577
 			}
578 578
 
579 579
 			// Do not show licenses notices on license tab.
580
-			if ( 'licenses' === give_get_current_setting_tab() ) {
580
+			if ('licenses' === give_get_current_setting_tab()) {
581 581
 				return;
582 582
 			}
583 583
 
@@ -586,118 +586,118 @@  discard block
 block discarded – undo
586 586
 			static $addon_license_key_in_subscriptions;
587 587
 
588 588
 			// Set default value.
589
-			$addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array();
589
+			$addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array();
590 590
 			$messages                           = array();
591 591
 
592 592
 			// Check whether admin has Give Add-on activated since 24 hours?
593
-			$is_license_notice_hidden = Give_Cache::get( 'give_cache_hide_license_notice_after_activation' );
593
+			$is_license_notice_hidden = Give_Cache::get('give_cache_hide_license_notice_after_activation');
594 594
 
595 595
 			// Display Invalid License notice, if its more than 24 hours since first Give Add-on activation.
596 596
 			if (
597
-				empty( $this->license )
598
-				&& empty( $showed_invalid_message )
599
-				&& ( false === $is_license_notice_hidden )
597
+				empty($this->license)
598
+				&& empty($showed_invalid_message)
599
+				&& (false === $is_license_notice_hidden)
600 600
 			) {
601 601
 
602
-				Give()->notices->register_notice( array(
602
+				Give()->notices->register_notice(array(
603 603
 					'id'               => 'give-invalid-license',
604 604
 					'type'             => 'error',
605 605
 					'description'      => sprintf(
606
-						__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
607
-						admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
606
+						__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
607
+						admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
608 608
 					),
609 609
 					'dismissible_type' => 'user',
610 610
 					'dismiss_interval' => 'shortly',
611
-				) );
611
+				));
612 612
 
613 613
 				$showed_invalid_message = true;
614 614
 
615 615
 			}
616 616
 
617 617
 			// Get subscriptions.
618
-			$subscriptions = get_option( 'give_subscriptions' );
618
+			$subscriptions = get_option('give_subscriptions');
619 619
 
620 620
 			// Show subscription messages.
621
-			if ( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) {
621
+			if ( ! empty($subscriptions) && ! $showed_subscriptions_message) {
622 622
 
623
-				foreach ( $subscriptions as $subscription ) {
623
+				foreach ($subscriptions as $subscription) {
624 624
 					// Subscription expires timestamp.
625
-					$subscription_expires = strtotime( $subscription['expires'] );
625
+					$subscription_expires = strtotime($subscription['expires']);
626 626
 
627 627
 					// Start showing subscriptions message before one week of renewal date.
628
-					if ( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) {
628
+					if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) {
629 629
 						continue;
630 630
 					}
631 631
 
632 632
 					// Check if subscription message already exist in messages.
633
-					if ( array_key_exists( $subscription['id'], $messages ) ) {
633
+					if (array_key_exists($subscription['id'], $messages)) {
634 634
 						continue;
635 635
 					}
636 636
 
637 637
 					// Check if license already expired.
638
-					if ( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) {
639
-						Give()->notices->register_notice( array(
638
+					if (strtotime($subscription['expires']) < current_time('timestamp', 1)) {
639
+						Give()->notices->register_notice(array(
640 640
 							'id'               => "give-expired-subscription-{$subscription['id']}",
641 641
 							'type'             => 'error',
642 642
 							'description'      => sprintf(
643
-								__( 'Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give' ),
644
-								urldecode( $subscription['invoice_url'] ),
643
+								__('Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give'),
644
+								urldecode($subscription['invoice_url']),
645 645
 								$subscription['payment_id'],
646 646
 								"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
647
-								Give()->notices->get_dismiss_link( array(
648
-									'title'            => __( 'Click here if already renewed', 'give' ),
647
+								Give()->notices->get_dismiss_link(array(
648
+									'title'            => __('Click here if already renewed', 'give'),
649 649
 									'dismissible_type' => 'user',
650 650
 									'dismiss_interval' => 'permanent',
651
-								) )
651
+								))
652 652
 							),
653 653
 							'dismissible_type' => 'user',
654 654
 							'dismiss_interval' => 'shortly',
655
-						) );
655
+						));
656 656
 					} else {
657
-						Give()->notices->register_notice( array(
657
+						Give()->notices->register_notice(array(
658 658
 							'id'               => "give-expires-subscription-{$subscription['id']}",
659 659
 							'type'             => 'error',
660 660
 							'description'      => sprintf(
661
-								__( 'Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give' ),
662
-								human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ),
663
-								urldecode( $subscription['invoice_url'] ),
661
+								__('Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give'),
662
+								human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])),
663
+								urldecode($subscription['invoice_url']),
664 664
 								$subscription['payment_id'],
665 665
 								"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
666
-								Give()->notices->get_dismiss_link( array(
667
-									'title'            => __( 'Click here if already renewed', 'give' ),
666
+								Give()->notices->get_dismiss_link(array(
667
+									'title'            => __('Click here if already renewed', 'give'),
668 668
 									'dismissible_type' => 'user',
669 669
 									'dismiss_interval' => 'permanent',
670
-								) )
670
+								))
671 671
 							),
672 672
 							'dismissible_type' => 'user',
673 673
 							'dismiss_interval' => 'shortly',
674
-						) );
674
+						));
675 675
 					}
676 676
 
677 677
 					// Stop validation for these license keys.
678
-					$addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] );
678
+					$addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']);
679 679
 				}// End foreach().
680 680
 				$showed_subscriptions_message = true;
681 681
 			}// End if().
682 682
 
683 683
 			// Show Non Subscription Give Add-on messages.
684 684
 			if (
685
-				! in_array( $this->license, $addon_license_key_in_subscriptions )
686
-				&& ! empty( $this->license )
687
-				&& empty( $showed_invalid_message )
685
+				! in_array($this->license, $addon_license_key_in_subscriptions)
686
+				&& ! empty($this->license)
687
+				&& empty($showed_invalid_message)
688 688
 				&& ! $this->is_valid_license()
689 689
 			) {
690 690
 
691
-				Give()->notices->register_notice( array(
691
+				Give()->notices->register_notice(array(
692 692
 					'id'               => 'give-invalid-license',
693 693
 					'type'             => 'error',
694 694
 					'description'      => sprintf(
695
-						__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
696
-						admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
695
+						__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
696
+						admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
697 697
 					),
698 698
 					'dismissible_type' => 'user',
699 699
 					'dismiss_interval' => 'shortly',
700
-				) );
700
+				));
701 701
 
702 702
 				$showed_invalid_message = true;
703 703
 
@@ -714,10 +714,10 @@  discard block
 block discarded – undo
714 714
 		 *
715 715
 		 * @return bool
716 716
 		 */
717
-		public function is_valid_license( $licence_data = null ) {
718
-			$license_data = empty( $licence_data ) ? $this->license_data : $licence_data;
717
+		public function is_valid_license($licence_data = null) {
718
+			$license_data = empty($licence_data) ? $this->license_data : $licence_data;
719 719
 
720
-			if ( apply_filters( 'give_is_valid_license', ( $this->is_license( $license_data ) && 'valid' === $license_data->license ) ) ) {
720
+			if (apply_filters('give_is_valid_license', ($this->is_license($license_data) && 'valid' === $license_data->license))) {
721 721
 				return true;
722 722
 			}
723 723
 
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 		 *
736 736
 		 * @return bool
737 737
 		 */
738
-		public function is_license( $licence_data = null ) {
739
-			$license_data = empty( $licence_data ) ? $this->license_data : $licence_data;
738
+		public function is_license($licence_data = null) {
739
+			$license_data = empty($licence_data) ? $this->license_data : $licence_data;
740 740
 
741
-			if ( apply_filters( 'give_is_license', ( is_object( $license_data ) && ! empty( $license_data ) && property_exists( $license_data, 'license' ) ) ) ) {
741
+			if (apply_filters('give_is_license', (is_object($license_data) && ! empty($license_data) && property_exists($license_data, 'license')))) {
742 742
 				return true;
743 743
 			}
744 744
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		 * @return bool
755 755
 		 */
756 756
 		private function __is_third_party_addon() {
757
-			return ( false === strpos( $this->api_url, 'givewp.com/' ) );
757
+			return (false === strpos($this->api_url, 'givewp.com/'));
758 758
 		}
759 759
 
760 760
 		/**
@@ -769,25 +769,25 @@  discard block
 block discarded – undo
769 769
 		 * @return bool
770 770
 		 */
771 771
 		private function __remove_license_key_from_subscriptions() {
772
-			$subscriptions = get_option( 'give_subscriptions', array() );
772
+			$subscriptions = get_option('give_subscriptions', array());
773 773
 
774 774
 			// Bailout.
775
-			if ( empty( $this->license ) ) {
775
+			if (empty($this->license)) {
776 776
 				return false;
777 777
 			}
778 778
 
779
-			if ( ! empty( $subscriptions ) ) {
780
-				foreach ( $subscriptions as $subscription_id => $subscription ) {
781
-					$license_index = array_search( $this->license, $subscription['licenses'] );
782
-					if ( false !== $license_index ) {
779
+			if ( ! empty($subscriptions)) {
780
+				foreach ($subscriptions as $subscription_id => $subscription) {
781
+					$license_index = array_search($this->license, $subscription['licenses']);
782
+					if (false !== $license_index) {
783 783
 						// Remove license key.
784
-						unset( $subscriptions[ $subscription_id ]['licenses'][ $license_index ] );
784
+						unset($subscriptions[$subscription_id]['licenses'][$license_index]);
785 785
 
786 786
 						// Rearrange license keys.
787
-						$subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] );
787
+						$subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']);
788 788
 
789 789
 						// Update subscription information.
790
-						update_option( 'give_subscriptions', $subscriptions );
790
+						update_option('give_subscriptions', $subscriptions);
791 791
 						break;
792 792
 					}
793 793
 				}
@@ -801,17 +801,17 @@  discard block
 block discarded – undo
801 801
 		 *
802 802
 		 * @return bool
803 803
 		 */
804
-		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
804
+		public function plugin_page_notices($plugin_file, $plugin_data, $status) {
805 805
 			// Bailout.
806
-			if ( $this->is_valid_license() ) {
806
+			if ($this->is_valid_license()) {
807 807
 				return false;
808 808
 			}
809 809
 
810 810
 			$update_notice_wrap = '<tr class="give-addon-notice-tr active"><td colspan="3" class="colspanchange"><div class="notice inline notice-warning notice-alt give-invalid-license"><p><span class="dashicons dashicons-info"></span> %s</p></div></td></tr>';
811 811
 			$message            = $this->license_state_message();
812 812
 
813
-			if ( ! empty( $message['message'] ) ) {
814
-				echo sprintf( $update_notice_wrap, $message['message'] );
813
+			if ( ! empty($message['message'])) {
814
+				echo sprintf($update_notice_wrap, $message['message']);
815 815
 			}
816 816
 		}
817 817
 
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 		public function license_state_message() {
827 827
 			$message_data = array();
828 828
 
829
-			if ( ! $this->is_valid_license() ) {
829
+			if ( ! $this->is_valid_license()) {
830 830
 
831 831
 				$message_data['message'] = sprintf(
832 832
 					'Please <a href="%1$s">activate your license</a> to receive updates and support for the %2$s add-on.',
833
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) ),
833
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')),
834 834
 					$this->item_name
835 835
 				);
836 836
 			}
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 			// Bailout.
850 850
 			if (
851 851
 				! Give_Admin_Settings::verify_nonce() ||
852
-				! current_user_can( 'manage_give_settings' ) ||
852
+				! current_user_can('manage_give_settings') ||
853 853
 				'licenses' !== give_get_current_setting_tab()
854 854
 			) {
855 855
 				return false;
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
 
858 858
 			// Security check.
859 859
 			if (
860
-				isset( $_POST[ $this->item_shortname . '_license_key-nonce' ] ) &&
861
-				! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' )
860
+				isset($_POST[$this->item_shortname.'_license_key-nonce']) &&
861
+				! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')
862 862
 			) {
863
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
863
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
864 864
 			}
865 865
 
866 866
 			return true;
@@ -878,9 +878,9 @@  discard block
 block discarded – undo
878 878
 		 *
879 879
 		 * @return mixed
880 880
 		 */
881
-		public function get_license_info( $edd_action = '', $response_in_array = false ) {
881
+		public function get_license_info($edd_action = '', $response_in_array = false) {
882 882
 
883
-			if ( empty( $edd_action ) ) {
883
+			if (empty($edd_action)) {
884 884
 				return false;
885 885
 			}
886 886
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 			$api_params = array(
889 889
 				'edd_action' => $edd_action, // never change from "edd_" to "give_"!
890 890
 				'license'    => $this->license,
891
-				'item_name'  => urlencode( $this->item_name ),
891
+				'item_name'  => urlencode($this->item_name),
892 892
 				'url'        => home_url(),
893 893
 			);
894 894
 
@@ -903,11 +903,11 @@  discard block
 block discarded – undo
903 903
 			);
904 904
 
905 905
 			// Make sure there are no errors.
906
-			if ( is_wp_error( $response ) ) {
906
+			if (is_wp_error($response)) {
907 907
 				return false;
908 908
 			}
909 909
 
910
-			return json_decode( wp_remote_retrieve_body( $response ), $response_in_array );
910
+			return json_decode(wp_remote_retrieve_body($response), $response_in_array);
911 911
 		}
912 912
 
913 913
 
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
 			$this->__remove_license_key_from_subscriptions();
924 924
 
925 925
 			// Remove license from database.
926
-			delete_option( "{$this->item_shortname}_license_active" );
927
-			give_delete_option( "{$this->item_shortname}_license_key" );
928
-			unset( $_POST["{$this->item_shortname}_license_key"] );
926
+			delete_option("{$this->item_shortname}_license_active");
927
+			give_delete_option("{$this->item_shortname}_license_key");
928
+			unset($_POST["{$this->item_shortname}_license_key"]);
929 929
 
930 930
 			// Unset license param.
931 931
 			$this->license = '';
@@ -943,8 +943,8 @@  discard block
 block discarded – undo
943 943
 		private function is_deactivating_license() {
944 944
 			$status = false;
945 945
 
946
-			foreach ( $_POST as $key => $value ) {
947
-				if ( false !== strpos( $key, 'license_key_deactivate' ) ) {
946
+			foreach ($_POST as $key => $value) {
947
+				if (false !== strpos($key, 'license_key_deactivate')) {
948 948
 					$status = true;
949 949
 					break;
950 950
 				}
Please login to merge, or discard this patch.