Completed
Pull Request — master (#986)
by Rami
20:36
created
includes/admin/system-info.php 1 patch
Spacing   +146 added lines, -146 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
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_system_info_callback() {
26 26
 
27
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
27
+	if ( ! current_user_can('manage_give_settings')) {
28 28
 		return;
29 29
 	}
30 30
 	?>
31
-	<textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" aria-label="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give' ); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea>
31
+	<textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" aria-label="<?php esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give'); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea>
32 32
 	<p class="submit">
33 33
 		<input type="hidden" name="give-action" value="download_sysinfo"/>
34
-		<?php submit_button( esc_html__( 'Download System Info File', 'give' ), 'secondary', 'give-download-sysinfo', false ); ?>
34
+		<?php submit_button(esc_html__('Download System Info File', 'give'), 'secondary', 'give-download-sysinfo', false); ?>
35 35
 	</p>
36 36
 	<?php
37 37
 }
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
  * @return bool
48 48
  */
49 49
 function give_allow_sessions_for_sysinfo() {
50
-	if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) {
50
+	if (is_admin() && (isset($_GET['page']) && isset($_GET['tab'])) && ($_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings')) {
51 51
 		return true;
52 52
 	}
53 53
 }
54 54
 
55
-add_filter( 'give_start_session', 'give_allow_sessions_for_sysinfo' );
55
+add_filter('give_start_session', 'give_allow_sessions_for_sysinfo');
56 56
 
57 57
 
58 58
 /**
@@ -67,63 +67,63 @@  discard block
 block discarded – undo
67 67
 function give_tools_sysinfo_get() {
68 68
 	global $wpdb, $give_options;
69 69
 
70
-	if ( ! class_exists( 'Browser' ) ) {
71
-		require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php';
70
+	if ( ! class_exists('Browser')) {
71
+		require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php';
72 72
 	}
73 73
 
74 74
 	$browser = new Browser();
75 75
 
76 76
 	// Get theme info
77
-	if ( get_bloginfo( 'version' ) < '3.4' ) {
78
-		$theme_data = wp_get_theme( get_stylesheet_directory() . '/style.css' );
79
-		$theme      = $theme_data['Name'] . ' ' . $theme_data['Version'];
77
+	if (get_bloginfo('version') < '3.4') {
78
+		$theme_data = wp_get_theme(get_stylesheet_directory().'/style.css');
79
+		$theme      = $theme_data['Name'].' '.$theme_data['Version'];
80 80
 	} else {
81 81
 		$theme_data = wp_get_theme();
82
-		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
82
+		$theme      = $theme_data->Name.' '.$theme_data->Version;
83 83
 	}
84 84
 
85 85
 	// Try to identify the hosting provider
86 86
 	$host = give_get_host();
87 87
 
88
-	$return = '### Begin System Info ###' . "\n\n";
88
+	$return = '### Begin System Info ###'."\n\n";
89 89
 
90 90
 	// Start with the basics...
91
-	$return .= '-- Site Info' . "\n\n";
92
-	$return .= 'Site URL:                 ' . site_url() . "\n";
93
-	$return .= 'Home URL:                 ' . home_url() . "\n";
94
-	$return .= 'Multisite:                ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
91
+	$return .= '-- Site Info'."\n\n";
92
+	$return .= 'Site URL:                 '.site_url()."\n";
93
+	$return .= 'Home URL:                 '.home_url()."\n";
94
+	$return .= 'Multisite:                '.(is_multisite() ? 'Yes' : 'No')."\n";
95 95
 
96
-	$return = apply_filters( 'give_sysinfo_after_site_info', $return );
96
+	$return = apply_filters('give_sysinfo_after_site_info', $return);
97 97
 
98 98
 	// Can we determine the site's host?
99
-	if ( $host ) {
100
-		$return .= "\n" . '-- Hosting Provider' . "\n\n";
101
-		$return .= 'Host:                     ' . $host . "\n";
99
+	if ($host) {
100
+		$return .= "\n".'-- Hosting Provider'."\n\n";
101
+		$return .= 'Host:                     '.$host."\n";
102 102
 
103
-		$return = apply_filters( 'give_sysinfo_after_host_info', $return );
103
+		$return = apply_filters('give_sysinfo_after_host_info', $return);
104 104
 	}
105 105
 
106 106
 	// The local users' browser information, handled by the Browser class
107
-	$return .= "\n" . '-- User Browser' . "\n\n";
107
+	$return .= "\n".'-- User Browser'."\n\n";
108 108
 	$return .= $browser;
109 109
 
110
-	$return = apply_filters( 'give_sysinfo_after_user_browser', $return );
110
+	$return = apply_filters('give_sysinfo_after_user_browser', $return);
111 111
 
112 112
 	// WordPress configuration
113
-	$return .= "\n" . '-- WordPress Configuration' . "\n\n";
114
-	$return .= 'Version:                  ' . get_bloginfo( 'version' ) . "\n";
115
-	$return .= 'Language:                 ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n";
116
-	$return .= 'Permalink Structure:      ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n";
117
-	$return .= 'Active Theme:             ' . $theme . "\n";
118
-	$return .= 'Show On Front:            ' . get_option( 'show_on_front' ) . "\n";
113
+	$return .= "\n".'-- WordPress Configuration'."\n\n";
114
+	$return .= 'Version:                  '.get_bloginfo('version')."\n";
115
+	$return .= 'Language:                 '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n";
116
+	$return .= 'Permalink Structure:      '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n";
117
+	$return .= 'Active Theme:             '.$theme."\n";
118
+	$return .= 'Show On Front:            '.get_option('show_on_front')."\n";
119 119
 
120 120
 	// Only show page specs if frontpage is set to 'page'
121
-	if ( get_option( 'show_on_front' ) == 'page' ) {
122
-		$front_page_id = get_option( 'page_on_front' );
123
-		$blog_page_id  = get_option( 'page_for_posts' );
121
+	if (get_option('show_on_front') == 'page') {
122
+		$front_page_id = get_option('page_on_front');
123
+		$blog_page_id  = get_option('page_for_posts');
124 124
 
125
-		$return .= 'Page On Front:            ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n";
126
-		$return .= 'Page For Posts:           ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n";
125
+		$return .= 'Page On Front:            '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n";
126
+		$return .= 'Page For Posts:           '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n";
127 127
 	}
128 128
 
129 129
 	// Make sure wp_remote_post() is working
@@ -132,205 +132,205 @@  discard block
 block discarded – undo
132 132
 	$params = array(
133 133
 		'sslverify'  => false,
134 134
 		'timeout'    => 60,
135
-		'user-agent' => 'Give/' . GIVE_VERSION,
135
+		'user-agent' => 'Give/'.GIVE_VERSION,
136 136
 		'body'       => $request
137 137
 	);
138 138
 
139
-	$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
139
+	$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
140 140
 
141
-	if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
141
+	if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
142 142
 		$WP_REMOTE_POST = 'wp_remote_post() works';
143 143
 	} else {
144 144
 		$WP_REMOTE_POST = 'wp_remote_post() does not work';
145 145
 	}
146 146
 
147
-	$return .= 'Remote Post:              ' . $WP_REMOTE_POST . "\n";
148
-	$return .= 'Table Prefix:             ' . 'Length: ' . strlen( $wpdb->prefix ) . '   Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n";
149
-	$return .= 'Admin AJAX:               ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n";
150
-	$return .= 'WP_DEBUG:                 ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
151
-	$return .= 'Memory Limit:             ' . WP_MEMORY_LIMIT . "\n";
152
-	$return .= 'Registered Post Stati:    ' . implode( ', ', get_post_stati() ) . "\n";
147
+	$return .= 'Remote Post:              '.$WP_REMOTE_POST."\n";
148
+	$return .= 'Table Prefix:             '.'Length: '.strlen($wpdb->prefix).'   Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n";
149
+	$return .= 'Admin AJAX:               '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n";
150
+	$return .= 'WP_DEBUG:                 '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n";
151
+	$return .= 'Memory Limit:             '.WP_MEMORY_LIMIT."\n";
152
+	$return .= 'Registered Post Stati:    '.implode(', ', get_post_stati())."\n";
153 153
 
154
-	$return = apply_filters( 'give_sysinfo_after_wordpress_config', $return );
154
+	$return = apply_filters('give_sysinfo_after_wordpress_config', $return);
155 155
 
156 156
 	// GIVE configuration
157
-	$return .= "\n" . '-- Give Configuration' . "\n\n";
158
-	$return .= 'Version:                  ' . GIVE_VERSION . "\n";
159
-	$return .= 'Upgraded From:            ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n";
160
-	$return .= 'Test Mode:                ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" );
161
-	$return .= 'Currency Code:            ' . give_get_currency() . "\n";
162
-	$return .= 'Currency Position:        ' . give_get_option( 'currency_position', 'before' ) . "\n";
163
-	$return .= 'Decimal Separator:        ' . give_get_option( 'decimal_separator', '.' ) . "\n";
164
-	$return .= 'Thousands Separator:      ' . give_get_option( 'thousands_separator', ',' ) . "\n";
157
+	$return .= "\n".'-- Give Configuration'."\n\n";
158
+	$return .= 'Version:                  '.GIVE_VERSION."\n";
159
+	$return .= 'Upgraded From:            '.get_option('give_version_upgraded_from', 'None')."\n";
160
+	$return .= 'Test Mode:                '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n");
161
+	$return .= 'Currency Code:            '.give_get_currency()."\n";
162
+	$return .= 'Currency Position:        '.give_get_option('currency_position', 'before')."\n";
163
+	$return .= 'Decimal Separator:        '.give_get_option('decimal_separator', '.')."\n";
164
+	$return .= 'Thousands Separator:      '.give_get_option('thousands_separator', ',')."\n";
165 165
 
166
-	$return = apply_filters( 'give_sysinfo_after_give_config', $return );
166
+	$return = apply_filters('give_sysinfo_after_give_config', $return);
167 167
 
168 168
 	// GIVE pages
169
-	$return .= "\n" . '-- Give Page Configuration' . "\n\n";
170
-	$return .= 'Success Page:             ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" );
171
-	$return .= 'Failure Page:             ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" );
172
-	$return .= 'Give Forms Slug:           ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" );
169
+	$return .= "\n".'-- Give Page Configuration'."\n\n";
170
+	$return .= 'Success Page:             '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n");
171
+	$return .= 'Failure Page:             '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n");
172
+	$return .= 'Give Forms Slug:           '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n");
173 173
 
174
-	$return = apply_filters( 'give_sysinfo_after_give_pages', $return );
174
+	$return = apply_filters('give_sysinfo_after_give_pages', $return);
175 175
 
176 176
 	// GIVE gateways
177
-	$return .= "\n" . '-- Give Gateway Configuration' . "\n\n";
177
+	$return .= "\n".'-- Give Gateway Configuration'."\n\n";
178 178
 
179 179
 	$active_gateways = give_get_enabled_payment_gateways();
180
-	if ( $active_gateways ) {
181
-		$default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) );
182
-		if ( $default_gateway_is_active ) {
183
-			$default_gateway = give_get_default_gateway( null );
184
-			$default_gateway = $active_gateways[ $default_gateway ]['admin_label'];
180
+	if ($active_gateways) {
181
+		$default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null));
182
+		if ($default_gateway_is_active) {
183
+			$default_gateway = give_get_default_gateway(null);
184
+			$default_gateway = $active_gateways[$default_gateway]['admin_label'];
185 185
 		} else {
186 186
 			$default_gateway = 'Test Donation';
187 187
 		}
188 188
 
189 189
 		$gateways = array();
190
-		foreach ( $active_gateways as $gateway ) {
190
+		foreach ($active_gateways as $gateway) {
191 191
 			$gateways[] = $gateway['admin_label'];
192 192
 		}
193 193
 
194
-		$return .= 'Enabled Gateways:         ' . implode( ', ', $gateways ) . "\n";
195
-		$return .= 'Default Gateway:          ' . $default_gateway . "\n";
194
+		$return .= 'Enabled Gateways:         '.implode(', ', $gateways)."\n";
195
+		$return .= 'Default Gateway:          '.$default_gateway."\n";
196 196
 	} else {
197
-		$return .= 'Enabled Gateways:         None' . "\n";
197
+		$return .= 'Enabled Gateways:         None'."\n";
198 198
 	}
199 199
 
200
-	$return = apply_filters( 'give_sysinfo_after_give_gateways', $return );
200
+	$return = apply_filters('give_sysinfo_after_give_gateways', $return);
201 201
 
202 202
 	// GIVE Templates
203
-	$dir = get_stylesheet_directory() . '/give_templates/*';
204
-	if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) {
205
-		$return .= "\n" . '-- Give Template Overrides' . "\n\n";
203
+	$dir = get_stylesheet_directory().'/give_templates/*';
204
+	if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) {
205
+		$return .= "\n".'-- Give Template Overrides'."\n\n";
206 206
 
207
-		foreach ( glob( $dir ) as $file ) {
208
-			$return .= 'Filename:                 ' . basename( $file ) . "\n";
207
+		foreach (glob($dir) as $file) {
208
+			$return .= 'Filename:                 '.basename($file)."\n";
209 209
 		}
210 210
 
211
-		$return = apply_filters( 'give_sysinfo_after_give_templates', $return );
211
+		$return = apply_filters('give_sysinfo_after_give_templates', $return);
212 212
 	}
213 213
 
214 214
 	// Must-use plugins
215 215
 	$muplugins = get_mu_plugins();
216
-	if ( count( $muplugins > 0 ) ) {
217
-		$return .= "\n" . '-- Must-Use Plugins' . "\n\n";
216
+	if (count($muplugins > 0)) {
217
+		$return .= "\n".'-- Must-Use Plugins'."\n\n";
218 218
 
219
-		foreach ( $muplugins as $plugin => $plugin_data ) {
220
-			$return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
219
+		foreach ($muplugins as $plugin => $plugin_data) {
220
+			$return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n";
221 221
 		}
222 222
 
223
-		$return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return );
223
+		$return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return);
224 224
 	}
225 225
 
226 226
 	// WordPress active plugins
227
-	$return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
227
+	$return .= "\n".'-- WordPress Active Plugins'."\n\n";
228 228
 
229 229
 	$plugins        = get_plugins();
230
-	$active_plugins = get_option( 'active_plugins', array() );
230
+	$active_plugins = get_option('active_plugins', array());
231 231
 
232
-	foreach ( $plugins as $plugin_path => $plugin ) {
233
-		if ( ! in_array( $plugin_path, $active_plugins ) ) {
232
+	foreach ($plugins as $plugin_path => $plugin) {
233
+		if ( ! in_array($plugin_path, $active_plugins)) {
234 234
 			continue;
235 235
 		}
236 236
 
237
-		$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
237
+		$return .= $plugin['Name'].': '.$plugin['Version']."\n";
238 238
 	}
239 239
 
240
-	$return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return );
240
+	$return = apply_filters('give_sysinfo_after_wordpress_plugins', $return);
241 241
 
242 242
 	// WordPress inactive plugins
243
-	$return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n";
243
+	$return .= "\n".'-- WordPress Inactive Plugins'."\n\n";
244 244
 
245
-	foreach ( $plugins as $plugin_path => $plugin ) {
246
-		if ( in_array( $plugin_path, $active_plugins ) ) {
245
+	foreach ($plugins as $plugin_path => $plugin) {
246
+		if (in_array($plugin_path, $active_plugins)) {
247 247
 			continue;
248 248
 		}
249 249
 
250
-		$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
250
+		$return .= $plugin['Name'].': '.$plugin['Version']."\n";
251 251
 	}
252 252
 
253
-	$return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return );
253
+	$return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return);
254 254
 
255
-	if ( is_multisite() ) {
255
+	if (is_multisite()) {
256 256
 		// WordPress Multisite active plugins
257
-		$return .= "\n" . '-- Network Active Plugins' . "\n\n";
257
+		$return .= "\n".'-- Network Active Plugins'."\n\n";
258 258
 
259 259
 		$plugins        = wp_get_active_network_plugins();
260
-		$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
260
+		$active_plugins = get_site_option('active_sitewide_plugins', array());
261 261
 
262
-		foreach ( $plugins as $plugin_path ) {
263
-			$plugin_base = plugin_basename( $plugin_path );
262
+		foreach ($plugins as $plugin_path) {
263
+			$plugin_base = plugin_basename($plugin_path);
264 264
 
265
-			if ( ! array_key_exists( $plugin_base, $active_plugins ) ) {
265
+			if ( ! array_key_exists($plugin_base, $active_plugins)) {
266 266
 				continue;
267 267
 			}
268 268
 
269
-			$plugin = get_plugin_data( $plugin_path );
270
-			$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
269
+			$plugin = get_plugin_data($plugin_path);
270
+			$return .= $plugin['Name'].': '.$plugin['Version']."\n";
271 271
 		}
272 272
 
273
-		$return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return );
273
+		$return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return);
274 274
 	}
275 275
 
276 276
 	// Server configuration (really just versioning)
277
-	$return .= "\n" . '-- Webserver Configuration' . "\n\n";
278
-	$return .= 'PHP Version:              ' . PHP_VERSION . "\n";
279
-	$return .= 'MySQL Version:            ' . $wpdb->db_version() . "\n";
280
-	$return .= 'Webserver Info:           ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
277
+	$return .= "\n".'-- Webserver Configuration'."\n\n";
278
+	$return .= 'PHP Version:              '.PHP_VERSION."\n";
279
+	$return .= 'MySQL Version:            '.$wpdb->db_version()."\n";
280
+	$return .= 'Webserver Info:           '.$_SERVER['SERVER_SOFTWARE']."\n";
281 281
 
282
-	$return = apply_filters( 'give_sysinfo_after_webserver_config', $return );
282
+	$return = apply_filters('give_sysinfo_after_webserver_config', $return);
283 283
 
284 284
 	// PHP configs... now we're getting to the important stuff
285
-	$return .= "\n" . '-- PHP Configuration' . "\n\n";
286
-	$return .= 'Safe Mode:                ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" );
287
-	$return .= 'Memory Limit:             ' . ini_get( 'memory_limit' ) . "\n";
288
-	$return .= 'Upload Max Size:          ' . ini_get( 'upload_max_filesize' ) . "\n";
289
-	$return .= 'Post Max Size:            ' . ini_get( 'post_max_size' ) . "\n";
290
-	$return .= 'Upload Max Filesize:      ' . ini_get( 'upload_max_filesize' ) . "\n";
291
-	$return .= 'Time Limit:               ' . ini_get( 'max_execution_time' ) . "\n";
292
-	$return .= 'Max Input Vars:           ' . ini_get( 'max_input_vars' ) . "\n";
293
-	$return .= 'URL-aware fopen:          ' . ( ini_get( 'allow_url_fopen' ) ? 'On (' . ini_get( 'allow_url_fopen' ) . ')' : 'N/A' ) . "\n";
294
-	$return .= 'Display Errors:           ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n";
295
-
296
-	$return = apply_filters( 'give_sysinfo_after_php_config', $return );
285
+	$return .= "\n".'-- PHP Configuration'."\n\n";
286
+	$return .= 'Safe Mode:                '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n");
287
+	$return .= 'Memory Limit:             '.ini_get('memory_limit')."\n";
288
+	$return .= 'Upload Max Size:          '.ini_get('upload_max_filesize')."\n";
289
+	$return .= 'Post Max Size:            '.ini_get('post_max_size')."\n";
290
+	$return .= 'Upload Max Filesize:      '.ini_get('upload_max_filesize')."\n";
291
+	$return .= 'Time Limit:               '.ini_get('max_execution_time')."\n";
292
+	$return .= 'Max Input Vars:           '.ini_get('max_input_vars')."\n";
293
+	$return .= 'URL-aware fopen:          '.(ini_get('allow_url_fopen') ? 'On ('.ini_get('allow_url_fopen').')' : 'N/A')."\n";
294
+	$return .= 'Display Errors:           '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n";
295
+
296
+	$return = apply_filters('give_sysinfo_after_php_config', $return);
297 297
 
298 298
 	// PHP extensions and such
299
-	$return .= "\n" . '-- PHP Extensions' . "\n\n";
300
-	$return .= 'cURL:                     ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n";
299
+	$return .= "\n".'-- PHP Extensions'."\n\n";
300
+	$return .= 'cURL:                     '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n";
301 301
 
302 302
 	//cURL version
303
-	if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) {
303
+	if (function_exists('curl_init') && function_exists('curl_version')) {
304 304
 		$curl_values = curl_version();
305
-		$return .= 'cURL Version:             ' . $curl_values["version"] . "\n";
305
+		$return .= 'cURL Version:             '.$curl_values["version"]."\n";
306 306
 	}
307
-	$return .= 'zlib:                     ' . ( function_exists( 'gzcompress' ) ? 'Supported' : 'Not Supported' ) . "\n";
308
-	$return .= 'GD:                       ' . ( ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ) ? 'Supported' : 'Not Supported' ) . "\n";
309
-	$return .= 'fsockopen:                ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n";
310
-	$return .= 'SOAP Client:              ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n";
311
-	$return .= 'Suhosin:                  ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n";
312
-	$return .= 'DOM:                      ' . ( extension_loaded( 'dom' ) ? 'Installed' : 'Not Installed' ) . "\n";
313
-	$return .= 'MBString:                 ' . ( extension_loaded( 'mbstring' ) ? 'Installed' : 'Not Installed' ) . "\n";
307
+	$return .= 'zlib:                     '.(function_exists('gzcompress') ? 'Supported' : 'Not Supported')."\n";
308
+	$return .= 'GD:                       '.((extension_loaded('gd') && function_exists('gd_info')) ? 'Supported' : 'Not Supported')."\n";
309
+	$return .= 'fsockopen:                '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n";
310
+	$return .= 'SOAP Client:              '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n";
311
+	$return .= 'Suhosin:                  '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n";
312
+	$return .= 'DOM:                      '.(extension_loaded('dom') ? 'Installed' : 'Not Installed')."\n";
313
+	$return .= 'MBString:                 '.(extension_loaded('mbstring') ? 'Installed' : 'Not Installed')."\n";
314 314
 
315
-	$return = apply_filters( 'give_sysinfo_after_php_ext', $return );
315
+	$return = apply_filters('give_sysinfo_after_php_ext', $return);
316 316
 
317 317
 	// Session stuff
318
-	$return .= "\n" . '-- Session Configuration' . "\n\n";
319
-	$return .= 'Give Use Sessions:        ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n";
320
-	$return .= 'Session:                  ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n";
318
+	$return .= "\n".'-- Session Configuration'."\n\n";
319
+	$return .= 'Give Use Sessions:        '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n";
320
+	$return .= 'Session:                  '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n";
321 321
 
322 322
 	// The rest of this is only relevant is session is enabled
323
-	if ( isset( $_SESSION ) ) {
324
-		$return .= 'Session Name:             ' . esc_html( ini_get( 'session.name' ) ) . "\n";
325
-		$return .= 'Cookie Path:              ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n";
326
-		$return .= 'Save Path:                ' . esc_html( ini_get( 'session.save_path' ) ) . "\n";
327
-		$return .= 'Use Cookies:              ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n";
328
-		$return .= 'Use Only Cookies:         ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n";
323
+	if (isset($_SESSION)) {
324
+		$return .= 'Session Name:             '.esc_html(ini_get('session.name'))."\n";
325
+		$return .= 'Cookie Path:              '.esc_html(ini_get('session.cookie_path'))."\n";
326
+		$return .= 'Save Path:                '.esc_html(ini_get('session.save_path'))."\n";
327
+		$return .= 'Use Cookies:              '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n";
328
+		$return .= 'Use Only Cookies:         '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n";
329 329
 	}
330 330
 
331
-	$return = apply_filters( 'give_sysinfo_after_session_config', $return );
331
+	$return = apply_filters('give_sysinfo_after_session_config', $return);
332 332
 
333
-	$return .= "\n" . '### End System Info ###';
333
+	$return .= "\n".'### End System Info ###';
334 334
 
335 335
 	return $return;
336 336
 }
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
  */
345 345
 function give_tools_sysinfo_download() {
346 346
 
347
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
347
+	if ( ! current_user_can('manage_give_settings')) {
348 348
 		return;
349 349
 	}
350 350
 
351 351
 	nocache_headers();
352 352
 
353
-	header( 'Content-Type: text/plain' );
354
-	header( 'Content-Disposition: attachment; filename="give-system-info.txt"' );
353
+	header('Content-Type: text/plain');
354
+	header('Content-Disposition: attachment; filename="give-system-info.txt"');
355 355
 
356
-	echo wp_strip_all_tags( $_POST['give-sysinfo'] );
356
+	echo wp_strip_all_tags($_POST['give-sysinfo']);
357 357
 	give_die();
358 358
 }
359 359
 
360
-add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' );
361 360
\ No newline at end of file
361
+add_action('give_download_sysinfo', 'give_tools_sysinfo_download');
362 362
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-forms.php 1 patch
Spacing   +53 added lines, -53 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
 
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	public function csv_cols() {
42 42
 
43 43
 		$cols = array(
44
-			'ID'                      => esc_html__( 'ID', 'give' ),
45
-			'post_name'               => esc_html__( 'Slug', 'give' ),
46
-			'post_title'              => esc_html__( 'Name', 'give' ),
47
-			'post_date'               => esc_html__( 'Date Created', 'give' ),
48
-			'post_author'             => esc_html__( 'Author', 'give' ),
49
-			'post_content'            => esc_html__( 'Description', 'give' ),
50
-			'post_excerpt'            => esc_html__( 'Excerpt', 'give' ),
51
-			'post_status'             => esc_html__( 'Status', 'give' ),
52
-			'categories'              => esc_html__( 'Categories', 'give' ),
53
-			'tags'                    => esc_html__( 'Tags', 'give' ),
54
-			'give_price'              => esc_html__( 'Price', 'give' ),
55
-			'_thumbnail_id'           => esc_html__( 'Featured Image', 'give' ),
56
-			'_give_form_sales'        => esc_html__( 'Donations', 'give' ),
57
-			'_give_download_earnings' => esc_html__( 'Income', 'give' ),
44
+			'ID'                      => esc_html__('ID', 'give'),
45
+			'post_name'               => esc_html__('Slug', 'give'),
46
+			'post_title'              => esc_html__('Name', 'give'),
47
+			'post_date'               => esc_html__('Date Created', 'give'),
48
+			'post_author'             => esc_html__('Author', 'give'),
49
+			'post_content'            => esc_html__('Description', 'give'),
50
+			'post_excerpt'            => esc_html__('Excerpt', 'give'),
51
+			'post_status'             => esc_html__('Status', 'give'),
52
+			'categories'              => esc_html__('Categories', 'give'),
53
+			'tags'                    => esc_html__('Tags', 'give'),
54
+			'give_price'              => esc_html__('Price', 'give'),
55
+			'_thumbnail_id'           => esc_html__('Featured Image', 'give'),
56
+			'_give_form_sales'        => esc_html__('Donations', 'give'),
57
+			'_give_download_earnings' => esc_html__('Income', 'give'),
58 58
 		);
59 59
 
60 60
 		return $cols;
@@ -86,43 +86,43 @@  discard block
 block discarded – undo
86 86
 			'paged'          => $this->step
87 87
 		);
88 88
 
89
-		$downloads = new WP_Query( $args );
89
+		$downloads = new WP_Query($args);
90 90
 
91
-		if ( $downloads->posts ) {
92
-			foreach ( $downloads->posts as $download ) {
91
+		if ($downloads->posts) {
92
+			foreach ($downloads->posts as $download) {
93 93
 
94 94
 				$row = array();
95 95
 
96
-				foreach ( $this->csv_cols() as $key => $value ) {
96
+				foreach ($this->csv_cols() as $key => $value) {
97 97
 
98 98
 					// Setup default value
99
-					$row[ $key ] = '';
99
+					$row[$key] = '';
100 100
 
101
-					if ( in_array( $key, $meta ) ) {
101
+					if (in_array($key, $meta)) {
102 102
 
103
-						switch ( $key ) {
103
+						switch ($key) {
104 104
 
105 105
 							case '_thumbnail_id' :
106 106
 
107
-								$image_id    = get_post_thumbnail_id( $download->ID );
108
-								$row[ $key ] = wp_get_attachment_url( $image_id );
107
+								$image_id    = get_post_thumbnail_id($download->ID);
108
+								$row[$key] = wp_get_attachment_url($image_id);
109 109
 
110 110
 								break;
111 111
 
112 112
 							case 'give_price' :
113 113
 
114
-								if ( give_has_variable_prices( $download->ID ) ) {
114
+								if (give_has_variable_prices($download->ID)) {
115 115
 
116 116
 									$prices = array();
117
-									foreach ( give_get_variable_prices( $download->ID ) as $price ) {
118
-										$prices[] = $price['name'] . ': ' . $price['amount'];
117
+									foreach (give_get_variable_prices($download->ID) as $price) {
118
+										$prices[] = $price['name'].': '.$price['amount'];
119 119
 									}
120 120
 
121
-									$row[ $key ] = implode( ' | ', $prices );
121
+									$row[$key] = implode(' | ', $prices);
122 122
 
123 123
 								} else {
124 124
 
125
-									$row[ $key ] = give_get_download_price( $download->ID );
125
+									$row[$key] = give_get_download_price($download->ID);
126 126
 
127 127
 								}
128 128
 
@@ -132,54 +132,54 @@  discard block
 block discarded – undo
132 132
 
133 133
 
134 134
 								$files = array();
135
-								foreach ( give_get_download_files( $download->ID ) as $file ) {
135
+								foreach (give_get_download_files($download->ID) as $file) {
136 136
 									$files[] = $file['file'];
137 137
 								}
138 138
 
139
-								$row[ $key ] = implode( ' | ', $files );
139
+								$row[$key] = implode(' | ', $files);
140 140
 
141 141
 								break;
142 142
 
143 143
 							default :
144 144
 
145
-								$row[ $key ] = get_post_meta( $download->ID, $key, true );
145
+								$row[$key] = get_post_meta($download->ID, $key, true);
146 146
 
147 147
 								break;
148 148
 
149 149
 						}
150 150
 
151
-					} elseif ( isset( $download->$key ) ) {
151
+					} elseif (isset($download->$key)) {
152 152
 
153
-						switch ( $key ) {
153
+						switch ($key) {
154 154
 
155 155
 							case 'post_author' :
156 156
 
157
-								$row[ $key ] = get_the_author_meta( 'user_login', $download->post_author );
157
+								$row[$key] = get_the_author_meta('user_login', $download->post_author);
158 158
 
159 159
 								break;
160 160
 
161 161
 							default :
162 162
 
163
-								$row[ $key ] = $download->$key;
163
+								$row[$key] = $download->$key;
164 164
 
165 165
 								break;
166 166
 						}
167 167
 
168
-					} elseif ( 'tags' == $key ) {
168
+					} elseif ('tags' == $key) {
169 169
 
170
-						$terms = get_the_terms( $download->ID, 'download_tag' );
171
-						if ( $terms ) {
172
-							$terms       = wp_list_pluck( $terms, 'name' );
173
-							$row[ $key ] = implode( ' | ', $terms );
170
+						$terms = get_the_terms($download->ID, 'download_tag');
171
+						if ($terms) {
172
+							$terms       = wp_list_pluck($terms, 'name');
173
+							$row[$key] = implode(' | ', $terms);
174 174
 						}
175 175
 
176 176
 
177
-					} elseif ( 'categories' == $key ) {
177
+					} elseif ('categories' == $key) {
178 178
 
179
-						$terms = get_the_terms( $download->ID, 'download_category' );
180
-						if ( $terms ) {
181
-							$terms       = wp_list_pluck( $terms, 'name' );
182
-							$row[ $key ] = implode( ' | ', $terms );
179
+						$terms = get_the_terms($download->ID, 'download_category');
180
+						if ($terms) {
181
+							$terms       = wp_list_pluck($terms, 'name');
182
+							$row[$key] = implode(' | ', $terms);
183 183
 						}
184 184
 
185 185
 					}
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 
191 191
 			}
192 192
 
193
-			$data = apply_filters( 'give_export_get_data', $data );
194
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
193
+			$data = apply_filters('give_export_get_data', $data);
194
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
195 195
 
196 196
 			return $data;
197 197
 		}
@@ -210,20 +210,20 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$args = array(
212 212
 			'post_type'      => 'give_forms',
213
-			'posts_per_page' => - 1,
213
+			'posts_per_page' => -1,
214 214
 			'post_status'    => 'any',
215 215
 			'fields'         => 'ids',
216 216
 		);
217 217
 
218
-		$downloads  = new WP_Query( $args );
218
+		$downloads  = new WP_Query($args);
219 219
 		$total      = (int) $downloads->post_count;
220 220
 		$percentage = 100;
221 221
 
222
-		if ( $total > 0 ) {
223
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
222
+		if ($total > 0) {
223
+			$percentage = ((30 * $this->step) / $total) * 100;
224 224
 		}
225 225
 
226
-		if ( $percentage > 100 ) {
226
+		if ($percentage > 100) {
227 227
 			$percentage = 100;
228 228
 		}
229 229
 
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-payments.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => esc_html__( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => esc_html__( 'Email', 'give' ),
45
-			'first'     => esc_html__( 'First Name', 'give' ),
46
-			'last'      => esc_html__( 'Last Name', 'give' ),
47
-			'address1'  => esc_html__( 'Address 1', 'give' ),
48
-			'address2'  => esc_html__( 'Address 2', 'give' ),
49
-			'city'      => esc_html__( 'City', 'give' ),
50
-			'state'     => esc_html__( 'State', 'give' ),
51
-			'country'   => esc_html__( 'Country', 'give' ),
52
-			'zip'       => esc_html__( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => esc_html__( 'Form ID', 'give' ),
54
-			'form_name' => esc_html__( 'Form Name', 'give' ),
55
-			'amount'    => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')',
56
-			'gateway'   => esc_html__( 'Payment Method', 'give' ),
57
-			'trans_id'  => esc_html__( 'Transaction ID', 'give' ),
58
-			'key'       => esc_html__( 'Key', 'give' ),
59
-			'date'      => esc_html__( 'Date', 'give' ),
60
-			'user'      => esc_html__( 'User', 'give' ),
61
-			'status'    => esc_html__( 'Status', 'give' )
42
+			'id'        => esc_html__('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => esc_html__('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => esc_html__('Email', 'give'),
45
+			'first'     => esc_html__('First Name', 'give'),
46
+			'last'      => esc_html__('Last Name', 'give'),
47
+			'address1'  => esc_html__('Address 1', 'give'),
48
+			'address2'  => esc_html__('Address 2', 'give'),
49
+			'city'      => esc_html__('City', 'give'),
50
+			'state'     => esc_html__('State', 'give'),
51
+			'country'   => esc_html__('Country', 'give'),
52
+			'zip'       => esc_html__('Zip / Postal Code', 'give'),
53
+			'form_id'   => esc_html__('Form ID', 'give'),
54
+			'form_name' => esc_html__('Form Name', 'give'),
55
+			'amount'    => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')',
56
+			'gateway'   => esc_html__('Payment Method', 'give'),
57
+			'trans_id'  => esc_html__('Transaction ID', 'give'),
58
+			'key'       => esc_html__('Key', 'give'),
59
+			'date'      => esc_html__('Date', 'give'),
60
+			'user'      => esc_html__('User', 'give'),
61
+			'status'    => esc_html__('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 			'status' => $this->status
88 88
 		);
89 89
 
90
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
90
+		if ( ! empty($this->start) || ! empty($this->end)) {
91 91
 
92 92
 			$args['date_query'] = array(
93 93
 				array(
94
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
95
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
94
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
95
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
96 96
 					'inclusive' => true
97 97
 				)
98 98
 			);
@@ -101,52 +101,52 @@  discard block
 block discarded – undo
101 101
 
102 102
 		//echo json_encode($args ); exit;
103 103
 
104
-		$payments = give_get_payments( $args );
104
+		$payments = give_get_payments($args);
105 105
 
106
-		if ( $payments ) {
106
+		if ($payments) {
107 107
 
108
-			foreach ( $payments as $payment ) {
109
-				$payment_meta = give_get_payment_meta( $payment->ID );
110
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
111
-				$total        = give_get_payment_amount( $payment->ID );
112
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
108
+			foreach ($payments as $payment) {
109
+				$payment_meta = give_get_payment_meta($payment->ID);
110
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
111
+				$total        = give_get_payment_amount($payment->ID);
112
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
113 113
 				$products     = '';
114 114
 				$skus         = '';
115 115
 
116
-				if ( is_numeric( $user_id ) ) {
117
-					$user = get_userdata( $user_id );
116
+				if (is_numeric($user_id)) {
117
+					$user = get_userdata($user_id);
118 118
 				} else {
119 119
 					$user = false;
120 120
 				}
121 121
 
122 122
 				$data[] = array(
123 123
 					'id'        => $payment->ID,
124
-					'seq_id'    => give_get_payment_number( $payment->ID ),
124
+					'seq_id'    => give_get_payment_number($payment->ID),
125 125
 					'email'     => $payment_meta['email'],
126 126
 					'first'     => $user_info['first_name'],
127 127
 					'last'      => $user_info['last_name'],
128
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
129
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
130
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
131
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
132
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
133
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
134
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
135
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
128
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
129
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
130
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
131
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
132
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
133
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
134
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
135
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
136 136
 					'skus'      => $skus,
137
-					'amount'    => html_entity_decode( give_format_amount( $total ) ),
138
-					'gateway'   => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ),
139
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
137
+					'amount'    => html_entity_decode(give_format_amount($total)),
138
+					'gateway'   => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)),
139
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
140 140
 					'key'       => $payment_meta['key'],
141 141
 					'date'      => $payment->post_date,
142
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
143
-					'status'    => give_get_payment_status( $payment, true )
142
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
143
+					'status'    => give_get_payment_status($payment, true)
144 144
 				);
145 145
 
146 146
 			}
147 147
 
148
-			$data = apply_filters( 'give_export_get_data', $data );
149
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
148
+			$data = apply_filters('give_export_get_data', $data);
149
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
150 150
 
151 151
 			return $data;
152 152
 
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$status = $this->status;
168 168
 		$args   = array(
169
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
170
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
169
+			'start-date' => date('n/d/Y', strtotime($this->start)),
170
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
171 171
 		);
172 172
 
173
-		if ( 'any' == $status ) {
173
+		if ('any' == $status) {
174 174
 
175
-			$total = array_sum( (array) give_count_payments( $args ) );
175
+			$total = array_sum((array) give_count_payments($args));
176 176
 
177 177
 		} else {
178 178
 
179
-			$total = give_count_payments( $args )->$status;
179
+			$total = give_count_payments($args)->$status;
180 180
 
181 181
 		}
182 182
 
183 183
 		$percentage = 100;
184 184
 
185
-		if ( $total > 0 ) {
186
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
185
+		if ($total > 0) {
186
+			$percentage = ((30 * $this->step) / $total) * 100;
187 187
 		}
188 188
 
189
-		if ( $percentage > 100 ) {
189
+		if ($percentage > 100) {
190 190
 			$percentage = 100;
191 191
 		}
192 192
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param array $request The Form Data passed into the batch processing.
202 202
 	 */
203
-	public function set_properties( $request ) {
204
-		$this->start  = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
205
-		$this->end    = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
206
-		$this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
203
+	public function set_properties($request) {
204
+		$this->start  = isset($request['start']) ? sanitize_text_field($request['start']) : '';
205
+		$this->end    = isset($request['end']) ? sanitize_text_field($request['end']) : '';
206
+		$this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
207 207
 	}
208 208
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-customers.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @param array $request The Form Data passed into the batch processing
48 48
 	 */
49
-	public function set_properties( $request ) {
49
+	public function set_properties($request) {
50 50
 
51 51
 		//Set data from form submission
52
-		if ( isset( $_POST['form'] ) ) {
53
-			parse_str( $_POST['form'], $this->data );
52
+		if (isset($_POST['form'])) {
53
+			parse_str($_POST['form'], $this->data);
54 54
 		}
55 55
 
56 56
 		$this->form = $this->data['forms'];
57 57
 
58
-		$this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
58
+		$this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
59 59
 
60 60
 	}
61 61
 
@@ -70,36 +70,36 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$cols = array();
72 72
 
73
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
73
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
74 74
 
75
-		if ( empty( $columns ) ) {
75
+		if (empty($columns)) {
76 76
 			return false;
77 77
 		}
78
-		if ( ! empty( $columns['full_name'] ) ) {
79
-			$cols['full_name'] = esc_html__( 'Full Name', 'give' );
78
+		if ( ! empty($columns['full_name'])) {
79
+			$cols['full_name'] = esc_html__('Full Name', 'give');
80 80
 		}
81
-		if ( ! empty( $columns['email'] ) ) {
82
-			$cols['email'] = esc_html__( 'Email Address', 'give' );
81
+		if ( ! empty($columns['email'])) {
82
+			$cols['email'] = esc_html__('Email Address', 'give');
83 83
 		}
84
-		if ( ! empty( $columns['address'] ) ) {
85
-			$cols['address_line1']   = esc_html__( 'Address 1', 'give' );
86
-			$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
87
-			$cols['address_city']    = esc_html__( 'City', 'give' );
88
-			$cols['address_state']   = esc_html__( 'State', 'give' );
89
-			$cols['address_zip']     = esc_html__( 'Zip', 'give' );
90
-			$cols['address_country'] = esc_html__( 'Country', 'give' );
84
+		if ( ! empty($columns['address'])) {
85
+			$cols['address_line1']   = esc_html__('Address 1', 'give');
86
+			$cols['address_line2']   = esc_html__('Address 2', 'give');
87
+			$cols['address_city']    = esc_html__('City', 'give');
88
+			$cols['address_state']   = esc_html__('State', 'give');
89
+			$cols['address_zip']     = esc_html__('Zip', 'give');
90
+			$cols['address_country'] = esc_html__('Country', 'give');
91 91
 		}
92
-		if ( ! empty( $columns['userid'] ) ) {
93
-			$cols['userid'] = esc_html__( 'User ID', 'give' );
92
+		if ( ! empty($columns['userid'])) {
93
+			$cols['userid'] = esc_html__('User ID', 'give');
94 94
 		}
95
-		if ( ! empty( $columns['date_first_donated'] ) ) {
96
-			$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
95
+		if ( ! empty($columns['date_first_donated'])) {
96
+			$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
97 97
 		}
98
-		if ( ! empty( $columns['donations'] ) ) {
99
-			$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
98
+		if ( ! empty($columns['donations'])) {
99
+			$cols['donations'] = esc_html__('Number of Donations', 'give');
100 100
 		}
101
-		if ( ! empty( $columns['donation_sum'] ) ) {
102
-			$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
101
+		if ( ! empty($columns['donation_sum'])) {
102
+			$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
103 103
 		}
104 104
 
105 105
 		return $cols;
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$i = 0;
121 121
 
122
-		if ( ! empty( $this->form ) ) {
122
+		if ( ! empty($this->form)) {
123 123
 
124 124
 			// Export donors of a specific product
125 125
 			global $give_logs;
126 126
 
127 127
 			$args = array(
128
-				'post_parent'    => absint( $this->form ),
128
+				'post_parent'    => absint($this->form),
129 129
 				'log_type'       => 'sale',
130 130
 				'posts_per_page' => 30,
131 131
 				'paged'          => $this->step
132 132
 			);
133 133
 
134 134
 			//Check for price option
135
-			if ( null !== $this->price_id ) {
135
+			if (null !== $this->price_id) {
136 136
 				$args['meta_query'] = array(
137 137
 					array(
138 138
 						'key'   => '_give_log_price_id',
@@ -141,33 +141,33 @@  discard block
 block discarded – undo
141 141
 				);
142 142
 			}
143 143
 
144
-			$logs = $give_logs->get_connected_logs( $args );
144
+			$logs = $give_logs->get_connected_logs($args);
145 145
 
146
-			if ( $logs ) {
147
-				foreach ( $logs as $log ) {
148
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
149
-					$payment    = new Give_Payment( $payment_id );
150
-					$donor      = Give()->customers->get_customer_by( 'id', $payment->customer_id );
151
-					$data[]     = $this->set_donor_data( $i, $data, $donor );
152
-					$i ++;
146
+			if ($logs) {
147
+				foreach ($logs as $log) {
148
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
149
+					$payment    = new Give_Payment($payment_id);
150
+					$donor      = Give()->customers->get_customer_by('id', $payment->customer_id);
151
+					$data[]     = $this->set_donor_data($i, $data, $donor);
152
+					$i++;
153 153
 				}
154 154
 			}
155 155
 
156 156
 		} else {
157 157
 
158 158
 			// Export all customers
159
-			$offset = 30 * ( $this->step - 1 );
160
-			$donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
159
+			$offset = 30 * ($this->step - 1);
160
+			$donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset));
161 161
 
162
-			foreach ( $donors as $donor ) {
162
+			foreach ($donors as $donor) {
163 163
 
164
-				$data[] = $this->set_donor_data( $i, $data, $donor );
165
-				$i ++;
164
+				$data[] = $this->set_donor_data($i, $data, $donor);
165
+				$i++;
166 166
 			}
167 167
 		}
168 168
 
169
-		$data = apply_filters( 'give_export_get_data', $data );
170
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
169
+		$data = apply_filters('give_export_get_data', $data);
170
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
171 171
 
172 172
 		return $data;
173 173
 	}
@@ -183,19 +183,19 @@  discard block
 block discarded – undo
183 183
 		$percentage = 0;
184 184
 
185 185
 		// We can't count the number when getting them for a specific form
186
-		if ( empty( $this->form ) ) {
186
+		if (empty($this->form)) {
187 187
 
188 188
 			$total = Give()->customers->count();
189 189
 
190
-			if ( $total > 0 ) {
190
+			if ($total > 0) {
191 191
 
192
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
192
+				$percentage = ((30 * $this->step) / $total) * 100;
193 193
 
194 194
 			}
195 195
 
196 196
 		}
197 197
 
198
-		if ( $percentage > 100 ) {
198
+		if ($percentage > 100) {
199 199
 			$percentage = 100;
200 200
 		}
201 201
 
@@ -207,46 +207,46 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param $donor
209 209
 	 */
210
-	private function set_donor_data( $i, $data, $donor ) {
210
+	private function set_donor_data($i, $data, $donor) {
211 211
 
212 212
 		$columns = $this->csv_cols();
213 213
 
214 214
 		//Set address variable
215 215
 		$address = '';
216
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
217
-			$address = give_get_donor_address( $donor->user_id );
216
+		if (isset($donor->user_id) && $donor->user_id > 0) {
217
+			$address = give_get_donor_address($donor->user_id);
218 218
 		}
219 219
 
220 220
 		//Set columns
221
-		if ( ! empty( $columns['full_name'] ) ) {
222
-			$data[ $i ]['full_name'] = $donor->name;
221
+		if ( ! empty($columns['full_name'])) {
222
+			$data[$i]['full_name'] = $donor->name;
223 223
 		}
224
-		if ( ! empty( $columns['email'] ) ) {
225
-			$data[ $i ]['email'] = $donor->email;
224
+		if ( ! empty($columns['email'])) {
225
+			$data[$i]['email'] = $donor->email;
226 226
 		}
227
-		if ( ! empty( $columns['address_line1'] ) ) {
227
+		if ( ! empty($columns['address_line1'])) {
228 228
 
229
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
230
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
231
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
232
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
233
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
234
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
229
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
230
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
231
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
232
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
233
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
234
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
235 235
 		}
236
-		if ( ! empty( $columns['userid'] ) ) {
237
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
236
+		if ( ! empty($columns['userid'])) {
237
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
238 238
 		}
239
-		if ( ! empty( $columns['date_first_donated'] ) ) {
240
-			$data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
239
+		if ( ! empty($columns['date_first_donated'])) {
240
+			$data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created));
241 241
 		}
242
-		if ( ! empty( $columns['donations'] ) ) {
243
-			$data[ $i ]['donations'] = $donor->purchase_count;
242
+		if ( ! empty($columns['donations'])) {
243
+			$data[$i]['donations'] = $donor->purchase_count;
244 244
 		}
245
-		if ( ! empty( $columns['donation_sum'] ) ) {
246
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value );
245
+		if ( ! empty($columns['donation_sum'])) {
246
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value);
247 247
 		}
248 248
 
249
-		return $data[ $i ];
249
+		return $data[$i];
250 250
 
251 251
 	}
252 252
 
Please login to merge, or discard this patch.
includes/admin/reporting/graphing.php 1 patch
Spacing   +243 added lines, -243 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,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$dates = give_get_report_dates();
26 26
 
27 27
 	// Determine graph options
28
-	switch ( $dates['range'] ) :
28
+	switch ($dates['range']) :
29 29
 		case 'today' :
30 30
 		case 'yesterday' :
31 31
 			$day_by_day = true;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$day_by_day = false;
38 38
 			break;
39 39
 		case 'other' :
40
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
40
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
41 41
 				$day_by_day = false;
42 42
 			} else {
43 43
 				$day_by_day = true;
@@ -49,61 +49,61 @@  discard block
 block discarded – undo
49 49
 	endswitch;
50 50
 
51 51
 	$earnings_totals = 0.00; // Total earnings for time period shown
52
-	$sales_totals    = 0;            // Total sales for time period shown
52
+	$sales_totals    = 0; // Total sales for time period shown
53 53
 
54 54
 	$earnings_data = array();
55 55
 	$sales_data    = array();
56 56
 
57
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
57
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
58 58
 		// Hour by hour
59 59
 		$hour  = 1;
60
-		$month = date( 'n', current_time( 'timestamp' ) );
61
-		while ( $hour <= 23 ) :
60
+		$month = date('n', current_time('timestamp'));
61
+		while ($hour <= 23) :
62 62
 
63
-			$sales    = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
64
-			$earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour );
63
+			$sales    = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour);
64
+			$earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour);
65 65
 
66 66
 			$sales_totals += $sales;
67 67
 			$earnings_totals += $earnings;
68 68
 
69
-			$date            = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000;
70
-			$sales_data[]    = array( $date, $sales );
71
-			$earnings_data[] = array( $date, $earnings );
69
+			$date            = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000;
70
+			$sales_data[]    = array($date, $sales);
71
+			$earnings_data[] = array($date, $earnings);
72 72
 
73
-			$hour ++;
73
+			$hour++;
74 74
 		endwhile;
75 75
 
76
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
76
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
77 77
 
78 78
 		// Day by day
79 79
 		$day     = $dates['day'];
80 80
 		$day_end = $dates['day_end'];
81 81
 		$month   = $dates['m_start'];
82
-		while ( $day <= $day_end ) :
83
-			$sales = give_get_sales_by_date( $day, $month, $dates['year'] );
82
+		while ($day <= $day_end) :
83
+			$sales = give_get_sales_by_date($day, $month, $dates['year']);
84 84
 			$sales_totals += $sales;
85 85
 
86
-			$earnings = give_get_earnings_by_date( $day, $month, $dates['year'] );
86
+			$earnings = give_get_earnings_by_date($day, $month, $dates['year']);
87 87
 			$earnings_totals += $earnings;
88 88
 
89
-			$date            = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
90
-			$sales_data[]    = array( $date, $sales );
91
-			$earnings_data[] = array( $date, $earnings );
92
-			$day ++;
89
+			$date            = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000;
90
+			$sales_data[]    = array($date, $sales);
91
+			$earnings_data[] = array($date, $earnings);
92
+			$day++;
93 93
 		endwhile;
94 94
 
95 95
 	} else {
96 96
 
97 97
 		$y = $dates['year'];
98
-		while ( $y <= $dates['year_end'] ) :
98
+		while ($y <= $dates['year_end']) :
99 99
 
100
-			if ( $dates['year'] == $dates['year_end'] ) {
100
+			if ($dates['year'] == $dates['year_end']) {
101 101
 				$month_start = $dates['m_start'];
102 102
 				$month_end   = $dates['m_end'];
103
-			} elseif ( $y == $dates['year'] ) {
103
+			} elseif ($y == $dates['year']) {
104 104
 				$month_start = $dates['m_start'];
105 105
 				$month_end   = 12;
106
-			} elseif ( $y == $dates['year_end'] ) {
106
+			} elseif ($y == $dates['year_end']) {
107 107
 				$month_start = 1;
108 108
 				$month_end   = $dates['m_end'];
109 109
 			} else {
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 
114 114
 			$i = $month_start;
115
-			while ( $i <= $month_end ) :
115
+			while ($i <= $month_end) :
116 116
 
117
-				if ( $day_by_day ) :
117
+				if ($day_by_day) :
118 118
 
119
-					if ( $i == $month_end ) {
119
+					if ($i == $month_end) {
120 120
 
121 121
 						$num_of_days = $dates['day_end'];
122 122
 
123 123
 					} else {
124 124
 
125
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
125
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
126 126
 
127 127
 					}
128 128
 
129 129
 					$d = $dates['day'];
130 130
 
131
-					while ( $d <= $num_of_days ) :
131
+					while ($d <= $num_of_days) :
132 132
 
133
-						$sales = give_get_sales_by_date( $d, $i, $y );
133
+						$sales = give_get_sales_by_date($d, $i, $y);
134 134
 						$sales_totals += $sales;
135 135
 
136
-						$earnings = give_get_earnings_by_date( $d, $i, $y );
136
+						$earnings = give_get_earnings_by_date($d, $i, $y);
137 137
 						$earnings_totals += $earnings;
138 138
 
139
-						$date            = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
140
-						$sales_data[]    = array( $date, $sales );
141
-						$earnings_data[] = array( $date, $earnings );
142
-						$d ++;
139
+						$date            = mktime(0, 0, 0, $i, $d, $y) * 1000;
140
+						$sales_data[]    = array($date, $sales);
141
+						$earnings_data[] = array($date, $earnings);
142
+						$d++;
143 143
 
144 144
 					endwhile;
145 145
 
146 146
 				else :
147 147
 
148
-					$sales = give_get_sales_by_date( null, $i, $y );
148
+					$sales = give_get_sales_by_date(null, $i, $y);
149 149
 					$sales_totals += $sales;
150 150
 
151
-					$earnings = give_get_earnings_by_date( null, $i, $y );
151
+					$earnings = give_get_earnings_by_date(null, $i, $y);
152 152
 					$earnings_totals += $earnings;
153 153
 
154
-					if ( $i == $month_end ) {
154
+					if ($i == $month_end) {
155 155
 
156
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
156
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
157 157
 
158 158
 					} else {
159 159
 
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 
162 162
 					}
163 163
 
164
-					$date            = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000;
165
-					$sales_data[]    = array( $date, $sales );
166
-					$earnings_data[] = array( $date, $earnings );
164
+					$date            = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000;
165
+					$sales_data[]    = array($date, $sales);
166
+					$earnings_data[] = array($date, $earnings);
167 167
 
168 168
 				endif;
169 169
 
170
-				$i ++;
170
+				$i++;
171 171
 
172 172
 			endwhile;
173 173
 
174
-			$y ++;
174
+			$y++;
175 175
 		endwhile;
176 176
 
177 177
 	}
178 178
 
179 179
 	$data = array(
180
-		esc_html__( 'Income', 'give' )    => $earnings_data,
181
-		esc_html__( 'Donations', 'give' ) => $sales_data
180
+		esc_html__('Income', 'give')    => $earnings_data,
181
+		esc_html__('Donations', 'give') => $sales_data
182 182
 	);
183 183
 
184 184
 	// start our own output buffer
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			<div class="postbox">
191 191
 				<div class="inside">
192 192
 					<?php
193
-					$graph = new Give_Graph( $data );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data);
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' == $dates['range'] ) {
198
+					if ('this_month' == $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
 			<table class="widefat reports-table alignleft" style="max-width:450px">
206 206
 				<tbody>
207 207
 				<tr>
208
-					<th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th>
209
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
208
+					<th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th>
209
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
210 210
 				</tr>
211 211
 				<tr class="alternate">
212
-					<th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th>
212
+					<th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th>
213 213
 					<td><?php echo $sales_totals; ?></td>
214 214
 				</tr>
215
-				<?php if ( 'this_month' == $dates['range'] ) : ?>
215
+				<?php if ('this_month' == $dates['range']) : ?>
216 216
 					<tr>
217
-						<th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th>
218
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td>
217
+						<th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th>
218
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td>
219 219
 					</tr>
220 220
 					<tr class="alternate">
221
-						<th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
222
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
221
+						<th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th>
222
+						<td><?php echo floor($estimated['sales']); ?></td>
223 223
 					</tr>
224 224
 				<?php endif; ?>
225 225
 			</table>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			 *
233 233
 			 * @since 1.0
234 234
 			 */
235
-			do_action( 'give_reports_graph_additional_stats' );
235
+			do_action('give_reports_graph_additional_stats');
236 236
 			?>
237 237
 
238 238
 		</div>
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
  * @since 1.0
252 252
  * @return void
253 253
  */
254
-function give_reports_graph_of_form( $form_id = 0 ) {
254
+function give_reports_graph_of_form($form_id = 0) {
255 255
 	// Retrieve the queried dates
256 256
 	$dates = give_get_report_dates();
257 257
 
258 258
 	// Determine graph options
259
-	switch ( $dates['range'] ) :
259
+	switch ($dates['range']) :
260 260
 		case 'today' :
261 261
 		case 'yesterday' :
262 262
 			$day_by_day = true;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			$day_by_day = false;
275 275
 			break;
276 276
 		case 'other' :
277
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
277
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
278 278
 				$day_by_day = false;
279 279
 			} else {
280 280
 				$day_by_day = true;
@@ -286,75 +286,75 @@  discard block
 block discarded – undo
286 286
 	endswitch;
287 287
 
288 288
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown
289
-	$sales_totals    = 0;            // Total sales for time period shown
289
+	$sales_totals    = 0; // Total sales for time period shown
290 290
 
291 291
 	$earnings_data = array();
292 292
 	$sales_data    = array();
293 293
 	$stats         = new Give_Payment_Stats;
294 294
 
295
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
295
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
296 296
 
297 297
 		// Hour by hour
298 298
 		$month  = $dates['m_start'];
299 299
 		$hour   = 1;
300 300
 		$minute = 0;
301 301
 		$second = 0;
302
-		while ( $hour <= 23 ) :
302
+		while ($hour <= 23) :
303 303
 
304
-			if ( $hour == 23 ) {
304
+			if ($hour == 23) {
305 305
 				$minute = $second = 59;
306 306
 			}
307 307
 
308
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
309
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
308
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
309
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
310 310
 
311
-			$sales = $stats->get_sales( $form_id, $date, $date_end );
311
+			$sales = $stats->get_sales($form_id, $date, $date_end);
312 312
 			$sales_totals += $sales;
313 313
 
314
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
314
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
315 315
 			$earnings_totals += $earnings;
316 316
 
317
-			$sales_data[]    = array( $date * 1000, $sales );
318
-			$earnings_data[] = array( $date * 1000, $earnings );
317
+			$sales_data[]    = array($date * 1000, $sales);
318
+			$earnings_data[] = array($date * 1000, $earnings);
319 319
 
320
-			$hour ++;
320
+			$hour++;
321 321
 		endwhile;
322 322
 
323
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
323
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
324 324
 
325 325
 		//Day by day
326 326
 		$day     = $dates['day'];
327 327
 		$day_end = $dates['day_end'];
328 328
 		$month   = $dates['m_start'];
329
-		while ( $day <= $day_end ) :
329
+		while ($day <= $day_end) :
330 330
 
331
-			$date     = mktime( 0, 0, 0, $month, $day, $dates['year'] );
332
-			$date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
333
-			$sales    = $stats->get_sales( $form_id, $date, $date_end );
331
+			$date     = mktime(0, 0, 0, $month, $day, $dates['year']);
332
+			$date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
333
+			$sales    = $stats->get_sales($form_id, $date, $date_end);
334 334
 			$sales_totals += $sales;
335 335
 
336
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
336
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
337 337
 			$earnings_totals += $earnings;
338 338
 
339
-			$sales_data[]    = array( $date * 1000, $sales );
340
-			$earnings_data[] = array( $date * 1000, $earnings );
339
+			$sales_data[]    = array($date * 1000, $sales);
340
+			$earnings_data[] = array($date * 1000, $earnings);
341 341
 
342
-			$day ++;
342
+			$day++;
343 343
 		endwhile;
344 344
 
345 345
 	} else {
346 346
 
347 347
 		$y = $dates['year'];
348 348
 
349
-		while ( $y <= $dates['year_end'] ) :
349
+		while ($y <= $dates['year_end']) :
350 350
 
351 351
 			$last_year = false;
352 352
 
353
-			if ( $dates['year'] == $dates['year_end'] ) {
353
+			if ($dates['year'] == $dates['year_end']) {
354 354
 				$month_start = $dates['m_start'];
355 355
 				$month_end   = $dates['m_end'];
356 356
 				$last_year   = true;
357
-			} elseif ( $y == $dates['year'] ) {
357
+			} elseif ($y == $dates['year']) {
358 358
 				$month_start = $dates['m_start'];
359 359
 				$month_end   = 12;
360 360
 			} else {
@@ -363,75 +363,75 @@  discard block
 block discarded – undo
363 363
 			}
364 364
 
365 365
 			$i = $month_start;
366
-			while ( $i <= $month_end ) :
366
+			while ($i <= $month_end) :
367 367
 
368
-				if ( $day_by_day ) :
368
+				if ($day_by_day) :
369 369
 
370
-					if ( $i == $month_end && $last_year ) {
370
+					if ($i == $month_end && $last_year) {
371 371
 
372 372
 						$num_of_days = $dates['day_end'];
373 373
 
374 374
 					} else {
375 375
 
376
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
376
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
377 377
 
378 378
 					}
379 379
 
380 380
 					$d = $dates['day'];
381
-					while ( $d <= $num_of_days ) :
381
+					while ($d <= $num_of_days) :
382 382
 
383
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
384
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
383
+						$date     = mktime(0, 0, 0, $i, $d, $y);
384
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
385 385
 
386
-						$sales = $stats->get_sales( $form_id, $date, $end_date );
386
+						$sales = $stats->get_sales($form_id, $date, $end_date);
387 387
 						$sales_totals += $sales;
388 388
 
389
-						$earnings = $stats->get_earnings( $form_id, $date, $end_date );
389
+						$earnings = $stats->get_earnings($form_id, $date, $end_date);
390 390
 						$earnings_totals += $earnings;
391 391
 
392
-						$sales_data[]    = array( $date * 1000, $sales );
393
-						$earnings_data[] = array( $date * 1000, $earnings );
394
-						$d ++;
392
+						$sales_data[]    = array($date * 1000, $sales);
393
+						$earnings_data[] = array($date * 1000, $earnings);
394
+						$d++;
395 395
 
396 396
 					endwhile;
397 397
 
398 398
 				else :
399 399
 
400
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
400
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
401 401
 
402
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
403
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
402
+					$date     = mktime(0, 0, 0, $i, 1, $y);
403
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
404 404
 
405
-					$sales = $stats->get_sales( $form_id, $date, $end_date );
405
+					$sales = $stats->get_sales($form_id, $date, $end_date);
406 406
 					$sales_totals += $sales;
407 407
 
408
-					$earnings = $stats->get_earnings( $form_id, $date, $end_date );
408
+					$earnings = $stats->get_earnings($form_id, $date, $end_date);
409 409
 					$earnings_totals += $earnings;
410 410
 
411
-					$sales_data[]    = array( $date * 1000, $sales );
412
-					$earnings_data[] = array( $date * 1000, $earnings );
411
+					$sales_data[]    = array($date * 1000, $sales);
412
+					$earnings_data[] = array($date * 1000, $earnings);
413 413
 				endif;
414 414
 
415
-				$i ++;
415
+				$i++;
416 416
 
417 417
 			endwhile;
418 418
 
419
-			$y ++;
419
+			$y++;
420 420
 		endwhile;
421 421
 
422 422
 	}
423 423
 
424 424
 	$data = array(
425
-		esc_html__( 'Income', 'give' )    => $earnings_data,
426
-		esc_html__( 'Donations', 'give' ) => $sales_data
425
+		esc_html__('Income', 'give')    => $earnings_data,
426
+		esc_html__('Donations', 'give') => $sales_data
427 427
 	);
428 428
 
429 429
 	?>
430 430
 	<h3><span><?php
431 431
 		printf(
432 432
 			/* translators: %s: form title */
433
-			esc_html__( 'Income Over Time for %s', 'give' ),
434
-			get_the_title( $form_id )
433
+			esc_html__('Income Over Time for %s', 'give'),
434
+			get_the_title($form_id)
435 435
 		);
436 436
 	?></span></h3>
437 437
 
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 		<div class="postbox">
440 440
 			<div class="inside">
441 441
 				<?php
442
-				$graph = new Give_Graph( $data );
443
-				$graph->set( 'x_mode', 'time' );
444
-				$graph->set( 'multiple_y_axes', true );
442
+				$graph = new Give_Graph($data);
443
+				$graph->set('x_mode', 'time');
444
+				$graph->set('multiple_y_axes', true);
445 445
 				$graph->display();
446 446
 				?>
447 447
 			</div>
@@ -450,20 +450,20 @@  discard block
 block discarded – undo
450 450
 		<table class="widefat reports-table alignleft" style="max-width:450px">
451 451
 			<tbody>
452 452
 			<tr>
453
-				<th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th>
454
-				<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
453
+				<th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th>
454
+				<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
455 455
 			</tr>
456 456
 			<tr class="alternate">
457
-				<th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th>
457
+				<th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th>
458 458
 				<td><?php echo $sales_totals; ?></td>
459 459
 			</tr>
460 460
 			<tr>
461
-				<th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th>
462
-				<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td>
461
+				<th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th>
462
+				<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td>
463 463
 			</tr>
464 464
 			<tr class="alternate">
465
-				<th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th>
466
-				<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
465
+				<th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th>
466
+				<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
467 467
 			</tr>
468 468
 			</tbody>
469 469
 		</table>
@@ -480,26 +480,26 @@  discard block
 block discarded – undo
480 480
  * @return void
481 481
  */
482 482
 function give_reports_graph_controls() {
483
-	$date_options = apply_filters( 'give_report_date_options', array(
484
-		'today'        => esc_html__( 'Today', 'give' ),
485
-		'yesterday'    => esc_html__( 'Yesterday', 'give' ),
486
-		'this_week'    => esc_html__( 'This Week', 'give' ),
487
-		'last_week'    => esc_html__( 'Last Week', 'give' ),
488
-		'this_month'   => esc_html__( 'This Month', 'give' ),
489
-		'last_month'   => esc_html__( 'Last Month', 'give' ),
490
-		'this_quarter' => esc_html__( 'This Quarter', 'give' ),
491
-		'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
492
-		'this_year'    => esc_html__( 'This Year', 'give' ),
493
-		'last_year'    => esc_html__( 'Last Year', 'give' ),
494
-		'other'        => esc_html__( 'Custom', 'give' )
495
-	) );
483
+	$date_options = apply_filters('give_report_date_options', array(
484
+		'today'        => esc_html__('Today', 'give'),
485
+		'yesterday'    => esc_html__('Yesterday', 'give'),
486
+		'this_week'    => esc_html__('This Week', 'give'),
487
+		'last_week'    => esc_html__('Last Week', 'give'),
488
+		'this_month'   => esc_html__('This Month', 'give'),
489
+		'last_month'   => esc_html__('Last Month', 'give'),
490
+		'this_quarter' => esc_html__('This Quarter', 'give'),
491
+		'last_quarter' => esc_html__('Last Quarter', 'give'),
492
+		'this_year'    => esc_html__('This Year', 'give'),
493
+		'last_year'    => esc_html__('Last Year', 'give'),
494
+		'other'        => esc_html__('Custom', 'give')
495
+	));
496 496
 
497 497
 	$dates   = give_get_report_dates();
498 498
 	$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
499 499
 	$view    = give_get_reporting_view();
500 500
 
501
-	if ( empty( $dates['day_end'] ) ) {
502
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
501
+	if (empty($dates['day_end'])) {
502
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
503 503
 	}
504 504
 
505 505
 	/**
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 *
508 508
 	 * @since 1.0
509 509
 	 */
510
-	do_action( 'give_report_graph_controls_before' );
510
+	do_action('give_report_graph_controls_before');
511 511
 	?>
512 512
 	<form id="give-graphs-filter" method="get" class="alignright">
513 513
 		<div class="tablenav top alignright">
@@ -515,53 +515,53 @@  discard block
 block discarded – undo
515 515
 
516 516
 				<input type="hidden" name="post_type" value="give_forms" />
517 517
 				<input type="hidden" name="page" value="give-reports" />
518
-				<input type="hidden" name="view" value="<?php echo esc_attr( $view ); ?>" />
518
+				<input type="hidden" name="view" value="<?php echo esc_attr($view); ?>" />
519 519
 
520
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
521
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
520
+				<?php if (isset($_GET['form-id'])) : ?>
521
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
522 522
 				<?php endif; ?>
523 523
 
524 524
 				<div id="give-graphs-date-options-wrap" class="alignright">
525 525
 					<select id="give-graphs-date-options" name="range">
526
-						<?php foreach ( $date_options as $key => $option ) : ?>
527
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
526
+						<?php foreach ($date_options as $key => $option) : ?>
527
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
528 528
 						<?php endforeach; ?>
529 529
 					</select>
530 530
 
531
-					<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" />
531
+					<input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" />
532 532
 				</div>
533 533
 
534 534
 				<div id="give-date-range-options" <?php echo $display; ?>>
535
-					<span><?php esc_html_e( 'From', 'give' ); ?>&nbsp;</span>
535
+					<span><?php esc_html_e('From', 'give'); ?>&nbsp;</span>
536 536
 					<select id="give-graphs-month-start" name="m_start">
537
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
538
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
537
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
538
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option>
539 539
 						<?php endfor; ?>
540 540
 					</select>
541 541
 					<select id="give-graphs-day-start" name="day">
542
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
543
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option>
542
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
543
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option>
544 544
 						<?php endfor; ?>
545 545
 					</select>
546 546
 					<select id="give-graphs-year-start" name="year">
547
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
548
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option>
547
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
548
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option>
549 549
 						<?php endfor; ?>
550 550
 					</select>
551
-					<span><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
551
+					<span><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
552 552
 					<select id="give-graphs-month-end" name="m_end">
553
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
554
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
553
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
554
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option>
555 555
 						<?php endfor; ?>
556 556
 					</select>
557 557
 					<select id="give-graphs-day-end" name="day_end">
558
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
559
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option>
558
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
559
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option>
560 560
 						<?php endfor; ?>
561 561
 					</select>
562 562
 					<select id="give-graphs-year-end" name="year_end">
563
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
564
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option>
563
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
564
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option>
565 565
 						<?php endfor; ?>
566 566
 					</select>
567 567
 				</div>
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 *
577 577
 	 * @since 1.0
578 578
 	 */
579
-	do_action( 'give_report_graph_controls_after' );
579
+	do_action('give_report_graph_controls_after');
580 580
 }
581 581
 
582 582
 /**
@@ -591,65 +591,65 @@  discard block
 block discarded – undo
591 591
 function give_get_report_dates() {
592 592
 	$dates = array();
593 593
 
594
-	$current_time = current_time( 'timestamp' );
594
+	$current_time = current_time('timestamp');
595 595
 
596
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
597
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
598
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
599
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
600
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
601
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
602
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
596
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
597
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
598
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
599
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
600
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
601
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
602
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
603 603
 
604 604
 	// Modify dates based on predefined ranges
605
-	switch ( $dates['range'] ) :
605
+	switch ($dates['range']) :
606 606
 
607 607
 		case 'this_month' :
608
-			$dates['m_start']  = date( 'n', $current_time );
609
-			$dates['m_end']    = date( 'n', $current_time );
608
+			$dates['m_start']  = date('n', $current_time);
609
+			$dates['m_end']    = date('n', $current_time);
610 610
 			$dates['day']      = 1;
611
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
612
-			$dates['year']     = date( 'Y' );
613
-			$dates['year_end'] = date( 'Y' );
611
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
612
+			$dates['year']     = date('Y');
613
+			$dates['year_end'] = date('Y');
614 614
 			break;
615 615
 
616 616
 		case 'last_month' :
617
-			if ( date( 'n' ) == 1 ) {
617
+			if (date('n') == 1) {
618 618
 				$dates['m_start']  = 12;
619 619
 				$dates['m_end']    = 12;
620
-				$dates['year']     = date( 'Y', $current_time ) - 1;
621
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
620
+				$dates['year']     = date('Y', $current_time) - 1;
621
+				$dates['year_end'] = date('Y', $current_time) - 1;
622 622
 			} else {
623
-				$dates['m_start']  = date( 'n' ) - 1;
624
-				$dates['m_end']    = date( 'n' ) - 1;
623
+				$dates['m_start']  = date('n') - 1;
624
+				$dates['m_end']    = date('n') - 1;
625 625
 				$dates['year_end'] = $dates['year'];
626 626
 			}
627
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
627
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
628 628
 			break;
629 629
 
630 630
 		case 'today' :
631
-			$dates['day']     = date( 'd', $current_time );
632
-			$dates['m_start'] = date( 'n', $current_time );
633
-			$dates['m_end']   = date( 'n', $current_time );
634
-			$dates['year']    = date( 'Y', $current_time );
631
+			$dates['day']     = date('d', $current_time);
632
+			$dates['m_start'] = date('n', $current_time);
633
+			$dates['m_end']   = date('n', $current_time);
634
+			$dates['year']    = date('Y', $current_time);
635 635
 			break;
636 636
 
637 637
 		case 'yesterday' :
638 638
 
639
-			$year  = date( 'Y', $current_time );
640
-			$month = date( 'n', $current_time );
641
-			$day   = date( 'd', $current_time );
639
+			$year  = date('Y', $current_time);
640
+			$month = date('n', $current_time);
641
+			$day   = date('d', $current_time);
642 642
 
643
-			if ( $month == 1 && $day == 1 ) {
643
+			if ($month == 1 && $day == 1) {
644 644
 
645 645
 				$year -= 1;
646 646
 				$month = 12;
647
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
647
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
648 648
 
649
-			} elseif ( $month > 1 && $day == 1 ) {
649
+			} elseif ($month > 1 && $day == 1) {
650 650
 
651 651
 				$month -= 1;
652
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
652
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
653 653
 
654 654
 			} else {
655 655
 
@@ -665,91 +665,91 @@  discard block
 block discarded – undo
665 665
 			break;
666 666
 
667 667
 		case 'this_week' :
668
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
669
-			$dates['day'] += get_option( 'start_of_week' );
668
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
669
+			$dates['day'] += get_option('start_of_week');
670 670
 			$dates['day_end'] = $dates['day'] + 6;
671
-			$dates['m_start'] = date( 'n', $current_time );
672
-			$dates['m_end']   = date( 'n', $current_time );
673
-			$dates['year']    = date( 'Y', $current_time );
671
+			$dates['m_start'] = date('n', $current_time);
672
+			$dates['m_end']   = date('n', $current_time);
673
+			$dates['year']    = date('Y', $current_time);
674 674
 			break;
675 675
 
676 676
 		case 'last_week' :
677
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
678
-			$dates['day'] += get_option( 'start_of_week' );
677
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
678
+			$dates['day'] += get_option('start_of_week');
679 679
 			$dates['day_end'] = $dates['day'] + 6;
680
-			$dates['year']    = date( 'Y' );
681
-
682
-			if ( date( 'j', $current_time ) <= 7 ) {
683
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
684
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
685
-				if ( $dates['m_start'] <= 1 ) {
686
-					$dates['year']     = date( 'Y', $current_time ) - 1;
687
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
680
+			$dates['year']    = date('Y');
681
+
682
+			if (date('j', $current_time) <= 7) {
683
+				$dates['m_start'] = date('n', $current_time) - 1;
684
+				$dates['m_end']   = date('n', $current_time) - 1;
685
+				if ($dates['m_start'] <= 1) {
686
+					$dates['year']     = date('Y', $current_time) - 1;
687
+					$dates['year_end'] = date('Y', $current_time) - 1;
688 688
 				}
689 689
 			} else {
690
-				$dates['m_start'] = date( 'n', $current_time );
691
-				$dates['m_end']   = date( 'n', $current_time );
690
+				$dates['m_start'] = date('n', $current_time);
691
+				$dates['m_end']   = date('n', $current_time);
692 692
 			}
693 693
 			break;
694 694
 
695 695
 		case 'this_quarter' :
696
-			$month_now = date( 'n', $current_time );
696
+			$month_now = date('n', $current_time);
697 697
 
698
-			if ( $month_now <= 3 ) {
698
+			if ($month_now <= 3) {
699 699
 
700 700
 				$dates['m_start'] = 1;
701 701
 				$dates['m_end']   = 4;
702
-				$dates['year']    = date( 'Y', $current_time );
702
+				$dates['year']    = date('Y', $current_time);
703 703
 
704
-			} else if ( $month_now <= 6 ) {
704
+			} else if ($month_now <= 6) {
705 705
 
706 706
 				$dates['m_start'] = 4;
707 707
 				$dates['m_end']   = 7;
708
-				$dates['year']    = date( 'Y', $current_time );
708
+				$dates['year']    = date('Y', $current_time);
709 709
 
710
-			} else if ( $month_now <= 9 ) {
710
+			} else if ($month_now <= 9) {
711 711
 
712 712
 				$dates['m_start'] = 7;
713 713
 				$dates['m_end']   = 10;
714
-				$dates['year']    = date( 'Y', $current_time );
714
+				$dates['year']    = date('Y', $current_time);
715 715
 
716 716
 			} else {
717 717
 
718 718
 				$dates['m_start']  = 10;
719 719
 				$dates['m_end']    = 1;
720
-				$dates['year']     = date( 'Y', $current_time );
721
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
720
+				$dates['year']     = date('Y', $current_time);
721
+				$dates['year_end'] = date('Y', $current_time) + 1;
722 722
 
723 723
 			}
724 724
 			break;
725 725
 
726 726
 		case 'last_quarter' :
727
-			$month_now = date( 'n' );
727
+			$month_now = date('n');
728 728
 
729
-			if ( $month_now <= 3 ) {
729
+			if ($month_now <= 3) {
730 730
 
731 731
 				$dates['m_start']  = 10;
732 732
 				$dates['m_end']    = 12;
733
-				$dates['year']     = date( 'Y', $current_time ) - 1; // Previous year
734
-				$dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year
733
+				$dates['year']     = date('Y', $current_time) - 1; // Previous year
734
+				$dates['year_end'] = date('Y', $current_time) - 1; // Previous year
735 735
 
736
-			} else if ( $month_now <= 6 ) {
736
+			} else if ($month_now <= 6) {
737 737
 
738 738
 				$dates['m_start'] = 1;
739 739
 				$dates['m_end']   = 3;
740
-				$dates['year']    = date( 'Y', $current_time );
740
+				$dates['year']    = date('Y', $current_time);
741 741
 
742
-			} else if ( $month_now <= 9 ) {
742
+			} else if ($month_now <= 9) {
743 743
 
744 744
 				$dates['m_start'] = 4;
745 745
 				$dates['m_end']   = 6;
746
-				$dates['year']    = date( 'Y', $current_time );
746
+				$dates['year']    = date('Y', $current_time);
747 747
 
748 748
 			} else {
749 749
 
750 750
 				$dates['m_start'] = 7;
751 751
 				$dates['m_end']   = 9;
752
-				$dates['year']    = date( 'Y', $current_time );
752
+				$dates['year']    = date('Y', $current_time);
753 753
 
754 754
 			}
755 755
 			break;
@@ -757,19 +757,19 @@  discard block
 block discarded – undo
757 757
 		case 'this_year' :
758 758
 			$dates['m_start'] = 1;
759 759
 			$dates['m_end']   = 12;
760
-			$dates['year']    = date( 'Y', $current_time );
760
+			$dates['year']    = date('Y', $current_time);
761 761
 			break;
762 762
 
763 763
 		case 'last_year' :
764 764
 			$dates['m_start']  = 1;
765 765
 			$dates['m_end']    = 12;
766
-			$dates['year']     = date( 'Y', $current_time ) - 1;
767
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
766
+			$dates['year']     = date('Y', $current_time) - 1;
767
+			$dates['year_end'] = date('Y', $current_time) - 1;
768 768
 			break;
769 769
 
770 770
 	endswitch;
771 771
 
772
-	return apply_filters( 'give_report_dates', $dates );
772
+	return apply_filters('give_report_dates', $dates);
773 773
 }
774 774
 
775 775
 /**
@@ -779,17 +779,17 @@  discard block
 block discarded – undo
779 779
  *
780 780
  * @param $data
781 781
  */
782
-function give_parse_report_dates( $data ) {
782
+function give_parse_report_dates($data) {
783 783
 	$dates = give_get_report_dates();
784 784
 
785 785
 	$view = give_get_reporting_view();
786
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
786
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
787 787
 
788
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
788
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id))));
789 789
 	give_die();
790 790
 }
791 791
 
792
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
792
+add_action('give_filter_reports', 'give_parse_report_dates');
793 793
 
794 794
 
795 795
 /**
@@ -801,16 +801,16 @@  discard block
 block discarded – undo
801 801
  */
802 802
 function give_reports_refresh_button() {
803 803
 
804
-	$url = wp_nonce_url( add_query_arg( array(
804
+	$url = wp_nonce_url(add_query_arg(array(
805 805
 		'give_action'  => 'refresh_reports_transients',
806 806
 		'give-message' => 'refreshed-reports'
807
-	) ), 'give-refresh-reports' );
807
+	)), 'give-refresh-reports');
808 808
 
809
-	echo '<a href="' . $url . '" data-tooltip="' . esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . esc_html__( 'Refresh Reports', 'give' ) . '</a>';
809
+	echo '<a href="'.$url.'" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.esc_html__('Refresh Reports', 'give').'</a>';
810 810
 
811 811
 }
812 812
 
813
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
813
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
814 814
 
815 815
 /**
816 816
  * Trigger the refresh of reports transients
@@ -821,18 +821,18 @@  discard block
 block discarded – undo
821 821
  *
822 822
  * @return void
823 823
  */
824
-function give_run_refresh_reports_transients( $data ) {
824
+function give_run_refresh_reports_transients($data) {
825 825
 
826
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
826
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
827 827
 		return;
828 828
 	}
829 829
 
830 830
 	//Delete transients
831
-	delete_transient( 'give_estimated_monthly_stats' );
832
-	delete_transient( 'give_earnings_total' );
833
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
834
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
831
+	delete_transient('give_estimated_monthly_stats');
832
+	delete_transient('give_earnings_total');
833
+	delete_transient(md5('give_earnings_this_monththis_month'));
834
+	delete_transient(md5('give_earnings_todaytoday'));
835 835
 
836 836
 }
837 837
 
838
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
839 838
\ No newline at end of file
839
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
840 840
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/class-export.php 1 patch
Spacing   +27 added lines, -27 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
 	/**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 * @return void
49 49
 	 */
50 50
 	public function headers() {
51
-		ignore_user_abort( true );
51
+		ignore_user_abort(true);
52 52
 
53
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
54
-			set_time_limit( 0 );
53
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
54
+			set_time_limit(0);
55 55
 		}
56 56
 
57 57
 		nocache_headers();
58
-		header( 'Content-Type: text/csv; charset=utf-8' );
59
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
60
-		header( "Expires: 0" );
58
+		header('Content-Type: text/csv; charset=utf-8');
59
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
60
+		header("Expires: 0");
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function csv_cols() {
71 71
 		$cols = array(
72
-			'id'   => esc_html__( 'ID', 'give' ),
73
-			'date' => esc_html__( 'Date', 'give' )
72
+			'id'   => esc_html__('ID', 'give'),
73
+			'date' => esc_html__('Date', 'give')
74 74
 		);
75 75
 
76 76
 		return $cols;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function get_csv_cols() {
87 87
 		$cols = $this->csv_cols();
88 88
 
89
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
89
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	public function csv_cols_out() {
101 101
 		$cols = $this->get_csv_cols();
102 102
 		$i    = 1;
103
-		foreach ( $cols as $col_id => $column ) {
104
-			echo '"' . addslashes( $column ) . '"';
105
-			echo $i == count( $cols ) ? '' : ',';
106
-			$i ++;
103
+		foreach ($cols as $col_id => $column) {
104
+			echo '"'.addslashes($column).'"';
105
+			echo $i == count($cols) ? '' : ',';
106
+			$i++;
107 107
 		}
108 108
 		echo "\r\n";
109 109
 	}
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 		$data = array(
121 121
 			0 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			),
125 125
 			1 => array(
126 126
 				'id'   => '',
127
-				'data' => date( 'F j, Y' )
127
+				'data' => date('F j, Y')
128 128
 			)
129 129
 		);
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		$cols = $this->get_csv_cols();
148 148
 
149 149
 		// Output each row
150
-		foreach ( $data as $row ) {
150
+		foreach ($data as $row) {
151 151
 			$i = 1;
152
-			foreach ( $row as $col_id => $column ) {
152
+			foreach ($row as $col_id => $column) {
153 153
 				// Make sure the column is valid
154
-				if ( array_key_exists( $col_id, $cols ) ) {
155
-					echo '"' . addslashes( $column ) . '"';
156
-					echo $i == count( $cols ) ? '' : ',';
157
-					$i ++;
154
+				if (array_key_exists($col_id, $cols)) {
155
+					echo '"'.addslashes($column).'"';
156
+					echo $i == count($cols) ? '' : ',';
157
+					$i++;
158 158
 				}
159 159
 			}
160 160
 			echo "\r\n";
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function export() {
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50 50
 			'ajax'     => false                        // Does this table support ajax?.
51
-		) );
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id;
71
+				return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id;
72 72
 			case 'gateway' :
73
-				return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway;
73
+				return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway;
74 74
 			case 'error' :
75
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
75
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) { ?>
92
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a>
91
+	public function column_message($item) { ?>
92
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a>
93 93
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
94 94
 			<?php
95 95
 
96
-			$log_message = get_post_field( 'post_content', $item['ID'] );
96
+			$log_message = get_post_field('post_content', $item['ID']);
97 97
 
98
-			$serialized = strpos( $log_message, '{"' );
98
+			$serialized = strpos($log_message, '{"');
99 99
 
100 100
 			// Check to see if the log message contains serialized information
101
-			if ( $serialized !== false ) {
102
-				$length = strlen( $log_message ) - $serialized;
103
-				$intro  = substr( $log_message, 0, - $length );
104
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
101
+			if ($serialized !== false) {
102
+				$length = strlen($log_message) - $serialized;
103
+				$intro  = substr($log_message, 0, - $length);
104
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
105 105
 
106
-				echo wpautop( $intro );
107
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
108
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
106
+				echo wpautop($intro);
107
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
108
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
109 109
 			} else {
110 110
 				// No serialized data found
111
-				echo wpautop( $log_message );
111
+				echo wpautop($log_message);
112 112
 			}
113 113
 			?>
114 114
 		</div>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get_columns() {
126 126
 		$columns = array(
127
-			'ID'         => esc_html__( 'Log ID', 'give' ),
128
-			'error'      => esc_html__( 'Error', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
131
-			'date'       => esc_html__( 'Date', 'give' ),
132
-			'message'    => esc_html__( 'Details', 'give' )
127
+			'ID'         => esc_html__('Log ID', 'give'),
128
+			'error'      => esc_html__('Error', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'payment_id' => esc_html__('Donation ID', 'give'),
131
+			'date'       => esc_html__('Date', 'give'),
132
+			'message'    => esc_html__('Details', 'give')
133 133
 		);
134 134
 
135 135
 		return $columns;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return int Current page number
144 144
 	 */
145 145
 	public function get_paged() {
146
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
146
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @since  1.0
154 154
 	 * @return void
155 155
 	 */
156
-	public function bulk_actions( $which = '' ) {
156
+	public function bulk_actions($which = '') {
157 157
 		give_log_views();
158 158
 	}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		// Prevent the queries from getting cached.
173 173
 		// Without this there are occasional memory issues for some installs.
174
-		wp_suspend_cache_addition( true );
174
+		wp_suspend_cache_addition(true);
175 175
 
176 176
 		$logs_data = array();
177 177
 		$paged     = $this->get_paged();
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			'paged'    => $paged
181 181
 		);
182 182
 
183
-		$logs = $give_logs->get_connected_logs( $log_query );
183
+		$logs = $give_logs->get_connected_logs($log_query);
184 184
 
185
-		if ( $logs ) {
186
-			foreach ( $logs as $log ) {
185
+		if ($logs) {
186
+			foreach ($logs as $log) {
187 187
 
188 188
 				$logs_data[] = array(
189 189
 					'ID'         => $log->ID,
190
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
190
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
191 191
 					'payment_id' => $log->post_parent,
192 192
 					'error'      => 'error',
193
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
193
+					'gateway'    => give_get_payment_gateway($log->post_parent),
194 194
 					'date'       => $log->post_date
195 195
 				);
196 196
 			}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $which
214 214
 	 */
215
-	protected function display_tablenav( $which ) {
216
-		if ( 'top' === $which ) {
217
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
215
+	protected function display_tablenav($which) {
216
+		if ('top' === $which) {
217
+			wp_nonce_field('bulk-'.$this->_args['plural']);
218 218
 		}
219 219
 		?>
220
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
220
+		<div class="tablenav <?php echo esc_attr($which); ?>">
221 221
 
222 222
 			<div class="alignleft actions bulkactions">
223
-				<?php $this->bulk_actions( $which ); ?>
223
+				<?php $this->bulk_actions($which); ?>
224 224
 			</div>
225 225
 			<?php
226
-			$this->extra_tablenav( $which );
227
-			$this->pagination( $which );
226
+			$this->extra_tablenav($which);
227
+			$this->pagination($which);
228 228
 			?>
229 229
 
230 230
 			<br class="clear"/>
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 		$columns               = $this->get_columns();
252 252
 		$hidden                = array(); // No hidden columns
253 253
 		$sortable              = $this->get_sortable_columns();
254
-		$this->_column_headers = array( $columns, $hidden, $sortable );
254
+		$this->_column_headers = array($columns, $hidden, $sortable);
255 255
 		$this->items           = $this->get_logs();
256
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
256
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
257 257
 
258
-		$this->set_pagination_args( array(
258
+		$this->set_pagination_args(array(
259 259
 				'total_items' => $total_items,
260 260
 				'per_page'    => $this->per_page,
261
-				'total_pages' => ceil( $total_items / $this->per_page )
261
+				'total_pages' => ceil($total_items / $this->per_page)
262 262
 			)
263 263
 		);
264 264
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-donor-reports-table.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
65
+		parent::__construct(array(
66
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
68 68
 			'ajax'     => false                        // Does this table support ajax?
69
-		) );
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search" role="search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,29 +124,29 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' == $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' == $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donors Report', 'give' ); ?></span></h3>
135
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donors Report', 'give'); ?></span></h3>
136 136
 
137 137
 			<div class="alignright tablenav-right">
138 138
 				<div class="actions bulkactions">
139 139
 					<?php
140
-					if ( 'top' == $which ) {
141
-						$this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' );
140
+					if ('top' == $which) {
141
+						$this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search');
142 142
 					}
143 143
 
144
-					$this->bulk_actions( $which ); ?>
144
+					$this->bulk_actions($which); ?>
145 145
 
146 146
 				</div>
147 147
 				<?php
148
-				$this->extra_tablenav( $which );
149
-				$this->pagination( $which );
148
+				$this->extra_tablenav($which);
149
+				$this->pagination($which);
150 150
 				?>
151 151
 			</div>
152 152
 
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Column Name
170 170
 	 */
171
-	public function column_default( $item, $column_name ) {
172
-		switch ( $column_name ) {
171
+	public function column_default($item, $column_name) {
172
+		switch ($column_name) {
173 173
 
174 174
 			case 'num_purchases' :
175
-				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
175
+				$value = '<a href="'.
176
+				         admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
177
+				         ).'">'.esc_html($item['num_purchases']).'</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
181
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
181
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
182 182
 				break;
183 183
 
184 184
 			default:
185
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
185
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
186 186
 				break;
187 187
 		}
188 188
 
189
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
189
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function get_columns() {
200 200
 		$columns = array(
201
-			'name'          => esc_html__( 'Name', 'give' ),
202
-			'id'            => esc_html__( 'ID', 'give' ),
203
-			'email'         => esc_html__( 'Email', 'give' ),
204
-			'num_purchases' => esc_html__( 'Purchases', 'give' ),
205
-			'amount_spent'  => esc_html__( 'Total Spent', 'give' )
201
+			'name'          => esc_html__('Name', 'give'),
202
+			'id'            => esc_html__('ID', 'give'),
203
+			'email'         => esc_html__('Email', 'give'),
204
+			'num_purchases' => esc_html__('Purchases', 'give'),
205
+			'amount_spent'  => esc_html__('Total Spent', 'give')
206 206
 		);
207 207
 
208
-		return apply_filters( 'give_report_donor_columns', $columns );
208
+		return apply_filters('give_report_donor_columns', $columns);
209 209
 
210 210
 	}
211 211
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	public function get_sortable_columns() {
220 220
 		return array(
221
-			'id'            => array( 'id', true ),
222
-			'name'          => array( 'name', true ),
223
-			'num_purchases' => array( 'purchase_count', false ),
224
-			'amount_spent'  => array( 'purchase_value', false ),
221
+			'id'            => array('id', true),
222
+			'name'          => array('name', true),
223
+			'num_purchases' => array('purchase_count', false),
224
+			'amount_spent'  => array('purchase_value', false),
225 225
 		);
226 226
 	}
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @return void
234 234
 	 */
235
-	public function bulk_actions( $which = '' ) {
235
+	public function bulk_actions($which = '') {
236 236
 		// These aren't really bulk actions but this outputs the markup in the right place
237 237
 		give_report_views();
238 238
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		}
293 293
 
294
-		$donors = Give()->customers->get_customers( $args );
294
+		$donors = Give()->customers->get_customers($args);
295 295
 
296
-		if ( $donors ) {
296
+		if ($donors) {
297 297
 
298
-			$this->count = count( $donors );
298
+			$this->count = count($donors);
299 299
 
300
-			foreach ( $donors as $donor ) {
300
+			foreach ($donors as $donor) {
301 301
 
302
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
302
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $donor->id,
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 		$hidden   = array(); // No hidden columns
333 333
 		$sortable = $this->get_sortable_columns();
334 334
 
335
-		$this->_column_headers = array( $columns, $hidden, $sortable );
335
+		$this->_column_headers = array($columns, $hidden, $sortable);
336 336
 
337 337
 		$this->items = $this->reports_data();
338 338
 
339 339
 		$this->total = give_count_total_customers();
340 340
 
341
-		$this->set_pagination_args( array(
341
+		$this->set_pagination_args(array(
342 342
 			'total_items' => $this->total,
343 343
 			'per_page'    => $this->per_page,
344
-			'total_pages' => ceil( $this->total / $this->per_page )
345
-		) );
344
+			'total_pages' => ceil($this->total / $this->per_page)
345
+		));
346 346
 	}
347 347
 }
348 348
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php 1 patch
Spacing   +37 added lines, -37 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
 
@@ -56,32 +56,32 @@  discard block
 block discarded – undo
56 56
 
57 57
 		$args = array(
58 58
 			'number'  => $this->per_step,
59
-			'offset'  => $this->per_step * ( $this->step - 1 ),
59
+			'offset'  => $this->per_step * ($this->step - 1),
60 60
 			'orderby' => 'id',
61 61
 			'order'   => 'DESC',
62 62
 		);
63 63
 
64
-		$customers = Give()->customers->get_customers( $args );
64
+		$customers = Give()->customers->get_customers($args);
65 65
 
66
-		if ( $customers ) {
66
+		if ($customers) {
67 67
 
68
-			$allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() );
68
+			$allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys());
69 69
 
70
-			foreach ( $customers as $customer ) {
70
+			foreach ($customers as $customer) {
71 71
 
72
-				$attached_payment_ids = explode( ',', $customer->payment_ids );
72
+				$attached_payment_ids = explode(',', $customer->payment_ids);
73 73
 
74 74
 				$attached_args = array(
75 75
 					'post__in' => $attached_payment_ids,
76
-					'number'   => - 1,
76
+					'number'   => -1,
77 77
 					'status'   => $allowed_payment_status,
78 78
 				);
79 79
 
80
-				$attached_payments = (array) give_get_payments( $attached_args );
80
+				$attached_payments = (array) give_get_payments($attached_args);
81 81
 
82 82
 				$unattached_args = array(
83 83
 					'post__not_in' => $attached_payment_ids,
84
-					'number'       => - 1,
84
+					'number'       => -1,
85 85
 					'status'       => $allowed_payment_status,
86 86
 					'meta_query'   => array(
87 87
 						array(
@@ -92,29 +92,29 @@  discard block
 block discarded – undo
92 92
 					),
93 93
 				);
94 94
 
95
-				$unattached_payments = give_get_payments( $unattached_args );
95
+				$unattached_payments = give_get_payments($unattached_args);
96 96
 
97
-				$payments = array_merge( $attached_payments, $unattached_payments );
97
+				$payments = array_merge($attached_payments, $unattached_payments);
98 98
 
99 99
 				$purchase_value = 0.00;
100 100
 				$purchase_count = 0;
101 101
 				$payment_ids    = array();
102 102
 
103
-				if ( $payments ) {
103
+				if ($payments) {
104 104
 
105
-					foreach ( $payments as $payment ) {
105
+					foreach ($payments as $payment) {
106 106
 
107 107
 						$should_process_payment = 'publish' == $payment->post_status ? true : false;
108
-						$should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment );
108
+						$should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment);
109 109
 
110
-						if ( true === $should_process_payment ) {
110
+						if (true === $should_process_payment) {
111 111
 
112
-							if ( apply_filters( 'give_customer_recount_should_increase_value', true, $payment ) ) {
113
-								$purchase_value += give_get_payment_amount( $payment->ID );
112
+							if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) {
113
+								$purchase_value += give_get_payment_amount($payment->ID);
114 114
 							}
115 115
 
116
-							if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
117
-								$purchase_count ++;
116
+							if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
117
+								$purchase_count++;
118 118
 							}
119 119
 
120 120
 						}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 				}
126 126
 
127
-				$payment_ids = implode( ',', $payment_ids );
127
+				$payment_ids = implode(',', $payment_ids);
128 128
 
129 129
 				$customer_update_data = array(
130 130
 					'purchase_count' => $purchase_count,
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 					'payment_ids'    => $payment_ids,
133 133
 				);
134 134
 
135
-				$customer_instance = new Give_Customer( $customer->id );
136
-				$customer_instance->update( $customer_update_data );
135
+				$customer_instance = new Give_Customer($customer->id);
136
+				$customer_instance->update($customer_update_data);
137 137
 
138 138
 			}
139 139
 
@@ -153,21 +153,21 @@  discard block
 block discarded – undo
153 153
 	public function get_percentage_complete() {
154 154
 
155 155
 		$args = array(
156
-			'number'  => - 1,
156
+			'number'  => -1,
157 157
 			'orderby' => 'id',
158 158
 			'order'   => 'DESC',
159 159
 		);
160 160
 
161
-		$customers = Give()->customers->get_customers( $args );
162
-		$total     = count( $customers );
161
+		$customers = Give()->customers->get_customers($args);
162
+		$total     = count($customers);
163 163
 
164 164
 		$percentage = 100;
165 165
 
166
-		if ( $total > 0 ) {
167
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
166
+		if ($total > 0) {
167
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
168 168
 		}
169 169
 
170
-		if ( $percentage > 100 ) {
170
+		if ($percentage > 100) {
171 171
 			$percentage = 100;
172 172
 		}
173 173
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @param array $request The Form Data passed into the batch processing
183 183
 	 */
184
-	public function set_properties( $request ) {
184
+	public function set_properties($request) {
185 185
 	}
186 186
 
187 187
 	/**
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function process_step() {
194 194
 
195
-		if ( ! $this->can_export() ) {
196
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
195
+		if ( ! $this->can_export()) {
196
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
197 197
 		}
198 198
 
199 199
 		$had_data = $this->get_data();
200 200
 
201
-		if ( $had_data ) {
201
+		if ($had_data) {
202 202
 			$this->done = false;
203 203
 
204 204
 			return true;
205 205
 		} else {
206 206
 			$this->done    = true;
207
-			$this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' );
207
+			$this->message = esc_html__('Donor stats have been successfully recounted.', 'give');
208 208
 
209 209
 			return false;
210 210
 		}
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * Headers
215 215
 	 */
216 216
 	public function headers() {
217
-		ignore_user_abort( true );
217
+		ignore_user_abort(true);
218 218
 
219
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-			set_time_limit( 0 );
219
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+			set_time_limit(0);
221 221
 		}
222 222
 	}
223 223
 
Please login to merge, or discard this patch.