Test Failed
Push — master ( f49c98...c5285d )
by Devin
01:02
created
includes/admin/tools/import/class-give-import-core-settings.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.17
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Core_Settings' ) ) {
18
+if ( ! class_exists('Give_Import_Core_Settings')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Core_Settings.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		 * @return static
69 69
 		 */
70 70
 		public static function get_instance() {
71
-			if ( null === static::$instance ) {
71
+			if (null === static::$instance) {
72 72
 				self::$instance = new static();
73 73
 			}
74 74
 
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 		 * @return void
96 96
 		 */
97 97
 		private function setup_hooks() {
98
-			if ( ! $this->is_donations_import_page() ) {
98
+			if ( ! $this->is_donations_import_page()) {
99 99
 				return;
100 100
 			}
101 101
 
102 102
 			// Do not render main import tools page.
103
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
103
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
104 104
 
105 105
 			// Render donation import page
106
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
106
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
107 107
 
108 108
 			// Print the HTML.
109
-			add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 );
109
+			add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10);
110 110
 
111 111
 			// Run when form submit.
112
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
112
+			add_action('give-tools_save_import', array($this, 'save'));
113 113
 
114
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
114
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
115 115
 
116 116
 			// Used to add submit button.
117
-			add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 );
117
+			add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10);
118 118
 		}
119 119
 
120 120
 		/**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return mixed
128 128
 		 */
