Completed
Pull Request — master (#1203)
by Devin
20:46
created
includes/admin/class-admin-settings.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -713,7 +713,7 @@
 block discarded – undo
713 713
 		 *
714 714
 		 * @param  array $value The form field value array
715 715
 		 *
716
-		 * @return array The description and tip as a 2 element array
716
+		 * @return string The description and tip as a 2 element array
717 717
 		 */
718 718
 		public static function get_field_description( $value ) {
719 719
 			$description = '';
Please login to merge, or discard this patch.
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Admin_Settings' ) ) :
16
+if ( ! class_exists('Give_Admin_Settings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Admin_Settings Class.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 *
73 73
 			 * @param array $settings Array of settings class object.
74 74
 			 */
75
-			self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() );
75
+			self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array());
76 76
 
77 77
 			return self::$settings;
78 78
 		}
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		public static function save() {
87 87
 			$current_tab = give_get_current_setting_tab();
88 88
 
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
90
-				die( __( 'Action failed. Please refresh the page and retry.', 'give' ) );
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90
+				die(__('Action failed. Please refresh the page and retry.', 'give'));
91 91
 			}
92 92
 
93 93
 			/**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 			 *
100 100
 			 * @since 1.8
101 101
 			 */
102
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
102
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
103 103
 
104
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
104
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
105 105
 
106 106
 			/**
107 107
 			 * Trigger Action.
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			 *
113 113
 			 * @since 1.8
114 114
 			 */
115
-			do_action( self::$setting_filter_prefix . '_saved' );
115
+			do_action(self::$setting_filter_prefix.'_saved');
116 116
 		}
117 117
 
118 118
 		/**
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 		 *
126 126
 		 * @return void
127 127
 		 */
