Test Failed
Pull Request — master (#2482)
by Devin
05:37
created
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 	 * @return void
40 40
 	 */
41 41
 	public function headers() {
42
-		ignore_user_abort( true );
42
+		ignore_user_abort(true);
43 43
 
44
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
45
-			set_time_limit( 0 );
44
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
45
+			set_time_limit(0);
46 46
 		}
47 47
 
48 48
 		nocache_headers();
49
-		header( 'Content-Type: application/json; charset=utf-8' );
50
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
51
-		header( 'Expires: 0' );
49
+		header('Content-Type: application/json; charset=utf-8');
50
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
51
+		header('Expires: 0');
52 52
 	}
53 53
 
54 54
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @since 1.8.17
59 59
 	 */
60 60
 	public function json_core_settings_export() {
61
-		echo wp_json_encode( get_option( 'give_settings' ) );
61
+		echo wp_json_encode(get_option('give_settings'));
62 62
 	}
63 63
 
64 64
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @since  1.8.17
69 69
 	 */
70 70
 	public function export() {
71
-		if ( ! $this->can_export() ) {
72
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
71
+		if ( ! $this->can_export()) {
72
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
73 73
 		}
74 74
 
75 75
 		// Set headers.
Please login to merge, or discard this patch.
includes/admin/tools/export/export-actions.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array(
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array(
27 27
 			'response' => 403,
28
-		) );
28
+		));
29 29
 	}
30 30
 
31
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
31
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
32 32
 
33 33
 	/**
34 34
 	 * Fires before batch export.
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param string $class Export class.
39 39
 	 */
40
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
40
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
41 41
 
42 42
 	$export = new $_REQUEST['class'];
43 43
 	$export->export();
44 44
 
45 45
 }
46 46
 
47
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
47
+add_action('give_form_batch_export', 'give_process_batch_export_form');
48 48
 
49 49
 /**
50 50
  * Exports earnings for a specified time period.
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
  * @return void
56 56
  */
57 57
 function give_export_earnings() {
58
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php';
58
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php';
59 59
 
60 60
 	$earnings_export = new Give_Earnings_Export();
61 61
 
62 62
 	$earnings_export->export();
63 63
 }
64 64
 
65
-add_action( 'give_earnings_export', 'give_export_earnings' );
65
+add_action('give_earnings_export', 'give_export_earnings');
66 66
 
67 67
 /**
68 68
  * Exports Give's core settings.
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return void
74 74
  */
75 75
 function give_core_settings_export() {
76
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-core-settings-export.php';
76
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-core-settings-export.php';
77 77
 
78 78
 	$core_settings = new Give_Core_Settings_Export();
79 79
 
80 80
 	$core_settings->export();
81 81
 }
82 82
 
83
-add_action( 'give_core_settings_export', 'give_core_settings_export' );
83
+add_action('give_core_settings_export', 'give_core_settings_export');
84 84
 
85 85
 
86 86
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_register_batch_exporters() {
93
-	if ( is_admin() ) {
93
+	if (is_admin()) {
94 94
 		/**
95 95
 		 * Fires in the admin, while plugins loaded.
96 96
 		 *
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 		 *
101 101
 		 * @param string $class Export class.
102 102
 		 */
103
-		do_action( 'give_register_batch_exporter' );
103
+		do_action('give_register_batch_exporter');
104 104
 	}
105 105
 }
106 106
 
107
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
107
+add_action('plugins_loaded', 'give_register_batch_exporters');
108 108
 
109 109
 /**
110 110
  * Register the payments batch exporter
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
  * @since  1.5
113 113
  */
114 114
 function give_register_payments_batch_export() {
115
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
115
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
116 116
 }
117 117
 
118
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
118
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
119 119
 
120 120
 /**
121 121
  * Loads the payments batch process if needed
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return void
128 128
  */
129
-function give_include_payments_batch_processor( $class ) {
129
+function give_include_payments_batch_processor($class) {
130 130
 
131
-	if ( 'Give_Batch_Payments_Export' === $class ) {
132
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php';
131
+	if ('Give_Batch_Payments_Export' === $class) {
132
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php';
133 133
 	}
134 134
 
135 135
 }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
  * @since  1.5.2
141 141
  */
142 142
 function give_register_donors_batch_export() {
143
-	add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 );
143
+	add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1);
144 144
 }
145 145
 
146
-add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 );
146
+add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10);
147 147
 
148 148
 /**
149 149
  * Loads the donors batch process if needed.
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_include_donors_batch_processor( $class ) {
157
+function give_include_donors_batch_processor($class) {
158 158
 
159
-	if ( 'Give_Batch_Donors_Export' === $class ) {
160
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php';
159
+	if ('Give_Batch_Donors_Export' === $class) {
160
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php';
161 161
 	}
162 162
 
163 163
 }
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
  * @since  1.5
169 169
  */
170 170
 function give_register_forms_batch_export() {
171
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
171
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
172 172
 }
173 173
 
174
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
174
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
175 175
 
176 176
 /**
177 177
  * Loads the file downloads batch process if needed
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
  *
183 183
  * @return void
184 184
  */
