Test Failed
Push — master ( f5256c...25a383 )
by Devin
07:02
created
includes/admin/tools/data/class-give-tools-reset-stats.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * Constructor.
51 51
 	 */
52
-	public function __construct( $_step = 1 ) {
53
-		parent::__construct( $_step );
52
+	public function __construct($_step = 1) {
53
+		parent::__construct($_step);
54 54
 
55 55
 		$this->is_writable = true;
56 56
 	}
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 	public function get_data() {
68 68
 		global $wpdb;
69 69
 
70
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
70
+		$items = $this->get_stored_data('give_temp_reset_ids');
71 71
 
72
-		if ( ! is_array( $items ) ) {
72
+		if ( ! is_array($items)) {
73 73
 			return false;
74 74
 		}
75 75
 
76
-		$offset     = ( $this->step - 1 ) * $this->per_step;
77
-		$step_items = array_slice( $items, $offset, $this->per_step );
76
+		$offset     = ($this->step - 1) * $this->per_step;
77
+		$step_items = array_slice($items, $offset, $this->per_step);
78 78
 
79
-		if ( $step_items ) {
79
+		if ($step_items) {
80 80
 
81 81
 			$step_ids = array(
82 82
 				'customers' => array(),
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 				'other'     => array(),
85 85
 			);
86 86
 
87
-			foreach ( $step_items as $item ) {
87
+			foreach ($step_items as $item) {
88 88
 
89
-				switch ( $item['type'] ) {
89
+				switch ($item['type']) {
90 90
 					case 'customer':
91 91
 						$step_ids['customers'][] = $item['id'];
92 92
 						break;
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
 						$step_ids['give_forms'][] = $item['id'];
95 95
 						break;
96 96
 					default:
97
-						$item_type                = apply_filters( 'give_reset_item_type', 'other', $item );
98
-						$step_ids[ $item_type ][] = $item['id'];
97
+						$item_type                = apply_filters('give_reset_item_type', 'other', $item);
98
+						$step_ids[$item_type][] = $item['id'];
99 99
 						break;
100 100
 				}
101 101
 			}
102 102
 
103 103
 			$sql = array();
104
-			$meta_table = __give_v20_bc_table_details('form' );
104
+			$meta_table = __give_v20_bc_table_details('form');
105 105
 
106
-			foreach ( $step_ids as $type => $ids ) {
106
+			foreach ($step_ids as $type => $ids) {
107 107
 
108
-				if ( empty( $ids ) ) {
108
+				if (empty($ids)) {
109 109
 					continue;
110 110
 				}
111 111
 
112
-				$ids = implode( ',', $ids );
112
+				$ids = implode(',', $ids);
113 113
 
114
-				switch ( $type ) {
114
+				switch ($type) {
115 115
 					case 'customers':
116 116
 						$sql[]           = "DELETE FROM $wpdb->donors WHERE id IN ($ids)";
117 117
 						$table_name      = $wpdb->donors;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 								OR $wpdb->term_taxonomy.taxonomy = %s
140 140
 							)
141 141
 							",
142
-							array( 'give_forms_category', 'give_forms_tag' )
142
+							array('give_forms_category', 'give_forms_tag')
143 143
 						);
144 144
 						$sql[] = $wpdb->prepare(
145 145
 							"
@@ -147,21 +147,21 @@  discard block
 block discarded – undo
147 147
 							WHERE $wpdb->term_taxonomy.taxonomy = %s
148 148
 							OR $wpdb->term_taxonomy.taxonomy = %s
149 149
 							",
150
-							array( 'give_forms_category', 'give_forms_tag' )
150
+							array('give_forms_category', 'give_forms_tag')
151 151
 						);
152 152
 						break;
153 153
 				}
154 154
 
155
-				if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) {
155
+				if ( ! in_array($type, array('customers', 'forms', 'other'))) {
156 156
 					// Allows other types of custom post types to filter on their own post_type
157 157
 					// and add items to the query list, for the IDs found in their post type.
158
-					$sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids );
158
+					$sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids);
159 159
 				}
160 160
 			}
161 161
 
162
-			if ( ! empty( $sql ) ) {
163
-				foreach ( $sql as $query ) {
164
-					$wpdb->query( $query );
162
+			if ( ! empty($sql)) {
163
+				foreach ($sql as $query) {
164
+					$wpdb->query($query);
165 165
 				}
166 166
 			}
167 167
 
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function get_percentage_complete() {
183 183
 
184
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
185
-		$total = count( $items );
184
+		$items = $this->get_stored_data('give_temp_reset_ids');
185
+		$total = count($items);
186 186
 
187 187
 		$percentage = 100;
188 188
 
189
-		if ( $total > 0 ) {
190
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
189
+		if ($total > 0) {
190
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
191 191
 		}
192 192
 
193
-		if ( $percentage > 100 ) {
193
+		if ($percentage > 100) {
194 194
 			$percentage = 100;
195 195
 		}
196 196
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @param array $request The Form Data passed into the batch processing.
206 206
 	 */
207
-	public function set_properties( $request ) {
207
+	public function set_properties($request) {
208 208
 	}
209 209
 
210 210
 	/**
@@ -215,26 +215,26 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function process_step() {
217 217
 
218
-		if ( ! $this->can_export() ) {
219
-			wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array(
218
+		if ( ! $this->can_export()) {
219
+			wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array(
220 220
 				'response' => 403,
221
-			) );
221
+			));
222 222
 		}
223 223
 
224 224
 		$had_data = $this->get_data();
225 225
 
226
-		if ( $had_data ) {
226
+		if ($had_data) {
227 227
 			$this->done = false;
228 228
 
229 229
 			return true;
230 230
 		} else {
231
-			update_option( 'give_earnings_total', 0, false );
232
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
231
+			update_option('give_earnings_total', 0, false);
232
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
233 233
 
234
-			$this->delete_data( 'give_temp_reset_ids' );
234
+			$this->delete_data('give_temp_reset_ids');
235 235
 
236 236
 			$this->done    = true;
237
-			$this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' );
237
+			$this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give');
238 238
 
239 239
 			return false;
240 240
 		}
@@ -267,26 +267,26 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function pre_fetch() {
269 269
 
270
-		if ( $this->step == 1 ) {
271
-			$this->delete_data( 'give_temp_reset_ids' );
270
+		if ($this->step == 1) {
271
+			$this->delete_data('give_temp_reset_ids');
272 272
 		}
273 273
 
274
-		$items = get_option( 'give_temp_reset_ids', false );
274
+		$items = get_option('give_temp_reset_ids', false);
275 275
 
276
-		if ( false === $items ) {
276
+		if (false === $items) {
277 277
 			$items = array();
278 278
 
279
-			$give_types_for_reset = array( 'give_forms', 'give_payment' );
280
-			$give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset );
279
+			$give_types_for_reset = array('give_forms', 'give_payment');
280
+			$give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset);
281 281
 
282
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
282
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
283 283
 				'post_type'      => $give_types_for_reset,
284 284
 				'post_status'    => 'any',
285
-				'posts_per_page' => - 1,
286
-			) );
285
+				'posts_per_page' => -1,
286
+			));
287 287
 
288
-			$posts = get_posts( $args );
289
-			foreach ( $posts as $post ) {
288
+			$posts = get_posts($args);
289
+			foreach ($posts as $post) {
290 290
 				$items[] = array(
291 291
 					'id'   => (int) $post->ID,
292 292
 					'type' => $post->post_type,
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 			}
295 295
 
296 296
 			$donor_args = array(
297
-				'number' => - 1,
297
+				'number' => -1,
298 298
 			);
299
-			$donors     = Give()->donors->get_donors( $donor_args );
300
-			foreach ( $donors as $donor ) {
299
+			$donors     = Give()->donors->get_donors($donor_args);
300
+			foreach ($donors as $donor) {
301 301
 				$items[] = array(
302 302
 					'id'   => (int) $donor->id,
303 303
 					'type' => 'customer',
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 
307 307
 			// Allow filtering of items to remove with an unassociative array for each item
308 308
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
309
-			$items = apply_filters( 'give_reset_items', $items );
309
+			$items = apply_filters('give_reset_items', $items);
310 310
 
311
-			$this->store_data( 'give_temp_reset_ids', $items );
311
+			$this->store_data('give_temp_reset_ids', $items);
312 312
 		}// End if().
313 313
 
314 314
 	}
@@ -322,17 +322,17 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return mixed       Returns the data from the database.
324 324
 	 */
325
-	private function get_stored_data( $key ) {
325
+	private function get_stored_data($key) {
326 326
 		global $wpdb;
327
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $key ) );
327
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $key));
328 328
 
329
-		if ( empty( $value ) ) {
329
+		if (empty($value)) {
330 330
 			return false;
331 331
 		}
332 332
 
333
-		$maybe_json = json_decode( $value );
334
-		if ( ! is_null( $maybe_json ) ) {
335
-			$value = json_decode( $value, true );
333
+		$maybe_json = json_decode($value);
334
+		if ( ! is_null($maybe_json)) {
335
+			$value = json_decode($value, true);
336 336
 		}
337 337
 
338 338
 		return (array) $value;
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return void
350 350
 	 */
351
-	private function store_data( $key, $value ) {
351
+	private function store_data($key, $value) {
352 352
 		global $wpdb;
353 353
 
354
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
354
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
355 355
 
356 356
 		$data = array(
357 357
 			'option_name'  => $key,
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			'%s',
366 366
 		);
367 367
 
368
-		$wpdb->replace( $wpdb->options, $data, $formats );
368
+		$wpdb->replace($wpdb->options, $data, $formats);
369 369
 	}
370 370
 
371 371
 	/**
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
 	 *
378 378
 	 * @return void
379 379
 	 */
380
-	private function delete_data( $key ) {
380
+	private function delete_data($key) {
381 381
 		global $wpdb;
382
-		$wpdb->delete( $wpdb->options, array(
382
+		$wpdb->delete($wpdb->options, array(
383 383
 			'option_name' => $key,
384
-		) );
384
+		));
385 385
 	}
386 386
 
387 387
 }
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-income.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -61,33 +61,33 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function get_data() {
63 63
 
64
-		if ( $this->step == 1 ) {
65
-			$this->delete_data( 'give_temp_recount_earnings' );
64
+		if ($this->step == 1) {
65
+			$this->delete_data('give_temp_recount_earnings');
66 66
 		}
67 67
 
68
-		$total = get_option( 'give_temp_recount_earnings', false );
68
+		$total = get_option('give_temp_recount_earnings', false);
69 69
 
70
-		if ( false === $total ) {
70
+		if (false === $total) {
71 71
 			$total = (float) 0;
72
-			$this->store_data( 'give_temp_recount_earnings', $total );
72
+			$this->store_data('give_temp_recount_earnings', $total);
73 73
 		}
74 74
 
75
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
75
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
76 76
 
77
-		$args = apply_filters( 'give_recount_earnings_args', array(
77
+		$args = apply_filters('give_recount_earnings_args', array(
78 78
 			'number' => $this->per_step,
79 79
 			'page'   => $this->step,
80 80
 			'status' => $accepted_statuses,
81 81
 			'fields' => 'ids'
82
-		) );
82
+		));
83 83
 
84
-		$payments = give_get_payments( $args );
84
+		$payments = give_get_payments($args);
85 85
 
86
-		if ( ! empty( $payments ) ) {
86
+		if ( ! empty($payments)) {
87 87
 
88
-			foreach ( $payments as $payment ) {
88
+			foreach ($payments as $payment) {
89 89
 				// Get the payment amount.
90
-				$payment_amount = give_get_meta( $payment->ID, '_give_payment_total', true );
90
+				$payment_amount = give_get_meta($payment->ID, '_give_payment_total', true);
91 91
 
92 92
 				/**
93 93
 				 * Filter the payment amount.
@@ -96,28 +96,28 @@  discard block
 block discarded – undo
96 96
 				 */
97 97
 				$donation_amount = apply_filters(
98 98
 					'give_donation_amount',
99
-					give_format_amount( $payment_amount, array( 'donation_id' => $payment->ID ) ),
99
+					give_format_amount($payment_amount, array('donation_id' => $payment->ID)),
100 100
 					$payment->total,
101 101
 					$payment->ID,
102
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
102
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
103 103
 				);
104 104
 
105
-				$total += (float) give_maybe_sanitize_amount( $donation_amount );
105
+				$total += (float) give_maybe_sanitize_amount($donation_amount);
106 106
 			}
107 107
 
108
-			if ( $total < 0 ) {
108
+			if ($total < 0) {
109 109
 				$totals = 0;
110 110
 			}
111 111
 
112
-			$total = round( $total, give_get_price_decimals() );
112
+			$total = round($total, give_get_price_decimals());
113 113
 
114
-			$this->store_data( 'give_temp_recount_earnings', $total );
114
+			$this->store_data('give_temp_recount_earnings', $total);
115 115
 
116 116
 			return true;
117 117
 
118 118
 		}
119 119
 
120
-		update_option( 'give_earnings_total', $total, false );
120
+		update_option('give_earnings_total', $total, false);
121 121
 
122 122
 		return false;
123 123
 
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function get_percentage_complete() {
133 133
 
134
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
134
+		$total = $this->get_stored_data('give_recount_earnings_total');
135 135
 
136
-		if ( false === $total ) {
137
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
136
+		if (false === $total) {
137
+			$args = apply_filters('give_recount_earnings_total_args', array());
138 138
 
139
-			$counts = give_count_payments( $args );
140
-			$total  = absint( $counts->publish );
141
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
139
+			$counts = give_count_payments($args);
140
+			$total  = absint($counts->publish);
141
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
142 142
 
143
-			$this->store_data( 'give_recount_earnings_total', $total );
143
+			$this->store_data('give_recount_earnings_total', $total);
144 144
 		}
145 145
 
146 146
 		$percentage = 100;
147 147
 
148
-		if ( $total > 0 ) {
149
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
148
+		if ($total > 0) {
149
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
150 150
 		}
151 151
 
152
-		if ( $percentage > 100 ) {
152
+		if ($percentage > 100) {
153 153
 			$percentage = 100;
154 154
 		}
155 155
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @param array $request The Form Data passed into the batch processing
165 165
 	 */
166
-	public function set_properties( $request ) {
166
+	public function set_properties($request) {
167 167
 	}
168 168
 
169 169
 	/**
@@ -174,21 +174,21 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function process_step() {
176 176
 
177
-		if ( ! $this->can_export() ) {
178
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
177
+		if ( ! $this->can_export()) {
178
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
179 179
 		}
180 180
 
181 181
 		$had_data = $this->get_data();
182 182
 
183
-		if ( $had_data ) {
183
+		if ($had_data) {
184 184
 			$this->done = false;
185 185
 
186 186
 			return true;
187 187
 		} else {
188
-			$this->delete_data( 'give_recount_earnings_total' );
189
-			$this->delete_data( 'give_temp_recount_earnings' );
188
+			$this->delete_data('give_recount_earnings_total');
189
+			$this->delete_data('give_temp_recount_earnings');
190 190
 			$this->done    = true;
191
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
191
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
192 192
 
193 193
 			return false;
194 194
 		}
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return mixed       Returns the data from the database
227 227
 	 */
228
-	private function get_stored_data( $key ) {
228
+	private function get_stored_data($key) {
229 229
 		global $wpdb;
230
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
230
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
231 231
 
232
-		if ( empty( $value ) ) {
232
+		if (empty($value)) {
233 233
 			return false;
234 234
 		}
235 235
 
236
-		$maybe_json = json_decode( $value );
237
-		if ( ! is_null( $maybe_json ) ) {
238
-			$value = json_decode( $value, true );
236
+		$maybe_json = json_decode($value);
237
+		if ( ! is_null($maybe_json)) {
238
+			$value = json_decode($value, true);
239 239
 		}
240 240
 
241 241
 		return $value;
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return void
253 253
 	 */
254
-	private function store_data( $key, $value ) {
254
+	private function store_data($key, $value) {
255 255
 		global $wpdb;
256 256
 
257
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
257
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
258 258
 
259 259
 		$data = array(
260 260
 			'option_name'  => $key,
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			'%s',
269 269
 		);
270 270
 
271
-		$wpdb->replace( $wpdb->options, $data, $formats );
271
+		$wpdb->replace($wpdb->options, $data, $formats);
272 272
 	}
273 273
 
274 274
 	/**
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return void
282 282
 	 */
283
-	private function delete_data( $key ) {
283
+	private function delete_data($key) {
284 284
 		global $wpdb;
285
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
285
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
286 286
 	}
287 287
 
288 288
 }
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 	 * @return array|bool $data The data for the CSV file
63 63
 	 */
64 64
 	public function get_data() {
65
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids' );
65
+		$items = $this->get_stored_data('give_temp_delete_test_ids');
66 66
 
67
-		if ( ! is_array( $items ) ) {
67
+		if ( ! is_array($items)) {
68 68
 			return false;
69 69
 		}
70 70
 
71
-		$offset     = ( $this->step - 1 ) * $this->per_step;
72
-		$step_items = array_slice( $items, $offset, $this->per_step );
73
-		$meta_table = __give_v20_bc_table_details( 'payment' );
71
+		$offset     = ($this->step - 1) * $this->per_step;
72
+		$step_items = array_slice($items, $offset, $this->per_step);
73
+		$meta_table = __give_v20_bc_table_details('payment');
74 74
 
75
-		if ( $step_items ) {
76
-			foreach ( $step_items as $item ) {
75
+		if ($step_items) {
76
+			foreach ($step_items as $item) {
77 77
 				// Delete the main payment.
78
-				give_delete_donation( absint( $item['id'] ) );
78
+				give_delete_donation(absint($item['id']));
79 79
 			}
80 80
 			return true;
81 81
 		}
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_percentage_complete() {
93 93
 
94
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids', false );
95
-		$total = count( $items );
94
+		$items = $this->get_stored_data('give_temp_delete_test_ids', false);
95
+		$total = count($items);
96 96
 
97 97
 		$percentage = 100;
98 98
 
99
-		if ( $total > 0 ) {
100
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
99
+		if ($total > 0) {
100
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
101 101
 		}
102 102
 
103
-		if ( $percentage > 100 ) {
103
+		if ($percentage > 100) {
104 104
 			$percentage = 100;
105 105
 		}
106 106
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $request The Form Data passed into the batch processing
116 116
 	 */
117
-	public function set_properties( $request ) {
117
+	public function set_properties($request) {
118 118
 	}
119 119
 
120 120
 	/**
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function process_step() {
127 127
 
128
-		if ( ! $this->can_export() ) {
129
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
128
+		if ( ! $this->can_export()) {
129
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
130 130
 		}
131 131
 
132 132
 		$had_data = $this->get_data();
133 133
 
134
-		if ( $had_data ) {
134
+		if ($had_data) {
135 135
 			$this->done = false;
136 136
 
137 137
 			return true;
138 138
 		} else {
139
-			update_option( 'give_earnings_total', give_get_total_earnings( true ), false );
140
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
139
+			update_option('give_earnings_total', give_get_total_earnings(true), false);
140
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
141 141
 
142
-			$this->delete_data( 'give_temp_delete_test_ids' );
142
+			$this->delete_data('give_temp_delete_test_ids');
143 143
 
144 144
 			$this->done    = true;
145
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
145
+			$this->message = __('Test transactions successfully deleted.', 'give');
146 146
 
147 147
 			return false;
148 148
 		}
@@ -175,27 +175,27 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function pre_fetch() {
177 177
 
178
-		if ( $this->step == 1 ) {
179
-			$this->delete_data( 'give_temp_delete_test_ids' );
178
+		if ($this->step == 1) {
179
+			$this->delete_data('give_temp_delete_test_ids');
180 180
 		}
181 181
 
182
-		$items = get_option( 'give_temp_delete_test_ids', false );
182
+		$items = get_option('give_temp_delete_test_ids', false);
183 183
 
184
-		if ( false === $items ) {
184
+		if (false === $items) {
185 185
 			$items = array();
186 186
 
187
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
187
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
188 188
 				'post_status' => 'any',
189
-				'number'      => - 1,
189
+				'number'      => -1,
190 190
 				'meta_key'    => '_give_payment_mode',
191 191
 				'meta_value'  => 'test'
192
-			) );
192
+			));
193 193
 
194
-			$posts    = new Give_Payments_Query( $args );
194
+			$posts    = new Give_Payments_Query($args);
195 195
 			$payments = $posts->get_payments();
196 196
 
197 197
 			/* @var Give_Payment $payment */
198
-			foreach ( $payments as $payment ) {
198
+			foreach ($payments as $payment) {
199 199
 				$items[] = array(
200 200
 					'id'   => (int) $payment->ID,
201 201
 					'type' => 'give_payment',
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 			// Allow filtering of items to remove with an unassociative array for each item.
206 206
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
207
-			$items = apply_filters( 'give_delete_test_items', $items );
207
+			$items = apply_filters('give_delete_test_items', $items);
208 208
 
209
-			$this->store_data( 'give_temp_delete_test_ids', $items );
209
+			$this->store_data('give_temp_delete_test_ids', $items);
210 210
 		}
211 211
 
212 212
 	}
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return mixed       Returns the data from the database
222 222
 	 */
223
-	private function get_stored_data( $key ) {
223
+	private function get_stored_data($key) {
224 224
 		global $wpdb;
225
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
225
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
226 226
 
227
-		if ( empty( $value ) ) {
227
+		if (empty($value)) {
228 228
 			return false;
229 229
 		}
230 230
 
231
-		$maybe_json = json_decode( $value );
232
-		if ( ! is_null( $maybe_json ) ) {
233
-			$value = json_decode( $value, true );
231
+		$maybe_json = json_decode($value);
232
+		if ( ! is_null($maybe_json)) {
233
+			$value = json_decode($value, true);
234 234
 		}
235 235
 
236 236
 		return $value;
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return void
248 248
 	 */
249
-	private function store_data( $key, $value ) {
249
+	private function store_data($key, $value) {
250 250
 		global $wpdb;
251 251
 
252
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
252
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
253 253
 
254 254
 		$data = array(
255 255
 			'option_name'  => $key,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			'%s',
264 264
 		);
265 265
 
266
-		$wpdb->replace( $wpdb->options, $data, $formats );
266
+		$wpdb->replace($wpdb->options, $data, $formats);
267 267
 	}
268 268
 
269 269
 	/**
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return void
277 277
 	 */
278
-	private function delete_data( $key ) {
278
+	private function delete_data($key) {
279 279
 		global $wpdb;
280
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
280
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
281 281
 	}
282 282
 
283 283
 }
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-donors.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	/**
99 99
 	 * Constructor.
100 100
 	 */
101
-	public function __construct( $_step = 1 ) {
102
-		parent::__construct( $_step );
101
+	public function __construct($_step = 1) {
102
+		parent::__construct($_step);
103 103
 
104 104
 		$this->is_writable = true;
105 105
 	}
@@ -118,32 +118,32 @@  discard block
 block discarded – undo
118 118
 		$donor_ids    = array();
119 119
 
120 120
 		// Check if the ajax request if running for the first time.
121
-		if ( 1 === (int) $this->step ) {
121
+		if (1 === (int) $this->step) {
122 122
 			// Delete all the donation ids.
123
-			$this->delete_option( $this->donation_key );
123
+			$this->delete_option($this->donation_key);
124 124
 			// Delete all the donor ids.
125
-			$this->delete_option( $this->donor_key );
125
+			$this->delete_option($this->donor_key);
126 126
 
127 127
 			// Delete all the step and set to 'count' which if the first step in the process of deleting the donors.
128
-			$this->update_option( $this->step_key, 'count' );
128
+			$this->update_option($this->step_key, 'count');
129 129
 
130 130
 			// Delete tha page count of the step.
131
-			$this->update_option( $this->step_on_key, '0' );
131
+			$this->update_option($this->step_on_key, '0');
132 132
 		} else {
133 133
 			// Get the old donors list.
134
-			$donor_ids = $this->get_option( $this->donor_key );
134
+			$donor_ids = $this->get_option($this->donor_key);
135 135
 
136 136
 			// Get the old donation list.
137
-			$donation_ids = $this->get_option( $this->donation_key );
137
+			$donation_ids = $this->get_option($this->donation_key);
138 138
 		}
139 139
 
140 140
 		// Get the step and check for it if it's on the first step( 'count' ) or not.
141 141
 		$step = (int) $this->get_step();
142
-		if ( 1 === $step ) {
142
+		if (1 === $step) {
143 143
 			/**
144 144
 			 * Will add or update the donation and donor data by running wp query.
145 145
 			 */
146
-			$this->count( $step, $donation_ids, $donor_ids );
146
+			$this->count($step, $donation_ids, $donor_ids);
147 147
 		}
148 148
 	}
149 149
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 * @param array $donation_ids Contain the list of all the donation id's that has being add before this
155 155
 	 * @param array $donor_ids Contain the list of all the donors id's that has being add before this
156 156
 	 */
157
-	private function count( $step, $donation_ids = array(), $donor_ids = array() ) {
157
+	private function count($step, $donation_ids = array(), $donor_ids = array()) {
158 158
 
159 159
 		// Get the Page count by default it's zero.
160 160
 		$paged = (int) $this->get_step_page();
161 161
 		// Incresed the page count by one.
162
-		++ $paged;
162
+		++$paged;
163 163
 
164 164
 		/**
165 165
 		 * Filter add to alter the argument before the wp quest run
166 166
 		 */
167
-		$args = apply_filters( 'give_tools_reset_stats_total_args', array(
167
+		$args = apply_filters('give_tools_reset_stats_total_args', array(
168 168
 			'post_type'      => 'give_payment',
169 169
 			'post_status'    => 'any',
170 170
 			'posts_per_page' => $this->per_step,
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
 			// ONLY TEST MODE TRANSACTIONS!!!
173 173
 			'meta_key'       => '_give_payment_mode',
174 174
 			'meta_value'     => 'test',
175
-		) );
175
+		));
176 176
 
177 177
 		// Reset the post data.
178 178
 		wp_reset_postdata();
179 179
 		// Getting the new donation.
180
-		$donation_posts = new WP_Query( $args );
180
+		$donation_posts = new WP_Query($args);
181 181
 
182 182
 		// The Loop.
183
-		if ( $donation_posts->have_posts() ) {
184
-			while ( $donation_posts->have_posts() ) {
183
+		if ($donation_posts->have_posts()) {
184
+			while ($donation_posts->have_posts()) {
185 185
 				$donation_posts->the_post();
186 186
 				global $post;
187 187
 				// Add the donation id in side the array.
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 		$max_num_pages = (int) $donation_posts->max_num_pages;
201 201
 
202 202
 		// Check current page is less then max number of page or not
203
-		if ( $paged < $max_num_pages ) {
203
+		if ($paged < $max_num_pages) {
204 204
 			// Update the curretn page virable for the next step
205
-			$this->update_option( $this->step_on_key, $paged );
205
+			$this->update_option($this->step_on_key, $paged);
206 206
 
207 207
 			// Calculating percentage.
208 208
 			$page_remain          = $max_num_pages - $paged;
209
-			$this->total_step     = (int) $max_num_pages + ( $total_donation / $this->per_step ) + ( ( $page_remain * 2 ) * count( $donor_ids ) );
209
+			$this->total_step     = (int) $max_num_pages + ($total_donation / $this->per_step) + (($page_remain * 2) * count($donor_ids));
210 210
 			$this->step_completed = $paged;
211 211
 		} else {
212
-			$donation_ids_count = count( $donor_ids );
213
-			$this->update_option( $this->step_key, 'donation' );
214
-			$this->update_option( $this->step_on_key, '0' );
212
+			$donation_ids_count = count($donor_ids);
213
+			$this->update_option($this->step_key, 'donation');
214
+			$this->update_option($this->step_on_key, '0');
215 215
 		}
216 216
 
217
-		$donor_ids = array_unique( $donor_ids );
218
-		$this->update_option( $this->donor_key, $donor_ids );
219
-		$this->update_option( $this->donation_key, $donation_ids );
217
+		$donor_ids = array_unique($donor_ids);
218
+		$this->update_option($this->donor_key, $donor_ids);
219
+		$this->update_option($this->donation_key, $donation_ids);
220 220
 
221 221
 		wp_reset_postdata();
222 222
 	}
@@ -228,33 +228,33 @@  discard block
 block discarded – undo
228 228
 	 * @return int
229 229
 	 */
230 230
 	public function get_percentage_complete() {
231
-		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
231
+		return ceil((100 * $this->step_completed) / $this->total_step);
232 232
 	}
233 233
 
234 234
 	public function process_step() {
235 235
 
236
-		if ( ! $this->can_export() ) {
236
+		if ( ! $this->can_export()) {
237 237
 			wp_die(
238
-				esc_html__( 'You do not have permission to delete test transactions.', 'give' ),
239
-				esc_html__( 'Error', 'give' ),
240
-				array( 'response' => 403 )
238
+				esc_html__('You do not have permission to delete test transactions.', 'give'),
239
+				esc_html__('Error', 'give'),
240
+				array('response' => 403)
241 241
 			);
242 242
 		}
243 243
 
244 244
 		$had_data = $this->get_data();
245 245
 
246
-		if ( $had_data ) {
246
+		if ($had_data) {
247 247
 			$this->done = false;
248 248
 
249 249
 			return true;
250 250
 		} else {
251
-			update_option( 'give_earnings_total', give_get_total_earnings( true ), false );
252
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
251
+			update_option('give_earnings_total', give_get_total_earnings(true), false);
252
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
253 253
 
254
-			$this->delete_option( $this->donation_key );
254
+			$this->delete_option($this->donation_key);
255 255
 
256 256
 			$this->done    = true;
257
-			$this->message = __( 'Test donor and transactions successfully deleted.', 'give' );
257
+			$this->message = __('Test donor and transactions successfully deleted.', 'give');
258 258
 
259 259
 			return false;
260 260
 		}
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 	public function get_data() {
273 273
 
274 274
 		// Get the donation id's.
275
-		$donation_ids = $this->get_option( $this->donation_key );
275
+		$donation_ids = $this->get_option($this->donation_key);
276 276
 
277 277
 		/**
278 278
 		 * Return false id not test donation is found.
279 279
 		 */
280
-		if ( empty( $donation_ids ) ) {
280
+		if (empty($donation_ids)) {
281 281
 			$this->is_empty   = true;
282 282
 			$this->total_step = 1;
283 283
 
@@ -288,68 +288,68 @@  discard block
 block discarded – undo
288 288
 		$step = (int) $this->get_step();
289 289
 
290 290
 		// get teh donor ids.
291
-		$donor_ids = $this->get_option( $this->donor_key );
291
+		$donor_ids = $this->get_option($this->donor_key);
292 292
 
293 293
 		// In step to we delete all the donation in loop.
294
-		if ( 2 === $step ) {
294
+		if (2 === $step) {
295 295
 			$pass_to_donor = false;
296 296
 			$page          = (int) $this->get_step_page();
297
-			$page ++;
298
-			$count = count( $donation_ids );
297
+			$page++;
298
+			$count = count($donation_ids);
299 299
 
300
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
300
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
301 301
 			$this->step_completed = $page;
302 302
 
303
-			if ( $count > $this->per_step ) {
303
+			if ($count > $this->per_step) {
304 304
 
305
-				$this->update_option( $this->step_on_key, $page );
306
-				$donation_ids = $this->get_delete_ids( $donation_ids, $page );
307
-				$current_page = (int) ceil( $count / $this->per_step );
305
+				$this->update_option($this->step_on_key, $page);
306
+				$donation_ids = $this->get_delete_ids($donation_ids, $page);
307
+				$current_page = (int) ceil($count / $this->per_step);
308 308
 
309
-				if ( $page === $current_page ) {
309
+				if ($page === $current_page) {
310 310
 					$pass_to_donor = true;
311 311
 				}
312 312
 			} else {
313 313
 				$pass_to_donor = true;
314 314
 			}
315 315
 
316
-			if ( true === $pass_to_donor ) {
317
-				$this->update_option( $this->step_key, 'donor' );
318
-				$this->update_option( $this->step_on_key, '0' );
316
+			if (true === $pass_to_donor) {
317
+				$this->update_option($this->step_key, 'donor');
318
+				$this->update_option($this->step_on_key, '0');
319 319
 			}
320 320
 
321
-			foreach ( $donation_ids as $item ) {
321
+			foreach ($donation_ids as $item) {
322 322
 				// Delete the main payment.
323
-				give_delete_donation( absint( $item ) );
323
+				give_delete_donation(absint($item));
324 324
 			}
325
-			do_action( 'give_delete_log_cache' );
325
+			do_action('give_delete_log_cache');
326 326
 		}
327 327
 
328 328
 		// Here we delete all the donor
329
-		if ( 3 === $step ) {
329
+		if (3 === $step) {
330 330
 			$page  = (int) $this->get_step_page();
331
-			$count = count( $donor_ids );
331
+			$count = count($donor_ids);
332 332
 
333
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
334
-			$this->step_completed = $page + ( count( $donation_ids ) / $this->per_step );
333
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
334
+			$this->step_completed = $page + (count($donation_ids) / $this->per_step);
335 335
 
336
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
336
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
337 337
 				'post_type'      => 'give_payment',
338 338
 				'post_status'    => 'any',
339 339
 				'posts_per_page' => 1,
340 340
 				'meta_key'       => '_give_payment_mode',
341 341
 				'meta_value'     => 'live',
342
-				'author'         => $donor_ids[ $page ],
343
-			) );
342
+				'author'         => $donor_ids[$page],
343
+			));
344 344
 
345
-			$donation_posts = get_posts( $args );
346
-			if ( empty( $donation_posts ) ) {
347
-				Give()->donors->delete_by_user_id( $donor_ids[ $page ] );
345
+			$donation_posts = get_posts($args);
346
+			if (empty($donation_posts)) {
347
+				Give()->donors->delete_by_user_id($donor_ids[$page]);
348 348
 			}
349 349
 
350
-			$page ++;
351
-			$this->update_option( $this->step_on_key, $page );
352
-			if ( $count === $page ) {
350
+			$page++;
351
+			$this->update_option($this->step_on_key, $page);
352
+			if ($count === $page) {
353 353
 				$this->is_empty = false;
354 354
 
355 355
 				return false;
@@ -361,24 +361,24 @@  discard block
 block discarded – undo
361 361
 		return true;
362 362
 	}
363 363
 
364
-	public function get_delete_ids( $donation_ids, $page ) {
365
-		$index            = $page --;
366
-		$count            = count( $donation_ids );
364
+	public function get_delete_ids($donation_ids, $page) {
365
+		$index            = $page--;
366
+		$count            = count($donation_ids);
367 367
 		$temp             = 0;
368 368
 		$current_page     = 0;
369 369
 		$post_delete      = $this->per_step;
370 370
 		$page_donation_id = array();
371 371
 
372
-		foreach ( $donation_ids as $item ) {
373
-			$temp ++;
374
-			$page_donation_id[ $current_page ][] = $item;
375
-			if ( $temp === $post_delete ) {
376
-				$current_page ++;
372
+		foreach ($donation_ids as $item) {
373
+			$temp++;
374
+			$page_donation_id[$current_page][] = $item;
375
+			if ($temp === $post_delete) {
376
+				$current_page++;
377 377
 				$temp = 0;
378 378
 			}
379 379
 		}
380 380
 
381
-		return $page_donation_id[ $page ];
381
+		return $page_donation_id[$page];
382 382
 	}
383 383
 
384 384
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @return mixed       Returns the data from the database
392 392
 	 */
393
-	public function get_option( $key, $defalut_value = false ) {
394
-		return get_option( $key, $defalut_value );
393
+	public function get_option($key, $defalut_value = false) {
394
+		return get_option($key, $defalut_value);
395 395
 	}
396 396
 
397 397
 	/**
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	 *
405 405
 	 * @return void
406 406
 	 */
407
-	public function update_option( $key, $value ) {
408
-		update_option( $key, $value, false );
407
+	public function update_option($key, $value) {
408
+		update_option($key, $value, false);
409 409
 	}
410 410
 
411 411
 	/**
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * @return void
419 419
 	 */
420
-	public function delete_option( $key ) {
421
-		delete_option( $key );
420
+	public function delete_option($key) {
421
+		delete_option($key);
422 422
 	}
423 423
 
424 424
 	/**
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 * @return int|string
430 430
 	 */
431 431
 	private function get_step() {
432
-		$step_key = (string) $this->get_option( $this->step_key, false );
433
-		if ( 'count' === $step_key ) {
432
+		$step_key = (string) $this->get_option($this->step_key, false);
433
+		if ('count' === $step_key) {
434 434
 			return 1;
435
-		} elseif ( 'donation' === $step_key ) {
435
+		} elseif ('donation' === $step_key) {
436 436
 			return 2;
437
-		} elseif ( 'donor' === $step_key ) {
437
+		} elseif ('donor' === $step_key) {
438 438
 			return 3;
439 439
 		} else {
440 440
 			return $step_key;
@@ -445,6 +445,6 @@  discard block
 block discarded – undo
445 445
 	 * Get the current $page value in the ajax.
446 446
 	 */
447 447
 	private function get_step_page() {
448
-		return $this->get_option( $this->step_on_key, false );
448
+		return $this->get_option($this->step_on_key, false);
449 449
 	}
450 450
 }
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-donations.php 1 patch
Spacing   +231 added lines, -237 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.
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		 * @access private
67 67
 		 */
68 68
 		private function __construct() {
69
-			self::$per_page = ! empty( $_GET['per_page'] ) ? absint( $_GET['per_page'] ) : self::$per_page;
69
+			self::$per_page = ! empty($_GET['per_page']) ? absint($_GET['per_page']) : self::$per_page;
70 70
 		}
71 71
 
72 72
 		/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		 * @return static
79 79
 		 */
80 80
 		public static function get_instance() {
81
-			if ( null === static::$instance ) {
81
+			if (null === static::$instance) {
82 82
 				self::$instance = new static();
83 83
 			}
84 84
 
@@ -105,27 +105,27 @@  discard block
 block discarded – undo
105 105
 		 * @return void
106 106
 		 */
107 107
 		private function setup_hooks() {
108
-			if ( ! $this->is_donations_import_page() ) {
108
+			if ( ! $this->is_donations_import_page()) {
109 109
 				return;
110 110
 			}
111 111
 
112 112
 			// Do not render main import tools page.
113
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
113
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
114 114
 
115 115
 
116 116
 			// Render donation import page
117
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
117
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
118 118
 
119 119
 			// Print the HTML.
120
-			add_action( 'give_tools_import_donations_form_start', array( $this, 'html' ), 10 );
120
+			add_action('give_tools_import_donations_form_start', array($this, 'html'), 10);
121 121
 
122 122
 			// Run when form submit.
123
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
123
+			add_action('give-tools_save_import', array($this, 'save'));
124 124
 
125
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
125
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
126 126
 
127 127
 			// Used to add submit button.
128
-			add_action( 'give_tools_import_donations_form_end', array( $this, 'submit' ), 10 );
128
+			add_action('give_tools_import_donations_form_end', array($this, 'submit'), 10);
129 129
 		}
130 130
 
131 131
 		/**
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 		 *
138 138
 		 * @return mixed
139 139
 		 */
140
-		public function update_notices( $messages ) {
141
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
142
-				unset( $messages['give-setting-updated'] );
140
+		public function update_notices($messages) {
141
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
142
+				unset($messages['give-setting-updated']);
143 143
 			}
144 144
 
145 145
 			return $messages;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		 * @since 1.8.14
152 152
 		 */
153 153
 		public function submit() {
154
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
154
+			wp_nonce_field('give-save-settings', '_give-save-settings');
155 155
 			?>
156 156
 			<input type="hidden" class="import-step" id="import-step" name="step"
157 157
 				   value="<?php echo $this->get_step(); ?>"/>
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 			?>
173 173
 			<section>
174 174
 				<table
175
-						class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_csv_valid ) ? 'give-hidden' : '' ); ?>  "
175
+						class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_csv_valid) ? 'give-hidden' : ''); ?>  "
176 176
 						id="<?php echo "step-{$step}"; ?>">
177 177
 					<tbody>
178 178
 					<?php
179
-					switch ( $step ) {
179
+					switch ($step) {
180 180
 						case 1:
181 181
 							$this->render_media_csv();
182 182
 							break;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 						case 4:
193 193
 							$this->import_success();
194 194
 					}
195
-					if ( false === $this->check_for_dropdown_or_import() ) {
195
+					if (false === $this->check_for_dropdown_or_import()) {
196 196
 						?>
197 197
 						<tr valign="top">
198 198
 							<th>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 								        *
207 207
 								        * @since 2.1
208 208
 								        */
209
-								       echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) );
209
+								       echo apply_filters('give_import_donation_submit_button_text', __('Submit', 'give'));
210 210
 								       ?>
211 211
 											"/>
212 212
 							</th>
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 								 *
218 218
 								 * @since 2.1
219 219
 								 */
220
-								do_action( 'give_import_donation_submit_button' );
220
+								do_action('give_import_donation_submit_button');
221 221
 								?>
222 222
 							</th>
223 223
 						</tr>
@@ -237,70 +237,70 @@  discard block
 block discarded – undo
237 237
 		 */
238 238
 		public function import_success() {
239 239
 
240
-			$delete_csv = ( ! empty( $_GET['delete_csv'] ) ? absint( $_GET['delete_csv'] ) : false );
241
-			$csv        = ( ! empty( $_GET['csv'] ) ? absint( $_GET['csv'] ) : false );
242
-			if ( ! empty( $delete_csv ) && ! empty( $csv ) ) {
243
-				wp_delete_attachment( $csv, true );
240
+			$delete_csv = ( ! empty($_GET['delete_csv']) ? absint($_GET['delete_csv']) : false);
241
+			$csv        = ( ! empty($_GET['csv']) ? absint($_GET['csv']) : false);
242
+			if ( ! empty($delete_csv) && ! empty($csv)) {
243
+				wp_delete_attachment($csv, true);
244 244
 			}
245 245
 
246 246
 			$report = give_import_donation_report();
247 247
 
248 248
 			$report_html = array(
249 249
 				'duplicate_donor'    => array(
250
-					__( '%s duplicate %s detected', 'give' ),
251
-					__( '%s duplicate %s will be detected', 'give' ),
252
-					__( 'donor', 'give' ),
253
-					__( 'donors', 'give' ),
250
+					__('%s duplicate %s detected', 'give'),
251
+					__('%s duplicate %s will be detected', 'give'),
252
+					__('donor', 'give'),
253
+					__('donors', 'give'),
254 254
 				),
255 255
 				'create_donor'       => array(
256
-					__( '%s %s created', 'give' ),
257
-					__( '%s %s will be going to get created', 'give' ),
258
-					__( 'donor', 'give' ),
259
-					__( 'donors', 'give' ),
256
+					__('%s %s created', 'give'),
257
+					__('%s %s will be going to get created', 'give'),
258
+					__('donor', 'give'),
259
+					__('donors', 'give'),
260 260
 				),
261 261
 				'create_form'        => array(
262
-					__( '%s donation %s created', 'give' ),
263
-					__( '%s donation %s will be going to get created', 'give' ),
264
-					__( 'form', 'give' ),
265
-					__( 'forms', 'give' ),
262
+					__('%s donation %s created', 'give'),
263
+					__('%s donation %s will be going to get created', 'give'),
264
+					__('form', 'give'),
265
+					__('forms', 'give'),
266 266
 				),
267 267
 				'duplicate_donation' => array(
268
-					__( '%s duplicate %s detected', 'give' ),
269
-					__( '%s duplicate %s will be detected', 'give' ),
270
-					__( 'donation', 'give' ),
271
-					__( 'donations', 'give' ),
268
+					__('%s duplicate %s detected', 'give'),
269
+					__('%s duplicate %s will be detected', 'give'),
270
+					__('donation', 'give'),
271
+					__('donations', 'give'),
272 272
 				),
273 273
 				'create_donation'    => array(
274
-					__( '%s %s imported', 'give' ),
275
-					__( '%s %s will going to get imported', 'give' ),
276
-					__( 'donation', 'give' ),
277
-					__( 'donations', 'give' ),
274
+					__('%s %s imported', 'give'),
275
+					__('%s %s will going to get imported', 'give'),
276
+					__('donation', 'give'),
277
+					__('donations', 'give'),
278 278
 				),
279 279
 			);
280
-			$total       = (int) $_GET['total'];
281
-			-- $total;
280
+			$total = (int) $_GET['total'];
281
+			--$total;
282 282
 			$success = (bool) $_GET['success'];
283
-			$dry_run = empty( $_GET['dry_run'] ) ? 0 : absint( $_GET['dry_run'] );
283
+			$dry_run = empty($_GET['dry_run']) ? 0 : absint($_GET['dry_run']);
284 284
 			?>
285 285
 			<tr valign="top" class="give-import-dropdown">
286 286
 				<th colspan="2">
287 287
 					<h2>
288 288
 						<?php
289
-						if ( $success ) {
290
-							if ( $dry_run ) {
289
+						if ($success) {
290
+							if ($dry_run) {
291 291
 								printf(
292
-									_n( 'Dry run import complete! %s donation processed', 'Dry run import complete! %s donations processed', $total, 'give' ),
292
+									_n('Dry run import complete! %s donation processed', 'Dry run import complete! %s donations processed', $total, 'give'),
293 293
 									"<strong>{$total}</strong>"
294 294
 								);
295 295
 							} else {
296 296
 								printf(
297
-									_n( 'Import complete! %s donation processed', 'Import complete! %s donations processed', $total, 'give' ),
297
+									_n('Import complete! %s donation processed', 'Import complete! %s donations processed', $total, 'give'),
298 298
 									"<strong>{$total}</strong>"
299 299
 								);
300 300
 							}
301 301
 						} else {
302 302
 							printf(
303
-								_n( 'Failed to import %s donation', 'Failed to import %s donations', $total, 'give' ),
303
+								_n('Failed to import %s donation', 'Failed to import %s donations', $total, 'give'),
304 304
 								"<strong>{$total}</strong>"
305 305
 							);
306 306
 						}
@@ -308,16 +308,16 @@  discard block
 block discarded – undo
308 308
 					</h2>
309 309
 
310 310
 					<?php
311
-					$text      = __( 'Import Donation', 'give' );
311
+					$text      = __('Import Donation', 'give');
312 312
 					$query_arg = array(
313 313
 						'post_type' => 'give_forms',
314 314
 						'page'      => 'give-tools',
315 315
 						'tab'       => 'import',
316 316
 					);
317
-					if ( $success ) {
317
+					if ($success) {
318 318
 
319 319
 
320
-						if ( $dry_run ) {
320
+						if ($dry_run) {
321 321
 							$query_arg = array(
322 322
 								'post_type'     => 'give_forms',
323 323
 								'page'          => 'give-tools',
@@ -325,25 +325,25 @@  discard block
 block discarded – undo
325 325
 								'importer-type' => 'import_donations',
326 326
 							);
327 327
 
328
-							$text = __( 'Start Import', 'give' );
328
+							$text = __('Start Import', 'give');
329 329
 						} else {
330 330
 							$query_arg = array(
331 331
 								'post_type' => 'give_forms',
332 332
 								'page'      => 'give-payment-history',
333 333
 							);
334
-							$text      = __( 'View Donations', 'give' );
334
+							$text = __('View Donations', 'give');
335 335
 						}
336 336
 					}
337 337
 
338
-					foreach ( $report as $key => $value ) {
339
-						if ( array_key_exists( $key, $report_html ) && ! empty( $value ) ) {
340
-							$key_name = $report_html[ $key ][2];
341
-							if ( $value > 1 ) {
342
-								$key_name = $report_html[ $key ][3];
338
+					foreach ($report as $key => $value) {
339
+						if (array_key_exists($key, $report_html) && ! empty($value)) {
340
+							$key_name = $report_html[$key][2];
341
+							if ($value > 1) {
342
+								$key_name = $report_html[$key][3];
343 343
 							}
344 344
 							?>
345 345
 							<p>
346
-								<?php printf( $report_html[ $key ][ $dry_run ], $value, $key_name ); ?>
346
+								<?php printf($report_html[$key][$dry_run], $value, $key_name); ?>
347 347
 							</p>
348 348
 							<?php
349 349
 						}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 					<p>
354 354
 						<a class="button button-large button-secondary"
355
-						   href="<?php echo add_query_arg( $query_arg, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
355
+						   href="<?php echo add_query_arg($query_arg, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
356 356
 					</p>
357 357
 				</th>
358 358
 			</tr>
@@ -369,26 +369,26 @@  discard block
 block discarded – undo
369 369
 			give_import_donation_report_reset();
370 370
 
371 371
 			$csv         = (int) $_REQUEST['csv'];
372
-			$delimiter   = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
372
+			$delimiter   = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
373 373
 			$index_start = 1;
374 374
 			$index_end   = 1;
375 375
 			$next        = true;
376
-			$total       = self::get_csv_total( $csv );
377
-			if ( self::$per_page < $total ) {
378
-				$total_ajax = ceil( $total / self::$per_page );
376
+			$total       = self::get_csv_total($csv);
377
+			if (self::$per_page < $total) {
378
+				$total_ajax = ceil($total / self::$per_page);
379 379
 				$index_end  = self::$per_page;
380 380
 			} else {
381 381
 				$total_ajax = 1;
382 382
 				$index_end  = $total;
383 383
 				$next       = false;
384 384
 			}
385
-			$current_percentage = 100 / ( $total_ajax + 1 );
385
+			$current_percentage = 100 / ($total_ajax + 1);
386 386
 
387 387
 			?>
388 388
 			<tr valign="top" class="give-import-dropdown">
389 389
 				<th colspan="2">
390
-					<h2 id="give-import-title"><?php _e( 'Importing', 'give' ) ?></h2>
391
-					<p class="give-field-description"><?php _e( 'Your donations are now being imported...', 'give' ) ?></p>
390
+					<h2 id="give-import-title"><?php _e('Importing', 'give') ?></h2>
391
+					<p class="give-field-description"><?php _e('Your donations are now being imported...', 'give') ?></p>
392 392
 				</th>
393 393
 			</tr>
394 394
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 						<div style="width: <?php echo $current_percentage; ?>%"></div>
408 408
 					</div>
409 409
 					<input type="hidden" value="3" name="step">
410
-					<input type="hidden" value='<?php echo maybe_serialize( $_REQUEST['mapto'] ); ?>' name="mapto"
410
+					<input type="hidden" value='<?php echo maybe_serialize($_REQUEST['mapto']); ?>' name="mapto"
411 411
 						   class="mapto">
412 412
 					<input type="hidden" value="<?php echo $_REQUEST['csv']; ?>" name="csv" class="csv">
413 413
 					<input type="hidden" value="<?php echo $_REQUEST['mode']; ?>" name="mode" class="mode">
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 					<input type="hidden" value="<?php echo $_REQUEST['delete_csv']; ?>" name="delete_csv"
417 417
 						   class="delete_csv">
418 418
 					<input type="hidden" value="<?php echo $delimiter; ?>" name="delimiter">
419
-					<input type="hidden" value="<?php echo absint( $_REQUEST['dry_run'] ); ?>" name="dry_run">
419
+					<input type="hidden" value="<?php echo absint($_REQUEST['dry_run']); ?>" name="dry_run">
420 420
 					<input type="hidden"
421
-						   value='<?php echo maybe_serialize( self::get_importer( $csv, 0, $delimiter ) ); ?>'
421
+						   value='<?php echo maybe_serialize(self::get_importer($csv, 0, $delimiter)); ?>'
422 422
 						   name="main_key"
423 423
 						   class="main_key">
424 424
 				</th>
@@ -433,20 +433,20 @@  discard block
 block discarded – undo
433 433
 		 */
434 434
 		public function check_for_dropdown_or_import() {
435 435
 			$return = true;
436
-			if ( isset( $_REQUEST['mapto'] ) ) {
436
+			if (isset($_REQUEST['mapto'])) {
437 437
 				$mapto = (array) $_REQUEST['mapto'];
438
-				if ( false === in_array( 'form_title', $mapto ) && false === in_array( 'form_id', $mapto ) ) {
439
-					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' ) );
438
+				if (false === in_array('form_title', $mapto) && false === in_array('form_id', $mapto)) {
439
+					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'));
440 440
 					$return = false;
441 441
 				}
442 442
 
443
-				if ( false === in_array( 'amount', $mapto ) ) {
444
-					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' ) );
443
+				if (false === in_array('amount', $mapto)) {
444
+					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'));
445 445
 					$return = false;
446 446
 				}
447 447
 
448
-				if ( false === in_array( 'email', $mapto ) && false === in_array( 'donor_id', $mapto ) ) {
449
-					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' ) );
448
+				if (false === in_array('email', $mapto) && false === in_array('donor_id', $mapto)) {
449
+					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'));
450 450
 					$return = false;
451 451
 				}
452 452
 			} else {
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
 		 */
464 464
 		public function render_dropdown() {
465 465
 			$csv       = (int) $_GET['csv'];
466
-			$delimiter = ( ! empty( $_GET['delimiter'] ) ? give_clean( $_GET['delimiter'] ) : 'csv' );
466
+			$delimiter = ( ! empty($_GET['delimiter']) ? give_clean($_GET['delimiter']) : 'csv');
467 467
 
468 468
 			// TO check if the CSV files that is being add is valid or not if not then redirect to first step again
469
-			if ( ! $this->is_valid_csv( $csv ) ) {
469
+			if ( ! $this->is_valid_csv($csv)) {
470 470
 				$url = give_import_page_url();
471 471
 				?>
472 472
 				<input type="hidden" name="csv_not_valid" class="csv_not_valid" value="<?php echo $url; ?>"/>
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 				?>
476 476
 				<tr valign="top" class="give-import-dropdown">
477 477
 					<th colspan="2">
478
-						<h2 id="give-import-title"><?php _e( 'Map CSV fields to donations', 'give' ) ?></h2>
478
+						<h2 id="give-import-title"><?php _e('Map CSV fields to donations', 'give') ?></h2>
479 479
 
480
-						<p class="give-import-donation-required-fields-title"><?php _e( 'Required Fields' ); ?></p>
480
+						<p class="give-import-donation-required-fields-title"><?php _e('Required Fields'); ?></p>
481 481
 
482
-						<p class="give-field-description"><?php _e( 'These fields are required for the import to submitted' ); ?></p>
482
+						<p class="give-field-description"><?php _e('These fields are required for the import to submitted'); ?></p>
483 483
 
484 484
 						<ul class="give-import-donation-required-fields">
485 485
 							<li class="give-import-donation-required-email"
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
488 488
 								<span class="give-import-donation-required-text">
489 489
 									<?php
490
-									_e( 'Email Address', 'give' );
490
+									_e('Email Address', 'give');
491 491
 									?>
492 492
 								</span>
493 493
 							</li>
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
498 498
 								<span class="give-import-donation-required-text">
499 499
 									<?php
500
-									_e( 'First Name', 'give' );
500
+									_e('First Name', 'give');
501 501
 									?>
502 502
 								</span>
503 503
 							</li>
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
508 508
 								<span class="give-import-donation-required-text">
509 509
 									<?php
510
-									_e( 'Donation Amount', 'give' );
510
+									_e('Donation Amount', 'give');
511 511
 									?>
512 512
 								</span>
513 513
 							</li>
@@ -517,32 +517,32 @@  discard block
 block discarded – undo
517 517
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
518 518
 								<span class="give-import-donation-required-text">
519 519
 									<?php
520
-									_e( 'Form Title or ID', 'give' );
520
+									_e('Form Title or ID', 'give');
521 521
 									?>
522 522
 								</span>
523 523
 							</li>
524 524
 						</ul>
525 525
 
526
-						<p class="give-field-description"><?php _e( 'Select fields from your CSV file to map against donations fields or to ignore during import.', 'give' ) ?></p>
526
+						<p class="give-field-description"><?php _e('Select fields from your CSV file to map against donations fields or to ignore during import.', 'give') ?></p>
527 527
 					</th>
528 528
 				</tr>
529 529
 
530 530
 				<tr valign="top" class="give-import-dropdown">
531
-					<th><b><?php _e( 'Column name', 'give' ); ?></b></th>
532
-					<th><b><?php _e( 'Map to field', 'give' ); ?></b></th>
531
+					<th><b><?php _e('Column name', 'give'); ?></b></th>
532
+					<th><b><?php _e('Map to field', 'give'); ?></b></th>
533 533
 				</tr>
534 534
 
535 535
 				<?php
536
-				$raw_key = $this->get_importer( $csv, 0, $delimiter );
537
-				$mapto   = (array) ( isset( $_REQUEST['mapto'] ) ? $_REQUEST['mapto'] : array() );
536
+				$raw_key = $this->get_importer($csv, 0, $delimiter);
537
+				$mapto   = (array) (isset($_REQUEST['mapto']) ? $_REQUEST['mapto'] : array());
538 538
 
539
-				foreach ( $raw_key as $index => $value ) {
539
+				foreach ($raw_key as $index => $value) {
540 540
 					?>
541 541
 					<tr valign="top" class="give-import-option">
542 542
 						<th><?php echo $value; ?></th>
543 543
 						<th>
544 544
 							<?php
545
-							$this->get_columns( $index, $value, $mapto );
545
+							$this->get_columns($index, $value, $mapto);
546 546
 							?>
547 547
 						</th>
548 548
 					</tr>
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 		 *
558 558
 		 * @return string
559 559
 		 */
560
-		public function selected( $option_value, $value ) {
561
-			$option_value = strtolower( $option_value );
562
-			$value        = strtolower( $value );
560
+		public function selected($option_value, $value) {
561
+			$option_value = strtolower($option_value);
562
+			$value        = strtolower($value);
563 563
 
564 564
 			$selected = '';
565
-			if ( stristr( $value, $option_value ) ) {
565
+			if (stristr($value, $option_value)) {
566 566
 				$selected = 'selected';
567
-			} elseif ( strrpos( $value, 'give_' ) && stristr( $option_value, __( 'Import as Meta', 'give' ) ) ) {
567
+			} elseif (strrpos($value, 'give_') && stristr($option_value, __('Import as Meta', 'give'))) {
568 568
 				$selected = 'selected';
569 569
 			}
570 570
 
@@ -583,28 +583,28 @@  discard block
 block discarded – undo
583 583
 		 *
584 584
 		 * @return void
585 585
 		 */
586
-		private function get_columns( $index, $value = false, $mapto = array() ) {
586
+		private function get_columns($index, $value = false, $mapto = array()) {
587 587
 			$default       = give_import_default_options();
588
-			$current_mapto = (string) ( ! empty( $mapto[ $index ] ) ? $mapto[ $index ] : '' );
588
+			$current_mapto = (string) ( ! empty($mapto[$index]) ? $mapto[$index] : '');
589 589
 			?>
590 590
 			<select name="mapto[<?php echo $index; ?>]">
591
-				<?php $this->get_dropdown_option_html( $default, $current_mapto, $value ); ?>
591
+				<?php $this->get_dropdown_option_html($default, $current_mapto, $value); ?>
592 592
 
593
-				<optgroup label="<?php _e( 'Donations', 'give' ); ?>">
593
+				<optgroup label="<?php _e('Donations', 'give'); ?>">
594 594
 					<?php
595
-					$this->get_dropdown_option_html( give_import_donations_options(), $current_mapto, $value );
595
+					$this->get_dropdown_option_html(give_import_donations_options(), $current_mapto, $value);
596 596
 					?>
597 597
 				</optgroup>
598 598
 
599
-				<optgroup label="<?php _e( 'Donors', 'give' ); ?>">
599
+				<optgroup label="<?php _e('Donors', 'give'); ?>">
600 600
 					<?php
601
-					$this->get_dropdown_option_html( give_import_donor_options(), $current_mapto, $value );
601
+					$this->get_dropdown_option_html(give_import_donor_options(), $current_mapto, $value);
602 602
 					?>
603 603
 				</optgroup>
604 604
 
605
-				<optgroup label="<?php _e( 'Forms', 'give' ); ?>">
605
+				<optgroup label="<?php _e('Forms', 'give'); ?>">
606 606
 					<?php
607
-					$this->get_dropdown_option_html( give_import_donation_form_options(), $current_mapto, $value );
607
+					$this->get_dropdown_option_html(give_import_donation_form_options(), $current_mapto, $value);
608 608
 					?>
609 609
 				</optgroup>
610 610
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 				 *
616 616
 				 * @since 1.8.15
617 617
 				 */
618
-				do_action( 'give_import_dropdown_option', $index, $value, $mapto, $current_mapto );
618
+				do_action('give_import_dropdown_option', $index, $value, $mapto, $current_mapto);
619 619
 				?>
620 620
 			</select>
621 621
 			<?php
@@ -633,23 +633,23 @@  discard block
 block discarded – undo
633 633
 		 *
634 634
 		 * @return void
635 635
 		 */
636
-		public function get_dropdown_option_html( $options, $current_mapto, $value = false ) {
636
+		public function get_dropdown_option_html($options, $current_mapto, $value = false) {
637 637
 
638
-			foreach ( $options as $option => $option_value ) {
638
+			foreach ($options as $option => $option_value) {
639 639
 				$ignore = array();
640
-				if ( isset( $option_value['ignore'] ) ) {
640
+				if (isset($option_value['ignore'])) {
641 641
 					$ignore = $option_value['ignore'];
642
-					unset( $option_value['ignore'] );
642
+					unset($option_value['ignore']);
643 643
 				}
644 644
 
645 645
 				$option_value_texts = (array) $option_value;
646 646
 				$option_text        = $option_value_texts[0];
647 647
 
648
-				$checked = ( ( $current_mapto === $option ) ? 'selected' : false );
649
-				if ( empty( $checked ) && ! in_array( $value, $ignore ) ) {
650
-					foreach ( $option_value_texts as $option_value_text ) {
651
-						$checked = $this->selected( $option_value_text, $value );
652
-						if ( $checked ) {
648
+				$checked = (($current_mapto === $option) ? 'selected' : false);
649
+				if (empty($checked) && ! in_array($value, $ignore)) {
650
+					foreach ($option_value_texts as $option_value_text) {
651
+						$checked = $this->selected($option_value_text, $value);
652
+						if ($checked) {
653 653
 							break;
654 654
 						}
655 655
 					}
@@ -673,12 +673,12 @@  discard block
 block discarded – undo
673 673
 		 *
674 674
 		 * @return bool|int
675 675
 		 */
676
-		public function get_csv_total( $file_id ) {
676
+		public function get_csv_total($file_id) {
677 677
 			$total = false;
678
-			if ( $file_id ) {
679
-				$file_dir = get_attached_file( $file_id );
680
-				if ( $file_dir ) {
681
-					$total = $this->get_csv_data_from_file_dir( $file_dir );
678
+			if ($file_id) {
679
+				$file_dir = get_attached_file($file_id);
680
+				if ($file_dir) {
681
+					$total = $this->get_csv_data_from_file_dir($file_dir);
682 682
 				}
683 683
 			}
684 684
 
@@ -694,11 +694,11 @@  discard block
 block discarded – undo
694 694
 		 *
695 695
 		 * @return bool|int
696 696
 		 */
697
-		public function get_csv_data_from_file_dir( $file_dir ) {
697
+		public function get_csv_data_from_file_dir($file_dir) {
698 698
 			$total = false;
699
-			if ( $file_dir ) {
700
-				$file = new SplFileObject( $file_dir, 'r' );
701
-				$file->seek( PHP_INT_MAX );
699
+			if ($file_dir) {
700
+				$file = new SplFileObject($file_dir, 'r');
701
+				$file->seek(PHP_INT_MAX);
702 702
 				$total = $file->key() + 1;
703 703
 			}
704 704
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		 *
717 717
 		 * @return array|bool $raw_data title of the CSV file fields
718 718
 		 */
719
-		public function get_importer( $file_id, $index = 0, $delimiter = 'csv' ) {
719
+		public function get_importer($file_id, $index = 0, $delimiter = 'csv') {
720 720
 			/**
721 721
 			 * Filter to modify delimiter of Import.
722 722
 			 *
@@ -724,16 +724,16 @@  discard block
 block discarded – undo
724 724
 			 *
725 725
 			 * Return string $delimiter.
726 726
 			 */
727
-			$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
727
+			$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
728 728
 
729 729
 			$raw_data = false;
730
-			$file_dir = get_attached_file( $file_id );
731
-			if ( $file_dir ) {
732
-				if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
733
-					$raw_data = fgetcsv( $handle, $index, $delimiter );
730
+			$file_dir = get_attached_file($file_id);
731
+			if ($file_dir) {
732
+				if (false !== ($handle = fopen($file_dir, 'r'))) {
733
+					$raw_data = fgetcsv($handle, $index, $delimiter);
734 734
 					// Remove BOM signature from the first item.
735
-					if ( isset( $raw_data[0] ) ) {
736
-						$raw_data[0] = $this->remove_utf8_bom( $raw_data[0] );
735
+					if (isset($raw_data[0])) {
736
+						$raw_data[0] = $this->remove_utf8_bom($raw_data[0]);
737 737
 					}
738 738
 				}
739 739
 			}
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
 		 *
751 751
 		 * @return string
752 752
 		 */
753
-		public function remove_utf8_bom( $string ) {
754
-			if ( 'efbbbf' === substr( bin2hex( $string ), 0, 6 ) ) {
755
-				$string = substr( $string, 3 );
753
+		public function remove_utf8_bom($string) {
754
+			if ('efbbbf' === substr(bin2hex($string), 0, 6)) {
755
+				$string = substr($string, 3);
756 756
 			}
757 757
 
758 758
 			return $string;
@@ -767,17 +767,17 @@  discard block
 block discarded – undo
767 767
 			$step = $this->get_step();
768 768
 			?>
769 769
 			<ol class="give-progress-steps">
770
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
771
-					<?php _e( 'Upload CSV file', 'give' ); ?>
770
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
771
+					<?php _e('Upload CSV file', 'give'); ?>
772 772
 				</li>
773
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
774
-					<?php _e( 'Column mapping', 'give' ); ?>
773
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
774
+					<?php _e('Column mapping', 'give'); ?>
775 775
 				</li>
776
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
777
-					<?php _e( 'Import', 'give' ); ?>
776
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
777
+					<?php _e('Import', 'give'); ?>
778 778
 				</li>
779
-				<li class="<?php echo( 4 === $step ? 'active' : '' ); ?>">
780
-					<?php _e( 'Done!', 'give' ); ?>
779
+				<li class="<?php echo(4 === $step ? 'active' : ''); ?>">
780
+					<?php _e('Done!', 'give'); ?>
781 781
 				</li>
782 782
 			</ol>
783 783
 			<?php
@@ -791,16 +791,16 @@  discard block
 block discarded – undo
791 791
 		 * @return int $step on which step doest the import is on.
792 792
 		 */
793 793
 		public function get_step() {
794
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
794
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
795 795
 			$on_step = 1;
796 796
 
797
-			if ( empty( $step ) || 1 === $step ) {
797
+			if (empty($step) || 1 === $step) {
798 798
 				$on_step = 1;
799
-			} elseif ( $this->check_for_dropdown_or_import() ) {
799
+			} elseif ($this->check_for_dropdown_or_import()) {
800 800
 				$on_step = 3;
801
-			} elseif ( 2 === $step ) {
801
+			} elseif (2 === $step) {
802 802
 				$on_step = 2;
803
-			} elseif ( 4 === $step ) {
803
+			} elseif (4 === $step) {
804 804
 				$on_step = 4;
805 805
 			}
806 806
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		 * @since 1.8.14
814 814
 		 */
815 815
 		public function render_page() {
816
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-donations.php';
816
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-donations.php';
817 817
 		}
818 818
 
819 819
 		/**
@@ -822,18 +822,18 @@  discard block
 block discarded – undo
822 822
 		 * @since 2.1
823 823
 		 */
824 824
 		public function give_import_donation_submit_button_render_media_csv() {
825
-			$dry_run = isset( $_POST['dry_run'] ) ? absint( $_POST['dry_run'] ) : 1;
825
+			$dry_run = isset($_POST['dry_run']) ? absint($_POST['dry_run']) : 1;
826 826
 			?>
827 827
 			<div>
828 828
 				<label for="dry_run">
829 829
 					<input type="hidden" name="dry_run" value="0"/>
830 830
 					<input type="checkbox" name="dry_run" id="dry_run" class="dry_run"
831
-						   value="1" <?php checked( 1, $dry_run ); ?> >
832
-					<strong><?php _e( 'Dry Run', 'give' ); ?></strong>
831
+						   value="1" <?php checked(1, $dry_run); ?> >
832
+					<strong><?php _e('Dry Run', 'give'); ?></strong>
833 833
 				</label>
834 834
 				<p class="give-field-description">
835 835
 					<?php
836
-					_e( 'Preview what the import would look like without making any default changes to your site or your database.', 'give' );
836
+					_e('Preview what the import would look like without making any default changes to your site or your database.', 'give');
837 837
 					?>
838 838
 				</p>
839 839
 			</div>
@@ -849,8 +849,8 @@  discard block
 block discarded – undo
849 849
 		 *
850 850
 		 * @return string
851 851
 		 */
852
-		function give_import_donation_submit_text_render_media_csv( $text ) {
853
-			return __( 'Begin Import', 'give' );
852
+		function give_import_donation_submit_text_render_media_csv($text) {
853
+			return __('Begin Import', 'give');
854 854
 		}
855 855
 
856 856
 		/**
@@ -862,60 +862,57 @@  discard block
 block discarded – undo
862 862
 		 * @return void
863 863
 		 */
864 864
 		public function render_media_csv() {
865
-			add_filter( 'give_import_donation_submit_button_text', array(
865
+			add_filter('give_import_donation_submit_button_text', array(
866 866
 				$this,
867 867
 				'give_import_donation_submit_text_render_media_csv'
868
-			) );
869
-			add_action( 'give_import_donation_submit_button', array(
868
+			));
869
+			add_action('give_import_donation_submit_button', array(
870 870
 				$this,
871 871
 				'give_import_donation_submit_button_render_media_csv'
872
-			) );
872
+			));
873 873
 			?>
874 874
 			<tr valign="top">
875 875
 				<th colspan="2">
876
-					<h2 id="give-import-title"><?php _e( 'Import donations from a CSV file', 'give' ) ?></h2>
877
-					<p class="give-field-description"><?php _e( 'This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give' ) ?></p>
876
+					<h2 id="give-import-title"><?php _e('Import donations from a CSV file', 'give') ?></h2>
877
+					<p class="give-field-description"><?php _e('This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give') ?></p>
878 878
 				</th>
879 879
 			</tr>
880 880
 			<?php
881
-			$csv         = ( isset( $_POST['csv'] ) ? give_clean( $_POST['csv'] ) : '' );
882
-			$csv_id      = ( isset( $_POST['csv_id'] ) ? give_clean( $_POST['csv_id'] ) : '' );
883
-			$delimiter   = ( isset( $_POST['delimiter'] ) ? give_clean( $_POST['delimiter'] ) : 'csv' );
884
-			$mode        = empty( $_POST['mode'] ) ?
885
-				'disabled' :
886
-				( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? 'enabled' : 'disabled' );
887
-			$create_user = empty( $_POST['create_user'] ) ?
888
-				'disabled' :
889
-				( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? 'enabled' : 'disabled' );
890
-			$delete_csv  = empty( $_POST['delete_csv'] ) ?
891
-				'enabled' :
892
-				( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? 'enabled' : 'disabled' );
881
+			$csv         = (isset($_POST['csv']) ? give_clean($_POST['csv']) : '');
882
+			$csv_id      = (isset($_POST['csv_id']) ? give_clean($_POST['csv_id']) : '');
883
+			$delimiter   = (isset($_POST['delimiter']) ? give_clean($_POST['delimiter']) : 'csv');
884
+			$mode        = empty($_POST['mode']) ?
885
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? 'enabled' : 'disabled');
886
+			$create_user = empty($_POST['create_user']) ?
887
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? 'enabled' : 'disabled');
888
+			$delete_csv  = empty($_POST['delete_csv']) ?
889
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? 'enabled' : 'disabled');
893 890
 
894 891
 			// Reset csv and csv_id if csv
895
-			if ( empty( $csv_id ) || ! $this->is_valid_csv( $csv_id, $csv ) ) {
892
+			if (empty($csv_id) || ! $this->is_valid_csv($csv_id, $csv)) {
896 893
 				$csv_id = $csv = '';
897 894
 			}
898
-			$per_page = isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page;
895
+			$per_page = isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page;
899 896
 
900 897
 			$sample_file_text = sprintf(
901 898
 				'%s <a href="%s">%s</a>.',
902
-				__( 'Download the sample file', 'give' ),
903
-				esc_url( GIVE_PLUGIN_URL . 'sample-data/sample-data.csv' ),
904
-				__( 'here', 'give' )
899
+				__('Download the sample file', 'give'),
900
+				esc_url(GIVE_PLUGIN_URL.'sample-data/sample-data.csv'),
901
+				__('here', 'give')
905 902
 			);
906 903
 
907 904
 			$csv_description = sprintf(
908 905
 				'%1$s %2$s',
909
-				__( 'The file must be a Comma Seperated Version (CSV) file type only.', 'give' ),
906
+				__('The file must be a Comma Seperated Version (CSV) file type only.', 'give'),
910 907
 				$sample_file_text
911 908
 			);
912 909
 
913 910
 			$settings = array(
914 911
 				array(
915 912
 					'id'          => 'csv',
916
-					'name'        => __( 'Choose a CSV file:', 'give' ),
913
+					'name'        => __('Choose a CSV file:', 'give'),
917 914
 					'type'        => 'file',
918
-					'attributes'  => array( 'editing' => 'false', 'library' => 'text' ),
915
+					'attributes'  => array('editing' => 'false', 'library' => 'text'),
919 916
 					'description' => $csv_description,
920 917
 					'fvalue'      => 'url',
921 918
 					'default'     => $csv,
@@ -927,62 +924,62 @@  discard block
 block discarded – undo
927 924
 				),
928 925
 				array(
929 926
 					'id'          => 'delimiter',
930
-					'name'        => __( 'CSV Delimiter:', 'give' ),
931
-					'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' ),
927
+					'name'        => __('CSV Delimiter:', 'give'),
928
+					'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'),
932 929
 					'default'     => $delimiter,
933 930
 					'type'        => 'select',
934 931
 					'options'     => array(
935
-						'csv'                  => __( 'Comma', 'give' ),
936
-						'tab-separated-values' => __( 'Tab', 'give' ),
932
+						'csv'                  => __('Comma', 'give'),
933
+						'tab-separated-values' => __('Tab', 'give'),
937 934
 					),
938 935
 				),
939 936
 				array(
940 937
 					'id'          => 'mode',
941
-					'name'        => __( 'Test Mode:', 'give' ),
942
-					'description' => __( 'Select whether you would like these donations to be marked as "test" donations within the database. By default, they will be marked as live donations.', 'give' ),
938
+					'name'        => __('Test Mode:', 'give'),
939
+					'description' => __('Select whether you would like these donations to be marked as "test" donations within the database. By default, they will be marked as live donations.', 'give'),
943 940
 					'default'     => $mode,
944 941
 					'type'        => 'radio_inline',
945 942
 					'options'     => array(
946
-						'enabled'  => __( 'Enabled', 'give' ),
947
-						'disabled' => __( 'Disabled', 'give' ),
943
+						'enabled'  => __('Enabled', 'give'),
944
+						'disabled' => __('Disabled', 'give'),
948 945
 					),
949 946
 				),
950 947
 				array(
951 948
 					'id'          => 'create_user',
952
-					'name'        => __( 'Create WP users for new donors:', 'give' ),
953
-					'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' ),
949
+					'name'        => __('Create WP users for new donors:', 'give'),
950
+					'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'),
954 951
 					'default'     => $create_user,
955 952
 					'type'        => 'radio_inline',
956 953
 					'options'     => array(
957
-						'enabled'  => __( 'Enabled', 'give' ),
958
-						'disabled' => __( 'Disabled', 'give' ),
954
+						'enabled'  => __('Enabled', 'give'),
955
+						'disabled' => __('Disabled', 'give'),
959 956
 					),
960 957
 				),
961 958
 				array(
962 959
 					'id'          => 'delete_csv',
963
-					'name'        => __( 'Delete CSV after import:', 'give' ),
964
-					'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' ),
960
+					'name'        => __('Delete CSV after import:', 'give'),
961
+					'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'),
965 962
 					'default'     => $delete_csv,
966 963
 					'type'        => 'radio_inline',
967 964
 					'options'     => array(
968
-						'enabled'  => __( 'Enabled', 'give' ),
969
-						'disabled' => __( 'Disabled', 'give' ),
965
+						'enabled'  => __('Enabled', 'give'),
966
+						'disabled' => __('Disabled', 'give'),
970 967
 					),
971 968
 				),
972 969
 				array(
973 970
 					'id'          => 'per_page',
974
-					'name'        => __( 'Process Rows Per Batch:', 'give' ),
971
+					'name'        => __('Process Rows Per Batch:', 'give'),
975 972
 					'type'        => 'number',
976
-					'description' => __( 'Determine how many rows you would like to import per cycle.', 'give' ),
973
+					'description' => __('Determine how many rows you would like to import per cycle.', 'give'),
977 974
 					'default'     => $per_page,
978 975
 					'class'       => 'give-text-small',
979 976
 				),
980 977
 			);
981 978
 
982
-			$settings = apply_filters( 'give_import_file_upload_html', $settings );
979
+			$settings = apply_filters('give_import_file_upload_html', $settings);
983 980
 
984
-			if ( empty( $this->is_csv_valid ) ) {
985
-				Give_Admin_Settings::output_fields( $settings, 'give_settings' );
981
+			if (empty($this->is_csv_valid)) {
982
+				Give_Admin_Settings::output_fields($settings, 'give_settings');
986 983
 			} else {
987 984
 				?>
988 985
 				<input type="hidden" name="is_csv_valid" class="is_csv_valid"
@@ -1001,28 +998,25 @@  discard block
 block discarded – undo
1001 998
 			$step = $this->get_step();
1002 999
 
1003 1000
 			// Validation for first step.
1004
-			if ( 1 === $step ) {
1005
-				$csv_id = absint( $_POST['csv_id'] );
1001
+			if (1 === $step) {
1002
+				$csv_id = absint($_POST['csv_id']);
1006 1003
 
1007
-				if ( $this->is_valid_csv( $csv_id, esc_url( $_POST['csv'] ) ) ) {
1004
+				if ($this->is_valid_csv($csv_id, esc_url($_POST['csv']))) {
1008 1005
 
1009
-					$url = give_import_page_url( (array) apply_filters( 'give_import_step_two_url', array(
1006
+					$url = give_import_page_url((array) apply_filters('give_import_step_two_url', array(
1010 1007
 						'step'          => '2',
1011 1008
 						'importer-type' => $this->importer_type,
1012 1009
 						'csv'           => $csv_id,
1013
-						'delimiter'     => isset( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv',
1014
-						'mode'          => empty( $_POST['mode'] ) ?
1015
-							'0' :
1016
-							( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? '1' : '0' ),
1017
-						'create_user'   => empty( $_POST['create_user'] ) ?
1018
-							'0' :
1019
-							( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? '1' : '0' ),
1020
-						'delete_csv'    => empty( $_POST['delete_csv'] ) ?
1021
-							'1' :
1022
-							( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? '1' : '0' ),
1023
-						'per_page'      => isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page,
1024
-						'dry_run'       => isset( $_POST['dry_run'] ) ? absint( $_POST['dry_run'] ) : 0,
1025
-					) ) );
1010
+						'delimiter'     => isset($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv',
1011
+						'mode'          => empty($_POST['mode']) ?
1012
+							'0' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? '1' : '0'),
1013
+						'create_user'   => empty($_POST['create_user']) ?
1014
+							'0' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? '1' : '0'),
1015
+						'delete_csv'    => empty($_POST['delete_csv']) ?
1016
+							'1' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? '1' : '0'),
1017
+						'per_page'      => isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page,
1018
+						'dry_run'       => isset($_POST['dry_run']) ? absint($_POST['dry_run']) : 0,
1019
+					)));
1026 1020
 
1027 1021
 					$this->is_csv_valid = $url;
1028 1022
 				}
@@ -1040,25 +1034,25 @@  discard block
 block discarded – undo
1040 1034
 		 *
1041 1035
 		 * @return bool $has_error CSV is valid or not.
1042 1036
 		 */
1043
-		private function is_valid_csv( $csv = false, $match_url = '' ) {
1037
+		private function is_valid_csv($csv = false, $match_url = '') {
1044 1038
 			$is_valid_csv = true;
1045 1039
 
1046
-			if ( $csv ) {
1047
-				$csv_url = wp_get_attachment_url( $csv );
1040
+			if ($csv) {
1041
+				$csv_url = wp_get_attachment_url($csv);
1048 1042
 
1049
-				$delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
1043
+				$delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
1050 1044
 
1051 1045
 				if (
1052 1046
 					! $csv_url ||
1053
-					( ! empty( $match_url ) && ( $csv_url !== $match_url ) ) ||
1054
-					( ( $mime_type = get_post_mime_type( $csv ) ) && ! strpos( $mime_type, $delimiter ) )
1047
+					( ! empty($match_url) && ($csv_url !== $match_url)) ||
1048
+					(($mime_type = get_post_mime_type($csv)) && ! strpos($mime_type, $delimiter))
1055 1049
 				) {
1056 1050
 					$is_valid_csv = false;
1057
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
1051
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
1058 1052
 				}
1059 1053
 			} else {
1060 1054
 				$is_valid_csv = false;
1061
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
1055
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
1062 1056
 			}
1063 1057
 
1064 1058
 			return $is_valid_csv;
@@ -1074,8 +1068,8 @@  discard block
 block discarded – undo
1074 1068
 		 * @param $field
1075 1069
 		 * @param $option_value
1076 1070
 		 */
1077
-		public function render_import_field( $field, $option_value ) {
1078
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
1071
+		public function render_import_field($field, $option_value) {
1072
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
1079 1073
 		}
1080 1074
 
1081 1075
 		/**
@@ -1086,8 +1080,8 @@  discard block
 block discarded – undo
1086 1080
 		 */
1087 1081
 		private function is_donations_import_page() {
1088 1082
 			return 'import' === give_get_current_setting_tab() &&
1089
-			       isset( $_GET['importer-type'] ) &&
1090
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
1083
+			       isset($_GET['importer-type']) &&
1084
+			       $this->importer_type === give_clean($_GET['importer-type']);
1091 1085
 		}
1092 1086
 	}
1093 1087
 
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-core-settings.php 1 patch
Spacing   +75 added lines, -75 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.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		 * @return static
78 78
 		 */
79 79
 		public static function get_instance() {
80
-			if ( null === static::$instance ) {
80
+			if (null === static::$instance) {
81 81
 				self::$instance = new static();
82 82
 			}
83 83
 
@@ -104,26 +104,26 @@  discard block
 block discarded – undo
104 104
 		 * @return void
105 105
 		 */
106 106
 		private function setup_hooks() {
107
-			if ( ! $this->is_donations_import_page() ) {
107
+			if ( ! $this->is_donations_import_page()) {
108 108
 				return;
109 109
 			}
110 110
 
111 111
 			// Do not render main import tools page.
112
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
112
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
113 113
 
114 114
 			// Render donation import page
115
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
115
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
116 116
 
117 117
 			// Print the HTML.
118
-			add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 );
118
+			add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10);
119 119
 
120 120
 			// Run when form submit.
121
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
121
+			add_action('give-tools_save_import', array($this, 'save'));
122 122
 
123
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
123
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
124 124
 
125 125
 			// Used to add submit button.
126
-			add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 );
126
+			add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10);
127 127
 		}
128 128
 
129 129
 		/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 		 *
136 136
 		 * @return mixed
137 137
 		 */
138
-		public function update_notices( $messages ) {
139
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
140
-				unset( $messages['give-setting-updated'] );
138
+		public function update_notices($messages) {
139
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
140
+				unset($messages['give-setting-updated']);
141 141
 			}
142 142
 
143 143
 			return $messages;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @since 1.8.17
150 150
 		 */
151 151
 		public function submit() {
152
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
152
+			wp_nonce_field('give-save-settings', '_give-save-settings');
153 153
 			?>
154 154
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
155 155
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 			?>
170 170
 			<section>
171 171
 				<table
172
-					class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_json_valid ) ? 'give-hidden' : '' ); ?> "
172
+					class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_json_valid) ? 'give-hidden' : ''); ?> "
173 173
 					id="<?php echo "step-{$step}"; ?>">
174 174
 					<tbody>
175 175
 					<?php
176
-					switch ( $step ) {
176
+					switch ($step) {
177 177
 						case 1:
178 178
 							$this->render_upload_html();
179 179
 							break;
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		public function import_success() {
201 201
 			// Imported successfully
202 202
 
203
-			$success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false );
204
-			$undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false );
203
+			$success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false);
204
+			$undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false);
205 205
 			$query_arg_setting = array(
206 206
 				'post_type' => 'give_forms',
207 207
 				'page'      => 'give-settings',
208 208
 			);
209 209
 
210
-			if ( $undo ) {
210
+			if ($undo) {
211 211
 				$success = false;
212 212
 			}
213 213
 
@@ -220,30 +220,30 @@  discard block
 block discarded – undo
220 220
 				'undo'      => 'true',
221 221
 			);
222 222
 
223
-			$title = __( 'Settings Importing Completed!', 'give' );
224
-			if ( $success ) {
223
+			$title = __('Settings Importing Completed!', 'give');
224
+			if ($success) {
225 225
 				$query_arg_success['undo'] = '1';
226 226
 				$query_arg_success['step'] = '3';
227 227
 				$query_arg_success['success'] = '1';
228
-				$text = __( 'Undo Importing', 'give' );
228
+				$text = __('Undo Importing', 'give');
229 229
 			} else {
230
-				if ( $undo ) {
231
-					$host_give_options = get_option( 'give_settings_old', array() );
232
-					update_option( 'give_settings', $host_give_options, false );
233
-					$title = __( 'Undo of Setting Imported Completed!', 'give' );
230
+				if ($undo) {
231
+					$host_give_options = get_option('give_settings_old', array());
232
+					update_option('give_settings', $host_give_options, false);
233
+					$title = __('Undo of Setting Imported Completed!', 'give');
234 234
 				} else {
235
-					$title = __( 'Failed to import', 'give' );
235
+					$title = __('Failed to import', 'give');
236 236
 				}
237 237
 
238
-				$text = __( 'Importing Again', 'give' );
238
+				$text = __('Importing Again', 'give');
239 239
 			}
240 240
 			?>
241 241
 			<tr valign="top" class="give-import-dropdown">
242 242
 				<th colspan="2">
243 243
 					<h2><?php echo $title; ?></h2>
244 244
 					<p>
245
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
246
-						<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>
245
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
246
+						<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>
247 247
 					</p>
248 248
 				</th>
249 249
 			</tr>
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 		 * @since 1.8.17
257 257
 		 */
258 258
 		public function start_import() {
259
-			$type      = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' );
260
-			$file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' );
259
+			$type      = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace');
260
+			$file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : '');
261 261
 
262 262
 			?>
263 263
 			<tr valign="top" class="give-import-dropdown">
264 264
 				<th colspan="2">
265
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
266
-					<p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p>
265
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
266
+					<p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p>
267 267
 				</th>
268 268
 			</tr>
269 269
 
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 			$step = $this->get_step();
291 291
 			?>
292 292
 			<ol class="give-progress-steps">
293
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
294
-					<?php esc_html_e( 'Upload JSON file', 'give' ); ?>
293
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
294
+					<?php esc_html_e('Upload JSON file', 'give'); ?>
295 295
 				</li>
296
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
297
-					<?php esc_html_e( 'Import', 'give' ); ?>
296
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
297
+					<?php esc_html_e('Import', 'give'); ?>
298 298
 				</li>
299
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
300
-					<?php esc_html_e( 'Done!', 'give' ); ?>
299
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
300
+					<?php esc_html_e('Done!', 'give'); ?>
301 301
 				</li>
302 302
 			</ol>
303 303
 			<?php
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 		 * @return int $step on which step doest the import is on.
312 312
 		 */
313 313
 		public function get_step() {
314
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
314
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
315 315
 			$on_step = 1;
316 316
 
317
-			if ( empty( $step ) || 1 === $step ) {
317
+			if (empty($step) || 1 === $step) {
318 318
 				$on_step = 1;
319
-			} elseif ( 2 === $step ) {
319
+			} elseif (2 === $step) {
320 320
 				$on_step = 2;
321
-			} elseif ( 3 === $step ) {
321
+			} elseif (3 === $step) {
322 322
 				$on_step = 3;
323 323
 			}
324 324
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		 * @since 1.8.17
332 332
 		 */
333 333
 		public function render_page() {
334
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php';
334
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php';
335 335
 		}
336 336
 
337 337
 		/**
@@ -343,28 +343,28 @@  discard block
 block discarded – undo
343 343
 		 * @return void
344 344
 		 */
345 345
 		public function render_upload_html() {
346
-			$json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' );
347
-			$type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' );
346
+			$json = (isset($_POST['json']) ? give_clean($_POST['json']) : '');
347
+			$type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge');
348 348
 			$step = $this->get_step();
349 349
 
350 350
 			?>
351 351
 			<tr valign="top">
352 352
 				<th colspan="2">
353
-					<h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2>
354
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p>
353
+					<h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2>
354
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p>
355 355
 				</th>
356 356
 			</tr>
357 357
 
358 358
 			<tr valign="top">
359 359
 				<th scope="row" class="titledesc">
360
-					<label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label>
360
+					<label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label>
361 361
 				</th>
362 362
 				<td class="give-forminp">
363 363
 					<div class="give-field-wrap">
364 364
 						<label for="json">
365 365
 							<input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>"
366 366
 							       accept=".json">
367
-							<p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p>
367
+							<p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p>
368 368
 						</label>
369 369
 					</div>
370 370
 				</td>
@@ -373,21 +373,21 @@  discard block
 block discarded – undo
373 373
 			$settings = array(
374 374
 				array(
375 375
 					'id'          => 'type',
376
-					'name'        => __( 'Merge Type:', 'give' ),
377
-					'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ),
376
+					'name'        => __('Merge Type:', 'give'),
377
+					'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'),
378 378
 					'default'     => $type,
379 379
 					'type'        => 'radio_inline',
380 380
 					'options'     => array(
381
-						'merge'   => __( 'Merge', 'give' ),
382
-						'replace' => __( 'Replace', 'give' ),
381
+						'merge'   => __('Merge', 'give'),
382
+						'replace' => __('Replace', 'give'),
383 383
 					),
384 384
 				),
385 385
 			);
386 386
 
387
-			$settings = apply_filters( 'give_import_core_setting_html', $settings );
387
+			$settings = apply_filters('give_import_core_setting_html', $settings);
388 388
 
389
-			if ( empty( $this->is_json_valid ) ) {
390
-				Give_Admin_Settings::output_fields( $settings, 'give_settings' );
389
+			if (empty($this->is_json_valid)) {
390
+				Give_Admin_Settings::output_fields($settings, 'give_settings');
391 391
 				?>
392 392
 				<tr valign="top">
393 393
 					<th></th>
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						<input type="submit"
396 396
 						       class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
397 397
 						       id="recount-stats-submit"
398
-						       value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
398
+						       value="<?php esc_attr_e('Submit', 'give'); ?>"/>
399 399
 					</th>
400 400
 				</tr>
401 401
 				<?php
@@ -417,20 +417,20 @@  discard block
 block discarded – undo
417 417
 			$step = $this->get_step();
418 418
 
419 419
 			// Validation for first step.
420
-			if ( 1 === $step ) {
421
-				$type          = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' );
420
+			if (1 === $step) {
421
+				$type          = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace');
422 422
 				$core_settings = self::upload_widget_settings_file();
423
-				if ( ! empty( $core_settings['error'] ) ) {
424
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) );
423
+				if ( ! empty($core_settings['error'])) {
424
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give'));
425 425
 				} else {
426
-					$file_path = explode( '/', $core_settings['file'] );
427
-					$count     = ( count( $file_path ) - 1 );
428
-					$url       = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array(
426
+					$file_path = explode('/', $core_settings['file']);
427
+					$count     = (count($file_path) - 1);
428
+					$url       = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array(
429 429
 						'step'          => '2',
430 430
 						'importer-type' => $this->importer_type,
431 431
 						'type'          => $type,
432
-						'file_name'     => $file_path[ $count ],
433
-					) ) );
432
+						'file_name'     => $file_path[$count],
433
+					)));
434 434
 
435 435
 
436 436
 					$this->is_json_valid = $url;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		 * @return bool
446 446
 		 */
447 447
 		private function is_donations_import_page() {
448
-			return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] );
448
+			return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']);
449 449
 		}
450 450
 
451 451
 		/**
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 		 */
455 455
 		public static function upload_widget_settings_file() {
456 456
 			$upload = false;
457
-			if ( isset( $_FILES['json'] ) ) {
458
-				add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
457
+			if (isset($_FILES['json'])) {
458
+				add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
459 459
 
460
-				$upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) );
460
+				$upload = wp_handle_upload($_FILES['json'], array('test_form' => false));
461 461
 
462
-				remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
462
+				remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
463 463
 			} else {
464
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
464
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
465 465
 			}
466 466
 
467 467
 			return $upload;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		 *
473 473
 		 * @param array $existing_mimes
474 474
 		 */
475
-		public static function json_upload_mimes( $existing_mimes = array() ) {
475
+		public static function json_upload_mimes($existing_mimes = array()) {
476 476
 			$existing_mimes['json'] = 'application/json';
477 477
 
478 478
 			return $existing_mimes;
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-system-info.php 1 patch
Spacing   +329 added lines, -330 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: System Info
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 ?>
26 26
 
27 27
 <div class="give-debug-report-wrapper">
28
-	<p class="give-debug-report-text"><?php echo sprintf(__( 'Please copy and paste this information in your ticket when contacting support:', 'give' )); ?> </p>
28
+	<p class="give-debug-report-text"><?php echo sprintf(__('Please copy and paste this information in your ticket when contacting support:', 'give')); ?> </p>
29 29
 	<div class="give-debug-report-actions">
30
-		<a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a>
31
-		<a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?> <span class="dashicons dashicons-external"></span></a>
30
+		<a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a>
31
+		<a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?> <span class="dashicons dashicons-external"></span></a>
32 32
 	</div>
33 33
 	<div class="give-debug-report js-give-debug-report">
34 34
 		<textarea readonly="readonly"></textarea>
@@ -38,56 +38,56 @@  discard block
 block discarded – undo
38 38
 <table class="give-status-table widefat" cellspacing="0" id="status">
39 39
 	<thead>
40 40
 		<tr>
41
-			<th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th>
41
+			<th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th>
42 42
 		</tr>
43 43
 	</thead>
44 44
 	<tbody>
45 45
 		<tr>
46
-			<td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td>
47
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The URL of your site\'s homepage.', 'give' ) ); ?></td>
48
-			<td><?php form_option( 'home' ); ?></td>
46
+			<td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td>
47
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The URL of your site\'s homepage.', 'give')); ?></td>
48
+			<td><?php form_option('home'); ?></td>
49 49
 		</tr>
50 50
 		<tr>
51
-			<td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td>
52
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The root URL of your site.', 'give' ) ); ?></td>
53
-			<td><?php form_option( 'siteurl' ); ?></td>
51
+			<td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td>
52
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The root URL of your site.', 'give')); ?></td>
53
+			<td><?php form_option('siteurl'); ?></td>
54 54
 		</tr>
55 55
 		<tr>
56
-			<td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td>
57
-			<td class="help"><?php echo Give()->tooltips->render_help(  __( 'The version of WordPress installed on your site.', 'give' ) ); ?></td>
58
-			<td><?php bloginfo( 'version' ); ?></td>
56
+			<td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td>
57
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The version of WordPress installed on your site.', 'give')); ?></td>
58
+			<td><?php bloginfo('version'); ?></td>
59 59
 		</tr>
60 60
 		<tr>
61
-			<td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td>
62
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?></td>
63
-			<td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '&ndash;'; ?></td>
61
+			<td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td>
62
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?></td>
63
+			<td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '&ndash;'; ?></td>
64 64
 
65 65
 		</tr>
66 66
 		<tr>
67
-			<td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td>
68
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?></td>
67
+			<td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td>
68
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?></td>
69 69
 			<td>
70 70
 				<?php
71
-				$memory = give_let_to_num( WP_MEMORY_LIMIT );
71
+				$memory = give_let_to_num(WP_MEMORY_LIMIT);
72 72
 
73
-				if ( function_exists( 'memory_get_usage' ) ) {
74
-					$system_memory = give_let_to_num( @ini_get( 'memory_limit' ) );
75
-					$memory        = max( $memory, $system_memory );
73
+				if (function_exists('memory_get_usage')) {
74
+					$system_memory = give_let_to_num(@ini_get('memory_limit'));
75
+					$memory        = max($memory, $system_memory);
76 76
 				}
77 77
 
78
-				if ( $memory < 67108864 ) {
79
-					echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'give' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'give' ) . '</a>' ) . '</mark>';
78
+				if ($memory < 67108864) {
79
+					echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend setting memory to at least 64 MB. See: %s', 'give'), size_format($memory), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.__('Increasing memory allocated to PHP', 'give').'</a>').'</mark>';
80 80
 				} else {
81
-					echo '<mark class="yes">' . size_format( $memory ) . '</mark>';
81
+					echo '<mark class="yes">'.size_format($memory).'</mark>';
82 82
 				}
83 83
 				?>
84 84
 			</td>
85 85
 		</tr>
86 86
 		<tr>
87
-			<td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td>
88
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?></td>
87
+			<td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td>
88
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?></td>
89 89
 			<td>
90
-				<?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?>
90
+				<?php if (defined('WP_DEBUG') && WP_DEBUG) : ?>
91 91
 					<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
92 92
 				<?php else : ?>
93 93
 					<mark class="no">&ndash;</mark>
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 			</td>
96 96
 		</tr>
97 97
 		<tr>
98
-			<td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td>
99
-			<td class="help"><?php echo Give()->tooltips->render( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?></td>
98
+			<td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td>
99
+			<td class="help"><?php echo Give()->tooltips->render(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?></td>
100 100
 			<td>
101
-				<?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?>
101
+				<?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?>
102 102
 					<mark class="no">&ndash;</mark>
103 103
 				<?php else : ?>
104 104
 					<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
@@ -106,60 +106,60 @@  discard block
 block discarded – undo
106 106
 			</td>
107 107
 		</tr>
108 108
 		<tr>
109
-			<td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td>
110
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?></td>
109
+			<td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td>
110
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The current language used by WordPress. Default = English', 'give')); ?></td>
111 111
 			<td><?php echo get_locale(); ?></td>
112 112
 		</tr>
113 113
 		<tr>
114
-			<td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td>
115
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?></td>
116
-			<td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td>
114
+			<td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td>
115
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The permalink structure as defined in Settings.', 'give')); ?></td>
116
+			<td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td>
117 117
 		</tr>
118 118
 		<tr>
119
-			<td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td>
120
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?></td>
121
-			<td><?php echo esc_html( get_option( 'show_on_front', '&ndash;' ) ); ?></td>
119
+			<td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td>
120
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether your front page is set to show posts or a static page.', 'give')); ?></td>
121
+			<td><?php echo esc_html(get_option('show_on_front', '&ndash;')); ?></td>
122 122
 		</tr>
123
-		<?php if ( 'page' === get_option( 'show_on_front' ) ) : ?>
123
+		<?php if ('page' === get_option('show_on_front')) : ?>
124 124
 			<?php
125
-			$front_page_id = absint( get_option( 'page_on_front' ) );
126
-			$blog_page_id  = absint( get_option( 'page_for_posts' ) );
125
+			$front_page_id = absint(get_option('page_on_front'));
126
+			$blog_page_id  = absint(get_option('page_for_posts'));
127 127
 			?>
128 128
 			<tr>
129
-				<td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td>
130
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display as your front page.', 'give' ) ); ?></td>
131
-				<td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td>
129
+				<td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td>
130
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display as your front page.', 'give')); ?></td>
131
+				<td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td>
132 132
 			</tr>
133 133
 			<tr>
134
-				<td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td>
135
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display your posts.', 'give' ) ); ?></td>
136
-				<td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td>
134
+				<td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td>
135
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display your posts.', 'give')); ?></td>
136
+				<td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td>
137 137
 			</tr>
138
-		<?php endif;?>
138
+		<?php endif; ?>
139 139
 		<tr>
140
-			<td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix', 'give' ); ?>:</td>
141
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The table prefix used in your WordPress database.', 'give' ) ); ?></td>
142
-			<td><?php echo esc_html( $wpdb->prefix ); ?></td>
140
+			<td data-export-label="Table Prefix Length"><?php _e('Table Prefix', 'give'); ?>:</td>
141
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The table prefix used in your WordPress database.', 'give')); ?></td>
142
+			<td><?php echo esc_html($wpdb->prefix); ?></td>
143 143
 		</tr>
144 144
 		<tr>
145
-			<td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td>
146
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?></td>
147
-			<td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td>
145
+			<td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td>
146
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The length of the table prefix used in your WordPress database.', 'give')); ?></td>
147
+			<td><?php echo esc_html(strlen($wpdb->prefix)); ?></td>
148 148
 		</tr>
149 149
 		<tr>
150
-			<td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td>
151
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?></td>
152
-			<td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td>
150
+			<td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td>
151
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The status of the table prefix used in your WordPress database.', 'give')); ?></td>
152
+			<td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td>
153 153
 		</tr>
154 154
 		<tr>
155
-			<td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td>
156
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?></td>
157
-			<td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td>
155
+			<td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td>
156
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether Admin AJAX is accessible.', 'give')); ?></td>
157
+			<td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td>
158 158
 		</tr>
159 159
 		<tr>
160
-			<td data-export-label="Registered Post Statuses"><?php _e( 'Registered Post Statuses', 'give' ); ?>:</td>
161
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'A list of all registered post statuses.', 'give' ) ); ?></td>
162
-			<td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td>
160
+			<td data-export-label="Registered Post Statuses"><?php _e('Registered Post Statuses', 'give'); ?>:</td>
161
+			<td class="help"><?php echo Give()->tooltips->render_help(__('A list of all registered post statuses.', 'give')); ?></td>
162
+			<td><?php echo esc_html(implode(', ', get_post_stati())); ?></td>
163 163
 		</tr>
164 164
 	</tbody>
165 165
 </table>
@@ -167,103 +167,103 @@  discard block
 block discarded – undo
167 167
 <table class="give-status-table widefat" cellspacing="0">
168 168
 	<thead>
169 169
 		<tr>
170
-			<th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th>
170
+			<th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th>
171 171
 		</tr>
172 172
 	</thead>
173 173
 	<tbody>
174 174
 		<tr>
175
-			<td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td>
176
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?></td>
177
-			<td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td>
175
+			<td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td>
176
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The hosting provider for this WordPress installation.', 'give')); ?></td>
177
+			<td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td>
178 178
 		</tr>
179 179
 		<tr>
180
-			<td data-export-label="TLS Connection"><?php _e( 'TLS Connection', 'give' ); ?>:</td>
181
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give' ) ); ?></td>
180
+			<td data-export-label="TLS Connection"><?php _e('TLS Connection', 'give'); ?>:</td>
181
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give')); ?></td>
182 182
 			<td>
183 183
 				<?php
184 184
 				$tls_check = false;
185 185
 
186 186
 				// Get the SSL status.
187
-				if ( ini_get( 'allow_url_fopen' ) ) {
188
-					$tls_check = file_get_contents( 'https://www.howsmyssl.com/a/check' );
187
+				if (ini_get('allow_url_fopen')) {
188
+					$tls_check = file_get_contents('https://www.howsmyssl.com/a/check');
189 189
 				}
190 190
 
191
-				if ( false !== $tls_check ) {
192
-					$tls_check = json_decode( $tls_check );
191
+				if (false !== $tls_check) {
192
+					$tls_check = json_decode($tls_check);
193 193
 					/* translators: %s: SSL connection response */
194
-					printf( __( 'Connection uses %s', 'give' ), esc_html( $tls_check->tls_version ) );
194
+					printf(__('Connection uses %s', 'give'), esc_html($tls_check->tls_version));
195 195
 				}
196 196
 				?>
197 197
 			</td>
198 198
 		</tr>
199 199
 		<tr>
200
-			<td data-export-label="TLS Connection"><?php _e( 'TLS Rating', 'give' ); ?>:</td>
201
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The server\'s connection as rated by https://www.howsmyssl.com/', 'give' ) ); ?></td>
200
+			<td data-export-label="TLS Connection"><?php _e('TLS Rating', 'give'); ?>:</td>
201
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The server\'s connection as rated by https://www.howsmyssl.com/', 'give')); ?></td>
202 202
 			<td>
203 203
 				<?php
204
-				if ( false !== $tls_check ) {
205
-					esc_html_e( property_exists( $tls_check, 'rating' ) ? $tls_check->rating : $tls_check->tls_version );
204
+				if (false !== $tls_check) {
205
+					esc_html_e(property_exists($tls_check, 'rating') ? $tls_check->rating : $tls_check->tls_version);
206 206
 				}
207 207
 				?>
208 208
 			</td>
209 209
 		</tr>
210 210
 		<tr>
211
-			<td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td>
212
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?></td>
213
-			<td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
211
+			<td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td>
212
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Information about the web server that is currently hosting your site.', 'give')); ?></td>
213
+			<td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td>
214 214
 		</tr>
215 215
 		<tr>
216
-			<td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td>
217
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?></td>
216
+			<td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td>
217
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The version of PHP installed on your hosting server.', 'give')); ?></td>
218 218
 			<td>
219 219
 				<?php
220 220
 				// Check if phpversion function exists.
221
-				if ( function_exists( 'phpversion' ) ) {
221
+				if (function_exists('phpversion')) {
222 222
 					$php_version = phpversion();
223 223
 
224
-					if ( version_compare( $php_version, '5.6', '<' ) ) {
225
-						echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'give' ), esc_html( $php_version ), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">' . __( 'PHP Requirements in Give', 'give' ) . '</a>' ) . '</mark>';
224
+					if (version_compare($php_version, '5.6', '<')) {
225
+						echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum PHP version of 5.6. See: %s', 'give'), esc_html($php_version), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">'.__('PHP Requirements in Give', 'give').'</a>').'</mark>';
226 226
 					} else {
227
-						echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>';
227
+						echo '<mark class="yes">'.esc_html($php_version).'</mark>';
228 228
 					}
229 229
 				} else {
230
-					_e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' );
230
+					_e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give');
231 231
 				}
232 232
 				?></td>
233 233
 		</tr>
234
-		<?php if ( function_exists( 'ini_get' ) ) : ?>
234
+		<?php if (function_exists('ini_get')) : ?>
235 235
 			<tr>
236
-				<td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td>
237
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?></td>
238
-				<td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td>
236
+				<td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td>
237
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be contained in one post.', 'give')); ?></td>
238
+				<td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td>
239 239
 			</tr>
240 240
 			<tr>
241
-				<td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td>
242
-				<td class="help"><?php echo Give() ->tooltips->render_help( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?></td>
243
-				<td><?php echo ini_get( 'max_execution_time' ); ?></td>
241
+				<td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td>
242
+				<td class="help"><?php echo Give() ->tooltips->render_help(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?></td>
243
+				<td><?php echo ini_get('max_execution_time'); ?></td>
244 244
 			</tr>
245 245
 			<tr>
246
-				<td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td>
247
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?></td>
248
-				<td><?php echo ini_get( 'max_input_vars' ); ?></td>
246
+				<td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td>
247
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?></td>
248
+				<td><?php echo ini_get('max_input_vars'); ?></td>
249 249
 			</tr>
250 250
 			<tr>
251
-				<td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td>
252
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?></td>
253
-				<td><?php echo size_format( wp_max_upload_size() ); ?></td>
251
+				<td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td>
252
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?></td>
253
+				<td><?php echo size_format(wp_max_upload_size()); ?></td>
254 254
 			</tr>
255 255
 			<tr>
256
-				<td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td>
257
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of cURL installed on your server.', 'give' ) ); ?></td>
256
+				<td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td>
257
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The version of cURL installed on your server.', 'give')); ?></td>
258 258
 				<td>
259 259
 					<?php
260
-					if ( function_exists( 'curl_version' ) ) {
260
+					if (function_exists('curl_version')) {
261 261
 						$curl_version = curl_version();
262 262
 
263
-						if ( version_compare( $curl_version['version'], '7.40', '<' ) ) {
264
-							echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'give' ), esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) ) . '</mark>';
263
+						if (version_compare($curl_version['version'], '7.40', '<')) {
264
+							echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum cURL version of 7.40.', 'give'), esc_html($curl_version['version'].', '.$curl_version['ssl_version'])).'</mark>';
265 265
 						} else {
266
-							echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>';
266
+							echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>';
267 267
 						}
268 268
 					} else {
269 269
 						echo '&ndash';
@@ -272,42 +272,42 @@  discard block
 block discarded – undo
272 272
 				</td>
273 273
 			</tr>
274 274
 			<tr>
275
-				<td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td>
276
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give' ) ); ?></td>
277
-				<td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;'; ?></td>
275
+				<td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td>
276
+				<td class="help"><?php echo Give()->tooltips->render_help(__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give')); ?></td>
277
+				<td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;'; ?></td>
278 278
 			</tr>
279 279
 		<?php endif;
280 280
 
281
-		if ( $wpdb->use_mysqli ) {
282
-			$ver = mysqli_get_server_info( $wpdb->dbh );
281
+		if ($wpdb->use_mysqli) {
282
+			$ver = mysqli_get_server_info($wpdb->dbh);
283 283
 		} else {
284 284
 			$ver = mysql_get_server_info();
285 285
 		}
286 286
 
287
-		if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?>
287
+		if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?>
288 288
 			<tr>
289
-				<td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td>
290
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?></td>
289
+				<td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td>
290
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The version of MySQL installed on your hosting server.', 'give')); ?></td>
291 291
 				<td>
292 292
 					<?php
293 293
 					$mysql_version = $wpdb->db_version();
294 294
 
295
-					if ( version_compare( $mysql_version, '5.6', '<' ) ) {
296
-						echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give' ), esc_html( $mysql_version ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress Requirements', 'give' ) . '</a>' ) . '</mark>';
295
+					if (version_compare($mysql_version, '5.6', '<')) {
296
+						echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give'), esc_html($mysql_version), '<a href="https://wordpress.org/about/requirements/" target="_blank">'.__('WordPress Requirements', 'give').'</a>').'</mark>';
297 297
 					} else {
298
-						echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>';
298
+						echo '<mark class="yes">'.esc_html($mysql_version).'</mark>';
299 299
 					}
300 300
 					?>
301 301
 				</td>
302 302
 			</tr>
303 303
 		<?php endif; ?>
304 304
 		<tr>
305
-			<td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td>
306
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The default timezone for your server.', 'give' ) ); ?></td>
305
+			<td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td>
306
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The default timezone for your server.', 'give')); ?></td>
307 307
 			<td><?php
308 308
 				$default_timezone = date_default_timezone_get();
309
-				if ( 'UTC' !== $default_timezone ) {
310
-					echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>';
309
+				if ('UTC' !== $default_timezone) {
310
+					echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>';
311 311
 				} else {
312 312
 					echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
313 313
 				} ?>
@@ -318,119 +318,119 @@  discard block
 block discarded – undo
318 318
 
319 319
 		// fsockopen/cURL.
320 320
 		$posting['fsockopen_curl']['name'] = 'fsockopen/cURL';
321
-		$posting['fsockopen_curl']['help'] = __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give' );
321
+		$posting['fsockopen_curl']['help'] = __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give');
322 322
 
323
-		if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
323
+		if (function_exists('fsockopen') || function_exists('curl_init')) {
324 324
 			$posting['fsockopen_curl']['success'] = true;
325 325
 		} else {
326 326
 			$posting['fsockopen_curl']['success'] = false;
327
-			$posting['fsockopen_curl']['note']    = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give' );
327
+			$posting['fsockopen_curl']['note']    = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give');
328 328
 		}
329 329
 
330 330
 		// SOAP.
331 331
 		$posting['soap_client']['name'] = 'SoapClient';
332
-		$posting['soap_client']['help'] = __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give' );
332
+		$posting['soap_client']['help'] = __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give');
333 333
 
334
-		if ( class_exists( 'SoapClient' ) ) {
334
+		if (class_exists('SoapClient')) {
335 335
 			$posting['soap_client']['success'] = true;
336 336
 		} else {
337 337
 			$posting['soap_client']['success'] = false;
338
-			$posting['soap_client']['note']    = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' );
338
+			$posting['soap_client']['note']    = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>');
339 339
 		}
340 340
 
341 341
 		// DOMDocument.
342 342
 		$posting['dom_document']['name'] = 'DOMDocument';
343
-		$posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' );
343
+		$posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give');
344 344
 
345
-		if ( class_exists( 'DOMDocument' ) ) {
345
+		if (class_exists('DOMDocument')) {
346 346
 			$posting['dom_document']['success'] = true;
347 347
 		} else {
348 348
 			$posting['dom_document']['success'] = false;
349
-			$posting['dom_document']['note']    = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
349
+			$posting['dom_document']['note']    = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>');
350 350
 		}
351 351
 
352 352
 		// gzip.
353 353
 		$posting['gzip']['name'] = 'gzip';
354
-		$posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' );
354
+		$posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give');
355 355
 
356
-		if ( is_callable( 'gzopen' ) ) {
356
+		if (is_callable('gzopen')) {
357 357
 			$posting['gzip']['success'] = true;
358 358
 		} else {
359 359
 			$posting['gzip']['success'] = false;
360
-			$posting['gzip']['note']    = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'give' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' );
360
+			$posting['gzip']['note']    = sprintf(__('Your server does not support the %s function - this is used for file compression and decompression.', 'give'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>');
361 361
 		}
362 362
 
363 363
 
364 364
 		// GD Graphics Library.
365 365
 		$posting['gd']['name']    = 'GD Graphics Library';
366
-		$posting['gd']['help']    = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' );
367
-		$posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false;
366
+		$posting['gd']['help']    = __('GD Graphics Library is used for dynamically manipulating images.', 'give');
367
+		$posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false;
368 368
 
369 369
 		// Multibyte String.
370 370
 		$posting['mbstring']['name'] = 'Multibyte String';
371
-		$posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' );
371
+		$posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give');
372 372
 
373
-		if ( extension_loaded( 'mbstring' ) ) {
373
+		if (extension_loaded('mbstring')) {
374 374
 			$posting['mbstring']['success'] = true;
375 375
 		} else {
376 376
 			$posting['mbstring']['success'] = false;
377
-			$posting['mbstring']['note']    = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' );
377
+			$posting['mbstring']['note']    = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>');
378 378
 		}
379 379
 
380 380
 		// WP Remote Post Check.
381
-		$posting['wp_remote_post']['name'] = __( 'Remote Post', 'give' );
382
-		$posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' );
381
+		$posting['wp_remote_post']['name'] = __('Remote Post', 'give');
382
+		$posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give');
383 383
 
384
-		$response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array(
384
+		$response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array(
385 385
 			'timeout'     => 60,
386
-			'user-agent'  => 'Give/' . GIVE_VERSION,
386
+			'user-agent'  => 'Give/'.GIVE_VERSION,
387 387
 			'httpversion' => '1.1',
388 388
 			'body'        => array(
389 389
 				'cmd' => '_notify-validate',
390 390
 			),
391
-		) );
391
+		));
392 392
 
393
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
393
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
394 394
 			$posting['wp_remote_post']['success'] = true;
395 395
 		} else {
396
-			$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' );
397
-			if ( is_wp_error( $response ) ) {
398
-				$posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) );
396
+			$posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give');
397
+			if (is_wp_error($response)) {
398
+				$posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message()));
399 399
 			} else {
400
-				$posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) );
400
+				$posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code']));
401 401
 			}
402 402
 			$posting['wp_remote_post']['success'] = false;
403 403
 		}
404 404
 
405 405
 		// WP Remote Get Check.
406
-		$posting['wp_remote_get']['name'] = __( 'Remote Get', 'give' );
407
-		$posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' );
406
+		$posting['wp_remote_get']['name'] = __('Remote Get', 'give');
407
+		$posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give');
408 408
 
409
-		$response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) );
409
+		$response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0'));
410 410
 
411
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
411
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
412 412
 			$posting['wp_remote_get']['success'] = true;
413 413
 		} else {
414
-			$posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give' );
415
-			if ( is_wp_error( $response ) ) {
416
-				$posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) );
414
+			$posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give');
415
+			if (is_wp_error($response)) {
416
+				$posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message()));
417 417
 			} else {
418
-				$posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) );
418
+				$posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code']));
419 419
 			}
420 420
 			$posting['wp_remote_get']['success'] = false;
421 421
 		}
422 422
 
423
-		$posting = apply_filters( 'give_debug_posting', $posting );
423
+		$posting = apply_filters('give_debug_posting', $posting);
424 424
 
425
-		foreach ( $posting as $post ) {
426
-			$mark = ! empty( $post['success'] ) ? 'yes' : 'error';
425
+		foreach ($posting as $post) {
426
+			$mark = ! empty($post['success']) ? 'yes' : 'error';
427 427
 			?>
428 428
 			<tr>
429
-				<td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td>
430
-				<td class="help"><?php echo Give()->tooltips->render_help( esc_attr( isset( $post['help'] ) ? $post['help'] : '' ) ); ?></td>
429
+				<td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td>
430
+				<td class="help"><?php echo Give()->tooltips->render_help(esc_attr(isset($post['help']) ? $post['help'] : '')); ?></td>
431 431
 				<td>
432 432
 					<mark class="<?php echo $mark; ?>">
433
-						<?php echo ! empty( $post['success'] ) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?>
433
+						<?php echo ! empty($post['success']) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty($post['note']) ? wp_kses_data($post['note']) : ''; ?>
434 434
 					</mark>
435 435
 				</td>
436 436
 			</tr>
@@ -443,47 +443,47 @@  discard block
 block discarded – undo
443 443
 <table class="give-status-table widefat" cellspacing="0">
444 444
 	<thead>
445 445
 		<tr>
446
-			<th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th>
446
+			<th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th>
447 447
 		</tr>
448 448
 	</thead>
449 449
 	<tbody>
450 450
 		<tr>
451
-			<td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td>
452
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed on your site.', 'give' ) ); ?></td>
453
-			<td><?php echo esc_html( GIVE_VERSION ); ?></td>
451
+			<td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td>
452
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed on your site.', 'give')); ?></td>
453
+			<td><?php echo esc_html(GIVE_VERSION); ?></td>
454 454
 		</tr>
455 455
 		<tr>
456
-			<td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td>
457
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td>
458
-			<td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td>
456
+			<td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td>
457
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td>
458
+			<td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td>
459 459
 		</tr>
460 460
 		<tr>
461
-			<td data-export-label="Database Updates"><?php _e( 'Database Updates', 'give' ); ?>:</td>
462
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'This will show the number of pending database updates.', 'give' ) ); ?></td>
461
+			<td data-export-label="Database Updates"><?php _e('Database Updates', 'give'); ?>:</td>
462
+			<td class="help"><?php echo Give()->tooltips->render_help(__('This will show the number of pending database updates.', 'give')); ?></td>
463 463
 			<td>
464 464
 				<?php
465
-				$updates_text    = __( 'All DB Updates Completed.', 'give' );
465
+				$updates_text    = __('All DB Updates Completed.', 'give');
466 466
 				$pending_updates = $give_updates->get_total_new_db_update_count();
467 467
 				$total_updates   = $give_updates->get_total_db_update_count();
468 468
 
469
-				if( Give_Updates::$background_updater->is_paused_process() ) {
469
+				if (Give_Updates::$background_updater->is_paused_process()) {
470 470
 					// When all the db updates are pending.
471 471
 					$updates_text = sprintf(
472
-						__( '%1$s updates still need to run. (Paused) ', 'give' ),
473
-						count( $give_updates->get_updates('database', 'new' ) )
472
+						__('%1$s updates still need to run. (Paused) ', 'give'),
473
+						count($give_updates->get_updates('database', 'new'))
474 474
 					);
475
-				} elseif( $pending_updates === $total_updates ) {
475
+				} elseif ($pending_updates === $total_updates) {
476 476
 
477 477
 					// When all the db updates are pending.
478 478
 					$updates_text = sprintf(
479
-						__( '%1$s updates still need to run.', 'give' ),
479
+						__('%1$s updates still need to run.', 'give'),
480 480
 						$total_updates
481 481
 					);
482
-				} elseif( $pending_updates > 0 ) {
482
+				} elseif ($pending_updates > 0) {
483 483
 
484 484
 					// When some of the db updates are completed and some are pending.
485 485
 					$updates_text = sprintf(
486
-						__( '%1$s of %2$s updates still need to run.', 'give' ),
486
+						__('%1$s of %2$s updates still need to run.', 'give'),
487 487
 						$pending_updates,
488 488
 						$total_updates
489 489
 					);
@@ -494,148 +494,147 @@  discard block
 block discarded – undo
494 494
 			</td>
495 495
 		</tr>
496 496
 		<tr>
497
-			<td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td>
498
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td>
499
-			<td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td>
497
+			<td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td>
498
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td>
499
+			<td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td>
500 500
 		</tr>
501 501
 		<tr>
502
-			<td data-export-label="Give Cache"><?php _e( 'Give Emails', 'give' ); ?>:</td>
503
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether emails is enabled in Give settings.', 'give' ) ); ?></td>
502
+			<td data-export-label="Give Cache"><?php _e('Give Emails', 'give'); ?>:</td>
503
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether emails is enabled in Give settings.', 'give')); ?></td>
504 504
 			<td>
505 505
 				<?php
506 506
 				/* @var Give_Email_Notification $email_notification */
507
-				if( $email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications() ) {
507
+				if ($email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications()) {
508 508
 					ob_start();
509 509
 
510
-					foreach ( Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification ) {
511
-						$status = Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ?
512
-							'yes' :
513
-							'error';
510
+					foreach (Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification) {
511
+						$status = Give_Email_Notification_Util::is_email_notification_active($email_notification) ?
512
+							'yes' : 'error';
514 513
 
515 514
 						echo sprintf(
516 515
 							'<li><mark class="%1$s"><span class="dashicons dashicons-%2$s"></mark></span>%3$s</li>',
517
-							Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'error',
518
-							Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'no-alt',
516
+							Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'error',
517
+							Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'no-alt',
519 518
 							$email_notification->config['label']
520 519
 						);
521 520
 					}
522 521
 
523
-					echo sprintf( '<ul>%s</ul>', ob_get_clean() );
522
+					echo sprintf('<ul>%s</ul>', ob_get_clean());
524 523
 				}
525 524
 				?>
526 525
 			</td>
527 526
 		</tr>
528 527
 		<tr>
529
-			<td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td>
530
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?></td>
531
-			<td><?php echo esc_html( get_option( 'give_version_upgraded_from', '&ndash;' ) ); ?></td>
528
+			<td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td>
529
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed prior to the last update.', 'give')); ?></td>
530
+			<td><?php echo esc_html(get_option('give_version_upgraded_from', '&ndash;')); ?></td>
532 531
 		</tr>
533 532
 		<tr>
534
-			<td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td>
535
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?></td>
536
-			<td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td>
533
+			<td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td>
534
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether Test Mode is enabled in Give settings.', 'give')); ?></td>
535
+			<td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td>
537 536
 		</tr>
538 537
 		<tr>
539
-			<td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td>
540
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency code selected in Give settings.', 'give' ) ); ?></td>
541
-			<td><?php echo esc_html( give_get_currency() ); ?></td>
538
+			<td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td>
539
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The currency code selected in Give settings.', 'give')); ?></td>
540
+			<td><?php echo esc_html(give_get_currency()); ?></td>
542 541
 		</tr>
543 542
 		<tr>
544
-			<td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td>
545
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency position selected in Give settings.', 'give' ) ); ?></td>
546
-			<td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td>
543
+			<td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td>
544
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The currency position selected in Give settings.', 'give')); ?></td>
545
+			<td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td>
547 546
 		</tr>
548 547
 		<tr>
549
-			<td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td>
550
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?></td>
551
-			<td><?php echo esc_html( give_get_price_decimal_separator() ); ?></td>
548
+			<td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td>
549
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The decimal separator defined in Give settings.', 'give')); ?></td>
550
+			<td><?php echo esc_html(give_get_price_decimal_separator()); ?></td>
552 551
 		</tr>
553 552
 		<tr>
554
-			<td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td>
555
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?></td>
556
-			<td><?php echo esc_html( give_get_price_thousand_separator() ); ?></td>
553
+			<td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td>
554
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The thousands separator defined in Give settings.', 'give')); ?></td>
555
+			<td><?php echo esc_html(give_get_price_thousand_separator()); ?></td>
557 556
 		</tr>
558 557
 		<tr>
559
-			<td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td>
560
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?></td>
561
-			<td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '&ndash;'; ?></td>
558
+			<td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td>
559
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a successful transaction.', 'give')); ?></td>
560
+			<td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '&ndash;'; ?></td>
562 561
 		</tr>
563 562
 		<tr>
564
-			<td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td>
565
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?></td>
566
-			<td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '&ndash;'; ?></td>
563
+			<td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td>
564
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a failed transaction.', 'give')); ?></td>
565
+			<td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '&ndash;'; ?></td>
567 566
 		</tr>
568 567
 		<tr>
569
-			<td data-export-label="Donation History Page"><?php _e( 'Donation History Page', 'give' ); ?>:</td>
570
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where past donations are listed.', 'give' ) ); ?></td>
571
-			<td><?php echo ! empty( $give_options['history_page'] ) ? esc_url( get_permalink( $give_options['history_page'] ) ) : '&ndash;'; ?></td>
568
+			<td data-export-label="Donation History Page"><?php _e('Donation History Page', 'give'); ?>:</td>
569
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The page where past donations are listed.', 'give')); ?></td>
570
+			<td><?php echo ! empty($give_options['history_page']) ? esc_url(get_permalink($give_options['history_page'])) : '&ndash;'; ?></td>
572 571
 		</tr>
573 572
 		<tr>
574
-			<td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td>
575
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The slug used for Give donation forms.', 'give' ) ); ?></td>
576
-			<td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td>
573
+			<td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td>
574
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The slug used for Give donation forms.', 'give')); ?></td>
575
+			<td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td>
577 576
 		</tr>
578 577
 		<?php
579 578
 		$active_gateways  = give_get_enabled_payment_gateways();
580 579
 		$enabled_gateways = $default_gateway = '';
581 580
 
582
-		if ( $active_gateways ) {
583
-			$default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) );
581
+		if ($active_gateways) {
582
+			$default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null));
584 583
 
585
-			if ( $default_gateway_is_active ) {
586
-				$default_gateway = give_get_default_gateway( null );
587
-				$default_gateway = $active_gateways[ $default_gateway ]['admin_label'];
584
+			if ($default_gateway_is_active) {
585
+				$default_gateway = give_get_default_gateway(null);
586
+				$default_gateway = $active_gateways[$default_gateway]['admin_label'];
588 587
 			} else {
589
-				$default_gateway = __( 'Test Donation', 'give' );
588
+				$default_gateway = __('Test Donation', 'give');
590 589
 			}
591 590
 
592 591
 			$gateways = array();
593 592
 
594
-			foreach ( $active_gateways as $gateway ) {
593
+			foreach ($active_gateways as $gateway) {
595 594
 				$gateways[] = $gateway['admin_label'];
596 595
 			}
597 596
 
598
-			$enabled_gateways = implode( ', ', $gateways );
597
+			$enabled_gateways = implode(', ', $gateways);
599 598
 		}
600 599
 		?>
601 600
 		<tr>
602
-			<td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td>
603
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?></td>
604
-			<td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '&ndash;' ); ?></td>
601
+			<td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td>
602
+			<td class="help"><?php echo Give()->tooltips->render_help(__('All payment gateways enabled in Give settings.', 'give')); ?></td>
603
+			<td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '&ndash;'); ?></td>
605 604
 		</tr>
606 605
 		<tr>
607
-			<td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td>
608
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?></td>
609
-			<td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '&ndash;' ); ?></td>
606
+			<td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td>
607
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The default payment gateway selected in Give settings.', 'give')); ?></td>
608
+			<td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '&ndash;'); ?></td>
610 609
 		</tr>
611 610
 		<tr>
612
-			<td data-export-label="PayPal IPN Verification"><?php _e( 'PayPal IPN Verification', 'give' ); ?>:</td>
613
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether admins requires verification of IPN notifications with PayPal.', 'give' ) ); ?></td>
614
-			<td><?php echo 'enabled' === give_get_option( 'paypal_verification' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td>
611
+			<td data-export-label="PayPal IPN Verification"><?php _e('PayPal IPN Verification', 'give'); ?>:</td>
612
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether admins requires verification of IPN notifications with PayPal.', 'give')); ?></td>
613
+			<td><?php echo 'enabled' === give_get_option('paypal_verification') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td>
615 614
 		</tr>
616 615
 		<tr>
617
-			<td data-export-label="PayPal IPN Notifications"><?php _e( 'PayPal IPN Notifications', 'give' ); ?>:</td>
618
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether when last PayPal IPN is received with which donation or transaction.', 'give' ) ); ?></td>
616
+			<td data-export-label="PayPal IPN Notifications"><?php _e('PayPal IPN Notifications', 'give'); ?>:</td>
617
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether when last PayPal IPN is received with which donation or transaction.', 'give')); ?></td>
619 618
 			<td>
620 619
 				<?php
621
-				$last_paypal_ipn_received = get_option( 'give_last_paypal_ipn_received' );
620
+				$last_paypal_ipn_received = get_option('give_last_paypal_ipn_received');
622 621
 				$donation_id              = $last_paypal_ipn_received['payment_id'];
623 622
 				if (
624
-					is_array( $last_paypal_ipn_received )
625
-					&& count( $last_paypal_ipn_received ) > 0
626
-					&& get_post( $donation_id ) instanceof WP_Post
623
+					is_array($last_paypal_ipn_received)
624
+					&& count($last_paypal_ipn_received) > 0
625
+					&& get_post($donation_id) instanceof WP_Post
627 626
 				) {
628
-					$ipn_timestamp   = give_get_meta( $donation_id, 'give_last_paypal_ipn_received', true );
629
-					$transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' . $last_paypal_ipn_received['transaction_id'];
630
-					$donation_url    = site_url() . '/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $donation_id;
627
+					$ipn_timestamp   = give_get_meta($donation_id, 'give_last_paypal_ipn_received', true);
628
+					$transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='.$last_paypal_ipn_received['transaction_id'];
629
+					$donation_url    = site_url().'/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$donation_id;
631 630
 					echo sprintf(
632
-						__( 'IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give' ),
631
+						__('IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give'),
633 632
 						$donation_url,
634 633
 						$donation_id,
635 634
 						$transaction_url,
636 635
 						$last_paypal_ipn_received['transaction_id'],
637
-						date_i18n( 'm/d/Y', $ipn_timestamp ),
638
-						date_i18n( 'H:i', $ipn_timestamp ),
636
+						date_i18n('m/d/Y', $ipn_timestamp),
637
+						date_i18n('H:i', $ipn_timestamp),
639 638
 						$last_paypal_ipn_received['auth_status']
640 639
 					);
641 640
 				} else {
@@ -645,9 +644,9 @@  discard block
 block discarded – undo
645 644
 			</td>
646 645
 		</tr>
647 646
 		<tr>
648
-			<td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td>
649
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?></td>
650
-			<td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td>
647
+			<td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td>
648
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether donors can access their donation history using only email.', 'give')); ?></td>
649
+			<td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td>
651 650
 		</tr>
652 651
 	</tbody>
653 652
 </table>
@@ -655,13 +654,13 @@  discard block
 block discarded – undo
655 654
 <table class="give-status-table widefat" cellspacing="0">
656 655
 	<thead>
657 656
 	<tr>
658
-		<th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th>
657
+		<th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th>
659 658
 	</tr>
660 659
 	</thead>
661 660
 	<tbody>
662 661
 		<?php
663
-		foreach ( $plugins as $plugin_data ) {
664
-			if ( 'active' != $plugin_data['Status'] ||  'add-on' != $plugin_data['Type'] ) {
662
+		foreach ($plugins as $plugin_data) {
663
+			if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) {
665 664
 				continue;
666 665
 			}
667 666
 
@@ -669,40 +668,40 @@  discard block
 block discarded – undo
669 668
 			$author_name = $plugin_data['Author'];
670 669
 
671 670
 			// Link the plugin name to the plugin URL if available.
672
-			if ( ! empty( $plugin_data['PluginURI'] ) ) {
671
+			if ( ! empty($plugin_data['PluginURI'])) {
673 672
 				$plugin_name = sprintf(
674 673
 					'<a href="%s" title="%s">%s</a>',
675
-					esc_url( $plugin_data['PluginURI'] ),
676
-					esc_attr__( 'Visit plugin homepage', 'give' ),
674
+					esc_url($plugin_data['PluginURI']),
675
+					esc_attr__('Visit plugin homepage', 'give'),
677 676
 					$plugin_name
678 677
 				);
679 678
 			}
680 679
 
681 680
 			// Link the author name to the author URL if available.
682
-			if ( ! empty( $plugin_data['AuthorURI'] ) ) {
681
+			if ( ! empty($plugin_data['AuthorURI'])) {
683 682
 				$author_name = sprintf(
684 683
 					'<a href="%s" title="%s">%s</a>',
685
-					esc_url( $plugin_data['AuthorURI'] ),
686
-					esc_attr__( 'Visit author homepage', 'give' ),
684
+					esc_url($plugin_data['AuthorURI']),
685
+					esc_attr__('Visit author homepage', 'give'),
687 686
 					$author_name
688 687
 				);
689 688
 			}
690 689
 			?>
691 690
 			<tr>
692
-				<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
691
+				<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
693 692
 				<td class="help">&nbsp;</td>
694 693
 				<td>
695 694
 					<?php
696
-					if ( true === $plugin_data['License'] ) {
697
-						echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' );
695
+					if (true === $plugin_data['License']) {
696
+						echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give');
698 697
 					} else {
699
-						echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' );
698
+						echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give');
700 699
 					}
701 700
 
702 701
 					echo ' &ndash; '
703
-					     . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) )
702
+					     . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post')))
704 703
 					     . ' &ndash; '
705
-					     . esc_html( $plugin_data['Version'] );
704
+					     . esc_html($plugin_data['Version']);
706 705
 					?>
707 706
 				</td>
708 707
 			</tr>
@@ -715,18 +714,18 @@  discard block
 block discarded – undo
715 714
 <table class="give-status-table widefat" cellspacing="0">
716 715
 	<thead>
717 716
 		<tr>
718
-			<th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th>
717
+			<th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th>
719 718
 		</tr>
720 719
 	</thead>
721 720
 	<tbody>
722 721
 		<?php
723
-		foreach ( $plugins as $plugin_data ) {
724
-			if ( 'active' != $plugin_data['Status'] ||  'other' != $plugin_data['Type'] ) {
722
+		foreach ($plugins as $plugin_data) {
723
+			if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) {
725 724
 				continue;
726 725
 			}
727 726
 
728 727
 			// Do not show Give core plugin.
729
-			if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) {
728
+			if ('Give - Donation Plugin' === $plugin_data['Name']) {
730 729
 				continue;
731 730
 			}
732 731
 
@@ -734,29 +733,29 @@  discard block
 block discarded – undo
734 733
 			$author_name = $plugin_data['Author'];
735 734
 
736 735
 			// Link the plugin name to the plugin URL if available.
737
-			if ( ! empty( $plugin_data['PluginURI'] ) ) {
736
+			if ( ! empty($plugin_data['PluginURI'])) {
738 737
 				$plugin_name = sprintf(
739 738
 					'<a href="%s" title="%s">%s</a>',
740
-					esc_url( $plugin_data['PluginURI'] ),
741
-					esc_attr__( 'Visit plugin homepage', 'give' ),
739
+					esc_url($plugin_data['PluginURI']),
740
+					esc_attr__('Visit plugin homepage', 'give'),
742 741
 					$plugin_name
743 742
 				);
744 743
 			}
745 744
 
746 745
 			// Link the author name to the author URL if available.
747
-			if ( ! empty( $plugin_data['AuthorURI'] ) ) {
746
+			if ( ! empty($plugin_data['AuthorURI'])) {
748 747
 				$author_name = sprintf(
749 748
 					'<a href="%s" title="%s">%s</a>',
750
-					esc_url( $plugin_data['AuthorURI'] ),
751
-					esc_attr__( 'Visit author homepage', 'give' ),
749
+					esc_url($plugin_data['AuthorURI']),
750
+					esc_attr__('Visit author homepage', 'give'),
752 751
 					$author_name
753 752
 				);
754 753
 			}
755 754
 			?>
756 755
 			<tr>
757
-				<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
756
+				<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
758 757
 				<td class="help">&nbsp;</td>
759
-				<td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' &ndash; ' . esc_html( $plugin_data['Version'] ); ?></td>
758
+				<td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' &ndash; '.esc_html($plugin_data['Version']); ?></td>
760 759
 			</tr>
761 760
 			<?php
762 761
 		}
@@ -767,13 +766,13 @@  discard block
 block discarded – undo
767 766
 <table class="give-status-table widefat" cellspacing="0">
768 767
 	<thead>
769 768
 		<tr>
770
-			<th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th>
769
+			<th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th>
771 770
 		</tr>
772 771
 	</thead>
773 772
 	<tbody>
774 773
 		<?php
775
-		foreach ( $plugins as $plugin_data ) {
776
-			if ( 'inactive' != $plugin_data['Status'] ) {
774
+		foreach ($plugins as $plugin_data) {
775
+			if ('inactive' != $plugin_data['Status']) {
777 776
 				continue;
778 777
 			}
779 778
 
@@ -781,29 +780,29 @@  discard block
 block discarded – undo
781 780
 			$author_name = $plugin_data['Author'];
782 781
 
783 782
 			// Link the plugin name to the plugin URL if available.
784
-			if ( ! empty( $plugin_data['PluginURI'] ) ) {
783
+			if ( ! empty($plugin_data['PluginURI'])) {
785 784
 				$plugin_name = sprintf(
786 785
 					'<a href="%s" title="%s">%s</a>',
787
-					esc_url( $plugin_data['PluginURI'] ),
788
-					esc_attr__( 'Visit plugin homepage', 'give' ),
786
+					esc_url($plugin_data['PluginURI']),
787
+					esc_attr__('Visit plugin homepage', 'give'),
789 788
 					$plugin_name
790 789
 				);
791 790
 			}
792 791
 
793 792
 			// Link the author name to the author URL if available.
794
-			if ( ! empty( $plugin_data['AuthorURI'] ) ) {
793
+			if ( ! empty($plugin_data['AuthorURI'])) {
795 794
 				$author_name = sprintf(
796 795
 					'<a href="%s" title="%s">%s</a>',
797
-					esc_url( $plugin_data['AuthorURI'] ),
798
-					esc_attr__( 'Visit author homepage', 'give' ),
796
+					esc_url($plugin_data['AuthorURI']),
797
+					esc_attr__('Visit author homepage', 'give'),
799 798
 					$author_name
800 799
 				);
801 800
 			}
802 801
 			?>
803 802
 			<tr>
804
-				<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
803
+				<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
805 804
 				<td class="help">&nbsp;</td>
806
-				<td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' &ndash; ' . esc_html( $plugin_data['Version'] ); ?></td>
805
+				<td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' &ndash; '.esc_html($plugin_data['Version']); ?></td>
807 806
 			</tr>
808 807
 			<?php
809 808
 		}
@@ -813,38 +812,38 @@  discard block
 block discarded – undo
813 812
 
814 813
 <?php
815 814
 $active_mu_plugins = (array) get_mu_plugins();
816
-if ( ! empty( $active_mu_plugins ) ) {
815
+if ( ! empty($active_mu_plugins)) {
817 816
 ?>
818 817
 	<table class="give-status-table widefat" cellspacing="0">
819 818
 		<thead>
820 819
 			<tr>
821
-				<th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th>
820
+				<th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th>
822 821
 			</tr>
823 822
 		</thead>
824 823
 		<tbody>
825 824
 			<?php
826 825
 
827
-			foreach ( $active_mu_plugins as $mu_plugin_data ) {
828
-				if ( ! empty( $mu_plugin_data['Name'] ) ) {
826
+			foreach ($active_mu_plugins as $mu_plugin_data) {
827
+				if ( ! empty($mu_plugin_data['Name'])) {
829 828
 					// Link the plugin name to the plugin URL if available.
830
-					$plugin_name = esc_html( $mu_plugin_data['Name'] );
829
+					$plugin_name = esc_html($mu_plugin_data['Name']);
831 830
 
832
-					if ( ! empty( $mu_plugin_data['PluginURI'] ) ) {
831
+					if ( ! empty($mu_plugin_data['PluginURI'])) {
833 832
 						$plugin_name = sprintf(
834 833
 							'<a href="%s" title="%s">%s</a>',
835
-							esc_url( $mu_plugin_data['PluginURI'] ),
836
-							esc_attr__( 'Visit plugin homepage', 'give' ),
834
+							esc_url($mu_plugin_data['PluginURI']),
835
+							esc_attr__('Visit plugin homepage', 'give'),
837 836
 							$plugin_name
838 837
 						);
839 838
 					}
840 839
 
841 840
 					// Link the author name to the author URL if available.
842
-					$author_name = esc_html( $mu_plugin_data['Author'] );
841
+					$author_name = esc_html($mu_plugin_data['Author']);
843 842
 
844
-					if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) {
843
+					if ( ! empty($mu_plugin_data['AuthorURI'])) {
845 844
 						$author_name = sprintf(
846 845
 							'<a href="%s">%s</a>',
847
-							esc_url( $mu_plugin_data['AuthorURI'] ),
846
+							esc_url($mu_plugin_data['AuthorURI']),
848 847
 							$author_name
849 848
 						);
850 849
 					}
@@ -852,7 +851,7 @@  discard block
 block discarded – undo
852 851
 					<tr>
853 852
 						<td><?php echo $plugin_name; ?></td>
854 853
 						<td class="help">&nbsp;</td>
855
-						<td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' &ndash; ' . esc_html( $mu_plugin_data['Version'] ); ?></td>
854
+						<td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' &ndash; '.esc_html($mu_plugin_data['Version']); ?></td>
856 855
 					</tr>
857 856
 					<?php
858 857
 				}
@@ -865,53 +864,53 @@  discard block
 block discarded – undo
865 864
 <table class="give-status-table widefat" cellspacing="0">
866 865
 	<thead>
867 866
 		<tr>
868
-			<th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th>
867
+			<th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th>
869 868
 		</tr>
870 869
 	</thead>
871 870
 	<?php
872
-	include_once( ABSPATH . 'wp-admin/includes/theme-install.php' );
871
+	include_once(ABSPATH.'wp-admin/includes/theme-install.php');
873 872
 	$active_theme = wp_get_theme();
874 873
 	?>
875 874
 	<tbody>
876 875
 		<tr>
877
-			<td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td>
878
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current active theme.', 'give' )  ); ?></td>
879
-			<td><?php echo esc_html( $active_theme->Name ); ?></td>
876
+			<td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td>
877
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current active theme.', 'give')); ?></td>
878
+			<td><?php echo esc_html($active_theme->Name); ?></td>
880 879
 		</tr>
881 880
 		<tr>
882
-			<td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td>
883
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the current active theme.', 'give' ) ); ?></td>
884
-			<td><?php echo esc_html( $active_theme->Version ); ?></td>
881
+			<td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td>
882
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the current active theme.', 'give')); ?></td>
883
+			<td><?php echo esc_html($active_theme->Version); ?></td>
885 884
 		</tr>
886 885
 		<tr>
887
-			<td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td>
888
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'The theme developer\'s URL.', 'give' ) ); ?></td>
886
+			<td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td>
887
+			<td class="help"><?php echo Give()->tooltips->render_help(__('The theme developer\'s URL.', 'give')); ?></td>
889 888
 			<td><?php echo $active_theme->{'Author URI'}; ?></td>
890 889
 		</tr>
891 890
 		<tr>
892
-			<td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td>
893
-			<td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current theme is a child theme.', 'give' ) ); ?></td>
891
+			<td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td>
892
+			<td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current theme is a child theme.', 'give')); ?></td>
894 893
 			<td><?php
895
-				echo is_child_theme() ? __( 'Yes', 'give' ) : __( 'No', 'give' ) . ' &ndash; ' . sprintf( __( 'If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give' ), 'https://codex.wordpress.org/Child_Themes' );
894
+				echo is_child_theme() ? __('Yes', 'give') : __('No', 'give').' &ndash; '.sprintf(__('If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give'), 'https://codex.wordpress.org/Child_Themes');
896 895
 				?></td>
897 896
 		</tr>
898 897
 		<?php
899
-		if( is_child_theme() ) {
900
-			$parent_theme = wp_get_theme( $active_theme->Template );
898
+		if (is_child_theme()) {
899
+			$parent_theme = wp_get_theme($active_theme->Template);
901 900
 		?>
902 901
 			<tr>
903
-				<td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td>
904
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the parent theme.', 'give' ) ); ?></td>
905
-				<td><?php echo esc_html( $parent_theme->Name ); ?></td>
902
+				<td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td>
903
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The name of the parent theme.', 'give')); ?></td>
904
+				<td><?php echo esc_html($parent_theme->Name); ?></td>
906 905
 			</tr>
907 906
 			<tr>
908
-				<td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td>
909
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the parent theme.', 'give' ) ); ?></td>
910
-				<td><?php echo esc_html( $parent_theme->Version ); ?></td>
907
+				<td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td>
908
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the parent theme.', 'give')); ?></td>
909
+				<td><?php echo esc_html($parent_theme->Version); ?></td>
911 910
 			</tr>
912 911
 			<tr>
913
-				<td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td>
914
-				<td class="help"><?php echo Give()->tooltips->render_help( __( 'The parent theme developers URL.', 'give' ) ); ?></td>
912
+				<td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td>
913
+				<td class="help"><?php echo Give()->tooltips->render_help(__('The parent theme developers URL.', 'give')); ?></td>
915 914
 				<td><?php echo $parent_theme->{'Author URI'}; ?></td>
916 915
 			</tr>
917 916
 		<?php } ?>
Please login to merge, or discard this patch.
includes/admin/tools/export/give-export-donations-exporter.php 1 patch
Spacing   +159 added lines, -159 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
 
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param array $request The Form Data passed into the batch processing.
87 87
 	 */
88
-	public function set_properties( $request ) {
88
+	public function set_properties($request) {
89 89
 
90 90
 		// Set data from form submission
91
-		if ( isset( $_POST['form'] ) ) {
92
-			$this->data = give_clean( wp_parse_args( $_POST['form'] ) );
91
+		if (isset($_POST['form'])) {
92
+			$this->data = give_clean(wp_parse_args($_POST['form']));
93 93
 		}
94 94
 
95 95
 		$this->form       = $this->data['forms'];
96
-		$this->categories = ! empty( $request['give_forms_categories'] ) ? (array) $request['give_forms_categories'] : array();
97
-		$this->tags       = ! empty( $request['give_forms_tags'] ) ? (array) $request['give_forms_tags'] : array();
98
-		$this->form_id    = $this->get_form_ids( $request );
99
-		$this->price_id   = isset( $request['give_price_option'] ) && ( 'all' !== $request['give_price_option'] && '' !== $request['give_price_option'] ) ? absint( $request['give_price_option'] ) : null;
100
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
101
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
102
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
96
+		$this->categories = ! empty($request['give_forms_categories']) ? (array) $request['give_forms_categories'] : array();
97
+		$this->tags       = ! empty($request['give_forms_tags']) ? (array) $request['give_forms_tags'] : array();
98
+		$this->form_id    = $this->get_form_ids($request);
99
+		$this->price_id   = isset($request['give_price_option']) && ('all' !== $request['give_price_option'] && '' !== $request['give_price_option']) ? absint($request['give_price_option']) : null;
100
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
101
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
102
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
103 103
 
104 104
 		/**
105 105
 		 * Hook to use after setting properties.
106 106
 		 *
107 107
 		 * @since 2.1.3
108 108
 		 */
109
-		do_action( 'give_export_donations_form_data', $this->data );
109
+		do_action('give_export_donations_form_data', $this->data);
110 110
 	}
111 111
 
112 112
 	/**
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return array|boolean|null $form get all the donation id that need to be exported
120 120
 	 */
121
-	public function get_form_ids( $request = array() ) {
122
-		$form = ! empty( $request['forms'] ) && 0 !== $request['forms'] ? absint( $request['forms'] ) : null;
121
+	public function get_form_ids($request = array()) {
122
+		$form = ! empty($request['forms']) && 0 !== $request['forms'] ? absint($request['forms']) : null;
123 123
 
124
-		$form_ids = ! empty( $request['form_ids'] ) ? sanitize_text_field( $request['form_ids'] ) : null;
124
+		$form_ids = ! empty($request['form_ids']) ? sanitize_text_field($request['form_ids']) : null;
125 125
 
126
-		if ( empty( $form ) && ! empty( $form_ids ) && ( ! empty( $this->categories ) || ! empty( $this->tags ) ) ) {
127
-			$form = explode( ',', $form_ids );
126
+		if (empty($form) && ! empty($form_ids) && ( ! empty($this->categories) || ! empty($this->tags))) {
127
+			$form = explode(',', $form_ids);
128 128
 		}
129 129
 
130 130
 		return $form;
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function csv_cols() {
143 143
 
144
-		$columns = isset( $this->data['give_give_donations_export_option'] ) ? $this->data['give_give_donations_export_option'] : array();
144
+		$columns = isset($this->data['give_give_donations_export_option']) ? $this->data['give_give_donations_export_option'] : array();
145 145
 
146 146
 		// We need columns.
147
-		if ( empty( $columns ) ) {
147
+		if (empty($columns)) {
148 148
 			return false;
149 149
 		}
150 150
 
151
-		$this->cols = $this->get_cols( $columns );
151
+		$this->cols = $this->get_cols($columns);
152 152
 
153 153
 		return $this->cols;
154 154
 	}
@@ -163,88 +163,88 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array
165 165
 	 */
166
-	private function get_cols( $columns ) {
166
+	private function get_cols($columns) {
167 167
 
168 168
 		$cols = array();
169 169
 
170
-		foreach ( $columns as $key => $value ) {
170
+		foreach ($columns as $key => $value) {
171 171
 
172
-			switch ( $key ) {
172
+			switch ($key) {
173 173
 				case 'donation_id':
174
-					$cols['donation_id'] = __( 'Donation ID', 'give' );
174
+					$cols['donation_id'] = __('Donation ID', 'give');
175 175
 					break;
176 176
 				case 'seq_id':
177
-					$cols['seq_id'] = __( 'Donation Number', 'give' );
177
+					$cols['seq_id'] = __('Donation Number', 'give');
178 178
 					break;
179 179
 				case 'title_prefix':
180
-					$cols['title_prefix'] = __( 'Title Prefix', 'give' );
180
+					$cols['title_prefix'] = __('Title Prefix', 'give');
181 181
 					break;
182 182
 				case 'first_name':
183
-					$cols['first_name'] = __( 'First Name', 'give' );
183
+					$cols['first_name'] = __('First Name', 'give');
184 184
 					break;
185 185
 				case 'last_name':
186
-					$cols['last_name'] = __( 'Last Name', 'give' );
186
+					$cols['last_name'] = __('Last Name', 'give');
187 187
 					break;
188 188
 				case 'email':
189
-					$cols['email'] = __( 'Email Address', 'give' );
189
+					$cols['email'] = __('Email Address', 'give');
190 190
 					break;
191 191
 				case 'company':
192
-					$cols['company'] = __( 'Company Name', 'give' );
192
+					$cols['company'] = __('Company Name', 'give');
193 193
 					break;
194 194
 				case 'address':
195
-					$cols['address_line1']   = __( 'Address 1', 'give' );
196
-					$cols['address_line2']   = __( 'Address 2', 'give' );
197
-					$cols['address_city']    = __( 'City', 'give' );
198
-					$cols['address_state']   = __( 'State', 'give' );
199
-					$cols['address_zip']     = __( 'Zip', 'give' );
200
-					$cols['address_country'] = __( 'Country', 'give' );
195
+					$cols['address_line1']   = __('Address 1', 'give');
196
+					$cols['address_line2']   = __('Address 2', 'give');
197
+					$cols['address_city']    = __('City', 'give');
198
+					$cols['address_state']   = __('State', 'give');
199
+					$cols['address_zip']     = __('Zip', 'give');
200
+					$cols['address_country'] = __('Country', 'give');
201 201
 					break;
202 202
 				case 'donation_total':
203
-					$cols['donation_total'] = __( 'Donation Total', 'give' );
203
+					$cols['donation_total'] = __('Donation Total', 'give');
204 204
 					break;
205 205
 				case 'currency_code':
206
-					$cols['currency_code'] = __( 'Currency Code', 'give' );
206
+					$cols['currency_code'] = __('Currency Code', 'give');
207 207
 					break;
208 208
 				case 'currency_symbol':
209
-					$cols['currency_symbol'] = __( 'Currency Symbol', 'give' );
209
+					$cols['currency_symbol'] = __('Currency Symbol', 'give');
210 210
 					break;
211 211
 				case 'donation_status':
212
-					$cols['donation_status'] = __( 'Donation Status', 'give' );
212
+					$cols['donation_status'] = __('Donation Status', 'give');
213 213
 					break;
214 214
 				case 'payment_gateway':
215
-					$cols['payment_gateway'] = __( 'Payment Gateway', 'give' );
215
+					$cols['payment_gateway'] = __('Payment Gateway', 'give');
216 216
 				case 'payment_mode':
217
-					$cols['payment_mode'] = __( 'Payment Mode', 'give' );
217
+					$cols['payment_mode'] = __('Payment Mode', 'give');
218 218
 					break;
219 219
 				case 'form_id':
220
-					$cols['form_id'] = __( 'Form ID', 'give' );
220
+					$cols['form_id'] = __('Form ID', 'give');
221 221
 					break;
222 222
 				case 'form_title':
223
-					$cols['form_title'] = __( 'Form Title', 'give' );
223
+					$cols['form_title'] = __('Form Title', 'give');
224 224
 					break;
225 225
 				case 'form_level_id':
226
-					$cols['form_level_id'] = __( 'Level ID', 'give' );
226
+					$cols['form_level_id'] = __('Level ID', 'give');
227 227
 					break;
228 228
 				case 'form_level_title':
229
-					$cols['form_level_title'] = __( 'Level Title', 'give' );
229
+					$cols['form_level_title'] = __('Level Title', 'give');
230 230
 					break;
231 231
 				case 'donation_date':
232
-					$cols['donation_date'] = __( 'Donation Date', 'give' );
232
+					$cols['donation_date'] = __('Donation Date', 'give');
233 233
 					break;
234 234
 				case 'donation_time':
235
-					$cols['donation_time'] = __( 'Donation Time', 'give' );
235
+					$cols['donation_time'] = __('Donation Time', 'give');
236 236
 					break;
237 237
 				case 'userid':
238
-					$cols['userid'] = __( 'User ID', 'give' );
238
+					$cols['userid'] = __('User ID', 'give');
239 239
 					break;
240 240
 				case 'donorid':
241
-					$cols['donorid'] = __( 'Donor ID', 'give' );
241
+					$cols['donorid'] = __('Donor ID', 'give');
242 242
 					break;
243 243
 				case 'donor_ip':
244
-					$cols['donor_ip'] = __( 'Donor IP Address', 'give' );
244
+					$cols['donor_ip'] = __('Donor IP Address', 'give');
245 245
 					break;
246 246
 				default:
247
-					$cols[ $key ] = $key;
247
+					$cols[$key] = $key;
248 248
 
249 249
 			}
250 250
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 * @param array $cols columns name for CSV
258 258
 		 * @param array $columns columns select by admin to export
259 259
 		 */
260
-		return (array) apply_filters( 'give_export_donation_get_columns_name', $cols, $columns );
260
+		return (array) apply_filters('give_export_donation_get_columns_name', $cols, $columns);
261 261
 	}
262 262
 
263 263
 	/**
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return array $args donation argument
271 271
 	 */
272
-	public function get_donation_argument( $args = array() ) {
272
+	public function get_donation_argument($args = array()) {
273 273
 		$defaults = array(
274 274
 			'number' => 30,
275 275
 			'page'   => $this->step,
276 276
 			'status' => $this->status,
277 277
 		);
278 278
 		// Date query.
279
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
280
-			if ( ! empty( $this->start ) ) {
281
-				$defaults['date_query'][0]['after'] = date( 'Y-n-d 00:00:00', strtotime( $this->start ) );
279
+		if ( ! empty($this->start) || ! empty($this->end)) {
280
+			if ( ! empty($this->start)) {
281
+				$defaults['date_query'][0]['after'] = date('Y-n-d 00:00:00', strtotime($this->start));
282 282
 			}
283
-			if ( ! empty( $this->end ) ) {
284
-				$defaults['date_query'][0]['before'] = date( 'Y-n-d 00:00:00', strtotime( $this->end ) );
283
+			if ( ! empty($this->end)) {
284
+				$defaults['date_query'][0]['before'] = date('Y-n-d 00:00:00', strtotime($this->end));
285 285
 			}
286 286
 		}
287 287
 
288
-		if ( ! empty( $this->form_id ) ) {
289
-			$defaults['give_forms'] = is_array( $this->form_id ) ? $this->form_id : array( $this->form_id );
288
+		if ( ! empty($this->form_id)) {
289
+			$defaults['give_forms'] = is_array($this->form_id) ? $this->form_id : array($this->form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 2.1.3
297 297
 		 */
298
-		return apply_filters( 'give_export_donations_donation_query_args', wp_parse_args( $args, $defaults ) );
298
+		return apply_filters('give_export_donations_donation_query_args', wp_parse_args($args, $defaults));
299 299
 	}
300 300
 
301 301
 	/**
@@ -314,130 +314,130 @@  discard block
 block discarded – undo
314 314
 		$data = array();
315 315
 		$i    = 0;
316 316
 		// Payment query.
317
-		$payments = give_get_payments( $this->get_donation_argument() );
317
+		$payments = give_get_payments($this->get_donation_argument());
318 318
 
319
-		if ( $payments ) {
319
+		if ($payments) {
320 320
 
321
-			foreach ( $payments as $payment ) {
321
+			foreach ($payments as $payment) {
322 322
 
323 323
 				$columns      = $this->csv_cols();
324
-				$payment      = new Give_Payment( $payment->ID );
324
+				$payment      = new Give_Payment($payment->ID);
325 325
 				$payment_meta = $payment->payment_meta;
326 326
 				$address      = $payment->address;
327 327
 
328 328
 				// Set columns.
329
-				if ( ! empty( $columns['donation_id'] ) ) {
330
-					$data[ $i ]['donation_id'] = $payment->ID;
329
+				if ( ! empty($columns['donation_id'])) {
330
+					$data[$i]['donation_id'] = $payment->ID;
331 331
 				}
332 332
 
333
-				if ( ! empty( $columns['seq_id'] ) ) {
334
-					$data[ $i ]['seq_id'] = Give()->seq_donation_number->get_serial_code( $payment->ID );
333
+				if ( ! empty($columns['seq_id'])) {
334
+					$data[$i]['seq_id'] = Give()->seq_donation_number->get_serial_code($payment->ID);
335 335
 				}
336 336
 
337
-				if ( ! empty( $columns['title_prefix'] ) ) {
338
-					$data[ $i ]['title_prefix'] = ! empty( $payment->title_prefix ) ? $payment->title_prefix : '';
337
+				if ( ! empty($columns['title_prefix'])) {
338
+					$data[$i]['title_prefix'] = ! empty($payment->title_prefix) ? $payment->title_prefix : '';
339 339
 				}
340 340
 
341
-				if ( ! empty( $columns['first_name'] ) ) {
342
-					$data[ $i ]['first_name'] = isset( $payment->first_name ) ? $payment->first_name : '';
341
+				if ( ! empty($columns['first_name'])) {
342
+					$data[$i]['first_name'] = isset($payment->first_name) ? $payment->first_name : '';
343 343
 				}
344 344
 
345
-				if ( ! empty( $columns['last_name'] ) ) {
346
-					$data[ $i ]['last_name'] = isset( $payment->last_name ) ? $payment->last_name : '';
345
+				if ( ! empty($columns['last_name'])) {
346
+					$data[$i]['last_name'] = isset($payment->last_name) ? $payment->last_name : '';
347 347
 				}
348 348
 
349
-				if ( ! empty( $columns['email'] ) ) {
350
-					$data[ $i ]['email'] = $payment->email;
349
+				if ( ! empty($columns['email'])) {
350
+					$data[$i]['email'] = $payment->email;
351 351
 				}
352 352
 
353
-				if ( ! empty( $columns['company'] ) ) {
354
-					$data[ $i ]['company'] = empty( $payment_meta['_give_donation_company'] ) ? '' : str_replace( "\'", "'", $payment_meta['_give_donation_company'] );
353
+				if ( ! empty($columns['company'])) {
354
+					$data[$i]['company'] = empty($payment_meta['_give_donation_company']) ? '' : str_replace("\'", "'", $payment_meta['_give_donation_company']);
355 355
 				}
356 356
 
357
-				if ( ! empty( $columns['address_line1'] ) ) {
358
-					$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
359
-					$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
360
-					$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
361
-					$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
362
-					$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
363
-					$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
357
+				if ( ! empty($columns['address_line1'])) {
358
+					$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
359
+					$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
360
+					$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
361
+					$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
362
+					$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
363
+					$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
364 364
 				}
365 365
 
366
-				if ( ! empty( $columns['donation_total'] ) ) {
367
-					$data[ $i ]['donation_total'] = give_format_amount( give_donation_amount( $payment->ID ) );
366
+				if ( ! empty($columns['donation_total'])) {
367
+					$data[$i]['donation_total'] = give_format_amount(give_donation_amount($payment->ID));
368 368
 				}
369 369
 
370
-				if ( ! empty( $columns['currency_code'] ) ) {
371
-					$data[ $i ]['currency_code'] = empty( $payment_meta['_give_payment_currency'] ) ? give_get_currency() : $payment_meta['_give_payment_currency'];
370
+				if ( ! empty($columns['currency_code'])) {
371
+					$data[$i]['currency_code'] = empty($payment_meta['_give_payment_currency']) ? give_get_currency() : $payment_meta['_give_payment_currency'];
372 372
 				}
373 373
 
374
-				if ( ! empty( $columns['currency_symbol'] ) ) {
375
-					$currency_code                 = $data[ $i ]['currency_code'];
376
-					$data[ $i ]['currency_symbol'] = give_currency_symbol( $currency_code, true );
374
+				if ( ! empty($columns['currency_symbol'])) {
375
+					$currency_code                 = $data[$i]['currency_code'];
376
+					$data[$i]['currency_symbol'] = give_currency_symbol($currency_code, true);
377 377
 				}
378 378
 
379
-				if ( ! empty( $columns['donation_status'] ) ) {
380
-					$data[ $i ]['donation_status'] = give_get_payment_status( $payment, true );
379
+				if ( ! empty($columns['donation_status'])) {
380
+					$data[$i]['donation_status'] = give_get_payment_status($payment, true);
381 381
 				}
382 382
 
383
-				if ( ! empty( $columns['payment_gateway'] ) ) {
384
-					$data[ $i ]['payment_gateway'] = $payment->gateway;
383
+				if ( ! empty($columns['payment_gateway'])) {
384
+					$data[$i]['payment_gateway'] = $payment->gateway;
385 385
 				}
386 386
 
387
-				if ( ! empty( $columns['payment_mode'] ) ) {
388
-					$data[ $i ]['payment_mode'] = $payment->mode;
387
+				if ( ! empty($columns['payment_mode'])) {
388
+					$data[$i]['payment_mode'] = $payment->mode;
389 389
 				}
390 390
 
391
-				if ( ! empty( $columns['form_id'] ) ) {
392
-					$data[ $i ]['form_id'] = $payment->form_id;
391
+				if ( ! empty($columns['form_id'])) {
392
+					$data[$i]['form_id'] = $payment->form_id;
393 393
 				}
394 394
 
395
-				if ( ! empty( $columns['form_title'] ) ) {
396
-					$data[ $i ]['form_title'] = get_the_title( $payment->form_id );
395
+				if ( ! empty($columns['form_title'])) {
396
+					$data[$i]['form_title'] = get_the_title($payment->form_id);
397 397
 				}
398 398
 
399
-				if ( ! empty( $columns['form_level_id'] ) ) {
400
-					$data[ $i ]['form_level_id'] = $payment->price_id;
399
+				if ( ! empty($columns['form_level_id'])) {
400
+					$data[$i]['form_level_id'] = $payment->price_id;
401 401
 				}
402 402
 
403
-				if ( ! empty( $columns['form_level_title'] ) ) {
404
-					$var_prices = give_has_variable_prices( $payment->form_id );
405
-					if ( empty( $var_prices ) ) {
406
-						$data[ $i ]['form_level_title'] = '';
403
+				if ( ! empty($columns['form_level_title'])) {
404
+					$var_prices = give_has_variable_prices($payment->form_id);
405
+					if (empty($var_prices)) {
406
+						$data[$i]['form_level_title'] = '';
407 407
 					} else {
408
-						if ( 'custom' === $payment->price_id ) {
409
-							$custom_amount_text = give_get_meta( $payment->form_id, '_give_custom_amount_text', true );
408
+						if ('custom' === $payment->price_id) {
409
+							$custom_amount_text = give_get_meta($payment->form_id, '_give_custom_amount_text', true);
410 410
 
411
-							if ( empty( $custom_amount_text ) ) {
412
-								$custom_amount_text = esc_html__( 'Custom', 'give' );
411
+							if (empty($custom_amount_text)) {
412
+								$custom_amount_text = esc_html__('Custom', 'give');
413 413
 							}
414
-							$data[ $i ]['form_level_title'] = $custom_amount_text;
414
+							$data[$i]['form_level_title'] = $custom_amount_text;
415 415
 						} else {
416
-							$data[ $i ]['form_level_title'] = give_get_price_option_name( $payment->form_id, $payment->price_id );
416
+							$data[$i]['form_level_title'] = give_get_price_option_name($payment->form_id, $payment->price_id);
417 417
 						}
418 418
 					}
419 419
 				}
420 420
 
421
-				if ( ! empty( $columns['donation_date'] ) ) {
422
-					$payment_date                = strtotime( $payment->date );
423
-					$data[ $i ]['donation_date'] = date( give_date_format(), $payment_date );
421
+				if ( ! empty($columns['donation_date'])) {
422
+					$payment_date                = strtotime($payment->date);
423
+					$data[$i]['donation_date'] = date(give_date_format(), $payment_date);
424 424
 				}
425 425
 
426
-				if ( ! empty( $columns['donation_time'] ) ) {
427
-					$payment_date                = strtotime( $payment->date );
428
-					$data[ $i ]['donation_time'] = date_i18n( 'H', $payment_date ) . ':' . date( 'i', $payment_date );
426
+				if ( ! empty($columns['donation_time'])) {
427
+					$payment_date                = strtotime($payment->date);
428
+					$data[$i]['donation_time'] = date_i18n('H', $payment_date).':'.date('i', $payment_date);
429 429
 				}
430 430
 
431
-				if ( ! empty( $columns['userid'] ) ) {
432
-					$data[ $i ]['userid'] = $payment->user_id;
431
+				if ( ! empty($columns['userid'])) {
432
+					$data[$i]['userid'] = $payment->user_id;
433 433
 				}
434 434
 
435
-				if ( ! empty( $columns['donorid'] ) ) {
436
-					$data[ $i ]['donorid'] = $payment->customer_id;
435
+				if ( ! empty($columns['donorid'])) {
436
+					$data[$i]['donorid'] = $payment->customer_id;
437 437
 				}
438 438
 
439
-				if ( ! empty( $columns['donor_ip'] ) ) {
440
-					$data[ $i ]['donor_ip'] = give_get_payment_user_ip( $payment->ID );
439
+				if ( ! empty($columns['donor_ip'])) {
440
+					$data[$i]['donor_ip'] = give_get_payment_user_ip($payment->ID);
441 441
 				}
442 442
 
443 443
 				// Add custom field data.
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 				);
470 470
 
471 471
 				// Removing above keys...
472
-				foreach ( $remove_keys as $key ) {
473
-					unset( $columns[ $key ] );
472
+				foreach ($remove_keys as $key) {
473
+					unset($columns[$key]);
474 474
 				}
475 475
 
476 476
 				// Now loop through remaining meta fields.
477
-				foreach ( $columns as $col ) {
478
-					$field_data         = get_post_meta( $payment->ID, $col, true );
479
-					$data[ $i ][ $col ] = $field_data;
480
-					unset( $columns[ $col ] );
477
+				foreach ($columns as $col) {
478
+					$field_data         = get_post_meta($payment->ID, $col, true);
479
+					$data[$i][$col] = $field_data;
480
+					unset($columns[$col]);
481 481
 				}
482 482
 
483 483
 				/**
@@ -492,27 +492,27 @@  discard block
 block discarded – undo
492 492
 				 *
493 493
 				 * @return array Donation data
494 494
 				 */
495
-				$data[ $i ] = apply_filters( 'give_export_donation_data', $data[ $i ], $payment, $columns, $this );
495
+				$data[$i] = apply_filters('give_export_donation_data', $data[$i], $payment, $columns, $this);
496 496
 
497 497
 				$new_data = array();
498
-				$old_data = $data[ $i ];
498
+				$old_data = $data[$i];
499 499
 
500 500
 				// sorting the columns bas on row
501
-				foreach ( $this->csv_cols() as $key => $value ) {
502
-					if ( array_key_exists( $key, $old_data ) ) {
503
-						$new_data[ $key ] = $old_data[ $key ];
501
+				foreach ($this->csv_cols() as $key => $value) {
502
+					if (array_key_exists($key, $old_data)) {
503
+						$new_data[$key] = $old_data[$key];
504 504
 					}
505 505
 				}
506 506
 
507
-				$data[ $i ] = $new_data;
507
+				$data[$i] = $new_data;
508 508
 
509 509
 				// Increment iterator.
510
-				$i ++;
510
+				$i++;
511 511
 
512 512
 			}
513 513
 
514
-			$data = apply_filters( 'give_export_get_data', $data );
515
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
514
+			$data = apply_filters('give_export_get_data', $data);
515
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
516 516
 
517 517
 			return $data;
518 518
 
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
 	 * @return int
531 531
 	 */
532 532
 	public function get_percentage_complete() {
533
-		$args = $this->get_donation_argument( array( 'number' => - 1 ) );
534
-		if ( isset( $args['page'] ) ) {
535
-			unset( $args['page'] );
533
+		$args = $this->get_donation_argument(array('number' => -1));
534
+		if (isset($args['page'])) {
535
+			unset($args['page']);
536 536
 		}
537
-		$query      = give_get_payments( $args );
538
-		$total      = count( $query );
537
+		$query      = give_get_payments($args);
538
+		$total      = count($query);
539 539
 		$percentage = 100;
540
-		if ( $total > 0 ) {
541
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
540
+		if ($total > 0) {
541
+			$percentage = ((30 * $this->step) / $total) * 100;
542 542
 		}
543
-		if ( $percentage > 100 ) {
543
+		if ($percentage > 100) {
544 544
 			$percentage = 100;
545 545
 		}
546 546
 
@@ -562,23 +562,23 @@  discard block
 block discarded – undo
562 562
 		$data     = $this->get_data();
563 563
 		$cols     = $this->get_csv_cols();
564 564
 
565
-		if ( $data ) {
565
+		if ($data) {
566 566
 
567 567
 			// Output each row
568
-			foreach ( $data as $row ) {
568
+			foreach ($data as $row) {
569 569
 				$i = 1;
570
-				foreach ( $row as $col_id => $column ) {
570
+				foreach ($row as $col_id => $column) {
571 571
 					// Make sure the column is valid
572
-					if ( array_key_exists( $col_id, $cols ) ) {
573
-						$row_data .= '"' . preg_replace( '/"/', "'", $column ) . '"';
574
-						$row_data .= $i == count( $cols ) ? '' : ',';
575
-						$i ++;
572
+					if (array_key_exists($col_id, $cols)) {
573
+						$row_data .= '"'.preg_replace('/"/', "'", $column).'"';
574
+						$row_data .= $i == count($cols) ? '' : ',';
575
+						$i++;
576 576
 					}
577 577
 				}
578 578
 				$row_data .= "\r\n";
579 579
 			}
580 580
 
581
-			$this->stash_step_data( $row_data );
581
+			$this->stash_step_data($row_data);
582 582
 
583 583
 			return $row_data;
584 584
 		}
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 1 patch
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly..
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,136 +25,136 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
-		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
38
+	if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) {
39
+		wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403));
40 40
 	}
41 41
 
42
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
42
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php';
43 43
 
44 44
 	$daterange = utf8_decode(
45 45
 		sprintf(
46 46
 		/* translators: 1: start date 2: end date */
47
-			__( '%1$s to %2$s', 'give' ),
48
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
49
-			date_i18n( give_date_format() )
47
+			__('%1$s to %2$s', 'give'),
48
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
49
+			date_i18n(give_date_format())
50 50
 		)
51 51
 	);
52 52
 
53
-	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
54
-	$tags_enabled       = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
53
+	$categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
54
+	$tags_enabled       = give_is_setting_enabled(give_get_option('tags', 'disabled'));
55 55
 
56
-	$pdf          = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false );
57
-	$default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' );
56
+	$pdf          = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false);
57
+	$default_font = apply_filters('give_pdf_default_font', 'Helvetica');
58 58
 	$custom_font  = 'dejavusans';
59 59
 	$font_style   = '';
60 60
 
61 61
 	if (
62
-		file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) &&
62
+		file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') &&
63 63
 
64 64
 		// RIAL exist for backward compatibility.
65
-		in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) )
65
+		in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR'))
66 66
 	) {
67
-		TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' );
67
+		TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', '');
68 68
 		$custom_font = 'CODE2000';
69 69
 		$font_style  = 'B';
70 70
 	}
71 71
 
72
-	$pdf->AddPage( 'L', 'A4' );
73
-	$pdf->setImageScale( 1.5 );
74
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
75
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
76
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
72
+	$pdf->AddPage('L', 'A4');
73
+	$pdf->setImageScale(1.5);
74
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
75
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
76
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
77 77
 
78 78
 	// Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/.
79
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/dist/images/give-logo-small.png' ), 247, 8 );
79
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/dist/images/give-logo-small.png'), 247, 8);
80 80
 
81
-	$pdf->SetMargins( 8, 8, 8 );
82
-	$pdf->SetX( 8 );
81
+	$pdf->SetMargins(8, 8, 8);
82
+	$pdf->SetX(8);
83 83
 
84
-	$pdf->SetFont( $default_font, '', 16 );
85
-	$pdf->SetTextColor( 50, 50, 50 );
86
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
84
+	$pdf->SetFont($default_font, '', 16);
85
+	$pdf->SetTextColor(50, 50, 50);
86
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
87 87
 
88
-	$pdf->SetFont( $default_font, '', 13 );
89
-	$pdf->SetTextColor( 150, 150, 150 );
90
-	$pdf->Ln( 1 );
91
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
88
+	$pdf->SetFont($default_font, '', 13);
89
+	$pdf->SetTextColor(150, 150, 150);
90
+	$pdf->Ln(1);
91
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
92 92
 	$pdf->Ln();
93
-	$pdf->SetTextColor( 50, 50, 50 );
94
-	$pdf->SetFont( $default_font, '', 14 );
95
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
96
-	$pdf->SetFont( $default_font, '', 12 );
93
+	$pdf->SetTextColor(50, 50, 50);
94
+	$pdf->SetFont($default_font, '', 14);
95
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
96
+	$pdf->SetFont($default_font, '', 12);
97 97
 
98
-	$pdf->SetFillColor( 238, 238, 238 );
99
-	$pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color.
100
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
101
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
98
+	$pdf->SetFillColor(238, 238, 238);
99
+	$pdf->SetTextColor(0, 0, 0, 100); // Set Black color.
100
+	$pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
101
+	$pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
102 102
 
103 103
 	// Display Categories Heading only, if user has opted for it.
104
-	if ( $categories_enabled ) {
105
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
104
+	if ($categories_enabled) {
105
+		$pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
106 106
 	}
107 107
 
108 108
 	// Display Tags Heading only, if user has opted for it.
109
-	if ( $tags_enabled ) {
110
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
109
+	if ($tags_enabled) {
110
+		$pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
111 111
 	}
112 112
 
113
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
114
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
113
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
114
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
115 115
 
116 116
 	// Set Custom Font to support various currencies.
117
-	$pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 );
117
+	$pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12);
118 118
 
119 119
 	// Object for getting stats.
120 120
 	$donation_stats = new Give_Payment_Stats();
121 121
 
122
-	$give_forms = get_posts( array(
122
+	$give_forms = get_posts(array(
123 123
 		'post_type'        => 'give_forms',
124
-		'posts_per_page'   => - 1,
124
+		'posts_per_page'   => -1,
125 125
 		'suppress_filters' => false,
126
-	) );
126
+	));
127 127
 
128
-	if ( $give_forms ) {
129
-		$pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) );
128
+	if ($give_forms) {
129
+		$pdf->SetWidths(array(50, 50, 45, 45, 45, 45));
130 130
 
131
-		foreach ( $give_forms as $form ):
132
-			$pdf->SetFillColor( 255, 255, 255 );
131
+		foreach ($give_forms as $form):
132
+			$pdf->SetFillColor(255, 255, 255);
133 133
 
134 134
 			$title = $form->post_title;
135 135
 
136
-			if ( give_has_variable_prices( $form->ID ) ) {
137
-				$price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' );
136
+			if (give_has_variable_prices($form->ID)) {
137
+				$price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8');
138 138
 			} else {
139
-				$price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) );
139
+				$price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true));
140 140
 			}
141 141
 
142 142
 			// Display Categories Data only, if user has opted for it.
143 143
 			$categories = array();
144
-			if ( $categories_enabled ) {
145
-				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
146
-				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
144
+			if ($categories_enabled) {
145
+				$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
146
+				$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
147 147
 			}
148 148
 
149 149
 			// Display Tags Data only, if user has opted for it.
150 150
 			$tags = array();
151
-			if ( $tags_enabled ) {
152
-				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
153
-				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
151
+			if ($tags_enabled) {
152
+				$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
153
+				$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
154 154
 			}
155 155
 
156
-			$sales    = $donation_stats->get_sales( $form->ID, 'this_year' );
157
-			$earnings = give_currency_filter( give_format_amount( $donation_stats->get_earnings( $form->ID, 'this_year' ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) );
156
+			$sales    = $donation_stats->get_sales($form->ID, 'this_year');
157
+			$earnings = give_currency_filter(give_format_amount($donation_stats->get_earnings($form->ID, 'this_year'), array('sanitize' => false,)), array('decode_currency' => true));
158 158
 
159 159
 			// This will help filter data before appending it to PDF Receipt.
160 160
 			$prepare_pdf_data   = array();
@@ -162,54 +162,54 @@  discard block
 block discarded – undo
162 162
 			$prepare_pdf_data[] = $price;
163 163
 
164 164
 			// Append Categories Data only, if user has opted for it.
165
-			if ( $categories_enabled ) {
165
+			if ($categories_enabled) {
166 166
 				$prepare_pdf_data[] = $categories;
167 167
 			}
168 168
 
169 169
 			// Append Tags Data only, if user has opted for it.
170
-			if ( $tags_enabled ) {
170
+			if ($tags_enabled) {
171 171
 				$prepare_pdf_data[] = $tags;
172 172
 			}
173 173
 
174 174
 			$prepare_pdf_data[] = $sales;
175 175
 			$prepare_pdf_data[] = $earnings;
176 176
 
177
-			$pdf->Row( $prepare_pdf_data );
177
+			$pdf->Row($prepare_pdf_data);
178 178
 
179 179
 		endforeach;
180 180
 	} else {
181 181
 
182 182
 		// Fix: Minor Styling Alignment Issue for PDF.
183
-		if ( $categories_enabled && $tags_enabled ) {
183
+		if ($categories_enabled && $tags_enabled) {
184 184
 			$no_found_width = 280;
185
-		} elseif ( $categories_enabled || $tags_enabled ) {
185
+		} elseif ($categories_enabled || $tags_enabled) {
186 186
 			$no_found_width = 235;
187 187
 		} else {
188 188
 			$no_found_width = 190;
189 189
 		}
190
-		$title = utf8_decode( __( 'No forms found.', 'give' ) );
191
-		$pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false );
190
+		$title = utf8_decode(__('No forms found.', 'give'));
191
+		$pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false);
192 192
 	}// End if().
193 193
 	$pdf->Ln();
194
-	$pdf->SetTextColor( 50, 50, 50 );
195
-	$pdf->SetFont( $default_font, '', 14 );
194
+	$pdf->SetTextColor(50, 50, 50);
195
+	$pdf->SetFont($default_font, '', 14);
196 196
 
197 197
 	// Output Graph on a new page.
198
-	$pdf->AddPage( 'L', 'A4' );
199
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
200
-	$pdf->SetFont( $default_font, '', 12 );
198
+	$pdf->AddPage('L', 'A4');
199
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
200
+	$pdf->SetFont($default_font, '', 12);
201 201
 
202
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
203
-	$image = str_replace( ' ', '%20', $image );
202
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
203
+	$image = str_replace(' ', '%20', $image);
204 204
 
205
-	$pdf->SetX( 25 );
206
-	$pdf->Image( $image . '&file=.png' );
207
-	$pdf->Ln( 7 );
208
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
205
+	$pdf->SetX(25);
206
+	$pdf->Image($image.'&file=.png');
207
+	$pdf->Ln(7);
208
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
209 209
 	exit();
210 210
 }
211 211
 
212
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
212
+add_action('give_generate_pdf', 'give_generate_pdf');
213 213
 
214 214
 /**
215 215
  * Draws Chart for PDF Report.
@@ -226,38 +226,38 @@  discard block
 block discarded – undo
226 226
  * @return string $chart->getUrl() URL for the Google Chart
227 227
  */
228 228
 function give_draw_chart_image() {
229
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
230
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
231
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
229
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
230
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
231
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
232 232
 
233
-	$chart = new GoogleChart( 'lc', 900, 330 );
233
+	$chart = new GoogleChart('lc', 900, 330);
234 234
 
235 235
 	$i        = 1;
236 236
 	$earnings = "";
237 237
 	$sales    = "";
238 238
 
239
-	while ( $i <= 12 ) :
240
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
241
-		$sales    .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
242
-		$i ++;
239
+	while ($i <= 12) :
240
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
241
+		$sales    .= give_get_sales_by_date(null, $i, date('Y')).",";
242
+		$i++;
243 243
 	endwhile;
244 244
 
245
-	$earnings_array = explode( ",", $earnings );
246
-	$sales_array    = explode( ",", $sales );
245
+	$earnings_array = explode(",", $earnings);
246
+	$sales_array    = explode(",", $sales);
247 247
 
248 248
 	$i = 0;
249
-	while ( $i <= 11 ) {
250
-		if ( empty( $sales_array[ $i ] ) ) {
251
-			$sales_array[ $i ] = 0;
249
+	while ($i <= 11) {
250
+		if (empty($sales_array[$i])) {
251
+			$sales_array[$i] = 0;
252 252
 		}
253
-		$i ++;
253
+		$i++;
254 254
 	}
255 255
 
256 256
 	$min_earnings   = 0;
257
-	$max_earnings   = max( $earnings_array );
258
-	$earnings_scale = round( $max_earnings, - 1 );
257
+	$max_earnings   = max($earnings_array);
258
+	$earnings_scale = round($max_earnings, - 1);
259 259
 
260
-	$data = new GoogleChartData( array(
260
+	$data = new GoogleChartData(array(
261 261
 		$earnings_array[0],
262 262
 		$earnings_array[1],
263 263
 		$earnings_array[2],
@@ -270,25 +270,25 @@  discard block
 block discarded – undo
270 270
 		$earnings_array[9],
271 271
 		$earnings_array[10],
272 272
 		$earnings_array[11],
273
-	) );
273
+	));
274 274
 
275
-	$data->setLegend( __( 'Income', 'give' ) );
276
-	$data->setColor( '1b58a3' );
277
-	$chart->addData( $data );
275
+	$data->setLegend(__('Income', 'give'));
276
+	$data->setColor('1b58a3');
277
+	$chart->addData($data);
278 278
 
279
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
280
-	$shape_marker->setColor( '000000' );
281
-	$shape_marker->setSize( 7 );
282
-	$shape_marker->setBorder( 2 );
283
-	$shape_marker->setData( $data );
284
-	$chart->addMarker( $shape_marker );
279
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
280
+	$shape_marker->setColor('000000');
281
+	$shape_marker->setSize(7);
282
+	$shape_marker->setBorder(2);
283
+	$shape_marker->setData($data);
284
+	$chart->addMarker($shape_marker);
285 285
 
286
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
287
-	$value_marker->setColor( '000000' );
288
-	$value_marker->setData( $data );
289
-	$chart->addMarker( $value_marker );
286
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
287
+	$value_marker->setColor('000000');
288
+	$value_marker->setData($data);
289
+	$chart->addMarker($value_marker);
290 290
 
291
-	$data = new GoogleChartData( array(
291
+	$data = new GoogleChartData(array(
292 292
 		$sales_array[0],
293 293
 		$sales_array[1],
294 294
 		$sales_array[2],
@@ -301,46 +301,46 @@  discard block
 block discarded – undo
301 301
 		$sales_array[9],
302 302
 		$sales_array[10],
303 303
 		$sales_array[11],
304
-	) );
305
-	$data->setLegend( __( 'Donations', 'give' ) );
306
-	$data->setColor( 'ff6c1c' );
307
-	$chart->addData( $data );
308
-
309
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
310
-
311
-	$chart->setScale( 0, $max_earnings );
312
-
313
-	$y_axis = new GoogleChartAxis( 'y' );
314
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
315
-	$chart->addAxis( $y_axis );
316
-
317
-	$x_axis = new GoogleChartAxis( 'x' );
318
-	$x_axis->setTickMarks( 5 );
319
-	$x_axis->setLabels( array(
320
-		__( 'Jan', 'give' ),
321
-		__( 'Feb', 'give' ),
322
-		__( 'Mar', 'give' ),
323
-		__( 'Apr', 'give' ),
324
-		__( 'May', 'give' ),
325
-		__( 'June', 'give' ),
326
-		__( 'July', 'give' ),
327
-		__( 'Aug', 'give' ),
328
-		__( 'Sept', 'give' ),
329
-		__( 'Oct', 'give' ),
330
-		__( 'Nov', 'give' ),
331
-		__( 'Dec', 'give' ),
332
-	) );
333
-	$chart->addAxis( $x_axis );
334
-
335
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
336
-	$shape_marker->setSize( 6 );
337
-	$shape_marker->setBorder( 2 );
338
-	$shape_marker->setData( $data );
339
-	$chart->addMarker( $shape_marker );
340
-
341
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
342
-	$value_marker->setData( $data );
343
-	$chart->addMarker( $value_marker );
304
+	));
305
+	$data->setLegend(__('Donations', 'give'));
306
+	$data->setColor('ff6c1c');
307
+	$chart->addData($data);
308
+
309
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
310
+
311
+	$chart->setScale(0, $max_earnings);
312
+
313
+	$y_axis = new GoogleChartAxis('y');
314
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
315
+	$chart->addAxis($y_axis);
316
+
317
+	$x_axis = new GoogleChartAxis('x');
318
+	$x_axis->setTickMarks(5);
319
+	$x_axis->setLabels(array(
320
+		__('Jan', 'give'),
321
+		__('Feb', 'give'),
322
+		__('Mar', 'give'),
323
+		__('Apr', 'give'),
324
+		__('May', 'give'),
325
+		__('June', 'give'),
326
+		__('July', 'give'),
327
+		__('Aug', 'give'),
328
+		__('Sept', 'give'),
329
+		__('Oct', 'give'),
330
+		__('Nov', 'give'),
331
+		__('Dec', 'give'),
332
+	));
333
+	$chart->addAxis($x_axis);
334
+
335
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
336
+	$shape_marker->setSize(6);
337
+	$shape_marker->setBorder(2);
338
+	$shape_marker->setData($data);
339
+	$chart->addMarker($shape_marker);
340
+
341
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
342
+	$value_marker->setData($data);
343
+	$chart->addMarker($value_marker);
344 344
 
345 345
 	return $chart->getUrl();
346 346
 }
Please login to merge, or discard this patch.