Test Failed
Pull Request — master (#2854)
by Devin
05:38
created
includes/formatting.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -340,7 +340,7 @@
 block discarded – undo
340 340
  * @since 1.0
341 341
  *
342 342
  * @param int|float|string $amount   Formatted or sanitized price
343
- * @param int|bool         $dp       number of decimals
343
+ * @param boolean         $dp       number of decimals
344 344
  * @param bool             $sanitize Whether or not sanitize number
345 345
  *
346 346
  * @return string $amount Newly formatted amount or Price Not Available
Please login to merge, or discard this patch.
Spacing   +185 added lines, -189 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,37 +23,37 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return mixed
25 25
  */
26
-function give_get_currency_formatting_settings( $id_or_currency_code = null ) {
26
+function give_get_currency_formatting_settings($id_or_currency_code = null) {
27 27
 	$give_options = give_get_settings();
28 28
 	$setting      = array();
29 29
 
30
-	if ( ! empty( $id_or_currency_code ) ) {
31
-		$currencies = give_get_currencies( 'all' );
30
+	if ( ! empty($id_or_currency_code)) {
31
+		$currencies = give_get_currencies('all');
32 32
 
33 33
 		// Set default formatting setting only if currency not set as global currency.
34 34
 		if (
35
-			is_string( $id_or_currency_code ) &&
36
-			! empty( $give_options['currency'] ) &&
35
+			is_string($id_or_currency_code) &&
36
+			! empty($give_options['currency']) &&
37 37
 			$id_or_currency_code !== $give_options['currency'] &&
38
-			array_key_exists( $id_or_currency_code, $currencies )
38
+			array_key_exists($id_or_currency_code, $currencies)
39 39
 		) {
40
-			$setting = $currencies[ $id_or_currency_code ]['setting'];
41
-		} elseif ( is_numeric( $id_or_currency_code ) && 'give_payment' === get_post_type( $id_or_currency_code ) ) {
42
-			$donation_meta = give_get_meta( $id_or_currency_code, '_give_payment_meta', true );
40
+			$setting = $currencies[$id_or_currency_code]['setting'];
41
+		} elseif (is_numeric($id_or_currency_code) && 'give_payment' === get_post_type($id_or_currency_code)) {
42
+			$donation_meta = give_get_meta($id_or_currency_code, '_give_payment_meta', true);
43 43
 
44 44
 			if (
45
-				! empty( $donation_meta['currency'] ) &&
45
+				! empty($donation_meta['currency']) &&
46 46
 				$give_options['currency'] !== $donation_meta['currency']
47 47
 			) {
48
-				$setting = $currencies[ $donation_meta['currency'] ]['setting'];
48
+				$setting = $currencies[$donation_meta['currency']]['setting'];
49 49
 			}
50 50
 		}
51 51
 	}
52 52
 
53
-	if ( empty( $setting ) ) {
53
+	if (empty($setting)) {
54 54
 		// Set thousand separator.
55
-		$thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
56
-		$thousand_separator = empty( $thousand_separator ) ? ' ' : $thousand_separator;
55
+		$thousand_separator = isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',';
56
+		$thousand_separator = empty($thousand_separator) ? ' ' : $thousand_separator;
57 57
 
58 58
 		// Set decimal separator.
59 59
 		$default_decimal_separators = array(
@@ -61,17 +61,16 @@  discard block
 block discarded – undo
61 61
 			',' => '.',
62 62
 		);
63 63
 
64
-		$default_decimal_separator = in_array( $thousand_separator, $default_decimal_separators ) ?
65
-			$default_decimal_separators[ $thousand_separator ] :
66
-			'.';
64
+		$default_decimal_separator = in_array($thousand_separator, $default_decimal_separators) ?
65
+			$default_decimal_separators[$thousand_separator] : '.';
67 66
 
68
-		$decimal_separator = ! empty( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : $default_decimal_separator;
67
+		$decimal_separator = ! empty($give_options['decimal_separator']) ? $give_options['decimal_separator'] : $default_decimal_separator;
69 68
 
70 69
 		$setting = array(
71
-			'currency_position'   => give_get_option( 'currency_position', 'before' ),
70
+			'currency_position'   => give_get_option('currency_position', 'before'),
72 71
 			'thousands_separator' => $thousand_separator,
73 72
 			'decimal_separator'   => $decimal_separator,
74
-			'number_decimals'     => give_get_option( 'number_decimals', 0 ),
73
+			'number_decimals'     => give_get_option('number_decimals', 0),
75 74
 		);
76 75
 	}
77 76
 
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
 	 *
81 80
 	 * @since 1.8.15
82 81
 	 */
83
-	return apply_filters( 'give_get_currency_formatting_settings', $setting, $id_or_currency_code );
82
+	return apply_filters('give_get_currency_formatting_settings', $setting, $id_or_currency_code);
84 83
 }
85 84
 
86 85
 /**
@@ -92,16 +91,16 @@  discard block
 block discarded – undo
92 91
  *
93 92
  * @return mixed
94 93
  */
95
-function give_get_price_decimals( $id_or_currency_code = null ) {
94
+function give_get_price_decimals($id_or_currency_code = null) {
96 95
 	// Set currency on basis of donation id.
97
-	if ( empty( $id_or_currency_code ) ) {
96
+	if (empty($id_or_currency_code)) {
98 97
 		$id_or_currency_code = give_get_currency();
99 98
 	}
100 99
 
101 100
 	$number_of_decimals = 0;
102 101
 
103
-	if ( ! give_is_zero_based_currency( $id_or_currency_code ) ) {
104
-		$setting            = give_get_currency_formatting_settings( $id_or_currency_code );
102
+	if ( ! give_is_zero_based_currency($id_or_currency_code)) {
103
+		$setting            = give_get_currency_formatting_settings($id_or_currency_code);
105 104
 		$number_of_decimals = $setting['number_decimals'];
106 105
 	}
107 106
 
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
 	 *
111 110
 	 * @since 1.6
112 111
 	 */
113
-	return apply_filters( 'give_sanitize_amount_decimals', $number_of_decimals, $id_or_currency_code );
112
+	return apply_filters('give_sanitize_amount_decimals', $number_of_decimals, $id_or_currency_code);
114 113
 }
115 114
 
116 115
 /**
@@ -122,15 +121,15 @@  discard block
 block discarded – undo
122 121
  *
123 122
  * @return mixed
124 123
  */
125
-function give_get_price_thousand_separator( $id_or_currency_code = null ) {
126
-	$setting = give_get_currency_formatting_settings( $id_or_currency_code );
124
+function give_get_price_thousand_separator($id_or_currency_code = null) {
125
+	$setting = give_get_currency_formatting_settings($id_or_currency_code);
127 126
 
128 127
 	/**
129 128
 	 * Filter the thousand separator
130 129
 	 *
131 130
 	 * @since 1.6
132 131
 	 */
133
-	return apply_filters( 'give_get_price_thousand_separator', $setting['thousands_separator'], $id_or_currency_code );
132
+	return apply_filters('give_get_price_thousand_separator', $setting['thousands_separator'], $id_or_currency_code);
134 133
 }
135 134
 
136 135
 /**
@@ -142,15 +141,15 @@  discard block
 block discarded – undo
142 141
  *
143 142
  * @return mixed
144 143
  */
145
-function give_get_price_decimal_separator( $id_or_currency_code = null ) {
146
-	$setting = give_get_currency_formatting_settings( $id_or_currency_code );
144
+function give_get_price_decimal_separator($id_or_currency_code = null) {
145
+	$setting = give_get_currency_formatting_settings($id_or_currency_code);
147 146
 
148 147
 	/**
149 148
 	 * Filter the thousand separator
150 149
 	 *
151 150
 	 * @since 1.6
152 151
 	 */
153
-	return apply_filters( 'give_get_price_decimal_separator', $setting['decimal_separator'], $id_or_currency_code );
152
+	return apply_filters('give_get_price_decimal_separator', $setting['decimal_separator'], $id_or_currency_code);
154 153
 }
155 154
 
156 155
 
@@ -163,8 +162,8 @@  discard block
 block discarded – undo
163 162
  *
164 163
  * @return string $amount Newly sanitized amount
165 164
  */
166
-function give_sanitize_amount_for_db( $number ) {
167
-	return give_maybe_sanitize_amount( $number, array( 'number_decimals' => 6 ) );
165
+function give_sanitize_amount_for_db($number) {
166
+	return give_maybe_sanitize_amount($number, array('number_decimals' => 6));
168 167
 }
169 168
 
170 169
 /**
@@ -177,19 +176,19 @@  discard block
 block discarded – undo
177 176
  *
178 177
  * @return string $amount Newly sanitized amount
179 178
  */
180
-function give_maybe_sanitize_amount( $number, $args = array() ) {
179
+function give_maybe_sanitize_amount($number, $args = array()) {
181 180
 	// Bailout.
182
-	if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) {
181
+	if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) {
183 182
 		return $number;
184 183
 	}
185 184
 
186 185
 	$func_args = func_get_args();
187 186
 
188 187
 	// Backward compatibility.
189
-	if ( isset( $func_args[1] ) && ( is_bool( $func_args[1] ) || is_numeric( $func_args[1] ) ) ) {
188
+	if (isset($func_args[1]) && (is_bool($func_args[1]) || is_numeric($func_args[1]))) {
190 189
 		$args = array(
191 190
 			'number_decimals' => $func_args[1],
192
-			'trim_zeros'      => isset( $func_args[2] ) ? $func_args[2] : false,
191
+			'trim_zeros'      => isset($func_args[2]) ? $func_args[2] : false,
193 192
 		);
194 193
 	}
195 194
 
@@ -202,23 +201,22 @@  discard block
 block discarded – undo
202 201
 		)
203 202
 	);
204 203
 
205
-	$thousand_separator = give_get_price_thousand_separator( $args['currency'] );
206
-	$decimal_separator  = give_get_price_decimal_separator( $args['currency'] );
207
-	$number_decimals    = is_bool( $args['number_decimals'] ) ?
208
-		give_get_price_decimals() :
209
-		$args['number_decimals'];
204
+	$thousand_separator = give_get_price_thousand_separator($args['currency']);
205
+	$decimal_separator  = give_get_price_decimal_separator($args['currency']);
206
+	$number_decimals    = is_bool($args['number_decimals']) ?
207
+		give_get_price_decimals() : $args['number_decimals'];
210 208
 
211 209
 	// Explode number by . decimal separator.
212
-	$number_parts = explode( '.', $number );
210
+	$number_parts = explode('.', $number);
213 211
 
214 212
 	// Remove currency symbols from number if any.
215
-	$number = trim( str_replace( give_currency_symbols( true ), '', $number ) );
213
+	$number = trim(str_replace(give_currency_symbols(true), '', $number));
216 214
 
217 215
 	if (
218 216
 		// Non formatted number.
219 217
 		(
220
-			( false === strpos( $number, $thousand_separator ) ) &&
221
-			( false === strpos( $number, $decimal_separator ) )
218
+			(false === strpos($number, $thousand_separator)) &&
219
+			(false === strpos($number, $decimal_separator))
222 220
 		) ||
223 221
 
224 222
 		// Decimal formatted number.
@@ -228,35 +226,35 @@  discard block
 block discarded – undo
228 226
 		(
229 227
 			$number_decimals &&
230 228
 			'.' === $thousand_separator &&
231
-			false !== strpos( $number, $thousand_separator ) &&
232
-			false === strpos( $number, $decimal_separator ) &&
233
-			2 === count( $number_parts ) &&
234
-			( $number_decimals >= strlen( $number_parts[1] ) )
229
+			false !== strpos($number, $thousand_separator) &&
230
+			false === strpos($number, $decimal_separator) &&
231
+			2 === count($number_parts) &&
232
+			($number_decimals >= strlen($number_parts[1]))
235 233
 		)
236 234
 	) {
237
-		return number_format( $number, $number_decimals, '.', '' );
235
+		return number_format($number, $number_decimals, '.', '');
238 236
 	}
239 237
 
240 238
 	// Handle thousand separator as '.'
241 239
 	// Handle sanitize database values.
242
-	$is_db_sanitize_val = ( 2 === count( $number_parts ) &&
243
-							is_numeric( $number_parts[0] ) &&
244
-							is_numeric( $number_parts[1] ) &&
245
-							( 6 === strlen( $number_parts[1] ) ) );
240
+	$is_db_sanitize_val = (2 === count($number_parts) &&
241
+							is_numeric($number_parts[0]) &&
242
+							is_numeric($number_parts[1]) &&
243
+							(6 === strlen($number_parts[1])));
246 244
 
247
-	if ( $is_db_sanitize_val ) {
245
+	if ($is_db_sanitize_val) {
248 246
 		// Sanitize database value.
249
-		return number_format( $number, $number_decimals, '.', '' );
247
+		return number_format($number, $number_decimals, '.', '');
250 248
 
251 249
 	} elseif (
252 250
 		'.' === $thousand_separator &&
253
-		false !== strpos( $number, $thousand_separator )
251
+		false !== strpos($number, $thousand_separator)
254 252
 	) {
255 253
 		// Fix point thousand separator value.
256
-		$number = str_replace( '.', '', $number );
254
+		$number = str_replace('.', '', $number);
257 255
 	}
258 256
 
259
-	return give_sanitize_amount( $number, $args );
257
+	return give_sanitize_amount($number, $args);
260 258
 }
261 259
 
262 260
 /**
@@ -273,10 +271,10 @@  discard block
 block discarded – undo
273 271
  *
274 272
  * @return string $amount Newly sanitized amount
275 273
  */
276
-function give_sanitize_amount( $number, $args = array() ) {
274
+function give_sanitize_amount($number, $args = array()) {
277 275
 
278 276
 	// Bailout.
279
-	if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) {
277
+	if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) {
280 278
 		return $number;
281 279
 	}
282 280
 
@@ -284,10 +282,10 @@  discard block
 block discarded – undo
284 282
 	$func_args = func_get_args();
285 283
 
286 284
 	// Backward compatibility.
287
-	if ( isset( $func_args[1] ) && ( is_bool( $func_args[1] ) || is_numeric( $func_args[1] ) ) ) {
285
+	if (isset($func_args[1]) && (is_bool($func_args[1]) || is_numeric($func_args[1]))) {
288 286
 		$args = array(
289 287
 			'number_decimals' => $func_args[1],
290
-			'trim_zeros'      => isset( $func_args[2] ) ? $func_args[2] : false,
288
+			'trim_zeros'      => isset($func_args[2]) ? $func_args[2] : false,
291 289
 		);
292 290
 	}
293 291
 
@@ -303,58 +301,58 @@  discard block
 block discarded – undo
303 301
 	// Remove slash from amount.
304 302
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
305 303
 	// To prevent notices and warning remove slash from amount/number.
306
-	$number = wp_unslash( $number );
304
+	$number = wp_unslash($number);
307 305
 
308
-	$thousand_separator = give_get_price_thousand_separator( $args['currency'] );
306
+	$thousand_separator = give_get_price_thousand_separator($args['currency']);
309 307
 
310 308
 	$locale   = localeconv();
311 309
 	$decimals = array(
312
-		give_get_price_decimal_separator( $args['currency'] ),
310
+		give_get_price_decimal_separator($args['currency']),
313 311
 		$locale['decimal_point'],
314 312
 		$locale['mon_decimal_point'],
315 313
 	);
316 314
 
317 315
 	// Remove locale from string
318
-	if ( ! is_float( $number ) ) {
319
-		$number = str_replace( $decimals, '.', $number );
316
+	if ( ! is_float($number)) {
317
+		$number = str_replace($decimals, '.', $number);
320 318
 	}
321 319
 
322 320
 	// Remove thousand amount formatting if amount has.
323 321
 	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
324 322
 	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
325
-	if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
326
-		$number = str_replace( $thousand_separator, '', $number );
327
-	} elseif ( in_array( $thousand_separator, $decimals ) ) {
328
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
323
+	if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
324
+		$number = str_replace($thousand_separator, '', $number);
325
+	} elseif (in_array($thousand_separator, $decimals)) {
326
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
329 327
 	}
330 328
 
331 329
 	// Remove non numeric entity before decimal separator.
332
-	$number     = preg_replace( '/[^0-9\.]/', '', $number );
333
-	$default_dp = give_get_price_decimals( $args['currency'] );
330
+	$number     = preg_replace('/[^0-9\.]/', '', $number);
331
+	$default_dp = give_get_price_decimals($args['currency']);
334 332
 
335 333
 	// Reset negative amount to zero.
336
-	if ( 0 > $number ) {
337
-		$number = number_format( 0, $default_dp, '.' );
334
+	if (0 > $number) {
335
+		$number = number_format(0, $default_dp, '.');
338 336
 	}
339 337
 
340 338
 	// If number does not have decimal then add number of decimals to it.
341 339
 	if (
342
-		false === strpos( $number, '.' )
343
-		|| ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) )
340
+		false === strpos($number, '.')
341
+		|| ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
344 342
 	) {
345
-		$number = number_format( $number, $default_dp, '.', '' );
343
+		$number = number_format($number, $default_dp, '.', '');
346 344
 	}
347 345
 
348 346
 	// Format number by custom number of decimals.
349
-	if ( false !== $args['number_decimals'] ) {
350
-		$dp     = intval( is_bool( $args['number_decimals'] ) ? $default_dp : $args['number_decimals'] );
351
-		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
352
-		$number = number_format( floatval( $number ), $dp, '.', '' );
347
+	if (false !== $args['number_decimals']) {
348
+		$dp     = intval(is_bool($args['number_decimals']) ? $default_dp : $args['number_decimals']);
349
+		$dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
350
+		$number = number_format(floatval($number), $dp, '.', '');
353 351
 	}
354 352
 
355 353
 	// Trim zeros.
356
-	if ( $args['trim_zeros'] && strstr( $number, '.' ) ) {
357
-		$number = rtrim( rtrim( $number, '0' ), '.' );
354
+	if ($args['trim_zeros'] && strstr($number, '.')) {
355
+		$number = rtrim(rtrim($number, '0'), '.');
358 356
 	}
359 357
 
360 358
 	/**
@@ -362,7 +360,7 @@  discard block
 block discarded – undo
362 360
 	 *
363 361
 	 * @since 1.0
364 362
 	 */
365
-	return apply_filters( 'give_sanitize_amount', $number );
363
+	return apply_filters('give_sanitize_amount', $number);
366 364
 }
367 365
 
368 366
 /**
@@ -375,9 +373,9 @@  discard block
 block discarded – undo
375 373
  *
376 374
  * @return string $amount   Newly formatted amount or Price Not Available
377 375
  */
378
-function give_format_amount( $amount, $args = array() ) {
376
+function give_format_amount($amount, $args = array()) {
379 377
 	// Backward compatibility.
380
-	if ( is_bool( $args ) ) {
378
+	if (is_bool($args)) {
381 379
 		$args = array(
382 380
 			'decimal' => $args,
383 381
 		);
@@ -390,61 +388,60 @@  discard block
 block discarded – undo
390 388
 		'currency'    => '',
391 389
 	);
392 390
 
393
-	$args = wp_parse_args( $args, $default_args );
391
+	$args = wp_parse_args($args, $default_args);
394 392
 
395 393
 	// Set Currency based on donation id, if required.
396
-	if ( $args['donation_id'] && empty( $args['currency'] ) ) {
397
-		$donation_meta    = give_get_meta( $args['donation_id'], '_give_payment_meta', true );
394
+	if ($args['donation_id'] && empty($args['currency'])) {
395
+		$donation_meta    = give_get_meta($args['donation_id'], '_give_payment_meta', true);
398 396
 		$args['currency'] = $donation_meta['currency'];
399 397
 	}
400 398
 
401 399
 	$formatted     = 0;
402
-	$currency      = ! empty( $args['currency'] ) ? $args['currency'] : give_get_currency( $args['donation_id'] );
403
-	$thousands_sep = give_get_price_thousand_separator( $currency );
404
-	$decimal_sep   = give_get_price_decimal_separator( $currency );
405
-	$decimals      = ! empty( $args['decimal'] ) ? give_get_price_decimals( $currency ) : 0;
400
+	$currency      = ! empty($args['currency']) ? $args['currency'] : give_get_currency($args['donation_id']);
401
+	$thousands_sep = give_get_price_thousand_separator($currency);
402
+	$decimal_sep   = give_get_price_decimal_separator($currency);
403
+	$decimals      = ! empty($args['decimal']) ? give_get_price_decimals($currency) : 0;
406 404
 
407
-	if ( ! empty( $amount ) ) {
405
+	if ( ! empty($amount)) {
408 406
 		// Sanitize amount before formatting.
409
-		$amount = ! empty( $args['sanitize'] ) ?
410
-			give_maybe_sanitize_amount( $amount, array( 'number_decimals' => $decimals, 'currency' => $currency ) ) :
411
-			number_format( $amount, $decimals, '.', '' );
407
+		$amount = ! empty($args['sanitize']) ?
408
+			give_maybe_sanitize_amount($amount, array('number_decimals' => $decimals, 'currency' => $currency)) : number_format($amount, $decimals, '.', '');
412 409
 
413
-		switch ( $currency ) {
410
+		switch ($currency) {
414 411
 			case 'INR':
415 412
 				$decimal_amount = '';
416 413
 
417 414
 				// Extract decimals from amount
418
-				if ( ( $pos = strpos( $amount, '.' ) ) !== false ) {
419
-					if ( ! empty( $decimals ) ) {
420
-						$decimal_amount = substr( round( substr( $amount, $pos ), $decimals ), 1 );
421
-						$amount         = substr( $amount, 0, $pos );
422
-
423
-						if ( ! $decimal_amount ) {
424
-							$decimal_amount = substr( "{$decimal_sep}0000000000", 0, ( $decimals + 1 ) );
425
-						} elseif ( ( $decimals + 1 ) > strlen( $decimal_amount ) ) {
426
-							$decimal_amount = substr( "{$decimal_amount}000000000", 0, ( $decimals + 1 ) );
415
+				if (($pos = strpos($amount, '.')) !== false) {
416
+					if ( ! empty($decimals)) {
417
+						$decimal_amount = substr(round(substr($amount, $pos), $decimals), 1);
418
+						$amount         = substr($amount, 0, $pos);
419
+
420
+						if ( ! $decimal_amount) {
421
+							$decimal_amount = substr("{$decimal_sep}0000000000", 0, ($decimals + 1));
422
+						} elseif (($decimals + 1) > strlen($decimal_amount)) {
423
+							$decimal_amount = substr("{$decimal_amount}000000000", 0, ($decimals + 1));
427 424
 						}
428 425
 					} else {
429
-						$amount = number_format( $amount, $decimals, $decimal_sep, '' );
426
+						$amount = number_format($amount, $decimals, $decimal_sep, '');
430 427
 					}
431 428
 				}
432 429
 
433 430
 				// Extract last 3 from amount
434
-				$result = substr( $amount, - 3 );
435
-				$amount = substr( $amount, 0, - 3 );
431
+				$result = substr($amount, - 3);
432
+				$amount = substr($amount, 0, - 3);
436 433
 
437 434
 				// Apply digits 2 by 2
438
-				while ( strlen( $amount ) > 0 ) {
439
-					$result = substr( $amount, - 2 ) . $thousands_sep . $result;
440
-					$amount = substr( $amount, 0, - 2 );
435
+				while (strlen($amount) > 0) {
436
+					$result = substr($amount, - 2).$thousands_sep.$result;
437
+					$amount = substr($amount, 0, - 2);
441 438
 				}
442 439
 
443
-				$formatted = $result . $decimal_amount;
440
+				$formatted = $result.$decimal_amount;
444 441
 				break;
445 442
 
446 443
 			default:
447
-				$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
444
+				$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
448 445
 		}
449 446
 	}
450 447
 
@@ -453,7 +450,7 @@  discard block
 block discarded – undo
453 450
 	 *
454 451
 	 * @since 1.0
455 452
 	 */
456
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args );
453
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args);
457 454
 }
458 455
 
459 456
 
@@ -471,17 +468,17 @@  discard block
 block discarded – undo
471 468
  *
472 469
  * @return string  formatted amount number with large number names.
473 470
  */
474
-function give_human_format_large_amount( $amount, $args = array() ) {
471
+function give_human_format_large_amount($amount, $args = array()) {
475 472
 	// Sanitize amount.
476
-	$sanitize_amount = give_maybe_sanitize_amount( $amount );
473
+	$sanitize_amount = give_maybe_sanitize_amount($amount);
477 474
 
478 475
 	// Bailout.
479
-	if ( ! floatval( $sanitize_amount ) ) {
476
+	if ( ! floatval($sanitize_amount)) {
480 477
 		return '0';
481 478
 	};
482 479
 
483 480
 	// Set default currency;
484
-	if ( empty( $args['currency'] ) ) {
481
+	if (empty($args['currency'])) {
485 482
 		$args['currency'] = give_get_currency();
486 483
 	}
487 484
 
@@ -489,37 +486,37 @@  discard block
 block discarded – undo
489 486
 	$thousands_sep = give_get_price_thousand_separator();
490 487
 
491 488
 	// Explode amount to calculate name of large numbers.
492
-	$amount_array = explode( $thousands_sep, $amount );
489
+	$amount_array = explode($thousands_sep, $amount);
493 490
 
494 491
 	// Calculate amount parts count.
495
-	$amount_count_parts = count( $amount_array );
492
+	$amount_count_parts = count($amount_array);
496 493
 
497 494
 	// Human format amount (default).
498 495
 	$human_format_amount = $amount;
499 496
 
500
-	switch ( $args['currency'] ) {
497
+	switch ($args['currency']) {
501 498
 		case 'INR':
502 499
 			// Calculate large number formatted amount.
503
-			if ( 4 < $amount_count_parts ) {
504
-				$human_format_amount = sprintf( esc_html__( '%s arab', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
505
-			} elseif ( 3 < $amount_count_parts ) {
506
-				$human_format_amount = sprintf( esc_html__( '%s crore', 'give' ), round( ( $sanitize_amount / 10000000 ), 2 ) );
507
-			} elseif ( 2 < $amount_count_parts ) {
508
-				$human_format_amount = sprintf( esc_html__( '%s lakh', 'give' ), round( ( $sanitize_amount / 100000 ), 2 ) );
500
+			if (4 < $amount_count_parts) {
501
+				$human_format_amount = sprintf(esc_html__('%s arab', 'give'), round(($sanitize_amount / 1000000000), 2));
502
+			} elseif (3 < $amount_count_parts) {
503
+				$human_format_amount = sprintf(esc_html__('%s crore', 'give'), round(($sanitize_amount / 10000000), 2));
504
+			} elseif (2 < $amount_count_parts) {
505
+				$human_format_amount = sprintf(esc_html__('%s lakh', 'give'), round(($sanitize_amount / 100000), 2));
509 506
 			}
510 507
 			break;
511 508
 		default:
512 509
 			// Calculate large number formatted amount.
513
-			if ( 4 < $amount_count_parts ) {
514
-				$human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
515
-			} elseif ( 3 < $amount_count_parts ) {
516
-				$human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
517
-			} elseif ( 2 < $amount_count_parts ) {
518
-				$human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) );
510
+			if (4 < $amount_count_parts) {
511
+				$human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
512
+			} elseif (3 < $amount_count_parts) {
513
+				$human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
514
+			} elseif (2 < $amount_count_parts) {
515
+				$human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
519 516
 			}
520 517
 	}
521 518
 
522
-	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
519
+	return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
523 520
 }
524 521
 
525 522
 /**
@@ -533,17 +530,16 @@  discard block
 block discarded – undo
533 530
  *
534 531
  * @return string $amount Newly formatted amount or Price Not Available
535 532
  */
536
-function give_format_decimal( $amount, $dp = false, $sanitize = true ) {
533
+function give_format_decimal($amount, $dp = false, $sanitize = true) {
537 534
 	$decimal_separator = give_get_price_decimal_separator();
538 535
 	$formatted_amount  = $sanitize ?
539
-		give_maybe_sanitize_amount( $amount, array( 'number_decimals' => $dp ) ) :
540
-		number_format( $amount, ( is_bool( $dp ) ? give_get_price_decimals() : $dp ), '.', '' );
536
+		give_maybe_sanitize_amount($amount, array('number_decimals' => $dp)) : number_format($amount, (is_bool($dp) ? give_get_price_decimals() : $dp), '.', '');
541 537
 
542
-	if ( false !== strpos( $formatted_amount, '.' ) ) {
543
-		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
538
+	if (false !== strpos($formatted_amount, '.')) {
539
+		$formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
544 540
 	}
545 541
 
546
-	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
542
+	return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
547 543
 }
548 544
 
549 545
 /**
@@ -555,7 +551,7 @@  discard block
 block discarded – undo
555 551
  *
556 552
  * @return string                  Date format string
557 553
  */
558
-function give_date_format( $date_context = '' ) {
554
+function give_date_format($date_context = '') {
559 555
 	/**
560 556
 	 * Filter the date context
561 557
 	 *
@@ -576,19 +572,19 @@  discard block
 block discarded – undo
576 572
 	 *
577 573
 	 *    }
578 574
 	 */
579
-	$date_format_contexts = apply_filters( 'give_date_format_contexts', array() );
575
+	$date_format_contexts = apply_filters('give_date_format_contexts', array());
580 576
 
581 577
 	// Set date format to default date format.
582
-	$date_format = get_option( 'date_format' );
578
+	$date_format = get_option('date_format');
583 579
 
584 580
 	// Update date format if we have non empty date format context array and non empty date format string for that context.
585
-	if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) {
586
-		$date_format = ! empty( $date_format_contexts[ $date_context ] )
587
-			? $date_format_contexts[ $date_context ]
581
+	if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) {
582
+		$date_format = ! empty($date_format_contexts[$date_context])
583
+			? $date_format_contexts[$date_context]
588 584
 			: $date_format;
589 585
 	}
590 586
 
591
-	return apply_filters( 'give_date_format', $date_format );
587
+	return apply_filters('give_date_format', $date_format);
592 588
 }
593 589
 
594 590
 /**
@@ -602,8 +598,8 @@  discard block
 block discarded – undo
602 598
  *
603 599
  * @return string
604 600
  */
605
-function give_get_cache_key( $action, $query_args ) {
606
-	return Give_Cache::get_key( $action, $query_args );
601
+function give_get_cache_key($action, $query_args) {
602
+	return Give_Cache::get_key($action, $query_args);
607 603
 }
608 604
 
609 605
 /**
@@ -616,11 +612,11 @@  discard block
 block discarded – undo
616 612
  *
617 613
  * @return string|array
618 614
  */
619
-function give_clean( $var ) {
620
-	if ( is_array( $var ) ) {
621
-		return array_map( 'give_clean', $var );
615
+function give_clean($var) {
616
+	if (is_array($var)) {
617
+		return array_map('give_clean', $var);
622 618
 	} else {
623
-		return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
619
+		return is_scalar($var) ? sanitize_text_field($var) : $var;
624 620
 	}
625 621
 }
626 622
 
@@ -633,10 +629,10 @@  discard block
 block discarded – undo
633 629
  *
634 630
  * @return int
635 631
  */
636
-function give_let_to_num( $size ) {
637
-	$l   = substr( $size, - 1 );
638
-	$ret = substr( $size, 0, - 1 );
639
-	switch ( strtoupper( $l ) ) {
632
+function give_let_to_num($size) {
633
+	$l   = substr($size, - 1);
634
+	$ret = substr($size, 0, - 1);
635
+	switch (strtoupper($l)) {
640 636
 		case 'P':
641 637
 			$ret *= 1024;
642 638
 		case 'T':
@@ -663,22 +659,22 @@  discard block
 block discarded – undo
663 659
  *
664 660
  * @return bool
665 661
  */
666
-function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) {
662
+function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) {
667 663
 
668 664
 	// Verify nonce.
669
-	$verify_nonce = wp_verify_nonce( $nonce, $action );
665
+	$verify_nonce = wp_verify_nonce($nonce, $action);
670 666
 
671 667
 	// On ajax request send nonce verification status.
672
-	if ( wp_doing_ajax() ) {
668
+	if (wp_doing_ajax()) {
673 669
 		return $verify_nonce;
674 670
 	}
675 671
 
676
-	if ( ! $verify_nonce ) {
672
+	if ( ! $verify_nonce) {
677 673
 		$wp_die_args = wp_parse_args(
678 674
 			$wp_die_args,
679 675
 			array(
680
-				'message' => __( 'Nonce verification has failed.', 'give' ),
681
-				'title'   => __( 'Error', 'give' ),
676
+				'message' => __('Nonce verification has failed.', 'give'),
677
+				'title'   => __('Error', 'give'),
682 678
 				'args'    => array(
683 679
 					'response' => 403,
684 680
 				)
@@ -704,19 +700,19 @@  discard block
 block discarded – undo
704 700
  *
705 701
  * @return bool
706 702
  */
707
-function give_verify_donation_form_nonce( $nonce = '' ) {
703
+function give_verify_donation_form_nonce($nonce = '') {
708 704
 	// Get nonce key from donation.
709
-	$nonce   = empty( $nonce ) ? give_clean( $_POST['_wpnonce'] ) : $nonce;
710
-	$form_id = isset( $_POST['give-form-id'] ) ? absint( $_POST['give-form-id'] ) : 0;
705
+	$nonce   = empty($nonce) ? give_clean($_POST['_wpnonce']) : $nonce;
706
+	$form_id = isset($_POST['give-form-id']) ? absint($_POST['give-form-id']) : 0;
711 707
 
712 708
 	// Form nonce action.
713 709
 	$nonce_action = "donation_form_nonce_{$form_id}";
714 710
 
715 711
 	// Nonce validation.
716
-	$verify_nonce = give_validate_nonce( $nonce, $nonce_action );
712
+	$verify_nonce = give_validate_nonce($nonce, $nonce_action);
717 713
 
718
-	if ( ! $verify_nonce ) {
719
-		give_set_error( 'donation_form_nonce', __( 'Nonce verification has failed.', 'give' ) );
714
+	if ( ! $verify_nonce) {
715
+		give_set_error('donation_form_nonce', __('Nonce verification has failed.', 'give'));
720 716
 	}
721 717
 
722 718
 	return $verify_nonce;
@@ -736,43 +732,43 @@  discard block
 block discarded – undo
736 732
  *
737 733
  * @return mixed
738 734
  */
739
-function give_check_variable( $variable, $conditional = '', $default = false, $array_key_name = '' ) {
735
+function give_check_variable($variable, $conditional = '', $default = false, $array_key_name = '') {
740 736
 	// Get value from array if array key non empty.
741
-	if( empty( $array_key_name ) ) {
742
-		switch ( $conditional ) {
737
+	if (empty($array_key_name)) {
738
+		switch ($conditional) {
743 739
 			case 'isset_empty':
744
-				$variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default;
740
+				$variable = (isset($variable) && ! empty($variable)) ? $variable : $default;
745 741
 				break;
746 742
 
747 743
 			case 'empty':
748
-				$variable = ! empty( $variable ) ? $variable : $default;
744
+				$variable = ! empty($variable) ? $variable : $default;
749 745
 				break;
750 746
 
751 747
 			case 'null':
752
-				$variable = ! is_null( $variable ) ? $variable : $default;
748
+				$variable = ! is_null($variable) ? $variable : $default;
753 749
 				break;
754 750
 
755 751
 			default:
756
-				$variable = isset( $variable ) ? $variable : $default;
752
+				$variable = isset($variable) ? $variable : $default;
757 753
 		}
758 754
 	} else {
759
-		$isset = array_key_exists( $array_key_name, $variable );
755
+		$isset = array_key_exists($array_key_name, $variable);
760 756
 
761
-		switch ( $conditional ) {
757
+		switch ($conditional) {
762 758
 			case 'isset_empty':
763
-				$variable = ( $isset && ! empty( $variable[ $array_key_name ] ) ) ? $variable[ $array_key_name ] : $default;
759
+				$variable = ($isset && ! empty($variable[$array_key_name])) ? $variable[$array_key_name] : $default;
764 760
 				break;
765 761
 
766 762
 			case 'empty':
767
-				$variable = ! empty( $variable[ $array_key_name ] ) ? $variable[ $array_key_name ] : $default;
763
+				$variable = ! empty($variable[$array_key_name]) ? $variable[$array_key_name] : $default;
768 764
 				break;
769 765
 
770 766
 			case 'null':
771
-				$variable = $isset && ! is_null( $variable[ $array_key_name ] ) ? $variable[ $array_key_name ] : $default;
767
+				$variable = $isset && ! is_null($variable[$array_key_name]) ? $variable[$array_key_name] : $default;
772 768
 				break;
773 769
 
774 770
 			default:
775
-				$variable = $isset && isset( $variable[ $array_key_name ] ) ? $variable[ $array_key_name ] : $default;
771
+				$variable = $isset && isset($variable[$array_key_name]) ? $variable[$array_key_name] : $default;
776 772
 		}
777 773
 	}
778 774
 
Please login to merge, or discard this patch.
includes/admin/upgrades/views/plugins-update-section.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* @var Give_Updates $give_updates */
3
-$plugins = $give_updates->get_updates( 'plugin' );
4
-if ( empty( $plugins ) ) {
3
+$plugins = $give_updates->get_updates('plugin');
4
+if (empty($plugins)) {
5 5
 	return;
6 6
 }
7 7
 
8 8
 ob_start();
9
-foreach ( $plugins as $plugin_data ) {
10
-	if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) {
9
+foreach ($plugins as $plugin_data) {
10
+	if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) {
11 11
 		continue;
12 12
 	}
13 13
 
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	$author_name = $plugin_data['Author'];
16 16
 
17 17
 	// Link the plugin name to the plugin URL if available.
18
-	if ( ! empty( $plugin_data['PluginURI'] ) ) {
18
+	if ( ! empty($plugin_data['PluginURI'])) {
19 19
 		$plugin_name = sprintf(
20 20
 			'<a href="%s" title="%s">%s</a> (%s)',
21
-			esc_url( $plugin_data['PluginURI'] ),
22
-			esc_attr__( 'Visit plugin homepage', 'give' ),
21
+			esc_url($plugin_data['PluginURI']),
22
+			esc_attr__('Visit plugin homepage', 'give'),
23 23
 			$plugin_name,
24
-			esc_html( $plugin_data['Version'] )
24
+			esc_html($plugin_data['Version'])
25 25
 		);
26 26
 	}
27 27
 
28 28
 	// Link the author name to the author URL if available.
29
-	if ( ! empty( $plugin_data['AuthorURI'] ) ) {
29
+	if ( ! empty($plugin_data['AuthorURI'])) {
30 30
 		$author_name = sprintf(
31 31
 			'<a href="%s" title="%s">%s</a>',
32
-			esc_url( $plugin_data['AuthorURI'] ),
33
-			esc_attr__( 'Visit author homepage', 'give' ),
32
+			esc_url($plugin_data['AuthorURI']),
33
+			esc_attr__('Visit author homepage', 'give'),
34 34
 			$author_name
35 35
 		);
36 36
 	}
37 37
 	?>
38
-	<tr <?php echo( true !== $plugin_data['License'] ? 'data-tooltip="' . __( 'Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give' ) . '"' : '' ); ?>>
39
-		<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
38
+	<tr <?php echo(true !== $plugin_data['License'] ? 'data-tooltip="'.__('Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give').'"' : ''); ?>>
39
+		<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
40 40
 		<td>
41 41
 			<?php
42
-			echo ( true === $plugin_data['License'] ) ? '<span class="dashicons dashicons-yes"></span>' . __( 'Licensed', 'give' ) : '<span class="dashicons dashicons-no-alt"></span>' . __( 'Unlicensed', 'give' );
42
+			echo (true === $plugin_data['License']) ? '<span class="dashicons dashicons-yes"></span>'.__('Licensed', 'give') : '<span class="dashicons dashicons-no-alt"></span>'.__('Unlicensed', 'give');
43 43
 
44 44
 			echo sprintf(
45 45
 				' &ndash; %s &ndash; %s',
46
-				sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ),
47
-				sprintf( __( '(Latest Version: %s)' ), $plugin_data['update']->new_version )
46
+				sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))),
47
+				sprintf(__('(Latest Version: %s)'), $plugin_data['update']->new_version)
48 48
 			);
49 49
 			?>
50 50
 		</td>
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Amount', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' ),
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Amount', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
83
+					echo give_price($post_id, false);
84
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
89
-					echo give_goal( $post_id, false );
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89
+					echo give_goal($post_id, false);
90 90
 				} else {
91
-					esc_html_e( 'No Goal Set', 'give' );
91
+					esc_html_e('No Goal Set', 'give');
92 92
 				}
93 93
 
94
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
94
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
95 95
 				break;
96 96
 			case 'donations':
97
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
98
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ) . '">';
99
-					echo give_get_form_sales_stats( $post_id );
97
+				if (current_user_can('view_give_form_stats', $post_id)) {
98
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)).'">';
99
+					echo give_get_form_sales_stats($post_id);
100 100
 					echo '</a>';
101 101
 				} else {
102 102
 					echo '-';
103 103
 				}
104 104
 				break;
105 105
 			case 'earnings':
106
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
107
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">';
108
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) );
106
+				if (current_user_can('view_give_form_stats', $post_id)) {
107
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">';
108
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false)));
109 109
 					echo '</a>';
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'shortcode':
115
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
115
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
116 116
 				break;
117 117
 		}// End switch().
118 118
 	}// End if().
119 119
 }
120 120
 
121
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
121
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
122 122
 
123 123
 /**
124 124
  * Registers the sortable columns in the list table
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @return array $columns Array of sortable columns
131 131
  */
132
-function give_sortable_form_columns( $columns ) {
132
+function give_sortable_form_columns($columns) {
133 133
 	$columns['price']     = 'amount';
134 134
 	$columns['sales']     = 'sales';
135 135
 	$columns['earnings']  = 'earnings';
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	return $columns;
140 140
 }
141 141
 
142
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
142
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
143 143
 
144 144
 /**
145 145
  * Sorts Columns in the Forms List Table
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
  *
151 151
  * @return array $vars Array of all the sort variables.
152 152
  */
153
-function give_sort_forms( $vars ) {
153
+function give_sort_forms($vars) {
154 154
 	// Check if we're viewing the "give_forms" post type.
155
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
155
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
156 156
 		return $vars;
157 157
 	}
158 158
 
159
-	switch ( $vars['orderby'] ) {
159
+	switch ($vars['orderby']) {
160 160
 		// Check if 'orderby' is set to "sales".
161 161
 		case 'sales':
162 162
 			$vars = array_merge(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 		// Check if "orderby" is set to "price/amount".
183 183
 		case 'amount':
184
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
184
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
185 185
 
186 186
 			$vars['orderby']    = 'meta_value_num';
187 187
 			$vars['meta_query'] = array(
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
  *
234 234
  * @return array       Array of all sort variables.
235 235
  */
236
-function give_filter_forms( $vars ) {
237
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
236
+function give_filter_forms($vars) {
237
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
238 238
 
239 239
 		// If an author ID was passed, use it
240
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
240
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
241 241
 
242 242
 			$author_id = $_REQUEST['author'];
243
-			if ( (int) $author_id !== get_current_user_id() ) {
244
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
243
+			if ((int) $author_id !== get_current_user_id()) {
244
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
245 245
 					'response' => 403,
246
-				) );
246
+				));
247 247
 			}
248 248
 			$vars = array_merge(
249 249
 				$vars,
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
  * @return void
268 268
  */
269 269
 function give_forms_load() {
270
-	add_filter( 'request', 'give_sort_forms' );
271
-	add_filter( 'request', 'give_filter_forms' );
270
+	add_filter('request', 'give_sort_forms');
271
+	add_filter('request', 'give_filter_forms');
272 272
 }
273 273
 
274
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
274
+add_action('load-edit.php', 'give_forms_load', 9999);
275 275
 
276 276
 /**
277 277
  * Remove Forms Month Filter
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
  * @global      $typenow The post type we are viewing.
286 286
  * @return array Empty array disables the dropdown.
287 287
  */
288
-function give_remove_month_filter( $dates ) {
288
+function give_remove_month_filter($dates) {
289 289
 	global $typenow;
290 290
 
291
-	if ( $typenow == 'give_forms' ) {
291
+	if ($typenow == 'give_forms') {
292 292
 		$dates = array();
293 293
 	}
294 294
 
295 295
 	return $dates;
296 296
 }
297 297
 
298
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
298
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
299 299
 
300 300
 /**
301 301
  * Updates price when saving post
@@ -306,23 +306,23 @@  discard block
 block discarded – undo
306 306
  *
307 307
  * @return int|null
308 308
  */
309
-function give_price_save_quick_edit( $post_id ) {
310
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
309
+function give_price_save_quick_edit($post_id) {
310
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
311 311
 		return;
312 312
 	}
313
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
313
+	if ( ! current_user_can('edit_post', $post_id)) {
314 314
 		return $post_id;
315 315
 	}
316
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
316
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
317 317
 		return $post_id;
318 318
 	}
319 319
 
320
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
321
-		give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) );
320
+	if (isset($_REQUEST['_give_regprice'])) {
321
+		give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice']))));
322 322
 	}
323 323
 }
324 324
 
325
-add_action( 'save_post', 'give_price_save_quick_edit' );
325
+add_action('save_post', 'give_price_save_quick_edit');
326 326
 
327 327
 /**
328 328
  * Process bulk edit actions via AJAX
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
  */
333 333
 function give_save_bulk_edit() {
334 334
 
335
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
335
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
336 336
 
337
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
338
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
339
-		foreach ( $post_ids as $post_id ) {
337
+	if ( ! empty($post_ids) && is_array($post_ids)) {
338
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
339
+		foreach ($post_ids as $post_id) {
340 340
 
341
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
341
+			if ( ! current_user_can('edit_post', $post_id)) {
342 342
 				continue;
343 343
 			}
344 344
 
345
-			if ( ! empty( $price ) ) {
346
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) );
345
+			if ( ! empty($price)) {
346
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price));
347 347
 			}
348 348
 		}
349 349
 	}
@@ -351,4 +351,4 @@  discard block
 block discarded – undo
351 351
 	die();
352 352
 }
353 353
 
354
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
354
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
28 28
 
29
-		parent::__construct( 'give_goal' );
29
+		parent::__construct('give_goal');
30 30
 	}
31 31
 
32 32
 	/**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$create_form_link = sprintf(
40 40
 		/* translators: %s: create new form URL */
41
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42
-			admin_url( 'post-new.php?post_type=give_forms' )
41
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
42
+			admin_url('post-new.php?post_type=give_forms')
43 43
 		);
44 44
 
45 45
 		return array(
@@ -51,35 +51,35 @@  discard block
 block discarded – undo
51 51
 					'meta_value' => 'enabled',
52 52
 				),
53 53
 				'name'        => 'id',
54
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
55
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
54
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
55
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
56 56
 				'required'    => array(
57
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
58
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
57
+					'alert' => esc_html__('You must first select a Form!', 'give'),
58
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
59 59
 				),
60 60
 			),
61 61
 			array(
62 62
 				'type' => 'container',
63
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
63
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
64 64
 			),
65 65
 			array(
66 66
 				'type'    => 'listbox',
67 67
 				'name'    => 'show_text',
68
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
69
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
68
+				'label'   => esc_attr__('Show Text:', 'give'),
69
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html__( 'Show', 'give' ),
72
-					'false' => esc_html__( 'Hide', 'give' ),
71
+					'true'  => esc_html__('Show', 'give'),
72
+					'false' => esc_html__('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'show_bar',
78
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
79
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
78
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
79
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
80 80
 				'options' => array(
81
-					'true'  => esc_html__( 'Show', 'give' ),
82
-					'false' => esc_html__( 'Hide', 'give' ),
81
+					'true'  => esc_html__('Show', 'give'),
82
+					'false' => esc_html__('Hide', 'give'),
83 83
 				),
84 84
 			),
85 85
 		);
Please login to merge, or discard this patch.
templates/shortcode-register.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * This template is used to display the registration form with [give_register]
4 4
  */
5
-Give()->notices->render_frontend_notices( 0 ); ?>
5
+Give()->notices->render_frontend_notices(0); ?>
6 6
 
7 7
 <form id="give-register-form" class="give-form" action="" method="post">
8 8
 	<?php
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	 *
14 14
 	 * @since 1.0
15 15
 	 */
16
-	do_action( 'give_register_form_fields_top' );
16
+	do_action('give_register_form_fields_top');
17 17
 	?>
18 18
 
19 19
 	<fieldset>
20
-		<legend><?php esc_html_e( 'Register a New Account', 'give' ); ?></legend>
20
+		<legend><?php esc_html_e('Register a New Account', 'give'); ?></legend>
21 21
 
22 22
 		<?php
23 23
 		/**
@@ -27,26 +27,26 @@  discard block
 block discarded – undo
27 27
 		 *
28 28
 		 * @since 1.0
29 29
 		 */
30
-		do_action( 'give_register_form_fields_before' );
30
+		do_action('give_register_form_fields_before');
31 31
 		?>
32 32
 
33 33
 		<div class="form-row form-row-first form-row-responsive">
34
-			<label for="give-user-login"><?php esc_html_e( 'Username', 'give' ); ?></label>
34
+			<label for="give-user-login"><?php esc_html_e('Username', 'give'); ?></label>
35 35
 			<input id="give-user-login" class="required give-input" type="text" name="give_user_login" required aria-required="true" />
36 36
 		</div>
37 37
 
38 38
 		<div class="form-row form-row-last form-row-responsive">
39
-			<label for="give-user-email"><?php esc_html_e( 'Email', 'give' ); ?></label>
39
+			<label for="give-user-email"><?php esc_html_e('Email', 'give'); ?></label>
40 40
 			<input id="give-user-email" class="required give-input" type="email" name="give_user_email" required aria-required="true" />
41 41
 		</div>
42 42
 
43 43
 		<div class="form-row form-row-first form-row-responsive">
44
-			<label for="give-user-pass"><?php esc_html_e( 'Password', 'give' ); ?></label>
44
+			<label for="give-user-pass"><?php esc_html_e('Password', 'give'); ?></label>
45 45
 			<input id="give-user-pass" class="password required give-input" type="password" name="give_user_pass" required aria-required="true" />
46 46
 		</div>
47 47
 
48 48
 		<div class="form-row form-row-last form-row-responsive">
49
-			<label for="give-user-pass2"><?php esc_html_e( 'Confirm PW', 'give' ); ?></label>
49
+			<label for="give-user-pass2"><?php esc_html_e('Confirm PW', 'give'); ?></label>
50 50
 			<input id="give-user-pass2" class="password required give-input" type="password" name="give_user_pass2" required aria-required="true" />
51 51
 		</div>
52 52
 
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
 		 *
59 59
 		 * @since 1.0
60 60
 		 */
61
-		do_action( 'give_register_form_fields_before_submit' );
61
+		do_action('give_register_form_fields_before_submit');
62 62
 		?>
63 63
 
64 64
 		<div class="give-hidden">
65 65
 			<input type="hidden" name="give_honeypot" value="" />
66 66
 			<input type="hidden" name="give_action" value="user_register" />
67
-			<input type="hidden" name="give_redirect" value="<?php echo esc_url( $give_register_redirect ); ?>" />
67
+			<input type="hidden" name="give_redirect" value="<?php echo esc_url($give_register_redirect); ?>" />
68 68
 		</div>
69 69
 
70 70
 		<div class="form-row">
71
-			<input class="button" name="give_register_submit" type="submit" value="<?php esc_attr_e( 'Register', 'give' ); ?>" />
71
+			<input class="button" name="give_register_submit" type="submit" value="<?php esc_attr_e('Register', 'give'); ?>" />
72 72
 		</div>
73 73
 
74 74
 		<?php
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @since 1.0
81 81
 		 */
82
-		do_action( 'give_register_form_fields_after' );
82
+		do_action('give_register_form_fields_after');
83 83
 		?>
84 84
 
85 85
 	</fieldset>
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @since 1.0
94 94
 	 */
95
-	do_action( 'give_register_form_fields_bottom' );
95
+	do_action('give_register_form_fields_bottom');
96 96
 	?>
97 97
 </form>
Please login to merge, or discard this patch.
templates/global/wrapper-start.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly.
14 14
 }
15 15
 
16
-$template = strtolower( get_option( 'template' ) );
16
+$template = strtolower(get_option('template'));
17 17
 
18
-switch ( $template ) {
18
+switch ($template) {
19 19
 	case 'twentyeleven' :
20 20
 		echo '<div id="primary" class="give-wrap"><div id="content" role="main" class="twentyeleven">';
21 21
 		break;
@@ -65,6 +65,6 @@  discard block
 block discarded – undo
65 65
 		echo '<div class="wrapper hentry" style="box-sizing: border-box;">';
66 66
 		break;
67 67
 	default :
68
-		echo apply_filters( 'give_default_wrapper_start', '<div id="container" class="give-wrap container"><div id="content" role="main">' );
68
+		echo apply_filters('give_default_wrapper_start', '<div id="container" class="give-wrap container"><div id="content" role="main">');
69 69
 		break;
70 70
 }
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
templates/global/wrapper-end.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly.
14 14
 }
15 15
 
16
-$template = get_option( 'template' );
16
+$template = get_option('template');
17 17
 
18
-switch ( $template ) {
18
+switch ($template) {
19 19
 	case 'twentyeleven' :
20 20
 		echo '</div></div>';
21 21
 		break;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		break;
28 28
 	case 'twentyfourteen' :
29 29
 		echo '</div></div></div>';
30
-		get_sidebar( 'content' );
30
+		get_sidebar('content');
31 31
 		break;
32 32
 	case 'twentyfifteen' :
33 33
 		echo '</div></div>';
@@ -57,6 +57,6 @@  discard block
 block discarded – undo
57 57
 		echo '</div>';
58 58
 		break;
59 59
 	default :
60
-		echo apply_filters( 'give_default_wrapper_end', '</div></div>' );
60
+		echo apply_filters('give_default_wrapper_end', '</div></div>');
61 61
 		break;
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
templates/single-give-form.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version       1.0
9 9
  */
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit; // Exit if accessed directly.
13 13
 }
14 14
 
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @since 1.0
23 23
  */
24
-do_action( 'give_before_main_content' );
24
+do_action('give_before_main_content');
25 25
 
26
-while ( have_posts() ) : the_post();
26
+while (have_posts()) : the_post();
27 27
 
28
-	give_get_template_part( 'single-give-form/content', 'single-give-form' );
28
+	give_get_template_part('single-give-form/content', 'single-give-form');
29 29
 
30 30
 endwhile; // end of the loop.
31 31
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @since 1.0
38 38
  */
39
-do_action( 'give_after_main_content' );
39
+do_action('give_after_main_content');
40 40
 
41 41
 /**
42 42
  * Fires in single form template, on the sidebar.
@@ -45,6 +45,6 @@  discard block
 block discarded – undo
45 45
  *
46 46
  * @since 1.0
47 47
  */
48
-do_action( 'give_sidebar' );
48
+do_action('give_sidebar');
49 49
 
50 50
 get_footer();
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
templates/single-give-form/featured-image.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since       1.0
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit; // Exit if accessed directly.
15 15
 }
16 16
 
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @since 1.0
25 25
  */
26
-do_action( 'give_pre_featured_thumbnail' );
26
+do_action('give_pre_featured_thumbnail');
27 27
 ?>
28 28
 
29 29
 <div class="images">
30 30
 	<?php //Featured Thumbnail
31
-	if ( has_post_thumbnail() ) {
31
+	if (has_post_thumbnail()) {
32 32
 		
33
-		$image_size = give_get_option( 'featured_image_size' );
34
-		$image      = get_the_post_thumbnail( $post->ID, apply_filters( 'single_give_form_large_thumbnail_size', ( ! empty( $image_size ) ? $image_size : 'large' ) ) );
33
+		$image_size = give_get_option('featured_image_size');
34
+		$image      = get_the_post_thumbnail($post->ID, apply_filters('single_give_form_large_thumbnail_size', ( ! empty($image_size) ? $image_size : 'large')));
35 35
 
36
-		echo apply_filters( 'single_give_form_image_html', $image );
36
+		echo apply_filters('single_give_form_image_html', $image);
37 37
 
38 38
 	} else {
39 39
 
40 40
 		//Placeholder Image
41
-		echo apply_filters( 'single_give_form_image_html', sprintf( '<img src="%s" alt="%s" />', give_get_placeholder_img_src(), esc_attr__( 'Placeholder', 'give' ) ), $post->ID );
41
+		echo apply_filters('single_give_form_image_html', sprintf('<img src="%s" alt="%s" />', give_get_placeholder_img_src(), esc_attr__('Placeholder', 'give')), $post->ID);
42 42
 
43 43
 	} ?>
44 44
 </div>
@@ -51,5 +51,5 @@  discard block
 block discarded – undo
51 51
  *
52 52
  * @since 1.0
53 53
  */
54
-do_action( 'give_post_featured_thumbnail' );
54
+do_action('give_post_featured_thumbnail');
55 55
 ?>
Please login to merge, or discard this patch.