185
-function give_include_forms_batch_processor( $class ) {
185
+function give_include_forms_batch_processor($class) {
186 186
 
187
-	if ( 'Give_Batch_Forms_Export' === $class ) {
188
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php';
187
+	if ('Give_Batch_Forms_Export' === $class) {
188
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php';
189 189
 	}
190 190
 
191 191
 }
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-api.php 1 patch
Spacing   +6 added lines, -6 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_API' ) ) :
16
+if ( ! class_exists('Give_Settings_API')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_API.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'api';
37
-			$this->label = esc_html__( 'API', 'give' );
37
+			$this->label = esc_html__('API', 'give');
38 38
 
39 39
 			parent::__construct();
40 40
 		}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		 */
48 48
 		public function get_settings() {
49 49
 			// Get settings.
50
-			$settings = apply_filters( 'give_settings_api', array(
50
+			$settings = apply_filters('give_settings_api', array(
51 51
 				array(
52 52
 					'id'   => 'give_tools_api',
53 53
 					'type' => 'title',
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				),
56 56
 				array(
57 57
 					'id'   => 'api',
58
-					'name' => esc_html__( 'API', 'give' ),
58
+					'name' => esc_html__('API', 'give'),
59 59
 					'type' => 'api',
60 60
 				),
61 61
 				array(
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			 * @since  1.8
72 72
 			 * @param  array $settings
73 73
 			 */
74
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
74
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
75 75
 
76 76
 			// Output.
77 77
 			return $settings;
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-logs.php 1 patch
Spacing   +12 added lines, -12 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_Logs' ) ) :
16
+if ( ! class_exists('Give_Settings_Logs')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Logs.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'logs';
37
-			$this->label = __( 'Logs', 'give' );
37
+			$this->label = __('Logs', 'give');
38 38
 
39 39
 			$this->default_tab = 'sales';
40 40
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		public function get_settings() {
52 52
 			// Get settings.
53
-			$settings = apply_filters( 'give_settings_logs', array(
53
+			$settings = apply_filters('give_settings_logs', array(
54 54
 				array(
55 55
 					'id'         => 'give_tools_logs',
56 56
 					'type'       => 'title',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				),
59 59
 				array(
60 60
 					'id'   => 'api',
61
-					'name' => __( 'Log', 'give' ),
61
+					'name' => __('Log', 'give'),
62 62
 					'type' => 'logs',
63 63
 
64 64
 				),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 					'type'       => 'sectionend',
68 68
 					'table_html' => false,
69 69
 				),
70
-			) );
70
+			));
71 71
 
72 72
 			/**
73 73
 			 * Filter the settings.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			 *
77 77
 			 * @param  array $settings
78 78
 			 */
79
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
79
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
80 80
 
81 81
 			// Output.
82 82
 			return $settings;
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 		 */
91 91
 		public function get_sections() {
92 92
 			$sections = array(
93
-				'sales'          => __( 'Donations', 'give' ),
94
-				'gateway_errors' => __( 'Payment Errors', 'give' ),
95
-				'api_requests'   => __( 'API Requests', 'give' ),
93
+				'sales'          => __('Donations', 'give'),
94
+				'gateway_errors' => __('Payment Errors', 'give'),
95
+				'api_requests'   => __('API Requests', 'give'),
96 96
 			);
97 97
 
98
-			$sections = apply_filters( 'give_log_views', $sections );
98
+			$sections = apply_filters('give_log_views', $sections);
99 99
 
100
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
100
+			return apply_filters('give_get_sections_'.$this->id, $sections);
101 101
 		}
102 102
 	}
103 103
 
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-data.php 1 patch
Spacing   +9 added lines, -9 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_Data' ) ) :
16
+if ( ! class_exists('Give_Settings_Data')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Data.
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function __construct() {
37 37
 			$this->id    = 'data';
38
-			$this->label = esc_html__( 'Data', 'give' );
38
+			$this->label = esc_html__('Data', 'give');
39 39
 
40 40
 			parent::__construct();
41 41
 
42 42
 			// Do not use main form for this tab.
43
-			if( give_get_current_setting_tab() === $this->id ) {
44
-				add_action( "give-tools_open_form", '__return_empty_string' );
45
-				add_action( "give-tools_close_form", '__return_empty_string' );
43
+			if (give_get_current_setting_tab() === $this->id) {
44
+				add_action("give-tools_open_form", '__return_empty_string');
45
+				add_action("give-tools_close_form", '__return_empty_string');
46 46
 			}
47 47
 		}
48 48
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		 */
55 55
 		public function get_settings() {
56 56
 			// Get settings.
57
-			$settings = apply_filters( 'give_settings_data', array(
57
+			$settings = apply_filters('give_settings_data', array(
58 58
 				array(
59 59
 					'id'   => 'give_tools_tools',
60 60
 					'type' => 'title',
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				),
63 63
 				array(
64 64
 					'id'   => 'api',
65
-					'name' => esc_html__( 'Tools', 'give' ),
65
+					'name' => esc_html__('Tools', 'give'),
66 66
 					'type' => 'data',
67 67
 				),
68 68
 				array(
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			 * @since  1.8
79 79
 			 * @param  array $settings
80 80
 			 */
81
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
81
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
82 82
 
83 83
 			// Output.
84 84
 			return $settings;
Please login to merge, or discard this patch.
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/import/class-give-import-donations.php 1 patch
Spacing   +189 added lines, -195 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.14
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_Donations' ) ) {
18
+if ( ! class_exists('Give_Import_Donations')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Donations.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @access private
58 58
 		 */
59 59
 		private function __construct() {
60
-			self::$per_page  = ! empty( $_GET['per_page'] ) ? absint( $_GET['per_page'] ) : self::$per_page;
60
+			self::$per_page = ! empty($_GET['per_page']) ? absint($_GET['per_page']) : self::$per_page;
61 61
 		}
62 62
 
63 63
 		/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		 * @return static
70 70
 		 */
71 71
 		public static function get_instance() {
72
-			if ( null === static::$instance ) {
72
+			if (null === static::$instance) {
73 73
 				self::$instance = new static();
74 74
 			}
75 75
 
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
 		 * @return void
97 97
 		 */
98 98
 		private function setup_hooks() {
99
-			if ( ! $this->is_donations_import_page() ) {
99
+			if ( ! $this->is_donations_import_page()) {
100 100
 				return;
101 101
 			}
102 102
 
103 103
 			// Do not render main import tools page.
104
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
104
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
105 105
 
106 106
 
107 107
 			// Render donation import page
108
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
108
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
109 109
 
110 110
 			// Print the HTML.
111
-			add_action( 'give_tools_import_donations_form_start', array( $this, 'html' ), 10 );
111
+			add_action('give_tools_import_donations_form_start', array($this, 'html'), 10);
112 112
 
113 113
 			// Run when form submit.
114
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
114
+			add_action('give-tools_save_import', array($this, 'save'));
115 115
 
116
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
116
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
117 117
 
118 118
 			// Used to add submit button.
119
-			add_action( 'give_tools_import_donations_form_end', array( $this, 'submit' ), 10 );
119
+			add_action('give_tools_import_donations_form_end', array($this, 'submit'), 10);
120 120
 		}
121 121
 
122 122
 		/**
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		 *
129 129
 		 * @return mixed
130 130
 		 */
131
-		public function update_notices( $messages ) {
132
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
133
-				unset( $messages['give-setting-updated'] );
131
+		public function update_notices($messages) {
132
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
133
+				unset($messages['give-setting-updated']);
134 134
 			}
135 135
 
136 136
 			return $messages;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		 * @since 1.8.14
143 143
 		 */
144 144
 		public function submit() {
145
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
145
+			wp_nonce_field('give-save-settings', '_give-save-settings');
146 146
 			?>
147 147
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
148 148
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				<table class="widefat export-options-table give-table <?php echo "step-{$step}"; ?>" id="<?php echo "step-{$step}"; ?>">
165 165
 					<tbody>
166 166
 						<?php
167
-						switch ( $this->get_step() ) {
167
+						switch ($this->get_step()) {
168 168
 							case 1:
169 169
 								$this->render_media_csv();
170 170
 								break;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 								$this->import_success();
182 182
 						}
183 183
 
184
-						if ( false === $this->check_for_dropdown_or_import() ) {
184
+						if (false === $this->check_for_dropdown_or_import()) {
185 185
 							?>
186 186
 							<tr valign="top">
187 187
 								<th></th>
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 									<input type="submit"
190 190
 										   class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
191 191
 										   id="recount-stats-submit"
192
-										   value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
192
+										   value="<?php esc_attr_e('Submit', 'give'); ?>"/>
193 193
 								</th>
194 194
 							</tr>
195 195
 							<?php
@@ -208,56 +208,56 @@  discard block
 block discarded – undo
208 208
 		 */
209 209
 		public function import_success() {
210 210
 
211
-			$delete_csv = ( ! empty( $_GET['delete_csv'] ) ? absint( $_GET['delete_csv'] ) : false );
212
-			$csv        = ( ! empty( $_GET['csv'] ) ? absint( $_GET['csv'] ) : false );
213
-			if ( ! empty( $delete_csv ) && ! empty( $csv ) ) {
214
-				wp_delete_attachment( $csv, true );
211
+			$delete_csv = ( ! empty($_GET['delete_csv']) ? absint($_GET['delete_csv']) : false);
212
+			$csv        = ( ! empty($_GET['csv']) ? absint($_GET['csv']) : false);
213
+			if ( ! empty($delete_csv) && ! empty($csv)) {
214
+				wp_delete_attachment($csv, true);
215 215
 			}
216 216
 
217 217
 			$report      = give_import_donation_report();
218 218
 			$report_html = array(
219 219
 				'duplicate_donor'    => array(
220
-					__( '%s duplicate %s detected', 'give' ),
221
-					__( 'donor', 'give' ),
222
-					__( 'donors', 'give' ),
220
+					__('%s duplicate %s detected', 'give'),
221
+					__('donor', 'give'),
222
+					__('donors', 'give'),
223 223
 				),
224 224
 				'create_donor'       => array(
225
-					__( '%s %s created', 'give' ),
226
-					__( 'donor', 'give' ),
227
-					__( 'donors', 'give' ),
225
+					__('%s %s created', 'give'),
226
+					__('donor', 'give'),
227
+					__('donors', 'give'),
228 228
 				),
229 229
 				'create_form'        => array(
230
-					__( '%s donation %s created', 'give' ),
231
-					__( 'form', 'give' ),
232
-					__( 'forms', 'give' ),
230
+					__('%s donation %s created', 'give'),
231
+					__('form', 'give'),
232
+					__('forms', 'give'),
233 233
 				),
234 234
 				'duplicate_donation' => array(
235
-					__( '%s duplicate %s detected', 'give' ),
236
-					__( 'donation', 'give' ),
237
-					__( 'donations', 'give' ),
235
+					__('%s duplicate %s detected', 'give'),
236
+					__('donation', 'give'),
237
+					__('donations', 'give'),
238 238
 				),
239 239
 				'create_donation'    => array(
240
-					__( '%s %s imported', 'give' ),
241
-					__( 'donation', 'give' ),
242
-					__( 'donations', 'give' ),
240
+					__('%s %s imported', 'give'),
241
+					__('donation', 'give'),
242
+					__('donations', 'give'),
243 243
 				),
244 244
 			);
245
-			$total       = (int) $_GET['total'];
246
-			-- $total;
245
+			$total = (int) $_GET['total'];
246
+			--$total;
247 247
 			$success = (bool) $_GET['success'];
248 248
 			?>
249 249
 			<tr valign="top" class="give-import-dropdown">
250 250
 				<th colspan="2">
251 251
 					<h2>
252 252
 						<?php
253
-						if ( $success ) {
253
+						if ($success) {
254 254
 							echo sprintf(
255
-								__( 'Import complete! %s donations processed', 'give' ),
255
+								__('Import complete! %s donations processed', 'give'),
256 256
 								"<strong>{$total}</strong>"
257 257
 							);
258 258
 						} else {
259 259
 							echo sprintf(
260
-								__( 'Failed to import %s donations', 'give' ),
260
+								__('Failed to import %s donations', 'give'),
261 261
 								"<strong>{$total}</strong>"
262 262
 							);
263 263
 						}
@@ -265,25 +265,25 @@  discard block
 block discarded – undo
265 265
 					</h2>
266 266
 
267 267
 					<?php
268
-					$text      = __( 'Import Donation', 'give' );
268
+					$text      = __('Import Donation', 'give');
269 269
 					$query_arg = array(
270 270
 						'post_type' => 'give_forms',
271 271
 						'page'      => 'give-tools',
272 272
 						'tab'       => 'import',
273 273
 					);
274
-					if ( $success ) {
274
+					if ($success) {
275 275
 						$query_arg = array(
276 276
 							'post_type' => 'give_forms',
277 277
 							'page'      => 'give-payment-history',
278 278
 						);
279
-						$text      = __( 'View Donations', 'give' );
279
+						$text = __('View Donations', 'give');
280 280
 					}
281 281
 
282
-					foreach ( $report as $key => $value ) {
283
-						if ( array_key_exists( $key, $report_html ) && ! empty( $value ) ) {
282
+					foreach ($report as $key => $value) {
283
+						if (array_key_exists($key, $report_html) && ! empty($value)) {
284 284
 							?>
285 285
 							<p>
286
-								<?php echo esc_html( wp_sprintf( $report_html[ $key ][0], $value, _n( $report_html[ $key ][1], $report_html[ $key ][2], $value, 'give' ) ) ); ?>
286
+								<?php echo esc_html(wp_sprintf($report_html[$key][0], $value, _n($report_html[$key][1], $report_html[$key][2], $value, 'give'))); ?>
287 287
 							</p>
288 288
 							<?php
289 289
 						}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 					?>
292 292
 
293 293
 					<p>
294
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
294
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
295 295
 					</p>
296 296
 				</th>
297 297
 			</tr>
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 			give_import_donation_report_reset();
309 309
 
310 310
 			$csv         = (int) $_REQUEST['csv'];
311
-			$delimiter   = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
311
+			$delimiter   = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
312 312
 			$index_start = 1;
313 313
 			$index_end   = 1;
314 314
 			$next        = true;
315
-			$total       = self::get_csv_total( $csv );
316
-			if ( self::$per_page < $total ) {
317
-				$total_ajax = ceil( $total / self::$per_page );
315
+			$total       = self::get_csv_total($csv);
316
+			if (self::$per_page < $total) {
317
+				$total_ajax = ceil($total / self::$per_page);
318 318
 				$index_end  = self::$per_page;
319 319
 			} else {
320 320
 				$total_ajax = 1;
321 321
 				$index_end  = $total;
322 322
 				$next       = false;
323 323
 			}
324
-			$current_percentage = 100 / ( $total_ajax + 1 );
324
+			$current_percentage = 100 / ($total_ajax + 1);
325 325
 
326 326
 			?>
327 327
 			<tr valign="top" class="give-import-dropdown">
328 328
 				<th colspan="2">
329
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
330
-					<p class="give-field-description"><?php esc_html_e( 'Your donations are now being imported...', 'give' ) ?></p>
329
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
330
+					<p class="give-field-description"><?php esc_html_e('Your donations are now being imported...', 'give') ?></p>
331 331
 				</th>
332 332
 			</tr>
333 333
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 						<div style="width: <?php echo $current_percentage; ?>%"></div>
347 347
 					</div>
348 348
 					<input type="hidden" value="3" name="step">
349
-					<input type="hidden" value='<?php echo maybe_serialize( $_REQUEST['mapto'] ); ?>' name="mapto"
349
+					<input type="hidden" value='<?php echo maybe_serialize($_REQUEST['mapto']); ?>' name="mapto"
350 350
 						   class="mapto">
351 351
 					<input type="hidden" value="<?php echo $_REQUEST['csv']; ?>" name="csv" class="csv">
352 352
 					<input type="hidden" value="<?php echo $_REQUEST['mode']; ?>" name="mode" class="mode">
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 					<input type="hidden" value="<?php echo $_REQUEST['delete_csv']; ?>" name="delete_csv"
356 356
 						   class="delete_csv">
357 357
 					<input type="hidden" value="<?php echo $delimiter; ?>" name="delimiter">
358
-					<input type="hidden" value='<?php echo maybe_serialize( self::get_importer( $csv, 0, $delimiter ) ); ?>'
358
+					<input type="hidden" value='<?php echo maybe_serialize(self::get_importer($csv, 0, $delimiter)); ?>'
359 359
 						   name="main_key"
360 360
 						   class="main_key">
361 361
 				</th>
@@ -376,20 +376,20 @@  discard block
 block discarded – undo
376 376
 		 */
377 377
 		public function check_for_dropdown_or_import() {
378 378
 			$return = true;
379
-			if ( isset( $_REQUEST['mapto'] ) ) {
379
+			if (isset($_REQUEST['mapto'])) {
380 380
 				$mapto = (array) $_REQUEST['mapto'];
381
-				if ( false === in_array( 'form_title', $mapto ) && false === in_array( 'form_id', $mapto ) ) {
382
-					Give_Admin_Settings::add_error( 'give-import-csv-form', __( 'In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give' ) );
381
+				if (false === in_array('form_title', $mapto) && false === in_array('form_id', $mapto)) {
382
+					Give_Admin_Settings::add_error('give-import-csv-form', __('In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give'));
383 383
 					$return = false;
384 384
 				}
385 385
 
386
-				if ( false === in_array( 'amount', $mapto ) ) {
387
-					Give_Admin_Settings::add_error( 'give-import-csv-amount', __( 'In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give' ) );
386
+				if (false === in_array('amount', $mapto)) {
387
+					Give_Admin_Settings::add_error('give-import-csv-amount', __('In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give'));
388 388
 					$return = false;
389 389
 				}
390 390
 
391
-				if ( false === in_array( 'email', $mapto ) && false === in_array( 'donor_id', $mapto ) ) {
392
-					Give_Admin_Settings::add_error( 'give-import-csv-donor', __( 'In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give' ) );
391
+				if (false === in_array('email', $mapto) && false === in_array('donor_id', $mapto)) {
392
+					Give_Admin_Settings::add_error('give-import-csv-donor', __('In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give'));
393 393
 					$return = false;
394 394
 				}
395 395
 			} else {
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 		 */
407 407
 		public function render_dropdown() {
408 408
 			$csv       = (int) $_GET['csv'];
409
-			$delimiter = ( ! empty( $_GET['delimiter'] ) ? give_clean( $_GET['delimiter'] ) : 'csv' );
409
+			$delimiter = ( ! empty($_GET['delimiter']) ? give_clean($_GET['delimiter']) : 'csv');
410 410
 
411 411
 			// TO check if the CSV files that is being add is valid or not if not then redirect to first step again
412
-			if ( ! $this->is_valid_csv( $csv ) ) {
412
+			if ( ! $this->is_valid_csv($csv)) {
413 413
 				$url = give_import_page_url();
414 414
 				?>
415 415
 				<script type="text/javascript">
@@ -420,27 +420,27 @@  discard block
 block discarded – undo
420 420
 				?>
421 421
 				<tr valign="top" class="give-import-dropdown">
422 422
 					<th colspan="2">
423
-						<h2 id="give-import-title"><?php esc_html_e( 'Map CSV fields to donations', 'give' ) ?></h2>
424
-						<p class="give-field-description"><?php esc_html_e( 'Select fields from your CSV file to map against donations fields or to ignore during import.', 'give' ) ?></p>
423
+						<h2 id="give-import-title"><?php esc_html_e('Map CSV fields to donations', 'give') ?></h2>
424
+						<p class="give-field-description"><?php esc_html_e('Select fields from your CSV file to map against donations fields or to ignore during import.', 'give') ?></p>
425 425
 					</th>
426 426
 				</tr>
427 427
 
428 428
 				<tr valign="top" class="give-import-dropdown">
429
-					<th><b><?php esc_html_e( 'Column name', 'give' ); ?></b></th>
430
-					<th><b><?php esc_html_e( 'Map to field', 'give' ); ?></b></th>
429
+					<th><b><?php esc_html_e('Column name', 'give'); ?></b></th>
430
+					<th><b><?php esc_html_e('Map to field', 'give'); ?></b></th>
431 431
 				</tr>
432 432
 
433 433
 				<?php
434
-				$raw_key   = $this->get_importer( $csv, 0, $delimiter );
435
-				$mapto     = (array) ( isset( $_REQUEST['mapto'] ) ? $_REQUEST['mapto'] : array() );
434
+				$raw_key   = $this->get_importer($csv, 0, $delimiter);
435
+				$mapto     = (array) (isset($_REQUEST['mapto']) ? $_REQUEST['mapto'] : array());
436 436
 
437
-				foreach ( $raw_key as $index => $value ) {
437
+				foreach ($raw_key as $index => $value) {
438 438
 					?>
439 439
 					<tr valign="top" class="give-import-option">
440 440
 						<th><?php echo $value; ?></th>
441 441
 						<th>
442 442
 							<?php
443
-							$this->get_columns( $index, $value, $mapto );
443
+							$this->get_columns($index, $value, $mapto);
444 444
 							?>
445 445
 						</th>
446 446
 					</tr>
@@ -455,14 +455,14 @@  discard block
 block discarded – undo
455 455
 		 *
456 456
 		 * @return string
457 457
 		 */
458
-		public function selected( $option_value, $value ) {
459
-			$option_value = strtolower( $option_value );
460
-			$value = strtolower( $value );
458
+		public function selected($option_value, $value) {
459
+			$option_value = strtolower($option_value);
460
+			$value = strtolower($value);
461 461
 
462 462
 			$selected = '';
463
-			if ( stristr( $value, $option_value ) ) {
463
+			if (stristr($value, $option_value)) {
464 464
 				$selected = 'selected';
465
-			} elseif ( strrpos( $value, '_' ) && stristr( $option_value, __( 'Import as Meta', 'give' ) ) ) {
465
+			} elseif (strrpos($value, '_') && stristr($option_value, __('Import as Meta', 'give'))) {
466 466
 				$selected = 'selected';
467 467
 			}
468 468
 
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
 		 *
482 482
 		 * @return void
483 483
 		 */
484
-		private function get_columns( $index, $value = false, $mapto = array() ) {
484
+		private function get_columns($index, $value = false, $mapto = array()) {
485 485
 			$default       = give_import_default_options();
486
-			$current_mapto = (string) ( ! empty( $mapto[ $index ] ) ? $mapto[ $index ] : '' );
486
+			$current_mapto = (string) ( ! empty($mapto[$index]) ? $mapto[$index] : '');
487 487
 			?>
488 488
 			<select name="mapto[<?php echo $index; ?>]">
489
-				<?php $this->get_dropdown_option_html( $default, $current_mapto, $value ); ?>
489
+				<?php $this->get_dropdown_option_html($default, $current_mapto, $value); ?>
490 490
 
491
-				<optgroup label="<?php _e( 'Donations', 'give' ); ?>">
491
+				<optgroup label="<?php _e('Donations', 'give'); ?>">
492 492
 					<?php
493
-					$this->get_dropdown_option_html( give_import_donations_options(), $current_mapto, $value );
493
+					$this->get_dropdown_option_html(give_import_donations_options(), $current_mapto, $value);
494 494
 					?>
495 495
 				</optgroup>
496 496
 
497
-				<optgroup label="<?php _e( 'Donors', 'give' ); ?>">
497
+				<optgroup label="<?php _e('Donors', 'give'); ?>">
498 498
 					<?php
499
-					$this->get_dropdown_option_html( give_import_donor_options(), $current_mapto, $value );
499
+					$this->get_dropdown_option_html(give_import_donor_options(), $current_mapto, $value);
500 500
 					?>
501 501
 				</optgroup>
502 502
 
503
-				<optgroup label="<?php _e( 'Forms', 'give' ); ?>">
503
+				<optgroup label="<?php _e('Forms', 'give'); ?>">
504 504
 					<?php
505
-					$this->get_dropdown_option_html( give_import_donation_form_options(), $current_mapto, $value );
505
+					$this->get_dropdown_option_html(give_import_donation_form_options(), $current_mapto, $value);
506 506
 					?>
507 507
 				</optgroup>
508 508
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				 *
514 514
 				 * @since 1.8.15
515 515
 				 */
516
-				do_action( 'give_import_dropdown_option', $index, $value, $mapto, $current_mapto );
516
+				do_action('give_import_dropdown_option', $index, $value, $mapto, $current_mapto);
517 517
 				?>
518 518
 			</select>
519 519
 			<?php
@@ -531,16 +531,16 @@  discard block
 block discarded – undo
531 531
 		 *
532 532
 		 * @return void
533 533
 		 */
534
-		public function get_dropdown_option_html( $options, $current_mapto, $value = false ) {
535
-			foreach ( $options as $option => $option_value ) {
534
+		public function get_dropdown_option_html($options, $current_mapto, $value = false) {
535
+			foreach ($options as $option => $option_value) {
536 536
 				$option_value_texts = (array) $option_value;
537 537
 				$option_text = $option_value_texts[0];
538 538
 
539
-				$checked = ( ( $current_mapto === $option ) ? 'selected' : false );
540
-				if ( empty( $checked ) ) {
541
-					foreach ( $option_value_texts as $option_value_text ) {
542
-						$checked = $this->selected( $option_value_text, $value );
543
-						if ( $checked ) {
539
+				$checked = (($current_mapto === $option) ? 'selected' : false);
540
+				if (empty($checked)) {
541
+					foreach ($option_value_texts as $option_value_text) {
542
+						$checked = $this->selected($option_value_text, $value);
543
+						if ($checked) {
544 544
 							break;
545 545
 						}
546 546
 					}
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 		 *
565 565
 		 * @return bool|int
566 566
 		 */
567
-		public function get_csv_total( $file_id ) {
567
+		public function get_csv_total($file_id) {
568 568
 			$total = false;
569
-			if ( $file_id ) {
570
-				$file_dir = get_attached_file( $file_id );
571
-				if ( $file_dir ) {
572
-					$file = new SplFileObject( $file_dir, 'r' );
573
-					$file->seek( PHP_INT_MAX );
569
+			if ($file_id) {
570
+				$file_dir = get_attached_file($file_id);
571
+				if ($file_dir) {
572
+					$file = new SplFileObject($file_dir, 'r');
573
+					$file->seek(PHP_INT_MAX);
574 574
 					$total = $file->key() + 1;
575 575
 				}
576 576
 			}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		 *
590 590
 		 * @return array|bool $raw_data title of the CSV file fields
591 591
 		 */
592
-		public function get_importer( $file_id, $index = 0, $delimiter = 'csv' ) {
592
+		public function get_importer($file_id, $index = 0, $delimiter = 'csv') {
593 593
 			/**
594 594
 			 * Filter to modify delimiter of Import.
595 595
 			 *
@@ -597,16 +597,16 @@  discard block
 block discarded – undo
597 597
 			 *
598 598
 			 * Return string $delimiter.
599 599
 			 */
600
-			$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
600
+			$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
601 601
 
602 602
 			$raw_data = false;
603
-			$file_dir = get_attached_file( $file_id );
604
-			if ( $file_dir ) {
605
-				if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
606
-					$raw_data = fgetcsv( $handle, $index, $delimiter );
603
+			$file_dir = get_attached_file($file_id);
604
+			if ($file_dir) {
605
+				if (false !== ($handle = fopen($file_dir, 'r'))) {
606
+					$raw_data = fgetcsv($handle, $index, $delimiter);
607 607
 					// Remove BOM signature from the first item.
608
-					if ( isset( $raw_data[0] ) ) {
609
-						$raw_data[0] = $this->remove_utf8_bom( $raw_data[0] );
608
+					if (isset($raw_data[0])) {
609
+						$raw_data[0] = $this->remove_utf8_bom($raw_data[0]);
610 610
 					}
611 611
 				}
612 612
 			}
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 		 *
624 624
 		 * @return string
625 625
 		 */
626
-		public function remove_utf8_bom( $string ) {
627
-			if ( 'efbbbf' === substr( bin2hex( $string ), 0, 6 ) ) {
628
-				$string = substr( $string, 3 );
626
+		public function remove_utf8_bom($string) {
627
+			if ('efbbbf' === substr(bin2hex($string), 0, 6)) {
628
+				$string = substr($string, 3);
629 629
 			}
630 630
 
631 631
 			return $string;
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 			$step = $this->get_step();
642 642
 			?>
643 643
 			<ol class="give-progress-steps">
644
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
645
-					<?php esc_html_e( 'Upload CSV file', 'give' ); ?>
644
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
645
+					<?php esc_html_e('Upload CSV file', 'give'); ?>
646 646
 				</li>
647
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
648
-					<?php esc_html_e( 'Column mapping', 'give' ); ?>
647
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
648
+					<?php esc_html_e('Column mapping', 'give'); ?>
649 649
 				</li>
650
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
651
-					<?php esc_html_e( 'Import', 'give' ); ?>
650
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
651
+					<?php esc_html_e('Import', 'give'); ?>
652 652
 				</li>
653
-				<li class="<?php echo( 4 === $step ? 'active' : '' ); ?>">
654
-					<?php esc_html_e( 'Done!', 'give' ); ?>
653
+				<li class="<?php echo(4 === $step ? 'active' : ''); ?>">
654
+					<?php esc_html_e('Done!', 'give'); ?>
655 655
 				</li>
656 656
 			</ol>
657 657
 			<?php
@@ -665,16 +665,16 @@  discard block
 block discarded – undo
665 665
 		 * @return int $step on which step doest the import is on.
666 666
 		 */
667 667
 		public function get_step() {
668
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
668
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
669 669
 			$on_step = 1;
670 670
 
671
-			if ( empty( $step ) || 1 === $step ) {
671
+			if (empty($step) || 1 === $step) {
672 672
 				$on_step = 1;
673
-			} elseif ( $this->check_for_dropdown_or_import() ) {
673
+			} elseif ($this->check_for_dropdown_or_import()) {
674 674
 				$on_step = 3;
675
-			} elseif ( 2 === $step ) {
675
+			} elseif (2 === $step) {
676 676
 				$on_step = 2;
677
-			} elseif ( 4 === $step ) {
677
+			} elseif (4 === $step) {
678 678
 				$on_step = 4;
679 679
 			}
680 680
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 		 * @since 1.8.14
688 688
 		 */
689 689
 		public function render_page() {
690
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-donations.php';
690
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-donations.php';
691 691
 		}
692 692
 
693 693
 		/**
@@ -702,37 +702,34 @@  discard block
 block discarded – undo
702 702
 			?>
703 703
 			<tr valign="top">
704 704
 				<th colspan="2">
705
-					<h2 id="give-import-title"><?php esc_html_e( 'Import donations from a CSV file', 'give' ) ?></h2>
706
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give' ) ?></p>
705
+					<h2 id="give-import-title"><?php esc_html_e('Import donations from a CSV file', 'give') ?></h2>
706
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give') ?></p>
707 707
 				</th>
708 708
 			</tr>
709 709
 			<?php
710
-			$csv         = ( isset( $_POST['csv'] ) ? give_clean( $_POST['csv'] ) : '' );
711
-			$csv_id      = ( isset( $_POST['csv_id'] ) ? give_clean( $_POST['csv_id'] ) : '' );
712
-			$delimiter   = ( isset( $_POST['delimiter'] ) ? give_clean( $_POST['delimiter'] ) : 'csv' );
713
-			$mode        = empty( $_POST['mode'] ) ?
714
-				'disabled' :
715
-				( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? 'enabled' : 'disabled' );
716
-			$create_user = empty( $_POST['create_user'] ) ?
717
-				'enabled' :
718
-				( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? 'enabled' : 'disabled' );
719
-			$delete_csv  = empty( $_POST['delete_csv'] ) ?
720
-				'enabled' :
721
-				( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? 'enabled' : 'disabled' );
710
+			$csv         = (isset($_POST['csv']) ? give_clean($_POST['csv']) : '');
711
+			$csv_id      = (isset($_POST['csv_id']) ? give_clean($_POST['csv_id']) : '');
712
+			$delimiter   = (isset($_POST['delimiter']) ? give_clean($_POST['delimiter']) : 'csv');
713
+			$mode        = empty($_POST['mode']) ?
714
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? 'enabled' : 'disabled');
715
+			$create_user = empty($_POST['create_user']) ?
716
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? 'enabled' : 'disabled');
717
+			$delete_csv  = empty($_POST['delete_csv']) ?
718
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? 'enabled' : 'disabled');
722 719
 
723 720
 			// Reset csv and csv_id if csv
724
-			if ( empty( $csv_id ) || ! $this->is_valid_csv( $csv_id, $csv ) ) {
721
+			if (empty($csv_id) || ! $this->is_valid_csv($csv_id, $csv)) {
725 722
 				$csv_id = $csv = '';
726 723
 			}
727
-			$per_page = isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page;
724
+			$per_page = isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page;
728 725
 
729 726
 			$settings = array(
730 727
 				array(
731 728
 					'id'          => 'csv',
732
-					'name'        => __( 'Choose a CSV file:', 'give' ),
729
+					'name'        => __('Choose a CSV file:', 'give'),
733 730
 					'type'        => 'file',
734
-					'attributes'  => array( 'editing' => 'false', 'library' => 'text' ),
735
-					'description' => __( 'The file must be a Comma Seperated Version (CSV) file type only.', 'give' ),
731
+					'attributes'  => array('editing' => 'false', 'library' => 'text'),
732
+					'description' => __('The file must be a Comma Seperated Version (CSV) file type only.', 'give'),
736 733
 					'fvalue'      => 'url',
737 734
 					'default'     => $csv,
738 735
 				),
@@ -743,61 +740,61 @@  discard block
 block discarded – undo
743 740
 				),
744 741
 				array(
745 742
 					'id'          => 'delimiter',
746
-					'name'        => __( 'CSV Delimiter:', 'give' ),
747
-					'description' => __( 'In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give' ),
743
+					'name'        => __('CSV Delimiter:', 'give'),
744
+					'description' => __('In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give'),
748 745
 					'default'     => $delimiter,
749 746
 					'type'        => 'select',
750 747
 					'options'     => array(
751
-						'csv'                  => esc_html__( 'Comma', 'give' ),
752
-						'tab-separated-values' => esc_html__( 'Tab', 'give' ),
748
+						'csv'                  => esc_html__('Comma', 'give'),
749
+						'tab-separated-values' => esc_html__('Tab', 'give'),
753 750
 					),
754 751
 				),
755 752
 				array(
756 753
 					'id'          => 'mode',
757
-					'name'        => __( 'Test Mode:', 'give' ),
758
-					'description' => __( 'Test mode allows you to preview what this import would look like without making any actual changes to your site or your database.', 'give' ),
754
+					'name'        => __('Test Mode:', 'give'),
755
+					'description' => __('Test mode allows you to preview what this import would look like without making any actual changes to your site or your database.', 'give'),
759 756
 					'default'     => $mode,
760 757
 					'type'        => 'radio_inline',
761 758
 					'options'     => array(
762
-						'enabled'  => __( 'Enabled', 'give' ),
763
-						'disabled' => __( 'Disabled', 'give' ),
759
+						'enabled'  => __('Enabled', 'give'),
760
+						'disabled' => __('Disabled', 'give'),
764 761
 					),
765 762
 				),
766 763
 				array(
767 764
 					'id'          => 'create_user',
768
-					'name'        => __( 'Create WP users for new donors:', 'give' ),
769
-					'description' => __( 'The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give' ),
765
+					'name'        => __('Create WP users for new donors:', 'give'),
766
+					'description' => __('The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give'),
770 767
 					'default'     => $create_user,
771 768
 					'type'        => 'radio_inline',
772 769
 					'options'     => array(
773
-						'enabled'  => __( 'Enabled', 'give' ),
774
-						'disabled' => __( 'Disabled', 'give' ),
770
+						'enabled'  => __('Enabled', 'give'),
771
+						'disabled' => __('Disabled', 'give'),
775 772
 					),
776 773
 				),
777 774
 				array(
778 775
 					'id'          => 'delete_csv',
779
-					'name'        => __( 'Delete CSV after import:', 'give' ),
780
-					'description' => __( 'Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give' ),
776
+					'name'        => __('Delete CSV after import:', 'give'),
777
+					'description' => __('Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give'),
781 778
 					'default'     => $delete_csv,
782 779
 					'type'        => 'radio_inline',
783 780
 					'options'     => array(
784
-						'enabled'  => __( 'Enabled', 'give' ),
785
-						'disabled' => __( 'Disabled', 'give' ),
781
+						'enabled'  => __('Enabled', 'give'),
782
+						'disabled' => __('Disabled', 'give'),
786 783
 					),
787 784
 				),
788 785
 				array(
789 786
 					'id'          => 'per_page',
790
-					'name'        => __( 'Process Rows Per Batch:', 'give' ),
787
+					'name'        => __('Process Rows Per Batch:', 'give'),
791 788
 					'type'        => 'number',
792
-					'description' => __( 'Determine how many rows you would like to import per cycle.', 'give' ),
789
+					'description' => __('Determine how many rows you would like to import per cycle.', 'give'),
793 790
 					'default'     => $per_page,
794 791
 					'class'       => 'give-text-small',
795 792
 				),
796 793
 			);
797 794
 
798
-			$settings = apply_filters( 'give_import_file_upload_html', $settings );
795
+			$settings = apply_filters('give_import_file_upload_html', $settings);
799 796
 
800
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
797
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
801 798
 		}
802 799
 
803 800
 		/**
@@ -810,27 +807,24 @@  discard block
 block discarded – undo
810 807
 			$step = $this->get_step();
811 808
 
812 809
 			// Validation for first step.
813
-			if ( 1 === $step ) {
814
-				$csv_id = absint( $_POST['csv_id'] );
810
+			if (1 === $step) {
811
+				$csv_id = absint($_POST['csv_id']);
815 812
 
816
-				if ( $this->is_valid_csv( $csv_id, esc_url( $_POST['csv'] ) ) ) {
813
+				if ($this->is_valid_csv($csv_id, esc_url($_POST['csv']))) {
817 814
 
818
-					$url = give_import_page_url( (array) apply_filters( 'give_import_step_two_url', array(
815
+					$url = give_import_page_url((array) apply_filters('give_import_step_two_url', array(
819 816
 						'step'          => '2',
820 817
 						'importer-type' => $this->importer_type,
821 818
 						'csv'           => $csv_id,
822
-						'delimiter'     => isset( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv',
823
-						'mode'          => empty( $_POST['mode'] ) ?
824
-							'0' :
825
-							( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? '1' : '0' ),
826
-						'create_user'   => empty( $_POST['create_user'] ) ?
827
-							'0' :
828
-							( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? '1' : '0' ),
829
-						'delete_csv'    => empty( $_POST['delete_csv'] ) ?
830
-							'1' :
831
-							( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? '1' : '0' ),
832
-						'per_page'      => isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page,
833
-					) ) );
819
+						'delimiter'     => isset($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv',
820
+						'mode'          => empty($_POST['mode']) ?
821
+							'0' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? '1' : '0'),
822
+						'create_user'   => empty($_POST['create_user']) ?
823
+							'0' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? '1' : '0'),
824
+						'delete_csv'    => empty($_POST['delete_csv']) ?
825
+							'1' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? '1' : '0'),
826
+						'per_page'      => isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page,
827
+					)));
834 828
 					?>
835 829
 					<script type="text/javascript">
836 830
 						window.location = "<?php echo $url; ?>"
@@ -851,25 +845,25 @@  discard block
 block discarded – undo
851 845
 		 *
852 846
 		 * @return bool $has_error CSV is valid or not.
853 847
 		 */
854
-		private function is_valid_csv( $csv = false, $match_url = '' ) {
848
+		private function is_valid_csv($csv = false, $match_url = '') {
855 849
 			$is_valid_csv = true;
856 850
 
857
-			if ( $csv ) {
858
-				$csv_url = wp_get_attachment_url( $csv );
851
+			if ($csv) {
852
+				$csv_url = wp_get_attachment_url($csv);
859 853
 
860
-				$delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
854
+				$delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
861 855
 
862 856
 				if (
863 857
 					! $csv_url ||
864
-					( ! empty( $match_url ) && ( $csv_url !== $match_url ) ) ||
865
-					( ( $mime_type = get_post_mime_type( $csv ) ) && ! strpos( $mime_type, $delimiter ) )
858
+					( ! empty($match_url) && ($csv_url !== $match_url)) ||
859
+					(($mime_type = get_post_mime_type($csv)) && ! strpos($mime_type, $delimiter))
866 860
 				) {
867 861
 					$is_valid_csv = false;
868
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
862
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
869 863
 				}
870 864
 			} else {
871 865
 				$is_valid_csv = false;
872
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
866
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
873 867
 			}
874 868
 
875 869
 			return $is_valid_csv;
@@ -885,8 +879,8 @@  discard block
 block discarded – undo
885 879
 		 * @param $field
886 880
 		 * @param $option_value
887 881
 		 */
888
-		public function render_import_field( $field, $option_value ) {
889
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
882
+		public function render_import_field($field, $option_value) {
883
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
890 884
 		}
891 885
 
892 886
 		/**
@@ -897,8 +891,8 @@  discard block
 block discarded – undo
897 891
 		 */
898 892
 		private function is_donations_import_page() {
899 893
 			return 'import' === give_get_current_setting_tab() &&
900
-			       isset( $_GET['importer-type'] ) &&
901
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
894
+			       isset($_GET['importer-type']) &&
895
+			       $this->importer_type === give_clean($_GET['importer-type']);
902 896
 		}
903 897
 	}
904 898
 
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.