129
-		public function update_notices( $messages ) {
130
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
131
-				unset( $messages['give-setting-updated'] );
129
+		public function update_notices($messages) {
130
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
131
+				unset($messages['give-setting-updated']);
132 132
 			}
133 133
 
134 134
 			return $messages;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 * @since 1.8.17
141 141
 		 */
142 142
 		public function submit() {
143
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
143
+			wp_nonce_field('give-save-settings', '_give-save-settings');
144 144
 			?>
145 145
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
146 146
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				       id="<?php echo "step-{$step}"; ?>">
164 164
 					<tbody>
165 165
 					<?php
166
-					switch ( $this->get_step() ) {
166
+					switch ($this->get_step()) {
167 167
 						case 1:
168 168
 							$this->render_upload_html();
169 169
 							break;
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 		public function import_success() {
191 191
 			// Imported successfully
192 192
 
193
-			$success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false );
194
-			$undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false );
193
+			$success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false);
194
+			$undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false);
195 195
 			$query_arg_setting = array(
196 196
 				'post_type' => 'give_forms',
197 197
 				'page'      => 'give-settings',
198 198
 			);
199 199
 
200
-			if ( $undo ) {
200
+			if ($undo) {
201 201
 				$success = false;
202 202
 			}
203 203
 
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
 				'undo'      => 'true',
211 211
 			);
212 212
 
213
-			$title = __( 'Settings Importing Completed!', 'give' );
214
-			if ( $success ) {
213
+			$title = __('Settings Importing Completed!', 'give');
214
+			if ($success) {
215 215
 				$query_arg_success['undo'] = '1';
216 216
 				$query_arg_success['step'] = '3';
217 217
 				$query_arg_success['success'] = '1';
218
-				$text = __( 'Undo Importing', 'give' );
218
+				$text = __('Undo Importing', 'give');
219 219
 			} else {
220
-				if ( $undo ) {
221
-					$host_give_options = get_option( 'give_settings_old', array() );
222
-					update_option( 'give_settings', $host_give_options );
223
-					$title = __( 'Undo of Setting Imported Completed!', 'give' );
220
+				if ($undo) {
221
+					$host_give_options = get_option('give_settings_old', array());
222
+					update_option('give_settings', $host_give_options);
223
+					$title = __('Undo of Setting Imported Completed!', 'give');
224 224
 				} else {
225
-					$title = __( 'Failed to import', 'give' );
225
+					$title = __('Failed to import', 'give');
226 226
 				}
227 227
 
228
-				$text = __( 'Importing Again', 'give' );
228
+				$text = __('Importing Again', 'give');
229 229
 			}
230 230
 			?>
231 231
 			<tr valign="top" class="give-import-dropdown">
232 232
 				<th colspan="2">
233 233
 					<h2><?php echo $title; ?></h2>
234 234
 					<p>
235
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
236
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a>
235
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
236
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a>
237 237
 					</p>
238 238
 				</th>
239 239
 			</tr>
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 		 * @since 1.8.17
247 247
 		 */
248 248
 		public function start_import() {
249
-			$type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' );
250
-			$file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' );
249
+			$type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace');
250
+			$file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : '');
251 251
 
252 252
 			?>
253 253
 			<tr valign="top" class="give-import-dropdown">
254 254
 				<th colspan="2">
255
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
256
-					<p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p>
255
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
256
+					<p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p>
257 257
 				</th>
258 258
 			</tr>
259 259
 
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 			$step = $this->get_step();
287 287
 			?>
288 288
 			<ol class="give-progress-steps">
289
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
290
-					<?php esc_html_e( 'Upload JSON file', 'give' ); ?>
289
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
290
+					<?php esc_html_e('Upload JSON file', 'give'); ?>
291 291
 				</li>
292
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
293
-					<?php esc_html_e( 'Import', 'give' ); ?>
292
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
293
+					<?php esc_html_e('Import', 'give'); ?>
294 294
 				</li>
295
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
296
-					<?php esc_html_e( 'Done!', 'give' ); ?>
295
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
296
+					<?php esc_html_e('Done!', 'give'); ?>
297 297
 				</li>
298 298
 			</ol>
299 299
 			<?php
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 		 * @return int $step on which step doest the import is on.
308 308
 		 */
309 309
 		public function get_step() {
310
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
310
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
311 311
 			$on_step = 1;
312 312
 
313
-			if ( empty( $step ) || 1 === $step ) {
313
+			if (empty($step) || 1 === $step) {
314 314
 				$on_step = 1;
315
-			} elseif ( 2 === $step ) {
315
+			} elseif (2 === $step) {
316 316
 				$on_step = 2;
317
-			} elseif ( 3 === $step ) {
317
+			} elseif (3 === $step) {
318 318
 				$on_step = 3;
319 319
 			}
320 320
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		 * @since 1.8.17
328 328
 		 */
329 329
 		public function render_page() {
330
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php';
330
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php';
331 331
 		}
332 332
 
333 333
 		/**
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 		 * @return void
340 340
 		 */
341 341
 		public function render_upload_html() {
342
-			$json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' );
343
-			$type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' );
342
+			$json = (isset($_POST['json']) ? give_clean($_POST['json']) : '');
343
+			$type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge');
344 344
 			$step = $this->get_step();
345 345
 
346 346
 			?>
347 347
 			<tr valign="top">
348 348
 				<th colspan="2">
349
-					<h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2>
350
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to merge or replace settings data to your give settings via a JSON file.', 'give' ) ?></p>
349
+					<h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2>
350
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to merge or replace settings data to your give settings via a JSON file.', 'give') ?></p>
351 351
 				</th>
352 352
 			</tr>
353 353
 
@@ -369,20 +369,20 @@  discard block
 block discarded – undo
369 369
 			$settings = array(
370 370
 				array(
371 371
 					'id'          => 'type',
372
-					'name'        => __( 'Merge Type:', 'give' ),
373
-					'description' => __( 'Import the Setting from the JSON and then merge or replace with the current settings', 'give' ),
372
+					'name'        => __('Merge Type:', 'give'),
373
+					'description' => __('Import the Setting from the JSON and then merge or replace with the current settings', 'give'),
374 374
 					'default'     => $type,
375 375
 					'type'        => 'radio_inline',
376 376
 					'options'     => array(
377
-						'merge'   => __( 'Merge', 'give' ),
378
-						'replace' => __( 'Replace', 'give' ),
377
+						'merge'   => __('Merge', 'give'),
378
+						'replace' => __('Replace', 'give'),
379 379
 					),
380 380
 				),
381 381
 			);
382 382
 
383
-			$settings = apply_filters( 'give_import_core_setting_html', $settings );
383
+			$settings = apply_filters('give_import_core_setting_html', $settings);
384 384
 
385
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
385
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
386 386
 			?>
387 387
 			<tr valign="top">
388 388
 				<th></th>
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 					<input type="submit"
391 391
 					       class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
392 392
 					       id="recount-stats-submit"
393
-					       value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
393
+					       value="<?php esc_attr_e('Submit', 'give'); ?>"/>
394 394
 				</th>
395 395
 			</tr>
396 396
 			<?php
@@ -407,20 +407,20 @@  discard block
 block discarded – undo
407 407
 			$step = $this->get_step();
408 408
 
409 409
 			// Validation for first step.
410
-			if ( 1 === $step ) {
411
-				$type          = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' );
410
+			if (1 === $step) {
411
+				$type          = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace');
412 412
 				$core_settings = self::upload_widget_settings_file();
413
-				if ( ! empty( $core_settings['error'] ) ) {
414
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) );
413
+				if ( ! empty($core_settings['error'])) {
414
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give'));
415 415
 				} else {
416
-					$file_path = explode( '/', $core_settings['file'] );
417
-					$count     = ( count( $file_path ) - 1 );
418
-					$url       = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array(
416
+					$file_path = explode('/', $core_settings['file']);
417
+					$count     = (count($file_path) - 1);
418
+					$url       = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array(
419 419
 						'step'          => '2',
420 420
 						'importer-type' => $this->importer_type,
421 421
 						'type'          => $type,
422
-						'file_name'     => $file_path[ $count ],
423
-					) ) );
422
+						'file_name'     => $file_path[$count],
423
+					)));
424 424
 
425 425
 					?>
426 426
 					<script type="text/javascript">
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		 * @return bool
439 439
 		 */
440 440
 		private function is_donations_import_page() {
441
-			return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] );
441
+			return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']);
442 442
 		}
443 443
 
444 444
 		/**
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
 		 */
448 448
 		public static function upload_widget_settings_file() {
449 449
 			$upload = false;
450
-			if ( isset( $_FILES['json'] ) ) {
451
-				add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
450
+			if (isset($_FILES['json'])) {
451
+				add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
452 452
 
453
-				$upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) );
453
+				$upload = wp_handle_upload($_FILES['json'], array('test_form' => false));
454 454
 
455
-				remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
455
+				remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
456 456
 			} else {
457
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
457
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
458 458
 			}
459 459
 
460 460
 			return $upload;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		 *
466 466
 		 * @param array $existing_mimes
467 467
 		 */
468
-		public static function json_upload_mimes( $existing_mimes = array() ) {
468
+		public static function json_upload_mimes($existing_mimes = array()) {
469 469
 			$existing_mimes['json'] = 'application/json';
470 470
 
471 471
 			return $existing_mimes;
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-import.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Import' ) ) {
16
+if ( ! class_exists('Give_Settings_Import')) {
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Import.
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
 		 */
46 46
 		public function __construct() {
47 47
 			$this->id    = 'import';
48
-			$this->label = __( 'Import', 'give' );
48
+			$this->label = __('Import', 'give');
49 49
 
50 50
 			parent::__construct();
51 51
 
52 52
 			// Will display html of the import donation.
53
-			add_action( 'give_admin_field_tools_import', array(
53
+			add_action('give_admin_field_tools_import', array(
54 54
 				'Give_Settings_Import',
55 55
 				'render_import_field',
56
-			), 10, 2 );
56
+			), 10, 2);
57 57
 
58 58
 			// Do not use main form for this tab.
59
-			if ( give_get_current_setting_tab() === $this->id ) {
60
-				add_action( "give-tools_open_form", '__return_empty_string' );
61
-				add_action( "give-tools_close_form", '__return_empty_string' );
59
+			if (give_get_current_setting_tab() === $this->id) {
60
+				add_action("give-tools_open_form", '__return_empty_string');
61
+				add_action("give-tools_close_form", '__return_empty_string');
62 62
 
63
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php';
64
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-core-settings.php';
63
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-donations.php';
64
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-core-settings.php';
65 65
 			}
66 66
 		}
67 67
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			 * @param  array $settings
81 81
 			 */
82 82
 			$settings = apply_filters(
83
-				'give_get_settings_' . $this->id,
83
+				'give_get_settings_'.$this->id,
84 84
 				array(
85 85
 					array(
86 86
 						'id'         => 'give_tools_import',
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 					),
90 90
 					array(
91 91
 						'id'   => 'import',
92
-						'name' => __( 'Import', 'give' ),
92
+						'name' => __('Import', 'give'),
93 93
 						'type' => 'tools_import',
94 94
 					),
95 95
 					array(
96
-						'name'  => esc_html__( 'Import Docs Link', 'give' ),
96
+						'name'  => esc_html__('Import Docs Link', 'give'),
97 97
 						'id'    => 'import_docs_link',
98
-						'url'   => esc_url( 'http://docs.givewp.com/tools-importer' ),
99
-						'title' => __( 'Import Tab', 'give' ),
98
+						'url'   => esc_url('http://docs.givewp.com/tools-importer'),
99
+						'title' => __('Import Tab', 'give'),
100 100
 						'type'  => 'give_docs_link',
101 101
 					),
102 102
 					array(
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 		 * @param $field
121 121
 		 * @param $option_value
122 122
 		 */
123
-		public static function render_import_field( $field, $option_value ) {
124
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
123
+		public static function render_import_field($field, $option_value) {
124
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
125 125
 		}
126 126
 	}
127 127
 }
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-import-donations.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Import Donations
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.8.13
18 18
  */
19
-do_action( 'give_tools_import_donations_main_before' );
19
+do_action('give_tools_import_donations_main_before');
20 20
 ?>
21 21
     <div id="poststuff">
22 22
         <div class="postbox">
23
-            <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Donations', 'give' ); ?></h1>
23
+            <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Donations', 'give'); ?></h1>
24 24
             <div class="inside give-tools-setting-page-import give-import-donations">
25 25
 				<?php
26 26
 				/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 				 *
29 29
 				 * @since 1.8.14
30 30
 				 */
31
-				do_action( 'give_tools_import_donations_form_before_start' );
31
+				do_action('give_tools_import_donations_form_before_start');
32 32
 				?>
33 33
                 <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import">
34 34
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 					 *
39 39
 					 * @since 1.8.14
40 40
 					 */
41
-					do_action( 'give_tools_import_donations_form_start' );
41
+					do_action('give_tools_import_donations_form_start');
42 42
 					?>
43 43
 
44 44
 					<?php
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 					 *
48 48
 					 * @since 1.8.14
49 49
 					 */
50
-					do_action( 'give_tools_import_donations_form_end' );
50
+					do_action('give_tools_import_donations_form_end');
51 51
 					?>
52 52
                 </form>
53 53
 				<?php
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				 *
57 57
 				 * @since 1.8.14
58 58
 				 */
59
-				do_action( 'give_tools_import_donations_form_after_end' );
59
+				do_action('give_tools_import_donations_form_after_end');
60 60
 				?>
61 61
             </div><!-- .inside -->
62 62
         </div><!-- .postbox -->
@@ -67,4 +67,4 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @since 1.8.13
69 69
  */
70
-do_action( 'give_tools_import_donations_main_after' );
70
+do_action('give_tools_import_donations_main_after');
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-exports.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.0
20 20
 				 */
21
-				do_action( 'give_tools_tab_export_content_top' );
21
+				do_action('give_tools_tab_export_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat export-options-table give-table striped">
25 25
 					<thead>
26 26
 						<tr>
27
-							<th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
28
-							<th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th>
27
+							<th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th>
28
+							<th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th>
29 29
 						</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,42 +38,42 @@  discard block
 block discarded – undo
38 38
 						 *
39 39
 						 * @since 1.0
40 40
 						 */
41
-						do_action( 'give_tools_tab_export_table_top' );
41
+						do_action('give_tools_tab_export_table_top');
42 42
 						?>
43 43
 						<tr class="give-export-pdf-sales-earnings">
44 44
 							<td scope="row" class="row-title">
45 45
 								<h3>
46
-									<span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span>
46
+									<span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span>
47 47
 								</h3>
48
-								<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
48
+								<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
49 49
 							</td>
50 50
 							<td>
51
-								<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>">
52
-									<?php esc_html_e( 'Generate PDF', 'give' ); ?>
51
+								<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>">
52
+									<?php esc_html_e('Generate PDF', 'give'); ?>
53 53
 								</a>
54 54
 							</td>
55 55
 						</tr>
56 56
 						<tr class="give-export-sales-earnings">
57 57
 							<td scope="row" class="row-title">
58 58
 								<h3>
59
-									<span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span>
59
+									<span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span>
60 60
 								</h3>
61
-								<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
61
+								<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
62 62
 							</td>
63 63
 							<td>
64 64
 								<form method="post">
65 65
 									<?php
66 66
 									printf(
67 67
 									/* translators: 1: start date dropdown 2: end date dropdown */
68
-										esc_html__( '%1$s to %2$s', 'give' ),
69
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
70
-										Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' )
68
+										esc_html__('%1$s to %2$s', 'give'),
69
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
70
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
71 71
 									);
72 72
 									?>
73 73
 									<input type="hidden" name="give-action"
74 74
 										   value="earnings_export"/>
75 75
 									<input type="submit"
76
-										   value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
76
+										   value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
77 77
 										   class="button-secondary"/>
78 78
 								</form>
79 79
 							</td>
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 						<tr class="give-export-payment-history">
82 82
 							<td scope="row" class="row-title">
83 83
 								<h3>
84
-									<span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span>
84
+									<span><?php esc_html_e('Export Donation History', 'give'); ?></span>
85 85
 								</h3>
86
-								<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
86
+								<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
87 87
 							</td>
88 88
 							<td>
89 89
 								<form id="give-export-payments"
90 90
 									  class="give-export-form" method="post">
91 91
 									<?php
92
-									echo Give()->html->date_field( array(
92
+									echo Give()->html->date_field(array(
93 93
 										'id'          => 'give-payment-export-start',
94 94
 										'name'        => 'start',
95
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
96
-									) );
95
+										'placeholder' => esc_attr__('Start date', 'give'),
96
+									));
97 97
 
98
-									echo Give()->html->date_field( array(
98
+									echo Give()->html->date_field(array(
99 99
 										'id'          => 'give-payment-export-end',
100 100
 										'name'        => 'end',
101
-										'placeholder' => esc_attr__( 'End date', 'give' ),
102
-									) );
101
+										'placeholder' => esc_attr__('End date', 'give'),
102
+									));
103 103
 									?>
104 104
 									<select name="status">
105
-										<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
105
+										<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
106 106
 										<?php
107 107
 										$statuses = give_get_payment_statuses();
108
-										foreach ( $statuses as $status => $label ) {
109
-											echo '<option value="' . $status . '">' . $label . '</option>';
108
+										foreach ($statuses as $status => $label) {
109
+											echo '<option value="'.$status.'">'.$label.'</option>';
110 110
 										}
111 111
 										?>
112 112
 									</select>
113 113
 									<?php
114
-									if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
114
+									if (give_is_setting_enabled(give_get_option('categories'))) {
115 115
 										echo Give()->html->category_dropdown(
116 116
 											'give_forms_categories[]',
117 117
 											0,
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 												'multiple'        => true,
122 122
 												'selected'        => array(),
123 123
 												'show_option_all' => false,
124
-												'placeholder'     => __( 'Choose one or more from categories', 'give' ),
124
+												'placeholder'     => __('Choose one or more from categories', 'give'),
125 125
 											)
126 126
 										);
127 127
 									}
128 128
 
129
-									if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
129
+									if (give_is_setting_enabled(give_get_option('tags'))) {
130 130
 										echo Give()->html->tags_dropdown(
131 131
 											'give_forms_tags[]',
132 132
 											0,
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 												'multiple'        => true,
137 137
 												'selected'        => array(),
138 138
 												'show_option_all' => false,
139
-												'placeholder'     => __( 'Choose one or more from tags', 'give' ),
139
+												'placeholder'     => __('Choose one or more from tags', 'give'),
140 140
 											)
141 141
 										);
142 142
 									}
143 143
 
144
-									wp_nonce_field( 'give_ajax_export', 'give_ajax_export' );
144
+									wp_nonce_field('give_ajax_export', 'give_ajax_export');
145 145
 									?>
146 146
 									<input type="hidden" name="give-export-class"
147 147
 										   value="Give_Batch_Payments_Export"/>
148 148
 									<span>
149 149
 									<input type="submit"
150
-										   value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
150
+										   value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
151 151
 										   class="button-secondary"/>
152 152
 									<span class="spinner"></span>
153 153
 								</span>
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 						<tr class="give-export-donors">
158 158
 							<td scope="row" class="row-title">
159 159
 								<h3>
160
-									<span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span>
160
+									<span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span>
161 161
 								</h3>
162
-								<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
162
+								<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
163 163
 							</td>
164 164
 							<td>
165 165
 								<form method="post" id="give_donor_export"
@@ -167,93 +167,93 @@  discard block
 block discarded – undo
167 167
 
168 168
 									<?php
169 169
 									// Start Date form field for donors
170
-									echo Give()->html->date_field( array(
170
+									echo Give()->html->date_field(array(
171 171
 										'id'          => 'give_donor_export_start_date',
172 172
 										'name'        => 'donor_export_start_date',
173
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
174
-									) );
173
+										'placeholder' => esc_attr__('Start date', 'give'),
174
+									));
175 175
 
176 176
 									// End Date form field for donors
177
-									echo Give()->html->date_field( array(
177
+									echo Give()->html->date_field(array(
178 178
 										'id'          => 'give_donor_export_end_date',
179 179
 										'name'        => 'donor_export_end_date',
180
-										'placeholder' => esc_attr__( 'End date', 'give' ),
181
-									) );
180
+										'placeholder' => esc_attr__('End date', 'give'),
181
+									));
182 182
 
183 183
 									// Donation forms dropdown for donors export
184
-									echo Give()->html->forms_dropdown( array(
184
+									echo Give()->html->forms_dropdown(array(
185 185
 										'name'   => 'forms',
186 186
 										'id'     => 'give_donor_export_form',
187 187
 										'chosen' => true,
188
-									) );
188
+									));
189 189
 									?>
190
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
190
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
191 191
 
192 192
 								<div id="export-donor-options-wrap"
193 193
 								     class="give-clearfix">
194
-									<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
194
+									<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
195 195
 									<ul id="give-export-option-ul">
196 196
 										<li>
197 197
 											<label for="give-export-fullname">
198 198
 												<input type="checkbox" checked
199 199
 												       name="give_export_option[full_name]"
200
-												       id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
200
+												       id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
201 201
 											</label>
202 202
 										</li>
203 203
 										<li>
204 204
 											<label for="give-export-email">
205 205
 												<input type="checkbox" checked
206 206
 												       name="give_export_option[email]"
207
-												       id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
207
+												       id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
208 208
 											</label>
209 209
 										</li>
210 210
 										<li>
211 211
 											<label for="give-export-address">
212 212
 												<input type="checkbox" checked
213 213
 												       name="give_export_option[address]"
214
-												       id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
214
+												       id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
215 215
 											</label>
216 216
 										</li>
217 217
 										<li>
218 218
 											<label for="give-export-userid">
219 219
 												<input type="checkbox" checked
220 220
 												       name="give_export_option[userid]"
221
-												       id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
221
+												       id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
222 222
 											</label>
223 223
 										</li>
224 224
 										<li>
225 225
 											<label for="give-export-donation-form">
226 226
 												<input type="checkbox" checked
227 227
 												       name="give_export_option[donation_form]"
228
-												       id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?>
228
+												       id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?>
229 229
 											</label>
230 230
 										</li>
231 231
 										<li>
232 232
 											<label for="give-export-first-donation-date">
233 233
 												<input type="checkbox" checked
234 234
 												       name="give_export_option[date_first_donated]"
235
-												       id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
235
+												       id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
236 236
 											</label>
237 237
 										</li>
238 238
 										<li>
239 239
 											<label for="give-export-donation-number">
240 240
 												<input type="checkbox" checked
241 241
 												       name="give_export_option[donations]"
242
-												       id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
242
+												       id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
243 243
 											</label>
244 244
 										</li>
245 245
 										<li>
246 246
 											<label for="give-export-donation-sum">
247 247
 												<input type="checkbox" checked
248 248
 												       name="give_export_option[donation_sum]"
249
-												       id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
249
+												       id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
250 250
 											</label>
251 251
 										</li>
252 252
 									</ul>
253 253
 								</div>
254
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
254
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
255 255
 								<input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/>
256
-								<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/>
256
+								<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/>
257 257
 							</form>
258 258
 						</td>
259 259
 					</tr>
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 					<tr class="give-export-core-settings">
262 262
 						<td scope="row" class="row-title">
263 263
 							<h3>
264
-								<span><?php esc_html_e( 'Export Give Settings', 'give' ); ?></span>
264
+								<span><?php esc_html_e('Export Give Settings', 'give'); ?></span>
265 265
 							</h3>
266
-							<p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p>
266
+							<p><?php esc_html_e('Download an export of Give\'s settings and import it in a new WordPress installation.', 'give'); ?></p>
267 267
 						</td>
268 268
 						<td>
269 269
 							<form method="post">
270 270
 								<input type="hidden" name="give-action" value="core_settings_export"/>
271
-								<input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/>
271
+								<input type="submit" value="<?php esc_attr_e('Export JSON', 'give'); ?>" class="button-secondary"/>
272 272
 							</form>
273 273
 						</td>
274 274
 					</tr>
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 					 *
282 282
 					 * @since 1.0
283 283
 					 */
284
-					do_action( 'give_tools_tab_export_table_bottom' );
284
+					do_action('give_tools_tab_export_table_bottom');
285 285
 					?>
286 286
 					</tbody>
287 287
 				</table>
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 				 *
293 293
 				 * @since 1.0
294 294
 				 */
295
-				do_action( 'give_tools_tab_export_content_bottom' );
295
+				do_action('give_tools_tab_export_content_bottom');
296 296
 				?>
297 297
 
298 298
 			</div>
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-data.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,29 +16,29 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.5
18 18
  */
19
-do_action( 'give_tools_recount_stats_before' );
19
+do_action('give_tools_recount_stats_before');
20 20
 ?>
21 21
 	<div id="poststuff">
22 22
 		<div class="postbox">
23 23
 
24
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
24
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
25 25
 
26 26
 			<div class="inside recount-stats-controls">
27
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
27
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
28 28
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
29 29
 
30
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
30
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
31 31
 
32 32
 					<select name="give-export-class" id="recount-stats-type">
33
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
34
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
35
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
36
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
37
-						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
38
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option>
39
-						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option>
40
-						<option data-type="delete-import-donors"   value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option>
41
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
33
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
34
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
35
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
36
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
37
+						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
38
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option>
39
+						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option>
40
+						<option data-type="delete-import-donors"   value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option>
41
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
42 42
 						<?php
43 43
 						/**
44 44
 						 * Fires in the recount stats selectbox.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 						 *
48 48
 						 * @since 1.5
49 49
 						 */
50
-						do_action( 'give_recount_tool_options' );
50
+						do_action('give_recount_tool_options');
51 51
 						?>
52 52
 					</select>
53 53
 
@@ -56,34 +56,34 @@  discard block
 block discarded – undo
56 56
 						$args = array(
57 57
 							'class'       => 'tools-form-dropdown-recount-form-select',
58 58
 							'name'        => 'form_id',
59
-							'number'      => - 1,
59
+							'number'      => -1,
60 60
 							'chosen'      => true,
61
-							'placeholder' => __( 'Select Form', 'give' ),
61
+							'placeholder' => __('Select Form', 'give'),
62 62
 						);
63
-						echo Give()->html->forms_dropdown( $args );
63
+						echo Give()->html->forms_dropdown($args);
64 64
 						?>
65 65
 					</span>
66 66
 
67 67
 					<span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none">
68 68
 						<label for="delete-import-donors">
69 69
 							<?php
70
-							echo Give()->html->checkbox( array(
70
+							echo Give()->html->checkbox(array(
71 71
 								'name'    => 'delete-import-donors'
72
-							) );
73
-							_e( 'Delete imported WordPress users', 'give' );
72
+							));
73
+							_e('Delete imported WordPress users', 'give');
74 74
 							?>
75 75
 						</label>
76 76
 					</span>
77 77
 
78
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
78
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
79 79
 
80 80
 					<br/>
81 81
 
82 82
 					<span class="give-recount-stats-descriptions">
83
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
84
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
85
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
86
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
83
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
84
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
85
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
86
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
87 87
 						<?php
88 88
 						/**
89 89
 						 * Fires in the recount stats description area.
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 						 *
93 93
 						 * @since 1.5
94 94
 						 */
95
-						do_action( 'give_recount_tool_descriptions' );
95
+						do_action('give_recount_tool_descriptions');
96 96
 						?>
97
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
98
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
97
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
98
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
99 99
 					</span>
100 100
 
101 101
 					<span class="spinner"></span>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				 *
110 110
 				 * @since 1.5
111 111
 				 */
112
-				do_action( 'give_tools_recount_forms' );
112
+				do_action('give_tools_recount_forms');
113 113
 				?>
114 114
 			</div><!-- .inside -->
115 115
 		</div><!-- .postbox -->
@@ -120,4 +120,4 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @since 1.5
122 122
  */
123
-do_action( 'give_tools_recount_stats_after' );
123
+do_action('give_tools_recount_stats_after');
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-imports.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Imports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.8.14
20 20
 				 */
21
-				do_action( 'give_tools_tab_import_content_top' );
21
+				do_action('give_tools_tab_import_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat Import-options-table give-table">
25 25
 					<thead>
26 26
 					<tr>
27
-						<th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th>
28
-						<th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th>
27
+						<th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th>
28
+						<th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th>
29 29
 					</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 					 *
39 39
 					 * @since 1.8.14
40 40
 					 */
41
-					do_action( 'give_tools_tab_import_table_top' );
41
+					do_action('give_tools_tab_import_table_top');
42 42
 					?>
43 43
 
44 44
 					<tr class="give-Import-pdf-sales-earnings">
45 45
 						<td scope="row" class="row-title">
46 46
 							<h3>
47
-								<span><?php esc_html_e( 'Import Donations', 'give' ); ?></span>
47
+								<span><?php esc_html_e('Import Donations', 'give'); ?></span>
48 48
 							</h3>
49
-							<p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p>
49
+							<p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p>
50 50
 						</td>
51 51
 						<td>
52
-							<a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>">
53
-								<?php esc_html_e( 'Import CSV', 'give' ); ?>
52
+							<a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>">
53
+								<?php esc_html_e('Import CSV', 'give'); ?>
54 54
 							</a>
55 55
 						</td>
56 56
 					</tr>
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 					<tr class="give-import-core-settings">
59 59
 						<td scope="row" class="row-title">
60 60
 							<h3>
61
-								<span><?php esc_html_e( 'Import Give Settings', 'give' ); ?></span>
61
+								<span><?php esc_html_e('Import Give Settings', 'give'); ?></span>
62 62
 							</h3>
63
-							<p><?php esc_html_e( 'Import Give\'s settings in JSON format.', 'give' ); ?></p>
63
+							<p><?php esc_html_e('Import Give\'s settings in JSON format.', 'give'); ?></p>
64 64
 						</td>
65 65
 						<td>
66
-							<a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_core_setting' ) ); ?>">
67
-								<?php esc_html_e( 'Import JSON', 'give' ); ?>
66
+							<a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_core_setting')); ?>">
67
+								<?php esc_html_e('Import JSON', 'give'); ?>
68 68
 							</a>
69 69
 						</td>
70 70
 					</tr>
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 					 *
79 79
 					 * @since 1.8.14
80 80
 					 */
81
-					do_action( 'give_tools_tab_import_table_bottom' );
81
+					do_action('give_tools_tab_import_table_bottom');
82 82
 					?>
83 83
 					</tbody>
84 84
 				</table>
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 				 *
90 90
 				 * @since 1.8.14
91 91
 				 */
92
-				do_action( 'give_tools_tab_import_content_bottom' );
92
+				do_action('give_tools_tab_import_content_bottom');
93 93
 				?>
94 94
 
95 95
 			</div>
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-import-core-settings.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Import Core Settings
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.8.17
18 18
  */
19
-do_action( 'give_tools_import_core_settings_main_before' );
19
+do_action('give_tools_import_core_settings_main_before');
20 20
 ?>
21 21
 	<div id="poststuff">
22 22
 		<div class="postbox">
23
-			<h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Settings', 'give' ); ?></h1>
23
+			<h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Settings', 'give'); ?></h1>
24 24
 			<div class="inside give-tools-setting-page-import give-import-core-settings">
25 25
 				<?php
26 26
 				/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 				 *
29 29
 				 * @since 1.8.17
30 30
 				 */
31
-				do_action( 'give_tools_import_core_settings_form_before_start' );
31
+				do_action('give_tools_import_core_settings_form_before_start');
32 32
 				?>
33 33
 				<form method="post" id="give-import-core-settings-form"
34 34
 				      class="give-import-form tools-setting-page-import tools-setting-page-import"
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 					 *
41 41
 					 * @since 1.8.17
42 42
 					 */
43
-					do_action( 'give_tools_import_core_settings_form_start' );
43
+					do_action('give_tools_import_core_settings_form_start');
44 44
 					?>
45 45
 
46 46
 					<?php
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 					 *
50 50
 					 * @since 1.8.17
51 51
 					 */
52
-					do_action( 'give_tools_import_core_settings_form_end' );
52
+					do_action('give_tools_import_core_settings_form_end');
53 53
 					?>
54 54
 				</form>
55 55
 				<?php
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				 *
59 59
 				 * @since 1.8.17
60 60
 				 */
61
-				do_action( 'give_tools_import_core_settings_form_after_end' );
61
+				do_action('give_tools_import_core_settings_form_after_end');
62 62
 				?>
63 63
 			</div><!-- .inside -->
64 64
 		</div><!-- .postbox -->
@@ -69,4 +69,4 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @since 1.8.17
71 71
  */
72
-do_action( 'give_tools_import_core_settings_main_after' );
72
+do_action('give_tools_import_core_settings_main_after');
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-system-info.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_System_Info' ) ) :
16
+if ( ! class_exists('Give_Settings_System_Info')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_System_Info.
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'system-info';
37
-			$this->label = esc_html__( 'System Info', 'give' );
37
+			$this->label = esc_html__('System Info', 'give');
38 38
 
39 39
 			parent::__construct();
40 40
 
41 41
 			// Do not use main form for this tab.
42
-			if ( give_get_current_setting_tab() === $this->id ) {
43
-				add_action( "give-tools_open_form", '__return_empty_string' );
44
-				add_action( "give-tools_close_form", '__return_empty_string' );
42
+			if (give_get_current_setting_tab() === $this->id) {
43
+				add_action("give-tools_open_form", '__return_empty_string');
44
+				add_action("give-tools_close_form", '__return_empty_string');
45 45
 			}
46 46
 		}
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 */
54 54
 		public function output() {
55 55
 			$GLOBALS['give_hide_save_button'] = true;
56
-			include_once( 'views/html-admin-page-system-info.php' );
56
+			include_once('views/html-admin-page-system-info.php');
57 57
 		}
58 58
 	}
59 59
 
Please login to merge, or discard this patch.
includes/admin/class-admin-settings.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 
110 110
 			// Show error message if Akismet not configured and Admin try to save 'enabled' option.
111 111
 			if ( isset( $_POST['akismet_spam_protection'] )
112
-			     && give_is_setting_enabled( $_POST['akismet_spam_protection'] )
113
-			     && ! give_check_akismet_key()
112
+				 && give_is_setting_enabled( $_POST['akismet_spam_protection'] )
113
+				 && ! give_check_akismet_key()
114 114
 			) {
115 115
 				self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) );
116 116
 
@@ -792,9 +792,9 @@  discard block
 block discarded – undo
792 792
 						<td class="give-docs-link" colspan="2">
793 793
 							<?php
794 794
 							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
795
-							     . '" target="_blank">'
796
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] )
797
-							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
795
+								 . '" target="_blank">'
796
+								 . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] )
797
+								 . '<span class="dashicons dashicons-editor-help"></span></a></p>';
798 798
 							?>
799 799
 						</td>
800 800
 						</tr><?php
Please login to merge, or discard this patch.
Spacing   +239 added lines, -239 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,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 * @return bool
87 87
 		 */
88 88
 		public static function verify_nonce() {
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90 90
 				return false;
91 91
 			}
92 92
 
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 		public static function save() {
103 103
 			$current_tab = give_get_current_setting_tab();
104 104
 
105
-			if ( ! self::verify_nonce() ) {
106
-				echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>';
105
+			if ( ! self::verify_nonce()) {
106
+				echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>';
107 107
 				die();
108 108
 			}
109 109
 
110 110
 			// Show error message if Akismet not configured and Admin try to save 'enabled' option.
111
-			if ( isset( $_POST['akismet_spam_protection'] )
112
-			     && give_is_setting_enabled( $_POST['akismet_spam_protection'] )
111
+			if (isset($_POST['akismet_spam_protection'])
112
+			     && give_is_setting_enabled($_POST['akismet_spam_protection'])
113 113
 			     && ! give_check_akismet_key()
114 114
 			) {
115
-				self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) );
115
+				self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give'));
116 116
 
117 117
 				return;
118 118
 			}
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @since 1.8
128 128
 			 */
129
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
129
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
130 130
 
131
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
131
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
132 132
 
133 133
 			/**
134 134
 			 * Trigger Action.
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			 *
140 140
 			 * @since 1.8
141 141
 			 */
142
-			do_action( self::$setting_filter_prefix . '_saved' );
142
+			do_action(self::$setting_filter_prefix.'_saved');
143 143
 		}
144 144
 
145 145
 		/**
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		 *
153 153
 		 * @return void
154 154
 		 */
155
-		public static function add_message( $code, $message ) {
156
-			self::$messages[ $code ] = $message;
155
+		public static function add_message($code, $message) {
156
+			self::$messages[$code] = $message;
157 157
 		}
158 158
 
159 159
 		/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 		 *
167 167
 		 * @return void
168 168
 		 */
169
-		public static function add_error( $code, $message ) {
170
-			self::$errors[ $code ] = $message;
169
+		public static function add_error($code, $message) {
170
+			self::$errors[$code] = $message;
171 171
 		}
172 172
 
173 173
 		/**
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 			$notice_html = '';
181 181
 			$classes     = 'give-notice settings-error notice is-dismissible';
182 182
 
183
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
184
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
183
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
184
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
185 185
 
186
-			if ( 0 < count( self::$errors ) ) {
187
-				foreach ( self::$errors as $code => $message ) {
188
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>';
186
+			if (0 < count(self::$errors)) {
187
+				foreach (self::$errors as $code => $message) {
188
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>';
189 189
 				}
190 190
 			}
191 191
 
192
-			if ( 0 < count( self::$messages ) ) {
193
-				foreach ( self::$messages as $code => $message ) {
194
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>';
192
+			if (0 < count(self::$messages)) {
193
+				foreach (self::$messages as $code => $message) {
194
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>';
195 195
 				}
196 196
 			}
197 197
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			self::$setting_filter_prefix = give_get_current_setting_page();
212 212
 
213 213
 			// Bailout: Exit if setting page is not defined.
214
-			if ( empty( self::$setting_filter_prefix ) ) {
214
+			if (empty(self::$setting_filter_prefix)) {
215 215
 				return false;
216 216
 			}
217 217
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			 *
225 225
 			 * @since 1.8
226 226
 			 */
227
-			do_action( self::$setting_filter_prefix . '_start' );
227
+			do_action(self::$setting_filter_prefix.'_start');
228 228
 
229 229
 			$current_tab = give_get_current_setting_tab();
230 230
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 			/* @var object $current_setting_obj */
235 235
 			$current_setting_obj = new StdClass;
236 236
 
237
-			foreach ( $all_setting as $setting ) {
237
+			foreach ($all_setting as $setting) {
238 238
 				if (
239
-					method_exists( $setting, 'get_id' ) &&
239
+					method_exists($setting, 'get_id') &&
240 240
 					$current_tab === $setting->get_id()
241 241
 				) {
242 242
 					$current_setting_obj = $setting;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			}
246 246
 
247 247
 			// Save settings if data has been posted.
248
-			if ( ! empty( $_POST ) ) {
248
+			if ( ! empty($_POST)) {
249 249
 				self::save();
250 250
 			}
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			 *
259 259
 			 * @since 1.8
260 260
 			 */
261
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
261
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
262 262
 
263 263
 			include 'views/html-admin-settings.php';
264 264
 
@@ -276,25 +276,25 @@  discard block
 block discarded – undo
276 276
 		 *
277 277
 		 * @return string|bool
278 278
 		 */
279
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
279
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
280 280
 			// Bailout.
281
-			if ( empty( $option_name ) && empty( $field_id ) ) {
281
+			if (empty($option_name) && empty($field_id)) {
282 282
 				return false;
283 283
 			}
284 284
 
285
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
285
+			if ( ! empty($field_id) && ! empty($option_name)) {
286 286
 				// Get field value if any.
287
-				$option_value = get_option( $option_name );
287
+				$option_value = get_option($option_name);
288 288
 
289
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
290
-					? $option_value[ $field_id ]
289
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
290
+					? $option_value[$field_id]
291 291
 					: $default;
292 292
 			} else {
293 293
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
294 294
 				$option_name = ! $option_name ? $field_id : $option_name;
295 295
 
296 296
 				// Get option value if any.
297
-				$option_value = get_option( $option_name, $default );
297
+				$option_value = get_option($option_name, $default);
298 298
 			}
299 299
 
300 300
 			return $option_value;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		 *
314 314
 		 * @return void
315 315
 		 */
316
-		public static function output_fields( $options, $option_name = '' ) {
316
+		public static function output_fields($options, $option_name = '') {
317 317
 			$current_tab = give_get_current_setting_tab();
318 318
 
319 319
 			// Field Default values.
@@ -325,61 +325,61 @@  discard block
 block discarded – undo
325 325
 				'desc'             => '',
326 326
 				'table_html'       => true,
327 327
 				'repeat'           => false,
328
-				'repeat_btn_title' => __( 'Add Field', 'give' ),
328
+				'repeat_btn_title' => __('Add Field', 'give'),
329 329
 			);
330 330
 
331
-			foreach ( $options as $value ) {
332
-				if ( ! isset( $value['type'] ) ) {
331
+			foreach ($options as $value) {
332
+				if ( ! isset($value['type'])) {
333 333
 					continue;
334 334
 				}
335 335
 
336 336
 				// Set title.
337
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
337
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
338 338
 
339 339
 				// Set default setting.
340
-				$value = wp_parse_args( $value, $defaults );
340
+				$value = wp_parse_args($value, $defaults);
341 341
 
342 342
 				// Colorpicker field.
343
-				$value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] );
344
-				$value['type']  = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] );
343
+				$value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']);
344
+				$value['type']  = ('colorpicker' === $value['type'] ? 'text' : $value['type']);
345 345
 
346 346
 
347 347
 				// Custom attribute handling.
348 348
 				$custom_attributes = array();
349 349
 
350
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
351
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
352
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
350
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
351
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
352
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
353 353
 					}
354 354
 				}
355 355
 
356 356
 				// Description handling.
357
-				$description          = self::get_field_description( $value );
357
+				$description = self::get_field_description($value);
358 358
 
359 359
 				// Switch based on type.
360
-				switch ( $value['type'] ) {
360
+				switch ($value['type']) {
361 361
 
362 362
 					// Section Titles
363 363
 					case 'title':
364
-						if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) {
364
+						if ( ! empty($value['title']) || ! empty($value['desc'])) {
365 365
 							?>
366 366
 							<div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>">
367
-								<?php if ( ! empty( $value['title'] ) ) : ?>
368
-									<h2><?php echo self::get_field_title( $value ); ?></h2><hr>
367
+								<?php if ( ! empty($value['title'])) : ?>
368
+									<h2><?php echo self::get_field_title($value); ?></h2><hr>
369 369
 								<?php endif; ?>
370 370
 
371
-								<?php if ( ! empty( $value['desc'] ) ) : ?>
372
-									<?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?>
371
+								<?php if ( ! empty($value['desc'])) : ?>
372
+									<?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?>
373 373
 								<?php endif; ?>
374 374
 							</div>
375 375
 							<?php
376 376
 						}
377 377
 
378
-						if ( $value['table_html'] ) {
379
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
378
+						if ($value['table_html']) {
379
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
380 380
 						}
381 381
 
382
-						if ( ! empty( $value['id'] ) ) {
382
+						if ( ! empty($value['id'])) {
383 383
 
384 384
 							/**
385 385
 							 * Trigger Action.
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 							 *
389 389
 							 * @since 1.8
390 390
 							 */
391
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
391
+							do_action('give_settings_'.sanitize_title($value['id']));
392 392
 						}
393 393
 
394 394
 						break;
395 395
 
396 396
 					// Section Ends.
397 397
 					case 'sectionend':
398
-						if ( ! empty( $value['id'] ) ) {
398
+						if ( ! empty($value['id'])) {
399 399
 
400 400
 							/**
401 401
 							 * Trigger Action.
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 							 *
405 405
 							 * @since 1.8
406 406
 							 */
407
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
407
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
408 408
 						}
409 409
 
410
-						if ( $value['table_html'] ) {
410
+						if ($value['table_html']) {
411 411
 							echo '</table>';
412 412
 						}
413 413
 
414
-						if ( ! empty( $value['id'] ) ) {
414
+						if ( ! empty($value['id'])) {
415 415
 
416 416
 							/**
417 417
 							 * Trigger Action.
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 							 *
421 421
 							 * @since 1.8
422 422
 							 */
423
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
423
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
424 424
 						}
425 425
 
426 426
 						break;
@@ -428,48 +428,48 @@  discard block
 block discarded – undo
428 428
 					// Standard text inputs and subtypes like 'number'.
429 429
 					case 'colorpicker':
430 430
 					case 'hidden' :
431
-						$value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden';
431
+						$value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden';
432 432
 					case 'text':
433 433
 					case 'email':
434 434
 					case 'number':
435 435
 					case 'password' :
436 436
 						$type = $value['type'];
437
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
437
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
438 438
 
439 439
 						// Set default value for repeater field if not any value set yet.
440
-						if( $value['repeat'] && is_string( $option_value ) ) {
441
-							$option_value = array( $value['default'] );
440
+						if ($value['repeat'] && is_string($option_value)) {
441
+							$option_value = array($value['default']);
442 442
 						}
443 443
 						?>
444
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
444
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
445 445
 							<th scope="row" class="titledesc">
446
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
446
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
447 447
 							</th>
448
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
449
-								<?php if ( $value['repeat'] ) : ?>
450
-									<?php foreach ( $option_value as $index => $field_value ) : ?>
448
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
449
+								<?php if ($value['repeat']) : ?>
450
+									<?php foreach ($option_value as $index => $field_value) : ?>
451 451
 										<p>
452 452
 											<input
453
-													name="<?php echo esc_attr( $value['id'] ); ?>[]"
454
-													type="<?php echo esc_attr( $type ); ?>"
455
-													style="<?php echo esc_attr( $value['css'] ); ?>"
456
-													value="<?php echo esc_attr( $field_value ); ?>"
457
-													class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>"
458
-												<?php echo implode( ' ', $custom_attributes ); ?>
453
+													name="<?php echo esc_attr($value['id']); ?>[]"
454
+													type="<?php echo esc_attr($type); ?>"
455
+													style="<?php echo esc_attr($value['css']); ?>"
456
+													value="<?php echo esc_attr($field_value); ?>"
457
+													class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>"
458
+												<?php echo implode(' ', $custom_attributes); ?>
459 459
 											/>
460
-											<span class="give-remove-setting-field" title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span>
460
+											<span class="give-remove-setting-field" title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span>
461 461
 										</p>
462 462
 									<?php endforeach; ?>
463 463
 									<a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a>
464 464
 								<?php else : ?>
465 465
 									<input
466
-											name="<?php echo esc_attr( $value['id'] ); ?>"
467
-											id="<?php echo esc_attr( $value['id'] ); ?>"
468
-											type="<?php echo esc_attr( $type ); ?>"
469
-											style="<?php echo esc_attr( $value['css'] ); ?>"
470
-											value="<?php echo esc_attr( $option_value ); ?>"
471
-											class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
472
-										<?php echo implode( ' ', $custom_attributes ); ?>
466
+											name="<?php echo esc_attr($value['id']); ?>"
467
+											id="<?php echo esc_attr($value['id']); ?>"
468
+											type="<?php echo esc_attr($type); ?>"
469
+											style="<?php echo esc_attr($value['css']); ?>"
470
+											value="<?php echo esc_attr($option_value); ?>"
471
+											class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
472
+										<?php echo implode(' ', $custom_attributes); ?>
473 473
 									/>
474 474
 								<?php endif; ?>
475 475
 								<?php echo $description; ?>
@@ -480,23 +480,23 @@  discard block
 block discarded – undo
480 480
 					// Textarea.
481 481
 					case 'textarea':
482 482
 
483
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
483
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
484 484
 
485 485
 						?>
486
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
486
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
487 487
 						<th scope="row" class="titledesc">
488
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
488
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
489 489
 						</th>
490
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
490
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
491 491
 								<textarea
492
-										name="<?php echo esc_attr( $value['id'] ); ?>"
493
-										id="<?php echo esc_attr( $value['id'] ); ?>"
494
-										style="<?php echo esc_attr( $value['css'] ); ?>"
495
-										class="<?php echo esc_attr( $value['class'] ); ?>"
492
+										name="<?php echo esc_attr($value['id']); ?>"
493
+										id="<?php echo esc_attr($value['id']); ?>"
494
+										style="<?php echo esc_attr($value['css']); ?>"
495
+										class="<?php echo esc_attr($value['class']); ?>"
496 496
 										rows="10"
497 497
 										cols="60"
498
-									<?php echo implode( ' ', $custom_attributes ); ?>
499
-								><?php echo esc_textarea( $option_value ); ?></textarea>
498
+									<?php echo implode(' ', $custom_attributes); ?>
499
+								><?php echo esc_textarea($option_value); ?></textarea>
500 500
 							<?php echo $description; ?>
501 501
 						</td>
502 502
 						</tr><?php
@@ -506,35 +506,35 @@  discard block
 block discarded – undo
506 506
 					case 'select' :
507 507
 					case 'multiselect' :
508 508
 
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
 						?>
512
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
512
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
513 513
 						<th scope="row" class="titledesc">
514
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
514
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
515 515
 						</th>
516
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
516
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
517 517
 							<select
518
-									name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) {
518
+									name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') {
519 519
 										echo '[]';
520 520
 									} ?>"
521
-									id="<?php echo esc_attr( $value['id'] ); ?>"
522
-									style="<?php echo esc_attr( $value['css'] ); ?>"
523
-									class="<?php echo esc_attr( $value['class'] ); ?>"
524
-								<?php echo implode( ' ', $custom_attributes ); ?>
525
-								<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
521
+									id="<?php echo esc_attr($value['id']); ?>"
522
+									style="<?php echo esc_attr($value['css']); ?>"
523
+									class="<?php echo esc_attr($value['class']); ?>"
524
+								<?php echo implode(' ', $custom_attributes); ?>
525
+								<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
526 526
 							>
527 527
 
528 528
 								<?php
529
-								if ( ! empty( $value['options'] ) ) {
530
-									foreach ( $value['options'] as $key => $val ) {
529
+								if ( ! empty($value['options'])) {
530
+									foreach ($value['options'] as $key => $val) {
531 531
 										?>
532
-										<option value="<?php echo esc_attr( $key ); ?>" <?php
532
+										<option value="<?php echo esc_attr($key); ?>" <?php
533 533
 
534
-										if ( is_array( $option_value ) ) {
535
-											selected( in_array( $key, $option_value ), true );
534
+										if (is_array($option_value)) {
535
+											selected(in_array($key, $option_value), true);
536 536
 										} else {
537
-											selected( $option_value, $key );
537
+											selected($option_value, $key);
538 538
 										}
539 539
 
540 540
 										?>><?php echo $val ?></option>
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 
551 551
 					// Radio inputs.
552 552
 					case 'radio_inline' :
553
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
553
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
554 554
 					case 'radio' :
555
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
555
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
556 556
 						?>
557
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
557
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
558 558
 						<th scope="row" class="titledesc">
559
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
559
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
560 560
 						</th>
561
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
561
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
562 562
 							<fieldset>
563 563
 								<ul>
564 564
 									<?php
565
-									foreach ( $value['options'] as $key => $val ) {
565
+									foreach ($value['options'] as $key => $val) {
566 566
 										?>
567 567
 										<li>
568 568
 											<label><input
569
-														name="<?php echo esc_attr( $value['id'] ); ?>"
569
+														name="<?php echo esc_attr($value['id']); ?>"
570 570
 														value="<?php echo $key; ?>"
571 571
 														type="radio"
572
-														style="<?php echo esc_attr( $value['css'] ); ?>"
573
-													<?php echo implode( ' ', $custom_attributes ); ?>
574
-													<?php checked( $key, $option_value ); ?>
572
+														style="<?php echo esc_attr($value['css']); ?>"
573
+													<?php echo implode(' ', $custom_attributes); ?>
574
+													<?php checked($key, $option_value); ?>
575 575
 												/> <?php echo $val ?></label>
576 576
 										</li>
577 577
 										<?php
@@ -585,21 +585,21 @@  discard block
 block discarded – undo
585 585
 
586 586
 					// Checkbox input.
587 587
 					case 'checkbox' :
588
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
588
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
589 589
 						?>
590
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
590
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
591 591
 							<th scope="row" class="titledesc">
592
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
592
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
593 593
 							</th>
594 594
 							<td class="give-forminp">
595 595
 								<input
596
-										name="<?php echo esc_attr( $value['id'] ); ?>"
597
-										id="<?php echo esc_attr( $value['id'] ); ?>"
596
+										name="<?php echo esc_attr($value['id']); ?>"
597
+										id="<?php echo esc_attr($value['id']); ?>"
598 598
 										type="checkbox"
599
-										class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
599
+										class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
600 600
 										value="1"
601
-									<?php checked( $option_value, 'on' ); ?>
602
-									<?php echo implode( ' ', $custom_attributes ); ?>
601
+									<?php checked($option_value, 'on'); ?>
602
+									<?php echo implode(' ', $custom_attributes); ?>
603 603
 								/>
604 604
 								<?php echo $description; ?>
605 605
 							</td>
@@ -609,28 +609,28 @@  discard block
 block discarded – undo
609 609
 
610 610
 					// Multi Checkbox input.
611 611
 					case 'multicheck' :
612
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
613
-						$option_value = is_array( $option_value ) ? $option_value : array();
612
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
613
+						$option_value = is_array($option_value) ? $option_value : array();
614 614
 						?>
615
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
615
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
616 616
 							<th scope="row" class="titledesc">
617
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
617
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
618 618
 							</th>
619
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
619
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
620 620
 								<fieldset>
621 621
 									<ul>
622 622
 										<?php
623
-										foreach ( $value['options'] as $key => $val ) {
623
+										foreach ($value['options'] as $key => $val) {
624 624
 											?>
625 625
 											<li>
626 626
 												<label>
627 627
 													<input
628
-															name="<?php echo esc_attr( $value['id'] ); ?>[]"
628
+															name="<?php echo esc_attr($value['id']); ?>[]"
629 629
 															value="<?php echo $key; ?>"
630 630
 															type="checkbox"
631
-															style="<?php echo esc_attr( $value['css'] ); ?>"
632
-														<?php echo implode( ' ', $custom_attributes ); ?>
633
-														<?php if ( in_array( $key, $option_value ) ) {
631
+															style="<?php echo esc_attr($value['css']); ?>"
632
+														<?php echo implode(' ', $custom_attributes); ?>
633
+														<?php if (in_array($key, $option_value)) {
634 634
 															echo 'checked="checked"';
635 635
 														} ?>
636 636
 													/> <?php echo $val ?>
@@ -649,30 +649,30 @@  discard block
 block discarded – undo
649 649
 					// File input field.
650 650
 					case 'file' :
651 651
 					case 'media' :
652
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
653
-						$button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' );
654
-						$fvalue       = empty( $value['fvalue'] ) ? 'url' : $value['fvalue'];
655
-
656
-						$allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' );
657
-						$preview_image_src        = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '';
658
-						$preview_image_extension  = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : '';
659
-						$is_show_preview          = in_array( $preview_image_extension, $allow_media_preview_tags );
652
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
653
+						$button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give');
654
+						$fvalue       = empty($value['fvalue']) ? 'url' : $value['fvalue'];
655
+
656
+						$allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico');
657
+						$preview_image_src        = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '';
658
+						$preview_image_extension  = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : '';
659
+						$is_show_preview          = in_array($preview_image_extension, $allow_media_preview_tags);
660 660
 						?>
661
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
661
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
662 662
 							<th scope="row" class="titledesc">
663
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
663
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
664 664
 							</th>
665 665
 							<td class="give-forminp">
666 666
 								<div class="give-field-wrap">
667 667
 									<label for="<?php echo $value['id'] ?>">
668 668
 										<input
669
-												name="<?php echo esc_attr( $value['id'] ); ?>"
670
-												id="<?php echo esc_attr( $value['id'] ); ?>"
669
+												name="<?php echo esc_attr($value['id']); ?>"
670
+												id="<?php echo esc_attr($value['id']); ?>"
671 671
 												type="text"
672
-												class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
672
+												class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
673 673
 												value="<?php echo $option_value; ?>"
674
-												style="<?php echo esc_attr( $value['css'] ); ?>"
675
-											<?php echo implode( ' ', $custom_attributes ); ?>
674
+												style="<?php echo esc_attr($value['css']); ?>"
675
+											<?php echo implode(' ', $custom_attributes); ?>
676 676
 										/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>">
677 677
 										<?php echo $description ?>
678 678
 										<div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>">
@@ -689,17 +689,17 @@  discard block
 block discarded – undo
689 689
 					// WordPress Editor.
690 690
 					case 'wysiwyg' :
691 691
 						// Get option value.
692
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
692
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
693 693
 
694 694
 						// Get editor settings.
695
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
695
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
696 696
 						?>
697
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
697
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
698 698
 						<th scope="row" class="titledesc">
699
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
699
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
700 700
 						</th>
701 701
 						<td class="give-forminp">
702
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
702
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
703 703
 							<?php echo $description; ?>
704 704
 						</td>
705 705
 						</tr><?php
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 					// Custom: System setting field.
709 709
 					case 'system_info' :
710 710
 						?>
711
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
711
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
712 712
 						<th scope="row" class="titledesc">
713
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
713
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
714 714
 						</th>
715 715
 						<td class="give-forminp">
716 716
 							<?php give_system_info_callback(); ?>
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
 
722 722
 					// Custom: Default gateways setting field.
723 723
 					case 'default_gateway' :
724
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
724
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
725 725
 						?>
726
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
726
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
727 727
 						<th scope="row" class="titledesc">
728
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
728
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
729 729
 						</th>
730 730
 						<td class="give-forminp">
731
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
731
+							<?php give_default_gateway_callback($value, $option_value); ?>
732 732
 							<?php echo $description; ?>
733 733
 						</td>
734 734
 						</tr><?php
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 
737 737
 					// Custom: Enable gateways setting field.
738 738
 					case 'enabled_gateways' :
739
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
739
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
740 740
 						?>
741
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
741
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
742 742
 						<th scope="row" class="titledesc">
743
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
743
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
744 744
 						</th>
745 745
 						<td class="give-forminp">
746
-							<?php give_enabled_gateways_callback( $value, $option_value ); ?>
746
+							<?php give_enabled_gateways_callback($value, $option_value); ?>
747 747
 							<?php echo $description; ?>
748 748
 						</td>
749 749
 						</tr><?php
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 					// Custom: Email preview buttons field.
753 753
 					case 'email_preview_buttons' :
754 754
 						?>
755
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
755
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
756 756
 						<th scope="row" class="titledesc">
757
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
757
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
758 758
 						</th>
759 759
 						<td class="give-forminp">
760
-							<?php give_email_preview_buttons_callback( $value ); ?>
760
+							<?php give_email_preview_buttons_callback($value); ?>
761 761
 							<?php echo $description; ?>
762 762
 						</td>
763 763
 						</tr><?php
@@ -771,22 +771,22 @@  discard block
 block discarded – undo
771 771
 
772 772
 					// Custom: Gateway API key.
773 773
 					case 'api_key' :
774
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
775
-						$type         = ! empty( $option_value ) ? 'password' : 'text';
774
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
775
+						$type         = ! empty($option_value) ? 'password' : 'text';
776 776
 						?>
777
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
777
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
778 778
 						<th scope="row" class="titledesc">
779
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
779
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
780 780
 						</th>
781
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
781
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
782 782
 							<input
783
-									name="<?php echo esc_attr( $value['id'] ); ?>"
784
-									id="<?php echo esc_attr( $value['id'] ); ?>"
785
-									type="<?php echo esc_attr( $type ); ?>"
786
-									style="<?php echo esc_attr( $value['css'] ); ?>"
787
-									value="<?php echo esc_attr( trim( $option_value ) ); ?>"
788
-									class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
789
-								<?php echo implode( ' ', $custom_attributes ); ?>
783
+									name="<?php echo esc_attr($value['id']); ?>"
784
+									id="<?php echo esc_attr($value['id']); ?>"
785
+									type="<?php echo esc_attr($type); ?>"
786
+									style="<?php echo esc_attr($value['css']); ?>"
787
+									value="<?php echo esc_attr(trim($option_value)); ?>"
788
+									class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
789
+								<?php echo implode(' ', $custom_attributes); ?>
790 790
 							/> <?php echo $description; ?>
791 791
 						</td>
792 792
 						</tr><?php
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 						 *
804 804
 						 * @since 1.0
805 805
 						 */
806
-						do_action( "give_logs_view_{$current_section}" );
806
+						do_action("give_logs_view_{$current_section}");
807 807
 
808 808
 						echo $description;
809 809
 						break;
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					// Custom: Data field.
812 812
 					case 'data' :
813 813
 
814
-						include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php';
814
+						include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php';
815 815
 
816 816
 						echo $description;
817 817
 						break;
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
 					// Custom: Give Docs Link field type.
820 820
 					case 'give_docs_link' :
821 821
 						?>
822
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
822
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
823 823
 						<td class="give-docs-link" colspan="2">
824 824
 							<?php
825
-							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
825
+							echo '<p class="give-docs-link"><a href="'.esc_url($value['url'])
826 826
 							     . '" target="_blank">'
827
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] )
827
+							     . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title'])
828 828
 							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
829 829
 							?>
830 830
 						</td>
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 					// You can add or handle your custom field action.
836 836
 					default:
837 837
 						// Get option value.
838
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
839
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
838
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
839
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
840 840
 						break;
841 841
 				}
842 842
 			}
@@ -852,15 +852,15 @@  discard block
 block discarded – undo
852 852
 		 *
853 853
 		 * @return string The HTML description of the field.
854 854
 		 */
855
-		public static function get_field_description( $value ) {
855
+		public static function get_field_description($value) {
856 856
 			$description = '';
857 857
 
858 858
 			// Support for both 'description' and 'desc' args.
859
-			$description_key = isset( $value['description'] ) ? 'description' : 'desc';
860
-			$value           = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : '';
859
+			$description_key = isset($value['description']) ? 'description' : 'desc';
860
+			$value           = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : '';
861 861
 
862
-			if ( ! empty( $value ) ) {
863
-				$description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>';
862
+			if ( ! empty($value)) {
863
+				$description = '<p class="give-field-description">'.wp_kses_post($value).'</p>';
864 864
 			}
865 865
 
866 866
 			return $description;
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
 		 *
878 878
 		 * @return array The description and tip as a 2 element array
879 879
 		 */
880
-		public static function get_field_title( $value ) {
881
-			$title = esc_html( $value['title'] );
880
+		public static function get_field_title($value) {
881
+			$title = esc_html($value['title']);
882 882
 
883 883
 			// If html tag detected then allow them to print.
884
-			if ( strip_tags( $title ) ) {
884
+			if (strip_tags($title)) {
885 885
 				$title = $value['title'];
886 886
 			}
887 887
 
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 		 *
901 901
 		 * @return bool
902 902
 		 */
903
-		public static function save_fields( $options, $option_name = '' ) {
904
-			if ( empty( $_POST ) ) {
903
+		public static function save_fields($options, $option_name = '') {
904
+			if (empty($_POST)) {
905 905
 				return false;
906 906
 			}
907 907
 
@@ -909,37 +909,37 @@  discard block
 block discarded – undo
909 909
 			$update_options = array();
910 910
 
911 911
 			// Loop options and get values to save.
912
-			foreach ( $options as $option ) {
913
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
912
+			foreach ($options as $option) {
913
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
914 914
 					continue;
915 915
 				}
916 916
 
917 917
 				// Get posted value.
918
-				if ( strstr( $option['id'], '[' ) ) {
919
-					parse_str( $option['id'], $option_name_array );
920
-					$field_option_name = current( array_keys( $option_name_array ) );
921
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
922
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
918
+				if (strstr($option['id'], '[')) {
919
+					parse_str($option['id'], $option_name_array);
920
+					$field_option_name = current(array_keys($option_name_array));
921
+					$setting_name      = key($option_name_array[$field_option_name]);
922
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
923 923
 				} else {
924 924
 					$field_option_name = $option['id'];
925 925
 					$setting_name      = '';
926
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
926
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
927 927
 				}
928 928
 
929 929
 				// Format the value based on option type.
930
-				switch ( $option['type'] ) {
930
+				switch ($option['type']) {
931 931
 					case 'checkbox' :
932
-						$value = is_null( $raw_value ) ? '' : 'on';
932
+						$value = is_null($raw_value) ? '' : 'on';
933 933
 						break;
934 934
 					case 'wysiwyg'  :
935 935
 					case 'textarea' :
936
-						$value = wp_kses_post( trim( $raw_value ) );
936
+						$value = wp_kses_post(trim($raw_value));
937 937
 						break;
938 938
 					case 'multiselect' :
939
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
939
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
940 940
 						break;
941 941
 					default :
942
-						$value = give_clean( $raw_value );
942
+						$value = give_clean($raw_value);
943 943
 						break;
944 944
 				}
945 945
 
@@ -948,37 +948,37 @@  discard block
 block discarded – undo
948 948
 				 *
949 949
 				 * @since 1.8
950 950
 				 */
951
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
951
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
952 952
 
953 953
 				/**
954 954
 				 * Sanitize the value of an option by option name.
955 955
 				 *
956 956
 				 * @since 1.8
957 957
 				 */
958
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
958
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
959 959
 
960
-				if ( is_null( $value ) ) {
960
+				if (is_null($value)) {
961 961
 					continue;
962 962
 				}
963 963
 
964 964
 				// Check if option is an array and handle that differently to single values.
965
-				if ( $field_option_name && $setting_name ) {
966
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
967
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
965
+				if ($field_option_name && $setting_name) {
966
+					if ( ! isset($update_options[$field_option_name])) {
967
+						$update_options[$field_option_name] = get_option($field_option_name, array());
968 968
 					}
969
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
970
-						$update_options[ $field_option_name ] = array();
969
+					if ( ! is_array($update_options[$field_option_name])) {
970
+						$update_options[$field_option_name] = array();
971 971
 					}
972
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
972
+					$update_options[$field_option_name][$setting_name] = $value;
973 973
 				} else {
974
-					$update_options[ $field_option_name ] = $value;
974
+					$update_options[$field_option_name] = $value;
975 975
 				}
976 976
 			}
977 977
 
978 978
 			// Save all options in our array or there own option name i.e. option id.
979
-			if ( empty( $option_name ) ) {
980
-				foreach ( $update_options as $name => $value ) {
981
-					update_option( $name, $value );
979
+			if (empty($option_name)) {
980
+				foreach ($update_options as $name => $value) {
981
+					update_option($name, $value);
982 982
 
983 983
 					/**
984 984
 					 * Trigger action.
@@ -987,13 +987,13 @@  discard block
 block discarded – undo
987 987
 					 *
988 988
 					 * @since 1.8
989 989
 					 */
990
-					do_action( "give_save_option_{$name}", $value, $name );
990
+					do_action("give_save_option_{$name}", $value, $name);
991 991
 				}
992 992
 			} else {
993
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
994
-				$update_options = array_merge( $old_options, $update_options );
993
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
994
+				$update_options = array_merge($old_options, $update_options);
995 995
 
996
-				update_option( $option_name, $update_options );
996
+				update_option($option_name, $update_options);
997 997
 
998 998
 				/**
999 999
 				 * Trigger action.
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 				 *
1003 1003
 				 * @since 1.8
1004 1004
 				 */
1005
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name );
1005
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name);
1006 1006
 			}
1007 1007
 
1008 1008
 			return true;
@@ -1031,17 +1031,17 @@  discard block
 block discarded – undo
1031 1031
 		 *
1032 1032
 		 * @return bool
1033 1033
 		 */
1034
-		public static function is_setting_page( $tab = '', $section = '' ) {
1034
+		public static function is_setting_page($tab = '', $section = '') {
1035 1035
 			$is_setting_page = false;
1036 1036
 
1037 1037
 			// Check fo setting tab.
1038
-			if ( ! empty( $tab ) ) {
1039
-				$is_setting_page = ( $tab === give_get_current_setting_tab() );
1038
+			if ( ! empty($tab)) {
1039
+				$is_setting_page = ($tab === give_get_current_setting_tab());
1040 1040
 			}
1041 1041
 
1042 1042
 			// Check fo setting section.
1043
-			if ( ! empty( $section ) ) {
1044
-				$is_setting_page = ( $section === give_get_current_setting_section() );
1043
+			if ( ! empty($section)) {
1044
+				$is_setting_page = ($section === give_get_current_setting_section());
1045 1045
 			}
1046 1046
 
1047 1047
 			return $is_setting_page;
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -461,9 +461,12 @@
 block discarded – undo
461 461
 										</p>
462 462
 									<?php endforeach; ?>
463 463
 									<a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a>
464
-								<?php else : ?>
464
+								<?php else {
465
+	: ?>
465 466
 									<input
466
-											name="<?php echo esc_attr( $value['id'] ); ?>"
467
+											name="<?php echo esc_attr( $value['id'] );
468
+}
469
+?>"
467 470
 											id="<?php echo esc_attr( $value['id'] ); ?>"
468 471
 											type="<?php echo esc_attr( $type ); ?>"
469 472
 											style="<?php echo esc_attr( $value['css'] ); ?>"
Please login to merge, or discard this patch.