128
-		public static function add_message( $code, $message ) {
129
-			self::$messages[ $code ] = $message;
128
+		public static function add_message($code, $message) {
129
+			self::$messages[$code] = $message;
130 130
 		}
131 131
 
132 132
 		/**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 		 *
140 140
 		 * @return void
141 141
 		 */
142
-		public static function add_error( $code, $message ) {
143
-			self::$errors[ $code ] = $message;
142
+		public static function add_error($code, $message) {
143
+			self::$errors[$code] = $message;
144 144
 		}
145 145
 
146 146
 		/**
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 			$notice_html = '';
154 154
 			$classes     = 'give-notice settings-error notice is-dismissible';
155 155
 
156
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
157
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
156
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
157
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
158 158
 
159
-			if ( 0 < count( self::$errors ) ) {
160
-				foreach ( self::$errors as $code => $message ) {
161
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>';
159
+			if (0 < count(self::$errors)) {
160
+				foreach (self::$errors as $code => $message) {
161
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>';
162 162
 				}
163 163
 			}
164 164
 
165
-			if ( 0 < count( self::$messages ) ) {
166
-				foreach ( self::$messages as $code => $message ) {
167
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>';
165
+			if (0 < count(self::$messages)) {
166
+				foreach (self::$messages as $code => $message) {
167
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>';
168 168
 				}
169 169
 			}
170 170
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			self::$setting_filter_prefix = give_get_current_setting_page();
185 185
 
186 186
 			// Bailout: Exit if setting page is not defined.
187
-			if ( empty( self::$setting_filter_prefix ) ) {
187
+			if (empty(self::$setting_filter_prefix)) {
188 188
 				return false;
189 189
 			}
190 190
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			 *
198 198
 			 * @since 1.8
199 199
 			 */
200
-			do_action( self::$setting_filter_prefix . '_start' );
200
+			do_action(self::$setting_filter_prefix.'_start');
201 201
 
202 202
 			$current_tab = give_get_current_setting_tab();
203 203
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			self::get_settings_pages();
206 206
 
207 207
 			// Save settings if data has been posted.
208
-			if ( ! empty( $_POST ) ) {
208
+			if ( ! empty($_POST)) {
209 209
 				self::save();
210 210
 			}
211 211
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 			 *
219 219
 			 * @since 1.8
220 220
 			 */
221
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
221
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
222 222
 
223 223
 			include 'views/html-admin-settings.php';
224 224
 
@@ -236,25 +236,25 @@  discard block
 block discarded – undo
236 236
 		 *
237 237
 		 * @return string|bool
238 238
 		 */
239
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
239
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
240 240
 			// Bailout.
241
-			if ( empty( $option_name ) && empty( $field_id ) ) {
241
+			if (empty($option_name) && empty($field_id)) {
242 242
 				return false;
243 243
 			}
244 244
 
245
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
245
+			if ( ! empty($field_id) && ! empty($option_name)) {
246 246
 				// Get field value if any.
247
-				$option_value = get_option( $option_name );
247
+				$option_value = get_option($option_name);
248 248
 
249
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
250
-					? $option_value[ $field_id ]
249
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
250
+					? $option_value[$field_id]
251 251
 					: $default;
252 252
 			} else {
253 253
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
254 254
 				$option_name = ! $option_name ? $field_id : $option_name;
255 255
 
256 256
 				// Get option value if any.
257
-				$option_value = get_option( $option_name, $default );
257
+				$option_value = get_option($option_name, $default);
258 258
 			}
259 259
 
260 260
 			return $option_value;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * @return void
274 274
 		 */
275
-		public static function output_fields( $options, $option_name = '' ) {
275
+		public static function output_fields($options, $option_name = '') {
276 276
 			$current_tab = give_get_current_setting_tab();
277 277
 
278 278
 			// Field Default values.
@@ -285,46 +285,46 @@  discard block
 block discarded – undo
285 285
 				'table_html' => true,
286 286
 			);
287 287
 
288
-			foreach ( $options as $value ) {
289
-				if ( ! isset( $value['type'] ) ) {
288
+			foreach ($options as $value) {
289
+				if ( ! isset($value['type'])) {
290 290
 					continue;
291 291
 				}
292 292
 
293 293
 				// Set title.
294
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
294
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
295 295
 
296
-				$value = wp_parse_args( $value, $defaults );
296
+				$value = wp_parse_args($value, $defaults);
297 297
 
298 298
 				// Custom attribute handling.
299 299
 				$custom_attributes = array();
300 300
 
301
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
302
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
303
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
301
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
302
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
303
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
304 304
 					}
305 305
 				}
306 306
 
307 307
 				// Description handling.
308
-				$description          = self::get_field_description( $value );
308
+				$description = self::get_field_description($value);
309 309
 
310 310
 				// Switch based on type.
311
-				switch ( $value['type'] ) {
311
+				switch ($value['type']) {
312 312
 
313 313
 					// Section Titles
314 314
 					case 'title':
315
-						if ( ! empty( $value['title'] ) ) {
316
-							echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>';
315
+						if ( ! empty($value['title'])) {
316
+							echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>';
317 317
 						}
318 318
 
319
-						if ( ! empty( $value['desc'] ) ) {
320
-							echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) );
319
+						if ( ! empty($value['desc'])) {
320
+							echo wpautop(wptexturize(wp_kses_post($value['desc'])));
321 321
 						}
322 322
 
323
-						if ( $value['table_html'] ) {
324
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
323
+						if ($value['table_html']) {
324
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
325 325
 						}
326 326
 
327
-						if ( ! empty( $value['id'] ) ) {
327
+						if ( ! empty($value['id'])) {
328 328
 
329 329
 							/**
330 330
 							 * Trigger Action.
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 							 *
334 334
 							 * @since 1.8
335 335
 							 */
336
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
336
+							do_action('give_settings_'.sanitize_title($value['id']));
337 337
 						}
338 338
 
339 339
 						break;
340 340
 
341 341
 					// Section Ends.
342 342
 					case 'sectionend':
343
-						if ( ! empty( $value['id'] ) ) {
343
+						if ( ! empty($value['id'])) {
344 344
 
345 345
 							/**
346 346
 							 * Trigger Action.
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
 							 *
350 350
 							 * @since 1.8
351 351
 							 */
352
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
352
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
353 353
 						}
354 354
 
355
-						if ( $value['table_html'] ) {
355
+						if ($value['table_html']) {
356 356
 							echo '</table>';
357 357
 						}
358 358
 
359
-						if ( ! empty( $value['id'] ) ) {
359
+						if ( ! empty($value['id'])) {
360 360
 
361 361
 							/**
362 362
 							 * Trigger Action.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 							 *
366 366
 							 * @since 1.8
367 367
 							 */
368
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
368
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
369 369
 						}
370 370
 
371 371
 						break;
@@ -377,22 +377,22 @@  discard block
 block discarded – undo
377 377
 					case 'password' :
378 378
 
379 379
 						$type = $value['type'];
380
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
380
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
381 381
 
382 382
 						?>
383 383
 						<tr valign="top">
384 384
 						<th scope="row" class="titledesc">
385
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
385
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
386 386
 						</th>
387
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
387
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
388 388
 							<input
389
-								name="<?php echo esc_attr( $value['id'] ); ?>"
390
-								id="<?php echo esc_attr( $value['id'] ); ?>"
391
-								type="<?php echo esc_attr( $type ); ?>"
392
-								style="<?php echo esc_attr( $value['css'] ); ?>"
393
-								value="<?php echo esc_attr( $option_value ); ?>"
394
-								class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
395
-								<?php echo implode( ' ', $custom_attributes ); ?>
389
+								name="<?php echo esc_attr($value['id']); ?>"
390
+								id="<?php echo esc_attr($value['id']); ?>"
391
+								type="<?php echo esc_attr($type); ?>"
392
+								style="<?php echo esc_attr($value['css']); ?>"
393
+								value="<?php echo esc_attr($option_value); ?>"
394
+								class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
395
+								<?php echo implode(' ', $custom_attributes); ?>
396 396
 							/> <?php echo $description; ?>
397 397
 						</td>
398 398
 						</tr><?php
@@ -401,23 +401,23 @@  discard block
 block discarded – undo
401 401
 					// Textarea.
402 402
 					case 'textarea':
403 403
 
404
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
404
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
405 405
 
406 406
 						?>
407 407
 						<tr valign="top">
408 408
 						<th scope="row" class="titledesc">
409
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
409
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
410 410
 						</th>
411
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
411
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
412 412
 								<textarea
413
-									name="<?php echo esc_attr( $value['id'] ); ?>"
414
-									id="<?php echo esc_attr( $value['id'] ); ?>"
415
-									style="<?php echo esc_attr( $value['css'] ); ?>"
416
-									class="<?php echo esc_attr( $value['class'] ); ?>"
413
+									name="<?php echo esc_attr($value['id']); ?>"
414
+									id="<?php echo esc_attr($value['id']); ?>"
415
+									style="<?php echo esc_attr($value['css']); ?>"
416
+									class="<?php echo esc_attr($value['class']); ?>"
417 417
 									rows="10"
418 418
 									cols="60"
419
-									<?php echo implode( ' ', $custom_attributes ); ?>
420
-								><?php echo esc_textarea( $option_value ); ?></textarea>
419
+									<?php echo implode(' ', $custom_attributes); ?>
420
+								><?php echo esc_textarea($option_value); ?></textarea>
421 421
 							<?php echo $description; ?>
422 422
 						</td>
423 423
 						</tr><?php
@@ -427,35 +427,35 @@  discard block
 block discarded – undo
427 427
 					case 'select' :
428 428
 					case 'multiselect' :
429 429
 
430
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
430
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
431 431
 
432 432
 						?>
433 433
 						<tr valign="top">
434 434
 						<th scope="row" class="titledesc">
435
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
435
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
436 436
 						</th>
437
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
437
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
438 438
 							<select
439
-								name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) {
439
+								name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') {
440 440
 									echo '[]';
441 441
 								} ?>"
442
-								id="<?php echo esc_attr( $value['id'] ); ?>"
443
-								style="<?php echo esc_attr( $value['css'] ); ?>"
444
-								class="<?php echo esc_attr( $value['class'] ); ?>"
445
-								<?php echo implode( ' ', $custom_attributes ); ?>
446
-								<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
442
+								id="<?php echo esc_attr($value['id']); ?>"
443
+								style="<?php echo esc_attr($value['css']); ?>"
444
+								class="<?php echo esc_attr($value['class']); ?>"
445
+								<?php echo implode(' ', $custom_attributes); ?>
446
+								<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
447 447
 							>
448 448
 
449 449
 								<?php
450
-								if ( ! empty( $value['options'] ) ) {
451
-									foreach ( $value['options'] as $key => $val ) {
450
+								if ( ! empty($value['options'])) {
451
+									foreach ($value['options'] as $key => $val) {
452 452
 										?>
453
-										<option value="<?php echo esc_attr( $key ); ?>" <?php
453
+										<option value="<?php echo esc_attr($key); ?>" <?php
454 454
 
455
-										if ( is_array( $option_value ) ) {
456
-											selected( in_array( $key, $option_value ), true );
455
+										if (is_array($option_value)) {
456
+											selected(in_array($key, $option_value), true);
457 457
 										} else {
458
-											selected( $option_value, $key );
458
+											selected($option_value, $key);
459 459
 										}
460 460
 
461 461
 										?>><?php echo $val ?></option>
@@ -471,28 +471,28 @@  discard block
 block discarded – undo
471 471
 
472 472
 					// Radio inputs.
473 473
 					case 'radio_inline' :
474
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
474
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
475 475
 					case 'radio' :
476
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
476
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
477 477
 						?>
478 478
 						<tr valign="top">
479 479
 						<th scope="row" class="titledesc">
480
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
480
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
481 481
 						</th>
482
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
482
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
483 483
 							<fieldset>
484 484
 								<ul>
485 485
 									<?php
486
-									foreach ( $value['options'] as $key => $val ) {
486
+									foreach ($value['options'] as $key => $val) {
487 487
 										?>
488 488
 										<li>
489 489
 											<label><input
490
-													name="<?php echo esc_attr( $value['id'] ); ?>"
490
+													name="<?php echo esc_attr($value['id']); ?>"
491 491
 													value="<?php echo $key; ?>"
492 492
 													type="radio"
493
-													style="<?php echo esc_attr( $value['css'] ); ?>"
494
-													<?php echo implode( ' ', $custom_attributes ); ?>
495
-													<?php checked( $key, $option_value ); ?>
493
+													style="<?php echo esc_attr($value['css']); ?>"
494
+													<?php echo implode(' ', $custom_attributes); ?>
495
+													<?php checked($key, $option_value); ?>
496 496
 												/> <?php echo $val ?></label>
497 497
 										</li>
498 498
 										<?php
@@ -506,21 +506,21 @@  discard block
 block discarded – undo
506 506
 
507 507
 					// Checkbox input.
508 508
 					case 'checkbox' :
509
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
509
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
510 510
 						?>
511 511
 						<tr valign="top">
512 512
 							<th scope="row" class="titledesc">
513
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
513
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
514 514
 							</th>
515 515
 							<td class="give-forminp">
516 516
 								<input
517
-									name="<?php echo esc_attr( $value['id'] ); ?>"
518
-									id="<?php echo esc_attr( $value['id'] ); ?>"
517
+									name="<?php echo esc_attr($value['id']); ?>"
518
+									id="<?php echo esc_attr($value['id']); ?>"
519 519
 									type="checkbox"
520
-									class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
520
+									class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
521 521
 									value="1"
522
-									<?php checked( $option_value, 'on' ); ?>
523
-									<?php echo implode( ' ', $custom_attributes ); ?>
522
+									<?php checked($option_value, 'on'); ?>
523
+									<?php echo implode(' ', $custom_attributes); ?>
524 524
 								/>
525 525
 								<?php echo $description; ?>
526 526
 							</td>
@@ -530,28 +530,28 @@  discard block
 block discarded – undo
530 530
 
531 531
 					// Multi Checkbox input.
532 532
 					case 'multicheck' :
533
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
534
-						$option_value = is_array( $option_value ) ? $option_value : array();
533
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
534
+						$option_value = is_array($option_value) ? $option_value : array();
535 535
 						?>
536 536
 						<tr valign="top">
537 537
 							<th scope="row" class="titledesc">
538
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
538
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
539 539
 							</th>
540
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
540
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
541 541
 								<fieldset>
542 542
 									<ul>
543 543
 										<?php
544
-										foreach ( $value['options'] as $key => $val ) {
544
+										foreach ($value['options'] as $key => $val) {
545 545
 											?>
546 546
 											<li>
547 547
 												<label>
548 548
 													<input
549
-														name="<?php echo esc_attr( $value['id'] ); ?>[]"
549
+														name="<?php echo esc_attr($value['id']); ?>[]"
550 550
 														value="<?php echo $key; ?>"
551 551
 														type="checkbox"
552
-														style="<?php echo esc_attr( $value['css'] ); ?>"
553
-														<?php echo implode( ' ', $custom_attributes ); ?>
554
-														<?php if ( in_array( $key, $option_value ) ) {
552
+														style="<?php echo esc_attr($value['css']); ?>"
553
+														<?php echo implode(' ', $custom_attributes); ?>
554
+														<?php if (in_array($key, $option_value)) {
555 555
 															echo 'checked="checked"';
556 556
 														} ?>
557 557
 													/> <?php echo $val ?>
@@ -569,24 +569,24 @@  discard block
 block discarded – undo
569 569
 
570 570
 					// File input field.
571 571
 					case 'file' :
572
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
572
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
573 573
 						?>
574 574
 						<tr valign="top">
575 575
 						<th scope="row" class="titledesc">
576
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
576
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
577 577
 						</th>
578 578
 						<td class="give-forminp">
579 579
 							<div class="give-field-wrap">
580 580
 								<label for="<?php echo $value['id'] ?>">
581 581
 									<input
582
-										name="<?php echo esc_attr( $value['id'] ); ?>"
583
-										id="<?php echo esc_attr( $value['id'] ); ?>"
582
+										name="<?php echo esc_attr($value['id']); ?>"
583
+										id="<?php echo esc_attr($value['id']); ?>"
584 584
 										type="text"
585
-										class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
585
+										class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
586 586
 										value="<?php echo $option_value; ?>"
587
-										style="<?php echo esc_attr( $value['css'] ); ?>"
588
-										<?php echo implode( ' ', $custom_attributes ); ?>
589
-									/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button" value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>">
587
+										style="<?php echo esc_attr($value['css']); ?>"
588
+										<?php echo implode(' ', $custom_attributes); ?>
589
+									/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button" value="<?php echo esc_html__('Add or Upload File', 'give'); ?>">
590 590
 									<?php echo $description ?>
591 591
 									<div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>">
592 592
 										<span class="give-delete-image-thumb dashicons dashicons-no-alt"></span>
@@ -601,17 +601,17 @@  discard block
 block discarded – undo
601 601
 					// WordPress Editor.
602 602
 					case 'wysiwyg' :
603 603
 						// Get option value.
604
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
604
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
605 605
 
606 606
 						// Get editor settings.
607
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
607
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
608 608
 						?>
609 609
 						<tr valign="top">
610 610
 						<th scope="row" class="titledesc">
611
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
611
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
612 612
 						</th>
613 613
 						<td class="give-forminp">
614
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
614
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
615 615
 							<?php echo $description; ?>
616 616
 						</td>
617 617
 						</tr><?php
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 						?>
623 623
 						<tr valign="top">
624 624
 						<th scope="row" class="titledesc">
625
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
625
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
626 626
 						</th>
627 627
 						<td class="give-forminp">
628 628
 							<?php give_system_info_callback(); ?>
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 
634 634
 					// Custom: Default gateways setting field.
635 635
 					case 'default_gateway' :
636
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
636
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
637 637
 						?>
638 638
 						<tr valign="top">
639 639
 						<th scope="row" class="titledesc">
640
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
640
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
641 641
 						</th>
642 642
 						<td class="give-forminp">
643
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
643
+							<?php give_default_gateway_callback($value, $option_value); ?>
644 644
 							<?php echo $description; ?>
645 645
 						</td>
646 646
 						</tr><?php
@@ -648,14 +648,14 @@  discard block
 block discarded – undo
648 648
 
649 649
 					// Custom: Enable gateways setting field.
650 650
 					case 'enabled_gateways' :
651
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
651
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
652 652
 						?>
653 653
 						<tr valign="top">
654 654
 						<th scope="row" class="titledesc">
655
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
655
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
656 656
 						</th>
657 657
 						<td class="give-forminp">
658
-							<?php give_enabled_gateways_callback( $value, $option_value ); ?>
658
+							<?php give_enabled_gateways_callback($value, $option_value); ?>
659 659
 							<?php echo $description; ?>
660 660
 						</td>
661 661
 						</tr><?php
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 						?>
667 667
 						<tr valign="top">
668 668
 						<th scope="row" class="titledesc">
669
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
669
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
670 670
 						</th>
671 671
 						<td class="give-forminp">
672 672
 							<?php give_email_preview_buttons_callback(); ?>
@@ -698,8 +698,8 @@  discard block
 block discarded – undo
698 698
 					// You can add or handle your custom field action.
699 699
 					default:
700 700
 						// Get option value.
701
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
702
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
701
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
702
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
703 703
 						break;
704 704
 				}
705 705
 			}
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
 		 *
716 716
 		 * @return array The description and tip as a 2 element array
717 717
 		 */
718
-		public static function get_field_description( $value ) {
718
+		public static function get_field_description($value) {
719 719
 			$description = '';
720 720
 
721
-			if ( ! empty( $value['desc'] ) ) {
722
-				$description = '<p class="give-field-description">' . wp_kses_post( $value['desc'] ) . '</p>';
721
+			if ( ! empty($value['desc'])) {
722
+				$description = '<p class="give-field-description">'.wp_kses_post($value['desc']).'</p>';
723 723
 			}
724 724
 
725 725
 			return $description;
@@ -736,11 +736,11 @@  discard block
 block discarded – undo
736 736
 		 *
737 737
 		 * @return array The description and tip as a 2 element array
738 738
 		 */
739
-		public static function get_field_title( $value ) {
740
-			$title = esc_html( $value['title'] );
739
+		public static function get_field_title($value) {
740
+			$title = esc_html($value['title']);
741 741
 
742 742
 			// If html tag detected then allow them to print.
743
-			if ( strip_tags( $title ) ) {
743
+			if (strip_tags($title)) {
744 744
 				$title = $value['title'];
745 745
 			}
746 746
 
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
 		 *
760 760
 		 * @return bool
761 761
 		 */
762
-		public static function save_fields( $options, $option_name = '' ) {
763
-			if ( empty( $_POST ) ) {
762
+		public static function save_fields($options, $option_name = '') {
763
+			if (empty($_POST)) {
764 764
 				return false;
765 765
 			}
766 766
 
@@ -768,36 +768,36 @@  discard block
 block discarded – undo
768 768
 			$update_options = array();
769 769
 
770 770
 			// Loop options and get values to save.
771
-			foreach ( $options as $option ) {
772
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
771
+			foreach ($options as $option) {
772
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
773 773
 					continue;
774 774
 				}
775 775
 
776 776
 				// Get posted value.
777
-				if ( strstr( $option['id'], '[' ) ) {
778
-					parse_str( $option['id'], $option_name_array );
779
-					$field_option_name = current( array_keys( $option_name_array ) );
780
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
781
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
777
+				if (strstr($option['id'], '[')) {
778
+					parse_str($option['id'], $option_name_array);
779
+					$field_option_name = current(array_keys($option_name_array));
780
+					$setting_name      = key($option_name_array[$field_option_name]);
781
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
782 782
 				} else {
783 783
 					$field_option_name = $option['id'];
784 784
 					$setting_name      = '';
785
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
785
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
786 786
 				}
787 787
 
788 788
 				// Format the value based on option type.
789
-				switch ( $option['type'] ) {
789
+				switch ($option['type']) {
790 790
 					case 'checkbox' :
791
-						$value = is_null( $raw_value ) ? '' : 'on';
791
+						$value = is_null($raw_value) ? '' : 'on';
792 792
 						break;
793 793
 					case 'textarea' :
794
-						$value = wp_kses_post( trim( $raw_value ) );
794
+						$value = wp_kses_post(trim($raw_value));
795 795
 						break;
796 796
 					case 'multiselect' :
797
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
797
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
798 798
 						break;
799 799
 					default :
800
-						$value = give_clean( $raw_value );
800
+						$value = give_clean($raw_value);
801 801
 						break;
802 802
 				}
803 803
 
@@ -806,37 +806,37 @@  discard block
 block discarded – undo
806 806
 				 *
807 807
 				 * @since 1.8
808 808
 				 */
809
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
809
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
810 810
 
811 811
 				/**
812 812
 				 * Sanitize the value of an option by option name.
813 813
 				 *
814 814
 				 * @since 1.8
815 815
 				 */
816
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
816
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
817 817
 
818
-				if ( is_null( $value ) ) {
818
+				if (is_null($value)) {
819 819
 					continue;
820 820
 				}
821 821
 
822 822
 				// Check if option is an array and handle that differently to single values.
823
-				if ( $field_option_name && $setting_name ) {
824
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
825
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
823
+				if ($field_option_name && $setting_name) {
824
+					if ( ! isset($update_options[$field_option_name])) {
825
+						$update_options[$field_option_name] = get_option($field_option_name, array());
826 826
 					}
827
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
828
-						$update_options[ $field_option_name ] = array();
827
+					if ( ! is_array($update_options[$field_option_name])) {
828
+						$update_options[$field_option_name] = array();
829 829
 					}
830
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
830
+					$update_options[$field_option_name][$setting_name] = $value;
831 831
 				} else {
832
-					$update_options[ $field_option_name ] = $value;
832
+					$update_options[$field_option_name] = $value;
833 833
 				}
834 834
 			}
835 835
 
836 836
 			// Save all options in our array or there own option name i.e. option id.
837
-			if ( empty( $option_name ) ) {
838
-				foreach ( $update_options as $name => $value ) {
839
-					update_option( $name, $value );
837
+			if (empty($option_name)) {
838
+				foreach ($update_options as $name => $value) {
839
+					update_option($name, $value);
840 840
 
841 841
 					/**
842 842
 					 * Trigger action.
@@ -845,13 +845,13 @@  discard block
 block discarded – undo
845 845
 					 *
846 846
 					 * @since 1.8
847 847
 					 */
848
-					do_action( "give_save_option_{$name}", $value, $name );
848
+					do_action("give_save_option_{$name}", $value, $name);
849 849
 				}
850 850
 			} else {
851
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
852
-				$update_options = array_merge( $old_options, $update_options );
851
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
852
+				$update_options = array_merge($old_options, $update_options);
853 853
 
854
-				update_option( $option_name, $update_options );
854
+				update_option($option_name, $update_options);
855 855
 
856 856
 				/**
857 857
 				 * Trigger action.
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 				 *
861 861
 				 * @since 1.8
862 862
 				 */
863
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name );
863
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name);
864 864
 			}
865 865
 
866 866
 			return true;
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param $url
73 73
 	 *
74
-	 * @return mixed
74
+	 * @return string
75 75
 	 */
76 76
 	public function give_update_cmb_meta_box_url( $url ) {
77 77
 		//Path to Give's CMB
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
  * @global $give_options
850 850
  *
851 851
  * @param string          $key The Key to update
852
- * @param string|bool|int $value The value to set the key to
852
+ * @param integer $value The value to set the key to
853 853
  *
854 854
  * @return boolean True if updated, false if not.
855 855
  */
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
  * @since      1.3.5
953 953
  *
954 954
  * @param $array
955
- * @param $position |int|string Expects an array key or 'id' of the settings field to appear after
955
+ * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after
956 956
  * @param $insert |array a valid array of options to insert
957 957
  *
958 958
  * @return array
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
  *
991 991
  * @since 1.0
992 992
  * @param array $field_arr
993
- * @param array $saved_values
993
+ * @param string|boolean $saved_values
994 994
  * @return void
995 995
  */
996 996
 function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) {
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
  *
1024 1024
  * @since  1.0
1025 1025
  * @param  array $field_arr
1026
- * @param  array $saved_value
1026
+ * @param  string|boolean $saved_value
1027 1027
  * @return void
1028 1028
  */
1029 1029
 function give_default_gateway_callback( $field_arr, $saved_value ) {
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -1166,25 +1166,25 @@  discard block
 block discarded – undo
1166 1166
  * @return void
1167 1167
  */
1168 1168
 function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1169
-    /* @var CMB2_Types $field_type_object*/
1169
+	/* @var CMB2_Types $field_type_object*/
1170 1170
 
1171
-    $id                   = $field_type_object->field->args['id'];
1171
+	$id                   = $field_type_object->field->args['id'];
1172 1172
 	$field_description    = $field_type_object->field->args['desc'];
1173 1173
 	$license              = $field_type_object->field->args['options']['license'];
1174
-    $license_key          = $escaped_value;
1175
-    $is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1176
-    $is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1177
-    $shortname            = $field_type_object->field->args['options']['shortname'];
1174
+	$license_key          = $escaped_value;
1175
+	$is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1176
+	$is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1177
+	$shortname            = $field_type_object->field->args['options']['shortname'];
1178 1178
 	$field_classes        = 'regular-text give-license-field';
1179 1179
 	$type                 = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1180
-    $custom_html          = '';
1181
-    $messages             = array();
1182
-    $class                = '';
1183
-    $account_page_link    = $field_type_object->field->args['options']['account_url'];
1184
-    $checkout_page_link   = $field_type_object->field->args['options']['checkout_url'];
1185
-    $addon_name           = $field_type_object->field->args['options']['item_name'];
1186
-    $license_status       = null;
1187
-    $is_in_subscription   = null;
1180
+	$custom_html          = '';
1181
+	$messages             = array();
1182
+	$class                = '';
1183
+	$account_page_link    = $field_type_object->field->args['options']['account_url'];
1184
+	$checkout_page_link   = $field_type_object->field->args['options']['checkout_url'];
1185
+	$addon_name           = $field_type_object->field->args['options']['item_name'];
1186
+	$license_status       = null;
1187
+	$is_in_subscription   = null;
1188 1188
 
1189 1189
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1190 1190
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
@@ -1193,141 +1193,141 @@  discard block
 block discarded – undo
1193 1193
 	}
1194 1194
 
1195 1195
 
1196
-    // Check if current license is part of subscription or not.
1197
-    $subscriptions = get_option( 'give_subscriptions' );
1198
-
1199
-    if( $is_license_key && $subscriptions ) {
1200
-        foreach ( $subscriptions as $subscription ) {
1201
-            if( in_array( $license_key, $subscription['licenses'] ) ) {
1202
-                $is_in_subscription = $subscription['id'];
1203
-                break;
1204
-            }
1205
-        }
1206
-    }
1207
-
1208
-
1209
-    if( $is_license_key ) {
1210
-        if( $is_in_subscription ) {
1211
-            $subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1212
-            $subscription_status  = esc_html__( 'renew', 'give' );
1213
-
1214
-            if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1215
-                $subscription_status = esc_html__( 'expire', 'give' );
1216
-            }
1217
-
1218
-            if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1219
-                $messages[] = sprintf(
1220
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1221
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1222
-                    $subscriptions[$is_in_subscription]['payment_id'],
1223
-                    $checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1224
-                );
1225
-                $license_status = 'license-expired';
1226
-            } elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1227
-                $messages[] = sprintf(
1228
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1229
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1230
-                    $subscriptions[$is_in_subscription]['payment_id'],
1231
-                    $subscription_status,
1232
-                    human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1233
-                );
1234
-                $license_status = 'license-expires-soon';
1235
-            } else {
1236
-                $messages[] = sprintf(
1237
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1238
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1239
-                    $subscriptions[$is_in_subscription]['payment_id'],
1240
-                    $subscription_status,
1241
-                    date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1242
-                );
1243
-                $license_status = 'license-expiration-date';
1244
-            }
1245
-
1246
-
1247
-        } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1248
-
1249
-            // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1250
-            switch(   $license->error ) {
1251
-                case 'expired' :
1252
-                    $class = $license->error;
1253
-                    $messages[] = sprintf(
1254
-                        __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1255
-                        date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1256
-                        $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1257
-                    );
1258
-                    $license_status = 'license-' . $class;
1259
-                    break;
1260
-
1261
-                case 'missing' :
1262
-                    $class = $license->error;
1263
-                    $messages[] = sprintf(
1264
-                        __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1265
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1266
-                    );
1267
-                    $license_status = 'license-' . $class;
1268
-                    break;
1269
-
1270
-                case 'invalid' :
1271
-                    $class = $license->error;
1272
-                    $messages[] = sprintf(
1273
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1274
-                        $addon_name,
1275
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1276
-                    );
1277
-                    $license_status = 'license-' . $class;
1278
-                    break;
1279
-
1280
-                case 'site_inactive' :
1281
-                    $class = $license->error;
1282
-                    $messages[] = sprintf(
1283
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1284
-                        $addon_name,
1285
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1286
-                    );
1287
-                    $license_status = 'license-' . $class;
1288
-                    break;
1289
-
1290
-                case 'item_name_mismatch' :
1291
-                    $class = $license->error;
1292
-                    $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $license_key, $addon_name );
1293
-                    $license_status = 'license-' . $class;
1294
-                    break;
1295
-
1296
-                case 'no_activations_left':
1297
-                    $class = $license->error;
1298
-                    $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1299
-                    $license_status = 'license-' . $class;
1300
-                    break;
1301
-            }
1302
-        } else {
1303
-            switch( $license->license ) {
1304
-                case 'valid' :
1305
-                default:
1306
-                    $class = 'valid';
1307
-                    $now        = current_time( 'timestamp' );
1308
-                    $expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1309
-
1310
-                    if( 'lifetime' === $license->expires ) {
1311
-                        $messages[] = esc_html__( 'License key never expires.', 'give' );
1312
-                        $license_status = 'license-lifetime-notice';
1313
-                    } elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1314
-                        $messages[] = sprintf(
1315
-                            __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1316
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1317
-                            $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1318
-                        );
1319
-                        $license_status = 'license-expires-soon';
1320
-                    } else {
1321
-                        $messages[] = sprintf(
1322
-                            __( 'Your license key expires on %s.', 'give' ),
1323
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1324
-                        );
1325
-                        $license_status = 'license-expiration-date';
1326
-                    }
1327
-                    break;
1328
-            }
1329
-        }
1330
-    } else{
1196
+	// Check if current license is part of subscription or not.
1197
+	$subscriptions = get_option( 'give_subscriptions' );
1198
+
1199
+	if( $is_license_key && $subscriptions ) {
1200
+		foreach ( $subscriptions as $subscription ) {
1201
+			if( in_array( $license_key, $subscription['licenses'] ) ) {
1202
+				$is_in_subscription = $subscription['id'];
1203
+				break;
1204
+			}
1205
+		}
1206
+	}
1207
+
1208
+
1209
+	if( $is_license_key ) {
1210
+		if( $is_in_subscription ) {
1211
+			$subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1212
+			$subscription_status  = esc_html__( 'renew', 'give' );
1213
+
1214
+			if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1215
+				$subscription_status = esc_html__( 'expire', 'give' );
1216
+			}
1217
+
1218
+			if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1219
+				$messages[] = sprintf(
1220
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1221
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1222
+					$subscriptions[$is_in_subscription]['payment_id'],
1223
+					$checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1224
+				);
1225
+				$license_status = 'license-expired';
1226
+			} elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1227
+				$messages[] = sprintf(
1228
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1229
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1230
+					$subscriptions[$is_in_subscription]['payment_id'],
1231
+					$subscription_status,
1232
+					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1233
+				);
1234
+				$license_status = 'license-expires-soon';
1235
+			} else {
1236
+				$messages[] = sprintf(
1237
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1238
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1239
+					$subscriptions[$is_in_subscription]['payment_id'],
1240
+					$subscription_status,
1241
+					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1242
+				);
1243
+				$license_status = 'license-expiration-date';
1244
+			}
1245
+
1246
+
1247
+		} elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1248
+
1249
+			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1250
+			switch(   $license->error ) {
1251
+				case 'expired' :
1252
+					$class = $license->error;
1253
+					$messages[] = sprintf(
1254
+						__( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1255
+						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1256
+						$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1257
+					);
1258
+					$license_status = 'license-' . $class;
1259
+					break;
1260
+
1261
+				case 'missing' :
1262
+					$class = $license->error;
1263
+					$messages[] = sprintf(
1264
+						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1265
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1266
+					);
1267
+					$license_status = 'license-' . $class;
1268
+					break;
1269
+
1270
+				case 'invalid' :
1271
+					$class = $license->error;
1272
+					$messages[] = sprintf(
1273
+						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1274
+						$addon_name,
1275
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1276
+					);
1277
+					$license_status = 'license-' . $class;
1278
+					break;
1279
+
1280
+				case 'site_inactive' :
1281
+					$class = $license->error;
1282
+					$messages[] = sprintf(
1283
+						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1284
+						$addon_name,
1285
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1286
+					);
1287
+					$license_status = 'license-' . $class;
1288
+					break;
1289
+
1290
+				case 'item_name_mismatch' :
1291
+					$class = $license->error;
1292
+					$messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $license_key, $addon_name );
1293
+					$license_status = 'license-' . $class;
1294
+					break;
1295
+
1296
+				case 'no_activations_left':
1297
+					$class = $license->error;
1298
+					$messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1299
+					$license_status = 'license-' . $class;
1300
+					break;
1301
+			}
1302
+		} else {
1303
+			switch( $license->license ) {
1304
+				case 'valid' :
1305
+				default:
1306
+					$class = 'valid';
1307
+					$now        = current_time( 'timestamp' );
1308
+					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1309
+
1310
+					if( 'lifetime' === $license->expires ) {
1311
+						$messages[] = esc_html__( 'License key never expires.', 'give' );
1312
+						$license_status = 'license-lifetime-notice';
1313
+					} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1314
+						$messages[] = sprintf(
1315
+							__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1316
+							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1317
+							$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1318
+						);
1319
+						$license_status = 'license-expires-soon';
1320
+					} else {
1321
+						$messages[] = sprintf(
1322
+							__( 'Your license key expires on %s.', 'give' ),
1323
+							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1324
+						);
1325
+						$license_status = 'license-expiration-date';
1326
+					}
1327
+					break;
1328
+			}
1329
+		}
1330
+	} else{
1331 1331
 		$class = 'empty';
1332 1332
 		$messages[] = sprintf(
1333 1333
 			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 	}
1338 1338
 
1339 1339
 
1340
-    // Add class for input field if license is active.
1340
+	// Add class for input field if license is active.
1341 1341
 	if ( $is_valid_license ) {
1342 1342
 		$field_classes .= ' give-license-active';
1343 1343
 	}
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
 	// If license is active so show deactivate button
1349 1349
 	if ( $is_valid_license ) {
1350
-        // Get input field html.
1350
+		// Get input field html.
1351 1351
 		$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">";
1352 1352
 
1353 1353
 		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
@@ -1356,27 +1356,27 @@  discard block
 block discarded – undo
1356 1356
 	// Field description.
1357 1357
 	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1358 1358
 
1359
-    // If no messages found then inform user that to get updated in future register yourself.
1360
-    if ( empty( $messages ) ) {
1361
-        $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1362
-    }
1359
+	// If no messages found then inform user that to get updated in future register yourself.
1360
+	if ( empty( $messages ) ) {
1361
+		$messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1362
+	}
1363 1363
 
1364
-    foreach( $messages as $message ) {
1365
-        $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">';
1366
-        $custom_html .= '<p>' . $message . '</p>';
1367
-        $custom_html .= '</div>';
1368
-    }
1364
+	foreach( $messages as $message ) {
1365
+		$custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">';
1366
+		$custom_html .= '<p>' . $message . '</p>';
1367
+		$custom_html .= '</div>';
1368
+	}
1369 1369
 
1370 1370
 
1371 1371
 
1372
-    // Field html.
1373
-    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1372
+	// Field html.
1373
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1374 1374
 
1375
-    // Nonce.
1375
+	// Nonce.
1376 1376
 	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1377 1377
 
1378
-    // Print field html.
1379
-    echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>";
1378
+	// Print field html.
1379
+	echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>";
1380 1380
 }
1381 1381
 
1382 1382
 
Please login to merge, or discard this patch.
Spacing   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 	public function __construct() {
43 43
 
44 44
 		//Custom CMB2 Settings Fields
45
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
46
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
47
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
48
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
49
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
50
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
51
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
52
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
45
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
46
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
47
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
48
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
49
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
50
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
51
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
52
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
53 53
 	}
54 54
 
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @since  1.0
60 60
 	 */
61 61
 	public function init() {
62
-		register_setting( $this->key, $this->key );
62
+		register_setting($this->key, $this->key);
63 63
 
64 64
 	}
65 65
 
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return mixed
75 75
 	 */
76
-	public function give_update_cmb_meta_box_url( $url ) {
76
+	public function give_update_cmb_meta_box_url($url) {
77 77
 		//Path to Give's CMB
78
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
78
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
79 79
 	}
80 80
 
81 81
 
@@ -87,27 +87,27 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function give_get_settings_tabs() {
89 89
 
90
-		$settings = $this->give_settings( null );
90
+		$settings = $this->give_settings(null);
91 91
 
92 92
 		$tabs             = array();
93
-		$tabs['general']  = esc_html__( 'General', 'give' );
94
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
95
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
96
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
93
+		$tabs['general']  = esc_html__('General', 'give');
94
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
95
+		$tabs['display']  = esc_html__('Display Options', 'give');
96
+		$tabs['emails']   = esc_html__('Emails', 'give');
97 97
 
98
-		if ( ! empty( $settings['addons']['fields'] ) ) {
99
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
98
+		if ( ! empty($settings['addons']['fields'])) {
99
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
100 100
 		}
101 101
 
102
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
103
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
102
+		if ( ! empty($settings['licenses']['fields'])) {
103
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
104 104
 		}
105 105
 
106
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
107
-		$tabs['api']         = esc_html__( 'API', 'give' );
108
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
106
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
107
+		$tabs['api']         = esc_html__('API', 'give');
108
+		$tabs['system_info'] = esc_html__('System Info', 'give');
109 109
 
110
-		return apply_filters( 'give_settings_tabs', $tabs );
110
+		return apply_filters('give_settings_tabs', $tabs);
111 111
 	}
112 112
 
113 113
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function admin_page_display() {
119 119
 
120
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
120
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
121 121
 
122 122
 		?>
123 123
 
@@ -127,22 +127,22 @@  discard block
 block discarded – undo
127 127
 
128 128
 			<h2 class="nav-tab-wrapper">
129 129
 				<?php
130
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
130
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
131 131
 
132
-					$tab_url = esc_url( add_query_arg( array(
132
+					$tab_url = esc_url(add_query_arg(array(
133 133
 						'settings-updated' => false,
134 134
 						'tab'              => $tab_id
135
-					) ) );
135
+					)));
136 136
 
137 137
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
138 138
 
139
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
139
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
140 140
 
141 141
 				}
142 142
 				?>
143 143
 			</h2>
144 144
 
145
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
145
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
146 146
 
147 147
 		</div><!-- .wrap -->
148 148
 
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @return string
166 166
 	 */
167
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
167
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
168 168
 
169 169
 		//only modify the give settings form
170
-		if ( 'give_settings' == $object_id ) {
170
+		if ('give_settings' == $object_id) {
171 171
 
172
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
172
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>';
173 173
 
174 174
 		}
175 175
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return array
188 188
 	 */
189
-	public function give_settings( $active_tab ) {
189
+	public function give_settings($active_tab) {
190 190
 
191 191
 		$give_settings = array(
192 192
 			/**
@@ -194,99 +194,99 @@  discard block
 block discarded – undo
194 194
 			 */
195 195
 			'general'     => array(
196 196
 				'id'         => 'general_settings',
197
-				'give_title' => esc_html__( 'General Settings', 'give' ),
198
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
199
-				'fields'     => apply_filters( 'give_settings_general', array(
197
+				'give_title' => esc_html__('General Settings', 'give'),
198
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
199
+				'fields'     => apply_filters('give_settings_general', array(
200 200
 						array(
201
-							'name' => esc_html__( 'General Settings', 'give' ),
201
+							'name' => esc_html__('General Settings', 'give'),
202 202
 							'desc' => '',
203 203
 							'type' => 'give_title',
204 204
 							'id'   => 'give_title_general_settings_1'
205 205
 						),
206 206
 						array(
207
-							'name'    => esc_html__( 'Success Page', 'give' ),
207
+							'name'    => esc_html__('Success Page', 'give'),
208 208
 							/* translators: %s: [give_receipt] */
209
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
209
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
210 210
 							'id'      => 'success_page',
211 211
 							'type'    => 'select',
212
-							'options' => give_cmb2_get_post_options( array(
212
+							'options' => give_cmb2_get_post_options(array(
213 213
 								'post_type'   => 'page',
214
-								'numberposts' => - 1
215
-							) ),
214
+								'numberposts' => -1
215
+							)),
216 216
 						),
217 217
 						array(
218
-							'name'    => esc_html__( 'Failed Donation Page', 'give' ),
219
-							'desc'    => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
218
+							'name'    => esc_html__('Failed Donation Page', 'give'),
219
+							'desc'    => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'),
220 220
 							'id'      => 'failure_page',
221 221
 							'type'    => 'select',
222
-							'options' => give_cmb2_get_post_options( array(
222
+							'options' => give_cmb2_get_post_options(array(
223 223
 								'post_type'   => 'page',
224
-								'numberposts' => - 1
225
-							) ),
224
+								'numberposts' => -1
225
+							)),
226 226
 						),
227 227
 						array(
228
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
228
+							'name'    => esc_html__('Donation History Page', 'give'),
229 229
 							/* translators: %s: [donation_history] */
230
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
230
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
231 231
 							'id'      => 'history_page',
232 232
 							'type'    => 'select',
233
-							'options' => give_cmb2_get_post_options( array(
233
+							'options' => give_cmb2_get_post_options(array(
234 234
 								'post_type'   => 'page',
235
-								'numberposts' => - 1
236
-							) ),
235
+								'numberposts' => -1
236
+							)),
237 237
 						),
238 238
 						array(
239
-							'name'    => esc_html__( 'Base Country', 'give' ),
240
-							'desc'    => esc_html__( 'The country your site operates from.', 'give' ),
239
+							'name'    => esc_html__('Base Country', 'give'),
240
+							'desc'    => esc_html__('The country your site operates from.', 'give'),
241 241
 							'id'      => 'base_country',
242 242
 							'type'    => 'select',
243 243
 							'options' => give_get_country_list(),
244 244
 						),
245 245
 						array(
246
-							'name' => esc_html__( 'Currency Settings', 'give' ),
246
+							'name' => esc_html__('Currency Settings', 'give'),
247 247
 							'desc' => '',
248 248
 							'type' => 'give_title',
249 249
 							'id'   => 'give_title_general_settings_2'
250 250
 						),
251 251
 						array(
252
-							'name'    => esc_html__( 'Currency', 'give' ),
253
-							'desc'    => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
252
+							'name'    => esc_html__('Currency', 'give'),
253
+							'desc'    => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
254 254
 							'id'      => 'currency',
255 255
 							'type'    => 'select',
256 256
 							'options' => give_get_currencies(),
257 257
 							'default' => 'USD',
258 258
 						),
259 259
 						array(
260
-							'name'    => esc_html__( 'Currency Position', 'give' ),
261
-							'desc'    => esc_html__( 'The position of the currency symbol.', 'give' ),
260
+							'name'    => esc_html__('Currency Position', 'give'),
261
+							'desc'    => esc_html__('The position of the currency symbol.', 'give'),
262 262
 							'id'      => 'currency_position',
263 263
 							'type'    => 'select',
264 264
 							'options' => array(
265 265
 								/* translators: %s: currency symbol */
266
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
266
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
267 267
 								/* translators: %s: currency symbol */
268
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
268
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
269 269
 							),
270 270
 							'default' => 'before',
271 271
 						),
272 272
 						array(
273
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
274
-							'desc'            => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
273
+							'name'            => esc_html__('Thousands Separator', 'give'),
274
+							'desc'            => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
275 275
 							'id'              => 'thousands_separator',
276 276
 							'type'            => 'text_small',
277 277
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
278 278
 							'default'         => ',',
279 279
 						),
280 280
 						array(
281
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
282
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
281
+							'name'    => esc_html__('Decimal Separator', 'give'),
282
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
283 283
 							'id'      => 'decimal_separator',
284 284
 							'type'    => 'text_small',
285 285
 							'default' => '.',
286 286
 						),
287 287
 						array(
288
-							'name'            => esc_html__( 'Number of Decimals', 'give' ),
289
-							'desc'            => esc_html__( 'The number of decimal points displayed in amounts.', 'give' ),
288
+							'name'            => esc_html__('Number of Decimals', 'give'),
289
+							'desc'            => esc_html__('The number of decimal points displayed in amounts.', 'give'),
290 290
 							'id'              => 'number_decimals',
291 291
 							'type'            => 'text_small',
292 292
 							'default'         => 2,
@@ -300,83 +300,83 @@  discard block
 block discarded – undo
300 300
 			 */
301 301
 			'gateways'    => array(
302 302
 				'id'         => 'payment_gateways',
303
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
304
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
305
-				'fields'     => apply_filters( 'give_settings_gateways', array(
303
+				'give_title' => esc_html__('Payment Gateways', 'give'),
304
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
305
+				'fields'     => apply_filters('give_settings_gateways', array(
306 306
 						array(
307
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
307
+							'name' => esc_html__('Gateways Settings', 'give'),
308 308
 							'desc' => '',
309 309
 							'id'   => 'give_title_gateway_settings_1',
310 310
 							'type' => 'give_title'
311 311
 						),
312 312
 						array(
313
-							'name' => esc_html__( 'Test Mode', 'give' ),
314
-							'desc' => esc_html__( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
313
+							'name' => esc_html__('Test Mode', 'give'),
314
+							'desc' => esc_html__('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
315 315
 							'id'   => 'test_mode',
316 316
 							'type' => 'checkbox'
317 317
 						),
318 318
 						array(
319
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
320
-							'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
319
+							'name' => esc_html__('Enabled Gateways', 'give'),
320
+							'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'),
321 321
 							'id'   => 'gateways',
322 322
 							'type' => 'enabled_gateways'
323 323
 						),
324 324
 						array(
325
-							'name' => esc_html__( 'Default Gateway', 'give' ),
326
-							'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ),
325
+							'name' => esc_html__('Default Gateway', 'give'),
326
+							'desc' => esc_html__('The gateway that will be selected by default.', 'give'),
327 327
 							'id'   => 'default_gateway',
328 328
 							'type' => 'default_gateway'
329 329
 						),
330 330
 						array(
331
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
331
+							'name' => esc_html__('PayPal Standard', 'give'),
332 332
 							'desc' => '',
333 333
 							'type' => 'give_title',
334 334
 							'id'   => 'give_title_gateway_settings_2',
335 335
 						),
336 336
 						array(
337
-							'name' => esc_html__( 'PayPal Email', 'give' ),
338
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
337
+							'name' => esc_html__('PayPal Email', 'give'),
338
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
339 339
 							'id'   => 'paypal_email',
340 340
 							'type' => 'text_email',
341 341
 						),
342 342
 						array(
343
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
344
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
343
+							'name' => esc_html__('PayPal Page Style', 'give'),
344
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
345 345
 							'id'   => 'paypal_page_style',
346 346
 							'type' => 'text',
347 347
 						),
348 348
 						array(
349
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
350
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
349
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
350
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
351 351
 							'id'      => 'paypal_button_type',
352 352
 							'type'    => 'radio_inline',
353 353
 							'options' => array(
354
-								'donation' => esc_html__( 'Donation', 'give' ),
355
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
354
+								'donation' => esc_html__('Donation', 'give'),
355
+								'standard' => esc_html__('Standard Transaction', 'give')
356 356
 							),
357 357
 							'default' => 'donation',
358 358
 						),
359 359
 						array(
360
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
361
-							'desc' => esc_html__( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
360
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
361
+							'desc' => esc_html__('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
362 362
 							'id'   => 'disable_paypal_verification',
363 363
 							'type' => 'checkbox'
364 364
 						),
365 365
 						array(
366
-							'name' => esc_html__( 'Offline Donations', 'give' ),
366
+							'name' => esc_html__('Offline Donations', 'give'),
367 367
 							'desc' => '',
368 368
 							'type' => 'give_title',
369 369
 							'id'   => 'give_title_gateway_settings_3',
370 370
 						),
371 371
 						array(
372
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
373
-							'desc' => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
372
+							'name' => esc_html__('Collect Billing Details', 'give'),
373
+							'desc' => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
374 374
 							'id'   => 'give_offline_donation_enable_billing_fields',
375 375
 							'type' => 'checkbox'
376 376
 						),
377 377
 						array(
378
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
379
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
378
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
379
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
380 380
 							'id'      => 'global_offline_donation_content',
381 381
 							'default' => give_get_default_offline_donation_content(),
382 382
 							'type'    => 'wysiwyg',
@@ -385,15 +385,15 @@  discard block
 block discarded – undo
385 385
 							)
386 386
 						),
387 387
 						array(
388
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
389
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
388
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
389
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
390 390
 							'id'      => 'offline_donation_subject',
391
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
391
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
392 392
 							'type'    => 'text'
393 393
 						),
394 394
 						array(
395
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
396
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
395
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
396
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
397 397
 							'id'      => 'global_offline_donation_email',
398 398
 							'default' => give_get_default_offline_donation_email_content(),
399 399
 							'type'    => 'wysiwyg',
@@ -407,95 +407,95 @@  discard block
 block discarded – undo
407 407
 			/** Display Settings */
408 408
 			'display'     => array(
409 409
 				'id'         => 'display_settings',
410
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
411
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
412
-				'fields'     => apply_filters( 'give_settings_display', array(
410
+				'give_title' => esc_html__('Display Settings', 'give'),
411
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
412
+				'fields'     => apply_filters('give_settings_display', array(
413 413
 						array(
414
-							'name' => esc_html__( 'Display Settings', 'give' ),
414
+							'name' => esc_html__('Display Settings', 'give'),
415 415
 							'desc' => '',
416 416
 							'id'   => 'give_title_display_settings_1',
417 417
 							'type' => 'give_title'
418 418
 						),
419 419
 						array(
420
-							'name' => esc_html__( 'Disable CSS', 'give' ),
421
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
420
+							'name' => esc_html__('Disable CSS', 'give'),
421
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
422 422
 							'id'   => 'disable_css',
423 423
 							'type' => 'checkbox'
424 424
 						),
425 425
 						array(
426
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
426
+							'name' => esc_html__('Enable Floating Labels', 'give'),
427 427
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
428
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
428
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
429 429
 							'id'   => 'floatlabels',
430 430
 							'type' => 'checkbox'
431 431
 						),
432 432
 						array(
433
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
433
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
434 434
 							/* translators: %s: about page URL */
435
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
435
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
436 436
 							'id'   => 'disable_welcome',
437 437
 							'type' => 'checkbox'
438 438
 						),
439 439
 						array(
440
-							'name' => esc_html__( 'Post Types', 'give' ),
440
+							'name' => esc_html__('Post Types', 'give'),
441 441
 							'desc' => '',
442 442
 							'id'   => 'give_title_display_settings_2',
443 443
 							'type' => 'give_title'
444 444
 						),
445 445
 						array(
446
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
447
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
446
+							'name' => esc_html__('Disable Form Single Views', 'give'),
447
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
448 448
 							'id'   => 'disable_forms_singular',
449 449
 							'type' => 'checkbox'
450 450
 						),
451 451
 						array(
452
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
453
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
452
+							'name' => esc_html__('Disable Form Archives', 'give'),
453
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
454 454
 							'id'   => 'disable_forms_archives',
455 455
 							'type' => 'checkbox'
456 456
 						),
457 457
 						array(
458
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
459
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
458
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
459
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
460 460
 							'id'   => 'disable_forms_excerpt',
461 461
 							'type' => 'checkbox'
462 462
 						),
463 463
 
464 464
 						array(
465
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
466
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
465
+							'name'    => esc_html__('Featured Image Size', 'give'),
466
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
467 467
 							'id'      => 'featured_image_size',
468 468
 							'type'    => 'select',
469 469
 							'default' => 'large',
470 470
 							'options' => give_get_featured_image_sizes()
471 471
 						),
472 472
 						array(
473
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
474
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
473
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
474
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
475 475
 							'id'   => 'disable_form_featured_img',
476 476
 							'type' => 'checkbox'
477 477
 						),
478 478
 						array(
479
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
480
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
479
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
480
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
481 481
 							'id'   => 'disable_form_sidebar',
482 482
 							'type' => 'checkbox'
483 483
 						),
484 484
 						array(
485
-							'name' => esc_html__( 'Taxonomies', 'give' ),
485
+							'name' => esc_html__('Taxonomies', 'give'),
486 486
 							'desc' => '',
487 487
 							'id'   => 'give_title_display_settings_3',
488 488
 							'type' => 'give_title'
489 489
 						),
490 490
 						array(
491
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
492
-							'desc' => esc_html__( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
491
+							'name' => esc_html__('Enable Form Categories', 'give'),
492
+							'desc' => esc_html__('Enables the "Category" taxonomy for all Give forms.', 'give'),
493 493
 							'id'   => 'categories',
494 494
 							'type' => 'checkbox'
495 495
 						),
496 496
 						array(
497
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
498
-							'desc' => esc_html__( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
497
+							'name' => esc_html__('Enable Form Tags', 'give'),
498
+							'desc' => esc_html__('Enables the "Tag" taxonomy for all Give forms.', 'give'),
499 499
 							'id'   => 'tags',
500 500
 							'type' => 'checkbox'
501 501
 						),
@@ -529,85 +529,85 @@  discard block
 block discarded – undo
529 529
 			 */
530 530
 			'emails'      => array(
531 531
 				'id'         => 'email_settings',
532
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
533
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
534
-				'fields'     => apply_filters( 'give_settings_emails', array(
532
+				'give_title' => esc_html__('Email Settings', 'give'),
533
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
534
+				'fields'     => apply_filters('give_settings_emails', array(
535 535
 						array(
536
-							'name' => esc_html__( 'Email Settings', 'give' ),
536
+							'name' => esc_html__('Email Settings', 'give'),
537 537
 							'desc' => '',
538 538
 							'id'   => 'give_title_email_settings_1',
539 539
 							'type' => 'give_title'
540 540
 						),
541 541
 						array(
542 542
 							'id'      => 'email_template',
543
-							'name'    => esc_html__( 'Email Template', 'give' ),
544
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
543
+							'name'    => esc_html__('Email Template', 'give'),
544
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
545 545
 							'type'    => 'select',
546 546
 							'options' => give_get_email_templates()
547 547
 						),
548 548
 						array(
549 549
 							'id'   => 'email_logo',
550
-							'name' => esc_html__( 'Logo', 'give' ),
551
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
550
+							'name' => esc_html__('Logo', 'give'),
551
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
552 552
 							'type' => 'file'
553 553
 						),
554 554
 						array(
555 555
 							'id'      => 'from_name',
556
-							'name'    => esc_html__( 'From Name', 'give' ),
557
-							'desc'    => esc_html__( 'The name which appears in the "From" field in donation receipt emails.', 'give' ),
558
-							'default' => get_bloginfo( 'name' ),
556
+							'name'    => esc_html__('From Name', 'give'),
557
+							'desc'    => esc_html__('The name which appears in the "From" field in donation receipt emails.', 'give'),
558
+							'default' => get_bloginfo('name'),
559 559
 							'type'    => 'text'
560 560
 						),
561 561
 						array(
562 562
 							'id'      => 'from_email',
563
-							'name'    => esc_html__( 'From Email', 'give' ),
564
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
565
-							'default' => get_bloginfo( 'admin_email' ),
563
+							'name'    => esc_html__('From Email', 'give'),
564
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
565
+							'default' => get_bloginfo('admin_email'),
566 566
 							'type'    => 'text'
567 567
 						),
568 568
 						array(
569
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
569
+							'name' => esc_html__('Donation Receipt', 'give'),
570 570
 							'desc' => '',
571 571
 							'id'   => 'give_title_email_settings_2',
572 572
 							'type' => 'give_title'
573 573
 						),
574 574
 						array(
575 575
 							'id'      => 'donation_subject',
576
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
577
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
578
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
576
+							'name'    => esc_html__('Donation Email Subject', 'give'),
577
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
578
+							'default' => esc_attr__('Donation Receipt', 'give'),
579 579
 							'type'    => 'text'
580 580
 						),
581 581
 						array(
582 582
 							'id'      => 'donation_receipt',
583
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
583
+							'name'    => esc_html__('Donation Receipt', 'give'),
584 584
 							'desc'    => sprintf(
585 585
 								/* translators: %s: emails tags list */
586
-								esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
586
+								esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
587 587
 								'<br/>'.give_get_emails_tags_list()
588 588
 							),
589 589
 							'type'    => 'wysiwyg',
590 590
 							'default' => give_get_default_donation_receipt_email()
591 591
 						),
592 592
 						array(
593
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
593
+							'name' => esc_html__('New Donation Notification', 'give'),
594 594
 							'desc' => '',
595 595
 							'id'   => 'give_title_email_settings_3',
596 596
 							'type' => 'give_title'
597 597
 						),
598 598
 						array(
599 599
 							'id'      => 'donation_notification_subject',
600
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
601
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
600
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
601
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
602 602
 							'type'    => 'text',
603
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
603
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
604 604
 						),
605 605
 						array(
606 606
 							'id'      => 'donation_notification',
607
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
607
+							'name'    => esc_html__('Donation Notification', 'give'),
608 608
 							'desc'    => sprintf(
609 609
 								/* translators: %s: emails tags list */
610
-								esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
610
+								esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
611 611
 								'<br/>'.give_get_emails_tags_list()
612 612
 							),
613 613
 							'type'    => 'wysiwyg',
@@ -615,15 +615,15 @@  discard block
 block discarded – undo
615 615
 						),
616 616
 						array(
617 617
 							'id'      => 'admin_notice_emails',
618
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
619
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
618
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
619
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
620 620
 							'type'    => 'textarea',
621
-							'default' => get_bloginfo( 'admin_email' )
621
+							'default' => get_bloginfo('admin_email')
622 622
 						),
623 623
 						array(
624 624
 							'id'   => 'disable_admin_notices',
625
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
626
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
625
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
626
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
627 627
 							'type' => 'checkbox'
628 628
 						)
629 629
 					)
@@ -632,99 +632,99 @@  discard block
 block discarded – undo
632 632
 			/** Extension Settings */
633 633
 			'addons'      => array(
634 634
 				'id'         => 'addons',
635
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
636
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
637
-				'fields'     => apply_filters( 'give_settings_addons', array()
635
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
636
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
637
+				'fields'     => apply_filters('give_settings_addons', array()
638 638
 				)
639 639
 			),
640 640
 			/** Licenses Settings */
641 641
 			'licenses'    => array(
642 642
 				'id'         => 'licenses',
643
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
644
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
645
-				'fields'     => apply_filters( 'give_settings_licenses', array()
643
+				'give_title' => esc_html__('Give Licenses', 'give'),
644
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
645
+				'fields'     => apply_filters('give_settings_licenses', array()
646 646
 				)
647 647
 			),
648 648
 			/** Advanced Options */
649 649
 			'advanced'    => array(
650 650
 				'id'         => 'advanced_options',
651
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
652
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
653
-				'fields'     => apply_filters( 'give_settings_advanced', array(
651
+				'give_title' => esc_html__('Advanced Options', 'give'),
652
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
653
+				'fields'     => apply_filters('give_settings_advanced', array(
654 654
 						array(
655
-							'name' => esc_html__( 'Access Control', 'give' ),
655
+							'name' => esc_html__('Access Control', 'give'),
656 656
 							'desc' => '',
657 657
 							'id'   => 'give_title_session_control_1',
658 658
 							'type' => 'give_title'
659 659
 						),
660 660
 						array(
661 661
 							'id'      => 'session_lifetime',
662
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
663
-							'desc'    => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
662
+							'name'    => esc_html__('Session Lifetime', 'give'),
663
+							'desc'    => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
664 664
 							'type'    => 'select',
665 665
 							'options' => array(
666
-								'86400'  => esc_html__( '24 Hours', 'give' ),
667
-								'172800' => esc_html__( '48 Hours', 'give' ),
668
-								'259200' => esc_html__( '72 Hours', 'give' ),
669
-								'604800' => esc_html__( '1 Week', 'give' ),
666
+								'86400'  => esc_html__('24 Hours', 'give'),
667
+								'172800' => esc_html__('48 Hours', 'give'),
668
+								'259200' => esc_html__('72 Hours', 'give'),
669
+								'604800' => esc_html__('1 Week', 'give'),
670 670
 							)
671 671
 						),
672 672
 						array(
673
-							'name' => esc_html__( 'Email Access', 'give' ),
674
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
673
+							'name' => esc_html__('Email Access', 'give'),
674
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
675 675
 							'id'   => 'email_access',
676 676
 							'type' => 'checkbox',
677 677
 						),
678 678
 						array(
679 679
 							'id'      => 'recaptcha_key',
680
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
680
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
681 681
 							/* translators: %s: https://www.google.com/recaptcha/ */
682
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
682
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
683 683
 							'default' => '',
684 684
 							'type'    => 'text'
685 685
 						),
686 686
 						array(
687 687
 							'id'      => 'recaptcha_secret',
688
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
689
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
688
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
689
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
690 690
 							'default' => '',
691 691
 							'type'    => 'text'
692 692
 						),
693 693
 						array(
694
-							'name' => esc_html__( 'Data Control', 'give' ),
694
+							'name' => esc_html__('Data Control', 'give'),
695 695
 							'desc' => '',
696 696
 							'id'   => 'give_title_data_control_2',
697 697
 							'type' => 'give_title'
698 698
 						),
699 699
 						array(
700
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
701
-							'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
700
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
701
+							'desc' => esc_html__('When the plugin is deleted, completely remove all Give data.', 'give'),
702 702
 							'id'   => 'uninstall_on_delete',
703 703
 							'type' => 'checkbox'
704 704
 						),
705 705
 						array(
706
-							'name' => esc_html__( 'Filter Control', 'give' ),
706
+							'name' => esc_html__('Filter Control', 'give'),
707 707
 							'desc' => '',
708 708
 							'id'   => 'give_title_filter_control',
709 709
 							'type' => 'give_title'
710 710
 						),
711 711
 						array(
712 712
 							/* translators: %s: the_content */
713
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
713
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
714 714
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
715
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
715
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
716 716
 							'id'   => 'disable_the_content_filter',
717 717
 							'type' => 'checkbox'
718 718
 						),
719 719
 						array(
720
-							'name' => esc_html__( 'Script Loading', 'give' ),
720
+							'name' => esc_html__('Script Loading', 'give'),
721 721
 							'desc' => '',
722 722
 							'id'   => 'give_title_script_control',
723 723
 							'type' => 'give_title'
724 724
 						),
725 725
 						array(
726
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
727
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
726
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
727
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
728 728
 							'id'   => 'scripts_footer',
729 729
 							'type' => 'checkbox'
730 730
 						)
@@ -734,13 +734,13 @@  discard block
 block discarded – undo
734 734
 			/** API Settings */
735 735
 			'api'         => array(
736 736
 				'id'         => 'api',
737
-				'give_title' => esc_html__( 'API', 'give' ),
738
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
737
+				'give_title' => esc_html__('API', 'give'),
738
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
739 739
 				'show_names' => false, // Hide field names on the left
740
-				'fields'     => apply_filters( 'give_settings_system', array(
740
+				'fields'     => apply_filters('give_settings_system', array(
741 741
 						array(
742 742
 							'id'   => 'api',
743
-							'name' => esc_html__( 'API', 'give' ),
743
+							'name' => esc_html__('API', 'give'),
744 744
 							'type' => 'api'
745 745
 						)
746 746
 					)
@@ -749,13 +749,13 @@  discard block
 block discarded – undo
749 749
 			/** Licenses Settings */
750 750
 			'system_info' => array(
751 751
 				'id'         => 'system_info',
752
-				'give_title' => esc_html__( 'System Info', 'give' ),
753
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
754
-				'fields'     => apply_filters( 'give_settings_system', array(
752
+				'give_title' => esc_html__('System Info', 'give'),
753
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
754
+				'fields'     => apply_filters('give_settings_system', array(
755 755
 						array(
756 756
 							'id'   => 'system-info-textarea',
757
-							'name' => esc_html__( 'System Info', 'give' ),
758
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
757
+							'name' => esc_html__('System Info', 'give'),
758
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
759 759
 							'type' => 'system_info'
760 760
 						)
761 761
 					)
@@ -763,16 +763,16 @@  discard block
 block discarded – undo
763 763
 			),
764 764
 		);
765 765
 
766
-		$give_settings = apply_filters( 'give_registered_settings', $give_settings );
766
+		$give_settings = apply_filters('give_registered_settings', $give_settings);
767 767
 
768 768
 		//Return all settings array if no active tab
769
-		if (  empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) {
769
+		if (empty($active_tab) || ! isset($give_settings[$active_tab])) {
770 770
 			return $give_settings;
771 771
 		}
772 772
 
773 773
 
774 774
 		// Add other tabs and settings fields as needed
775
-		return $give_settings[ $active_tab ];
775
+		return $give_settings[$active_tab];
776 776
 
777 777
 	}
778 778
 
@@ -781,11 +781,11 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function settings_notices() {
783 783
 
784
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
784
+		if ( ! isset($_POST['give_settings_saved'])) {
785 785
 			return;
786 786
 		}
787 787
 
788
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
788
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
789 789
 
790 790
 	}
791 791
 
@@ -800,17 +800,17 @@  discard block
 block discarded – undo
800 800
 	 * @return mixed         Field value or exception is thrown.
801 801
 	 * @throws Exception     Throws an exception if the field is invalid.
802 802
 	 */
803
-	public function __get( $field ) {
803
+	public function __get($field) {
804 804
 
805 805
 		// Allowed fields to retrieve
806
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
806
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
807 807
 			return $this->{$field};
808 808
 		}
809
-		if ( 'option_metabox' === $field ) {
809
+		if ('option_metabox' === $field) {
810 810
 			return $this->option_metabox();
811 811
 		}
812 812
 
813
-		throw new Exception( sprintf( esc_html__( 'Invalid property: %s', 'give' ), $field ) );
813
+		throw new Exception(sprintf(esc_html__('Invalid property: %s', 'give'), $field));
814 814
 	}
815 815
 
816 816
 
@@ -828,12 +828,12 @@  discard block
 block discarded – undo
828 828
  *
829 829
  * @return mixed        Option value
830 830
  */
831
-function give_get_option( $key = '', $default = false ) {
831
+function give_get_option($key = '', $default = false) {
832 832
 	$give_options = give_get_settings();
833
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
834
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
833
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
834
+	$value = apply_filters('give_get_option', $value, $key, $default);
835 835
 
836
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
836
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
837 837
 }
838 838
 
839 839
 
@@ -853,33 +853,33 @@  discard block
 block discarded – undo
853 853
  *
854 854
  * @return boolean True if updated, false if not.
855 855
  */
856
-function give_update_option( $key = '', $value = false ) {
856
+function give_update_option($key = '', $value = false) {
857 857
 
858 858
 	// If no key, exit
859
-	if ( empty( $key ) ) {
859
+	if (empty($key)) {
860 860
 		return false;
861 861
 	}
862 862
 
863
-	if ( empty( $value ) ) {
864
-		$remove_option = give_delete_option( $key );
863
+	if (empty($value)) {
864
+		$remove_option = give_delete_option($key);
865 865
 
866 866
 		return $remove_option;
867 867
 	}
868 868
 
869 869
 	// First let's grab the current settings
870
-	$options = get_option( 'give_settings' );
870
+	$options = get_option('give_settings');
871 871
 
872 872
 	// Let's let devs alter that value coming in
873
-	$value = apply_filters( 'give_update_option', $value, $key );
873
+	$value = apply_filters('give_update_option', $value, $key);
874 874
 
875 875
 	// Next let's try to update the value
876
-	$options[ $key ] = $value;
877
-	$did_update      = update_option( 'give_settings', $options );
876
+	$options[$key] = $value;
877
+	$did_update      = update_option('give_settings', $options);
878 878
 
879 879
 	// If it updated, let's update the global variable
880
-	if ( $did_update ) {
880
+	if ($did_update) {
881 881
 		global $give_options;
882
-		$give_options[ $key ] = $value;
882
+		$give_options[$key] = $value;
883 883
 	}
884 884
 
885 885
 	return $did_update;
@@ -898,27 +898,27 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return boolean True if updated, false if not.
900 900
  */
901
-function give_delete_option( $key = '' ) {
901
+function give_delete_option($key = '') {
902 902
 
903 903
 	// If no key, exit
904
-	if ( empty( $key ) ) {
904
+	if (empty($key)) {
905 905
 		return false;
906 906
 	}
907 907
 
908 908
 	// First let's grab the current settings
909
-	$options = get_option( 'give_settings' );
909
+	$options = get_option('give_settings');
910 910
 
911 911
 	// Next let's try to update the value
912
-	if ( isset( $options[ $key ] ) ) {
912
+	if (isset($options[$key])) {
913 913
 
914
-		unset( $options[ $key ] );
914
+		unset($options[$key]);
915 915
 
916 916
 	}
917 917
 
918
-	$did_update = update_option( 'give_settings', $options );
918
+	$did_update = update_option('give_settings', $options);
919 919
 
920 920
 	// If it updated, let's update the global variable
921
-	if ( $did_update ) {
921
+	if ($did_update) {
922 922
 		global $give_options;
923 923
 		$give_options = $options;
924 924
 	}
@@ -937,9 +937,9 @@  discard block
 block discarded – undo
937 937
  */
938 938
 function give_get_settings() {
939 939
 
940
-	$settings = get_option( 'give_settings' );
940
+	$settings = get_option('give_settings');
941 941
 
942
-	return (array) apply_filters( 'give_get_settings', $settings );
942
+	return (array) apply_filters('give_get_settings', $settings);
943 943
 
944 944
 }
945 945
 
@@ -957,25 +957,25 @@  discard block
 block discarded – undo
957 957
  *
958 958
  * @return array
959 959
  */
960
-function give_settings_array_insert( $array, $position, $insert ) {
961
-	if ( is_int( $position ) ) {
962
-		array_splice( $array, $position, 0, $insert );
960
+function give_settings_array_insert($array, $position, $insert) {
961
+	if (is_int($position)) {
962
+		array_splice($array, $position, 0, $insert);
963 963
 	} else {
964 964
 
965
-		foreach ( $array as $index => $subarray ) {
966
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
965
+		foreach ($array as $index => $subarray) {
966
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
967 967
 				$pos = $index;
968 968
 			}
969 969
 		}
970 970
 
971
-		if ( ! isset( $pos ) ) {
971
+		if ( ! isset($pos)) {
972 972
 			return $array;
973 973
 		}
974 974
 
975 975
 		$array = array_merge(
976
-			array_slice( $array, 0, $pos ),
976
+			array_slice($array, 0, $pos),
977 977
 			$insert,
978
-			array_slice( $array, $pos )
978
+			array_slice($array, $pos)
979 979
 		);
980 980
 	}
981 981
 
@@ -993,23 +993,23 @@  discard block
 block discarded – undo
993 993
  * @param array $saved_values
994 994
  * @return void
995 995
  */
996
-function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) {
996
+function give_enabled_gateways_callback($field_arr, $saved_values = array()) {
997 997
 
998 998
 	$id       = $field_arr['id'];
999
-	$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
999
+	$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
1000 1000
 
1001 1001
 	echo '<ul class="give-checklist-fields give-payment-gatways-list">';
1002 1002
 
1003
-	foreach ( $gateways as $key => $option ) :
1003
+	foreach ($gateways as $key => $option) :
1004 1004
 
1005
-		if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) {
1005
+		if (is_array($saved_values) && array_key_exists($key, $saved_values)) {
1006 1006
 			$enabled = '1';
1007 1007
 		} else {
1008 1008
 			$enabled = null;
1009 1009
 		}
1010 1010
 
1011
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1012
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1011
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1012
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1013 1013
 
1014 1014
 	endforeach;
1015 1015
 
@@ -1026,22 +1026,22 @@  discard block
 block discarded – undo
1026 1026
  * @param  array $saved_value
1027 1027
  * @return void
1028 1028
  */
1029
-function give_default_gateway_callback( $field_arr, $saved_value ) {
1029
+function give_default_gateway_callback($field_arr, $saved_value) {
1030 1030
 	global $post;
1031 1031
 
1032 1032
 	$id                = $field_arr['id'];
1033 1033
 	$gateways          = give_get_enabled_payment_gateways();
1034 1034
 
1035
-	echo '<select class="give-select" name="' . $id . '" id="' . $id . '">';
1035
+	echo '<select class="give-select" name="'.$id.'" id="'.$id.'">';
1036 1036
 
1037 1037
 		//Add a field to the Give Form admin single post view of this field
1038
-		if ( is_object( $post ) &&  'give_forms' === $post->post_type ) {
1039
-			echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1038
+		if (is_object($post) && 'give_forms' === $post->post_type) {
1039
+			echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1040 1040
 		}
1041 1041
 
1042
-		foreach ( $gateways as $key => $option ) :
1043
-			$selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : '';
1044
-			echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1042
+		foreach ($gateways as $key => $option) :
1043
+			$selected = isset($saved_value) ? selected($key, $saved_value, false) : '';
1044
+			echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1045 1045
 		endforeach;
1046 1046
 
1047 1047
 	echo '</select>';
@@ -1059,13 +1059,13 @@  discard block
 block discarded – undo
1059 1059
  *
1060 1060
  * @return void
1061 1061
  */
1062
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1062
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1063 1063
 
1064 1064
 	$id                = $field_type_object->field->args['id'];
1065 1065
 	$title             = $field_type_object->field->args['name'];
1066 1066
 	$field_description = $field_type_object->field->args['desc'];
1067 1067
 
1068
-	echo '<hr>' . $field_description;
1068
+	echo '<hr>'.$field_description;
1069 1069
 
1070 1070
 }
1071 1071
 
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
  *
1081 1081
  * @return void
1082 1082
  */
1083
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1083
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1084 1084
 
1085 1085
 	$id                = $field_type_object->field->args['id'];
1086 1086
 	$title             = $field_type_object->field->args['name'];
@@ -1100,25 +1100,25 @@  discard block
 block discarded – undo
1100 1100
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1101 1101
  * @return array An array of options that matches the CMB2 options array
1102 1102
  */
1103
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1103
+function give_cmb2_get_post_options($query_args, $force = false) {
1104 1104
 
1105
-	$post_options = array( '' => '' ); // Blank option
1105
+	$post_options = array('' => ''); // Blank option
1106 1106
 
1107
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1107
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1108 1108
 		return $post_options;
1109 1109
 	}
1110 1110
 
1111
-	$args = wp_parse_args( $query_args, array(
1111
+	$args = wp_parse_args($query_args, array(
1112 1112
 		'post_type'   => 'page',
1113 1113
 		'numberposts' => 10,
1114
-	) );
1114
+	));
1115 1115
 
1116
-	$posts = get_posts( $args );
1116
+	$posts = get_posts($args);
1117 1117
 
1118
-	if ( $posts ) {
1119
-		foreach ( $posts as $post ) {
1118
+	if ($posts) {
1119
+		foreach ($posts as $post) {
1120 1120
 
1121
-			$post_options[ $post->ID ] = $post->post_title;
1121
+			$post_options[$post->ID] = $post->post_title;
1122 1122
 
1123 1123
 		}
1124 1124
 	}
@@ -1140,17 +1140,17 @@  discard block
 block discarded – undo
1140 1140
 	global $_wp_additional_image_sizes;
1141 1141
 	$sizes = array();
1142 1142
 
1143
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1143
+	foreach (get_intermediate_image_sizes() as $_size) {
1144 1144
 
1145
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1146
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1147
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1148
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1145
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1146
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1147
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1148
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1149 1149
 		}
1150 1150
 
1151 1151
 	}
1152 1152
 
1153
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1153
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1154 1154
 }
1155 1155
 
1156 1156
 
@@ -1165,18 +1165,18 @@  discard block
 block discarded – undo
1165 1165
  *
1166 1166
  * @return void
1167 1167
  */
1168
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1168
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1169 1169
     /* @var CMB2_Types $field_type_object*/
1170 1170
 
1171 1171
     $id                   = $field_type_object->field->args['id'];
1172 1172
 	$field_description    = $field_type_object->field->args['desc'];
1173 1173
 	$license              = $field_type_object->field->args['options']['license'];
1174 1174
     $license_key          = $escaped_value;
1175
-    $is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1176
-    $is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1175
+    $is_license_key       = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1176
+    $is_valid_license     = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1177 1177
     $shortname            = $field_type_object->field->args['options']['shortname'];
1178 1178
 	$field_classes        = 'regular-text give-license-field';
1179
-	$type                 = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1179
+	$type                 = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1180 1180
     $custom_html          = '';
1181 1181
     $messages             = array();
1182 1182
     $class                = '';
@@ -1188,17 +1188,17 @@  discard block
 block discarded – undo
1188 1188
 
1189 1189
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1190 1190
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1191
-	if( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1191
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1192 1192
 		$is_license_key = false;
1193 1193
 	}
1194 1194
 
1195 1195
 
1196 1196
     // Check if current license is part of subscription or not.
1197
-    $subscriptions = get_option( 'give_subscriptions' );
1197
+    $subscriptions = get_option('give_subscriptions');
1198 1198
 
1199
-    if( $is_license_key && $subscriptions ) {
1200
-        foreach ( $subscriptions as $subscription ) {
1201
-            if( in_array( $license_key, $subscription['licenses'] ) ) {
1199
+    if ($is_license_key && $subscriptions) {
1200
+        foreach ($subscriptions as $subscription) {
1201
+            if (in_array($license_key, $subscription['licenses'])) {
1202 1202
                 $is_in_subscription = $subscription['id'];
1203 1203
                 break;
1204 1204
             }
@@ -1206,131 +1206,131 @@  discard block
 block discarded – undo
1206 1206
     }
1207 1207
 
1208 1208
 
1209
-    if( $is_license_key ) {
1210
-        if( $is_in_subscription ) {
1211
-            $subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1212
-            $subscription_status  = esc_html__( 'renew', 'give' );
1209
+    if ($is_license_key) {
1210
+        if ($is_in_subscription) {
1211
+            $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1212
+            $subscription_status  = esc_html__('renew', 'give');
1213 1213
 
1214
-            if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1215
-                $subscription_status = esc_html__( 'expire', 'give' );
1214
+            if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1215
+                $subscription_status = esc_html__('expire', 'give');
1216 1216
             }
1217 1217
 
1218
-            if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1218
+            if ($subscription_expires < current_time('timestamp', 1)) {
1219 1219
                 $messages[] = sprintf(
1220
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1221
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1220
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1221
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1222 1222
                     $subscriptions[$is_in_subscription]['payment_id'],
1223
-                    $checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1223
+                    $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1224 1224
                 );
1225 1225
                 $license_status = 'license-expired';
1226
-            } elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1226
+            } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1227 1227
                 $messages[] = sprintf(
1228
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1229
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1228
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give'),
1229
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1230 1230
                     $subscriptions[$is_in_subscription]['payment_id'],
1231 1231
                     $subscription_status,
1232
-                    human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1232
+                    human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1233 1233
                 );
1234 1234
                 $license_status = 'license-expires-soon';
1235 1235
             } else {
1236 1236
                 $messages[] = sprintf(
1237
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1238
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1237
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give'),
1238
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1239 1239
                     $subscriptions[$is_in_subscription]['payment_id'],
1240 1240
                     $subscription_status,
1241
-                    date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1241
+                    date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1242 1242
                 );
1243 1243
                 $license_status = 'license-expiration-date';
1244 1244
             }
1245 1245
 
1246 1246
 
1247
-        } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1247
+        } elseif (empty($license->success) && property_exists($license, 'error')) {
1248 1248
 
1249 1249
             // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1250
-            switch(   $license->error ) {
1250
+            switch ($license->error) {
1251 1251
                 case 'expired' :
1252 1252
                     $class = $license->error;
1253 1253
                     $messages[] = sprintf(
1254
-                        __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1255
-                        date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1256
-                        $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1254
+                        __('Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1255
+                        date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1256
+                        $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1257 1257
                     );
1258
-                    $license_status = 'license-' . $class;
1258
+                    $license_status = 'license-'.$class;
1259 1259
                     break;
1260 1260
 
1261 1261
                 case 'missing' :
1262 1262
                     $class = $license->error;
1263 1263
                     $messages[] = sprintf(
1264
-                        __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1265
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1264
+                        __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1265
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1266 1266
                     );
1267
-                    $license_status = 'license-' . $class;
1267
+                    $license_status = 'license-'.$class;
1268 1268
                     break;
1269 1269
 
1270 1270
                 case 'invalid' :
1271 1271
                     $class = $license->error;
1272 1272
                     $messages[] = sprintf(
1273
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1273
+                        __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1274 1274
                         $addon_name,
1275
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1275
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1276 1276
                     );
1277
-                    $license_status = 'license-' . $class;
1277
+                    $license_status = 'license-'.$class;
1278 1278
                     break;
1279 1279
 
1280 1280
                 case 'site_inactive' :
1281 1281
                     $class = $license->error;
1282 1282
                     $messages[] = sprintf(
1283
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1283
+                        __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1284 1284
                         $addon_name,
1285
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1285
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1286 1286
                     );
1287
-                    $license_status = 'license-' . $class;
1287
+                    $license_status = 'license-'.$class;
1288 1288
                     break;
1289 1289
 
1290 1290
                 case 'item_name_mismatch' :
1291 1291
                     $class = $license->error;
1292
-                    $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $license_key, $addon_name );
1293
-                    $license_status = 'license-' . $class;
1292
+                    $messages[] = sprintf(__('This license %s does not belong to %s.', 'give'), $license_key, $addon_name);
1293
+                    $license_status = 'license-'.$class;
1294 1294
                     break;
1295 1295
 
1296 1296
                 case 'no_activations_left':
1297 1297
                     $class = $license->error;
1298
-                    $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1299
-                    $license_status = 'license-' . $class;
1298
+                    $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1299
+                    $license_status = 'license-'.$class;
1300 1300
                     break;
1301 1301
             }
1302 1302
         } else {
1303
-            switch( $license->license ) {
1303
+            switch ($license->license) {
1304 1304
                 case 'valid' :
1305 1305
                 default:
1306 1306
                     $class = 'valid';
1307
-                    $now        = current_time( 'timestamp' );
1308
-                    $expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1307
+                    $now        = current_time('timestamp');
1308
+                    $expiration = strtotime($license->expires, current_time('timestamp'));
1309 1309
 
1310
-                    if( 'lifetime' === $license->expires ) {
1311
-                        $messages[] = esc_html__( 'License key never expires.', 'give' );
1310
+                    if ('lifetime' === $license->expires) {
1311
+                        $messages[] = esc_html__('License key never expires.', 'give');
1312 1312
                         $license_status = 'license-lifetime-notice';
1313
-                    } elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1313
+                    } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1314 1314
                         $messages[] = sprintf(
1315
-                            __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1316
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1317
-                            $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1315
+                            __('Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1316
+                            date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1317
+                            $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1318 1318
                         );
1319 1319
                         $license_status = 'license-expires-soon';
1320 1320
                     } else {
1321 1321
                         $messages[] = sprintf(
1322
-                            __( 'Your license key expires on %s.', 'give' ),
1323
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1322
+                            __('Your license key expires on %s.', 'give'),
1323
+                            date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1324 1324
                         );
1325 1325
                         $license_status = 'license-expiration-date';
1326 1326
                     }
1327 1327
                     break;
1328 1328
             }
1329 1329
         }
1330
-    } else{
1330
+    } else {
1331 1331
 		$class = 'empty';
1332 1332
 		$messages[] = sprintf(
1333
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1333
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1334 1334
 			$addon_name
1335 1335
 		);
1336 1336
 		$license_status = null;
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
 
1339 1339
 
1340 1340
     // Add class for input field if license is active.
1341
-	if ( $is_valid_license ) {
1341
+	if ($is_valid_license) {
1342 1342
 		$field_classes .= ' give-license-active';
1343 1343
 	}
1344 1344
 
@@ -1346,34 +1346,34 @@  discard block
 block discarded – undo
1346 1346
 	$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">";
1347 1347
 
1348 1348
 	// If license is active so show deactivate button
1349
-	if ( $is_valid_license ) {
1349
+	if ($is_valid_license) {
1350 1350
         // Get input field html.
1351 1351
 		$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">";
1352 1352
 
1353
-		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1353
+		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1354 1354
 	}
1355 1355
 
1356 1356
 	// Field description.
1357
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1357
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1358 1358
 
1359 1359
     // If no messages found then inform user that to get updated in future register yourself.
1360
-    if ( empty( $messages ) ) {
1361
-        $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1360
+    if (empty($messages)) {
1361
+        $messages[] = apply_filters("{$shortname}_default_addon_notice", esc_html__('To receive updates, please enter your valid Software Licensing license key.', 'give'));
1362 1362
     }
1363 1363
 
1364
-    foreach( $messages as $message ) {
1365
-        $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">';
1366
-        $custom_html .= '<p>' . $message . '</p>';
1364
+    foreach ($messages as $message) {
1365
+        $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">';
1366
+        $custom_html .= '<p>'.$message.'</p>';
1367 1367
         $custom_html .= '</div>';
1368 1368
     }
1369 1369
 
1370 1370
 
1371 1371
 
1372 1372
     // Field html.
1373
-    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1373
+    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1374 1374
 
1375 1375
     // Nonce.
1376
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1376
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1377 1377
 
1378 1378
     // Print field html.
1379 1379
     echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>";
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
  */
1389 1389
 function give_api_callback() {
1390 1390
 
1391
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1391
+	if ( ! current_user_can('manage_give_settings')) {
1392 1392
 		return;
1393 1393
 	}
1394 1394
 
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
 	 *
1398 1398
 	 * @since 1.0
1399 1399
 	 */
1400
-	do_action( 'give_tools_api_keys_before' );
1400
+	do_action('give_tools_api_keys_before');
1401 1401
 
1402
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1402
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1403 1403
 
1404 1404
 	$api_keys_table = new Give_API_Keys_Table();
1405 1405
 	$api_keys_table->prepare_items();
@@ -1408,9 +1408,9 @@  discard block
 block discarded – undo
1408 1408
 	<span class="cmb2-metabox-description api-description">
1409 1409
 		<?php echo sprintf(
1410 1410
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1411
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1412
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1413
-			esc_url( 'https://givewp.com/addons/zapier/' )
1411
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1412
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1413
+			esc_url('https://givewp.com/addons/zapier/')
1414 1414
 		); ?>
1415 1415
 	</span>
1416 1416
 	<?php
@@ -1420,10 +1420,10 @@  discard block
 block discarded – undo
1420 1420
 	 *
1421 1421
 	 * @since 1.0
1422 1422
 	 */
1423
-	do_action( 'give_tools_api_keys_after' );
1423
+	do_action('give_tools_api_keys_after');
1424 1424
 }
1425 1425
 
1426
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1426
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1427 1427
 
1428 1428
 /**
1429 1429
  * Hook Callback
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
  *
1437 1437
  * @return void
1438 1438
  */
1439
-function give_hook_callback( $args ) {
1439
+function give_hook_callback($args) {
1440 1440
 
1441 1441
 	$id = $args['id'];
1442 1442
 
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 	 *
1446 1446
 	 * @since 1.0
1447 1447
 	 */
1448
-	do_action( "give_{$id}" );
1448
+	do_action("give_{$id}");
1449 1449
 
1450 1450
 }
1451 1451
 
@@ -1458,19 +1458,19 @@  discard block
 block discarded – undo
1458 1458
  * @param  string $compare_with
1459 1459
  * @return bool
1460 1460
  */
1461
-function give_is_setting_enabled( $value, $compare_with = null ) {
1462
-	if( ! is_null( $compare_with ) ) {
1461
+function give_is_setting_enabled($value, $compare_with = null) {
1462
+	if ( ! is_null($compare_with)) {
1463 1463
 
1464
-		if( is_array( $compare_with ) ) {
1464
+		if (is_array($compare_with)) {
1465 1465
 			// Output.
1466
-			return in_array( $value, $compare_with );
1466
+			return in_array($value, $compare_with);
1467 1467
 		}
1468 1468
 
1469 1469
 		// Output.
1470
-		return ( $value === $compare_with );
1470
+		return ($value === $compare_with);
1471 1471
 	}
1472 1472
 
1473 1473
 	// Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled
1474 1474
 	// Output.
1475
-	return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false );
1475
+	return (in_array($value, array('enabled', 'on', 'yes')) ? true : false);
1476 1476
 }
1477 1477
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -727,7 +727,7 @@
 block discarded – undo
727 727
 	 *
728 728
 	 * @since  1.8
729 729
 	 * @param  $field_id
730
-	 * @return array|string
730
+	 * @return string|null
731 731
 	 */
732 732
 	function get_field_type( $field_id ) {
733 733
 		$field_type = '';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,8 +108,8 @@
 block discarded – undo
108 108
 
109 109
 		$settings = array(
110 110
 			 /**
111
-			 * Repeatable Field Groups
112
-			 */
111
+			  * Repeatable Field Groups
112
+			  */
113 113
 			'form_field_options' => apply_filters( 'give_forms_field_options', array(
114 114
 				'id'           => 'form_field_options',
115 115
 				'title'        => esc_html__( 'Donation Options', 'give' ),
Please login to merge, or discard this patch.
Spacing   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -44,27 +44,27 @@  discard block
 block discarded – undo
44 44
 	/**
45 45
 	 * Give_MetaBox_Form_Data constructor.
46 46
 	 */
47
-	function __construct(){
47
+	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = esc_html__( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = esc_html__('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init' , array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 30 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 30);
56 56
 
57 57
 		// Load required scripts.
58
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) );
58
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_script'));
59 59
 
60 60
 		// Save form meta.
61
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
61
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
62 62
 
63 63
 		// cmb2 old setting loaders.
64 64
 		//add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
65 65
 
66 66
 		// Add offline donations options.
67
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
67
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
68 68
 	}
69 69
 
70 70
 
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	function get_settings() {
89 89
 		$post_id               = give_get_admin_post_id();
90
-		$price                 = give_get_form_price( $post_id );
91
-		$custom_amount_minimum = give_get_form_minimum_price( $post_id );
92
-		$goal                  = give_get_form_goal( $post_id );
93
-		$variable_pricing      = give_has_variable_prices( $post_id );
94
-		$prices                = give_get_variable_prices( $post_id );
90
+		$price                 = give_get_form_price($post_id);
91
+		$custom_amount_minimum = give_get_form_minimum_price($post_id);
92
+		$goal                  = give_get_form_goal($post_id);
93
+		$variable_pricing      = give_has_variable_prices($post_id);
94
+		$prices                = give_get_variable_prices($post_id);
95 95
 
96 96
 		//No empty prices - min. 1.00 for new forms
97
-		if ( empty( $price ) && is_null( $post_id ) ) {
98
-			$price = esc_attr( give_format_decimal( '1.00' ) );
97
+		if (empty($price) && is_null($post_id)) {
98
+			$price = esc_attr(give_format_decimal('1.00'));
99 99
 		}
100 100
 
101 101
 		//Min. $1.00 for new forms
102
-		if ( empty( $custom_amount_minimum ) ) {
103
-			$custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) );
102
+		if (empty($custom_amount_minimum)) {
103
+			$custom_amount_minimum = esc_attr(give_format_decimal('1.00'));
104 104
 		}
105 105
 
106 106
 		// Start with an underscore to hide fields from custom fields list
@@ -110,126 +110,126 @@  discard block
 block discarded – undo
110 110
 			 /**
111 111
 			 * Repeatable Field Groups
112 112
 			 */
113
-			'form_field_options' => apply_filters( 'give_forms_field_options', array(
113
+			'form_field_options' => apply_filters('give_forms_field_options', array(
114 114
 				'id'           => 'form_field_options',
115
-				'title'        => esc_html__( 'Donation Options', 'give' ),
116
-				'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
115
+				'title'        => esc_html__('Donation Options', 'give'),
116
+				'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
117 117
 						//Donation Option
118 118
 						array(
119
-							'name'        => esc_html__( 'Donation Option', 'give' ),
120
-							'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
121
-							'id'          => $prefix . 'price_option',
119
+							'name'        => esc_html__('Donation Option', 'give'),
120
+							'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
121
+							'id'          => $prefix.'price_option',
122 122
 							'type'        => 'radio_inline',
123 123
 							'default'     => 'set',
124
-							'options'     => apply_filters( 'give_forms_price_options', array(
125
-								'set'   => esc_html__( 'Set Donation', 'give' ),
126
-								'multi' => esc_html__( 'Multi-level Donation', 'give' ),
127
-							) ),
124
+							'options'     => apply_filters('give_forms_price_options', array(
125
+								'set'   => esc_html__('Set Donation', 'give'),
126
+								'multi' => esc_html__('Multi-level Donation', 'give'),
127
+							)),
128 128
 						),
129 129
 						array(
130
-							'name'         => esc_html__( 'Set Donation', 'give' ),
131
-							'description'  => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
132
-							'id'           => $prefix . 'set_price',
130
+							'name'         => esc_html__('Set Donation', 'give'),
131
+							'description'  => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
132
+							'id'           => $prefix.'set_price',
133 133
 							'type'         => 'text_small',
134 134
 							'render_row_cb'=> 'give_cmb_amount_field_render_row_cb',
135 135
 							'data_type'    => 'decimal',
136 136
 							'attributes'   => array(
137
-								'placeholder' => give_format_decimal( '1.00' ),
138
-								'value'       => give_format_decimal( $price ),
137
+								'placeholder' => give_format_decimal('1.00'),
138
+								'value'       => give_format_decimal($price),
139 139
 								'class'       => 'cmb-type-text-small give-money-field',
140 140
 							),
141 141
 						),
142 142
 						//Donation Levels: Repeatable CMB2 Group
143 143
 						array(
144
-							'id'          => $prefix . 'donation_levels',
144
+							'id'          => $prefix.'donation_levels',
145 145
 							'type'        => 'group',
146 146
 							'options'     => array(
147
-								'add_button'    => esc_html__( 'Add Level', 'give' ),
147
+								'add_button'    => esc_html__('Add Level', 'give'),
148 148
 								'remove_button' => '<span class="dashicons dashicons-no"></span>',
149 149
 								'sortable'      => true, // beta
150 150
 							),
151 151
 							// Fields array works the same, except id's only need to be unique for this group.
152 152
 							// Prefix is not needed.
153
-							'fields'      => apply_filters( 'give_donation_levels_table_row', array(
153
+							'fields'      => apply_filters('give_donation_levels_table_row', array(
154 154
 								array(
155
-									'name' => esc_html__( 'ID', 'give' ),
156
-									'id'   => $prefix . 'id',
155
+									'name' => esc_html__('ID', 'give'),
156
+									'id'   => $prefix.'id',
157 157
 									'type' => 'levels_id',
158 158
 								),
159 159
 								array(
160
-									'name'              => esc_html__( 'Amount', 'give' ),
161
-									'id'                => $prefix . 'amount',
160
+									'name'              => esc_html__('Amount', 'give'),
161
+									'id'                => $prefix.'amount',
162 162
 									'type'              => 'text_small',
163
-									'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
164
-									'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
163
+									'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
164
+									'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
165 165
 									'data_type'         => 'decimal',
166 166
 									'attributes'        => array(
167
-										'placeholder' => give_format_decimal( '1.00' ),
167
+										'placeholder' => give_format_decimal('1.00'),
168 168
 										'class'       => 'cmb-type-text-small give-money-field',
169 169
 									),
170 170
 									'before'       => 'give_format_admin_multilevel_amount',
171 171
 								),
172 172
 								array(
173
-									'name'       => esc_html__( 'Text', 'give' ),
174
-									'id'         => $prefix . 'text',
173
+									'name'       => esc_html__('Text', 'give'),
174
+									'id'         => $prefix.'text',
175 175
 									'type'       => 'text',
176 176
 									'attributes' => array(
177
-										'placeholder' => esc_html__( 'Donation Level', 'give' ),
177
+										'placeholder' => esc_html__('Donation Level', 'give'),
178 178
 										'class'       => 'give-multilevel-text-field',
179 179
 									),
180 180
 								),
181 181
 								array(
182
-									'name' => esc_html__( 'Default', 'give' ),
183
-									'id'   => $prefix . 'default',
182
+									'name' => esc_html__('Default', 'give'),
183
+									'id'   => $prefix.'default',
184 184
 									'type' => 'give_default_radio_inline'
185 185
 								),
186
-							) ),
186
+							)),
187 187
 						),
188 188
 						//Display Style
189 189
 						array(
190
-							'name'        => esc_html__( 'Display Style', 'give' ),
191
-							'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
192
-							'id'          => $prefix . 'display_style',
190
+							'name'        => esc_html__('Display Style', 'give'),
191
+							'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
192
+							'id'          => $prefix.'display_style',
193 193
 							'type'        => 'radio_inline',
194 194
 							'default'     => 'buttons',
195 195
 							'options'     => array(
196
-								'buttons'  => esc_html__( 'Buttons', 'give' ),
197
-								'radios'   => esc_html__( 'Radios', 'give' ),
198
-								'dropdown' => esc_html__( 'Dropdown', 'give' ),
196
+								'buttons'  => esc_html__('Buttons', 'give'),
197
+								'radios'   => esc_html__('Radios', 'give'),
198
+								'dropdown' => esc_html__('Dropdown', 'give'),
199 199
 							),
200 200
 						),
201 201
 						//Custom Amount
202 202
 						array(
203
-							'name'        => esc_html__( 'Custom Amount', 'give' ),
204
-							'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
205
-							'id'          => $prefix . 'custom_amount',
203
+							'name'        => esc_html__('Custom Amount', 'give'),
204
+							'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
205
+							'id'          => $prefix.'custom_amount',
206 206
 							'type'        => 'radio_inline',
207 207
 							'default'     => 'disabled',
208 208
 							'options'     => array(
209
-								'enabled'   => esc_html__( 'Enabled', 'give' ),
210
-								'disabled'  => esc_html__( 'Disabled', 'give' ),
209
+								'enabled'   => esc_html__('Enabled', 'give'),
210
+								'disabled'  => esc_html__('Disabled', 'give'),
211 211
 							),
212 212
 						),
213 213
 						array(
214
-							'name'              => esc_html__( 'Minimum Amount', 'give' ),
215
-							'description'       => esc_html__( 'Enter the minimum custom donation amount.', 'give' ),
216
-							'id'                => $prefix . 'custom_amount_minimum',
214
+							'name'              => esc_html__('Minimum Amount', 'give'),
215
+							'description'       => esc_html__('Enter the minimum custom donation amount.', 'give'),
216
+							'id'                => $prefix.'custom_amount_minimum',
217 217
 							'type'              => 'text_small',
218 218
 							'data_type'         => 'decimal',
219 219
 							'attributes'   => array(
220 220
 								'placeholder' => give_format_decimal('1.00'),
221
-								'value'       => give_format_decimal( $custom_amount_minimum ),
221
+								'value'       => give_format_decimal($custom_amount_minimum),
222 222
 								'class'       => 'cmb-type-text-small give-money-field',
223 223
 							)
224 224
 						),
225 225
 						array(
226
-							'name'        => esc_html__( 'Custom Amount Text', 'give' ),
227
-							'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
228
-							'id'          => $prefix . 'custom_amount_text',
226
+							'name'        => esc_html__('Custom Amount Text', 'give'),
227
+							'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
228
+							'id'          => $prefix.'custom_amount_text',
229 229
 							'type'        => 'text',
230 230
 							'attributes'  => array(
231 231
 								'rows'        => 3,
232
-								'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
232
+								'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
233 233
 							),
234 234
 						)
235 235
 					)
@@ -239,72 +239,72 @@  discard block
 block discarded – undo
239 239
 			/**
240 240
 			 * Donation Goals
241 241
 			 */
242
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
242
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
243 243
 				'id'           => 'donation_goal_options',
244
-				'title'        => esc_html__( 'Donation Goal', 'give' ),
245
-				'fields'       => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
244
+				'title'        => esc_html__('Donation Goal', 'give'),
245
+				'fields'       => apply_filters('give_forms_donation_goal_metabox_fields', array(
246 246
 					//Goals
247 247
 					array(
248
-						'name'        => esc_html__( 'Donation Goal', 'give' ),
249
-						'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
250
-						'id'          => $prefix . 'goal_option',
248
+						'name'        => esc_html__('Donation Goal', 'give'),
249
+						'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
250
+						'id'          => $prefix.'goal_option',
251 251
 						'type'        => 'radio_inline',
252 252
 						'default'     => 'disabled',
253 253
 						'options'     => array(
254
-							'enabled'   => esc_html__( 'Enabled', 'give' ),
255
-							'disabled'  => esc_html__( 'Disabled', 'give' ),
254
+							'enabled'   => esc_html__('Enabled', 'give'),
255
+							'disabled'  => esc_html__('Disabled', 'give'),
256 256
 						),
257 257
 					),
258 258
 					array(
259
-						'name'              => esc_html__( 'Goal Amount', 'give' ),
260
-						'description'       => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
261
-						'id'                => $prefix . 'set_goal',
259
+						'name'              => esc_html__('Goal Amount', 'give'),
260
+						'description'       => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'),
261
+						'id'                => $prefix.'set_goal',
262 262
 						'type'              => 'text_small',
263 263
 						'data_type'         => 'decimal',
264 264
 						'attributes'        => array(
265
-							'placeholder' => give_format_decimal( '0.00' ),
266
-							'value'       => give_format_decimal( $goal ),
265
+							'placeholder' => give_format_decimal('0.00'),
266
+							'value'       => give_format_decimal($goal),
267 267
 							'class'       => 'cmb-type-text-small give-money-field',
268 268
 						),
269 269
 					),
270 270
 
271 271
 					array(
272
-						'name'        => esc_html__( 'Goal Format', 'give' ),
273
-						'description' => esc_html__( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
274
-						'id'          => $prefix . 'goal_format',
272
+						'name'        => esc_html__('Goal Format', 'give'),
273
+						'description' => esc_html__('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
274
+						'id'          => $prefix.'goal_format',
275 275
 						'type'        => 'radio_inline',
276 276
 						'default'     => 'amount',
277 277
 						'options'     => array(
278
-							'amount'     => esc_html__( 'Amount', 'give' ),
279
-							'percentage' => esc_html__( 'Percentage', 'give' ),
278
+							'amount'     => esc_html__('Amount', 'give'),
279
+							'percentage' => esc_html__('Percentage', 'give'),
280 280
 						),
281 281
 					),
282 282
 					array(
283
-						'name'        => esc_html__( 'Progress Bar Color', 'give' ),
284
-						'desc'        => esc_html__( 'Customize the color of the goal progress bar.', 'give' ),
285
-						'id'          => $prefix . 'goal_color',
283
+						'name'        => esc_html__('Progress Bar Color', 'give'),
284
+						'desc'        => esc_html__('Customize the color of the goal progress bar.', 'give'),
285
+						'id'          => $prefix.'goal_color',
286 286
 						'type'        => 'colorpicker',
287 287
 						'default'     => '#2bc253',
288 288
 					),
289 289
 
290 290
 					array(
291
-						'name'        => esc_html__( 'Close Form', 'give' ),
292
-						'desc'        => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
293
-						'id'          => $prefix . 'close_form_when_goal_achieved',
291
+						'name'        => esc_html__('Close Form', 'give'),
292
+						'desc'        => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
293
+						'id'          => $prefix.'close_form_when_goal_achieved',
294 294
 						'type'        => 'radio_inline',
295 295
 						'default'     => 'disabled',
296 296
 						'options'     => array(
297
-							'enabled'   => esc_html__( 'Enabled', 'give' ),
298
-							'disabled'  => esc_html__( 'Disabled', 'give' ),
297
+							'enabled'   => esc_html__('Enabled', 'give'),
298
+							'disabled'  => esc_html__('Disabled', 'give'),
299 299
 						),
300 300
 					),
301 301
 					array(
302
-						'name'        => esc_html__( 'Goal Achieved Message', 'give' ),
303
-						'desc'        => esc_html__( 'Do you want to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
304
-						'id'          => $prefix . 'form_goal_achieved_message',
302
+						'name'        => esc_html__('Goal Achieved Message', 'give'),
303
+						'desc'        => esc_html__('Do you want to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
304
+						'id'          => $prefix.'form_goal_achieved_message',
305 305
 						'type'        => 'textarea',
306 306
 						'attributes'  => array(
307
-							'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
307
+							'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
308 308
 						),
309 309
 					)
310 310
 				))
@@ -314,80 +314,80 @@  discard block
 block discarded – undo
314 314
 			/**
315 315
 			 * Display Options
316 316
 			 */
317
-			'form_display_options' => apply_filters( 'give_form_display_options', array(
317
+			'form_display_options' => apply_filters('give_form_display_options', array(
318 318
 				'id'           => 'form_display_options',
319
-				'title'        => esc_html__( 'Form Display', 'give' ),
320
-				'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
319
+				'title'        => esc_html__('Form Display', 'give'),
320
+				'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
321 321
 							array(
322
-								'name'    => esc_html__( 'Display Options', 'give' ),
323
-								'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
324
-								'id'      => $prefix . 'payment_display',
322
+								'name'    => esc_html__('Display Options', 'give'),
323
+								'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
324
+								'id'      => $prefix.'payment_display',
325 325
 								'type'    => 'radio_inline',
326 326
 								'options' => array(
327
-									'onpage' => esc_html__( 'All Fields', 'give' ),
328
-									'modal'  => esc_html__( 'Modal', 'give' ),
329
-									'reveal' => esc_html__( 'Reveal', 'give' ),
327
+									'onpage' => esc_html__('All Fields', 'give'),
328
+									'modal'  => esc_html__('Modal', 'give'),
329
+									'reveal' => esc_html__('Reveal', 'give'),
330 330
 								),
331 331
 								'default' => 'onpage',
332 332
 							),
333 333
 							array(
334
-								'id'          => $prefix . 'reveal_label',
335
-								'name'        => esc_html__( 'Continue Button', 'give' ),
336
-								'desc'        => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ),
334
+								'id'          => $prefix.'reveal_label',
335
+								'name'        => esc_html__('Continue Button', 'give'),
336
+								'desc'        => esc_html__('The button label for displaying the additional payment fields.', 'give'),
337 337
 								'type'        => 'text_small',
338 338
 								'attributes'  => array(
339
-									'placeholder' => esc_attr__( 'Donate Now', 'give' ),
339
+									'placeholder' => esc_attr__('Donate Now', 'give'),
340 340
 								),
341 341
 							),
342 342
 							array(
343
-								'id'         => $prefix . 'checkout_label',
344
-								'name'       => esc_html__( 'Submit Button', 'give' ),
345
-								'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
343
+								'id'         => $prefix.'checkout_label',
344
+								'name'       => esc_html__('Submit Button', 'give'),
345
+								'desc'       => esc_html__('The button label for completing a donation.', 'give'),
346 346
 								'type'       => 'text_small',
347 347
 								'attributes' => array(
348
-									'placeholder' => esc_html__( 'Donate Now', 'give' ),
348
+									'placeholder' => esc_html__('Donate Now', 'give'),
349 349
 								),
350 350
 							),
351 351
 							array(
352
-								'name' => esc_html__( 'Default Gateway', 'give' ),
353
-								'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
354
-								'id'   => $prefix . 'default_gateway',
352
+								'name' => esc_html__('Default Gateway', 'give'),
353
+								'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
354
+								'id'   => $prefix.'default_gateway',
355 355
 								'type' => 'default_gateway'
356 356
 							),
357 357
 							array(
358
-								'name'    => esc_html__( 'Guest Donations', 'give' ),
359
-								'desc'    => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ),
360
-								'id'      => $prefix . 'logged_in_only',
358
+								'name'    => esc_html__('Guest Donations', 'give'),
359
+								'desc'    => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
360
+								'id'      => $prefix.'logged_in_only',
361 361
 								'type'    => 'radio_inline',
362 362
 								'default' => 'enabled',
363 363
 								'options' => array(
364
-									'enabled'    => esc_html__( 'Enabled', 'give' ),
365
-									'disabled'   => esc_html__( 'Disabled', 'give' ),
364
+									'enabled'    => esc_html__('Enabled', 'give'),
365
+									'disabled'   => esc_html__('Disabled', 'give'),
366 366
 								)
367 367
 							),
368 368
 							array(
369
-								'name'    => esc_html__( 'Registration', 'give' ),
370
-								'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
371
-								'id'      => $prefix . 'show_register_form',
369
+								'name'    => esc_html__('Registration', 'give'),
370
+								'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
371
+								'id'      => $prefix.'show_register_form',
372 372
 								'type'    => 'radio',
373 373
 								'options' => array(
374
-									'none'         => esc_html__( 'None', 'give' ),
375
-									'registration' => esc_html__( 'Registration', 'give' ),
376
-									'login'        => esc_html__( 'Login', 'give' ),
377
-									'both'         => esc_html__( 'Registration + Login', 'give' ),
374
+									'none'         => esc_html__('None', 'give'),
375
+									'registration' => esc_html__('Registration', 'give'),
376
+									'login'        => esc_html__('Login', 'give'),
377
+									'both'         => esc_html__('Registration + Login', 'give'),
378 378
 								),
379 379
 								'default' => 'none',
380 380
 							),
381 381
 							array(
382
-								'name'    => esc_html__( 'Floating Labels', 'give' ),
382
+								'name'    => esc_html__('Floating Labels', 'give'),
383 383
 								/* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
384
-								'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
385
-								'id'      => $prefix . 'form_floating_labels',
384
+								'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
385
+								'id'      => $prefix.'form_floating_labels',
386 386
 								'type'    => 'radio_inline',
387 387
 								'options' => array(
388
-									'global'   => esc_html__( 'Global Options', 'give' ),
389
-									'enabled'  => esc_html__( 'Enabled', 'give' ),
390
-									'disabled' => esc_html__( 'Disabled', 'give' ),
388
+									'global'   => esc_html__('Global Options', 'give'),
389
+									'enabled'  => esc_html__('Enabled', 'give'),
390
+									'disabled' => esc_html__('Disabled', 'give'),
391 391
 								),
392 392
 								'default' => 'global',
393 393
 							)
@@ -399,92 +399,92 @@  discard block
 block discarded – undo
399 399
 			/**
400 400
 			 * Content Field
401 401
 			 */
402
-			'form_content_options' => apply_filters( 'give_forms_content_options', array(
402
+			'form_content_options' => apply_filters('give_forms_content_options', array(
403 403
 				'id'           => 'form_content_options',
404
-				'title'        => esc_html__( 'Form Content', 'give' ),
405
-				'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
404
+				'title'        => esc_html__('Form Content', 'give'),
405
+				'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
406 406
 
407 407
 						//Donation content.
408 408
 						array(
409
-							'name'        => esc_html__( 'Display Content', 'give' ),
410
-							'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ),
411
-							'id'          => $prefix . 'display_content',
409
+							'name'        => esc_html__('Display Content', 'give'),
410
+							'description' => esc_html__('Do you want to add custom content to this form?', 'give'),
411
+							'id'          => $prefix.'display_content',
412 412
 							'type'        => 'radio_inline',
413 413
 							'options'     => array(
414
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
415
-								'disabled' => esc_html__( 'Disabled', 'give' ),
414
+								'enabled'  => esc_html__('Enabled', 'give'),
415
+								'disabled' => esc_html__('Disabled', 'give'),
416 416
 							),
417 417
 							'default'     => 'disabled',
418 418
 						),
419 419
 
420 420
 						// Content placement.
421 421
 						array(
422
-							'name'        => esc_html__( 'Content Placement', 'give' ),
423
-							'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ),
424
-							'id'          => $prefix . 'content_placement',
422
+							'name'        => esc_html__('Content Placement', 'give'),
423
+							'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'),
424
+							'id'          => $prefix.'content_placement',
425 425
 							'type'        => 'radio_inline',
426
-							'options'     => apply_filters( 'give_forms_content_options_select', array(
427
-									'give_pre_form'  => esc_html__( 'Above fields', 'give' ),
428
-									'give_post_form' => esc_html__( 'Below fields', 'give' ),
426
+							'options'     => apply_filters('give_forms_content_options_select', array(
427
+									'give_pre_form'  => esc_html__('Above fields', 'give'),
428
+									'give_post_form' => esc_html__('Below fields', 'give'),
429 429
 								)
430 430
 							),
431 431
 							'default'     => 'give_pre_form',
432 432
 						),
433 433
 						array(
434
-							'name'        => esc_html__( 'Content', 'give' ),
435
-							'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
436
-							'id'          => $prefix . 'form_content',
434
+							'name'        => esc_html__('Content', 'give'),
435
+							'description' => esc_html__('This content will display on the single give form page.', 'give'),
436
+							'id'          => $prefix.'form_content',
437 437
 							'type'        => 'wysiwyg'
438 438
 						),
439 439
 					)
440 440
 				)
441
-			) ),
441
+			)),
442 442
 
443 443
 			/**
444 444
 			 * Terms & Conditions
445 445
 			 */
446
-			'form_terms_options' => apply_filters( 'give_forms_terms_options', array(
446
+			'form_terms_options' => apply_filters('give_forms_terms_options', array(
447 447
 				'id'           => 'form_terms_options',
448
-				'title'        => esc_html__( 'Terms & Conditions', 'give' ),
449
-				'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
448
+				'title'        => esc_html__('Terms & Conditions', 'give'),
449
+				'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
450 450
 						//Donation Option
451 451
 						array(
452
-							'name'        => esc_html__( 'Terms & Conditions', 'give' ),
453
-							'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
454
-							'id'          => $prefix . 'terms_option',
452
+							'name'        => esc_html__('Terms & Conditions', 'give'),
453
+							'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
454
+							'id'          => $prefix.'terms_option',
455 455
 							'type'        => 'radio_inline',
456
-							'options'     => apply_filters( 'give_forms_content_options_select', array(
457
-									'global'   => esc_html__( 'Global Options', 'give' ),
458
-									'enabled'  => esc_html__( 'Customize', 'give' ),
459
-									'disabled' => esc_html__( 'Disable', 'give' ),
456
+							'options'     => apply_filters('give_forms_content_options_select', array(
457
+									'global'   => esc_html__('Global Options', 'give'),
458
+									'enabled'  => esc_html__('Customize', 'give'),
459
+									'disabled' => esc_html__('Disable', 'give'),
460 460
 								)
461 461
 							),
462 462
 							'default'     => 'global',
463 463
 						),
464 464
 						array(
465
-							'id'          => $prefix . 'agree_label',
466
-							'name'        => esc_html__( 'Agreement Label', 'give' ),
467
-							'desc'        => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
465
+							'id'          => $prefix.'agree_label',
466
+							'name'        => esc_html__('Agreement Label', 'give'),
467
+							'desc'        => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
468 468
 							'type'        => 'text',
469 469
 							'size'        => 'regular',
470 470
 							'attributes'  => array(
471
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
471
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
472 472
 							),
473 473
 						),
474 474
 						array(
475
-							'id'          => $prefix . 'agree_text',
476
-							'name'        => esc_html__( 'Agreement Text', 'give' ),
477
-							'desc'        => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
475
+							'id'          => $prefix.'agree_text',
476
+							'name'        => esc_html__('Agreement Text', 'give'),
477
+							'desc'        => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
478 478
 							'type'        => 'wysiwyg'
479 479
 						),
480 480
 					)
481 481
 				)
482
-			) )
482
+			))
483 483
 		);
484 484
 		/**
485 485
 		 * Filter the metabox tabbed panel settings.
486 486
 		 */
487
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings );
487
+		$settings = apply_filters('give_metabox_form_data_settings', $settings);
488 488
 
489 489
 		// Output.
490 490
 		return $settings;
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 		add_meta_box(
501 501
 			$this->get_metabox_ID(),
502 502
 			$this->get_metabox_label(),
503
-			array( $this, 'output' ),
504
-			array( 'give_forms' ),
503
+			array($this, 'output'),
504
+			array('give_forms'),
505 505
 			'normal',
506 506
 			'high'
507 507
 		);
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 	function enqueue_script() {
518 518
 		global $post;
519 519
 
520
-		if( is_object( $post ) && 'give_forms' === $post->post_type ) {
521
-			wp_enqueue_style( 'wp-color-picker' );
522
-			wp_enqueue_script( 'wp-color-picker' );
520
+		if (is_object($post) && 'give_forms' === $post->post_type) {
521
+			wp_enqueue_style('wp-color-picker');
522
+			wp_enqueue_script('wp-color-picker');
523 523
 		}
524 524
 	}
525 525
 
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 	public function get_tabs() {
554 554
 		$tabs = array();
555 555
 
556
-		if( ! empty( $this->settings ) ) {
557
-			foreach ( $this->settings as $setting ) {
558
-				if( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
556
+		if ( ! empty($this->settings)) {
557
+			foreach ($this->settings as $setting) {
558
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
559 559
 					continue;
560 560
 				}
561 561
 
@@ -579,29 +579,29 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	public function output() {
581 581
 		// Bailout.
582
-		if( $form_data_tabs = $this->get_tabs() ) {
583
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
582
+		if ($form_data_tabs = $this->get_tabs()) {
583
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
584 584
 			?>
585 585
 			<div class="give-metabox-panel-wrap">
586 586
 				<ul class="give-form-data-tabs give-metabox-tabs">
587
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
588
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ); ?>"><a href="#<?php echo $form_data_tab['id']; ?>"><?php echo $form_data_tab['label']; ?></a></li>
587
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
588
+						<li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : ''); ?>"><a href="#<?php echo $form_data_tab['id']; ?>"><?php echo $form_data_tab['label']; ?></a></li>
589 589
 					<?php endforeach; ?>
590 590
 				</ul>
591 591
 
592 592
 				<?php $show_first_tab_content = true; ?>
593
-				<?php foreach ( $this->settings as $setting ) : ?>
594
-					<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
593
+				<?php foreach ($this->settings as $setting) : ?>
594
+					<?php do_action("give_before_{$setting['id']}_settings"); ?>
595 595
 
596
-					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel <?php echo ( $show_first_tab_content ? '' : 'give-hidden' ); $show_first_tab_content = false; ?>">
597
-						<?php if( ! empty( $setting['fields'] ) ) : ?>
598
-							<?php foreach ( $setting['fields'] as $field ) : ?>
599
-								<?php give_render_field( $field ); ?>
596
+					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel <?php echo ($show_first_tab_content ? '' : 'give-hidden'); $show_first_tab_content = false; ?>">
597
+						<?php if ( ! empty($setting['fields'])) : ?>
598
+							<?php foreach ($setting['fields'] as $field) : ?>
599
+								<?php give_render_field($field); ?>
600 600
 							<?php endforeach; ?>
601 601
 						<?php endif; ?>
602 602
 					</div>
603 603
 
604
-					<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
604
+					<?php do_action("give_after_{$setting['id']}_settings"); ?>
605 605
 				<?php endforeach; ?>
606 606
 			</div>
607 607
 			<?php
@@ -615,14 +615,14 @@  discard block
 block discarded – undo
615 615
 	 * @return mixed|void
616 616
 	 */
617 617
 	function cmb2_metabox_settings() {
618
-		$all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() );
618
+		$all_cmb2_settings = apply_filters('cmb2_meta_boxes', array());
619 619
 		$give_forms_settings = $all_cmb2_settings;
620 620
 
621 621
 
622 622
 		// Filter settings: Use only give forms related settings.
623
-		foreach ( $all_cmb2_settings as $index => $setting ) {
624
-			if( ! in_array( 'give_forms', $setting['object_types'] ) ) {
625
-				unset( $give_forms_settings[$index] );
623
+		foreach ($all_cmb2_settings as $index => $setting) {
624
+			if ( ! in_array('give_forms', $setting['object_types'])) {
625
+				unset($give_forms_settings[$index]);
626 626
 			}
627 627
 		}
628 628
 		return $give_forms_settings;
@@ -637,68 +637,68 @@  discard block
 block discarded – undo
637 637
 	 * @param  object $post
638 638
 	 * @return void
639 639
 	 */
640
-	public function save( $post_id, $post ) {
640
+	public function save($post_id, $post) {
641 641
 
642 642
 		// $post_id and $post are required.
643
-		if ( empty( $post_id ) || empty( $post ) ) {
643
+		if (empty($post_id) || empty($post)) {
644 644
 			return;
645 645
 		}
646 646
 		
647 647
 		// Don't save meta boxes for revisions or autosaves.
648
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
648
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
649 649
 			return;
650 650
 		}
651 651
 
652 652
 		// Check the nonce.
653
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
653
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
654 654
 			return;
655 655
 		}
656 656
 
657 657
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
658
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
658
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
659 659
 			return;
660 660
 		}
661 661
 
662 662
 		// Check user has permission to edit.
663
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
663
+		if ( ! current_user_can('edit_post', $post_id)) {
664 664
 			return;
665 665
 		}
666 666
 
667 667
 		// Fire action before saving form meta.
668
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
668
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
669 669
 
670 670
 		/**
671 671
 		 * Filter the meta key to save.
672 672
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
673 673
 		 */
674
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
674
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
675 675
 
676 676
 		// Save form meta data.
677 677
 		// @TODO: Sanitize data for group field, just in case if there any editor setting field.
678
-		if( ! empty( $form_meta_keys ) ) {
679
-			foreach ( $form_meta_keys as $form_meta_key ) {
680
-				if( isset( $_POST[ $form_meta_key ] ) ) {
681
-					if( $field_type = $this->get_field_type( $form_meta_key ) ) {
682
-						switch ( $field_type ) {
678
+		if ( ! empty($form_meta_keys)) {
679
+			foreach ($form_meta_keys as $form_meta_key) {
680
+				if (isset($_POST[$form_meta_key])) {
681
+					if ($field_type = $this->get_field_type($form_meta_key)) {
682
+						switch ($field_type) {
683 683
 							case 'wysiwyg':
684
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
685
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
684
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
685
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
686 686
 								break;
687 687
 
688 688
 							default:
689
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
690
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
689
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
690
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
691 691
 						}
692 692
 
693 693
 						// Fire after saving form meta key.
694
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
694
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
695 695
 					}
696 696
 				}
697 697
 			}
698 698
 		}
699 699
 
700 700
 		// Fire action after saving form meta.
701
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
701
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
702 702
 	}
703 703
 
704 704
 
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
 	 */
711 711
 	private function get_meta_keys_from_settings() {
712 712
 		$meta_keys = array();
713
-		foreach ( $this->settings as $setting ) {
714
-			if( ! empty( $setting['fields'] ) ) {
715
-				foreach ( $setting['fields'] as $field ) {
713
+		foreach ($this->settings as $setting) {
714
+			if ( ! empty($setting['fields'])) {
715
+				foreach ($setting['fields'] as $field) {
716 716
 					$meta_keys[] = $field['id'];
717 717
 				}
718 718
 			}
@@ -729,13 +729,13 @@  discard block
 block discarded – undo
729 729
 	 * @param  $field_id
730 730
 	 * @return array|string
731 731
 	 */
732
-	function get_field_type( $field_id ) {
732
+	function get_field_type($field_id) {
733 733
 		$field_type = '';
734 734
 
735
-		if( ! empty( $this->settings ) ) {
736
-			foreach ( $this->settings as $setting ) {
737
-				if( ! empty( $setting['fields'] ) ) {
738
-					foreach ( $setting['fields'] as $field ) {
735
+		if ( ! empty($this->settings)) {
736
+			foreach ($this->settings as $setting) {
737
+				if ( ! empty($setting['fields'])) {
738
+					foreach ($setting['fields'] as $field) {
739 739
 						$field_type[] = $field['type'];
740 740
 						return $field_type;
741 741
 					}
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 	 * @param  array $settings List of form settings.
753 753
 	 * @return mixed
754 754
 	 */
755
-	function add_offline_donations_setting_tab( $settings  ){
756
-		if( give_is_gateway_active( 'offline') ) {
757
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
755
+	function add_offline_donations_setting_tab($settings) {
756
+		if (give_is_gateway_active('offline')) {
757
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
758 758
 				'id'           => 'offline_donations_options',
759
-				'title'        => esc_html__( 'Offline Donations', 'give' ),
760
-				'fields'       => apply_filters( 'give_forms_offline_donations_metabox_fields', array() )
759
+				'title'        => esc_html__('Offline Donations', 'give'),
760
+				'fields'       => apply_filters('give_forms_offline_donations_metabox_fields', array())
761 761
 			));
762 762
 		}
763 763
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-cmb2-backward-compatibility.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 		 *
86 86
 		 * @since  1.8
87 87
 		 *
88
-		 * @param  $setting_tab
88
+		 * @param  string $setting_tab
89 89
 		 *
90 90
 		 * @return string
91 91
 		 */
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) :
12
+if ( ! class_exists('Give_CMB2_Settings_Loader')) :
13 13
 
14 14
 	/**
15 15
 	 * This class loads the cmb2 settings.
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 
53 53
 			// Get current tab.
54 54
 			$this->current_tab     = give_get_current_setting_tab();
55
-			$this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] );
55
+			$this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']);
56 56
 
57 57
 			// Tab ID.
58 58
 			$this->id = $this->current_tab;
59 59
 
60 60
 
61 61
 			// Add addon tabs.
62
-			add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 );
62
+			add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999);
63 63
 
64 64
 			// Add save hook to addons.
65
-			add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 );
65
+			add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999);
66 66
 
67 67
 			// Add backward compatibility filters plugin settings.
68
-			$setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' );
68
+			$setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses');
69 69
 
70 70
 			// Filter Payment Gateways settings.
71
-			if ( in_array( $this->current_tab, $setting_tabs ) ) {
72
-				add_filter( "give_get_settings_{$this->current_tab}", array(
71
+			if (in_array($this->current_tab, $setting_tabs)) {
72
+				add_filter("give_get_settings_{$this->current_tab}", array(
73 73
 					$this,
74 74
 					'get_filtered_addon_settings'
75
-				), 999999, 1 );
76
-				add_filter( "give_get_sections_{$this->current_tab}", array(
75
+				), 999999, 1);
76
+				add_filter("give_get_sections_{$this->current_tab}", array(
77 77
 					$this,
78 78
 					'get_filtered_addon_sections'
79
-				), 999999, 1 );
79
+				), 999999, 1);
80 80
 			}
81 81
 		}
82 82
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 		 *
90 90
 		 * @return string
91 91
 		 */
92
-		function set_default_setting_tab( $setting_tab ) {
92
+		function set_default_setting_tab($setting_tab) {
93 93
 			$default_tab = '';
94 94
 
95 95
 			// Set default tab to first setting tab.
96
-			if ( $sections = array_keys( $this->get_sections() ) ) {
97
-				$default_tab = current( $sections );
96
+			if ($sections = array_keys($this->get_sections())) {
97
+				$default_tab = current($sections);
98 98
 			}
99 99
 
100 100
 			return $default_tab;
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
 		 *
110 110
 		 * @return mixed
111 111
 		 */
112
-		function add_addon_settings_page( $pages ) {
112
+		function add_addon_settings_page($pages) {
113 113
 			// Previous setting page.
114 114
 			$previous_pages = $this->prev_settings->give_get_settings_tabs();
115 115
 
116 116
 			// API and System Info setting tab merge to Tools setting tab, so remove them from tabs.
117
-			unset( $previous_pages['api'] );
118
-			unset( $previous_pages['system_info'] );
117
+			unset($previous_pages['api']);
118
+			unset($previous_pages['system_info']);
119 119
 
120 120
 			// Tab is not register.
121
-			$pages_diff = array_keys( array_diff( $previous_pages, $pages ) );
121
+			$pages_diff = array_keys(array_diff($previous_pages, $pages));
122 122
 
123 123
 			// Merge old settings with new settings.
124
-			$pages = array_merge( $pages, $previous_pages );
124
+			$pages = array_merge($pages, $previous_pages);
125 125
 
126
-			if ( in_array( $this->current_tab, $pages_diff ) ) {
126
+			if (in_array($this->current_tab, $pages_diff)) {
127 127
 				// Filter & actions.
128
-				add_filter( "give_default_setting_tab_section_{$this->current_tab}", array(
128
+				add_filter("give_default_setting_tab_section_{$this->current_tab}", array(
129 129
 					$this,
130 130
 					'set_default_setting_tab'
131
-				), 10 );
132
-				add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) );
133
-				add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 );
134
-				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) );
131
+				), 10);
132
+				add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections'));
133
+				add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10);
134
+				add_action("give-settings_save_{$this->current_tab}", array($this, 'save'));
135 135
 			}
136 136
 
137 137
 			return $pages;
@@ -147,29 +147,29 @@  discard block
 block discarded – undo
147 147
 		 *
148 148
 		 * @return mixed
149 149
 		 */
150
-		function setup_addon_save_hook( $pages ) {
150
+		function setup_addon_save_hook($pages) {
151 151
 			$page_ids = array();
152 152
 
153
-			foreach ( $pages as $page ) {
154
-				$page_ids = $page->add_settings_page( $page_ids );
153
+			foreach ($pages as $page) {
154
+				$page_ids = $page->add_settings_page($page_ids);
155 155
 			}
156 156
 
157 157
 			// Previous setting page.
158 158
 			$previous_pages = $this->prev_settings->give_get_settings_tabs();
159 159
 
160 160
 			// API and System Info setting tab merge to Tools setting tab, so remove them from tabs.
161
-			unset( $previous_pages['api'] );
162
-			unset( $previous_pages['system_info'] );
161
+			unset($previous_pages['api']);
162
+			unset($previous_pages['system_info']);
163 163
 
164 164
 			// Tab is not register.
165
-			$pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) );
165
+			$pages_diff = array_keys(array_diff($previous_pages, $page_ids));
166 166
 
167 167
 			// Merge old settings with new settings.
168
-			$pages = array_merge( $page_ids, $previous_pages );
168
+			$pages = array_merge($page_ids, $previous_pages);
169 169
 
170
-			if ( in_array( $this->current_tab, $pages_diff ) ) {
170
+			if (in_array($this->current_tab, $pages_diff)) {
171 171
 				// Filter & actions.
172
-				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) );
172
+				add_action("give-settings_save_{$this->current_tab}", array($this, 'save'));
173 173
 			}
174 174
 
175 175
 			return $pages;
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
 		 *
185 185
 		 * @return string
186 186
 		 */
187
-		function get_section_name( $field_name ) {
187
+		function get_section_name($field_name) {
188 188
 			// Bailout.
189
-			if ( empty( $field_name ) ) {
189
+			if (empty($field_name)) {
190 190
 				return $field_name;
191 191
 			}
192 192
 
193
-			$section_name = explode( ' ', $field_name );
193
+			$section_name = explode(' ', $field_name);
194 194
 //			unset( $section_name[ count( $section_name ) - 1 ] );
195 195
 
196 196
 			// Output.
197
-			return strip_tags( implode( ' ', $section_name ) );
197
+			return strip_tags(implode(' ', $section_name));
198 198
 		}
199 199
 
200 200
 
@@ -207,39 +207,39 @@  discard block
 block discarded – undo
207 207
 		 *
208 208
 		 * @return mixed
209 209
 		 */
210
-		function get_filtered_addon_sections( $sections = array() ) {
210
+		function get_filtered_addon_sections($sections = array()) {
211 211
 			// New sections.
212 212
 			$new_sections = array();
213
-			$sections_ID  = array_keys( $sections );
213
+			$sections_ID  = array_keys($sections);
214 214
 
215
-			if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) {
215
+			if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) {
216 216
 
217
-				foreach ( $setting_fields['fields'] as $field ) {
217
+				foreach ($setting_fields['fields'] as $field) {
218 218
 					// Section name.
219
-					$field['name'] = isset( $field['name'] ) ? $field['name'] : '';
220
-					$section_name  = $this->get_section_name( $field['name'] );
219
+					$field['name'] = isset($field['name']) ? $field['name'] : '';
220
+					$section_name  = $this->get_section_name($field['name']);
221 221
 
222 222
 					// Check if section name exit and section title array is not empty.
223
-					if ( ! empty( $sections ) && ! empty( $field['name'] ) ) {
223
+					if ( ! empty($sections) && ! empty($field['name'])) {
224 224
 
225 225
 						// Bailout: Do not load section if it is already exist.
226 226
 						if (
227
-							in_array( sanitize_title( $field['name'] ), $sections_ID ) // Check section id.
228
-							|| in_array( $section_name, $sections )                    // Check section name.
227
+							in_array(sanitize_title($field['name']), $sections_ID) // Check section id.
228
+							|| in_array($section_name, $sections)                    // Check section name.
229 229
 						) {
230 230
 							continue;
231 231
 						}
232 232
 					}
233 233
 
234 234
 					// Collect new sections from addons.
235
-					if ( 'give_title' == $field['type'] ) {
236
-						$new_sections[ sanitize_title( $field['name'] ) ] = $section_name;
235
+					if ('give_title' == $field['type']) {
236
+						$new_sections[sanitize_title($field['name'])] = $section_name;
237 237
 					}
238 238
 				}
239 239
 			}
240 240
 
241 241
 			// Add new section.
242
-			$sections = array_merge( $sections, $new_sections );
242
+			$sections = array_merge($sections, $new_sections);
243 243
 
244 244
 			// Output.
245 245
 			return $sections;
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 		 *
257 257
 		 * @return array
258 258
 		 */
259
-		function get_filtered_addon_settings( $settings, $setting_fields = array() ) {
259
+		function get_filtered_addon_settings($settings, $setting_fields = array()) {
260 260
 			global $wp_filter;
261 261
 
262 262
 			$new_setting_fields = array();
263 263
 
264
-			if ( ! empty( $settings ) ) {
264
+			if ( ! empty($settings)) {
265 265
 				// Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ).
266
-				if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) {
267
-					foreach ( $settings as $setting ) {
266
+				if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) {
267
+					foreach ($settings as $setting) {
268 268
 						$new_setting_fields[] = $setting;
269 269
 
270 270
 						// We need setting only till first section end.
271
-						if ( 'sectionend' === $setting['type'] ) {
271
+						if ('sectionend' === $setting['type']) {
272 272
 							break;
273 273
 						}
274 274
 					}
@@ -280,18 +280,18 @@  discard block
 block discarded – undo
280 280
 				$prev_title_field_id = '';
281 281
 
282 282
 				// Create new setting fields.
283
-				foreach ( $settings as $index => $field ) {
283
+				foreach ($settings as $index => $field) {
284 284
 
285 285
 					// Bailout: Must need field type to process.
286
-					if ( ! isset( $field['type'] ) ) {
286
+					if ( ! isset($field['type'])) {
287 287
 						continue;
288 288
 					}
289 289
 
290
-					$field['name'] = ! isset( $field['name'] ) ? '' : $field['name'];
291
-					$field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc'];
290
+					$field['name'] = ! isset($field['name']) ? '' : $field['name'];
291
+					$field['desc'] = ! isset($field['desc']) ? '' : $field['desc'];
292 292
 
293 293
 					// Modify cmb2 setting fields.
294
-					switch ( $field['type'] ) {
294
+					switch ($field['type']) {
295 295
 						case 'text' :
296 296
 						case 'file' :
297 297
 							$field['css'] = 'width:25em;';
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 							break;
317 317
 					}
318 318
 
319
-					if ( 'title' === $field['type'] ) {
319
+					if ('title' === $field['type']) {
320 320
 
321 321
 						// If we do not have first element as title then these field will be skip from frontend
322 322
 						// because there are not belong to any section, so put all abandon fields under first section.
323
-						if ( $index && empty( $prev_title_field_id ) ) {
323
+						if ($index && empty($prev_title_field_id)) {
324 324
 							array_unshift(
325 325
 								$new_setting_fields,
326 326
 								array(
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 							$prev_title_field_id = $field['id'];
335 335
 
336 336
 							continue;
337
-						} elseif ( $index ) {
337
+						} elseif ($index) {
338 338
 							// Section end.
339 339
 							$new_setting_fields[] = array(
340 340
 								'type' => 'sectionend',
@@ -366,47 +366,47 @@  discard block
 block discarded – undo
366 366
 
367 367
 				// Check if setting page has title section or not.
368 368
 				// If setting page does not have title section  then add title section to it and fix section end array id.
369
-				if ( 'title' !== $new_setting_fields[0]['type'] ) {
369
+				if ('title' !== $new_setting_fields[0]['type']) {
370 370
 					array_unshift(
371 371
 						$new_setting_fields,
372 372
 						array(
373
-							'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ),
373
+							'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''),
374 374
 							'type'  => 'title',
375
-							'desc'  => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '',
376
-							'id'    => ( isset( $settings['id'] ) ? $settings['id'] : '' )
375
+							'desc'  => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '',
376
+							'id'    => (isset($settings['id']) ? $settings['id'] : '')
377 377
 						)
378 378
 					);
379 379
 
380 380
 					// Update id in section end array if does not contain.
381
-					if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) {
382
-						$new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' );
381
+					if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) {
382
+						$new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : '');
383 383
 					}
384 384
 				}
385 385
 
386 386
 				// Return only section related settings.
387
-				if ( $sections = $this->get_filtered_addon_sections() ) {
388
-					$new_setting_fields = $this->get_section_settings( $new_setting_fields );
387
+				if ($sections = $this->get_filtered_addon_sections()) {
388
+					$new_setting_fields = $this->get_section_settings($new_setting_fields);
389 389
 				}
390 390
 
391 391
 				// Third party plugin backward compatibility.
392
-				foreach ( $new_setting_fields as $index => $field ) {
392
+				foreach ($new_setting_fields as $index => $field) {
393 393
 
394
-					if ( in_array( $field['type'], array( 'title', 'sectionend' ) ) ) {
394
+					if (in_array($field['type'], array('title', 'sectionend'))) {
395 395
 						continue;
396 396
 					}
397 397
 
398 398
 					$cmb2_filter_name = "cmb2_render_{$field['type']}";
399 399
 
400
-					if ( ! empty( $wp_filter[ $cmb2_filter_name ] ) ) {
401
-						$cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] );
400
+					if ( ! empty($wp_filter[$cmb2_filter_name])) {
401
+						$cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]);
402 402
 
403
-						if ( ! empty( $cmb2_filter_arr ) ) {
403
+						if ( ! empty($cmb2_filter_arr)) {
404 404
 							// Note: function can be called either globally or with class object, it depends on how developer invoke it.
405
-							$new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr );
406
-							add_action( "give_admin_field_{$field['type']}", array(
405
+							$new_setting_fields[$index]['func'] = current($cmb2_filter_arr);
406
+							add_action("give_admin_field_{$field['type']}", array(
407 407
 								$this,
408 408
 								'addon_setting_field'
409
-							), 10, 2 );
409
+							), 10, 2);
410 410
 						}
411 411
 					}
412 412
 				}
@@ -427,31 +427,31 @@  discard block
 block discarded – undo
427 427
 		 *
428 428
 		 * @return array
429 429
 		 */
430
-		function get_section_settings( $tab_settings ) {
430
+		function get_section_settings($tab_settings) {
431 431
 			$current_section = give_get_current_setting_section();
432 432
 
433 433
 			// Note: If we are opening default tabe for addon setting then it is possible that we will get empty string as current section
434 434
 			// because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section
435 435
 			// This is hack to fix this.
436
-			if ( empty( $current_section ) ) {
437
-				$current_section = $this->set_default_setting_tab( $current_section );
436
+			if (empty($current_section)) {
437
+				$current_section = $this->set_default_setting_tab($current_section);
438 438
 			}
439 439
 
440 440
 			$section_start               = false;
441 441
 			$section_end                 = false;
442 442
 			$section_only_setting_fields = array();
443 443
 
444
-			foreach ( $tab_settings as $field ) {
445
-				if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) {
444
+			foreach ($tab_settings as $field) {
445
+				if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) {
446 446
 					$section_start = true;
447 447
 				}
448 448
 
449
-				if ( ! $section_start || $section_end ) {
449
+				if ( ! $section_start || $section_end) {
450 450
 					continue;
451 451
 				}
452 452
 
453
-				if ( $section_start && ! $section_end ) {
454
-					if ( 'sectionend' == $field['type'] ) {
453
+				if ($section_start && ! $section_end) {
454
+					if ('sectionend' == $field['type']) {
455 455
 						$section_end = true;
456 456
 					}
457 457
 					$section_only_setting_fields[] = $field;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			// Remove title from setting, pevent it from render in setting tab.
462 462
 			$section_only_setting_fields[0]['title'] = '';
463 463
 
464
-			return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings );
464
+			return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings);
465 465
 		}
466 466
 
467 467
 
@@ -475,17 +475,17 @@  discard block
 block discarded – undo
475 475
 		 *
476 476
 		 * @return void
477 477
 		 */
478
-		function addon_setting_field( $field, $saved_value ) {
478
+		function addon_setting_field($field, $saved_value) {
479 479
 			// Create object for cmb2  function callback backward compatibility.
480 480
 			// Note: Do not call any cmb2 function on these objects
481
-			$field_obj      = (object) array( 'args' => $field );
482
-			$field_type_obj = (object) array( 'field' => $field_obj );
481
+			$field_obj      = (object) array('args' => $field);
482
+			$field_type_obj = (object) array('field' => $field_obj);
483 483
 
484
-			switch ( $this->current_tab ) :
484
+			switch ($this->current_tab) :
485 485
 				case 'licenses':
486 486
 					?>
487 487
 					<div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>">
488
-						<?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?>
488
+						<?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?>
489 489
 					</div>
490 490
 					<? break;
491 491
 
@@ -493,19 +493,19 @@  discard block
 block discarded – undo
493 493
 					$colspan = "colspan=\"2\"";
494 494
 					?>
495 495
 					<tr valign="top">
496
-						<?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( '&nbsp;' ) ) ) : ?>
496
+						<?php if ( ! empty($field['name']) && ! in_array($field['name'], array('&nbsp;'))) : ?>
497 497
 							<th scope="row" class="titledesc">
498 498
 								<label
499
-									for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label>
499
+									for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label>
500 500
 							</th>
501 501
 							<?php $colspan = ''; ?>
502 502
 						<?php endif; ?>
503 503
 						<td class="give-forminp" <?php echo $colspan; ?>>
504 504
 							<?php
505
-							if ( is_array( $field['func']['function'] ) ) {
506
-								$field['func']['function'][0]->$field['func']['function'][1]( $field_obj, $saved_value, '', '', $field_type_obj );
505
+							if (is_array($field['func']['function'])) {
506
+								$field['func']['function'][0]->$field['func']['function'][1]($field_obj, $saved_value, '', '', $field_type_obj);
507 507
 							} else {
508
-								$field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj );
508
+								$field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj);
509 509
 							}
510 510
 							?>
511 511
 						</td>
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
 		public function get_sections() {
524 524
 			$sections = array();
525 525
 
526
-			if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) {
527
-				foreach ( $setting_fields['fields'] as $field ) {
528
-					if ( 'give_title' == $field['type'] ) {
529
-						$sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] );
526
+			if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) {
527
+				foreach ($setting_fields['fields'] as $field) {
528
+					if ('give_title' == $field['type']) {
529
+						$sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']);
530 530
 					}
531 531
 				}
532 532
 			}
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
 
547 547
 			$new_setting_fields = array();
548 548
 
549
-			if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) {
550
-				if ( isset( $setting_fields['fields'] ) ) {
549
+			if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) {
550
+				if (isset($setting_fields['fields'])) {
551 551
 
552 552
 					$tab_data = array(
553 553
 						'id'         => $setting_fields['id'],
554 554
 						'give_title' => $setting_fields['give_title'],
555
-						'desc'       => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' )
555
+						'desc'       => (isset($setting_fields['desc']) ? $setting_fields['desc'] : '')
556 556
 					);
557 557
 
558
-					$new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data );
558
+					$new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data);
559 559
 				}
560 560
 			}
561 561
 
@@ -571,16 +571,16 @@  discard block
 block discarded – undo
571 571
 		public function output_sections() {
572 572
 			$sections = $this->get_sections();
573 573
 
574
-			if ( empty( $sections ) || 1 === sizeof( $sections ) ) {
574
+			if (empty($sections) || 1 === sizeof($sections)) {
575 575
 				return;
576 576
 			}
577 577
 
578 578
 			echo '<ul class="subsubsub">';
579 579
 
580
-			$array_keys = array_keys( $sections );
580
+			$array_keys = array_keys($sections);
581 581
 
582
-			foreach ( $sections as $id => $label ) {
583
-				echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
582
+			foreach ($sections as $id => $label) {
583
+				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'&section='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>';
584 584
 			}
585 585
 
586 586
 			echo '</ul><br class="clear" />';
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		public function output() {
596 596
 			$settings = $this->get_settings();
597 597
 
598
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
598
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
599 599
 		}
600 600
 
601 601
 		/**
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 		public function save() {
608 608
 			$settings = $this->get_settings();
609 609
 
610
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
610
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
611 611
 		}
612 612
 	}
613 613
 endif;
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +140 added lines, -140 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,36 +23,36 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	// Give Forms single post and archive options.
26
-	$give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) );
27
-	$give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) );
26
+	$give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular'));
27
+	$give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives'));
28 28
 
29
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
29
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
30 30
 	//support for old 'GIVE_FORMS_SLUG' constant
31
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
31
+	if (defined('GIVE_FORMS_SLUG')) {
32 32
 		$give_forms_slug = GIVE_FORMS_SLUG;
33 33
 	}
34 34
 
35
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
35
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36 36
 		'slug'       => $give_forms_slug,
37 37
 		'with_front' => false
38 38
 	);
39 39
 
40
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
41
-		'name'               => esc_html__( 'Donation Forms', 'give' ),
42
-		'singular_name'      => esc_html__( 'Form', 'give' ),
43
-		'add_new'            => esc_html__( 'Add Form', 'give' ),
44
-		'add_new_item'       => esc_html__( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => esc_html__( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => esc_html__( 'New Form', 'give' ),
47
-		'all_items'          => esc_html__( 'All Forms', 'give' ),
48
-		'view_item'          => esc_html__( 'View Form', 'give' ),
49
-		'search_items'       => esc_html__( 'Search Forms', 'give' ),
50
-		'not_found'          => esc_html__( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => esc_html__('Donation Forms', 'give'),
42
+		'singular_name'      => esc_html__('Form', 'give'),
43
+		'add_new'            => esc_html__('Add Form', 'give'),
44
+		'add_new_item'       => esc_html__('Add New Donation Form', 'give'),
45
+		'edit_item'          => esc_html__('Edit Donation Form', 'give'),
46
+		'new_item'           => esc_html__('New Form', 'give'),
47
+		'all_items'          => esc_html__('All Forms', 'give'),
48
+		'view_item'          => esc_html__('View Form', 'give'),
49
+		'search_items'       => esc_html__('Search Forms', 'give'),
50
+		'not_found'          => esc_html__('No forms found.', 'give'),
51
+		'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) )
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give'))
55
+	));
56 56
 
57 57
 	//Default give_forms supports.
58 58
 	$give_form_supports = array(
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 
66 66
 	//Has the user disabled the excerpt?
67
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
68
-		unset( $give_form_supports[2] );
67
+	if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) {
68
+		unset($give_form_supports[2]);
69 69
 	}
70 70
 
71 71
 	//Has user disabled the featured image?
72
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
73
-		unset( $give_form_supports[1] );
74
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
72
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
73
+		unset($give_form_supports[1]);
74
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
75 75
 	}
76 76
 
77 77
 	$give_forms_args = array(
@@ -87,42 +87,42 @@  discard block
 block discarded – undo
87 87
 		'has_archive'        => $give_forms_archives,
88 88
 		'menu_icon'          => 'dashicons-give',
89 89
 		'hierarchical'       => false,
90
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
90
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
91 91
 	);
92
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
92
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
93 93
 	
94 94
 	/** Donation Post Type */
95 95
 	$payment_labels = array(
96
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
97
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
98
-		'add_new'            => esc_html__( 'Add New', 'give' ),
99
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
100
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
101
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
102
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
103
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
104
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
105
-		'not_found'          => esc_html__( 'No donations found.', 'give' ),
106
-		'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ),
96
+		'name'               => _x('Donations', 'post type general name', 'give'),
97
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
98
+		'add_new'            => esc_html__('Add New', 'give'),
99
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
100
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
101
+		'new_item'           => esc_html__('New Donation', 'give'),
102
+		'all_items'          => esc_html__('All Donations', 'give'),
103
+		'view_item'          => esc_html__('View Donation', 'give'),
104
+		'search_items'       => esc_html__('Search Donations', 'give'),
105
+		'not_found'          => esc_html__('No donations found.', 'give'),
106
+		'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'),
107 107
 		'parent_item_colon'  => '',
108
-		'menu_name'          => esc_html__( 'Donations', 'give' )
108
+		'menu_name'          => esc_html__('Donations', 'give')
109 109
 	);
110 110
 
111 111
 	$payment_args = array(
112
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
112
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
113 113
 		'public'          => false,
114 114
 		'query_var'       => false,
115 115
 		'rewrite'         => false,
116 116
 		'map_meta_cap'    => true,
117 117
 		'capability_type' => 'give_payment',
118
-		'supports'        => array( 'title' ),
118
+		'supports'        => array('title'),
119 119
 		'can_export'      => true
120 120
 	);
121
-	register_post_type( 'give_payment', $payment_args );
121
+	register_post_type('give_payment', $payment_args);
122 122
 
123 123
 }
124 124
 
125
-add_action( 'init', 'give_setup_post_types', 1 );
125
+add_action('init', 'give_setup_post_types', 1);
126 126
 
127 127
 
128 128
 /**
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_setup_taxonomies() {
137 137
 
138
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
138
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
139 139
 
140 140
 	/** Categories */
141 141
 	$category_labels = array(
142
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
143
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
144
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
145
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
146
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
147
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
148
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
149
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
150
-		'add_new_item'      => esc_html__( 'Add New Category', 'give' ),
151
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
152
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
142
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
143
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
144
+		'search_items'      => esc_html__('Search Categories', 'give'),
145
+		'all_items'         => esc_html__('All Categories', 'give'),
146
+		'parent_item'       => esc_html__('Parent Category', 'give'),
147
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
148
+		'edit_item'         => esc_html__('Edit Category', 'give'),
149
+		'update_item'       => esc_html__('Update Category', 'give'),
150
+		'add_new_item'      => esc_html__('Add New Category', 'give'),
151
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
152
+		'menu_name'         => esc_html__('Categories', 'give'),
153 153
 	);
154 154
 
155
-	$category_args = apply_filters( 'give_forms_category_args', array(
155
+	$category_args = apply_filters('give_forms_category_args', array(
156 156
 			'hierarchical' => true,
157
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
157
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
158 158
 			'show_ui'      => true,
159 159
 			'query_var'    => 'give_forms_category',
160 160
 			'rewrite'      => array(
161
-				'slug'         => $slug . '/category',
161
+				'slug'         => $slug.'/category',
162 162
 				'with_front'   => false,
163 163
 				'hierarchical' => true
164 164
 			),
@@ -172,34 +172,34 @@  discard block
 block discarded – undo
172 172
 	);
173 173
 
174 174
 	//Does the user want categories?
175
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
176
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
177
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
175
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
176
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
177
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
178 178
 	}
179 179
 
180 180
 
181 181
 	/** Tags */
182 182
 	$tag_labels = array(
183
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
184
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
185
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
186
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
187
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
188
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
189
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
190
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
191
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
192
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
193
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
194
-		'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ),
183
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
184
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
185
+		'search_items'          => esc_html__('Search Tags', 'give'),
186
+		'all_items'             => esc_html__('All Tags', 'give'),
187
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
188
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
189
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
190
+		'update_item'           => esc_html__('Update Tag', 'give'),
191
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
192
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
193
+		'menu_name'             => esc_html__('Tags', 'give'),
194
+		'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'),
195 195
 	);
196 196
 
197
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
197
+	$tag_args = apply_filters('give_forms_tag_args', array(
198 198
 			'hierarchical' => false,
199
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
199
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
200 200
 			'show_ui'      => true,
201 201
 			'query_var'    => 'give_forms_tag',
202
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
202
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
203 203
 			'capabilities' => array(
204 204
 				'manage_terms' => 'manage_give_form_terms',
205 205
 				'edit_terms'   => 'edit_give_form_terms',
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 		)
210 210
 	);
211 211
 
212
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
213
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
214
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
212
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
213
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
214
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
215 215
 	}
216 216
 
217 217
 
218 218
 }
219 219
 
220
-add_action( 'init', 'give_setup_taxonomies', 0 );
220
+add_action('init', 'give_setup_taxonomies', 0);
221 221
 
222 222
 
223 223
 /**
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
  */
229 229
 function give_get_default_form_labels() {
230 230
 	$defaults = array(
231
-		'singular' => esc_html__( 'Form', 'give' ),
232
-		'plural'   => esc_html__( 'Forms', 'give' )
231
+		'singular' => esc_html__('Form', 'give'),
232
+		'plural'   => esc_html__('Forms', 'give')
233 233
 	);
234 234
 
235
-	return apply_filters( 'give_default_form_name', $defaults );
235
+	return apply_filters('give_default_form_name', $defaults);
236 236
 }
237 237
 
238 238
 /**
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return string $defaults['singular'] Singular label
246 246
  */
247
-function give_get_forms_label_singular( $lowercase = false ) {
247
+function give_get_forms_label_singular($lowercase = false) {
248 248
 	$defaults = give_get_default_form_labels();
249 249
 
250
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
250
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
251 251
 }
252 252
 
253 253
 /**
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
  * @since 1.0
257 257
  * @return string $defaults['plural'] Plural label
258 258
  */
259
-function give_get_forms_label_plural( $lowercase = false ) {
259
+function give_get_forms_label_plural($lowercase = false) {
260 260
 	$defaults = give_get_default_form_labels();
261 261
 
262
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
262
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
263 263
 }
264 264
 
265 265
 /**
@@ -271,24 +271,24 @@  discard block
 block discarded – undo
271 271
  *
272 272
  * @return string $title New placeholder text
273 273
  */
274
-function give_change_default_title( $title ) {
274
+function give_change_default_title($title) {
275 275
 	// If a frontend plugin uses this filter (check extensions before changing this function)
276
-	if ( ! is_admin() ) {
277
-		$title = esc_html__( 'Enter form title here', 'give' );
276
+	if ( ! is_admin()) {
277
+		$title = esc_html__('Enter form title here', 'give');
278 278
 
279 279
 		return $title;
280 280
 	}
281 281
 
282 282
 	$screen = get_current_screen();
283 283
 
284
-	if ( 'give_forms' == $screen->post_type ) {
285
-		$title = esc_html__( 'Enter form title here', 'give' );
284
+	if ('give_forms' == $screen->post_type) {
285
+		$title = esc_html__('Enter form title here', 'give');
286 286
 	}
287 287
 
288 288
 	return $title;
289 289
 }
290 290
 
291
-add_filter( 'enter_title_here', 'give_change_default_title' );
291
+add_filter('enter_title_here', 'give_change_default_title');
292 292
 
293 293
 /**
294 294
  * Registers Custom Post Statuses which are used by the Payments
@@ -298,50 +298,50 @@  discard block
 block discarded – undo
298 298
  */
299 299
 function give_register_post_type_statuses() {
300 300
 	// Payment Statuses
301
-	register_post_status( 'refunded', array(
302
-		'label'                     => esc_html__( 'Refunded', 'give' ),
301
+	register_post_status('refunded', array(
302
+		'label'                     => esc_html__('Refunded', 'give'),
303 303
 		'public'                    => true,
304 304
 		'exclude_from_search'       => false,
305 305
 		'show_in_admin_all_list'    => true,
306 306
 		'show_in_admin_status_list' => true,
307
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
308
-	) );
309
-	register_post_status( 'failed', array(
310
-		'label'                     => esc_html__( 'Failed', 'give' ),
307
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
308
+	));
309
+	register_post_status('failed', array(
310
+		'label'                     => esc_html__('Failed', 'give'),
311 311
 		'public'                    => true,
312 312
 		'exclude_from_search'       => false,
313 313
 		'show_in_admin_all_list'    => true,
314 314
 		'show_in_admin_status_list' => true,
315
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
316
-	) );
317
-	register_post_status( 'revoked', array(
318
-		'label'                     => esc_html__( 'Revoked', 'give' ),
315
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
316
+	));
317
+	register_post_status('revoked', array(
318
+		'label'                     => esc_html__('Revoked', 'give'),
319 319
 		'public'                    => true,
320 320
 		'exclude_from_search'       => false,
321 321
 		'show_in_admin_all_list'    => true,
322 322
 		'show_in_admin_status_list' => true,
323
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
324
-	) );
325
-	register_post_status( 'cancelled', array(
326
-		'label'                     => esc_html__( 'Cancelled', 'give' ),
323
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
324
+	));
325
+	register_post_status('cancelled', array(
326
+		'label'                     => esc_html__('Cancelled', 'give'),
327 327
 		'public'                    => true,
328 328
 		'exclude_from_search'       => false,
329 329
 		'show_in_admin_all_list'    => true,
330 330
 		'show_in_admin_status_list' => true,
331
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
332
-	) );
333
-	register_post_status( 'abandoned', array(
334
-		'label'                     => esc_html__( 'Abandoned', 'give' ),
331
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
332
+	));
333
+	register_post_status('abandoned', array(
334
+		'label'                     => esc_html__('Abandoned', 'give'),
335 335
 		'public'                    => true,
336 336
 		'exclude_from_search'       => false,
337 337
 		'show_in_admin_all_list'    => true,
338 338
 		'show_in_admin_status_list' => true,
339
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
340
-	) );
339
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
340
+	));
341 341
 
342 342
 }
343 343
 
344
-add_action( 'init', 'give_register_post_type_statuses' );
344
+add_action('init', 'give_register_post_type_statuses');
345 345
 
346 346
 /**
347 347
  * Updated Messages
@@ -354,27 +354,27 @@  discard block
 block discarded – undo
354 354
  *
355 355
  * @return array $messages New post updated messages
356 356
  */
357
-function give_updated_messages( $messages ) {
357
+function give_updated_messages($messages) {
358 358
 	global $post, $post_ID;
359 359
 
360
-	if ( give_get_option( 'disable_forms_singular' ) === 'on' ) {
360
+	if (give_get_option('disable_forms_singular') === 'on') {
361 361
 
362 362
 		$messages['give_forms'] = array(
363
-			1 => esc_html__( 'Form updated.',   'give' ),
364
-			4 => esc_html__( 'Form updated.',   'give' ),
365
-			6 => esc_html__( 'Form published.', 'give' ),
366
-			7 => esc_html__( 'Form saved.',     'give' ),
367
-			8 => esc_html__( 'Form submitted.', 'give' )
363
+			1 => esc_html__('Form updated.', 'give'),
364
+			4 => esc_html__('Form updated.', 'give'),
365
+			6 => esc_html__('Form published.', 'give'),
366
+			7 => esc_html__('Form saved.', 'give'),
367
+			8 => esc_html__('Form submitted.', 'give')
368 368
 		);
369 369
 
370 370
 	} else {
371 371
 
372 372
 		$messages['give_forms'] = array(
373
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.',   'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
374
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.',   'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
375
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
376
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.',     'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
377
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) )
373
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
374
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
375
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
376
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
377
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give'))
378 378
 		);
379 379
 
380 380
 	}
@@ -382,27 +382,27 @@  discard block
 block discarded – undo
382 382
 	return $messages;
383 383
 }
384 384
 
385
-add_filter( 'post_updated_messages', 'give_updated_messages' );
385
+add_filter('post_updated_messages', 'give_updated_messages');
386 386
 
387 387
 
388 388
 /**
389 389
  * Setup Post Type Images
390 390
  */
391
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
391
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
392 392
 
393 393
 /**
394 394
  * Ensure post thumbnail support is turned on
395 395
  */
396 396
 function give_add_thumbnail_support() {
397
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
397
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
398 398
 		return;
399 399
 	}
400 400
 
401
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
402
-		add_theme_support( 'post-thumbnails' );
401
+	if ( ! current_theme_supports('post-thumbnails')) {
402
+		add_theme_support('post-thumbnails');
403 403
 	}
404 404
 
405
-	add_post_type_support( 'give_forms', 'thumbnail' );
405
+	add_post_type_support('give_forms', 'thumbnail');
406 406
 }
407 407
 
408 408
 /**
@@ -415,21 +415,21 @@  discard block
 block discarded – undo
415 415
 
416 416
 	//Single Give Forms (disabled if single turned off in settings)
417 417
 	if (
418
-		! give_is_setting_enabled( give_get_option( 'forms_singular' ) )
419
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
418
+		! give_is_setting_enabled(give_get_option('forms_singular'))
419
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
420 420
 	) {
421 421
 
422
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
423
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
422
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
423
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
424 424
 			'id'            => 'give-forms-sidebar',
425
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
425
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
426 426
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
427 427
 			'after_widget'  => '</div>',
428 428
 			'before_title'  => '<h3 class="widgettitle widget-title">',
429 429
 			'after_title'   => '</h3>',
430
-		) ) );
430
+		)));
431 431
 
432 432
 	}
433 433
 }
434 434
 
435
-add_action( 'widgets_init', 'give_widgets_init', 999 );
435
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +97 added lines, -97 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
 
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34 34
 
35 35
 	/**
36 36
 	 * Filters the from name.
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @since 1.0
42 42
 	 */
43
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
43
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
44 44
 
45
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
45
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
46 46
 
47 47
 	/**
48 48
 	 * Filters the from email.
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @since 1.0
54 54
 	 */
55
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
55
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
56 56
 
57
-	$to_email = give_get_payment_user_email( $payment_id );
57
+	$to_email = give_get_payment_user_email($payment_id);
58 58
 
59
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
59
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
60 60
 
61 61
 	/**
62 62
 	 * Filters the donation email receipt subject.
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
67
-	$subject = give_do_email_tags( $subject, $payment_id );
66
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
67
+	$subject = give_do_email_tags($subject, $payment_id);
68 68
 
69 69
 	/**
70 70
 	 * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt.
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @since 1.0
76 76
 	 */
77
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
78
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
77
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
78
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
79 79
 
80 80
 	$emails = Give()->emails;
81 81
 
82
-	$emails->__set( 'from_name', $from_name );
83
-	$emails->__set( 'from_email', $from_email );
84
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
82
+	$emails->__set('from_name', $from_name);
83
+	$emails->__set('from_email', $from_email);
84
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
85 85
 
86 86
 	/**
87 87
 	 * Filters the donation receipt's email headers.
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @since 1.0
93 93
 	 */
94
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
95
-	$emails->__set( 'headers', $headers );
94
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
95
+	$emails->__set('headers', $headers);
96 96
 
97 97
 	//Send the donation receipt.
98
-	$emails->send( $to_email, $subject, $message, $attachments );
98
+	$emails->send($to_email, $subject, $message, $attachments);
99 99
 
100 100
 	//If admin notifications are on, send the admin notice.
101
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
101
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
102 102
 		/**
103 103
 		 * Fires in the donation email receipt.
104 104
 		 *
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 * @param int $payment_id Payment id.
110 110
 		 * @param mixed $payment_data Payment meta data.
111 111
 		 */
112
-		do_action( 'give_admin_donation_email', $payment_id, $payment_data );
112
+		do_action('give_admin_donation_email', $payment_id, $payment_data);
113 113
 	}
114 114
 }
115 115
 
@@ -122,41 +122,41 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function give_email_test_donation_receipt() {
124 124
 
125
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
125
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
126 126
 
127 127
 	/**
128 128
 	 * Filters the from name.
129 129
 	 *
130 130
 	 * @since 1.7
131 131
 	 */
132
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() );
132
+	$from_name = apply_filters('give_donation_from_name', $from_name, 0, array());
133 133
 
134
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
134
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
135 135
 
136 136
 	/**
137 137
 	 * Filters the from email.
138 138
 	 *
139 139
 	 * @since 1.7
140 140
 	 */
141
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() );
141
+	$from_email = apply_filters('give_donation_from_address', $from_email, 0, array());
142 142
 
143
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
144
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
145
-	$subject = give_do_email_tags( $subject, 0 );
143
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
144
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
145
+	$subject = give_do_email_tags($subject, 0);
146 146
 
147
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
147
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
148 148
 
149
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
149
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
150 150
 
151 151
 	$emails = Give()->emails;
152
-	$emails->__set( 'from_name', $from_name );
153
-	$emails->__set( 'from_email', $from_email );
154
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
152
+	$emails->__set('from_name', $from_name);
153
+	$emails->__set('from_email', $from_email);
154
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
155 155
 
156
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
157
-	$emails->__set( 'headers', $headers );
156
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
157
+	$emails->__set('headers', $headers);
158 158
 
159
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
159
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
160 160
 
161 161
 }
162 162
 
@@ -170,49 +170,49 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @return void
172 172
  */
173
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
173
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
174 174
 
175
-	$payment_id = absint( $payment_id );
175
+	$payment_id = absint($payment_id);
176 176
 
177
-	if ( empty( $payment_id ) ) {
177
+	if (empty($payment_id)) {
178 178
 		return;
179 179
 	}
180 180
 
181
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
181
+	if ( ! give_get_payment_by('id', $payment_id)) {
182 182
 		return;
183 183
 	}
184 184
 
185
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
185
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
186 186
 
187 187
 	/**
188 188
 	 * Filters the from name.
189 189
 	 *
190 190
 	 * @since 1.0
191 191
 	 */
192
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
192
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
193 193
 
194
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
194
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
195 195
 
196 196
 	/**
197 197
 	 * Filters the from email.
198 198
 	 *
199 199
 	 * @since 1.0
200 200
 	 */
201
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
201
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
202 202
 
203 203
 	/* translators: %s: payment id */
204
-	$subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
204
+	$subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id));
205 205
 
206 206
 	/**
207 207
 	 * Filters the donation notification subject.
208 208
 	 *
209 209
 	 * @since 1.0
210 210
 	 */
211
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
212
-	$subject = give_do_email_tags( $subject, $payment_id );
211
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
212
+	$subject = give_do_email_tags($subject, $payment_id);
213 213
 
214
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
215
-	$headers .= "Reply-To: " . $from_email . "\r\n";
214
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
215
+	$headers .= "Reply-To: ".$from_email."\r\n";
216 216
 	//$headers  .= "MIME-Version: 1.0\r\n";
217 217
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
218 218
 
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.0
223 223
 	 */
224
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
224
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
225 225
 
226 226
 	/**
227 227
 	 * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple.
228 228
 	 *
229 229
 	 * @since 1.0
230 230
 	 */
231
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
231
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
232 232
 
233
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
233
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
234 234
 
235 235
 	$emails = Give()->emails;
236
-	$emails->__set( 'from_name', $from_name );
237
-	$emails->__set( 'from_email', $from_email );
238
-	$emails->__set( 'headers', $headers );
239
-	$emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) );
236
+	$emails->__set('from_name', $from_name);
237
+	$emails->__set('from_email', $from_email);
238
+	$emails->__set('headers', $headers);
239
+	$emails->__set('heading', esc_html__('New Donation!', 'give'));
240 240
 
241
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
241
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
242 242
 
243 243
 }
244 244
 
245
-add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 );
245
+add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2);
246 246
 
247 247
 /**
248 248
  * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
  */
253 253
 function give_get_admin_notice_emails() {
254 254
 
255
-	$email_option = give_get_option( 'admin_notice_emails' );
255
+	$email_option = give_get_option('admin_notice_emails');
256 256
 
257
-	$emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
258
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
257
+	$emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email');
258
+	$emails = array_map('trim', explode("\n", $emails));
259 259
 
260
-	return apply_filters( 'give_admin_notice_emails', $emails );
260
+	return apply_filters('give_admin_notice_emails', $emails);
261 261
 }
262 262
 
263 263
 /**
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return mixed
271 271
  */
272
-function give_admin_notices_disabled( $payment_id = 0 ) {
272
+function give_admin_notices_disabled($payment_id = 0) {
273 273
 
274 274
 	return apply_filters(
275 275
 		'give_admin_notices_disabled',
276
-		! give_is_setting_enabled( give_get_option( 'admin_notices' ) ),
276
+		! give_is_setting_enabled(give_get_option('admin_notices')),
277 277
 		$payment_id
278 278
 	);
279 279
 }
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
  */
289 289
 function give_get_default_donation_notification_email() {
290 290
 
291
-	$default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n";
292
-	$default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
293
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
294
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
295
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
296
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
297
-	$default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n";
298
-	$default_email_body .= '{sitename}' . "\n";
291
+	$default_email_body = esc_html__('Hi there,', 'give')."\n\n";
292
+	$default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
293
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n";
294
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
295
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
296
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
297
+	$default_email_body .= esc_html__('Thank you,', 'give')."\n\n";
298
+	$default_email_body .= '{sitename}'."\n";
299 299
 
300
-	$custom_message = give_get_option( 'donation_notification' );
301
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
300
+	$custom_message = give_get_option('donation_notification');
301
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
302 302
 
303
-	return apply_filters( 'give_default_donation_notification_email', $message );
303
+	return apply_filters('give_default_donation_notification_email', $message);
304 304
 }
305 305
 
306 306
 
@@ -314,25 +314,25 @@  discard block
 block discarded – undo
314 314
  */
315 315
 function give_get_default_donation_receipt_email() {
316 316
 
317
-	$default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n";
318
-	$default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
319
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
320
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
321
-	$default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
322
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
323
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
324
-	$default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
325
-	$default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
326
-	$default_email_body .= '{receipt_link}' . "\n\n";
317
+	$default_email_body = esc_html__('Dear', 'give')." {name},\n\n";
318
+	$default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
319
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n";
320
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
321
+	$default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n";
322
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
323
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
324
+	$default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
325
+	$default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
326
+	$default_email_body .= '{receipt_link}'."\n\n";
327 327
 	$default_email_body .= "\n\n";
328
-	$default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n";
329
-	$default_email_body .= '{sitename}' . "\n";
328
+	$default_email_body .= esc_html__('Sincerely,', 'give')."\n";
329
+	$default_email_body .= '{sitename}'."\n";
330 330
 
331
-	$custom_message = give_get_option( 'donation_receipt' );
331
+	$custom_message = give_get_option('donation_receipt');
332 332
 
333
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
333
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
334 334
 
335
-	return apply_filters( 'give_default_donation_receipt_email', $message );
335
+	return apply_filters('give_default_donation_receipt_email', $message);
336 336
 }
337 337
 
338 338
 /**
@@ -344,19 +344,19 @@  discard block
 block discarded – undo
344 344
  *
345 345
  * @return array $email_names
346 346
  */
347
-function give_get_email_names( $user_info ) {
347
+function give_get_email_names($user_info) {
348 348
 	$email_names = array();
349
-	$user_info   = maybe_unserialize( $user_info );
349
+	$user_info   = maybe_unserialize($user_info);
350 350
 
351 351
 	$email_names['fullname'] = '';
352
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
353
-		$user_data               = get_userdata( $user_info['id'] );
352
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
353
+		$user_data               = get_userdata($user_info['id']);
354 354
 		$email_names['name']     = $user_info['first_name'];
355
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
355
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
356 356
 		$email_names['username'] = $user_data->user_login;
357
-	} elseif ( isset( $user_info['first_name'] ) ) {
357
+	} elseif (isset($user_info['first_name'])) {
358 358
 		$email_names['name']     = $user_info['first_name'];
359
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
359
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
360 360
 		$email_names['username'] = $user_info['first_name'];
361 361
 	} else {
362 362
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @since 1.0
21 21
  */
22
-class Give_Forms_Widget extends WP_Widget{
22
+class Give_Forms_Widget extends WP_Widget {
23 23
 	/**
24 24
 	 * The widget class name
25 25
 	 *
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * Instantiate the class
32 32
 	 */
33
-	public function __construct(){
34
-		$this->self = get_class( $this );
33
+	public function __construct() {
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			esc_html__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			esc_html__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook ){
55
+	public function admin_widget_scripts($hook) {
56 56
 		// Directories of assets
57
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
58
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
59
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
57
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
58
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
59
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
60 60
 
61 61
 		// Use minified libraries if SCRIPT_DEBUG is turned off
62
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
62
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
63 63
 
64 64
 		// Widget Script
65
-		if ( $hook == 'widgets.php' ) {
65
+		if ($hook == 'widgets.php') {
66 66
 
67
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
67
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
68 68
 
69
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
69
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
70 70
 
71
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
71
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
72 72
 		}
73 73
 	}
74 74
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 	 *                        before_widget, and after_widget.
80 80
 	 * @param array $instance The settings for the particular instance of the widget.
81 81
 	 */
82
-	public function widget( $args, $instance ){
83
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
84
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
82
+	public function widget($args, $instance) {
83
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
84
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
85 85
 
86 86
 
87 87
 		// If user set float labels to global then check global float label setting and update donation form widget accordingly.
88
-		if( ( 'global' === $instance['float_labels'] ) ) {
89
-			$instance['float_labels'] = give_get_option( 'floatlabels', 'disabled' );
88
+		if (('global' === $instance['float_labels'])) {
89
+			$instance['float_labels'] = give_get_option('floatlabels', 'disabled');
90 90
 		}
91 91
 
92 92
 		echo $args['before_widget'];
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 		 *
97 97
 		 * @since 1.0
98 98
 		 */
99
-		do_action( 'give_before_forms_widget' );
99
+		do_action('give_before_forms_widget');
100 100
 
101
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
101
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
102 102
 
103
-		give_get_donation_form( $instance );
103
+		give_get_donation_form($instance);
104 104
 
105 105
 		echo $args['after_widget'];
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 *
110 110
 		 * @since 1.0
111 111
 		 */
112
-		do_action( 'give_after_forms_widget' );
112
+		do_action('give_after_forms_widget');
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return string
121 121
 	 */
122
-	public function form( $instance ){
122
+	public function form($instance) {
123 123
 		$defaults = array(
124 124
 			'title'         => '',
125 125
 			'id'            => '',
@@ -127,64 +127,64 @@  discard block
 block discarded – undo
127 127
 			'display_style' => 'modal',
128 128
 		);
129 129
 
130
-		$instance = wp_parse_args( (array) $instance, $defaults );
130
+		$instance = wp_parse_args((array) $instance, $defaults);
131 131
 
132 132
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
133
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
133
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
134 134
 
135 135
 		// Query Give Forms
136 136
 		$args = array(
137 137
 			'post_type'      => 'give_forms',
138
-			'posts_per_page' => - 1,
138
+			'posts_per_page' => -1,
139 139
 			'post_status'    => 'publish',
140 140
 		);
141 141
 
142
-		$give_forms = get_posts( $args );
142
+		$give_forms = get_posts($args);
143 143
 
144 144
 		// Widget: Title
145 145
 
146 146
 		?><p>
147
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
148
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br>
149
-			<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
147
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
148
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br>
149
+			<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
150 150
 		</p><?php
151 151
 
152 152
 		// Widget: Give Form
153 153
 
154 154
 		?><p>
155
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
156
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
157
-				<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
158
-				<?php foreach ( $give_forms as $give_form ) { ?>
159
-					<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
155
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
156
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
157
+				<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
158
+				<?php foreach ($give_forms as $give_form) { ?>
159
+					<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
160 160
 				<?php } ?>
161 161
 			</select><br>
162
-			<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
162
+			<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
163 163
 		</p>
164 164
 
165 165
 		<?php // Widget: Display Style ?>
166 166
 		<p>
167
-			<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display style:', 'give' ); ?></label><br>
168
-			<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
169
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
170
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label><br>
167
+			<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display style:', 'give'); ?></label><br>
168
+			<label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
169
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
170
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label><br>
171 171
 			 <small class="give-field-description">
172
-				<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
172
+				<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
173 173
 			</small>
174 174
 		</p>
175 175
 
176 176
 		<?php // Widget: Floating Labels ?>
177 177
 		<p>
178
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
179
-			<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
180
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
181
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
178
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
179
+			<label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
180
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
181
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
182 182
 			<small class="give-field-description">
183 183
 				<?php
184 184
 				printf(
185 185
 					/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
186
-					__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
187
-					esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' )
186
+					__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
187
+					esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')
188 188
 				);
189 189
 			?></small>
190 190
 		</p><?php
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return void
197 197
 	 */
198
-	function widget_init(){
199
-		register_widget( $this->self );
198
+	function widget_init() {
199
+		register_widget($this->self);
200 200
 	}
201 201
 
202 202
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return array
209 209
 	 */
210
-	public function update( $new_instance, $old_instance ){
210
+	public function update($new_instance, $old_instance) {
211 211
 		$this->flush_widget_cache();
212 212
 
213 213
 		return $new_instance;
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return void
220 220
 	 */
221
-	public function flush_widget_cache(){
222
-		wp_cache_delete( $this->self, 'widget' );
221
+	public function flush_widget_cache() {
222
+		wp_cache_delete($this->self, 'widget');
223 223
 	}
224 224
 }
225 225
 
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 1 patch
Spacing   +118 added lines, -118 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
 
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	 * @param  bool  $_id   Post id. Default is false.
330 330
 	 * @param  array $_args Arguments passed.
331 331
 	 */
332
-	public function __construct( $_id = false, $_args = array() ) {
332
+	public function __construct($_id = false, $_args = array()) {
333 333
 
334
-		$donation_form = WP_Post::get_instance( $_id );
334
+		$donation_form = WP_Post::get_instance($_id);
335 335
 
336
-		return $this->setup_donation_form( $donation_form );
336
+		return $this->setup_donation_form($donation_form);
337 337
 	}
338 338
 
339 339
 	/**
@@ -346,23 +346,23 @@  discard block
 block discarded – undo
346 346
 	 *
347 347
 	 * @return bool                   If the setup was successful or not.
348 348
 	 */
349
-	private function setup_donation_form( $donation_form ) {
349
+	private function setup_donation_form($donation_form) {
350 350
 
351
-		if ( ! is_object( $donation_form ) ) {
351
+		if ( ! is_object($donation_form)) {
352 352
 			return false;
353 353
 		}
354 354
 
355
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
355
+		if ( ! is_a($donation_form, 'WP_Post')) {
356 356
 			return false;
357 357
 		}
358 358
 
359
-		if ( 'give_forms' !== $donation_form->post_type ) {
359
+		if ('give_forms' !== $donation_form->post_type) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		foreach ( $donation_form as $key => $value ) {
363
+		foreach ($donation_form as $key => $value) {
364 364
 
365
-			switch ( $key ) {
365
+			switch ($key) {
366 366
 
367 367
 				default:
368 368
 					$this->$key = $value;
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @return mixed
388 388
 	 */
389
-	public function __get( $key ) {
389
+	public function __get($key) {
390 390
 
391
-		if ( method_exists( $this, 'get_' . $key ) ) {
391
+		if (method_exists($this, 'get_'.$key)) {
392 392
 
393
-			return call_user_func( array( $this, 'get_' . $key ) );
393
+			return call_user_func(array($this, 'get_'.$key));
394 394
 
395 395
 		} else {
396 396
 
397 397
 			/* translators: %s: property key */
398
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
398
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
399 399
 
400 400
 		}
401 401
 
@@ -411,30 +411,30 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
413 413
 	 */
414
-	public function create( $data = array() ) {
414
+	public function create($data = array()) {
415 415
 
416
-		if ( $this->id != 0 ) {
416
+		if ($this->id != 0) {
417 417
 			return false;
418 418
 		}
419 419
 
420 420
 		$defaults = array(
421 421
 			'post_type'   => 'give_forms',
422 422
 			'post_status' => 'draft',
423
-			'post_title'  => esc_html__( 'New Donation Form', 'give' ),
423
+			'post_title'  => esc_html__('New Donation Form', 'give'),
424 424
 		);
425 425
 
426
-		$args = wp_parse_args( $data, $defaults );
426
+		$args = wp_parse_args($data, $defaults);
427 427
 
428 428
 		/**
429 429
 		 * Fired before a donation form is created
430 430
 		 *
431 431
 		 * @param array $args The post object arguments used for creation.
432 432
 		 */
433
-		do_action( 'give_form_pre_create', $args );
433
+		do_action('give_form_pre_create', $args);
434 434
 
435
-		$id = wp_insert_post( $args, true );
435
+		$id = wp_insert_post($args, true);
436 436
 
437
-		$donation_form = WP_Post::get_instance( $id );
437
+		$donation_form = WP_Post::get_instance($id);
438 438
 
439 439
 		/**
440 440
 		 * Fired after a donation form is created
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
 		 * @param int   $id   The post ID of the created item.
443 443
 		 * @param array $args The post object arguments used for creation.
444 444
 		 */
445
-		do_action( 'give_form_post_create', $id, $args );
445
+		do_action('give_form_post_create', $id, $args);
446 446
 
447
-		return $this->setup_donation_form( $donation_form );
447
+		return $this->setup_donation_form($donation_form);
448 448
 
449 449
 	}
450 450
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	 * @return string Donation form name.
470 470
 	 */
471 471
 	public function get_name() {
472
-		return get_the_title( $this->ID );
472
+		return get_the_title($this->ID);
473 473
 	}
474 474
 
475 475
 	/**
@@ -482,13 +482,13 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public function get_price() {
484 484
 
485
-		if ( ! isset( $this->price ) ) {
485
+		if ( ! isset($this->price)) {
486 486
 
487
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
487
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
488 488
 
489
-			if ( $this->price ) {
489
+			if ($this->price) {
490 490
 
491
-				$this->price = give_sanitize_amount( $this->price );
491
+				$this->price = give_sanitize_amount($this->price);
492 492
 
493 493
 			} else {
494 494
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		 * @param string     $price The donation form price.
507 507
 		 * @param string|int $id    The form ID.
508 508
 		 */
509
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
509
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
510 510
 	}
511 511
 
512 512
 	/**
@@ -519,14 +519,14 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	public function get_minimum_price() {
521 521
 
522
-		if ( ! isset( $this->minimum_price ) ) {
522
+		if ( ! isset($this->minimum_price)) {
523 523
 
524
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
525
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
524
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
525
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
526 526
 
527
-			if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) {
527
+			if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) {
528 528
 
529
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
529
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
530 530
 
531 531
 			} else {
532 532
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
 		}
538 538
 
539
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
539
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
540 540
 	}
541 541
 
542 542
 	/**
@@ -549,9 +549,9 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	public function get_prices() {
551 551
 
552
-		if ( ! isset( $this->prices ) ) {
552
+		if ( ! isset($this->prices)) {
553 553
 
554
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
554
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
555 555
 
556 556
 		}
557 557
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 		 * @param array      $prices The array of mulit-level prices.
564 564
 		 * @param int|string The     ID of the form.
565 565
 		 */
566
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
566
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
567 567
 
568 568
 	}
569 569
 
@@ -577,13 +577,13 @@  discard block
 block discarded – undo
577 577
 	 */
578 578
 	public function get_goal() {
579 579
 
580
-		if ( ! isset( $this->goal ) ) {
580
+		if ( ! isset($this->goal)) {
581 581
 
582
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
582
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
583 583
 
584
-			if ( $this->goal ) {
584
+			if ($this->goal) {
585 585
 
586
-				$this->goal = give_sanitize_amount( $this->goal );
586
+				$this->goal = give_sanitize_amount($this->goal);
587 587
 
588 588
 			} else {
589 589
 
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
 		}
595 595
 
596
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
596
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
597 597
 
598 598
 	}
599 599
 
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
 	 */
608 608
 	public function is_single_price_mode() {
609 609
 
610
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
610
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
611 611
 		$ret    = 0;
612 612
 
613
-		if ( empty( $option ) || $option === 'set' ) {
613
+		if (empty($option) || $option === 'set') {
614 614
 			$ret = 1;
615 615
 		}
616 616
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 		 * @param bool       $ret Is donation form in single price mode?
623 623
 		 * @param int|string The  ID of the donation form.
624 624
 		 */
625
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
625
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
626 626
 
627 627
 	}
628 628
 
@@ -636,10 +636,10 @@  discard block
 block discarded – undo
636 636
 	 */
637 637
 	public function is_custom_price_mode() {
638 638
 
639
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
639
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
640 640
 		$ret    = 0;
641 641
 
642
-		if ( give_is_setting_enabled( $option ) ) {
642
+		if (give_is_setting_enabled($option)) {
643 643
 			$ret = 1;
644 644
 		}
645 645
 
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 		 * @param bool       $ret Is donation form in custom price mode?
652 652
 		 * @param int|string The  ID of the donation form.
653 653
 		 */
654
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
654
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
655 655
 
656 656
 	}
657 657
 
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function has_variable_prices() {
669 669
 
670
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
670
+		$option = get_post_meta($this->ID, '_give_price_option', true);
671 671
 		$ret    = 0;
672 672
 
673
-		if ( $option === 'multi' ) {
673
+		if ($option === 'multi') {
674 674
 			$ret = 1;
675 675
 		}
676 676
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		 * @param bool       $ret Does donation form have variable prices?
681 681
 		 * @param int|string The  ID of the donation form.
682 682
 		 */
683
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
683
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
684 684
 
685 685
 	}
686 686
 
@@ -694,17 +694,17 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function get_type() {
696 696
 
697
-		if ( ! isset( $this->type ) ) {
697
+		if ( ! isset($this->type)) {
698 698
 
699
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
699
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
700 700
 
701
-			if ( empty( $this->type ) ) {
701
+			if (empty($this->type)) {
702 702
 				$this->type = 'set';
703 703
 			}
704 704
 
705 705
 		}
706 706
 
707
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
707
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
708 708
 
709 709
 	}
710 710
 
@@ -720,23 +720,23 @@  discard block
 block discarded – undo
720 720
 	 *
721 721
 	 * @return string
722 722
 	 */
723
-	public function get_form_classes( $args ) {
723
+	public function get_form_classes($args) {
724 724
 
725
-		$float_labels_option = give_is_float_labels_enabled( $args )
725
+		$float_labels_option = give_is_float_labels_enabled($args)
726 726
 			? 'float-labels-enabled'
727 727
 			: '';
728 728
 
729
-		$form_classes_array = apply_filters( 'give_form_classes', array(
729
+		$form_classes_array = apply_filters('give_form_classes', array(
730 730
 			'give-form',
731
-			'give-form-' . $this->ID,
732
-			'give-form-type-' . $this->get_type(),
731
+			'give-form-'.$this->ID,
732
+			'give-form-type-'.$this->get_type(),
733 733
 			$float_labels_option,
734
-		), $this->ID, $args );
734
+		), $this->ID, $args);
735 735
 
736 736
 		// Remove empty class names.
737
-		$form_classes_array = array_filter( $form_classes_array );
737
+		$form_classes_array = array_filter($form_classes_array);
738 738
 
739
-		return implode( ' ', $form_classes_array );
739
+		return implode(' ', $form_classes_array);
740 740
 
741 741
 	}
742 742
 
@@ -751,19 +751,19 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @return string
753 753
 	 */
754
-	public function get_form_wrap_classes( $args ) {
754
+	public function get_form_wrap_classes($args) {
755 755
 
756
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
756
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
757 757
 			? $args['display_style']
758
-			: get_post_meta( $this->ID, '_give_payment_display', true );
758
+			: get_post_meta($this->ID, '_give_payment_display', true);
759 759
 
760
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
760
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
761 761
 			'give-form-wrap',
762
-			'give-display-' . $display_option,
763
-		), $this->ID, $args );
762
+			'give-display-'.$display_option,
763
+		), $this->ID, $args);
764 764
 
765 765
 
766
-		return implode( ' ', $form_wrap_classes_array );
766
+		return implode(' ', $form_wrap_classes_array);
767 767
 
768 768
 	}
769 769
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	public function is_set_type_donation_form() {
779 779
 		$form_type = $this->get_type();
780 780
 
781
-		return ( 'set' === $form_type ? true : false );
781
+		return ('set' === $form_type ? true : false);
782 782
 	}
783 783
 
784 784
 	/**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	public function is_multi_type_donation_form() {
793 793
 		$form_type = $this->get_type();
794 794
 
795
-		return ( 'multi' === $form_type ? true : false );
795
+		return ('multi' === $form_type ? true : false);
796 796
 
797 797
 	}
798 798
 
@@ -806,15 +806,15 @@  discard block
 block discarded – undo
806 806
 	 */
807 807
 	public function get_sales() {
808 808
 
809
-		if ( ! isset( $this->sales ) ) {
809
+		if ( ! isset($this->sales)) {
810 810
 
811
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
812
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
811
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
812
+				add_post_meta($this->ID, '_give_form_sales', 0);
813 813
 			} // End if
814 814
 
815
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
815
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
816 816
 
817
-			if ( $this->sales < 0 ) {
817
+			if ($this->sales < 0) {
818 818
 				// Never let sales be less than zero
819 819
 				$this->sales = 0;
820 820
 			}
@@ -835,13 +835,13 @@  discard block
 block discarded – undo
835 835
 	 *
836 836
 	 * @return int|false     New number of total sales.
837 837
 	 */
838
-	public function increase_sales( $quantity = 1 ) {
838
+	public function increase_sales($quantity = 1) {
839 839
 
840
-		$sales       = give_get_form_sales_stats( $this->ID );
841
-		$quantity    = absint( $quantity );
840
+		$sales       = give_get_form_sales_stats($this->ID);
841
+		$quantity    = absint($quantity);
842 842
 		$total_sales = $sales + $quantity;
843 843
 
844
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
844
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
845 845
 
846 846
 			$this->sales = $total_sales;
847 847
 
@@ -862,17 +862,17 @@  discard block
 block discarded – undo
862 862
 	 *
863 863
 	 * @return int|false     New number of total sales.
864 864
 	 */
865
-	public function decrease_sales( $quantity = 1 ) {
865
+	public function decrease_sales($quantity = 1) {
866 866
 
867
-		$sales = give_get_form_sales_stats( $this->ID );
867
+		$sales = give_get_form_sales_stats($this->ID);
868 868
 
869 869
 		// Only decrease if not already zero
870
-		if ( $sales > 0 ) {
870
+		if ($sales > 0) {
871 871
 
872
-			$quantity    = absint( $quantity );
872
+			$quantity    = absint($quantity);
873 873
 			$total_sales = $sales - $quantity;
874 874
 
875
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
875
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
876 876
 
877 877
 				$this->sales = $sales;
878 878
 
@@ -896,15 +896,15 @@  discard block
 block discarded – undo
896 896
 	 */
897 897
 	public function get_earnings() {
898 898
 
899
-		if ( ! isset( $this->earnings ) ) {
899
+		if ( ! isset($this->earnings)) {
900 900
 
901
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
902
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
901
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
902
+				add_post_meta($this->ID, '_give_form_earnings', 0);
903 903
 			}
904 904
 
905
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
905
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
906 906
 
907
-			if ( $this->earnings < 0 ) {
907
+			if ($this->earnings < 0) {
908 908
 				// Never let earnings be less than zero
909 909
 				$this->earnings = 0;
910 910
 			}
@@ -925,12 +925,12 @@  discard block
 block discarded – undo
925 925
 	 *
926 926
 	 * @return float|false
927 927
 	 */
928
-	public function increase_earnings( $amount = 0 ) {
928
+	public function increase_earnings($amount = 0) {
929 929
 
930
-		$earnings   = give_get_form_earnings_stats( $this->ID );
930
+		$earnings   = give_get_form_earnings_stats($this->ID);
931 931
 		$new_amount = $earnings + (float) $amount;
932 932
 
933
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
933
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
934 934
 
935 935
 			$this->earnings = $new_amount;
936 936
 
@@ -952,16 +952,16 @@  discard block
 block discarded – undo
952 952
 	 *
953 953
 	 * @return float|false
954 954
 	 */
955
-	public function decrease_earnings( $amount ) {
955
+	public function decrease_earnings($amount) {
956 956
 
957
-		$earnings = give_get_form_earnings_stats( $this->ID );
957
+		$earnings = give_get_form_earnings_stats($this->ID);
958 958
 
959
-		if ( $earnings > 0 ) {
959
+		if ($earnings > 0) {
960 960
 			// Only decrease if greater than zero
961 961
 			$new_amount = $earnings - (float) $amount;
962 962
 
963 963
 
964
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
964
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
965 965
 
966 966
 				$this->earnings = $new_amount;
967 967
 
@@ -985,22 +985,22 @@  discard block
 block discarded – undo
985 985
 	 *
986 986
 	 * @return bool
987 987
 	 */
988
-	public function is_free( $price_id = false ) {
988
+	public function is_free($price_id = false) {
989 989
 
990 990
 		$is_free          = false;
991
-		$variable_pricing = give_has_variable_prices( $this->ID );
991
+		$variable_pricing = give_has_variable_prices($this->ID);
992 992
 
993
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
994
-			$price = give_get_price_option_amount( $this->ID, $price_id );
995
-		} elseif ( ! $variable_pricing ) {
996
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
993
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
994
+			$price = give_get_price_option_amount($this->ID, $price_id);
995
+		} elseif ( ! $variable_pricing) {
996
+			$price = get_post_meta($this->ID, '_give_set_price', true);
997 997
 		}
998 998
 
999
-		if ( isset( $price ) && (float) $price == 0 ) {
999
+		if (isset($price) && (float) $price == 0) {
1000 1000
 			$is_free = true;
1001 1001
 		}
1002 1002
 
1003
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1003
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1004 1004
 
1005 1005
 	}
1006 1006
 
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 		$is_close_form = apply_filters(
1028 1028
 			'give_is_close_donation_form',
1029 1029
 			(
1030
-			give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) )
1031
-			&& give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1032
-			&& ( $this->get_goal() <= $this->get_earnings()
1030
+			give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) )
1031
+			&& give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1032
+			&& ($this->get_goal() <= $this->get_earnings()
1033 1033
 			),
1034 1034
 			$this->ID
1035 1035
 		);
@@ -1048,29 +1048,29 @@  discard block
 block discarded – undo
1048 1048
 	 *
1049 1049
 	 * @return bool                            The result of the update query.
1050 1050
 	 */
1051
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1051
+	private function update_meta($meta_key = '', $meta_value = '') {
1052 1052
 
1053 1053
 		/* @var WPDB $wpdb */
1054 1054
 		global $wpdb;
1055 1055
 
1056
-		if ( empty( $meta_key ) ) {
1056
+		if (empty($meta_key)) {
1057 1057
 			return false;
1058 1058
 		}
1059 1059
 
1060 1060
 		// Make sure if it needs to be serialized, we do
1061
-		$meta_value = maybe_serialize( $meta_value );
1061
+		$meta_value = maybe_serialize($meta_value);
1062 1062
 
1063
-		if ( is_numeric( $meta_value ) ) {
1064
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1063
+		if (is_numeric($meta_value)) {
1064
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1065 1065
 		} else {
1066 1066
 			$value_type = "'%s'";
1067 1067
 		}
1068 1068
 
1069
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1069
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1070 1070
 
1071
-		if ( $wpdb->query( $sql ) ) {
1071
+		if ($wpdb->query($sql)) {
1072 1072
 
1073
-			clean_post_cache( $this->ID );
1073
+			clean_post_cache($this->ID);
1074 1074
 
1075 1075
 			return true;
1076 1076
 
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +52 added lines, -52 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,15 +23,15 @@  discard block
 block discarded – undo
23 23
  * @global $wpdb
24 24
  * @return void
25 25
  */
26
-function give_install( $network_wide = false ) {
26
+function give_install($network_wide = false) {
27 27
 
28 28
 	global $wpdb;
29 29
 
30
-	if ( is_multisite() && $network_wide ) {
30
+	if (is_multisite() && $network_wide) {
31 31
 
32
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
32
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
33 33
 
34
-			switch_to_blog( $blog_id );
34
+			switch_to_blog($blog_id);
35 35
 			give_run_install();
36 36
 			restore_current_blog();
37 37
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 }
47 47
 
48
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
48
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
49 49
 
50 50
 /**
51 51
  * Run the Give Install process.
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
 	give_setup_post_types();
62 62
 
63 63
 	// Clear the permalinks.
64
-	flush_rewrite_rules( false );
64
+	flush_rewrite_rules(false);
65 65
 
66 66
 	// Add Upgraded From Option.
67
-	$current_version = get_option( 'give_version' );
68
-	if ( $current_version ) {
69
-		update_option( 'give_version_upgraded_from', $current_version );
67
+	$current_version = get_option('give_version');
68
+	if ($current_version) {
69
+		update_option('give_version_upgraded_from', $current_version);
70 70
 	}
71 71
 
72 72
 	// Setup some default options.
73 73
 	$options = array();
74 74
 
75 75
 	// Checks if the Success Page option exists AND that the page exists.
76
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
76
+	if ( ! get_post(give_get_option('success_page'))) {
77 77
 
78 78
 		// Donation Confirmation (Success) Page
79 79
 		$success = wp_insert_post(
80 80
 			array(
81
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
81
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
82 82
 				'post_content'   => '[give_receipt]',
83 83
 				'post_status'    => 'publish',
84 84
 				'post_author'    => 1,
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	// Checks if the Failure Page option exists AND that the page exists.
95
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
95
+	if ( ! get_post(give_get_option('failure_page'))) {
96 96
 
97 97
 		// Failed Donation Page
98 98
 		$failed = wp_insert_post(
99 99
 			array(
100
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
101
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
100
+				'post_title'     => esc_html__('Donation Failed', 'give'),
101
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
102 102
 				'post_status'    => 'publish',
103 103
 				'post_author'    => 1,
104 104
 				'post_type'      => 'page',
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	// Checks if the History Page option exists AND that the page exists.
113
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
113
+	if ( ! get_post(give_get_option('history_page'))) {
114 114
 		// Donation History Page
115 115
 		$history = wp_insert_post(
116 116
 			array(
117
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
117
+				'post_title'     => esc_html__('Donation History', 'give'),
118 118
 				'post_content'   => '[donation_history]',
119 119
 				'post_status'    => 'publish',
120 120
 				'post_author'    => 1,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
130
-	if ( empty( $current_version ) ) {
130
+	if (empty($current_version)) {
131 131
 
132 132
 		// General.
133 133
 		$options['base_country']       = 'US';
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		$options['scripts_footer']       = 'disabled';
156 156
 
157 157
 		// Paypal IPN verification.
158
-		$options['paypal_verification']       = 'enabled';
158
+		$options['paypal_verification'] = 'enabled';
159 159
 
160 160
 		// Default is manual gateway.
161 161
 		$options['gateways']['manual'] = 'on';
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 	}
178 178
 
179 179
 	// Populate the default values.
180
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
181
-	update_option( 'give_version', GIVE_VERSION );
180
+	update_option('give_settings', array_merge($give_options, $options));
181
+	update_option('give_version', GIVE_VERSION);
182 182
 
183 183
 	// Create Give roles.
184 184
 	$roles = new Give_Roles();
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	$roles->add_caps();
187 187
 
188 188
 	$api = new Give_API();
189
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
189
+	update_option('give_default_api_version', 'v'.$api->get_version());
190 190
 
191 191
 	// Create the customers databases.
192 192
 	@Give()->customers->create_table();
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	Give()->session->use_php_sessions();
197 197
 
198 198
 	// Add a temporary option to note that Give pages have been created.
199
-	set_transient( '_give_installed', $options, 30 );
199
+	set_transient('_give_installed', $options, 30);
200 200
 
201
-	if ( ! $current_version ) {
201
+	if ( ! $current_version) {
202 202
 
203
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
203
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
204 204
 
205 205
 		// When new upgrade routines are added, mark them as complete on fresh install.
206 206
 		$upgrade_routines = array(
@@ -209,22 +209,22 @@  discard block
 block discarded – undo
209 209
 			'upgrade_give_offline_status'
210 210
 		);
211 211
 
212
-		foreach ( $upgrade_routines as $upgrade ) {
213
-			give_set_upgrade_complete( $upgrade );
212
+		foreach ($upgrade_routines as $upgrade) {
213
+			give_set_upgrade_complete($upgrade);
214 214
 		}
215 215
 	}
216 216
 
217 217
 	// Bail if activating from network, or bulk.
218
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
218
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
219 219
 		return;
220 220
 	}
221 221
 
222 222
 	// Add the transient to redirect.
223
-	set_transient( '_give_activation_redirect', true, 30 );
223
+	set_transient('_give_activation_redirect', true, 30);
224 224
 
225 225
 }
226 226
 
227
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
227
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
228 228
 
229 229
 /**
230 230
  * Network Activated New Site Setup.
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
  * @param  int    $site_id The Site ID.
241 241
  * @param  array  $meta Blog Meta.
242 242
  */
243
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
243
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
244 244
 
245
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
245
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
246 246
 
247
-		switch_to_blog( $blog_id );
247
+		switch_to_blog($blog_id);
248 248
 		give_install();
249 249
 		restore_current_blog();
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 }
254 254
 
255
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
255
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
256 256
 
257 257
 
258 258
 /**
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
  *
266 266
  * @return array          The tables to drop.
267 267
  */
268
-function give_wpmu_drop_tables( $tables, $blog_id ) {
268
+function give_wpmu_drop_tables($tables, $blog_id) {
269 269
 
270
-	switch_to_blog( $blog_id );
270
+	switch_to_blog($blog_id);
271 271
 	$customers_db     = new Give_DB_Customers();
272 272
 	$customer_meta_db = new Give_DB_Customer_Meta();
273 273
 
274
-	if ( $customers_db->installed() ) {
274
+	if ($customers_db->installed()) {
275 275
 		$tables[] = $customers_db->table_name;
276 276
 		$tables[] = $customer_meta_db->table_name;
277 277
 	}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 }
283 283
 
284
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
284
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
285 285
 
286 286
 /**
287 287
  * Post-installation
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
  */
294 294
 function give_after_install() {
295 295
 
296
-	if ( ! is_admin() ) {
296
+	if ( ! is_admin()) {
297 297
 		return;
298 298
 	}
299 299
 
300
-	$give_options     = get_transient( '_give_installed' );
301
-	$give_table_check = get_option( '_give_table_check', false );
300
+	$give_options     = get_transient('_give_installed');
301
+	$give_table_check = get_option('_give_table_check', false);
302 302
 
303
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
303
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
304 304
 
305
-		if ( ! @Give()->customer_meta->installed() ) {
305
+		if ( ! @Give()->customer_meta->installed()) {
306 306
 
307 307
 			// Create the customer meta database
308 308
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 		}
312 312
 
313
-		if ( ! @Give()->customers->installed() ) {
313
+		if ( ! @Give()->customers->installed()) {
314 314
 			// Create the customers database
315 315
 			// (this ensures it creates it on multisite instances where it is network activated).
316 316
 			@Give()->customers->create_table();
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
 			 *
323 323
 			 * @param array $give_options Give plugin options.
324 324
 			 */
325
-			do_action( 'give_after_install', $give_options );
325
+			do_action('give_after_install', $give_options);
326 326
 		}
327 327
 
328
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
328
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
329 329
 
330 330
 	}
331 331
 
332 332
 	// Delete the transient
333
-	if ( false !== $give_options ) {
334
-		delete_transient( '_give_installed' );
333
+	if (false !== $give_options) {
334
+		delete_transient('_give_installed');
335 335
 	}
336 336
 
337 337
 
338 338
 }
339 339
 
340
-add_action( 'admin_init', 'give_after_install' );
340
+add_action('admin_init', 'give_after_install');
341 341
 
342 342
 
343 343
 /**
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 
353 353
 	global $wp_roles;
354 354
 
355
-	if ( ! is_object( $wp_roles ) ) {
355
+	if ( ! is_object($wp_roles)) {
356 356
 		return;
357 357
 	}
358 358
 
359
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
359
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
360 360
 
361 361
 		// Create Give plugin roles
362 362
 		$roles = new Give_Roles();
@@ -367,4 +367,4 @@  discard block
 block discarded – undo
367 367
 
368 368
 }
369 369
 
370
-add_action( 'admin_init', 'give_install_roles_on_network' );
371 370
\ No newline at end of file
371
+add_action('admin_init', 'give_install_roles_on_network');
372 372
\ No newline at end of file
Please login to merge, or discard this patch.