Test Failed
Push — master ( bb0b3f...21ce85 )
by Devin
06:53 queued 01:10
created
includes/admin/add-ons.php 1 patch
Spacing   +15 added lines, -15 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,14 +25,14 @@  discard block
 block discarded – undo
25 25
 function give_add_ons_page() {
26 26
 	?>
27 27
 	<div class="wrap" id="give-add-ons">
28
-		<h1><?php echo esc_html( get_admin_page_title() ); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
28
+		<h1><?php echo esc_html(get_admin_page_title()); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php give_add_ons_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
 function give_add_ons_feed() {
50 50
 
51 51
 	$addons_debug = false; //set to true to debug
52
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
52
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
53 53
 
54
-	if ( false === $cache || ( true === $addons_debug && true === WP_DEBUG ) ) {
55
-		if ( function_exists( 'vip_safe_wp_remote_get' ) ) {
56
-			$feed = vip_safe_wp_remote_get( 'https://givewp.com/downloads/feed/', false, 3, 1, 20, array( 'sslverify' => false ) );
54
+	if (false === $cache || (true === $addons_debug && true === WP_DEBUG)) {
55
+		if (function_exists('vip_safe_wp_remote_get')) {
56
+			$feed = vip_safe_wp_remote_get('https://givewp.com/downloads/feed/', false, 3, 1, 20, array('sslverify' => false));
57 57
 		} else {
58
-			$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
58
+			$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
59 59
 		}
60 60
 
61
-		if ( ! is_wp_error( $feed ) && ! empty( $feed ) ) {
62
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
63
-				$cache = wp_remote_retrieve_body( $feed );
64
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
61
+		if ( ! is_wp_error($feed) && ! empty($feed)) {
62
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
63
+				$cache = wp_remote_retrieve_body($feed);
64
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
65 65
 			}
66 66
 		} else {
67 67
 			$cache = sprintf(
68 68
 				'<div class="error"><p>%s</p></div>',
69
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
69
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
70 70
 			);
71 71
 		}
72 72
 	}
73 73
 
74
-	echo wp_kses_post( $cache );
74
+	echo wp_kses_post($cache);
75 75
 }
Please login to merge, or discard this patch.
includes/admin/class-blank-slate.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8.13
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -75,63 +75,63 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function init() {
77 77
 		// Bail early if screen cannot be detected.
78
-		if ( empty( $this->screen ) ) {
78
+		if (empty($this->screen)) {
79 79
 			return null;
80 80
 		}
81 81
 
82 82
 		$content = array();
83 83
 
84 84
 		// Define content and hook into the appropriate action.
85
-		switch ( $this->screen ) {
85
+		switch ($this->screen) {
86 86
 			// Forms screen.
87 87
 			case 'edit-give_forms':
88
-				$this->form = $this->post_exists( 'give_forms' );
88
+				$this->form = $this->post_exists('give_forms');
89 89
 
90
-				if ( $this->form ) {
90
+				if ($this->form) {
91 91
 					// Form exists. Bail out.
92 92
 					return false;
93 93
 				} else {
94 94
 					// No forms exist.
95
-					$content = $this->get_content( 'no_forms' );
95
+					$content = $this->get_content('no_forms');
96 96
 				}
97 97
 
98
-				add_action( 'manage_posts_extra_tablenav', array( $this, 'render' ) );
98
+				add_action('manage_posts_extra_tablenav', array($this, 'render'));
99 99
 				break;
100 100
 			// Donations screen.
101 101
 			case 'give_forms_page_give-payment-history':
102
-				$this->form     = $this->post_exists( 'give_forms' );
103
-				$this->donation = $this->post_exists( 'give_payment' );
102
+				$this->form     = $this->post_exists('give_forms');
103
+				$this->donation = $this->post_exists('give_payment');
104 104
 
105
-				if ( $this->donation ) {
105
+				if ($this->donation) {
106 106
 					// Donation exists. Bail out.
107 107
 					return false;
108
-				} elseif ( ! $this->form ) {
108
+				} elseif ( ! $this->form) {
109 109
 					// No forms and no donations exist.
110
-					$content = $this->get_content( 'no_donations_or_forms' );
110
+					$content = $this->get_content('no_donations_or_forms');
111 111
 				} else {
112 112
 					// No donations exist but a form does exist.
113
-					$content = $this->get_content( 'no_donations' );
113
+					$content = $this->get_content('no_donations');
114 114
 				}
115 115
 
116
-				add_action( 'give_payments_page_bottom', array( $this, 'render' ) );
116
+				add_action('give_payments_page_bottom', array($this, 'render'));
117 117
 				break;
118 118
 			// Donors screen.
119 119
 			case 'give_forms_page_give-donors':
120
-				$this->form  = $this->post_exists( 'give_forms' );
120
+				$this->form  = $this->post_exists('give_forms');
121 121
 				$this->donor = $this->donor_exists();
122 122
 
123
-				if ( $this->donor ) {
123
+				if ($this->donor) {
124 124
 					// Donor exists. Bail out.
125 125
 					return false;
126
-				} elseif ( ! $this->form ) {
126
+				} elseif ( ! $this->form) {
127 127
 					// No forms and no donors exist.
128
-					$content = $this->get_content( 'no_donors_or_forms' );
128
+					$content = $this->get_content('no_donors_or_forms');
129 129
 				} else {
130 130
 					// No donors exist but a form does exist.
131
-					$content = $this->get_content( 'no_donors' );
131
+					$content = $this->get_content('no_donors');
132 132
 				}
133 133
 
134
-				add_action( 'give_donors_table_bottom', array( $this, 'render' ) );
134
+				add_action('give_donors_table_bottom', array($this, 'render'));
135 135
 				break;
136 136
 			default:
137 137
 				return null;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$this->content = $content;
141 141
 
142 142
 		// Hide non-essential UI elements.
143
-		add_action( 'admin_head', array( $this, 'hide_ui' ) );
143
+		add_action('admin_head', array($this, 'hide_ui'));
144 144
 	}
145 145
 
146 146
 	/**
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param string $which The location of the list table hook: 'top' or 'bottom'.
152 152
 	 */
153
-	public function render( $which = 'bottom' ) {
153
+	public function render($which = 'bottom') {
154 154
 		// Bail out to prevent content from rendering twice.
155
-		if ( 'top' === $which ) {
155
+		if ('top' === $which) {
156 156
 			return null;
157 157
 		}
158 158
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 		 *
178 178
 		 * @param string $screen The current screen ID.
179 179
 		 */
180
-		$content = apply_filters( 'give_blank_slate_content', $this->content, $screen );
180
+		$content = apply_filters('give_blank_slate_content', $this->content, $screen);
181 181
 
182
-		$template_path = GIVE_PLUGIN_DIR . 'includes/admin/views/blank-slate.php';
182
+		$template_path = GIVE_PLUGIN_DIR.'includes/admin/views/blank-slate.php';
183 183
 
184 184
 		include $template_path;
185 185
 	}
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
 	 * @param string $post_type Post type used in the query.
215 215
 	 * @return bool True if post exists, otherwise false.
216 216
 	 */
217
-	private function post_exists( $post_type ) {
217
+	private function post_exists($post_type) {
218 218
 		// Attempt to get a single post of the post type.
219
-		$query = new WP_Query( array(
219
+		$query = new WP_Query(array(
220 220
 			'post_type'              => $post_type,
221 221
 			'posts_per_page'         => 1,
222 222
 			'no_found_rows'          => false,
223 223
 			'update_post_meta_cache' => false,
224 224
 			'update_post_term_cache' => false,
225 225
 			'fields'                 => 'ids',
226
-			'post_status'            => array( 'any', 'trash' ),
227
-		) );
226
+			'post_status'            => array('any', 'trash'),
227
+		));
228 228
 
229 229
 		return $query->have_posts();
230 230
 	}
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	 * @return bool True if donor exists, otherwise false.
238 238
 	 */
239 239
 	private function donor_exists() {
240
-		$donors = Give()->donors->get_donors( array( 'number' => 1 ) );
240
+		$donors = Give()->donors->get_donors(array('number' => 1));
241 241
 
242
-		return ! empty( $donors );
242
+		return ! empty($donors);
243 243
 	}
244 244
 
245 245
 	/**
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 	 * @param string $context The key used to determine which content is returned.
251 251
 	 * @return array Blank slate content.
252 252
 	 */
253
-	private function get_content( $context ) {
253
+	private function get_content($context) {
254 254
 		// Define default content.
255 255
 		$defaults = array(
256
-			'image_url' => GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg',
257
-			'image_alt' => __( 'Give Icon', 'give' ),
258
-			'heading'   => __( 'No donation forms  found.', 'give' ),
259
-			'message'   => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
260
-			'cta_text'  => __( 'Create Donation Form', 'give' ),
261
-			'cta_link'  => admin_url( 'post-new.php?post_type=give_forms' ),
256
+			'image_url' => GIVE_PLUGIN_URL.'assets/dist/images/give-icon-full-circle.svg',
257
+			'image_alt' => __('Give Icon', 'give'),
258
+			'heading'   => __('No donation forms  found.', 'give'),
259
+			'message'   => __('The first step towards accepting online donations is to create a form.', 'give'),
260
+			'cta_text'  => __('Create Donation Form', 'give'),
261
+			'cta_link'  => admin_url('post-new.php?post_type=give_forms'),
262 262
 			'help'      => sprintf(
263 263
 				/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
264
-				__( 'Need help? Get started with %1$sGive 101%2$s.', 'give' ),
264
+				__('Need help? Get started with %1$sGive 101%2$s.', 'give'),
265 265
 				'<a href="http://docs.givewp.com/give101/" target="_blank">',
266 266
 				'</a>'
267 267
 			),
@@ -270,42 +270,42 @@  discard block
 block discarded – undo
270 270
 		// Define contextual content.
271 271
 		$content = array(
272 272
 			'no_donations_or_forms' => array(
273
-				'heading' => __( 'No donations found.', 'give' ),
274
-				'message' => __( 'Your donation history will appear here, but first, you need a donation form!', 'give' ),
273
+				'heading' => __('No donations found.', 'give'),
274
+				'message' => __('Your donation history will appear here, but first, you need a donation form!', 'give'),
275 275
 			),
276 276
 			'no_donations'          => array(
277
-				'heading'  => __( 'No donations found.', 'give' ),
278
-				'message'  => __( 'When your first donation arrives, a record of the donation will appear here.', 'give' ),
279
-				'cta_text' => __( 'View All Forms', 'give' ),
280
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
277
+				'heading'  => __('No donations found.', 'give'),
278
+				'message'  => __('When your first donation arrives, a record of the donation will appear here.', 'give'),
279
+				'cta_text' => __('View All Forms', 'give'),
280
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
281 281
 				'help'     => sprintf(
282 282
 					/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
283
-					__( 'Need help? Learn more about %1$sDonations%2$s.', 'give' ),
283
+					__('Need help? Learn more about %1$sDonations%2$s.', 'give'),
284 284
 					'<a href="http://docs.givewp.com/core-donations/">',
285 285
 					'</a>'
286 286
 				),
287 287
 			),
288 288
 			'no_donors_or_forms'    => array(
289
-				'heading' => __( 'No donors  found.', 'give' ),
290
-				'message' => __( 'Your donor history will appear here, but first, you need a donation form!', 'give' ),
289
+				'heading' => __('No donors  found.', 'give'),
290
+				'message' => __('Your donor history will appear here, but first, you need a donation form!', 'give'),
291 291
 			),
292 292
 			'no_donors'             => array(
293
-				'heading'  => __( 'No donors found.', 'give' ),
294
-				'message'  => __( 'When your first donation arrives, the donor will appear here.', 'give' ),
295
-				'cta_text' => __( 'View All Forms', 'give' ),
296
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
293
+				'heading'  => __('No donors found.', 'give'),
294
+				'message'  => __('When your first donation arrives, the donor will appear here.', 'give'),
295
+				'cta_text' => __('View All Forms', 'give'),
296
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
297 297
 				'help'     => sprintf(
298 298
 					/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
299
-					__( 'Need help? Learn more about %1$sDonors%2$s.', 'give' ),
299
+					__('Need help? Learn more about %1$sDonors%2$s.', 'give'),
300 300
 					'<a href="http://docs.givewp.com/core-donors/">',
301 301
 					'</a>'
302 302
 				),
303 303
 			),
304 304
 		);
305 305
 
306
-		if ( isset( $content[ $context ] ) ) {
306
+		if (isset($content[$context])) {
307 307
 			// Merge contextual content with defaults.
308
-			return wp_parse_args( $content[ $context ], $defaults );
308
+			return wp_parse_args($content[$context], $defaults);
309 309
 		} else {
310 310
 			// Return defaults if context is undefined.
311 311
 			return $defaults;
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 patch
Spacing   +56 added lines, -56 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
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * Constructor.
55 55
 	 */
56
-	public function __construct( $_step = 1 ) {
57
-		parent::__construct( $_step );
56
+	public function __construct($_step = 1) {
57
+		parent::__construct($_step);
58 58
 
59 59
 		$this->is_writable = true;
60 60
 	}
@@ -69,43 +69,43 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function get_data() {
71 71
 
72
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
72
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
73 73
 
74
-		if ( $this->step == 1 ) {
75
-			$this->delete_data( 'give_temp_recount_form_stats' );
74
+		if ($this->step == 1) {
75
+			$this->delete_data('give_temp_recount_form_stats');
76 76
 		}
77 77
 
78
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
78
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
79 79
 
80
-		if ( false === $totals ) {
80
+		if (false === $totals) {
81 81
 			$totals = array(
82 82
 				'earnings' => (float) 0,
83 83
 				'sales'    => 0,
84 84
 			);
85
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
85
+			$this->store_data('give_temp_recount_form_stats', $totals);
86 86
 		}
87 87
 
88
-		$args = apply_filters( 'give_recount_form_stats_args', array(
88
+		$args = apply_filters('give_recount_form_stats_args', array(
89 89
 			'give_forms' => $this->form_id,
90 90
 			'number'     => $this->per_step,
91 91
 			'status'     => $accepted_statuses,
92 92
 			'paged'      => $this->step,
93 93
 			'fields'     => 'ids',
94
-		) );
94
+		));
95 95
 
96
-		$payments = new Give_Payments_Query( $args );
96
+		$payments = new Give_Payments_Query($args);
97 97
 		$payments = $payments->get_payments();
98 98
 
99
-		if ( $payments ) {
100
-			foreach ( $payments as $payment ) {
99
+		if ($payments) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Ensure acceptable status only.
103
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
103
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				// Ensure only payments for this form are counted.
108
-				if ( $payment->form_id != $this->form_id ) {
108
+				if ($payment->form_id != $this->form_id) {
109 109
 					continue;
110 110
 				}
111 111
 
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 				 */
117 117
 				$earning_amount = apply_filters(
118 118
 					'give_donation_amount',
119
-					give_format_amount( $payment->total, array( 'donation_id' => $payment->ID ) ),
119
+					give_format_amount($payment->total, array('donation_id' => $payment->ID)),
120 120
 					$payment->total,
121 121
 					$payment->ID,
122
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
122
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
123 123
 				);
124 124
 
125
-				$totals['sales'] ++;
126
-				$totals['earnings'] += (float) give_maybe_sanitize_amount( $earning_amount );
125
+				$totals['sales']++;
126
+				$totals['earnings'] += (float) give_maybe_sanitize_amount($earning_amount);
127 127
 
128 128
 			}
129 129
 
130
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
130
+			$this->store_data('give_temp_recount_form_stats', $totals);
131 131
 
132 132
 			return true;
133 133
 		}
134 134
 
135 135
 
136
-		give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
137
-		give_update_meta( $this->form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
136
+		give_update_meta($this->form_id, '_give_form_sales', $totals['sales']);
137
+		give_update_meta($this->form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
138 138
 
139 139
 		return false;
140 140
 	}
@@ -146,35 +146,35 @@  discard block
 block discarded – undo
146 146
 	 * @return int
147 147
 	 */
148 148
 	public function get_percentage_complete() {
149
-		if ( $this->step == 1 ) {
150
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
149
+		if ($this->step == 1) {
150
+			$this->delete_data('give_recount_total_'.$this->form_id);
151 151
 		}
152 152
 
153
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
154
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
153
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
154
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
155 155
 
156
-		if ( false === $total ) {
156
+		if (false === $total) {
157 157
 			$total = 0;
158
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
158
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
159 159
 				'give_forms' => $this->form_id,
160
-				'number'     => - 1,
160
+				'number'     => -1,
161 161
 				'status'     => $accepted_statuses,
162 162
 				'fields'     => 'ids',
163
-			) );
163
+			));
164 164
 
165
-			$payments = new Give_Payments_Query( $args );
166
-			$total    = count( $payments->get_payments() );
167
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
165
+			$payments = new Give_Payments_Query($args);
166
+			$total    = count($payments->get_payments());
167
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
168 168
 
169 169
 		}
170 170
 
171 171
 		$percentage = 100;
172 172
 
173
-		if ( $total > 0 ) {
174
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
173
+		if ($total > 0) {
174
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
175 175
 		}
176 176
 
177
-		if ( $percentage > 100 ) {
177
+		if ($percentage > 100) {
178 178
 			$percentage = 100;
179 179
 		}
180 180
 
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @param array $request The Form Data passed into the batch processing
190 190
 	 */
191
-	public function set_properties( $request ) {
192
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
191
+	public function set_properties($request) {
192
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
193 193
 	}
194 194
 
195 195
 	/**
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function process_step() {
202 202
 
203
-		if ( ! $this->can_export() ) {
204
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
203
+		if ( ! $this->can_export()) {
204
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
205 205
 		}
206 206
 
207 207
 		$had_data = $this->get_data();
208 208
 
209
-		if ( $had_data ) {
209
+		if ($had_data) {
210 210
 			$this->done = false;
211 211
 
212 212
 			return true;
213 213
 		} else {
214
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
215
-			$this->delete_data( 'give_temp_recount_form_stats' );
214
+			$this->delete_data('give_recount_total_'.$this->form_id);
215
+			$this->delete_data('give_temp_recount_form_stats');
216 216
 			$this->done    = true;
217
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
217
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
218 218
 
219 219
 			return false;
220 220
 		}
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return mixed       Returns the data from the database
250 250
 	 */
251
-	private function get_stored_data( $key ) {
251
+	private function get_stored_data($key) {
252 252
 		global $wpdb;
253
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
253
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
254 254
 
255
-		if ( empty( $value ) ) {
255
+		if (empty($value)) {
256 256
 			return false;
257 257
 		}
258 258
 
259
-		$maybe_json = json_decode( $value );
260
-		if ( ! is_null( $maybe_json ) ) {
261
-			$value = json_decode( $value, true );
259
+		$maybe_json = json_decode($value);
260
+		if ( ! is_null($maybe_json)) {
261
+			$value = json_decode($value, true);
262 262
 		}
263 263
 
264 264
 		return $value;
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return void
276 276
 	 */
277
-	private function store_data( $key, $value ) {
277
+	private function store_data($key, $value) {
278 278
 		global $wpdb;
279 279
 
280
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
280
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
281 281
 
282 282
 		$data = array(
283 283
 			'option_name'  => $key,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			'%s',
292 292
 		);
293 293
 
294
-		$wpdb->replace( $wpdb->options, $data, $formats );
294
+		$wpdb->replace($wpdb->options, $data, $formats);
295 295
 	}
296 296
 
297 297
 	/**
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return void
305 305
 	 */
306
-	private function delete_data( $key ) {
306
+	private function delete_data($key) {
307 307
 		global $wpdb;
308
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
308
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
309 309
 	}
310 310
 
311 311
 }
312 312
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-all-stats.php 1 patch
Spacing   +100 added lines, -102 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
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Constructor.
75 75
 	 */
76
-	public function __construct( $_step = 1 ) {
77
-		parent::__construct( $_step );
76
+	public function __construct($_step = 1) {
77
+		parent::__construct($_step);
78 78
 
79 79
 		$this->is_writable = true;
80 80
 	}
@@ -89,108 +89,106 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function get_data() {
91 91
 
92
-		$totals             = $this->get_stored_data( 'give_temp_recount_all_stats' );
93
-		$payment_items      = $this->get_stored_data( 'give_temp_payment_items' );
94
-		$processed_payments = $this->get_stored_data( 'give_temp_processed_payments' );
95
-		$accepted_statuses  = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
92
+		$totals             = $this->get_stored_data('give_temp_recount_all_stats');
93
+		$payment_items      = $this->get_stored_data('give_temp_payment_items');
94
+		$processed_payments = $this->get_stored_data('give_temp_processed_payments');
95
+		$accepted_statuses  = apply_filters('give_recount_accepted_statuses', array('publish'));
96 96
 
97
-		if ( false === $totals ) {
97
+		if (false === $totals) {
98 98
 			$totals = array();
99 99
 		}
100 100
 
101
-		if ( false === $payment_items ) {
101
+		if (false === $payment_items) {
102 102
 			$payment_items = array();
103 103
 		}
104 104
 
105
-		if ( false === $processed_payments ) {
105
+		if (false === $processed_payments) {
106 106
 			$processed_payments = array();
107 107
 		}
108 108
 
109
-		$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
109
+		$all_forms = $this->get_stored_data('give_temp_form_ids');
110 110
 
111
-		$payments = $this->get_stored_data( 'give_temp_all_payments_data' );
111
+		$payments = $this->get_stored_data('give_temp_all_payments_data');
112 112
 
113
-		if ( empty( $payments ) ) {
114
-			$args = apply_filters( 'give_recount_form_stats_args', array(
113
+		if (empty($payments)) {
114
+			$args = apply_filters('give_recount_form_stats_args', array(
115 115
 				'give_forms' => $all_forms,
116 116
 				'number'     => $this->per_step,
117 117
 				'status'     => $accepted_statuses,
118 118
 				'paged'      => $this->step,
119 119
 				'output'     => 'give_payments',
120
-			) );
120
+			));
121 121
 
122
-			$payments_query = new Give_Payments_Query( $args );
122
+			$payments_query = new Give_Payments_Query($args);
123 123
 			$payments       = $payments_query->get_payments();
124 124
 		}
125 125
 
126
-		if ( ! empty( $payments ) ) {
126
+		if ( ! empty($payments)) {
127 127
 
128 128
 			//Loop through payments
129
-			foreach ( $payments as $payment ) {
129
+			foreach ($payments as $payment) {
130 130
 
131
-				$payment_id = ( ! empty( $payment['ID'] ) ? absint( $payment['ID'] ) : ( ! empty( $payment->ID ) ? absint( $payment->ID ) : false ) );
132
-				$payment = new Give_Payment( $payment_id );
131
+				$payment_id = ( ! empty($payment['ID']) ? absint($payment['ID']) : ( ! empty($payment->ID) ? absint($payment->ID) : false));
132
+				$payment = new Give_Payment($payment_id);
133 133
 
134 134
 				// Prevent payments that have all ready been retrieved from a previous sales log from counting again.
135
-				if ( in_array( $payment->ID, $processed_payments ) ) {
135
+				if (in_array($payment->ID, $processed_payments)) {
136 136
 					continue;
137 137
 				}
138 138
 
139 139
 				// Verify accepted status.
140
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
140
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
141 141
 					$processed_payments[] = $payment->ID;
142 142
 					continue;
143 143
 				}
144 144
 
145
-				$payment_item = $payment_items[ $payment->ID ];
145
+				$payment_item = $payment_items[$payment->ID];
146 146
 
147
-				$form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : '';
147
+				$form_id = isset($payment_item['id']) ? $payment_item['id'] : '';
148 148
 
149 149
 				// Must have a form ID.
150
-				if ( empty( $form_id ) ) {
150
+				if (empty($form_id)) {
151 151
 					continue;
152 152
 				}
153 153
 
154 154
 				// Form ID must be within $all_forms array to be validated.
155
-				if ( ! in_array( $form_id, $all_forms ) ) {
155
+				if ( ! in_array($form_id, $all_forms)) {
156 156
 					continue;
157 157
 				}
158 158
 
159 159
 				// Set Sales count
160
-				$totals[ $form_id ]['sales'] = isset( $totals[ $form_id ]['sales'] ) ?
161
-					++ $totals[ $form_id ]['sales'] :
162
-					1;
160
+				$totals[$form_id]['sales'] = isset($totals[$form_id]['sales']) ?
161
+					++$totals[$form_id]['sales'] : 1;
163 162
 
164 163
 				// Set Total Earnings
165
-				$totals[ $form_id ]['earnings'] = isset( $totals[ $form_id ]['earnings'] ) ?
166
-					( $totals[ $form_id ]['earnings'] + $payment_item['price'] ) :
167
-					$payment_item['price'];
164
+				$totals[$form_id]['earnings'] = isset($totals[$form_id]['earnings']) ?
165
+					($totals[$form_id]['earnings'] + $payment_item['price']) : $payment_item['price'];
168 166
 
169 167
 				$processed_payments[] = $payment->ID;
170 168
 			}
171 169
 
172 170
 			// Get the list of form ids which does not contain any payment record.
173
-			$remaining_form_ids = array_diff( $all_forms, array_keys( $totals ) );
174
-			foreach ( $remaining_form_ids as $form_id ) {
171
+			$remaining_form_ids = array_diff($all_forms, array_keys($totals));
172
+			foreach ($remaining_form_ids as $form_id) {
175 173
 				//If array key doesn't exist, create it
176
-				if ( ! array_key_exists( $form_id, $totals ) ) {
177
-					$totals[ $form_id ] = array(
174
+				if ( ! array_key_exists($form_id, $totals)) {
175
+					$totals[$form_id] = array(
178 176
 						'sales'    => (int) 0,
179 177
 						'earnings' => (float) 0,
180 178
 					);
181 179
 				}
182 180
 			}
183 181
 
184
-			$this->store_data( 'give_temp_processed_payments', $processed_payments );
185
-			$this->store_data( 'give_temp_recount_all_stats', $totals );
182
+			$this->store_data('give_temp_processed_payments', $processed_payments);
183
+			$this->store_data('give_temp_recount_all_stats', $totals);
186 184
 
187 185
 			return true;
188 186
 		}
189 187
 
190 188
 
191
-		foreach ( $totals as $key => $stats ) {
192
-			give_update_meta( $key, '_give_form_sales', $stats['sales'] );
193
-			give_update_meta( $key, '_give_form_earnings', give_sanitize_amount_for_db( $stats['earnings'] ) );
189
+		foreach ($totals as $key => $stats) {
190
+			give_update_meta($key, '_give_form_sales', $stats['sales']);
191
+			give_update_meta($key, '_give_form_earnings', give_sanitize_amount_for_db($stats['earnings']));
194 192
 		}
195 193
 
196 194
 		return false;
@@ -205,20 +203,20 @@  discard block
 block discarded – undo
205 203
 	 */
206 204
 	public function get_percentage_complete() {
207 205
 
208
-		$total = $this->get_stored_data( 'give_recount_all_total' );
206
+		$total = $this->get_stored_data('give_recount_all_total');
209 207
 
210
-		if ( false === $total ) {
208
+		if (false === $total) {
211 209
 			$this->pre_fetch();
212
-			$total = $this->get_stored_data( 'give_recount_all_total' );
210
+			$total = $this->get_stored_data('give_recount_all_total');
213 211
 		}
214 212
 
215 213
 		$percentage = 100;
216 214
 
217
-		if ( $total > 0 ) {
218
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
215
+		if ($total > 0) {
216
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
219 217
 		}
220 218
 
221
-		if ( $percentage > 100 ) {
219
+		if ($percentage > 100) {
222 220
 			$percentage = 100;
223 221
 		}
224 222
 
@@ -232,8 +230,8 @@  discard block
 block discarded – undo
232 230
 	 *
233 231
 	 * @param array $request The Form Data passed into the batch processing
234 232
 	 */
235
-	public function set_properties( $request ) {
236
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
233
+	public function set_properties($request) {
234
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
237 235
 	}
238 236
 
239 237
 	/**
@@ -244,25 +242,25 @@  discard block
 block discarded – undo
244 242
 	 */
245 243
 	public function process_step() {
246 244
 
247
-		if ( ! $this->can_export() ) {
248
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
245
+		if ( ! $this->can_export()) {
246
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
249 247
 		}
250 248
 
251 249
 		$had_data = $this->get_data();
252 250
 
253
-		if ( $had_data ) {
251
+		if ($had_data) {
254 252
 			$this->done = false;
255 253
 
256 254
 			return true;
257 255
 		} else {
258
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
259
-			$this->delete_data( 'give_recount_all_total' );
260
-			$this->delete_data( 'give_temp_recount_all_stats' );
261
-			$this->delete_data( 'give_temp_payment_items' );
262
-			$this->delete_data( 'give_temp_form_ids' );
263
-			$this->delete_data( 'give_temp_processed_payments' );
256
+			$this->delete_data('give_recount_total_'.$this->form_id);
257
+			$this->delete_data('give_recount_all_total');
258
+			$this->delete_data('give_temp_recount_all_stats');
259
+			$this->delete_data('give_temp_payment_items');
260
+			$this->delete_data('give_temp_form_ids');
261
+			$this->delete_data('give_temp_processed_payments');
264 262
 			$this->done    = true;
265
-			$this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' );
263
+			$this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give');
266 264
 
267 265
 			return false;
268 266
 		}
@@ -298,69 +296,69 @@  discard block
 block discarded – undo
298 296
 	 */
299 297
 	public function pre_fetch() {
300 298
 
301
-		if ( 1 == $this->step ) {
302
-			$this->delete_data( 'give_temp_recount_all_total' );
303
-			$this->delete_data( 'give_temp_recount_all_stats' );
304
-			$this->delete_data( 'give_temp_payment_items' );
305
-			$this->delete_data( 'give_temp_processed_payments' );
306
-			$this->delete_data( 'give_temp_all_payments_data' );
299
+		if (1 == $this->step) {
300
+			$this->delete_data('give_temp_recount_all_total');
301
+			$this->delete_data('give_temp_recount_all_stats');
302
+			$this->delete_data('give_temp_payment_items');
303
+			$this->delete_data('give_temp_processed_payments');
304
+			$this->delete_data('give_temp_all_payments_data');
307 305
 		}
308 306
 
309
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
310
-		$total             = $this->get_stored_data( 'give_temp_recount_all_total' );
307
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
308
+		$total             = $this->get_stored_data('give_temp_recount_all_total');
311 309
 
312
-		if ( false === $total ) {
310
+		if (false === $total) {
313 311
 
314
-			$payment_items = $this->get_stored_data( 'give_temp_payment_items' );
312
+			$payment_items = $this->get_stored_data('give_temp_payment_items');
315 313
 
316
-			if ( false === $payment_items ) {
314
+			if (false === $payment_items) {
317 315
 				$payment_items = array();
318
-				$this->store_data( 'give_temp_payment_items', $payment_items );
316
+				$this->store_data('give_temp_payment_items', $payment_items);
319 317
 			}
320 318
 
321 319
 			$args = array(
322 320
 				'post_status'    => 'publish',
323 321
 				'post_type'      => 'give_forms',
324
-				'posts_per_page' => - 1,
322
+				'posts_per_page' => -1,
325 323
 				'fields'         => 'ids',
326 324
 			);
327 325
 
328
-			$all_forms = get_posts( $args );
326
+			$all_forms = get_posts($args);
329 327
 
330
-			$this->store_data( 'give_temp_form_ids', $all_forms );
328
+			$this->store_data('give_temp_form_ids', $all_forms);
331 329
 
332
-			$args = apply_filters( 'give_recount_form_stats_total_args', array(
330
+			$args = apply_filters('give_recount_form_stats_total_args', array(
333 331
 				'give_forms' => $all_forms,
334 332
 				'number'     => $this->per_step,
335 333
 				'status'     => $accepted_statuses,
336 334
 				'page'       => $this->step,
337 335
 				'output'     => 'payments',
338
-			) );
336
+			));
339 337
 
340
-			$payments_query = new Give_Payments_Query( $args );
338
+			$payments_query = new Give_Payments_Query($args);
341 339
 			$payments       = $payments_query->get_payments();
342 340
 
343
-			$total = wp_count_posts( 'give_payment' )->publish;
341
+			$total = wp_count_posts('give_payment')->publish;
344 342
 
345
-			$this->store_data( 'give_temp_all_payments_data', $payments );
343
+			$this->store_data('give_temp_all_payments_data', $payments);
346 344
 
347
-			if ( $payments ) {
345
+			if ($payments) {
348 346
 
349
-				foreach ( $payments as $payment ) {
347
+				foreach ($payments as $payment) {
350 348
 
351 349
 					$form_id = $payment->form_id;
352 350
 
353 351
 					//If for some reason somehow the form_ID isn't set check payment meta
354
-					if ( empty( $payment->form_id ) ) {
352
+					if (empty($payment->form_id)) {
355 353
 						$payment_meta = $payment->get_meta();
356
-						$form_id      = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
354
+						$form_id      = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
357 355
 					}
358 356
 
359
-					if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
357
+					if ( ! in_array($payment->post_status, $accepted_statuses)) {
360 358
 						continue;
361 359
 					}
362 360
 
363
-					if ( ! array_key_exists( $payment->ID, $payment_items ) ) {
361
+					if ( ! array_key_exists($payment->ID, $payment_items)) {
364 362
 
365 363
 						/**
366 364
 						 * Filter the payment amount.
@@ -369,22 +367,22 @@  discard block
 block discarded – undo
369 367
 						 */
370 368
 						$payment_total = apply_filters(
371 369
 							'give_donation_amount',
372
-							give_format_amount( $payment->total, array( 'donation_id' => $payment->ID ) ),
370
+							give_format_amount($payment->total, array('donation_id' => $payment->ID)),
373 371
 							$payment->total,
374 372
 							$payment->ID,
375
-							array( 'type' => 'stats', 'currency' => false, 'amount' => false )
373
+							array('type' => 'stats', 'currency' => false, 'amount' => false)
376 374
 						);
377 375
 
378
-						$payment_items[ $payment->ID ] = array(
376
+						$payment_items[$payment->ID] = array(
379 377
 							'id'         => $form_id,
380 378
 							'payment_id' => $payment->ID,
381
-							'price'      => (float) give_maybe_sanitize_amount( $payment_total ),
379
+							'price'      => (float) give_maybe_sanitize_amount($payment_total),
382 380
 						);
383 381
 					}
384 382
 				}
385 383
 			}
386
-			$this->store_data( 'give_temp_payment_items', $payment_items );
387
-			$this->store_data( 'give_recount_all_total', $total );
384
+			$this->store_data('give_temp_payment_items', $payment_items);
385
+			$this->store_data('give_recount_all_total', $total);
388 386
 		}
389 387
 
390 388
 	}
@@ -398,17 +396,17 @@  discard block
 block discarded – undo
398 396
 	 *
399 397
 	 * @return mixed       Returns the data from the database
400 398
 	 */
401
-	private function get_stored_data( $key ) {
399
+	private function get_stored_data($key) {
402 400
 		global $wpdb;
403
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
404
-		if ( empty( $value ) ) {
401
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
402
+		if (empty($value)) {
405 403
 			return false;
406 404
 		}
407 405
 
408
-		$maybe_json = json_decode( $value );
406
+		$maybe_json = json_decode($value);
409 407
 
410
-		if ( ! is_null( $maybe_json ) ) {
411
-			$value = json_decode( $value, true );
408
+		if ( ! is_null($maybe_json)) {
409
+			$value = json_decode($value, true);
412 410
 		}
413 411
 
414 412
 		return $value;
@@ -424,10 +422,10 @@  discard block
 block discarded – undo
424 422
 	 *
425 423
 	 * @return void
426 424
 	 */
427
-	private function store_data( $key, $value ) {
425
+	private function store_data($key, $value) {
428 426
 		global $wpdb;
429 427
 
430
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
428
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
431 429
 
432 430
 		$data = array(
433 431
 			'option_name'  => $key,
@@ -441,7 +439,7 @@  discard block
 block discarded – undo
441 439
 			'%s',
442 440
 		);
443 441
 
444
-		$wpdb->replace( $wpdb->options, $data, $formats );
442
+		$wpdb->replace($wpdb->options, $data, $formats);
445 443
 	}
446 444
 
447 445
 	/**
@@ -453,9 +451,9 @@  discard block
 block discarded – undo
453 451
 	 *
454 452
 	 * @return void
455 453
 	 */
456
-	private function delete_data( $key ) {
454
+	private function delete_data($key) {
457 455
 		global $wpdb;
458
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
456
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
459 457
 	}
460 458
 
461 459
 }
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-export.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Export' ) ) :
16
+if ( ! class_exists('Give_Settings_Export')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Export.
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'export';
37
-			$this->label = __( 'Export', 'give' );
37
+			$this->label = __('Export', 'give');
38 38
 
39 39
 			parent::__construct();
40 40
 
41
-			add_action( 'give_admin_field_tools_export', array( 'Give_Settings_Export', 'render_export_field' ), 10, 2 );
41
+			add_action('give_admin_field_tools_export', array('Give_Settings_Export', 'render_export_field'), 10, 2);
42 42
 
43 43
 			// Do not use main donor for this tab.
44
-			if( give_get_current_setting_tab() === $this->id ) {
45
-				add_action( 'give-tools_open_form', '__return_empty_string' );
46
-				add_action( 'give-tools_close_form', '__return_empty_string' );
44
+			if (give_get_current_setting_tab() === $this->id) {
45
+				add_action('give-tools_open_form', '__return_empty_string');
46
+				add_action('give-tools_close_form', '__return_empty_string');
47 47
 
48 48
 
49
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-give-export-donations.php';
49
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-give-export-donations.php';
50 50
 			}
51 51
 		}
52 52
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			 * @param  array $settings
65 65
 			 */
66 66
 			$settings = apply_filters(
67
-				'give_get_settings_' . $this->id,
67
+				'give_get_settings_'.$this->id,
68 68
 				array(
69 69
 					array(
70 70
 						'id'   => 'give_tools_export',
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 					),
74 74
 					array(
75 75
 						'id'   => 'export',
76
-						'name' => __( 'Export', 'give' ),
76
+						'name' => __('Export', 'give'),
77 77
 						'type' => 'tools_export',
78 78
 					),
79 79
 					array(
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 		 * @param $field
98 98
 		 * @param $option_value
99 99
 		 */
100
-		public static function render_export_field( $field, $option_value ) {
101
-			include_once( 'views/html-admin-page-exports.php' );
100
+		public static function render_export_field($field, $option_value) {
101
+			include_once('views/html-admin-page-exports.php');
102 102
 		}
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
includes/admin/tools/export/export-actions.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array(
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array(
27 27
 			'response' => 403,
28
-		) );
28
+		));
29 29
 	}
30 30
 
31
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
31
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
32 32
 
33 33
 	/**
34 34
 	 * Fires before batch export.
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param string $class Export class.
39 39
 	 */
40
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
40
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
41 41
 
42 42
 	$export = new $_REQUEST['class'];
43 43
 	$export->export();
44 44
 
45 45
 }
46 46
 
47
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
47
+add_action('give_form_batch_export', 'give_process_batch_export_form');
48 48
 
49 49
 /**
50 50
  * Exports earnings for a specified time period.
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
  * @return void
56 56
  */
57 57
 function give_export_earnings() {
58
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php';
58
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php';
59 59
 
60 60
 	$earnings_export = new Give_Earnings_Export();
61 61
 
62 62
 	$earnings_export->export();
63 63
 }
64 64
 
65
-add_action( 'give_earnings_export', 'give_export_earnings' );
65
+add_action('give_earnings_export', 'give_export_earnings');
66 66
 
67 67
 /**
68 68
  * Exports Give's core settings.
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return void
74 74
  */
75 75
 function give_core_settings_export() {
76
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-core-settings-export.php';
76
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-core-settings-export.php';
77 77
 
78 78
 	$core_settings = new Give_Core_Settings_Export();
79 79
 
80 80
 	$core_settings->export();
81 81
 }
82 82
 
83
-add_action( 'give_core_settings_export', 'give_core_settings_export' );
83
+add_action('give_core_settings_export', 'give_core_settings_export');
84 84
 
85 85
 
86 86
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_register_batch_exporters() {
93
-	if ( is_admin() ) {
93
+	if (is_admin()) {
94 94
 		/**
95 95
 		 * Fires in the admin, while plugins loaded.
96 96
 		 *
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 		 *
101 101
 		 * @param string $class Export class.
102 102
 		 */
103
-		do_action( 'give_register_batch_exporter' );
103
+		do_action('give_register_batch_exporter');
104 104
 	}
105 105
 }
106 106
 
107
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
107
+add_action('plugins_loaded', 'give_register_batch_exporters');
108 108
 
109 109
 /**
110 110
  * Register the donors batch exporter.
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
  * @since  1.5.2
113 113
  */
114 114
 function give_register_donors_batch_export() {
115
-	add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 );
115
+	add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1);
116 116
 }
117 117
 
118
-add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 );
118
+add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10);
119 119
 
120 120
 /**
121 121
  * Loads the donors batch process if needed.
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return void
128 128
  */
129
-function give_include_donors_batch_processor( $class ) {
129
+function give_include_donors_batch_processor($class) {
130 130
 
131
-	if ( 'Give_Batch_Donors_Export' === $class ) {
132
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php';
131
+	if ('Give_Batch_Donors_Export' === $class) {
132
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php';
133 133
 	}
134 134
 
135 135
 }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
  * @since  1.5
141 141
  */
142 142
 function give_register_forms_batch_export() {
143
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
143
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
144 144
 }
145 145
 
146
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
146
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
147 147
 
148 148
 /**
149 149
  * Loads the file downloads batch process if needed
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_include_forms_batch_processor( $class ) {
157
+function give_include_forms_batch_processor($class) {
158 158
 
159
-	if ( 'Give_Batch_Forms_Export' === $class ) {
160
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php';
159
+	if ('Give_Batch_Forms_Export' === $class) {
160
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php';
161 161
 	}
162 162
 
163 163
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/class-give-export-donations.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       2.1
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Export_Donations' ) ) {
16
+if ( ! class_exists('Give_Export_Donations')) {
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_CSV.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @return static
58 58
 		 */
59 59
 		public static function get_instance() {
60
-			if ( null === static::$instance ) {
60
+			if (null === static::$instance) {
61 61
 				self::$instance = new static();
62 62
 			}
63 63
 
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
 		 * @return void
85 85
 		 */
86 86
 		private function setup_hooks() {
87
-			if ( ! $this->is_donations_export_page() ) {
87
+			if ( ! $this->is_donations_export_page()) {
88 88
 				return;
89 89
 			}
90 90
 
91 91
 			// Do not render main export tools page.
92
-			remove_action( 'give_admin_field_tools_export', array(
92
+			remove_action('give_admin_field_tools_export', array(
93 93
 				'Give_Settings_Export',
94 94
 				'render_export_field'
95
-			), 10 );
95
+			), 10);
96 96
 
97 97
 			// Render donation export page
98
-			add_action( 'give_admin_field_tools_export', array( $this, 'render_page' ) );
98
+			add_action('give_admin_field_tools_export', array($this, 'render_page'));
99 99
 
100 100
 			// Print the HTML.
101
-			add_action( 'give_tools_export_donations_form_start', array( $this, 'html' ) );
101
+			add_action('give_tools_export_donations_form_start', array($this, 'html'));
102 102
 		}
103 103
 
104 104
 		/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		 *
111 111
 		 * @return array args for Taxonomy
112 112
 		 */
113
-		function give_forms_taxonomy_dropdown( $args ) {
113
+		function give_forms_taxonomy_dropdown($args) {
114 114
 			$args['number'] = 30;
115 115
 
116 116
 			return $args;
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
 					<tbody>
129 129
 					<tr class="top">
130 130
 						<td colspan="2">
131
-							<h2 id="give-export-title"><?php _e( 'Export Donation History and Custom Fields to CSV', 'give' ) ?></h2>
132
-							<p class="give-field-description"><?php _e( 'Download an export of donors for specific donation forms with the option to include custom fields.', 'give' ) ?></p>
131
+							<h2 id="give-export-title"><?php _e('Export Donation History and Custom Fields to CSV', 'give') ?></h2>
132
+							<p class="give-field-description"><?php _e('Download an export of donors for specific donation forms with the option to include custom fields.', 'give') ?></p>
133 133
 						</td>
134 134
 					</tr>
135 135
 
136 136
 					<?php
137
-					if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
138
-						add_filter( 'give_forms_category_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
137
+					if (give_is_setting_enabled(give_get_option('categories'))) {
138
+						add_filter('give_forms_category_dropdown', array($this, 'give_forms_taxonomy_dropdown'));
139 139
 						?>
140 140
 						<tr>
141 141
 							<td scope="row" class="row-title">
142 142
 								<label
143
-									for="give_forms_categories"><?php _e( 'Filter by Categories:', 'give' ); ?></label>
143
+									for="give_forms_categories"><?php _e('Filter by Categories:', 'give'); ?></label>
144 144
 							</td>
145 145
 							<td class="give-field-wrap">
146 146
 								<div class="give-clearfix">
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 											'multiple'        => true,
156 156
 											'selected'        => array(),
157 157
 											'show_option_all' => false,
158
-											'placeholder'     => __( 'Choose one or more from categories', 'give' ),
159
-											'data'            => array( 'search-type' => 'categories' ),
158
+											'placeholder'     => __('Choose one or more from categories', 'give'),
159
+											'data'            => array('search-type' => 'categories'),
160 160
 										)
161 161
 									);
162 162
 									?>
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
 							</td>
165 165
 						</tr>
166 166
 						<?php
167
-						remove_filter( 'give_forms_category_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
167
+						remove_filter('give_forms_category_dropdown', array($this, 'give_forms_taxonomy_dropdown'));
168 168
 					}
169 169
 
170
-					if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
171
-						add_filter( 'give_forms_tag_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
170
+					if (give_is_setting_enabled(give_get_option('tags'))) {
171
+						add_filter('give_forms_tag_dropdown', array($this, 'give_forms_taxonomy_dropdown'));
172 172
 						?>
173 173
 						<tr>
174 174
 							<td scope="row" class="row-title">
175 175
 								<label
176
-									for="give_forms_tags"><?php _e( 'Filter by Tags:', 'give' ); ?></label>
176
+									for="give_forms_tags"><?php _e('Filter by Tags:', 'give'); ?></label>
177 177
 							</td>
178 178
 							<td class="give-field-wrap">
179 179
 								<div class="give-clearfix">
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 											'multiple'        => true,
189 189
 											'selected'        => array(),
190 190
 											'show_option_all' => false,
191
-											'placeholder'     => __( 'Choose one or more from tags', 'give' ),
192
-											'data'            => array( 'search-type' => 'tags' ),
191
+											'placeholder'     => __('Choose one or more from tags', 'give'),
192
+											'data'            => array('search-type' => 'tags'),
193 193
 										)
194 194
 									);
195 195
 									?>
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 							</td>
198 198
 						</tr>
199 199
 						<?php
200
-						remove_filter( 'give_forms_tag_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
200
+						remove_filter('give_forms_tag_dropdown', array($this, 'give_forms_taxonomy_dropdown'));
201 201
 					}
202 202
 					?>
203 203
 
204 204
 					<tr class="give-export-donation-form">
205 205
 						<td scope="row" class="row-title">
206 206
 							<label
207
-								for="give_payment_form_select"><?php _e( 'Filter by Donation Form:', 'give' ); ?></label>
207
+								for="give_payment_form_select"><?php _e('Filter by Donation Form:', 'give'); ?></label>
208 208
 						</td>
209 209
 						<td class="give-field-wrap">
210 210
 							<div class="give-clearfix">
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 									'name'        => 'forms',
214 214
 									'id'          => 'give-payment-form-select',
215 215
 									'chosen'      => true,
216
-									'placeholder' => __( 'All Forms', 'give' ),
217
-									'data'            => array( 'no-form' => __( 'No donation forms found', 'give' ), ),
216
+									'placeholder' => __('All Forms', 'give'),
217
+									'data'            => array('no-form' => __('No donation forms found', 'give'),),
218 218
 								);
219
-								echo Give()->html->forms_dropdown( $args );
219
+								echo Give()->html->forms_dropdown($args);
220 220
 								?>
221 221
 
222 222
 								<input type="hidden" name="form_ids" class="form_ids" />
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 					<tr>
228 228
 						<td scope="row" class="row-title">
229
-							<label for="give-payment-export-start"><?php _e( 'Filter by Date:', 'give' ); ?></label>
229
+							<label for="give-payment-export-start"><?php _e('Filter by Date:', 'give'); ?></label>
230 230
 						</td>
231 231
 						<td class="give-field-wrap">
232 232
 							<div class="give-clearfix">
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 								$args = array(
235 235
 									'id'          => 'give-payment-export-start',
236 236
 									'name'        => 'start',
237
-									'placeholder' => __( 'Start date', 'give' ),
237
+									'placeholder' => __('Start date', 'give'),
238 238
 								);
239
-								echo Give()->html->date_field( $args ); ?>
239
+								echo Give()->html->date_field($args); ?>
240 240
 								<?php
241 241
 								$args = array(
242 242
 									'id'          => 'give-payment-export-end',
243 243
 									'name'        => 'end',
244
-									'placeholder' => __( 'End date', 'give' ),
244
+									'placeholder' => __('End date', 'give'),
245 245
 								);
246
-								echo Give()->html->date_field( $args ); ?>
246
+								echo Give()->html->date_field($args); ?>
247 247
 							</div>
248 248
 						</td>
249 249
 					</tr>
@@ -251,16 +251,16 @@  discard block
 block discarded – undo
251 251
 					<tr>
252 252
 						<td scope="row" class="row-title">
253 253
 							<label
254
-								for="give-export-donations-status"><?php _e( 'Filter by Status:', 'give' ); ?></label>
254
+								for="give-export-donations-status"><?php _e('Filter by Status:', 'give'); ?></label>
255 255
 						</td>
256 256
 						<td>
257 257
 							<div class="give-clearfix">
258 258
 								<select name="status" id="give-export-donations-status">
259
-									<option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
259
+									<option value="any"><?php _e('All Statuses', 'give'); ?></option>
260 260
 									<?php
261 261
 									$statuses = give_get_payment_statuses();
262
-									foreach ( $statuses as $status => $label ) {
263
-										echo '<option value="' . $status . '">' . $label . '</option>';
262
+									foreach ($statuses as $status => $label) {
263
+										echo '<option value="'.$status.'">'.$label.'</option>';
264 264
 									}
265 265
 									?>
266 266
 								</select>
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
 					 *
275 275
 					 * @since 2.1
276 276
 					 */
277
-					do_action( 'give_export_donation_fields' );
277
+					do_action('give_export_donation_fields');
278 278
 					?>
279 279
 
280 280
 					<tr class="end">
281 281
 						<td>
282 282
 						</td>
283 283
 						<td>
284
-							<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
284
+							<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
285 285
 							<input type="hidden" name="give-export-class" value="Give_Export_Donations_CSV"/>
286
-							<input type="submit" value="<?php _e( 'Generate CSV', 'give' ) ?>" class="give-export-donation-button button button-primary">
286
+							<input type="submit" value="<?php _e('Generate CSV', 'give') ?>" class="give-export-donation-button button button-primary">
287 287
 							<div class="add-notices"></div>
288 288
 						</td>
289 289
 					</tr>
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 			 *
305 305
 			 * @since 2.1
306 306
 			 */
307
-			do_action( 'give_tools_export_donations_main_before' );
307
+			do_action('give_tools_export_donations_main_before');
308 308
 			?>
309 309
 			<div id="poststuff">
310 310
 				<div class="postbox">
311
-					<h1 class="give-export-h1" align="center"><?php _e( 'Export Donations', 'give' ); ?></h1>
311
+					<h1 class="give-export-h1" align="center"><?php _e('Export Donations', 'give'); ?></h1>
312 312
 					<div class="inside give-tools-setting-page-export give-export_donations">
313 313
 						<?php
314 314
 						/**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 						 *
317 317
 						 * @since 2.1
318 318
 						 */
319
-						do_action( 'give_tools_export_donations_form_before_start' );
319
+						do_action('give_tools_export_donations_form_before_start');
320 320
 						?>
321 321
 						<form method="post" id="give-export_donations-form"
322 322
 						      class="give-export-form tools-setting-page-export tools-setting-page-export"
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 							 *
329 329
 							 * @since 2.1
330 330
 							 */
331
-							do_action( 'give_tools_export_donations_form_start' );
331
+							do_action('give_tools_export_donations_form_start');
332 332
 							?>
333 333
 
334 334
 							<?php
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 							 *
338 338
 							 * @since 2.1
339 339
 							 */
340
-							do_action( 'give_tools_export_donations_form_end' );
340
+							do_action('give_tools_export_donations_form_end');
341 341
 							?>
342 342
 						</form>
343 343
 						<?php
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 						 *
347 347
 						 * @since 2.1
348 348
 						 */
349
-						do_action( 'give_tools_iexport_donations_form_after_end' );
349
+						do_action('give_tools_iexport_donations_form_after_end');
350 350
 						?>
351 351
 					</div><!-- .inside -->
352 352
 				</div><!-- .postbox -->
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			 *
358 358
 			 * @since 2.1
359 359
 			 */
360
-			do_action( 'give_tools_export_donations_main_after' );
360
+			do_action('give_tools_export_donations_main_after');
361 361
 		}
362 362
 
363 363
 		/**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		 * @return bool
369 369
 		 */
370 370
 		private function is_donations_export_page() {
371
-			return 'export' === give_get_current_setting_tab() && isset( $_GET['type'] ) && $this->exporter_type === give_clean( $_GET['type'] );
371
+			return 'export' === give_get_current_setting_tab() && isset($_GET['type']) && $this->exporter_type === give_clean($_GET['type']);
372 372
 		}
373 373
 	}
374 374
 
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 		 *
61 61
 		 * @return $file_name string file name
62 62
 		 */
63
-		$file_name = apply_filters( 'give_export_filename', 'give-export-' . $this->export_type . '-' . date( 'm-d-Y' ), $this->export_type );
63
+		$file_name = apply_filters('give_export_filename', 'give-export-'.$this->export_type.'-'.date('m-d-Y'), $this->export_type);
64 64
 
65 65
 		nocache_headers();
66
-		header( 'Content-Type: text/csv; charset=utf-8' );
67
-		header( 'Content-Disposition: attachment; filename=' . $file_name . '.csv' );
68
-		header( "Expires: 0" );
66
+		header('Content-Type: text/csv; charset=utf-8');
67
+		header('Content-Disposition: attachment; filename='.$file_name.'.csv');
68
+		header("Expires: 0");
69 69
 	}
70 70
 
71 71
 	/**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function csv_cols() {
79 79
 		$cols = array(
80
-			'id'   => __( 'ID', 'give' ),
81
-			'date' => __( 'Date', 'give' )
80
+			'id'   => __('ID', 'give'),
81
+			'date' => __('Date', 'give')
82 82
 		);
83 83
 
84 84
 		return $cols;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	public function get_csv_cols() {
95 95
 		$cols = $this->csv_cols();
96 96
 
97
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
97
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
98 98
 	}
99 99
 
100 100
 	/**
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	public function csv_cols_out() {
109 109
 		$cols = $this->get_csv_cols();
110 110
 		$i    = 1;
111
-		foreach ( $cols as $col_id => $column ) {
112
-			echo '"' . addslashes( $column ) . '"';
113
-			echo $i == count( $cols ) ? '' : ',';
114
-			$i ++;
111
+		foreach ($cols as $col_id => $column) {
112
+			echo '"'.addslashes($column).'"';
113
+			echo $i == count($cols) ? '' : ',';
114
+			$i++;
115 115
 		}
116 116
 		echo "\r\n";
117 117
 	}
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 		$data = array(
129 129
 			0 => array(
130 130
 				'id'   => '',
131
-				'data' => date( 'F j, Y' )
131
+				'data' => date('F j, Y')
132 132
 			),
133 133
 			1 => array(
134 134
 				'id'   => '',
135
-				'data' => date( 'F j, Y' )
135
+				'data' => date('F j, Y')
136 136
 			)
137 137
 		);
138 138
 
139
-		$data = apply_filters( 'give_export_get_data', $data );
140
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
139
+		$data = apply_filters('give_export_get_data', $data);
140
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
141 141
 
142 142
 		return $data;
143 143
 	}
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 		$cols = $this->get_csv_cols();
156 156
 
157 157
 		// Output each row
158
-		foreach ( $data as $row ) {
158
+		foreach ($data as $row) {
159 159
 			$i = 1;
160
-			foreach ( $row as $col_id => $column ) {
160
+			foreach ($row as $col_id => $column) {
161 161
 				// Make sure the column is valid
162
-				if ( array_key_exists( $col_id, $cols ) ) {
163
-					echo '"' . addslashes( $column ) . '"';
164
-					echo $i == count( $cols ) ? '' : ',';
165
-					$i ++;
162
+				if (array_key_exists($col_id, $cols)) {
163
+					echo '"'.addslashes($column).'"';
164
+					echo $i == count($cols) ? '' : ',';
165
+					$i++;
166 166
 				}
167 167
 			}
168 168
 			echo "\r\n";
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @return void
182 182
 	 */
183 183
 	public function export() {
184
-		if ( ! $this->can_export() ) {
185
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
184
+		if ( ! $this->can_export()) {
185
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
186 186
 		}
187 187
 
188 188
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +15 added lines, -15 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
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		give_ignore_user_abort();
43 43
 
44 44
 		nocache_headers();
45
-		header( 'Content-Type: application/json; charset=utf-8' );
46
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
47
-		header( 'Expires: 0' );
45
+		header('Content-Type: application/json; charset=utf-8');
46
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
47
+		header('Expires: 0');
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 	 * @since 1.8.17
55 55
 	 */
56 56
 	public function json_core_settings_export() {
57
-		$settings_excludes = isset( $_POST['settings_export_excludes'] ) ? give_clean( $_POST['settings_export_excludes'] ) : array();
58
-		$give_settings     = get_option( 'give_settings' );
57
+		$settings_excludes = isset($_POST['settings_export_excludes']) ? give_clean($_POST['settings_export_excludes']) : array();
58
+		$give_settings     = get_option('give_settings');
59 59
 
60
-		if ( is_array( $settings_excludes ) && ! empty( $settings_excludes ) ) {
61
-			foreach ( $settings_excludes as $key => $value ) {
62
-				if ( give_is_setting_enabled( $value ) ) {
63
-					unset( $give_settings[ $key ] );
60
+		if (is_array($settings_excludes) && ! empty($settings_excludes)) {
61
+			foreach ($settings_excludes as $key => $value) {
62
+				if (give_is_setting_enabled($value)) {
63
+					unset($give_settings[$key]);
64 64
 				}
65 65
 			}
66 66
 		}
67 67
 
68
-		echo wp_json_encode( $give_settings );
68
+		echo wp_json_encode($give_settings);
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	 * @since  1.8.17
76 76
 	 */
77 77
 	public function export() {
78
-		if ( ! $this->can_export() ) {
78
+		if ( ! $this->can_export()) {
79 79
 			wp_die(
80
-				esc_html__( 'You do not have permission to export data.', 'give' ),
81
-				esc_html__( 'Error', 'give' ),
82
-				array( 'response' => 403 )
80
+				esc_html__('You do not have permission to export data.', 'give'),
81
+				esc_html__('Error', 'give'),
82
+				array('response' => 403)
83 83
 			);
84 84
 		}
85 85
 
Please login to merge, or discard this patch.