Test Failed
Push — master ( 21ce85...fda949 )
by Devin
06:42
created
includes/admin/EDD_SL_Plugin_Updater.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
 	 * @uses api_request()
119 119
 	 *
120 120
 	 * @param array $_transient_data Update array build by WordPress.
121
-	 * @return array Modified update array with custom plugin data.
121
+	 * @return stdClass Modified update array with custom plugin data.
122 122
 	 */
123 123
 	public function check_update( $_transient_data ) {
124 124
 
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined('ABSPATH')) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -33,48 +33,48 @@  discard block
 block discarded – undo
33 33
 	 * @param string $_plugin_file Path to the plugin file.
34 34
 	 * @param array  $_api_data    Optional data to send with API calls.
35 35
 	 */
36
-	public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
36
+	public function __construct($_api_url, $_plugin_file, $_api_data = null) {
37 37
 
38 38
 		global $edd_plugin_data, $edd_plugin_url_available;
39 39
 
40
-		$this->api_url = trailingslashit( $_api_url );
40
+		$this->api_url = trailingslashit($_api_url);
41 41
 
42 42
 		// Do a quick status check on this domain if we haven't already checked it.
43
-		$store_hash = md5( $this->api_url );
44
-		if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
45
-			$test_url_parts = parse_url( $this->api_url );
43
+		$store_hash = md5($this->api_url);
44
+		if ( ! is_array($edd_plugin_url_available) || ! isset($edd_plugin_url_available[$store_hash])) {
45
+			$test_url_parts = parse_url($this->api_url);
46 46
 
47
-			$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
48
-			$host   = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
49
-			$port   = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
47
+			$scheme = ! empty($test_url_parts['scheme']) ? $test_url_parts['scheme'] : 'http';
48
+			$host   = ! empty($test_url_parts['host']) ? $test_url_parts['host'] : '';
49
+			$port   = ! empty($test_url_parts['port']) ? ':'.$test_url_parts['port'] : '';
50 50
 
51
-			if ( empty( $host ) ) {
52
-				$edd_plugin_url_available[ $store_hash ] = false;
51
+			if (empty($host)) {
52
+				$edd_plugin_url_available[$store_hash] = false;
53 53
 			} else {
54
-				$test_url                                = $scheme . '://' . $host . $port;
54
+				$test_url                                = $scheme.'://'.$host.$port;
55 55
 				$response                                = wp_remote_get(
56 56
 					$test_url, array(
57 57
 						'timeout'   => $this->health_check_timeout,
58 58
 						'sslverify' => true,
59 59
 					)
60 60
 				);
61
-				$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
61
+				$edd_plugin_url_available[$store_hash] = is_wp_error($response) ? false : true;
62 62
 			}
63 63
 		}
64 64
 
65
-		if ( false === $edd_plugin_url_available[ $store_hash ] ) {
65
+		if (false === $edd_plugin_url_available[$store_hash]) {
66 66
 			return;
67 67
 		}
68 68
 
69 69
 		$this->api_data    = $_api_data;
70
-		$this->name        = plugin_basename( $_plugin_file );
71
-		$this->slug        = basename( $_plugin_file, '.php' );
70
+		$this->name        = plugin_basename($_plugin_file);
71
+		$this->slug        = basename($_plugin_file, '.php');
72 72
 		$this->version     = $_api_data['version'];
73
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
74
-		$this->beta        = ! empty( $this->api_data['beta'] ) ? true : false;
75
-		$this->cache_key   = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
73
+		$this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false;
74
+		$this->beta        = ! empty($this->api_data['beta']) ? true : false;
75
+		$this->cache_key   = 'edd_sl_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta));
76 76
 
77
-		$edd_plugin_data[ $this->slug ] = $this->api_data;
77
+		$edd_plugin_data[$this->slug] = $this->api_data;
78 78
 
79 79
 		/**
80 80
 		 * Fires after the $edd_plugin_data is setup.
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		 *
84 84
 		 * @param array $edd_plugin_data Array of EDD SL plugin data.
85 85
 		 */
86
-		do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
86
+		do_action('post_edd_sl_plugin_updater_setup', $edd_plugin_data);
87 87
 
88 88
 		// Set up hooks.
89 89
 		$this->init();
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function init() {
101 101
 
102
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
103
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
104
-		remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
105
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
106
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
102
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
103
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
104
+		remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10);
105
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
106
+		add_action('admin_init', array($this, 'show_changelog'));
107 107
 
108 108
 	}
109 109
 
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 	 * @param array $_transient_data Update array build by WordPress.
121 121
 	 * @return array Modified update array with custom plugin data.
122 122
 	 */
123
-	public function check_update( $_transient_data ) {
123
+	public function check_update($_transient_data) {
124 124
 
125 125
 		global $pagenow;
126 126
 
127
-		if ( ! is_object( $_transient_data ) ) {
127
+		if ( ! is_object($_transient_data)) {
128 128
 			$_transient_data = new stdClass();
129 129
 		}
130 130
 
131
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
131
+		if ('plugins.php' == $pagenow && is_multisite()) {
132 132
 			return $_transient_data;
133 133
 		}
134 134
 
135
-		if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
135
+		if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
136 136
 			return $_transient_data;
137 137
 		}
138 138
 
139 139
 		$version_info = $this->get_cached_version_info();
140 140
 
141
-		if ( false === $version_info ) {
141
+		if (false === $version_info) {
142 142
 			$version_info = $this->api_request(
143 143
 				'plugin_latest_version', array(
144 144
 					'slug' => $this->slug,
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 				)
147 147
 			);
148 148
 
149
-			$this->set_version_info_cache( $version_info );
149
+			$this->set_version_info_cache($version_info);
150 150
 
151 151
 		}
152 152
 
153
-		if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
153
+		if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
154 154
 
155
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
155
+			if (version_compare($this->version, $version_info->new_version, '<')) {
156 156
 
157
-				$_transient_data->response[ $this->name ] = $version_info;
157
+				$_transient_data->response[$this->name] = $version_info;
158 158
 
159 159
 			}
160 160
 
161 161
 			$_transient_data->last_checked           = time();
162
-			$_transient_data->checked[ $this->name ] = $this->version;
162
+			$_transient_data->checked[$this->name] = $this->version;
163 163
 
164 164
 		}
165 165
 
@@ -172,36 +172,36 @@  discard block
 block discarded – undo
172 172
 	 * @param string $file
173 173
 	 * @param array  $plugin
174 174
 	 */
175
-	public function show_update_notification( $file, $plugin ) {
175
+	public function show_update_notification($file, $plugin) {
176 176
 
177
-		if ( is_network_admin() ) {
177
+		if (is_network_admin()) {
178 178
 			return;
179 179
 		}
180 180
 
181
-		if ( ! current_user_can( 'update_plugins' ) ) {
181
+		if ( ! current_user_can('update_plugins')) {
182 182
 			return;
183 183
 		}
184 184
 
185
-		if ( ! is_multisite() ) {
185
+		if ( ! is_multisite()) {
186 186
 			return;
187 187
 		}
188 188
 
189
-		if ( $this->name != $file ) {
189
+		if ($this->name != $file) {
190 190
 			return;
191 191
 		}
192 192
 
193 193
 		// Remove our filter on the site transient
194
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
194
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
195 195
 
196
-		$update_cache = get_site_transient( 'update_plugins' );
196
+		$update_cache = get_site_transient('update_plugins');
197 197
 
198
-		$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
198
+		$update_cache = is_object($update_cache) ? $update_cache : new stdClass();
199 199
 
200
-		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
200
+		if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
201 201
 
202 202
 			$version_info = $this->get_cached_version_info();
203 203
 
204
-			if ( false === $version_info ) {
204
+			if (false === $version_info) {
205 205
 				$version_info = $this->api_request(
206 206
 					'plugin_latest_version', array(
207 207
 						'slug' => $this->slug,
@@ -209,65 +209,65 @@  discard block
 block discarded – undo
209 209
 					)
210 210
 				);
211 211
 
212
-				$this->set_version_info_cache( $version_info );
212
+				$this->set_version_info_cache($version_info);
213 213
 			}
214 214
 
215
-			if ( ! is_object( $version_info ) ) {
215
+			if ( ! is_object($version_info)) {
216 216
 				return;
217 217
 			}
218 218
 
219
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
219
+			if (version_compare($this->version, $version_info->new_version, '<')) {
220 220
 
221
-				$update_cache->response[ $this->name ] = $version_info;
221
+				$update_cache->response[$this->name] = $version_info;
222 222
 
223 223
 			}
224 224
 
225 225
 			$update_cache->last_checked           = time();
226
-			$update_cache->checked[ $this->name ] = $this->version;
226
+			$update_cache->checked[$this->name] = $this->version;
227 227
 
228
-			set_site_transient( 'update_plugins', $update_cache );
228
+			set_site_transient('update_plugins', $update_cache);
229 229
 
230 230
 		} else {
231 231
 
232
-			$version_info = $update_cache->response[ $this->name ];
232
+			$version_info = $update_cache->response[$this->name];
233 233
 
234 234
 		}
235 235
 
236 236
 		// Restore our filter
237
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
237
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
238 238
 
239
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
239
+		if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
240 240
 
241 241
 			// build a plugin list row, with update notification
242
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
242
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
243 243
 			// <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
244
-			echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
244
+			echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">';
245 245
 			echo '<td colspan="3" class="plugin-update colspanchange">';
246 246
 			echo '<div class="update-message notice inline notice-warning notice-alt">';
247 247
 
248
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
248
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
249 249
 
250
-			if ( empty( $version_info->download_link ) ) {
250
+			if (empty($version_info->download_link)) {
251 251
 				printf(
252
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ),
253
-					esc_html( $version_info->name ),
254
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
255
-					esc_html( $version_info->new_version ),
252
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'),
253
+					esc_html($version_info->name),
254
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
255
+					esc_html($version_info->new_version),
256 256
 					'</a>'
257 257
 				);
258 258
 			} else {
259 259
 				printf(
260
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ),
261
-					esc_html( $version_info->name ),
262
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
263
-					esc_html( $version_info->new_version ),
260
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'),
261
+					esc_html($version_info->name),
262
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
263
+					esc_html($version_info->new_version),
264 264
 					'</a>',
265
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">',
265
+					'<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">',
266 266
 					'</a>'
267 267
 				);
268 268
 			}
269 269
 
270
-			do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
270
+			do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
271 271
 
272 272
 			echo '</div></td></tr>';
273 273
 		}
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 	 * @param object $_args
284 284
 	 * @return object $_data
285 285
 	 */
286
-	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
286
+	public function plugins_api_filter($_data, $_action = '', $_args = null) {
287 287
 
288
-		if ( $_action != 'plugin_information' ) {
288
+		if ($_action != 'plugin_information') {
289 289
 
290 290
 			return $_data;
291 291
 
292 292
 		}
293 293
 
294
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
294
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
295 295
 
296 296
 			return $_data;
297 297
 
@@ -306,20 +306,20 @@  discard block
 block discarded – undo
306 306
 			),
307 307
 		);
308 308
 
309
-		$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
309
+		$cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta));
310 310
 
311 311
 		// Get the transient where we store the api request for this plugin for 24 hours
312
-		$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
312
+		$edd_api_request_transient = $this->get_cached_version_info($cache_key);
313 313
 
314 314
 		// If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
315
-		if ( empty( $edd_api_request_transient ) ) {
315
+		if (empty($edd_api_request_transient)) {
316 316
 
317
-			$api_response = $this->api_request( 'plugin_information', $to_send );
317
+			$api_response = $this->api_request('plugin_information', $to_send);
318 318
 
319 319
 			// Expires in 3 hours
320
-			$this->set_version_info_cache( $api_response, $cache_key );
320
+			$this->set_version_info_cache($api_response, $cache_key);
321 321
 
322
-			if ( false !== $api_response ) {
322
+			if (false !== $api_response) {
323 323
 				$_data = $api_response;
324 324
 			}
325 325
 		} else {
@@ -327,20 +327,20 @@  discard block
 block discarded – undo
327 327
 		}
328 328
 
329 329
 		// Convert sections into an associative array, since we're getting an object, but Core expects an array.
330
-		if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
330
+		if (isset($_data->sections) && ! is_array($_data->sections)) {
331 331
 			$new_sections = array();
332
-			foreach ( $_data->sections as $key => $value ) {
333
-				$new_sections[ $key ] = $value;
332
+			foreach ($_data->sections as $key => $value) {
333
+				$new_sections[$key] = $value;
334 334
 			}
335 335
 
336 336
 			$_data->sections = $new_sections;
337 337
 		}
338 338
 
339 339
 		// Convert banners into an associative array, since we're getting an object, but Core expects an array.
340
-		if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
340
+		if (isset($_data->banners) && ! is_array($_data->banners)) {
341 341
 			$new_banners = array();
342
-			foreach ( $_data->banners as $key => $value ) {
343
-				$new_banners[ $key ] = $value;
342
+			foreach ($_data->banners as $key => $value) {
343
+				$new_banners[$key] = $value;
344 344
 			}
345 345
 
346 346
 			$_data->banners = $new_banners;
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 	 * @param string $url
357 357
 	 * @return object $array
358 358
 	 */
359
-	public function http_request_args( $args, $url ) {
359
+	public function http_request_args($args, $url) {
360 360
 
361 361
 		$verify_ssl = $this->verify_ssl();
362
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
362
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
363 363
 			$args['sslverify'] = $verify_ssl;
364 364
 		}
365 365
 		return $args;
@@ -377,30 +377,30 @@  discard block
 block discarded – undo
377 377
 	 * @param array  $_data   Parameters for the API action.
378 378
 	 * @return false|object
379 379
 	 */
380
-	private function api_request( $_action, $_data ) {
380
+	private function api_request($_action, $_data) {
381 381
 
382 382
 		global $wp_version;
383 383
 
384
-		$data = array_merge( $this->api_data, $_data );
384
+		$data = array_merge($this->api_data, $_data);
385 385
 
386
-		if ( $data['slug'] != $this->slug ) {
386
+		if ($data['slug'] != $this->slug) {
387 387
 			return;
388 388
 		}
389 389
 
390
-		if ( $this->api_url == trailingslashit( home_url() ) ) {
390
+		if ($this->api_url == trailingslashit(home_url())) {
391 391
 			return false; // Don't allow a plugin to ping itself
392 392
 		}
393 393
 
394 394
 		$api_params = array(
395 395
 			'edd_action' => 'get_version',
396
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
397
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
398
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
399
-			'version'    => isset( $data['version'] ) ? $data['version'] : false,
396
+			'license'    => ! empty($data['license']) ? $data['license'] : '',
397
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
398
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
399
+			'version'    => isset($data['version']) ? $data['version'] : false,
400 400
 			'slug'       => $data['slug'],
401 401
 			'author'     => $data['author'],
402 402
 			'url'        => home_url(),
403
-			'beta'       => ! empty( $data['beta'] ),
403
+			'beta'       => ! empty($data['beta']),
404 404
 		);
405 405
 
406 406
 		$verify_ssl = $this->verify_ssl();
@@ -412,22 +412,22 @@  discard block
 block discarded – undo
412 412
 			)
413 413
 		);
414 414
 
415
-		if ( ! is_wp_error( $request ) ) {
416
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
415
+		if ( ! is_wp_error($request)) {
416
+			$request = json_decode(wp_remote_retrieve_body($request));
417 417
 		}
418 418
 
419
-		if ( $request && isset( $request->sections ) ) {
420
-			$request->sections = maybe_unserialize( $request->sections );
419
+		if ($request && isset($request->sections)) {
420
+			$request->sections = maybe_unserialize($request->sections);
421 421
 		} else {
422 422
 			$request = false;
423 423
 		}
424 424
 
425
-		if ( $request && isset( $request->banners ) ) {
426
-			$request->banners = maybe_unserialize( $request->banners );
425
+		if ($request && isset($request->banners)) {
426
+			$request->banners = maybe_unserialize($request->banners);
427 427
 		}
428 428
 
429
-		if ( ! empty( $request->sections ) ) {
430
-			foreach ( $request->sections as $key => $section ) {
429
+		if ( ! empty($request->sections)) {
430
+			foreach ($request->sections as $key => $section) {
431 431
 				$request->$key = (array) $section;
432 432
 			}
433 433
 		}
@@ -439,37 +439,37 @@  discard block
 block discarded – undo
439 439
 
440 440
 		global $edd_plugin_data;
441 441
 
442
-		if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
442
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
443 443
 			return;
444 444
 		}
445 445
 
446
-		if ( empty( $_REQUEST['plugin'] ) ) {
446
+		if (empty($_REQUEST['plugin'])) {
447 447
 			return;
448 448
 		}
449 449
 
450
-		if ( empty( $_REQUEST['slug'] ) ) {
450
+		if (empty($_REQUEST['slug'])) {
451 451
 			return;
452 452
 		}
453 453
 
454
-		if ( ! current_user_can( 'update_plugins' ) ) {
455
-			wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
454
+		if ( ! current_user_can('update_plugins')) {
455
+			wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403));
456 456
 		}
457 457
 
458
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
459
-		$beta         = ! empty( $data['beta'] ) ? true : false;
460
-		$cache_key    = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
461
-		$version_info = $this->get_cached_version_info( $cache_key );
458
+		$data         = $edd_plugin_data[$_REQUEST['slug']];
459
+		$beta         = ! empty($data['beta']) ? true : false;
460
+		$cache_key    = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info');
461
+		$version_info = $this->get_cached_version_info($cache_key);
462 462
 
463
-		if ( false === $version_info ) {
463
+		if (false === $version_info) {
464 464
 
465 465
 			$api_params = array(
466 466
 				'edd_action' => 'get_version',
467
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
468
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
467
+				'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
468
+				'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
469 469
 				'slug'       => $_REQUEST['slug'],
470 470
 				'author'     => $data['author'],
471 471
 				'url'        => home_url(),
472
-				'beta'       => ! empty( $data['beta'] ),
472
+				'beta'       => ! empty($data['beta']),
473 473
 			);
474 474
 
475 475
 			$verify_ssl = $this->verify_ssl();
@@ -481,61 +481,61 @@  discard block
 block discarded – undo
481 481
 				)
482 482
 			);
483 483
 
484
-			if ( ! is_wp_error( $request ) ) {
485
-				$version_info = json_decode( wp_remote_retrieve_body( $request ) );
484
+			if ( ! is_wp_error($request)) {
485
+				$version_info = json_decode(wp_remote_retrieve_body($request));
486 486
 			}
487 487
 
488
-			if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
489
-				$version_info->sections = maybe_unserialize( $version_info->sections );
488
+			if ( ! empty($version_info) && isset($version_info->sections)) {
489
+				$version_info->sections = maybe_unserialize($version_info->sections);
490 490
 			} else {
491 491
 				$version_info = false;
492 492
 			}
493 493
 
494
-			if ( ! empty( $version_info ) ) {
495
-				foreach ( $version_info->sections as $key => $section ) {
494
+			if ( ! empty($version_info)) {
495
+				foreach ($version_info->sections as $key => $section) {
496 496
 					$version_info->$key = (array) $section;
497 497
 				}
498 498
 			}
499 499
 
500
-			$this->set_version_info_cache( $version_info, $cache_key );
500
+			$this->set_version_info_cache($version_info, $cache_key);
501 501
 
502 502
 		}
503 503
 
504
-		if ( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
505
-			echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
504
+		if ( ! empty($version_info) && isset($version_info->sections['changelog'])) {
505
+			echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>';
506 506
 		}
507 507
 
508 508
 		exit;
509 509
 	}
510 510
 
511
-	public function get_cached_version_info( $cache_key = '' ) {
511
+	public function get_cached_version_info($cache_key = '') {
512 512
 
513
-		if ( empty( $cache_key ) ) {
513
+		if (empty($cache_key)) {
514 514
 			$cache_key = $this->cache_key;
515 515
 		}
516 516
 
517
-		$cache = get_option( $cache_key );
517
+		$cache = get_option($cache_key);
518 518
 
519
-		if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
519
+		if (empty($cache['timeout']) || time() > $cache['timeout']) {
520 520
 			return false; // Cache is expired
521 521
 		}
522 522
 
523
-		return json_decode( $cache['value'] );
523
+		return json_decode($cache['value']);
524 524
 
525 525
 	}
526 526
 
527
-	public function set_version_info_cache( $value = '', $cache_key = '' ) {
527
+	public function set_version_info_cache($value = '', $cache_key = '') {
528 528
 
529
-		if ( empty( $cache_key ) ) {
529
+		if (empty($cache_key)) {
530 530
 			$cache_key = $this->cache_key;
531 531
 		}
532 532
 
533 533
 		$data = array(
534
-			'timeout' => strtotime( '+3 hours', time() ),
535
-			'value'   => json_encode( $value ),
534
+			'timeout' => strtotime('+3 hours', time()),
535
+			'value'   => json_encode($value),
536 536
 		);
537 537
 
538
-		update_option( $cache_key, $data, 'no' );
538
+		update_option($cache_key, $data, 'no');
539 539
 
540 540
 	}
541 541
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	 * @return bool
547 547
 	 */
548 548
 	private function verify_ssl() {
549
-		return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
549
+		return (bool) apply_filters('edd_sl_api_request_verify_ssl', true, $this);
550 550
 	}
551 551
 
552 552
 }
Please login to merge, or discard this patch.
templates/shortcode-donor-wall.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 // Exit if accessed directly.
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if ( ! defined('ABSPATH')) {
8 8
 	exit;
9 9
 }
10 10
 
11 11
 /** @var $donor Give_Donor */
12 12
 $donor = $args[0];
13
-$donor = new Give_Donor( $donor->id );
13
+$donor = new Give_Donor($donor->id);
14 14
 
15 15
 $give_settings = $args[1]; // Give settings.
16 16
 $atts          = $args[2]; // Shortcode attributes.
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
 		<div class="give-donor__header">
22 22
 			<?php
23 23
 			// Maybe display the Avatar.
24
-			if ( true === $atts['show_avatar'] ) {
25
-				echo give_get_donor_avatar( $donor );
24
+			if (true === $atts['show_avatar']) {
25
+				echo give_get_donor_avatar($donor);
26 26
 			}
27 27
 			?>
28 28
 
29 29
 			<div class="give-donor__details">
30
-				<?php if ( true === $atts['show_name'] ) : ?>
31
-					<h3 class="give-donor__name"><?php esc_html_e( $donor->name ); ?></h3>
30
+				<?php if (true === $atts['show_name']) : ?>
31
+					<h3 class="give-donor__name"><?php esc_html_e($donor->name); ?></h3>
32 32
 				<?php endif; ?>
33 33
 
34
-				<?php if ( true === $atts['show_total'] ) : ?>
34
+				<?php if (true === $atts['show_total']) : ?>
35 35
 					<span class="give-donor__total">
36 36
 						<?php
37 37
 						$donated_amount = Give_Donor_Stats::donated(
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 							)
42 42
 						);
43 43
 
44
-						echo give_currency_filter( give_format_amount( $donated_amount, array( 'sanitize' => false ) ) );
44
+						echo give_currency_filter(give_format_amount($donated_amount, array('sanitize' => false)));
45 45
 						?>
46 46
 					</span>
47 47
 				<?php endif; ?>
48 48
 
49
-				<?php if ( true === $atts['show_time'] ) : ?>
49
+				<?php if (true === $atts['show_time']) : ?>
50 50
 					<span class="give-donor__timestamp">
51 51
 						<?php
52 52
 						// If not filtered by form ID then display the "Donor Since" text.
53 53
 						// If filtered by form ID then display the last donation date.
54
-						echo $donor->get_last_donation_date( true );
54
+						echo $donor->get_last_donation_date(true);
55 55
 						?>
56 56
 					</span>
57 57
 				<?php endif; ?>
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 		</div>
60 60
 
61 61
 		<?php
62
-		$comment = give_get_donor_latest_comment( $donor->id, $atts['form_id'] );
62
+		$comment = give_get_donor_latest_comment($donor->id, $atts['form_id']);
63 63
 
64
-		if ( true === $atts['show_comments'] && absint( $atts['comment_length'] ) && $comment instanceof WP_Comment ) :
64
+		if (true === $atts['show_comments'] && absint($atts['comment_length']) && $comment instanceof WP_Comment) :
65 65
 		?>
66 66
 			<div class="give-donor__content">
67 67
 					<?php
68
-					$comment_content = apply_filters( 'the_content', $comment->comment_content );
68
+					$comment_content = apply_filters('the_content', $comment->comment_content);
69 69
 
70
-					if ( $atts['comment_length'] < strlen( $comment->comment_content ) ) {
70
+					if ($atts['comment_length'] < strlen($comment->comment_content)) {
71 71
 						echo sprintf(
72 72
 							'<p class="give-donor__comment_excerpt">%s&hellip;<span>&nbsp;<a class="give-donor__read-more">%s</a></span></p>',
73
-							substr( $comment_content, 0, $atts['comment_length'] ),
73
+							substr($comment_content, 0, $atts['comment_length']),
74 74
 							$atts['readmore_text']
75 75
 						);
76 76
 
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
  */
39 39
 
40 40
 // Exit if accessed directly.
41
-if ( ! defined( 'ABSPATH' ) ) {
41
+if ( ! defined('ABSPATH')) {
42 42
 	exit;
43 43
 }
44 44
 
45
-if ( ! class_exists( 'Give' ) ) :
45
+if ( ! class_exists('Give')) :
46 46
 
47 47
 	/**
48 48
 	 * Main Give Class
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		 * @return    Give
280 280
 		 */
281 281
 		public static function instance() {
282
-			if ( is_null( self::$_instance ) ) {
282
+			if (is_null(self::$_instance)) {
283 283
 				self::$_instance = new self();
284 284
 			}
285 285
 
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 		 */
292 292
 		public function __construct() {
293 293
 			// PHP version
294
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
295
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
294
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
295
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
296 296
 			}
297 297
 
298 298
 			// Bailout: Need minimum php version to load plugin.
299
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
300
-				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
299
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
300
+				add_action('admin_notices', array($this, 'minimum_phpversion_notice'));
301 301
 
302 302
 				return;
303 303
 			}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			$this->includes();
307 307
 			$this->init_hooks();
308 308
 
309
-			do_action( 'give_loaded' );
309
+			do_action('give_loaded');
310 310
 		}
311 311
 
312 312
 		/**
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 		 * @since  1.8.9
316 316
 		 */
317 317
 		private function init_hooks() {
318
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
319
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
318
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
319
+			add_action('plugins_loaded', array($this, 'init'), 0);
320 320
 
321 321
 			// Set up localization on init Hook.
322
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
322
+			add_action('init', array($this, 'load_textdomain'), 0);
323 323
 		}
324 324
 
325 325
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			 *
336 336
 			 * @since 1.8.9
337 337
 			 */
338
-			do_action( 'before_give_init' );
338
+			do_action('before_give_init');
339 339
 
340 340
 			// Set up localization.
341 341
 			$this->load_textdomain();
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			 *
371 371
 			 * @since 1.8.7
372 372
 			 */
373
-			do_action( 'give_init', $this );
373
+			do_action('give_init', $this);
374 374
 
375 375
 		}
376 376
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		 */
388 388
 		public function __clone() {
389 389
 			// Cloning instances of the class is forbidden.
390
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
390
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
391 391
 		}
392 392
 
393 393
 		/**
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		 */
401 401
 		public function __wakeup() {
402 402
 			// Unserializing instances of the class is forbidden.
403
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
403
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
404 404
 		}
405 405
 
406 406
 		/**
@@ -414,33 +414,33 @@  discard block
 block discarded – undo
414 414
 		private function setup_constants() {
415 415
 
416 416
 			// Plugin version
417
-			if ( ! defined( 'GIVE_VERSION' ) ) {
418
-				define( 'GIVE_VERSION', '2.2.4' );
417
+			if ( ! defined('GIVE_VERSION')) {
418
+				define('GIVE_VERSION', '2.2.4');
419 419
 			}
420 420
 
421 421
 			// Plugin Root File
422
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
423
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
422
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
423
+				define('GIVE_PLUGIN_FILE', __FILE__);
424 424
 			}
425 425
 
426 426
 			// Plugin Folder Path
427
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
428
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
427
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
428
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
429 429
 			}
430 430
 
431 431
 			// Plugin Folder URL
432
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
433
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
432
+			if ( ! defined('GIVE_PLUGIN_URL')) {
433
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
434 434
 			}
435 435
 
436 436
 			// Plugin Basename aka: "give/give.php"
437
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
438
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
437
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
438
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
439 439
 			}
440 440
 
441 441
 			// Make sure CAL_GREGORIAN is defined
442
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
443
-				define( 'CAL_GREGORIAN', 1 );
442
+			if ( ! defined('CAL_GREGORIAN')) {
443
+				define('CAL_GREGORIAN', 1);
444 444
 			}
445 445
 		}
446 446
 
@@ -458,170 +458,170 @@  discard block
 block discarded – undo
458 458
 			/**
459 459
 			 * Load libraries.
460 460
 			 */
461
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
462
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
461
+			if ( ! class_exists('WP_Async_Request')) {
462
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
463 463
 			}
464 464
 
465
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
466
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
465
+			if ( ! class_exists('WP_Background_Process')) {
466
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
467 467
 			}
468 468
 
469 469
 			/**
470 470
 			 * Load plugin files
471 471
 			 */
472
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
474 474
 			$give_options = give_get_settings();
475 475
 
476
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
477
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
478
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
485
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php';
490
-
491
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
498
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php';
501
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
502
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor-wall-widget.php';
503
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
504
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sessions.php';
505
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
506
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
507
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
508
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
509
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
510
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
511
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-comment.php';
512
-
513
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
514
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
515
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
516
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
517
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
518
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
519
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
520
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
521
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
522
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
523
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
524
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
525
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
526
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
527
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
528
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
529
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
530
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
531
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
532
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
533
-
534
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
535
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
536
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
537
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
538
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
539
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
540
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php';
541
-
542
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
543
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
544
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
545
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
546
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
547
-
548
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
549
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
550
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
551
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
552
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
553
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
554
-
555
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
556
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-wall.php';
557
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-stats.php';
558
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
559
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/frontend-donor-functions.php';
560
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/actions.php';
561
-
562
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
563
-
564
-			require_once GIVE_PLUGIN_DIR . 'blocks/load.php';
565
-
566
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
567
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
478
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
485
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php';
490
+
491
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
498
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php';
501
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
502
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor-wall-widget.php';
503
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
504
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sessions.php';
505
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
506
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
507
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
508
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
509
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
510
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
511
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-comment.php';
512
+
513
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
514
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
515
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
516
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
517
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
518
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
519
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
520
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
521
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
522
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
523
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
524
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
525
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
526
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
527
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
528
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
529
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
530
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
531
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
532
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
533
+
534
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
535
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
536
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
537
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
538
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
539
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
540
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php';
541
+
542
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
543
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
544
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
545
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
546
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
547
+
548
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
549
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
550
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
551
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
552
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
553
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
554
+
555
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
556
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-wall.php';
557
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-stats.php';
558
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
559
+			require_once GIVE_PLUGIN_DIR.'includes/donors/frontend-donor-functions.php';
560
+			require_once GIVE_PLUGIN_DIR.'includes/donors/actions.php';
561
+
562
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
563
+
564
+			require_once GIVE_PLUGIN_DIR.'blocks/load.php';
565
+
566
+			if (defined('WP_CLI') && WP_CLI) {
567
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
568 568
 			}
569 569
 
570
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
571
-
572
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
573
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
574
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
575
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
576
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
577
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
578
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
579
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
580
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
581
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
582
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
583
-
584
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
585
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
586
-
587
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
588
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
589
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
590
-
591
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
592
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-give-form-duplicator.php';
593
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
594
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
595
-
596
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
597
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
598
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
599
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
600
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
601
-
602
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
603
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
604
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
605
-
606
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
607
-
608
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
609
-
610
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
611
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
612
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
613
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
614
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
615
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
616
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
617
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
618
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
619
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
620
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
621
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donor-wall.php';
570
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
571
+
572
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
573
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
574
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
575
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
576
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
577
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
578
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
579
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
580
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
581
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
582
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
583
+
584
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
585
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
586
+
587
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
588
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
589
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
590
+
591
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
592
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-give-form-duplicator.php';
593
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
594
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
595
+
596
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
597
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
598
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
599
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
600
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php';
601
+
602
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
603
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
604
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
605
+
606
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
607
+
608
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
609
+
610
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
611
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
612
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
613
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
614
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
615
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
616
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
617
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php';
618
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
619
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
620
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php';
621
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donor-wall.php';
622 622
 			}// End if().
623 623
 
624
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
624
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
625 625
 
626 626
 		}
627 627
 
@@ -636,16 +636,16 @@  discard block
 block discarded – undo
636 636
 		public function load_textdomain() {
637 637
 
638 638
 			// Set filter for Give's languages directory
639
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
640
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
639
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
640
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
641 641
 
642 642
 			// Traditional WordPress plugin locale filter.
643
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
644
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
643
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
644
+			$locale = apply_filters('plugin_locale', $locale, 'give');
645 645
 
646
-			unload_textdomain( 'give' );
647
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
648
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
646
+			unload_textdomain('give');
647
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
648
+			load_plugin_textdomain('give', false, $give_lang_dir);
649 649
 
650 650
 		}
651 651
 
@@ -658,21 +658,21 @@  discard block
 block discarded – undo
658 658
 		 */
659 659
 		public function minimum_phpversion_notice() {
660 660
 			// Bailout.
661
-			if ( ! is_admin() ) {
661
+			if ( ! is_admin()) {
662 662
 				return;
663 663
 			}
664 664
 
665
-			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
666
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
667
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
668
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
669
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
670
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
671
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
665
+			$notice_desc  = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
666
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
667
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
668
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
669
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
670
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
671
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
672 672
 
673 673
 			echo sprintf(
674 674
 				'<div class="notice notice-error">%1$s</div>',
675
-				wp_kses_post( $notice_desc )
675
+				wp_kses_post($notice_desc)
676 676
 			);
677 677
 		}
678 678
 
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-income.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -61,32 +61,32 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function get_data() {
63 63
 
64
-		if ( $this->step == 1 ) {
65
-			$this->delete_data( 'give_temp_recount_earnings' );
64
+		if ($this->step == 1) {
65
+			$this->delete_data('give_temp_recount_earnings');
66 66
 		}
67 67
 
68
-		$total = get_option( 'give_temp_recount_earnings', false );
68
+		$total = get_option('give_temp_recount_earnings', false);
69 69
 
70
-		if ( false === $total ) {
70
+		if (false === $total) {
71 71
 			$total = (float) 0;
72
-			$this->store_data( 'give_temp_recount_earnings', $total );
72
+			$this->store_data('give_temp_recount_earnings', $total);
73 73
 		}
74 74
 
75
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
75
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
76 76
 
77
-		$args = apply_filters( 'give_recount_earnings_args', array(
77
+		$args = apply_filters('give_recount_earnings_args', array(
78 78
 			'number' => $this->per_step,
79 79
 			'page'   => $this->step,
80 80
 			'status' => $accepted_statuses,
81
-		) );
81
+		));
82 82
 
83
-		$payments = give_get_payments( $args );
83
+		$payments = give_get_payments($args);
84 84
 
85
-		if ( ! empty( $payments ) ) {
85
+		if ( ! empty($payments)) {
86 86
 
87
-			foreach ( $payments as $payment ) {
87
+			foreach ($payments as $payment) {
88 88
 				// Get the payment amount.
89
-				$payment_amount = give_get_meta( $payment->ID, '_give_payment_total', true );
89
+				$payment_amount = give_get_meta($payment->ID, '_give_payment_total', true);
90 90
 
91 91
 				/**
92 92
 				 * Filter the payment amount.
@@ -95,28 +95,28 @@  discard block
 block discarded – undo
95 95
 				 */
96 96
 				$donation_amount = apply_filters(
97 97
 					'give_donation_amount',
98
-					give_format_amount( $payment_amount, array( 'donation_id' => $payment->ID ) ),
98
+					give_format_amount($payment_amount, array('donation_id' => $payment->ID)),
99 99
 					$payment->total,
100 100
 					$payment->ID,
101
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
101
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
102 102
 				);
103 103
 
104
-				$total += (float) give_maybe_sanitize_amount( $donation_amount );
104
+				$total += (float) give_maybe_sanitize_amount($donation_amount);
105 105
 			}
106 106
 
107
-			if ( $total < 0 ) {
107
+			if ($total < 0) {
108 108
 				$totals = 0;
109 109
 			}
110 110
 
111
-			$total = round( $total, give_get_price_decimals() );
111
+			$total = round($total, give_get_price_decimals());
112 112
 
113
-			$this->store_data( 'give_temp_recount_earnings', $total );
113
+			$this->store_data('give_temp_recount_earnings', $total);
114 114
 
115 115
 			return true;
116 116
 
117 117
 		}
118 118
 
119
-		update_option( 'give_earnings_total', $total, false );
119
+		update_option('give_earnings_total', $total, false);
120 120
 
121 121
 		return false;
122 122
 
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function get_percentage_complete() {
132 132
 
133
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
133
+		$total = $this->get_stored_data('give_recount_earnings_total');
134 134
 
135
-		if ( false === $total ) {
136
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
135
+		if (false === $total) {
136
+			$args = apply_filters('give_recount_earnings_total_args', array());
137 137
 
138
-			$counts = give_count_payments( $args );
139
-			$total  = absint( $counts->publish );
140
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
138
+			$counts = give_count_payments($args);
139
+			$total  = absint($counts->publish);
140
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
141 141
 
142
-			$this->store_data( 'give_recount_earnings_total', $total );
142
+			$this->store_data('give_recount_earnings_total', $total);
143 143
 		}
144 144
 
145 145
 		$percentage = 100;
146 146
 
147
-		if ( $total > 0 ) {
148
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
147
+		if ($total > 0) {
148
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
149 149
 		}
150 150
 
151
-		if ( $percentage > 100 ) {
151
+		if ($percentage > 100) {
152 152
 			$percentage = 100;
153 153
 		}
154 154
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @param array $request The Form Data passed into the batch processing
164 164
 	 */
165
-	public function set_properties( $request ) {
165
+	public function set_properties($request) {
166 166
 	}
167 167
 
168 168
 	/**
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function process_step() {
175 175
 
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		$had_data = $this->get_data();
181 181
 
182
-		if ( $had_data ) {
182
+		if ($had_data) {
183 183
 			$this->done = false;
184 184
 
185 185
 			return true;
186 186
 		} else {
187
-			$this->delete_data( 'give_recount_earnings_total' );
188
-			$this->delete_data( 'give_temp_recount_earnings' );
187
+			$this->delete_data('give_recount_earnings_total');
188
+			$this->delete_data('give_temp_recount_earnings');
189 189
 			$this->done    = true;
190
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
190
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
191 191
 
192 192
 			return false;
193 193
 		}
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return mixed       Returns the data from the database
226 226
 	 */
227
-	private function get_stored_data( $key ) {
227
+	private function get_stored_data($key) {
228 228
 		global $wpdb;
229
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
229
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
230 230
 
231
-		if ( empty( $value ) ) {
231
+		if (empty($value)) {
232 232
 			return false;
233 233
 		}
234 234
 
235
-		$maybe_json = json_decode( $value );
236
-		if ( ! is_null( $maybe_json ) ) {
237
-			$value = json_decode( $value, true );
235
+		$maybe_json = json_decode($value);
236
+		if ( ! is_null($maybe_json)) {
237
+			$value = json_decode($value, true);
238 238
 		}
239 239
 
240 240
 		return $value;
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return void
252 252
 	 */
253
-	private function store_data( $key, $value ) {
253
+	private function store_data($key, $value) {
254 254
 		global $wpdb;
255 255
 
256
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
256
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
257 257
 
258 258
 		$data = array(
259 259
 			'option_name'  => $key,
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			'%s',
268 268
 		);
269 269
 
270
-		$wpdb->replace( $wpdb->options, $data, $formats );
270
+		$wpdb->replace($wpdb->options, $data, $formats);
271 271
 	}
272 272
 
273 273
 	/**
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return void
281 281
 	 */
282
-	private function delete_data( $key ) {
282
+	private function delete_data($key) {
283 283
 		global $wpdb;
284
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
284
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
285 285
 	}
286 286
 
287 287
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +483 added lines, -483 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,70 +25,70 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ):
37
+		case version_compare($give_version, '1.6', '<'):
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ):
41
+		case version_compare($give_version, '1.7', '<'):
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ):
45
+		case version_compare($give_version, '1.8', '<'):
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ):
49
+		case version_compare($give_version, '1.8.7', '<'):
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ):
53
+		case version_compare($give_version, '1.8.8', '<'):
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ):
57
+		case version_compare($give_version, '1.8.9', '<'):
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ):
61
+		case version_compare($give_version, '1.8.12', '<'):
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ):
65
+		case version_compare($give_version, '1.8.13', '<'):
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ):
69
+		case version_compare($give_version, '1.8.17', '<'):
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ):
73
+		case version_compare($give_version, '1.8.18', '<'):
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ):
77
+		case version_compare($give_version, '2.0', '<'):
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ):
81
+		case version_compare($give_version, '2.0.1', '<'):
82 82
 			// Do nothing on fresh install.
83
-			if ( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 
91
-		case version_compare( $give_version, '2.0.2', '<' ):
91
+		case version_compare($give_version, '2.0.2', '<'):
92 92
 			// Remove 2.0.1 update to rerun on 2.0.2
93 93
 			$completed_upgrades = give_get_completed_upgrades();
94 94
 			$v201_updates       = array(
@@ -98,43 +98,43 @@  discard block
 block discarded – undo
98 98
 				'v201_logs_upgrades',
99 99
 			);
100 100
 
101
-			foreach ( $v201_updates as $v201_update ) {
102
-				if ( in_array( $v201_update, $completed_upgrades ) ) {
103
-					unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] );
101
+			foreach ($v201_updates as $v201_update) {
102
+				if (in_array($v201_update, $completed_upgrades)) {
103
+					unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]);
104 104
 				}
105 105
 			}
106 106
 
107
-			update_option( 'give_completed_upgrades', $completed_upgrades, false );
107
+			update_option('give_completed_upgrades', $completed_upgrades, false);
108 108
 
109 109
 			// Do nothing on fresh install.
110
-			if ( ! doing_action( 'give_upgrades' ) ) {
110
+			if ( ! doing_action('give_upgrades')) {
111 111
 				give_v201_create_tables();
112
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
112
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
113 113
 				Give_Updates::$background_updater->dispatch();
114 114
 			}
115 115
 
116 116
 			$did_upgrade = true;
117 117
 
118
-		case version_compare( $give_version, '2.0.3', '<' ):
118
+		case version_compare($give_version, '2.0.3', '<'):
119 119
 			give_v203_upgrades();
120 120
 			$did_upgrade = true;
121 121
 
122
-		case version_compare( $give_version, '2.2.0', '<' ):
122
+		case version_compare($give_version, '2.2.0', '<'):
123 123
 			give_v220_upgrades();
124 124
 			$did_upgrade = true;
125 125
 
126
-		case version_compare( $give_version, '2.2.1', '<' ):
126
+		case version_compare($give_version, '2.2.1', '<'):
127 127
 			give_v221_upgrades();
128 128
 			$did_upgrade = true;
129 129
 	}
130 130
 
131
-	if ( $did_upgrade ) {
132
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
131
+	if ($did_upgrade) {
132
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
133 133
 	}
134 134
 }
135 135
 
136
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
137
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
136
+add_action('admin_init', 'give_do_automatic_upgrades');
137
+add_action('give_upgrades', 'give_do_automatic_upgrades');
138 138
 
139 139
 /**
140 140
  * Display Upgrade Notices.
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
  *
149 149
  * @return void
150 150
  */
151
-function give_show_upgrade_notices( $give_updates ) {
151
+function give_show_upgrade_notices($give_updates) {
152 152
 	// v1.3.2 Upgrades
153 153
 	$give_updates->register(
154 154
 		array(
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			'id'       => 'v20_move_metadata_into_new_table',
302 302
 			'version'  => '2.0.0',
303 303
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
304
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
304
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
305 305
 		)
306 306
 	);
307 307
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 			'id'       => 'v201_move_metadata_into_new_table',
347 347
 			'version'  => '2.0.1',
348 348
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
349
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
349
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
350 350
 		)
351 351
 	);
352 352
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 			'id'       => 'v213_delete_donation_meta',
375 375
 			'version'  => '2.1.3',
376 376
 			'callback' => 'give_v213_delete_donation_meta_callback',
377
-			'depends'  => array( 'v201_move_metadata_into_new_table' ),
377
+			'depends'  => array('v201_move_metadata_into_new_table'),
378 378
 		)
379 379
 	);
380 380
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	);
398 398
 }
399 399
 
400
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
400
+add_action('give_register_updates', 'give_show_upgrade_notices');
401 401
 
402 402
 /**
403 403
  * Triggers all upgrade functions
@@ -409,31 +409,31 @@  discard block
 block discarded – undo
409 409
  */
410 410
 function give_trigger_upgrades() {
411 411
 
412
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
412
+	if ( ! current_user_can('manage_give_settings')) {
413 413
 		wp_die(
414
-			esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
414
+			esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
415 415
 				'response' => 403,
416 416
 			)
417 417
 		);
418 418
 	}
419 419
 
420
-	$give_version = get_option( 'give_version' );
420
+	$give_version = get_option('give_version');
421 421
 
422
-	if ( ! $give_version ) {
422
+	if ( ! $give_version) {
423 423
 		// 1.0 is the first version to use this option so we must add it.
424 424
 		$give_version = '1.0';
425
-		add_option( 'give_version', $give_version, '', false );
425
+		add_option('give_version', $give_version, '', false);
426 426
 	}
427 427
 
428
-	update_option( 'give_version', GIVE_VERSION, false );
429
-	delete_option( 'give_doing_upgrade' );
428
+	update_option('give_version', GIVE_VERSION, false);
429
+	delete_option('give_doing_upgrade');
430 430
 
431
-	if ( DOING_AJAX ) {
432
-		die( 'complete' );
431
+	if (DOING_AJAX) {
432
+		die('complete');
433 433
 	} // End if().
434 434
 }
435 435
 
436
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
436
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
437 437
 
438 438
 
439 439
 /**
@@ -451,10 +451,10 @@  discard block
 block discarded – undo
451 451
 
452 452
 	// UPDATE DB METAKEYS.
453 453
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
454
-	$query = $wpdb->query( $sql );
454
+	$query = $wpdb->query($sql);
455 455
 
456 456
 	$give_updates->percentage = 100;
457
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
457
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
458 458
 }
459 459
 
460 460
 
@@ -478,24 +478,24 @@  discard block
 block discarded – undo
478 478
 	$where .= "AND ( p.post_status = 'abandoned' )";
479 479
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
480 480
 
481
-	$sql            = $select . $join . $where;
482
-	$found_payments = $wpdb->get_col( $sql );
481
+	$sql            = $select.$join.$where;
482
+	$found_payments = $wpdb->get_col($sql);
483 483
 
484
-	foreach ( $found_payments as $payment ) {
484
+	foreach ($found_payments as $payment) {
485 485
 
486 486
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
487
-		$modified_time = get_post_modified_time( 'U', false, $payment );
487
+		$modified_time = get_post_modified_time('U', false, $payment);
488 488
 
489 489
 		// 1450124863 =  12/10/2015 20:42:25.
490
-		if ( $modified_time >= 1450124863 ) {
490
+		if ($modified_time >= 1450124863) {
491 491
 
492
-			give_update_payment_status( $payment, 'pending' );
492
+			give_update_payment_status($payment, 'pending');
493 493
 
494 494
 		}
495 495
 	}
496 496
 
497 497
 	$give_updates->percentage = 100;
498
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
498
+	give_set_upgrade_complete('upgrade_give_offline_status');
499 499
 }
500 500
 
501 501
 
@@ -508,17 +508,17 @@  discard block
 block discarded – undo
508 508
  */
509 509
 function give_v152_cleanup_users() {
510 510
 
511
-	$give_version = get_option( 'give_version' );
511
+	$give_version = get_option('give_version');
512 512
 
513
-	if ( ! $give_version ) {
513
+	if ( ! $give_version) {
514 514
 		// 1.0 is the first version to use this option so we must add it.
515 515
 		$give_version = '1.0';
516 516
 	}
517 517
 
518
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
518
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
519 519
 
520 520
 	// v1.5.2 Upgrades
521
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
521
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
522 522
 
523 523
 		// Delete all caps with "ss".
524 524
 		// Also delete all unused "campaign" roles.
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
 		);
566 566
 
567 567
 		global $wp_roles;
568
-		foreach ( $delete_caps as $cap ) {
569
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
570
-				$wp_roles->remove_cap( $role, $cap );
568
+		foreach ($delete_caps as $cap) {
569
+			foreach (array_keys($wp_roles->roles) as $role) {
570
+				$wp_roles->remove_cap($role, $cap);
571 571
 			}
572 572
 		}
573 573
 
@@ -577,15 +577,15 @@  discard block
 block discarded – undo
577 577
 		$roles->add_caps();
578 578
 
579 579
 		// The Update Ran.
580
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
581
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
582
-		delete_option( 'give_doing_upgrade' );
580
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
581
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
582
+		delete_option('give_doing_upgrade');
583 583
 
584 584
 	}// End if().
585 585
 
586 586
 }
587 587
 
588
-add_action( 'admin_init', 'give_v152_cleanup_users' );
588
+add_action('admin_init', 'give_v152_cleanup_users');
589 589
 
590 590
 /**
591 591
  * 1.6 Upgrade routine to create the customer meta table.
@@ -628,53 +628,53 @@  discard block
 block discarded – undo
628 628
 
629 629
 	// Get addons license key.
630 630
 	$addons = array();
631
-	foreach ( $give_options as $key => $value ) {
632
-		if ( false !== strpos( $key, '_license_key' ) ) {
633
-			$addons[ $key ] = $value;
631
+	foreach ($give_options as $key => $value) {
632
+		if (false !== strpos($key, '_license_key')) {
633
+			$addons[$key] = $value;
634 634
 		}
635 635
 	}
636 636
 
637 637
 	// Bailout: We do not have any addon license data to upgrade.
638
-	if ( empty( $addons ) ) {
638
+	if (empty($addons)) {
639 639
 		return false;
640 640
 	}
641 641
 
642
-	foreach ( $addons as $key => $addon_license ) {
642
+	foreach ($addons as $key => $addon_license) {
643 643
 
644 644
 		// Get addon shortname.
645
-		$shortname = str_replace( '_license_key', '', $key );
645
+		$shortname = str_replace('_license_key', '', $key);
646 646
 
647 647
 		// Addon license option name.
648
-		$addon_license_option_name = $shortname . '_license_active';
648
+		$addon_license_option_name = $shortname.'_license_active';
649 649
 
650 650
 		// bailout if license is empty.
651
-		if ( empty( $addon_license ) ) {
652
-			delete_option( $addon_license_option_name );
651
+		if (empty($addon_license)) {
652
+			delete_option($addon_license_option_name);
653 653
 			continue;
654 654
 		}
655 655
 
656 656
 		// Get addon name.
657 657
 		$addon_name       = array();
658
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
659
-		foreach ( $addon_name_parts as $name_part ) {
658
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
659
+		foreach ($addon_name_parts as $name_part) {
660 660
 
661 661
 			// Fix addon name
662
-			switch ( $name_part ) {
662
+			switch ($name_part) {
663 663
 				case 'authorizenet':
664 664
 					$name_part = 'authorize.net';
665 665
 					break;
666 666
 			}
667 667
 
668
-			$addon_name[] = ucfirst( $name_part );
668
+			$addon_name[] = ucfirst($name_part);
669 669
 		}
670 670
 
671
-		$addon_name = implode( ' ', $addon_name );
671
+		$addon_name = implode(' ', $addon_name);
672 672
 
673 673
 		// Data to send to the API.
674 674
 		$api_params = array(
675 675
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
676 676
 			'license'    => $addon_license,
677
-			'item_name'  => urlencode( $addon_name ),
677
+			'item_name'  => urlencode($addon_name),
678 678
 			'url'        => home_url(),
679 679
 		);
680 680
 
@@ -689,17 +689,17 @@  discard block
 block discarded – undo
689 689
 		);
690 690
 
691 691
 		// Make sure there are no errors.
692
-		if ( is_wp_error( $response ) ) {
693
-			delete_option( $addon_license_option_name );
692
+		if (is_wp_error($response)) {
693
+			delete_option($addon_license_option_name);
694 694
 			continue;
695 695
 		}
696 696
 
697 697
 		// Tell WordPress to look for updates.
698
-		set_site_transient( 'update_plugins', null );
698
+		set_site_transient('update_plugins', null);
699 699
 
700 700
 		// Decode license data.
701
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
702
-		update_option( $addon_license_option_name, $license_data, false );
701
+		$license_data = json_decode(wp_remote_retrieve_body($response));
702
+		update_option($addon_license_option_name, $license_data, false);
703 703
 	}// End foreach().
704 704
 }
705 705
 
@@ -729,9 +729,9 @@  discard block
 block discarded – undo
729 729
 	);
730 730
 
731 731
 	global $wp_roles;
732
-	foreach ( $delete_caps as $cap ) {
733
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
734
-			$wp_roles->remove_cap( $role, $cap );
732
+	foreach ($delete_caps as $cap) {
733
+		foreach (array_keys($wp_roles->roles) as $role) {
734
+			$wp_roles->remove_cap($role, $cap);
735 735
 		}
736 736
 	}
737 737
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 function give_v18_upgrades_core_setting() {
766 766
 	// Core settings which changes from checkbox to radio.
767 767
 	$core_setting_names = array_merge(
768
-		array_keys( give_v18_renamed_core_settings() ),
768
+		array_keys(give_v18_renamed_core_settings()),
769 769
 		array(
770 770
 			'uninstall_on_delete',
771 771
 			'scripts_footer',
@@ -777,48 +777,48 @@  discard block
 block discarded – undo
777 777
 	);
778 778
 
779 779
 	// Bailout: If not any setting define.
780
-	if ( $give_settings = get_option( 'give_settings' ) ) {
780
+	if ($give_settings = get_option('give_settings')) {
781 781
 
782 782
 		$setting_changed = false;
783 783
 
784 784
 		// Loop: check each setting field.
785
-		foreach ( $core_setting_names as $setting_name ) {
785
+		foreach ($core_setting_names as $setting_name) {
786 786
 			// New setting name.
787
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
787
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
788 788
 
789 789
 			// Continue: If setting already set.
790 790
 			if (
791
-				array_key_exists( $new_setting_name, $give_settings )
792
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
791
+				array_key_exists($new_setting_name, $give_settings)
792
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
793 793
 			) {
794 794
 				continue;
795 795
 			}
796 796
 
797 797
 			// Set checkbox value to radio value.
798
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
798
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
799 799
 
800 800
 			// @see https://github.com/WordImpress/Give/issues/1063.
801
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
801
+			if (false !== strpos($setting_name, 'disable_')) {
802 802
 
803
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
804
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
803
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
804
+			} elseif (false !== strpos($setting_name, 'enable_')) {
805 805
 
806
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
806
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
807 807
 			}
808 808
 
809 809
 			// Tell bot to update core setting to db.
810
-			if ( ! $setting_changed ) {
810
+			if ( ! $setting_changed) {
811 811
 				$setting_changed = true;
812 812
 			}
813 813
 		}
814 814
 
815 815
 		// Update setting only if they changed.
816
-		if ( $setting_changed ) {
817
-			update_option( 'give_settings', $give_settings, false );
816
+		if ($setting_changed) {
817
+			update_option('give_settings', $give_settings, false);
818 818
 		}
819 819
 	}// End if().
820 820
 
821
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
821
+	give_set_upgrade_complete('v18_upgrades_core_setting');
822 822
 }
823 823
 
824 824
 /**
@@ -842,41 +842,41 @@  discard block
 block discarded – undo
842 842
 		)
843 843
 	);
844 844
 
845
-	if ( $forms->have_posts() ) {
846
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
845
+	if ($forms->have_posts()) {
846
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
847 847
 
848
-		while ( $forms->have_posts() ) {
848
+		while ($forms->have_posts()) {
849 849
 			$forms->the_post();
850 850
 
851 851
 			// Form content.
852 852
 			// Note in version 1.8 display content setting split into display content and content placement setting.
853 853
 			// You can delete _give_content_option in future.
854
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
855
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
856
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
857
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
854
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
855
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
856
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
857
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
858 858
 
859
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
860
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
859
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
860
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
861 861
 			}
862 862
 
863 863
 			// "Disable" Guest Donation. Checkbox.
864 864
 			// See: https://github.com/WordImpress/Give/issues/1470.
865
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
866
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
867
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
865
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
866
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
867
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
868 868
 
869 869
 			// Offline Donations.
870 870
 			// See: https://github.com/WordImpress/Give/issues/1579.
871
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
872
-			if ( 'no' === $offline_donation ) {
871
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
872
+			if ('no' === $offline_donation) {
873 873
 				$offline_donation_newval = 'global';
874
-			} elseif ( 'yes' === $offline_donation ) {
874
+			} elseif ('yes' === $offline_donation) {
875 875
 				$offline_donation_newval = 'enabled';
876 876
 			} else {
877 877
 				$offline_donation_newval = 'disabled';
878 878
 			}
879
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
879
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
880 880
 
881 881
 			// Convert yes/no setting field to enabled/disabled.
882 882
 			$form_radio_settings = array(
@@ -896,15 +896,15 @@  discard block
 block discarded – undo
896 896
 				'_give_offline_donation_enable_billing_fields_single',
897 897
 			);
898 898
 
899
-			foreach ( $form_radio_settings as $meta_key ) {
899
+			foreach ($form_radio_settings as $meta_key) {
900 900
 				// Get value.
901
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
901
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
902 902
 
903 903
 				// Convert meta value only if it is in yes/no/none.
904
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
904
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
905 905
 
906
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
907
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
906
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
907
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
908 908
 				}
909 909
 			}
910 910
 		}// End while().
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 
914 914
 	} else {
915 915
 		// No more forms found, finish up.
916
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
916
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
917 917
 	}
918 918
 }
919 919
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 				'%_transient_give_stats_%',
981 981
 				'give_cache%',
982 982
 				'%_transient_give_add_ons_feed%',
983
-				'%_transient__give_ajax_works' .
983
+				'%_transient__give_ajax_works'.
984 984
 				'%_transient_give_total_api_keys%',
985 985
 				'%_transient_give_i18n_give_promo_hide%',
986 986
 				'%_transient_give_contributors%',
@@ -1007,24 +1007,24 @@  discard block
 block discarded – undo
1007 1007
 		ARRAY_A
1008 1008
 	);
1009 1009
 
1010
-	if ( ! empty( $user_apikey_options ) ) {
1011
-		foreach ( $user_apikey_options as $user ) {
1012
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
1013
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
1014
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
1010
+	if ( ! empty($user_apikey_options)) {
1011
+		foreach ($user_apikey_options as $user) {
1012
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
1013
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
1014
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
1015 1015
 		}
1016 1016
 	}
1017 1017
 
1018
-	if ( ! empty( $cached_options ) ) {
1019
-		foreach ( $cached_options as $option ) {
1020
-			switch ( true ) {
1021
-				case ( false !== strpos( $option, 'transient' ) ):
1022
-					$option = str_replace( '_transient_', '', $option );
1023
-					delete_transient( $option );
1018
+	if ( ! empty($cached_options)) {
1019
+		foreach ($cached_options as $option) {
1020
+			switch (true) {
1021
+				case (false !== strpos($option, 'transient')):
1022
+					$option = str_replace('_transient_', '', $option);
1023
+					delete_transient($option);
1024 1024
 					break;
1025 1025
 
1026 1026
 				default:
1027
-					delete_option( $option );
1027
+					delete_option($option);
1028 1028
 			}
1029 1029
 		}
1030 1030
 	}
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 	global $wp_roles;
1043 1043
 
1044 1044
 	// Get the role object.
1045
-	$give_worker = get_role( 'give_worker' );
1045
+	$give_worker = get_role('give_worker');
1046 1046
 
1047 1047
 	// A list of capabilities to add for give workers.
1048 1048
 	$caps_to_add = array(
@@ -1050,9 +1050,9 @@  discard block
 block discarded – undo
1050 1050
 		'edit_pages',
1051 1051
 	);
1052 1052
 
1053
-	foreach ( $caps_to_add as $cap ) {
1053
+	foreach ($caps_to_add as $cap) {
1054 1054
 		// Add the capability.
1055
-		$give_worker->add_cap( $cap );
1055
+		$give_worker->add_cap($cap);
1056 1056
 	}
1057 1057
 
1058 1058
 }
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 		)
1080 1080
 	);
1081 1081
 
1082
-	if ( $donation_forms->have_posts() ) {
1083
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1082
+	if ($donation_forms->have_posts()) {
1083
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1084 1084
 
1085
-		while ( $donation_forms->have_posts() ) {
1085
+		while ($donation_forms->have_posts()) {
1086 1086
 			$donation_forms->the_post();
1087 1087
 			$form_id = get_the_ID();
1088 1088
 
@@ -1090,41 +1090,41 @@  discard block
 block discarded – undo
1090 1090
 			update_post_meta(
1091 1091
 				$form_id,
1092 1092
 				'_give_set_price',
1093
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1093
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1094 1094
 			);
1095 1095
 
1096 1096
 			// Remove formatting from _give_custom_amount_minimum.
1097 1097
 			update_post_meta(
1098 1098
 				$form_id,
1099 1099
 				'_give_custom_amount_minimum',
1100
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1100
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1101 1101
 			);
1102 1102
 
1103 1103
 			// Bailout.
1104
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1104
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1105 1105
 				continue;
1106 1106
 			}
1107 1107
 
1108
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1108
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1109 1109
 
1110
-			if ( ! empty( $donation_levels ) ) {
1110
+			if ( ! empty($donation_levels)) {
1111 1111
 
1112
-				foreach ( $donation_levels as $index => $donation_level ) {
1113
-					if ( isset( $donation_level['_give_amount'] ) ) {
1114
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1112
+				foreach ($donation_levels as $index => $donation_level) {
1113
+					if (isset($donation_level['_give_amount'])) {
1114
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1115 1115
 					}
1116 1116
 				}
1117 1117
 
1118
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1118
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1119 1119
 
1120
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1120
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1121 1121
 
1122
-				$min_amount = min( $donation_levels_amounts );
1123
-				$max_amount = max( $donation_levels_amounts );
1122
+				$min_amount = min($donation_levels_amounts);
1123
+				$max_amount = max($donation_levels_amounts);
1124 1124
 
1125 1125
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1126
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1127
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1126
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1127
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1128 1128
 			}
1129 1129
 		}
1130 1130
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 		wp_reset_postdata();
1133 1133
 	} else {
1134 1134
 		// The Update Ran.
1135
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1135
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1136 1136
 	}
1137 1137
 
1138 1138
 }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
  */
1183 1183
 function give_v20_upgrades() {
1184 1184
 	// Update cache setting.
1185
-	give_update_option( 'cache', 'enabled' );
1185
+	give_update_option('cache', 'enabled');
1186 1186
 
1187 1187
 	// Upgrade email settings.
1188 1188
 	give_v20_upgrades_email_setting();
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 	$all_setting = give_get_settings();
1202 1202
 
1203 1203
 	// Bailout on fresh install.
1204
-	if ( empty( $all_setting ) ) {
1204
+	if (empty($all_setting)) {
1205 1205
 		return;
1206 1206
 	}
1207 1207
 
@@ -1220,19 +1220,19 @@  discard block
 block discarded – undo
1220 1220
 		'admin_notices'                 => 'new-donation_notification',
1221 1221
 	);
1222 1222
 
1223
-	foreach ( $settings as $old_setting => $new_setting ) {
1223
+	foreach ($settings as $old_setting => $new_setting) {
1224 1224
 		// Do not update already modified
1225
-		if ( ! is_array( $new_setting ) ) {
1226
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1225
+		if ( ! is_array($new_setting)) {
1226
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1227 1227
 				continue;
1228 1228
 			}
1229 1229
 		}
1230 1230
 
1231
-		switch ( $old_setting ) {
1231
+		switch ($old_setting) {
1232 1232
 			case 'admin_notices':
1233
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1233
+				$notification_status = give_get_option($old_setting, 'enabled');
1234 1234
 
1235
-				give_update_option( $new_setting, $notification_status );
1235
+				give_update_option($new_setting, $notification_status);
1236 1236
 
1237 1237
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1238 1238
 				// give_delete_option( $old_setting );
@@ -1242,19 +1242,19 @@  discard block
 block discarded – undo
1242 1242
 			case 'admin_notice_emails':
1243 1243
 				$recipients = give_get_admin_notice_emails();
1244 1244
 
1245
-				foreach ( $new_setting as $setting ) {
1245
+				foreach ($new_setting as $setting) {
1246 1246
 					// bailout if setting already exist.
1247
-					if ( array_key_exists( $setting, $all_setting ) ) {
1247
+					if (array_key_exists($setting, $all_setting)) {
1248 1248
 						continue;
1249 1249
 					}
1250 1250
 
1251
-					give_update_option( $setting, $recipients );
1251
+					give_update_option($setting, $recipients);
1252 1252
 				}
1253 1253
 				break;
1254 1254
 
1255 1255
 			default:
1256
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1257
-				give_delete_option( $old_setting );
1256
+				give_update_option($new_setting, give_get_option($old_setting));
1257
+				give_delete_option($old_setting);
1258 1258
 		}
1259 1259
 	}
1260 1260
 }
@@ -1271,22 +1271,22 @@  discard block
 block discarded – undo
1271 1271
 	$give_settings        = give_get_settings();
1272 1272
 	$give_setting_updated = false;
1273 1273
 
1274
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1274
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1275 1275
 		$give_settings['number_decimals']   = 0;
1276 1276
 		$give_settings['decimal_separator'] = '';
1277 1277
 		$give_setting_updated               = true;
1278 1278
 
1279
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1279
+	} elseif (empty($give_settings['decimal_separator'])) {
1280 1280
 		$give_settings['number_decimals'] = 0;
1281 1281
 		$give_setting_updated             = true;
1282 1282
 
1283
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1283
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1284 1284
 		$give_settings['number_decimals'] = 5;
1285 1285
 		$give_setting_updated             = true;
1286 1286
 	}
1287 1287
 
1288
-	if ( $give_setting_updated ) {
1289
-		update_option( 'give_settings', $give_settings, false );
1288
+	if ($give_setting_updated) {
1289
+		update_option('give_settings', $give_settings, false);
1290 1290
 	}
1291 1291
 }
1292 1292
 
@@ -1310,73 +1310,73 @@  discard block
 block discarded – undo
1310 1310
 			'paged'          => $give_updates->step,
1311 1311
 			'status'         => 'any',
1312 1312
 			'order'          => 'ASC',
1313
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1313
+			'post_type'      => array('give_forms', 'give_payment'),
1314 1314
 			'posts_per_page' => 20,
1315 1315
 		)
1316 1316
 	);
1317
-	if ( $donation_forms->have_posts() ) {
1318
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1317
+	if ($donation_forms->have_posts()) {
1318
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1319 1319
 
1320
-		while ( $donation_forms->have_posts() ) {
1320
+		while ($donation_forms->have_posts()) {
1321 1321
 			$donation_forms->the_post();
1322 1322
 			global $post;
1323 1323
 
1324
-			$meta = get_post_meta( $post->ID );
1324
+			$meta = get_post_meta($post->ID);
1325 1325
 
1326
-			switch ( $post->post_type ) {
1326
+			switch ($post->post_type) {
1327 1327
 				case 'give_forms':
1328 1328
 					// _give_set_price.
1329
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1330
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1329
+					if ( ! empty($meta['_give_set_price'][0])) {
1330
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1331 1331
 					}
1332 1332
 
1333 1333
 					// _give_custom_amount_minimum.
1334
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1335
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1334
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1335
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1336 1336
 					}
1337 1337
 
1338 1338
 					// _give_levels_minimum_amount.
1339
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1340
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1339
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1340
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1341 1341
 					}
1342 1342
 
1343 1343
 					// _give_levels_maximum_amount.
1344
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1345
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1344
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1345
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1346 1346
 					}
1347 1347
 
1348 1348
 					// _give_set_goal.
1349
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1350
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1349
+					if ( ! empty($meta['_give_set_goal'][0])) {
1350
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1351 1351
 					}
1352 1352
 
1353 1353
 					// _give_form_earnings.
1354
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1355
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1354
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1355
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1356 1356
 					}
1357 1357
 
1358 1358
 					// _give_custom_amount_minimum.
1359
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1360
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1359
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1360
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1361 1361
 
1362
-						foreach ( $donation_levels as $index => $level ) {
1363
-							if ( empty( $level['_give_amount'] ) ) {
1362
+						foreach ($donation_levels as $index => $level) {
1363
+							if (empty($level['_give_amount'])) {
1364 1364
 								continue;
1365 1365
 							}
1366 1366
 
1367
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1367
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1368 1368
 						}
1369 1369
 
1370 1370
 						$meta['_give_donation_levels'] = $donation_levels;
1371
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1371
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1372 1372
 					}
1373 1373
 
1374 1374
 					break;
1375 1375
 
1376 1376
 				case 'give_payment':
1377 1377
 					// _give_payment_total.
1378
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1379
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1378
+					if ( ! empty($meta['_give_payment_total'][0])) {
1379
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1380 1380
 					}
1381 1381
 
1382 1382
 					break;
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 		wp_reset_postdata();
1388 1388
 	} else {
1389 1389
 		// The Update Ran.
1390
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1390
+		give_set_upgrade_complete('v1812_update_amount_values');
1391 1391
 	}
1392 1392
 }
1393 1393
 
@@ -1409,20 +1409,20 @@  discard block
 block discarded – undo
1409 1409
 	$donors = Give()->donors->get_donors(
1410 1410
 		array(
1411 1411
 			'number' => 20,
1412
-			'offset' => $give_updates->get_offset( 20 ),
1412
+			'offset' => $give_updates->get_offset(20),
1413 1413
 		)
1414 1414
 	);
1415 1415
 
1416
-	if ( ! empty( $donors ) ) {
1417
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1416
+	if ( ! empty($donors)) {
1417
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1418 1418
 
1419 1419
 		/* @var Object $donor */
1420
-		foreach ( $donors as $donor ) {
1421
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1420
+		foreach ($donors as $donor) {
1421
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1422 1422
 		}
1423 1423
 	} else {
1424 1424
 		// The Update Ran.
1425
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1425
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1426 1426
 	}
1427 1427
 }
1428 1428
 
@@ -1439,23 +1439,23 @@  discard block
 block discarded – undo
1439 1439
 	$donors = Give()->donors->get_donors(
1440 1440
 		array(
1441 1441
 			'number' => 20,
1442
-			'offset' => $give_updates->get_offset( 20 ),
1442
+			'offset' => $give_updates->get_offset(20),
1443 1443
 		)
1444 1444
 	);
1445 1445
 
1446
-	if ( ! empty( $donors ) ) {
1447
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1446
+	if ( ! empty($donors)) {
1447
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1448 1448
 
1449 1449
 		/* @var Object $donor */
1450
-		foreach ( $donors as $donor ) {
1450
+		foreach ($donors as $donor) {
1451 1451
 			$user_id = $donor->user_id;
1452 1452
 
1453 1453
 			// Proceed, if donor is attached with user.
1454
-			if ( $user_id ) {
1455
-				$user = get_userdata( $user_id );
1454
+			if ($user_id) {
1455
+				$user = get_userdata($user_id);
1456 1456
 
1457 1457
 				// Update user role, if user has subscriber role.
1458
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1458
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1459 1459
 					wp_update_user(
1460 1460
 						array(
1461 1461
 							'ID'   => $user_id,
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 		}
1468 1468
 	} else {
1469 1469
 		// The Update Ran.
1470
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1470
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1471 1471
 	}
1472 1472
 }
1473 1473
 
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
  */
1480 1480
 function give_v1813_upgrades() {
1481 1481
 	// Update admin setting.
1482
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1482
+	give_update_option('donor_default_user_role', 'give_donor');
1483 1483
 
1484 1484
 	// Update Give roles.
1485 1485
 	$roles = new Give_Roles();
@@ -1502,27 +1502,27 @@  discard block
 block discarded – undo
1502 1502
 			'paged'          => $give_updates->step,
1503 1503
 			'status'         => 'any',
1504 1504
 			'order'          => 'ASC',
1505
-			'post_type'      => array( 'give_payment' ),
1505
+			'post_type'      => array('give_payment'),
1506 1506
 			'posts_per_page' => 100,
1507 1507
 		)
1508 1508
 	);
1509 1509
 
1510
-	if ( $payments->have_posts() ) {
1511
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1510
+	if ($payments->have_posts()) {
1511
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1512 1512
 
1513
-		while ( $payments->have_posts() ) {
1513
+		while ($payments->have_posts()) {
1514 1514
 			$payments->the_post();
1515 1515
 
1516
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1516
+			$payment_meta = give_get_payment_meta(get_the_ID());
1517 1517
 
1518
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1518
+			if ('RIAL' === $payment_meta['currency']) {
1519 1519
 				$payment_meta['currency'] = 'IRR';
1520
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1520
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1521 1521
 			}
1522 1522
 		}
1523 1523
 	} else {
1524 1524
 		// The Update Ran.
1525
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1525
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1526 1526
 	}
1527 1527
 }
1528 1528
 
@@ -1535,9 +1535,9 @@  discard block
 block discarded – undo
1535 1535
 function give_v1817_upgrades() {
1536 1536
 	$give_settings = give_get_settings();
1537 1537
 
1538
-	if ( 'RIAL' === $give_settings['currency'] ) {
1538
+	if ('RIAL' === $give_settings['currency']) {
1539 1539
 		$give_settings['currency'] = 'IRR';
1540
-		update_option( 'give_settings', $give_settings, false );
1540
+		update_option('give_settings', $give_settings, false);
1541 1541
 	}
1542 1542
 }
1543 1543
 
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 
1551 1551
 	global $wp_roles;
1552 1552
 
1553
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1553
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1554 1554
 		return;
1555 1555
 	}
1556 1556
 
@@ -1574,15 +1574,15 @@  discard block
 block discarded – undo
1574 1574
 		),
1575 1575
 	);
1576 1576
 
1577
-	foreach ( $add_caps as $role => $caps ) {
1578
-		foreach ( $caps as $cap ) {
1579
-			$wp_roles->add_cap( $role, $cap );
1577
+	foreach ($add_caps as $role => $caps) {
1578
+		foreach ($caps as $cap) {
1579
+			$wp_roles->add_cap($role, $cap);
1580 1580
 		}
1581 1581
 	}
1582 1582
 
1583
-	foreach ( $remove_caps as $role => $caps ) {
1584
-		foreach ( $caps as $cap ) {
1585
-			$wp_roles->remove_cap( $role, $cap );
1583
+	foreach ($remove_caps as $role => $caps) {
1584
+		foreach ($caps as $cap) {
1585
+			$wp_roles->remove_cap($role, $cap);
1586 1586
 		}
1587 1587
 	}
1588 1588
 
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 	$roles->add_roles();
1607 1607
 	$roles->add_caps();
1608 1608
 
1609
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1609
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1610 1610
 }
1611 1611
 
1612 1612
 /**
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 function give_v1818_upgrades() {
1618 1618
 
1619 1619
 	// Remove email_access_installed from give_settings.
1620
-	give_delete_option( 'email_access_installed' );
1620
+	give_delete_option('email_access_installed');
1621 1621
 }
1622 1622
 
1623 1623
 /**
@@ -1635,19 +1635,19 @@  discard block
 block discarded – undo
1635 1635
 			'paged'          => $give_updates->step,
1636 1636
 			'status'         => 'any',
1637 1637
 			'order'          => 'ASC',
1638
-			'post_type'      => array( 'give_payment' ),
1638
+			'post_type'      => array('give_payment'),
1639 1639
 			'posts_per_page' => 100,
1640 1640
 		)
1641 1641
 	);
1642 1642
 
1643
-	if ( $donations->have_posts() ) {
1644
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1643
+	if ($donations->have_posts()) {
1644
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1645 1645
 
1646
-		while ( $donations->have_posts() ) {
1646
+		while ($donations->have_posts()) {
1647 1647
 			$donations->the_post();
1648 1648
 
1649
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1650
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1649
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1650
+			$donation_meta = give_get_payment_meta(get_the_ID());
1651 1651
 
1652 1652
 			// Update Donation meta with price_id set as custom, only if it is:
1653 1653
 			// 1. Donation Type = Set Donation.
@@ -1656,19 +1656,19 @@  discard block
 block discarded – undo
1656 1656
 			if (
1657 1657
 				$form->ID &&
1658 1658
 				$form->is_set_type_donation_form() &&
1659
-				( 'custom' !== $donation_meta['price_id'] ) &&
1660
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1659
+				('custom' !== $donation_meta['price_id']) &&
1660
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1661 1661
 			) {
1662 1662
 				$donation_meta['price_id'] = 'custom';
1663
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1664
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1663
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1664
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1665 1665
 			}
1666 1666
 		}
1667 1667
 
1668 1668
 		wp_reset_postdata();
1669 1669
 	} else {
1670 1670
 		// Update Ran Successfully.
1671
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1671
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1672 1672
 	}
1673 1673
 }
1674 1674
 
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 
1687 1687
 	global $wp_roles;
1688 1688
 
1689
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1689
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1690 1690
 		return;
1691 1691
 	}
1692 1692
 
@@ -1704,9 +1704,9 @@  discard block
 block discarded – undo
1704 1704
 		),
1705 1705
 	);
1706 1706
 
1707
-	foreach ( $remove_caps as $role => $caps ) {
1708
-		foreach ( $caps as $cap ) {
1709
-			$wp_roles->remove_cap( $role, $cap );
1707
+	foreach ($remove_caps as $role => $caps) {
1708
+		foreach ($caps as $cap) {
1709
+			$wp_roles->remove_cap($role, $cap);
1710 1710
 		}
1711 1711
 	}
1712 1712
 
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	$roles->add_roles();
1718 1718
 	$roles->add_caps();
1719 1719
 
1720
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1720
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1721 1721
 }
1722 1722
 
1723 1723
 /**
@@ -1741,15 +1741,15 @@  discard block
 block discarded – undo
1741 1741
 		)
1742 1742
 	);
1743 1743
 
1744
-	if ( $forms->have_posts() ) {
1745
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1744
+	if ($forms->have_posts()) {
1745
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1746 1746
 
1747
-		while ( $forms->have_posts() ) {
1747
+		while ($forms->have_posts()) {
1748 1748
 			$forms->the_post();
1749 1749
 			global $post;
1750 1750
 
1751 1751
 			// Update offline instruction email notification status.
1752
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1752
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1753 1753
 			$offline_instruction_notification_status = give_is_setting_enabled(
1754 1754
 				$offline_instruction_notification_status, array(
1755 1755
 					'enabled',
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 			)
1759 1759
 				? $offline_instruction_notification_status
1760 1760
 				: 'global';
1761
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1761
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1762 1762
 
1763 1763
 			// Update offline instruction email message.
1764 1764
 			update_post_meta(
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 		wp_reset_postdata();
1790 1790
 	} else {
1791 1791
 		// No more forms found, finish up.
1792
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1792
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1793 1793
 	}
1794 1794
 }
1795 1795
 
@@ -1816,19 +1816,19 @@  discard block
 block discarded – undo
1816 1816
 		)
1817 1817
 	);
1818 1818
 
1819
-	if ( $forms->have_posts() ) {
1820
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1819
+	if ($forms->have_posts()) {
1820
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1821 1821
 
1822
-		while ( $forms->have_posts() ) {
1822
+		while ($forms->have_posts()) {
1823 1823
 			$forms->the_post();
1824 1824
 			global $post;
1825 1825
 
1826 1826
 			// Split _give_payment_meta meta.
1827 1827
 			// @todo Remove _give_payment_meta after releases 2.0
1828
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1828
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1829 1829
 
1830
-			if ( ! empty( $payment_meta ) ) {
1831
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1830
+			if ( ! empty($payment_meta)) {
1831
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1832 1832
 			}
1833 1833
 
1834 1834
 			$deprecated_meta_keys = array(
@@ -1837,9 +1837,9 @@  discard block
 block discarded – undo
1837 1837
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1838 1838
 			);
1839 1839
 
1840
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1840
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1841 1841
 				// Do not add new meta key if already exist.
1842
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1842
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1843 1843
 					continue;
1844 1844
 				}
1845 1845
 
@@ -1848,25 +1848,25 @@  discard block
 block discarded – undo
1848 1848
 					array(
1849 1849
 						'post_id'    => $post->ID,
1850 1850
 						'meta_key'   => $new_meta_key,
1851
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1851
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1852 1852
 					)
1853 1853
 				);
1854 1854
 			}
1855 1855
 
1856 1856
 			// Bailout
1857
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1857
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1858 1858
 				/* @var Give_Donor $donor */
1859
-				$donor = new Give_Donor( $donor_id );
1859
+				$donor = new Give_Donor($donor_id);
1860 1860
 
1861
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1862
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1863
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1864
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1865
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1866
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1861
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1862
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1863
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1864
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1865
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1866
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1867 1867
 
1868 1868
 				// Save address.
1869
-				$donor->add_address( 'billing[]', $address );
1869
+				$donor->add_address('billing[]', $address);
1870 1870
 			}
1871 1871
 		}// End while().
1872 1872
 
@@ -1875,7 +1875,7 @@  discard block
 block discarded – undo
1875 1875
 		// @todo Delete user id meta after releases 2.0
1876 1876
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1877 1877
 		// No more forms found, finish up.
1878
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1878
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1879 1879
 	}
1880 1880
 }
1881 1881
 
@@ -1901,20 +1901,20 @@  discard block
 block discarded – undo
1901 1901
 		)
1902 1902
 	);
1903 1903
 
1904
-	if ( $forms->have_posts() ) {
1905
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1904
+	if ($forms->have_posts()) {
1905
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1906 1906
 
1907
-		while ( $forms->have_posts() ) {
1907
+		while ($forms->have_posts()) {
1908 1908
 			$forms->the_post();
1909 1909
 			global $post;
1910 1910
 
1911
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1911
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1912 1912
 				continue;
1913 1913
 			}
1914 1914
 
1915
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1916
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1917
-			$term_name = ! empty( $term ) ? $term->slug : '';
1915
+			$term      = get_the_terms($post->ID, 'give_log_type');
1916
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1917
+			$term_name = ! empty($term) ? $term->slug : '';
1918 1918
 
1919 1919
 			$log_data = array(
1920 1920
 				'ID'           => $post->ID,
@@ -1927,29 +1927,29 @@  discard block
 block discarded – undo
1927 1927
 			);
1928 1928
 			$log_meta = array();
1929 1929
 
1930
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1931
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1932
-					switch ( $meta_key ) {
1930
+			if ($old_log_meta = get_post_meta($post->ID)) {
1931
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1932
+					switch ($meta_key) {
1933 1933
 						case '_give_log_payment_id':
1934
-							$log_data['log_parent']        = current( $meta_value );
1934
+							$log_data['log_parent']        = current($meta_value);
1935 1935
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1936 1936
 							break;
1937 1937
 
1938 1938
 						default:
1939
-							$log_meta[ $meta_key ] = current( $meta_value );
1939
+							$log_meta[$meta_key] = current($meta_value);
1940 1940
 					}
1941 1941
 				}
1942 1942
 			}
1943 1943
 
1944
-			if ( 'api_request' === $term_name ) {
1944
+			if ('api_request' === $term_name) {
1945 1945
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1946 1946
 			}
1947 1947
 
1948
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1948
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1949 1949
 
1950
-			if ( ! empty( $log_meta ) ) {
1951
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1952
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1950
+			if ( ! empty($log_meta)) {
1951
+				foreach ($log_meta as $meta_key => $meta_value) {
1952
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1953 1953
 				}
1954 1954
 			}
1955 1955
 
@@ -1994,7 +1994,7 @@  discard block
 block discarded – undo
1994 1994
 		Give()->logs->delete_cache();
1995 1995
 
1996 1996
 		// No more forms found, finish up.
1997
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1997
+		give_set_upgrade_complete('v20_logs_upgrades');
1998 1998
 	}
1999 1999
 }
2000 2000
 
@@ -2015,15 +2015,15 @@  discard block
 block discarded – undo
2015 2015
 			'paged'          => $give_updates->step,
2016 2016
 			'status'         => 'any',
2017 2017
 			'order'          => 'ASC',
2018
-			'post_type'      => array( 'give_forms', 'give_payment' ),
2018
+			'post_type'      => array('give_forms', 'give_payment'),
2019 2019
 			'posts_per_page' => 100,
2020 2020
 		)
2021 2021
 	);
2022 2022
 
2023
-	if ( $payments->have_posts() ) {
2024
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
2023
+	if ($payments->have_posts()) {
2024
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
2025 2025
 
2026
-		while ( $payments->have_posts() ) {
2026
+		while ($payments->have_posts()) {
2027 2027
 			$payments->the_post();
2028 2028
 			global $post;
2029 2029
 
@@ -2035,19 +2035,19 @@  discard block
 block discarded – undo
2035 2035
 				ARRAY_A
2036 2036
 			);
2037 2037
 
2038
-			if ( ! empty( $meta_data ) ) {
2039
-				foreach ( $meta_data as $index => $data ) {
2038
+			if ( ! empty($meta_data)) {
2039
+				foreach ($meta_data as $index => $data) {
2040 2040
 					// Check for duplicate meta values.
2041
-					if ( $result = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . ' WHERE meta_id=%d', $data['meta_id'] ), ARRAY_A ) ) {
2041
+					if ($result = $wpdb->get_results($wpdb->prepare('SELECT * FROM '.('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta).' WHERE meta_id=%d', $data['meta_id']), ARRAY_A)) {
2042 2042
 						continue;
2043 2043
 					}
2044 2044
 
2045
-					switch ( $post->post_type ) {
2045
+					switch ($post->post_type) {
2046 2046
 						case 'give_forms':
2047 2047
 							$data['form_id'] = $data['post_id'];
2048
-							unset( $data['post_id'] );
2048
+							unset($data['post_id']);
2049 2049
 
2050
-							Give()->form_meta->insert( $data );
2050
+							Give()->form_meta->insert($data);
2051 2051
 							// @todo: delete form meta from post meta table after releases 2.0.
2052 2052
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2053 2053
 
@@ -2055,9 +2055,9 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
 						case 'give_payment':
2057 2057
 							$data['payment_id'] = $data['post_id'];
2058
-							unset( $data['post_id'] );
2058
+							unset($data['post_id']);
2059 2059
 
2060
-							Give()->payment_meta->insert( $data );
2060
+							Give()->payment_meta->insert($data);
2061 2061
 
2062 2062
 							// @todo: delete donation meta from post meta table after releases 2.0.
2063 2063
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
 		wp_reset_postdata();
2072 2072
 	} else {
2073 2073
 		// No more forms found, finish up.
2074
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2074
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2075 2075
 	}
2076 2076
 
2077 2077
 }
@@ -2094,38 +2094,38 @@  discard block
 block discarded – undo
2094 2094
 		)
2095 2095
 	);
2096 2096
 
2097
-	if ( $donors ) {
2098
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2097
+	if ($donors) {
2098
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2099 2099
 		// Loop through Donors
2100
-		foreach ( $donors as $donor ) {
2100
+		foreach ($donors as $donor) {
2101 2101
 
2102
-			$donor_name       = explode( ' ', $donor->name, 2 );
2103
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2104
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2102
+			$donor_name       = explode(' ', $donor->name, 2);
2103
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2104
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2105 2105
 
2106 2106
 			// If first name meta of donor is not created, then create it.
2107
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2108
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2107
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2108
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2109 2109
 			}
2110 2110
 
2111 2111
 			// If last name meta of donor is not created, then create it.
2112
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2113
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2112
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2113
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2114 2114
 			}
2115 2115
 
2116 2116
 			// If Donor is connected with WP User then update user meta.
2117
-			if ( $donor->user_id ) {
2118
-				if ( isset( $donor_name[0] ) ) {
2119
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2117
+			if ($donor->user_id) {
2118
+				if (isset($donor_name[0])) {
2119
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2120 2120
 				}
2121
-				if ( isset( $donor_name[1] ) ) {
2122
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2121
+				if (isset($donor_name[1])) {
2122
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2123 2123
 				}
2124 2124
 			}
2125 2125
 		}
2126 2126
 	} else {
2127 2127
 		// The Update Ran.
2128
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2128
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2129 2129
 	}
2130 2130
 
2131 2131
 }
@@ -2154,15 +2154,15 @@  discard block
 block discarded – undo
2154 2154
 
2155 2155
 	$users = $user_query->get_results();
2156 2156
 
2157
-	if ( $users ) {
2158
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2157
+	if ($users) {
2158
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2159 2159
 
2160 2160
 		// Loop through Donors
2161
-		foreach ( $users as $user ) {
2161
+		foreach ($users as $user) {
2162 2162
 			/* @var Give_Donor $donor */
2163
-			$donor = new Give_Donor( $user->ID, true );
2163
+			$donor = new Give_Donor($user->ID, true);
2164 2164
 
2165
-			if ( ! $donor->id ) {
2165
+			if ( ! $donor->id) {
2166 2166
 				continue;
2167 2167
 			}
2168 2168
 
@@ -2178,10 +2178,10 @@  discard block
 block discarded – undo
2178 2178
 				)
2179 2179
 			);
2180 2180
 
2181
-			if ( ! empty( $address ) ) {
2182
-				$address = maybe_unserialize( $address );
2183
-				$donor->add_address( 'personal', $address );
2184
-				$donor->add_address( 'billing[]', $address );
2181
+			if ( ! empty($address)) {
2182
+				$address = maybe_unserialize($address);
2183
+				$donor->add_address('personal', $address);
2184
+				$donor->add_address('billing[]', $address);
2185 2185
 
2186 2186
 				// @todo: delete _give_user_address from user meta after releases 2.0.
2187 2187
 				/*delete_user_meta( $user->ID, '_give_user_address' );*/
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
 		}
2190 2190
 	} else {
2191 2191
 		// The Update Ran.
2192
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2192
+		give_set_upgrade_complete('v20_upgrades_user_address');
2193 2193
 	}
2194 2194
 
2195 2195
 }
@@ -2213,15 +2213,15 @@  discard block
 block discarded – undo
2213 2213
 	);
2214 2214
 
2215 2215
 	// Alter customer table
2216
-	foreach ( $tables as $old_table => $new_table ) {
2216
+	foreach ($tables as $old_table => $new_table) {
2217 2217
 		if (
2218
-			$wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', $old_table ) ) &&
2219
-			! $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', $new_table ) )
2218
+			$wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', $old_table)) &&
2219
+			! $wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', $new_table))
2220 2220
 		) {
2221
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2221
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2222 2222
 
2223
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2224
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2223
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2224
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2225 2225
 			}
2226 2226
 		}
2227 2227
 	}
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
 	$give_updates->percentage = 100;
2230 2230
 
2231 2231
 	// No more forms found, finish up.
2232
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2232
+	give_set_upgrade_complete('v20_rename_donor_tables');
2233 2233
 
2234 2234
 	// Re initiate donor classes.
2235 2235
 	Give()->donors     = new Give_DB_Donors();
@@ -2247,19 +2247,19 @@  discard block
 block discarded – undo
2247 2247
 function give_v201_create_tables() {
2248 2248
 	global $wpdb;
2249 2249
 
2250
-	if ( ! $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2250
+	if ( ! $wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', "{$wpdb->prefix}give_paymentmeta"))) {
2251 2251
 		Give()->payment_meta->create_table();
2252 2252
 	}
2253 2253
 
2254
-	if ( ! $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', "{$wpdb->prefix}give_formmeta" ) ) ) {
2254
+	if ( ! $wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', "{$wpdb->prefix}give_formmeta"))) {
2255 2255
 		Give()->form_meta->create_table();
2256 2256
 	}
2257 2257
 
2258
-	if ( ! $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', "{$wpdb->prefix}give_logs" ) ) ) {
2258
+	if ( ! $wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', "{$wpdb->prefix}give_logs"))) {
2259 2259
 		Give()->logs->log_db->create_table();
2260 2260
 	}
2261 2261
 
2262
-	if ( ! $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', "{$wpdb->prefix}give_logmeta" ) ) ) {
2262
+	if ( ! $wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', "{$wpdb->prefix}give_logmeta"))) {
2263 2263
 		Give()->logs->logmeta_db->create_table();
2264 2264
 	}
2265 2265
 }
@@ -2284,30 +2284,30 @@  discard block
 block discarded – undo
2284 2284
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2285 2285
 			)
2286 2286
 			AND $wpdb->posts.post_type = 'give_payment'
2287
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2287
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2288 2288
 			ORDER BY $wpdb->posts.post_date ASC 
2289 2289
 			LIMIT 100
2290
-			OFFSET " . $give_updates->get_offset( 100 )
2290
+			OFFSET ".$give_updates->get_offset(100)
2291 2291
 	);
2292 2292
 
2293
-	if ( ! empty( $payments ) ) {
2294
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2293
+	if ( ! empty($payments)) {
2294
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2295 2295
 
2296
-		foreach ( $payments as $payment_id ) {
2297
-			$post = get_post( $payment_id );
2298
-			setup_postdata( $post );
2296
+		foreach ($payments as $payment_id) {
2297
+			$post = get_post($payment_id);
2298
+			setup_postdata($post);
2299 2299
 
2300 2300
 			// Do not add new meta keys if already refactored.
2301
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2301
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2302 2302
 				continue;
2303 2303
 			}
2304 2304
 
2305 2305
 			// Split _give_payment_meta meta.
2306 2306
 			// @todo Remove _give_payment_meta after releases 2.0
2307
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2307
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2308 2308
 
2309
-			if ( ! empty( $payment_meta ) ) {
2310
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2309
+			if ( ! empty($payment_meta)) {
2310
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2311 2311
 			}
2312 2312
 
2313 2313
 			$deprecated_meta_keys = array(
@@ -2316,9 +2316,9 @@  discard block
 block discarded – undo
2316 2316
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2317 2317
 			);
2318 2318
 
2319
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2319
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2320 2320
 				// Do not add new meta key if already exist.
2321
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2321
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2322 2322
 					continue;
2323 2323
 				}
2324 2324
 
@@ -2327,25 +2327,25 @@  discard block
 block discarded – undo
2327 2327
 					array(
2328 2328
 						'post_id'    => $post->ID,
2329 2329
 						'meta_key'   => $new_meta_key,
2330
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2330
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2331 2331
 					)
2332 2332
 				);
2333 2333
 			}
2334 2334
 
2335 2335
 			// Bailout
2336
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2336
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2337 2337
 				/* @var Give_Donor $donor */
2338
-				$donor = new Give_Donor( $donor_id );
2338
+				$donor = new Give_Donor($donor_id);
2339 2339
 
2340
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2341
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2342
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2343
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2344
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2345
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2340
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2341
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2342
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2343
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2344
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2345
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2346 2346
 
2347 2347
 				// Save address.
2348
-				$donor->add_address( 'billing[]', $address );
2348
+				$donor->add_address('billing[]', $address);
2349 2349
 			}
2350 2350
 		}// End while().
2351 2351
 
@@ -2354,7 +2354,7 @@  discard block
 block discarded – undo
2354 2354
 		// @todo Delete user id meta after releases 2.0
2355 2355
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2356 2356
 		// No more forms found, finish up.
2357
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2357
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2358 2358
 	}
2359 2359
 }
2360 2360
 
@@ -2374,13 +2374,13 @@  discard block
 block discarded – undo
2374 2374
 			SELECT ID FROM $wpdb->posts 
2375 2375
 			WHERE 1=1
2376 2376
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2377
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2377
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2378 2378
 			ORDER BY $wpdb->posts.post_date ASC 
2379 2379
 			LIMIT 100
2380
-			OFFSET " . $give_updates->get_offset( 100 )
2380
+			OFFSET ".$give_updates->get_offset(100)
2381 2381
 	);
2382 2382
 
2383
-	if ( ! empty( $payments ) ) {
2383
+	if ( ! empty($payments)) {
2384 2384
 		$give_updates->set_percentage(
2385 2385
 			give_get_total_post_type_count(
2386 2386
 				array(
@@ -2390,9 +2390,9 @@  discard block
 block discarded – undo
2390 2390
 			), $give_updates->step * 100
2391 2391
 		);
2392 2392
 
2393
-		foreach ( $payments as $payment_id ) {
2394
-			$post = get_post( $payment_id );
2395
-			setup_postdata( $post );
2393
+		foreach ($payments as $payment_id) {
2394
+			$post = get_post($payment_id);
2395
+			setup_postdata($post);
2396 2396
 
2397 2397
 			$meta_data = $wpdb->get_results(
2398 2398
 				$wpdb->prepare(
@@ -2402,19 +2402,19 @@  discard block
 block discarded – undo
2402 2402
 				ARRAY_A
2403 2403
 			);
2404 2404
 
2405
-			if ( ! empty( $meta_data ) ) {
2406
-				foreach ( $meta_data as $index => $data ) {
2405
+			if ( ! empty($meta_data)) {
2406
+				foreach ($meta_data as $index => $data) {
2407 2407
 					// Check for duplicate meta values.
2408
-					if ( $result = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . ' WHERE meta_id=%d', $data['meta_id'] ), ARRAY_A ) ) {
2408
+					if ($result = $wpdb->get_results($wpdb->prepare('SELECT * FROM '.('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta).' WHERE meta_id=%d', $data['meta_id']), ARRAY_A)) {
2409 2409
 						continue;
2410 2410
 					}
2411 2411
 
2412
-					switch ( $post->post_type ) {
2412
+					switch ($post->post_type) {
2413 2413
 						case 'give_forms':
2414 2414
 							$data['form_id'] = $data['post_id'];
2415
-							unset( $data['post_id'] );
2415
+							unset($data['post_id']);
2416 2416
 
2417
-							Give()->form_meta->insert( $data );
2417
+							Give()->form_meta->insert($data);
2418 2418
 							// @todo: delete form meta from post meta table after releases 2.0.
2419 2419
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2420 2420
 
@@ -2422,9 +2422,9 @@  discard block
 block discarded – undo
2422 2422
 
2423 2423
 						case 'give_payment':
2424 2424
 							$data['payment_id'] = $data['post_id'];
2425
-							unset( $data['post_id'] );
2425
+							unset($data['post_id']);
2426 2426
 
2427
-							Give()->payment_meta->insert( $data );
2427
+							Give()->payment_meta->insert($data);
2428 2428
 
2429 2429
 							// @todo: delete donation meta from post meta table after releases 2.0.
2430 2430
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 		wp_reset_postdata();
2439 2439
 	} else {
2440 2440
 		// No more forms found, finish up.
2441
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2441
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2442 2442
 	}
2443 2443
 
2444 2444
 }
@@ -2459,26 +2459,26 @@  discard block
 block discarded – undo
2459 2459
 			SELECT ID FROM $wpdb->posts 
2460 2460
 			WHERE 1=1
2461 2461
 			AND $wpdb->posts.post_type = 'give_log'
2462
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2462
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2463 2463
 			ORDER BY $wpdb->posts.post_date ASC 
2464 2464
 			LIMIT 100
2465
-			OFFSET " . $give_updates->get_offset( 100 )
2465
+			OFFSET ".$give_updates->get_offset(100)
2466 2466
 	);
2467 2467
 
2468
-	if ( ! empty( $logs ) ) {
2469
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2468
+	if ( ! empty($logs)) {
2469
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2470 2470
 
2471
-		foreach ( $logs as $log_id ) {
2472
-			$post = get_post( $log_id );
2473
-			setup_postdata( $post );
2471
+		foreach ($logs as $log_id) {
2472
+			$post = get_post($log_id);
2473
+			setup_postdata($post);
2474 2474
 
2475
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2475
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2476 2476
 				continue;
2477 2477
 			}
2478 2478
 
2479
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2480
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2481
-			$term_name = ! empty( $term ) ? $term->slug : '';
2479
+			$term      = get_the_terms($post->ID, 'give_log_type');
2480
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2481
+			$term_name = ! empty($term) ? $term->slug : '';
2482 2482
 
2483 2483
 			$log_data = array(
2484 2484
 				'ID'           => $post->ID,
@@ -2491,29 +2491,29 @@  discard block
 block discarded – undo
2491 2491
 			);
2492 2492
 			$log_meta = array();
2493 2493
 
2494
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2495
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2496
-					switch ( $meta_key ) {
2494
+			if ($old_log_meta = get_post_meta($post->ID)) {
2495
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2496
+					switch ($meta_key) {
2497 2497
 						case '_give_log_payment_id':
2498
-							$log_data['log_parent']        = current( $meta_value );
2498
+							$log_data['log_parent']        = current($meta_value);
2499 2499
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2500 2500
 							break;
2501 2501
 
2502 2502
 						default:
2503
-							$log_meta[ $meta_key ] = current( $meta_value );
2503
+							$log_meta[$meta_key] = current($meta_value);
2504 2504
 					}
2505 2505
 				}
2506 2506
 			}
2507 2507
 
2508
-			if ( 'api_request' === $term_name ) {
2508
+			if ('api_request' === $term_name) {
2509 2509
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2510 2510
 			}
2511 2511
 
2512
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2512
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2513 2513
 
2514
-			if ( ! empty( $log_meta ) ) {
2515
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2516
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2514
+			if ( ! empty($log_meta)) {
2515
+				foreach ($log_meta as $meta_key => $meta_value) {
2516
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2517 2517
 				}
2518 2518
 			}
2519 2519
 
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
 		Give()->logs->delete_cache();
2527 2527
 
2528 2528
 		// No more forms found, finish up.
2529
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2529
+		give_set_upgrade_complete('v201_logs_upgrades');
2530 2530
 	}
2531 2531
 }
2532 2532
 
@@ -2541,51 +2541,51 @@  discard block
 block discarded – undo
2541 2541
 	global $wpdb;
2542 2542
 	give_v201_create_tables();
2543 2543
 
2544
-	if ( $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', "{$wpdb->prefix}give_customers" ) ) ) {
2545
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2546
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2544
+	if ($wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', "{$wpdb->prefix}give_customers"))) {
2545
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2546
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2547 2547
 		$donor_data = array();
2548 2548
 
2549
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2550
-			foreach ( $missing_donors as $donor_id ) {
2549
+		if ($missing_donors = array_diff($customers, $donors)) {
2550
+			foreach ($missing_donors as $donor_id) {
2551 2551
 				$donor_data[] = array(
2552
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2553
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2552
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2553
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2554 2554
 
2555 2555
 				);
2556 2556
 			}
2557 2557
 		}
2558 2558
 
2559
-		if ( ! empty( $donor_data ) ) {
2559
+		if ( ! empty($donor_data)) {
2560 2560
 			$donor_table_name      = Give()->donors->table_name;
2561 2561
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2562 2562
 
2563 2563
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2564 2564
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2565 2565
 
2566
-			foreach ( $donor_data as $donor ) {
2566
+			foreach ($donor_data as $donor) {
2567 2567
 				$donor['info'][0] = (array) $donor['info'][0];
2568 2568
 
2569 2569
 				// Prevent duplicate meta id issue.
2570
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2570
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2571 2571
 					continue;
2572 2572
 				}
2573 2573
 
2574
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2574
+				$donor_id = Give()->donors->add($donor['info'][0]);
2575 2575
 
2576
-				if ( ! empty( $donor['meta'] ) ) {
2577
-					foreach ( $donor['meta'] as $donor_meta ) {
2576
+				if ( ! empty($donor['meta'])) {
2577
+					foreach ($donor['meta'] as $donor_meta) {
2578 2578
 						$donor_meta = (array) $donor_meta;
2579 2579
 
2580 2580
 						// Prevent duplicate meta id issue.
2581
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2582
-							unset( $donor_meta['meta_id'] );
2581
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2582
+							unset($donor_meta['meta_id']);
2583 2583
 						}
2584 2584
 
2585 2585
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2586
-						unset( $donor_meta['customer_id'] );
2586
+						unset($donor_meta['customer_id']);
2587 2587
 
2588
-						Give()->donor_meta->insert( $donor_meta );
2588
+						Give()->donor_meta->insert($donor_meta);
2589 2589
 					}
2590 2590
 				}
2591 2591
 
@@ -2604,35 +2604,35 @@  discard block
 block discarded – undo
2604 2604
 					)
2605 2605
 				);
2606 2606
 
2607
-				$donor = new Give_Donor( $donor_id );
2607
+				$donor = new Give_Donor($donor_id);
2608 2608
 
2609
-				if ( ! empty( $address ) ) {
2610
-					$address = maybe_unserialize( $address );
2611
-					$donor->add_address( 'personal', $address );
2612
-					$donor->add_address( 'billing[]', $address );
2609
+				if ( ! empty($address)) {
2610
+					$address = maybe_unserialize($address);
2611
+					$donor->add_address('personal', $address);
2612
+					$donor->add_address('billing[]', $address);
2613 2613
 				}
2614 2614
 
2615
-				$donor_name       = explode( ' ', $donor->name, 2 );
2616
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2617
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2615
+				$donor_name       = explode(' ', $donor->name, 2);
2616
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2617
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2618 2618
 
2619 2619
 				// If first name meta of donor is not created, then create it.
2620
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2621
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2620
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2621
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2622 2622
 				}
2623 2623
 
2624 2624
 				// If last name meta of donor is not created, then create it.
2625
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2626
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2625
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2626
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2627 2627
 				}
2628 2628
 
2629 2629
 				// If Donor is connected with WP User then update user meta.
2630
-				if ( $donor->user_id ) {
2631
-					if ( isset( $donor_name[0] ) ) {
2632
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2630
+				if ($donor->user_id) {
2631
+					if (isset($donor_name[0])) {
2632
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2633 2633
 					}
2634
-					if ( isset( $donor_name[1] ) ) {
2635
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2634
+					if (isset($donor_name[1])) {
2635
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2636 2636
 					}
2637 2637
 				}
2638 2638
 			}
@@ -2643,7 +2643,7 @@  discard block
 block discarded – undo
2643 2643
 	}
2644 2644
 
2645 2645
 	Give_Updates::get_instance()->percentage = 100;
2646
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2646
+	give_set_upgrade_complete('v201_add_missing_donors');
2647 2647
 }
2648 2648
 
2649 2649
 
@@ -2656,14 +2656,14 @@  discard block
 block discarded – undo
2656 2656
 	global $wpdb;
2657 2657
 
2658 2658
 	// Do not auto load option.
2659
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2659
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2660 2660
 
2661 2661
 	// Remove from cache.
2662 2662
 	$all_options = wp_load_alloptions();
2663 2663
 
2664
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2665
-		unset( $all_options['give_completed_upgrades'] );
2666
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2664
+	if (isset($all_options['give_completed_upgrades'])) {
2665
+		unset($all_options['give_completed_upgrades']);
2666
+		wp_cache_set('alloptions', $all_options, 'options');
2667 2667
 	}
2668 2668
 
2669 2669
 }
@@ -2727,11 +2727,11 @@  discard block
 block discarded – undo
2727 2727
 		"
2728 2728
 	);
2729 2729
 
2730
-	if ( ! empty( $option_like ) ) {
2731
-		$options = array_merge( $options, $option_like );
2730
+	if ( ! empty($option_like)) {
2731
+		$options = array_merge($options, $option_like);
2732 2732
 	}
2733 2733
 
2734
-	$options_str = '\'' . implode( "','", $options ) . '\'';
2734
+	$options_str = '\''.implode("','", $options).'\'';
2735 2735
 
2736 2736
 	$wpdb->query(
2737 2737
 		"
@@ -2755,7 +2755,7 @@  discard block
 block discarded – undo
2755 2755
 	 *
2756 2756
 	 * Change column length
2757 2757
 	 */
2758
-	$wpdb->query( "ALTER TABLE $wpdb->donors MODIFY email varchar(255) NOT NULL" );
2758
+	$wpdb->query("ALTER TABLE $wpdb->donors MODIFY email varchar(255) NOT NULL");
2759 2759
 }
2760 2760
 
2761 2761
 /**
@@ -2778,16 +2778,16 @@  discard block
 block discarded – undo
2778 2778
 		)
2779 2779
 	);
2780 2780
 
2781
-	if ( $donation_forms->have_posts() ) {
2782
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
2781
+	if ($donation_forms->have_posts()) {
2782
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
2783 2783
 
2784
-		while ( $donation_forms->have_posts() ) {
2784
+		while ($donation_forms->have_posts()) {
2785 2785
 			$donation_forms->the_post();
2786 2786
 			$form_id = get_the_ID();
2787 2787
 
2788
-			$form_closed_status = give_get_meta( $form_id, '_give_form_status', true );
2789
-			if ( empty( $form_closed_status ) ) {
2790
-				give_set_form_closed_status( $form_id );
2788
+			$form_closed_status = give_get_meta($form_id, '_give_form_status', true);
2789
+			if (empty($form_closed_status)) {
2790
+				give_set_form_closed_status($form_id);
2791 2791
 			}
2792 2792
 		}
2793 2793
 
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
 	} else {
2798 2798
 
2799 2799
 		// The Update Ran.
2800
-		give_set_upgrade_complete( 'v210_verify_form_status_upgrades' );
2800
+		give_set_upgrade_complete('v210_verify_form_status_upgrades');
2801 2801
 	}
2802 2802
 }
2803 2803
 
@@ -2816,22 +2816,22 @@  discard block
 block discarded – undo
2816 2816
 		SELECT DISTINCT payment_id
2817 2817
 		FROM {$donation_meta_table}
2818 2818
 		LIMIT 20
2819
-		OFFSET {$give_updates->get_offset( 20 )}
2819
+		OFFSET {$give_updates->get_offset(20)}
2820 2820
 		"
2821 2821
 	);
2822 2822
 
2823
-	if ( ! empty( $donations ) ) {
2824
-		foreach ( $donations as $donation ) {
2825
-			$donation_obj = get_post( $donation );
2823
+	if ( ! empty($donations)) {
2824
+		foreach ($donations as $donation) {
2825
+			$donation_obj = get_post($donation);
2826 2826
 
2827
-			if ( ! $donation_obj instanceof WP_Post ) {
2828
-				Give()->payment_meta->delete_all_meta( $donation );
2827
+			if ( ! $donation_obj instanceof WP_Post) {
2828
+				Give()->payment_meta->delete_all_meta($donation);
2829 2829
 			}
2830 2830
 		}
2831 2831
 	} else {
2832 2832
 
2833 2833
 		// The Update Ran.
2834
-		give_set_upgrade_complete( 'v213_delete_donation_meta' );
2834
+		give_set_upgrade_complete('v213_delete_donation_meta');
2835 2835
 	}
2836 2836
 }
2837 2837
 
@@ -2847,16 +2847,16 @@  discard block
 block discarded – undo
2847 2847
 
2848 2848
 	// Check upgrade before running.
2849 2849
 	if (
2850
-		give_has_upgrade_completed( 'v220_rename_donation_meta_type' )
2851
-		|| ! $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', "{$wpdb->prefix}give_paymentmeta" ) )
2850
+		give_has_upgrade_completed('v220_rename_donation_meta_type')
2851
+		|| ! $wpdb->query($wpdb->prepare('SHOW TABLES LIKE %s', "{$wpdb->prefix}give_paymentmeta"))
2852 2852
 	) {
2853 2853
 		return;
2854 2854
 	}
2855 2855
 
2856
-	$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)" );
2857
-	$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta" );
2856
+	$wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)");
2857
+	$wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta");
2858 2858
 
2859
-	give_set_upgrade_complete( 'v220_rename_donation_meta_type' );
2859
+	give_set_upgrade_complete('v220_rename_donation_meta_type');
2860 2860
 }
2861 2861
 
2862 2862
 /**
@@ -2866,10 +2866,10 @@  discard block
 block discarded – undo
2866 2866
  */
2867 2867
 function give_v215_update_donor_user_roles_callback() {
2868 2868
 
2869
-	$role = get_role( 'give_manager' );
2870
-	$role->add_cap( 'view_give_payments' );
2869
+	$role = get_role('give_manager');
2870
+	$role->add_cap('view_give_payments');
2871 2871
 
2872
-	give_set_upgrade_complete( 'v215_update_donor_user_roles' );
2872
+	give_set_upgrade_complete('v215_update_donor_user_roles');
2873 2873
 }
2874 2874
 
2875 2875
 
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
 function give_v220_delete_wp_session_data() {
2885 2885
 	global $wpdb;
2886 2886
 
2887
-	$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" );
2887
+	$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'");
2888 2888
 }
2889 2889
 
2890 2890
 
@@ -2911,19 +2911,19 @@  discard block
 block discarded – undo
2911 2911
 		)
2912 2912
 	);
2913 2913
 
2914
-	if ( $donors ) {
2915
-		$give_updates->set_percentage( $donor_count, $give_updates->step * 100 );
2914
+	if ($donors) {
2915
+		$give_updates->set_percentage($donor_count, $give_updates->step * 100);
2916 2916
 		// Loop through Donors
2917
-		foreach ( $donors as $donor ) {
2918
-			$anonymous_metadata = Give()->donor_meta->get_meta( $donor->id, '_give_anonymous_donor', true );
2917
+		foreach ($donors as $donor) {
2918
+			$anonymous_metadata = Give()->donor_meta->get_meta($donor->id, '_give_anonymous_donor', true);
2919 2919
 
2920 2920
 			// If first name meta of donor is not created, then create it.
2921
-			if ( ! in_array( $anonymous_metadata, array( '0', '1' ) ) ) {
2922
-				Give()->donor_meta->add_meta( $donor->id, '_give_anonymous_donor', '0' );
2921
+			if ( ! in_array($anonymous_metadata, array('0', '1'))) {
2922
+				Give()->donor_meta->add_meta($donor->id, '_give_anonymous_donor', '0');
2923 2923
 			}
2924 2924
 		}
2925 2925
 	} else {
2926 2926
 		// The Update Ran.
2927
-		give_set_upgrade_complete( 'v224_update_donor_meta' );
2927
+		give_set_upgrade_complete('v224_update_donor_meta');
2928 2928
 	}
2929 2929
 }
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +168 added lines, -168 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
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number       = $payment->number;
46 46
 $payment_meta = $payment->get_meta();
47 47
 
48
-$company_name   = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
49
-$transaction_id = esc_attr( $payment->transaction_id );
48
+$company_name   = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : '';
49
+$transaction_id = esc_attr($payment->transaction_id);
50 50
 $user_id        = $payment->user_id;
51 51
 $donor_id       = $payment->customer_id;
52
-$payment_date   = strtotime( $payment->date );
53
-$user_info      = give_get_payment_meta_user_info( $payment_id );
52
+$payment_date   = strtotime($payment->date);
53
+$user_info      = give_get_payment_meta_user_info($payment_id);
54 54
 $address        = $payment->address;
55 55
 $currency_code  = $payment->currency;
56 56
 $gateway        = $payment->gateway;
57 57
 $currency_code  = $payment->currency;
58 58
 $payment_mode   = $payment->mode;
59
-$base_url       = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
59
+$base_url       = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
60 60
 
61 61
 ?>
62 62
 <div class="wrap give-wrap">
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 		<?php
66 66
 		printf(
67 67
 		/* translators: %s: donation number */
68
-			esc_html__( 'Donation %s', 'give' ),
68
+			esc_html__('Donation %s', 'give'),
69 69
 			$number
70 70
 		);
71
-		if ( $payment_mode == 'test' ) {
71
+		if ($payment_mode == 'test') {
72 72
 			echo Give()->tooltips->render_span(array(
73
-				'label' => __( 'This donation was made in test mode.', 'give' ),
74
-				'tag_content' => __( 'Test Donation', 'give' ),
73
+				'label' => __('This donation was made in test mode.', 'give'),
74
+				'tag_content' => __('Test Donation', 'give'),
75 75
 				'position'=> 'right',
76 76
 				'attributes' => array(
77 77
 					'id' => 'test-payment-label',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param int $payment_id Payment id.
92 92
 	 */
93
-	do_action( 'give_view_donation_details_before', $payment_id );
93
+	do_action('give_view_donation_details_before', $payment_id);
94 94
 	?>
95 95
 
96 96
 	<hr class="wp-header-end">
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *
105 105
 		 * @param int $payment_id Payment id.
106 106
 		 */
107
-		do_action( 'give_view_donation_details_form_top', $payment_id );
107
+		do_action('give_view_donation_details_form_top', $payment_id);
108 108
 		?>
109 109
 		<div id="poststuff">
110 110
 			<div id="give-dashboard-widgets-wrap">
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 							 *
121 121
 							 * @param int $payment_id Payment id.
122 122
 							 */
123
-							do_action( 'give_view_donation_details_sidebar_before', $payment_id );
123
+							do_action('give_view_donation_details_sidebar_before', $payment_id);
124 124
 							?>
125 125
 
126 126
 							<div id="give-order-update" class="postbox give-order-data">
127 127
 
128 128
 								<div class="give-order-top">
129
-									<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
129
+									<h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3>
130 130
 
131 131
 									<?php
132
-									if ( current_user_can( 'view_give_payments' ) ) {
132
+									if (current_user_can('view_give_payments')) {
133 133
 										echo sprintf(
134 134
 											'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
135 135
 											$payment_id,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 													), $base_url
142 142
 												), 'give_donation_nonce'
143 143
 											),
144
-											sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
144
+											sprintf(__('Delete Donation %s', 'give'), $payment_id)
145 145
 										);
146 146
 									}
147 147
 									?>
@@ -158,34 +158,34 @@  discard block
 block discarded – undo
158 158
 										 *
159 159
 										 * @param int $payment_id Payment id.
160 160
 										 */
161
-										do_action( 'give_view_donation_details_totals_before', $payment_id );
161
+										do_action('give_view_donation_details_totals_before', $payment_id);
162 162
 										?>
163 163
 
164 164
 										<div class="give-admin-box-inside">
165 165
 											<p>
166
-												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
166
+												<label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label>&nbsp;
167 167
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
168
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
169
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
168
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
169
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
170 170
 													<?php endforeach; ?>
171 171
 												</select>
172
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
172
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
173 173
 											</p>
174 174
 										</div>
175 175
 
176 176
 										<div class="give-admin-box-inside">
177 177
 											<?php $localized_date_format = give_get_localized_date_format_to_js(); ?>
178 178
 											<p>
179
-												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
180
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/>
179
+												<label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label>&nbsp;
180
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/>
181 181
 											</p>
182 182
 										</div>
183 183
 
184 184
 										<div class="give-admin-box-inside">
185 185
 											<p>
186
-												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
187
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
188
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
186
+												<label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label>&nbsp;
187
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
188
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
189 189
 											</p>
190 190
 										</div>
191 191
 
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 										 *
200 200
 										 * @param int $payment_id Payment id.
201 201
 										 */
202
-										do_action( 'give_view_donation_details_update_inner', $payment_id );
202
+										do_action('give_view_donation_details_update_inner', $payment_id);
203 203
 										?>
204 204
 
205 205
 										<div class="give-order-payment give-admin-box-inside">
206 206
 											<p>
207
-												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
208
-												<?php echo give_currency_symbol( $payment->currency ); ?>
209
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
207
+												<label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label>&nbsp;
208
+												<?php echo give_currency_symbol($payment->currency); ?>
209
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
210 210
 											</p>
211 211
 										</div>
212 212
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 										 *
219 219
 										 * @param int $payment_id Payment id.
220 220
 										 */
221
-										do_action( 'give_view_donation_details_totals_after', $payment_id );
221
+										do_action('give_view_donation_details_totals_after', $payment_id);
222 222
 										?>
223 223
 
224 224
 									</div>
@@ -236,26 +236,26 @@  discard block
 block discarded – undo
236 236
 									 *
237 237
 									 * @param int $payment_id Payment id.
238 238
 									 */
239
-									do_action( 'give_view_donation_details_update_before', $payment_id );
239
+									do_action('give_view_donation_details_update_before', $payment_id);
240 240
 									?>
241 241
 
242 242
 									<div id="major-publishing-actions">
243 243
 										<div id="publishing-action">
244
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
244
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
245 245
 											<?php
246
-											if ( give_is_payment_complete( $payment_id ) ) {
246
+											if (give_is_payment_complete($payment_id)) {
247 247
 												$url = add_query_arg(
248 248
 													array(
249 249
 														'give-action' => 'email_links',
250 250
 														'purchase_id' => $payment_id,
251 251
 													),
252
-													admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id )
252
+													admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id)
253 253
 												);
254 254
 
255 255
 												echo sprintf(
256 256
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
257
-													esc_url( $url ),
258
-													esc_html__( 'Resend Receipt', 'give' )
257
+													esc_url($url),
258
+													esc_html__('Resend Receipt', 'give')
259 259
 												);
260 260
 											}
261 261
 											?>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 									 *
271 271
 									 * @param int $payment_id Payment id.
272 272
 									 */
273
-									do_action( 'give_view_donation_details_update_after', $payment_id );
273
+									do_action('give_view_donation_details_update_after', $payment_id);
274 274
 									?>
275 275
 
276 276
 								</div>
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 							<div id="give-order-details" class="postbox give-order-data">
283 283
 
284
-								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
284
+								<h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3>
285 285
 
286 286
 								<div class="inside">
287 287
 									<div class="give-admin-box">
@@ -294,30 +294,30 @@  discard block
 block discarded – undo
294 294
 										 *
295 295
 										 * @param int $payment_id Payment id.
296 296
 										 */
297
-										do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
297
+										do_action('give_view_donation_details_payment_meta_before', $payment_id);
298 298
 
299
-										$gateway = give_get_payment_gateway( $payment_id );
300
-										if ( $gateway ) :
299
+										$gateway = give_get_payment_gateway($payment_id);
300
+										if ($gateway) :
301 301
 											?>
302 302
 											<div class="give-order-gateway give-admin-box-inside">
303 303
 												<p>
304
-													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
305
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
304
+													<strong><?php _e('Gateway:', 'give'); ?></strong>&nbsp;
305
+													<?php echo give_get_gateway_admin_label($gateway); ?>
306 306
 												</p>
307 307
 											</div>
308 308
 										<?php endif; ?>
309 309
 
310 310
 										<div class="give-order-payment-key give-admin-box-inside">
311 311
 											<p>
312
-												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
313
-												<?php echo give_get_payment_key( $payment_id ); ?>
312
+												<strong><?php _e('Key:', 'give'); ?></strong>&nbsp;
313
+												<?php echo give_get_payment_key($payment_id); ?>
314 314
 											</p>
315 315
 										</div>
316 316
 
317 317
 										<div class="give-order-ip give-admin-box-inside">
318 318
 											<p>
319
-												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
320
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
319
+												<strong><?php _e('IP:', 'give'); ?></strong>&nbsp;
320
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
321 321
 											</p>
322 322
 										</div>
323 323
 
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
 										// Display the transaction ID present.
326 326
 										// The transaction ID is the charge ID from the gateway.
327 327
 										// For instance, stripe "ch_BzvwYCchqOy5Nt".
328
-										if ( $transaction_id != $payment_id ) : ?>
328
+										if ($transaction_id != $payment_id) : ?>
329 329
 											<div class="give-order-tx-id give-admin-box-inside">
330 330
 												<p>
331
-													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
332
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
331
+													<strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong>&nbsp;
332
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
333 333
 												</p>
334 334
 											</div>
335 335
 										<?php endif; ?>
336 336
 
337 337
 										<div class="give-admin-box-inside">
338
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
339
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
338
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
339
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor &raquo;', 'give'); ?></a>
340 340
 											</p>
341 341
 										</div>
342 342
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 										 *
349 349
 										 * @param int $payment_id Payment id.
350 350
 										 */
351
-										do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
351
+										do_action('give_view_donation_details_payment_meta_after', $payment_id);
352 352
 										?>
353 353
 
354 354
 									</div>
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 							 *
369 369
 							 * @param int $payment_id Payment id.
370 370
 							 */
371
-							do_action( 'give_view_donation_details_sidebar_after', $payment_id );
371
+							do_action('give_view_donation_details_sidebar_after', $payment_id);
372 372
 							?>
373 373
 
374 374
 						</div>
@@ -388,31 +388,31 @@  discard block
 block discarded – undo
388 388
 							 *
389 389
 							 * @param int $payment_id Payment id.
390 390
 							 */
391
-							do_action( 'give_view_donation_details_main_before', $payment_id );
391
+							do_action('give_view_donation_details_main_before', $payment_id);
392 392
 							?>
393 393
 
394 394
 							<?php $column_count = 'columns-3'; ?>
395 395
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
396
-								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
396
+								<h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3>
397 397
 
398 398
 								<div class="inside">
399 399
 
400 400
 									<div class="column-container">
401 401
 										<div class="column">
402 402
 											<p>
403
-												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
403
+												<strong><?php _e('Donation Form ID:', 'give'); ?></strong><br>
404 404
 												<?php
405
-												if ( $payment_meta['form_id'] ) :
405
+												if ($payment_meta['form_id']) :
406 406
 													printf(
407 407
 														'<a href="%1$s">%2$s</a>',
408
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
408
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
409 409
 														$payment_meta['form_id']
410 410
 													);
411 411
 												endif;
412 412
 												?>
413 413
 											</p>
414 414
 											<p>
415
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
415
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
416 416
 												<?php
417 417
 												echo Give()->html->forms_dropdown(
418 418
 													array(
@@ -428,21 +428,21 @@  discard block
 block discarded – undo
428 428
 										</div>
429 429
 										<div class="column">
430 430
 											<p>
431
-												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
432
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
431
+												<strong><?php _e('Donation Date:', 'give'); ?></strong><br>
432
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
433 433
 											</p>
434 434
 											<p>
435
-												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
435
+												<strong><?php _e('Donation Level:', 'give'); ?></strong><br>
436 436
 												<span class="give-donation-level">
437 437
 													<?php
438
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
439
-													if ( empty( $var_prices ) ) {
440
-														_e( 'n/a', 'give' );
438
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
439
+													if (empty($var_prices)) {
440
+														_e('n/a', 'give');
441 441
 													} else {
442 442
 														$prices_atts = array();
443
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
444
-															foreach ( $variable_prices as $variable_price ) {
445
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
443
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
444
+															foreach ($variable_prices as $variable_price) {
445
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
446 446
 															}
447 447
 														}
448 448
 														// Variable price dropdown options.
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
 															'name'             => 'give-variable-price',
452 452
 															'chosen'           => true,
453 453
 															'show_option_all'  => '',
454
-															'show_option_none' => ( '' === $payment->price_id ? __( 'None', 'give' ) : '' ),
455
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
454
+															'show_option_none' => ('' === $payment->price_id ? __('None', 'give') : ''),
455
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
456 456
 															'selected'         => $payment->price_id,
457 457
 														);
458 458
 														// Render variable prices select tag html.
459
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
459
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
460 460
 													}
461 461
 													?>
462 462
 												</span>
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
 										</div>
465 465
 										<div class="column">
466 466
 											<p>
467
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
468
-												<?php echo give_donation_amount( $payment, true ); ?>
467
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
468
+												<?php echo give_donation_amount($payment, true); ?>
469 469
 											</p>
470 470
 
471
-											<?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ):  ?>
471
+											<?php if (give_is_anonymous_donation_field_enabled($payment->form_id)):  ?>
472 472
 												<div>
473
-													<strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong>
473
+													<strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong>
474 474
 													<ul class="give-radio-inline">
475 475
 														<li>
476 476
 															<label>
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 																	name="give_anonymous_donation"
479 479
 																	value="1"
480 480
 																	type="radio"
481
-																	<?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?>
482
-																><?php _e( 'Yes', 'give' ); ?>
481
+																	<?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?>
482
+																><?php _e('Yes', 'give'); ?>
483 483
 															</label>
484 484
 														</li>
485 485
 														<li>
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 																	name="give_anonymous_donation"
489 489
 																	value="0"
490 490
 																	type="radio"
491
-																	<?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?>
492
-																><?php _e( 'No', 'give' ); ?>
491
+																	<?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?>
492
+																><?php _e('No', 'give'); ?>
493 493
 															</label>
494 494
 														</li>
495 495
 													</ul>
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 												 *
507 507
 												 * @param int $payment_id Payment id.
508 508
 												 */
509
-												do_action( 'give_donation_details_thead_before', $payment_id );
509
+												do_action('give_donation_details_thead_before', $payment_id);
510 510
 
511 511
 
512 512
 												/**
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 												 *
519 519
 												 * @param int $payment_id Payment id.
520 520
 												 */
521
-												do_action( 'give_donation_details_thead_after', $payment_id );
521
+												do_action('give_donation_details_thead_after', $payment_id);
522 522
 
523 523
 												/**
524 524
 												 * Fires in donation details page, in the donation-information metabox, before the body elements.
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 												 *
530 530
 												 * @param int $payment_id Payment id.
531 531
 												 */
532
-												do_action( 'give_donation_details_tbody_before', $payment_id );
532
+												do_action('give_donation_details_tbody_before', $payment_id);
533 533
 
534 534
 												/**
535 535
 												 * Fires in donation details page, in the donation-information metabox, after the body elements.
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 												 *
541 541
 												 * @param int $payment_id Payment id.
542 542
 												 */
543
-												do_action( 'give_donation_details_tbody_after', $payment_id );
543
+												do_action('give_donation_details_tbody_after', $payment_id);
544 544
 												?>
545 545
 											</p>
546 546
 										</div>
@@ -560,66 +560,66 @@  discard block
 block discarded – undo
560 560
 							 *
561 561
 							 * @param int $payment_id Payment id.
562 562
 							 */
563
-							do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
563
+							do_action('give_view_donation_details_donor_detail_before', $payment_id);
564 564
 							?>
565 565
 
566 566
 							<div id="give-donor-details" class="postbox">
567
-								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
567
+								<h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3>
568 568
 
569 569
 								<div class="inside">
570 570
 
571
-									<?php $donor = new Give_Donor( $donor_id ); ?>
571
+									<?php $donor = new Give_Donor($donor_id); ?>
572 572
 
573 573
 									<div class="column-container donor-info">
574 574
 										<div class="column">
575 575
 											<p>
576
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
576
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
577 577
 												<?php
578
-												if ( ! empty( $donor->id ) ) {
578
+												if ( ! empty($donor->id)) {
579 579
 													printf(
580 580
 														'<a href="%1$s">%2$s</a>',
581
-														esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ),
582
-														intval( $donor->id )
581
+														esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)),
582
+														intval($donor->id)
583 583
 													);
584 584
 												}
585 585
 												?>
586
-												<span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span>
586
+												<span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span>
587 587
 											</p>
588 588
 											<p>
589
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
590
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
589
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
590
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
591 591
 											</p>
592 592
 										</div>
593 593
 										<div class="column">
594 594
 											<p>
595
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
595
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
596 596
 												<?php
597
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
598
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
597
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
598
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
599 599
 
600 600
 												// Check whether the donor name and WP_User name is same or not.
601
-												if ( $donor_billing_name !== $donor_name ) {
601
+												if ($donor_billing_name !== $donor_name) {
602 602
 													echo sprintf(
603 603
 														'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
604
-														esc_html( $donor_billing_name ),
605
-														esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
606
-														esc_html( $donor_name )
604
+														esc_html($donor_billing_name),
605
+														esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")),
606
+														esc_html($donor_name)
607 607
 													);
608 608
 												} else {
609
-													echo esc_html( $donor_name );
609
+													echo esc_html($donor_name);
610 610
 												}
611 611
 												?>
612 612
 											</p>
613 613
 											<p>
614
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
614
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
615 615
 												<?php
616 616
 												// Show Donor donation email first and Primary email on parenthesis if not match both email.
617
-												echo hash_equals( $donor->email, $payment->email )
617
+												echo hash_equals($donor->email, $payment->email)
618 618
 													? $payment->email
619 619
 													: sprintf(
620 620
 														'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
621 621
 														$payment->email,
622
-														esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
622
+														esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")),
623 623
 														$donor->email
624 624
 													);
625 625
 												?>
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 										</div>
628 628
 										<div class="column">
629 629
 											<p>
630
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
630
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
631 631
 												<?php
632 632
 												echo Give()->html->donor_dropdown(
633 633
 													array(
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 												?>
639 639
 											</p>
640 640
 											<p>
641
-												<?php if ( ! empty( $company_name ) ) {
641
+												<?php if ( ! empty($company_name)) {
642 642
 													?>
643
-													<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
643
+													<strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br>
644 644
 													<?php
645 645
 													echo $company_name;
646 646
 												} ?>
@@ -651,19 +651,19 @@  discard block
 block discarded – undo
651 651
 									<div class="column-container new-donor" style="display: none">
652 652
 										<div class="column">
653 653
 											<p>
654
-												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
654
+												<label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label>
655 655
 												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
656 656
 											</p>
657 657
 										</div>
658 658
 										<div class="column">
659 659
 											<p>
660
-												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
660
+												<label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label>
661 661
 												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
662 662
 											</p>
663 663
 										</div>
664 664
 										<div class="column">
665 665
 											<p>
666
-												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
666
+												<label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label>
667 667
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
668 668
 											</p>
669 669
 										</div>
@@ -671,9 +671,9 @@  discard block
 block discarded – undo
671 671
 											<p>
672 672
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
673 673
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
674
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
674
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
675 675
 												<br>
676
-												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
676
+												<em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em>
677 677
 											</p>
678 678
 										</div>
679 679
 									</div>
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 									 * @param array $payment_meta Payment meta.
689 689
 									 * @param array $user_info    User information.
690 690
 									 */
691
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
691
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
692 692
 
693 693
 									/**
694 694
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 									 *
698 698
 									 * @param int $payment_id Payment id.
699 699
 									 */
700
-									do_action( 'give_payment_view_details', $payment_id );
700
+									do_action('give_payment_view_details', $payment_id);
701 701
 									?>
702 702
 
703 703
 								</div>
@@ -713,11 +713,11 @@  discard block
 block discarded – undo
713 713
 							 *
714 714
 							 * @param int $payment_id Payment id.
715 715
 							 */
716
-							do_action( 'give_view_donation_details_billing_before', $payment_id );
716
+							do_action('give_view_donation_details_billing_before', $payment_id);
717 717
 							?>
718 718
 
719 719
 							<div id="give-billing-details" class="postbox">
720
-								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
720
+								<h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3>
721 721
 
722 722
 								<div class="inside">
723 723
 
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 											<div class="data column-container">
728 728
 
729 729
 												<?php
730
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
730
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
731 731
 
732
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
732
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
733 733
 
734 734
 												// Get the country list that does not have any states init.
735 735
 												$no_states_country = give_no_states_country_list();
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 
738 738
 												<div class="row">
739 739
 													<div id="give-order-address-country-wrap">
740
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
740
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
741 741
 														<?php
742 742
 														echo Give()->html->select(
743 743
 															array(
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
 																'show_option_all'  => false,
748 748
 																'show_option_none' => false,
749 749
 																'chosen'           => true,
750
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
751
-																'data'             => array( 'search-type' => 'no_ajax' ),
750
+																'placeholder'      => esc_attr__('Select a country', 'give'),
751
+																'data'             => array('search-type' => 'no_ajax'),
752 752
 															)
753 753
 														);
754 754
 														?>
@@ -757,35 +757,35 @@  discard block
 block discarded – undo
757 757
 
758 758
 												<div class="row">
759 759
 													<div class="give-wrap-address-line1">
760
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
761
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
760
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label>
761
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
762 762
 													</div>
763 763
 												</div>
764 764
 
765 765
 												<div class="row">
766 766
 													<div class="give-wrap-address-line2">
767
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
768
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
767
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label>
768
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
769 769
 													</div>
770 770
 												</div>
771 771
 
772 772
 												<div class="row">
773 773
 													<div class="give-wrap-address-city">
774
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
775
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
774
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
775
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
776 776
 													</div>
777 777
 												</div>
778 778
 
779 779
 												<?php
780
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
780
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
781 781
 												?>
782 782
 												<div class="row">
783
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
784
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
785
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
783
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
784
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
785
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
786 786
 															<?php
787
-															$states = give_get_states( $address['country'] );
788
-															if ( ! empty( $states ) ) {
787
+															$states = give_get_states($address['country']);
788
+															if ( ! empty($states)) {
789 789
 																echo Give()->html->select(
790 790
 																	array(
791 791
 																		'options'          => $states,
@@ -794,23 +794,23 @@  discard block
 block discarded – undo
794 794
 																		'show_option_all'  => false,
795 795
 																		'show_option_none' => false,
796 796
 																		'chosen'           => true,
797
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
798
-																		'data'             => array( 'search-type' => 'no_ajax' ),
797
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
798
+																		'data'             => array('search-type' => 'no_ajax'),
799 799
 																	)
800 800
 																);
801 801
 															} else {
802 802
 																?>
803
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
803
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
804 804
 																<?php
805 805
 															}
806 806
 															?>
807 807
 														</div>
808 808
 													</div>
809 809
 
810
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
810
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
811 811
 														<div class="give-wrap-address-zip">
812
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
813
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
812
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
813
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
814 814
 														</div>
815 815
 													</div>
816 816
 												</div>
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 									 *
830 830
 									 * @param int $payment_id Payment id.
831 831
 									 */
832
-									do_action( 'give_payment_billing_details', $payment_id );
832
+									do_action('give_payment_billing_details', $payment_id);
833 833
 									?>
834 834
 
835 835
 								</div>
@@ -845,34 +845,34 @@  discard block
 block discarded – undo
845 845
 							 *
846 846
 							 * @param int $payment_id Payment id.
847 847
 							 */
848
-							do_action( 'give_view_donation_details_billing_after', $payment_id );
848
+							do_action('give_view_donation_details_billing_after', $payment_id);
849 849
 							?>
850 850
 
851 851
 							<div id="give-payment-notes" class="postbox">
852
-								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
852
+								<h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3>
853 853
 
854 854
 								<div class="inside">
855 855
 									<div id="give-payment-notes-inner">
856 856
 										<?php
857
-										$notes = give_get_payment_notes( $payment_id );
858
-										if ( ! empty( $notes ) ) {
857
+										$notes = give_get_payment_notes($payment_id);
858
+										if ( ! empty($notes)) {
859 859
 											$no_notes_display = ' style="display:none;"';
860
-											foreach ( $notes as $note ) :
860
+											foreach ($notes as $note) :
861 861
 
862
-												echo give_get_payment_note_html( $note, $payment_id );
862
+												echo give_get_payment_note_html($note, $payment_id);
863 863
 
864 864
 											endforeach;
865 865
 										} else {
866 866
 											$no_notes_display = '';
867 867
 										}
868 868
 
869
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
869
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
870 870
 										?>
871 871
 									</div>
872 872
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
873 873
 
874 874
 									<div class="give-clearfix">
875
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
875
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
876 876
 									</div>
877 877
 
878 878
 								</div>
@@ -888,18 +888,18 @@  discard block
 block discarded – undo
888 888
 							 *
889 889
 							 * @param int $payment_id Payment id.
890 890
 							 */
891
-							do_action( 'give_view_donation_details_main_after', $payment_id );
891
+							do_action('give_view_donation_details_main_after', $payment_id);
892 892
 							?>
893 893
 
894
-							<?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?>
894
+							<?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?>
895 895
 								<div id="give-payment-donor-comment" class="postbox">
896
-									<h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3>
896
+									<h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3>
897 897
 
898 898
 									<div class="inside">
899 899
 										<div id="give-payment-donor-comment-inner">
900 900
 											<p>
901 901
 												<?php
902
-												$donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id );
902
+												$donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id);
903 903
 
904 904
 												echo sprintf(
905 905
 													'<input type="hidden" name="give_comment_id" value="%s">',
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 
909 909
 												echo sprintf(
910 910
 													'<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>',
911
-													__( 'Add a comment', 'give' ),
911
+													__('Add a comment', 'give'),
912 912
 													$donor_comment instanceof WP_Comment ? $donor_comment->comment_content : ''
913 913
 												);
914 914
 												?>
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 							 *
930 930
 							 * @param int $payment_id Payment id.
931 931
 							 */
932
-							do_action( 'give_view_donation_details_main_after', $payment_id );
932
+							do_action('give_view_donation_details_main_after', $payment_id);
933 933
 							?>
934 934
 
935 935
 						</div>
@@ -951,11 +951,11 @@  discard block
 block discarded – undo
951 951
 		 *
952 952
 		 * @param int $payment_id Payment id.
953 953
 		 */
954
-		do_action( 'give_view_donation_details_form_bottom', $payment_id );
954
+		do_action('give_view_donation_details_form_bottom', $payment_id);
955 955
 
956
-		wp_nonce_field( 'give_update_payment_details_nonce' );
956
+		wp_nonce_field('give_update_payment_details_nonce');
957 957
 		?>
958
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
958
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
959 959
 		<input type="hidden" name="give_action" value="update_payment_details"/>
960 960
 	</form>
961 961
 	<?php
@@ -966,6 +966,6 @@  discard block
 block discarded – undo
966 966
 	 *
967 967
 	 * @param int $payment_id Payment id.
968 968
 	 */
969
-	do_action( 'give_view_donation_details_after', $payment_id );
969
+	do_action('give_view_donation_details_after', $payment_id);
970 970
 	?>
971 971
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/class-give-scripts.php 1 patch
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @since 2.1.0
38 38
 	 */
39 39
 	public function __construct() {
40
-		$this->direction      = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
41
-		$this->scripts_footer = give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ? true : false;
40
+		$this->direction      = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
41
+		$this->scripts_footer = give_is_setting_enabled(give_get_option('scripts_footer')) ? true : false;
42 42
 		$this->init();
43 43
 	}
44 44
 
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function init() {
51 51
 
52
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_styles' ) );
53
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) );
54
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) );
55
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
52
+		add_action('admin_enqueue_scripts', array($this, 'register_styles'));
53
+		add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
54
+		add_action('wp_enqueue_scripts', array($this, 'register_styles'));
55
+		add_action('wp_enqueue_scripts', array($this, 'register_scripts'));
56 56
 
57
-		if ( is_admin() ) {
58
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) );
60
-			add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_admin_scripts' ) );
61
-			add_action( 'admin_head', array( $this, 'global_admin_head' ) );
57
+		if (is_admin()) {
58
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
59
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles'));
60
+			add_action('enqueue_block_editor_assets', array($this, 'gutenberg_admin_scripts'));
61
+			add_action('admin_head', array($this, 'global_admin_head'));
62 62
 
63 63
 		} else {
64
-			add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_styles' ) );
65
-			add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ) );
64
+			add_action('wp_enqueue_scripts', array($this, 'public_enqueue_styles'));
65
+			add_action('wp_enqueue_scripts', array($this, 'public_enqueue_scripts'));
66 66
 		}
67 67
 	}
68 68
 
@@ -74,19 +74,19 @@  discard block
 block discarded – undo
74 74
 	public function register_styles() {
75 75
 
76 76
 		// WP-admin.
77
-		wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', array(), GIVE_VERSION );
77
+		wp_register_style('give-admin-styles', GIVE_PLUGIN_URL.'assets/dist/css/admin'.$this->direction.'.css', array(), GIVE_VERSION);
78 78
 
79 79
 		// WP-admin: plugin page.
80 80
 		wp_register_style(
81 81
 			'plugin-deactivation-survey-css',
82
-			GIVE_PLUGIN_URL . 'assets/dist/css/plugin-deactivation-survey.css',
82
+			GIVE_PLUGIN_URL.'assets/dist/css/plugin-deactivation-survey.css',
83 83
 			array(),
84 84
 			GIVE_VERSION
85 85
 		);
86 86
 
87 87
 		// Frontend.
88
-		if ( give_is_setting_enabled( give_get_option( 'css' ) ) ) {
89
-			wp_register_style( 'give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
88
+		if (give_is_setting_enabled(give_get_option('css'))) {
89
+			wp_register_style('give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all');
90 90
 		}
91 91
 	}
92 92
 
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
 	public function register_scripts() {
99 99
 
100 100
 		// WP-Admin.
101
-		wp_register_script( 'give-admin-scripts', GIVE_PLUGIN_URL . 'assets/dist/js/admin.js', array(
101
+		wp_register_script('give-admin-scripts', GIVE_PLUGIN_URL.'assets/dist/js/admin.js', array(
102 102
 			'jquery',
103 103
 			'jquery-ui-datepicker',
104 104
 			'wp-color-picker',
105 105
 			'jquery-query',
106
-		), GIVE_VERSION );
106
+		), GIVE_VERSION);
107 107
 
108 108
 		// WP-admin: plugin page.
109
-		wp_register_script( 'plugin-deactivation-survey-js',
110
-			GIVE_PLUGIN_URL . 'assets/dist/js/plugin-deactivation-survey.js',
111
-			array( 'jquery' ),
109
+		wp_register_script('plugin-deactivation-survey-js',
110
+			GIVE_PLUGIN_URL.'assets/dist/js/plugin-deactivation-survey.js',
111
+			array('jquery'),
112 112
 			GIVE_VERSION,
113 113
 			true
114 114
 		);
115 115
 
116 116
 		// Frontend.
117
-		wp_register_script( 'give', GIVE_PLUGIN_URL . 'assets/dist/js/give.js', array( 'jquery' ), GIVE_VERSION, $this->scripts_footer );
117
+		wp_register_script('give', GIVE_PLUGIN_URL.'assets/dist/js/give.js', array('jquery'), GIVE_VERSION, $this->scripts_footer);
118 118
 	}
119 119
 
120 120
 	/**
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $hook Page hook.
126 126
 	 */
127
-	public function admin_enqueue_styles( $hook ) {
127
+	public function admin_enqueue_styles($hook) {
128 128
 		// Give Admin Only.
129
-		if ( ! apply_filters( 'give_load_admin_styles', give_is_admin_page(), $hook ) ) {
129
+		if ( ! apply_filters('give_load_admin_styles', give_is_admin_page(), $hook)) {
130 130
 			return;
131 131
 		}
132 132
 
133 133
 		// Give enqueues.
134
-		wp_enqueue_style( 'give-admin-styles' );
135
-		wp_enqueue_style( 'give-admin-bar-notification' );
134
+		wp_enqueue_style('give-admin-styles');
135
+		wp_enqueue_style('give-admin-bar-notification');
136 136
 
137 137
 		// WP Core enqueues.
138
-		wp_enqueue_style( 'wp-color-picker' );
139
-		wp_enqueue_style( 'thickbox' ); // @TODO remove once we have modal API.
138
+		wp_enqueue_style('wp-color-picker');
139
+		wp_enqueue_style('thickbox'); // @TODO remove once we have modal API.
140 140
 
141 141
 	}
142 142
 
@@ -147,27 +147,27 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param string $hook Page hook.
149 149
 	 */
150
-	public function admin_enqueue_scripts( $hook ) {
150
+	public function admin_enqueue_scripts($hook) {
151 151
 		global $pagenow;
152 152
 
153 153
 		// Plugin page script
154
-		if ( 'plugins.php' === $pagenow ) {
154
+		if ('plugins.php' === $pagenow) {
155 155
 			$this->plugin_equeue_scripts();
156 156
 		}
157 157
 
158 158
 		// Give Admin Only.
159
-		if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
159
+		if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
160 160
 			return;
161 161
 		}
162 162
 
163 163
 		// WP Scripts.
164
-		wp_enqueue_script( 'wp-color-picker' );
165
-		wp_enqueue_script( 'jquery-ui-datepicker' );
166
-		wp_enqueue_script( 'thickbox' );
164
+		wp_enqueue_script('wp-color-picker');
165
+		wp_enqueue_script('jquery-ui-datepicker');
166
+		wp_enqueue_script('thickbox');
167 167
 		wp_enqueue_media();
168 168
 
169 169
 		// Give admin scripts.
170
-		wp_enqueue_script( 'give-admin-scripts' );
170
+		wp_enqueue_script('give-admin-scripts');
171 171
 
172 172
 		// Localize admin scripts
173 173
 		$this->admin_localize_scripts();
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
 	 * @access private
181 181
 	 */
182 182
 	private function plugin_equeue_scripts() {
183
-		wp_enqueue_style( 'plugin-deactivation-survey-css' );
184
-		wp_enqueue_script( 'plugin-deactivation-survey-js' );
183
+		wp_enqueue_style('plugin-deactivation-survey-css');
184
+		wp_enqueue_script('plugin-deactivation-survey-js');
185 185
 
186 186
 		$localized_data = array(
187
-			'nonce'                           => wp_create_nonce( 'deactivation_survey_nonce' ),
188
-			'cancel'                          => __( 'Cancel', 'give' ),
189
-			'deactivation_no_option_selected' => __( 'Error: Please select at least one option.', 'give' ),
190
-			'submit_and_deactivate'           => __( 'Submit and Deactivate', 'give' ),
191
-			'skip_and_deactivate'             => __( 'Skip & Deactivate', 'give' ),
192
-			'please_fill_field'               => __( 'Error: Please fill the field.', 'give' ),
187
+			'nonce'                           => wp_create_nonce('deactivation_survey_nonce'),
188
+			'cancel'                          => __('Cancel', 'give'),
189
+			'deactivation_no_option_selected' => __('Error: Please select at least one option.', 'give'),
190
+			'submit_and_deactivate'           => __('Submit and Deactivate', 'give'),
191
+			'skip_and_deactivate'             => __('Skip & Deactivate', 'give'),
192
+			'please_fill_field'               => __('Error: Please fill the field.', 'give'),
193 193
 
194 194
 		);
195 195
 
196
-		wp_localize_script( 'plugin-deactivation-survey-js', 'give_vars', $localized_data );
196
+		wp_localize_script('plugin-deactivation-survey-js', 'give_vars', $localized_data);
197 197
 	}
198 198
 
199 199
 	/**
@@ -210,119 +210,119 @@  discard block
 block discarded – undo
210 210
 
211 211
 		// Localize strings & variables for JS.
212 212
 		$localized_data = array(
213
-			'post_id'                           => isset( $post->ID ) ? $post->ID : null,
213
+			'post_id'                           => isset($post->ID) ? $post->ID : null,
214 214
 			'give_version'                      => GIVE_VERSION,
215 215
 			'thousands_separator'               => $thousand_separator,
216 216
 			'decimal_separator'                 => $decimal_separator,
217
-			'quick_edit_warning'                => __( 'Not available for variable priced forms.', 'give' ),
218
-			'delete_payment'                    => __( 'Are you sure you want to <strong>permanently</strong> delete this donation?', 'give' ),
219
-			'delete_payment_note'               => __( 'Are you sure you want to delete this note?', 'give' ),
220
-			'revoke_api_key'                    => __( 'Are you sure you want to revoke this API key?', 'give' ),
221
-			'regenerate_api_key'                => __( 'Are you sure you want to regenerate this API key?', 'give' ),
222
-			'resend_receipt'                    => __( 'Are you sure you want to resend the donation receipt?', 'give' ),
223
-			'disconnect_user'                   => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
224
-			'one_option'                        => __( 'Choose a form', 'give' ),
225
-			'one_or_more_option'                => __( 'Choose one or more forms', 'give' ),
226
-			'currency_sign'                     => give_currency_filter( '' ),
227
-			'currency_pos'                      => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
217
+			'quick_edit_warning'                => __('Not available for variable priced forms.', 'give'),
218
+			'delete_payment'                    => __('Are you sure you want to <strong>permanently</strong> delete this donation?', 'give'),
219
+			'delete_payment_note'               => __('Are you sure you want to delete this note?', 'give'),
220
+			'revoke_api_key'                    => __('Are you sure you want to revoke this API key?', 'give'),
221
+			'regenerate_api_key'                => __('Are you sure you want to regenerate this API key?', 'give'),
222
+			'resend_receipt'                    => __('Are you sure you want to resend the donation receipt?', 'give'),
223
+			'disconnect_user'                   => __('Are you sure you want to disconnect the user from this donor?', 'give'),
224
+			'one_option'                        => __('Choose a form', 'give'),
225
+			'one_or_more_option'                => __('Choose one or more forms', 'give'),
226
+			'currency_sign'                     => give_currency_filter(''),
227
+			'currency_pos'                      => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
228 228
 			'currency_decimals'                 => give_get_price_decimals(),
229
-			'ok'                                => __( 'Ok', 'give' ),
230
-			'cancel'                            => __( 'Cancel', 'give' ),
231
-			'success'                           => __( 'Success', 'give' ),
232
-			'error'                             => __( 'Error', 'give' ),
233
-			'close'                             => __( 'Close', 'give' ),
234
-			'confirm'                           => __( 'Confirm', 'give' ),
235
-			'confirm_action'                    => __( 'Confirm Action', 'give' ),
236
-			'confirm_deletion'                  => __( 'Confirm Deletion', 'give' ),
237
-			'confirm_delete_donation'           => __( 'Confirm Delete Donation', 'give' ),
238
-			'confirm_resend'                    => __( 'Confirm re-send', 'give' ),
239
-			'confirm_bulk_action'               => __( 'Confirm bulk action', 'give' ),
240
-			'restart_upgrade'                   => __( 'Do you want to restart the update process?', 'give' ),
241
-			'restart_update'                    => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ),
242
-			'stop_upgrade'                      => __( 'Do you want to stop the update process now?', 'give' ),
243
-			'import_failed'                     => __( 'Import failed', 'give' ),
244
-			'flush_success'                     => __( 'Flush success', 'give' ),
245
-			'flush_error'                       => __( 'Flush error', 'give' ),
246
-			'no_form_selected'                  => __( 'No form selected', 'give' ),
247
-			'batch_export_no_class'             => __( 'You must choose a method.', 'give' ),
248
-			'batch_export_no_reqs'              => __( 'Required fields not completed.', 'give' ),
249
-			'reset_stats_warn'                  => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
250
-			'delete_test_donor'                 => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ),
251
-			'delete_import_donor'               => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ),
252
-			'price_format_guide'                => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
229
+			'ok'                                => __('Ok', 'give'),
230
+			'cancel'                            => __('Cancel', 'give'),
231
+			'success'                           => __('Success', 'give'),
232
+			'error'                             => __('Error', 'give'),
233
+			'close'                             => __('Close', 'give'),
234
+			'confirm'                           => __('Confirm', 'give'),
235
+			'confirm_action'                    => __('Confirm Action', 'give'),
236
+			'confirm_deletion'                  => __('Confirm Deletion', 'give'),
237
+			'confirm_delete_donation'           => __('Confirm Delete Donation', 'give'),
238
+			'confirm_resend'                    => __('Confirm re-send', 'give'),
239
+			'confirm_bulk_action'               => __('Confirm bulk action', 'give'),
240
+			'restart_upgrade'                   => __('Do you want to restart the update process?', 'give'),
241
+			'restart_update'                    => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'),
242
+			'stop_upgrade'                      => __('Do you want to stop the update process now?', 'give'),
243
+			'import_failed'                     => __('Import failed', 'give'),
244
+			'flush_success'                     => __('Flush success', 'give'),
245
+			'flush_error'                       => __('Flush error', 'give'),
246
+			'no_form_selected'                  => __('No form selected', 'give'),
247
+			'batch_export_no_class'             => __('You must choose a method.', 'give'),
248
+			'batch_export_no_reqs'              => __('Required fields not completed.', 'give'),
249
+			'reset_stats_warn'                  => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
250
+			'delete_test_donor'                 => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'),
251
+			'delete_import_donor'               => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'),
252
+			'price_format_guide'                => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
253 253
 			/* translators : %s: Donation form options metabox */
254
-			'confirm_before_remove_row_text'    => __( 'Do you want to delete this item?', 'give' ),
255
-			'matched_success_failure_page'      => __( 'You cannot set the success and failed pages to the same page', 'give' ),
256
-			'dismiss_notice_text'               => __( 'Dismiss this notice.', 'give' ),
257
-			'search_placeholder'                => __( 'Type to search all forms', 'give' ),
258
-			'search_placeholder_donor'          => __( 'Type to search all donors', 'give' ),
259
-			'search_placeholder_country'        => __( 'Type to search all countries', 'give' ),
260
-			'search_placeholder_state'          => __( 'Type to search all states/provinces', 'give' ),
261
-			'unlock_donor_fields_title'         => __( 'Action forbidden', 'give' ),
262
-			'unlock_donor_fields_message'       => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ),
263
-			'remove_from_bulk_delete'           => __( 'Remove from Bulk Delete', 'give' ),
254
+			'confirm_before_remove_row_text'    => __('Do you want to delete this item?', 'give'),
255
+			'matched_success_failure_page'      => __('You cannot set the success and failed pages to the same page', 'give'),
256
+			'dismiss_notice_text'               => __('Dismiss this notice.', 'give'),
257
+			'search_placeholder'                => __('Type to search all forms', 'give'),
258
+			'search_placeholder_donor'          => __('Type to search all donors', 'give'),
259
+			'search_placeholder_country'        => __('Type to search all countries', 'give'),
260
+			'search_placeholder_state'          => __('Type to search all states/provinces', 'give'),
261
+			'unlock_donor_fields_title'         => __('Action forbidden', 'give'),
262
+			'unlock_donor_fields_message'       => __('To edit first name and last name, please go to user profile of the donor.', 'give'),
263
+			'remove_from_bulk_delete'           => __('Remove from Bulk Delete', 'give'),
264 264
 			'donors_bulk_action'                => array(
265 265
 				'no_donor_selected'  => array(
266
-					'title' => __( 'No donors selected', 'give' ),
267
-					'desc'  => __( 'You must choose at least one or more donors to delete.', 'give' )
266
+					'title' => __('No donors selected', 'give'),
267
+					'desc'  => __('You must choose at least one or more donors to delete.', 'give')
268 268
 				),
269 269
 				'no_action_selected' => array(
270
-					'title' => __( 'No action selected', 'give' ),
271
-					'desc'  => __( 'You must select a bulk action to proceed.', 'give' ),
270
+					'title' => __('No action selected', 'give'),
271
+					'desc'  => __('You must select a bulk action to proceed.', 'give'),
272 272
 				),
273 273
 			),
274 274
 			'donations_bulk_action'             => array(
275 275
 				'titles'         => array(
276
-					'zero' => __( 'No payments selected', 'give' ),
276
+					'zero' => __('No payments selected', 'give'),
277 277
 				),
278 278
 				'delete'         => array(
279
-					'zero'     => __( 'You must choose at least one or more donations to delete.', 'give' ),
280
-					'single'   => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
281
-					'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
279
+					'zero'     => __('You must choose at least one or more donations to delete.', 'give'),
280
+					'single'   => __('Are you sure you want to permanently delete this donation?', 'give'),
281
+					'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
282 282
 				),
283 283
 				'resend-receipt' => array(
284
-					'zero'     => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
285
-					'single'   => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
286
-					'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
284
+					'zero'     => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
285
+					'single'   => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
286
+					'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
287 287
 				),
288 288
 				'set-to-status'  => array(
289
-					'zero'     => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ),
290
-					'single'   => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ),
291
-					'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ),
289
+					'zero'     => __('You must choose at least one or more donations to set status to {status}.', 'give'),
290
+					'single'   => __('Are you sure you want to set status of this donation to {status}?', 'give'),
291
+					'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'),
292 292
 				),
293 293
 			),
294 294
 			'updates'                           => array(
295
-				'ajax_error' => __( 'Please reload this page and try again', 'give' ),
295
+				'ajax_error' => __('Please reload this page and try again', 'give'),
296 296
 			),
297 297
 			'metabox_fields'                    => array(
298 298
 				'media' => array(
299
-					'button_title' => __( 'Choose Image', 'give' ),
299
+					'button_title' => __('Choose Image', 'give'),
300 300
 				),
301 301
 				'file'  => array(
302
-					'button_title' => __( 'Choose File', 'give' ),
302
+					'button_title' => __('Choose File', 'give'),
303 303
 				),
304 304
 			),
305 305
 			'chosen'                            => array(
306
-				'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
307
-				'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
306
+				'no_results_msg'  => __('No results match {search_term}', 'give'),
307
+				'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
308 308
 			),
309
-			'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ),
310
-			'db_update_confirmation_msg'        => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ),
311
-			'error_message'                     => __( 'Something went wrong kindly try again!', 'give' ),
309
+			'db_update_confirmation_msg_button' => __('Run Updates', 'give'),
310
+			'db_update_confirmation_msg'        => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'),
311
+			'error_message'                     => __('Something went wrong kindly try again!', 'give'),
312 312
 			'give_donation_import'              => 'give_donation_import',
313 313
 			'core_settings_import'              => 'give_core_settings_import',
314
-			'setting_not_save_message'          => __( 'Changes you made may not be saved.', 'give' ),
314
+			'setting_not_save_message'          => __('Changes you made may not be saved.', 'give'),
315 315
 			'give_donation_amounts'             => array(
316
-				'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ),
317
-				'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ),
316
+				'minimum' => apply_filters('give_donation_minimum_limit', 1),
317
+				'maximum' => apply_filters('give_donation_maximum_limit', 999999.99),
318 318
 			),
319
-			'chosen_add_title_prefix'           => __( 'No result found. Press enter to add', 'give' ),
320
-			'db_update_nonce'                   => wp_create_nonce( Give_Updates::$background_updater->get_identifier() ),
319
+			'chosen_add_title_prefix'           => __('No result found. Press enter to add', 'give'),
320
+			'db_update_nonce'                   => wp_create_nonce(Give_Updates::$background_updater->get_identifier()),
321 321
 			'ajax'                              => give_test_ajax_works(),
322 322
 			'date_format'                       => give_get_localized_date_format_to_js(),
323 323
 		);
324 324
 
325
-		wp_localize_script( 'give-admin-scripts', 'give_vars', $localized_data );
325
+		wp_localize_script('give-admin-scripts', 'give_vars', $localized_data);
326 326
 	}
327 327
 
328 328
 	/**
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 		<style type="text/css" media="screen">
334 334
 			@font-face {
335 335
 				font-family: 'give-icomoon';
336
-				src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
337
-				src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
338
-				url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
339
-				url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
336
+				src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
337
+				src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
338
+				url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
339
+				url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
340 340
 				font-weight: normal;
341 341
 				font-style: normal;
342 342
 			}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @since 2.1.0
360 360
 	 */
361 361
 	public function public_enqueue_styles() {
362
-		wp_enqueue_style( 'give-styles' );
362
+		wp_enqueue_style('give-styles');
363 363
 	}
364 364
 
365 365
 
@@ -371,17 +371,17 @@  discard block
 block discarded – undo
371 371
 	public function public_enqueue_scripts() {
372 372
 
373 373
 		// Call Babel Polyfill with common handle so that it is compatible with plugins and themes.
374
-		if ( ! wp_script_is( 'babel-polyfill', 'enqueued' ) ) {
374
+		if ( ! wp_script_is('babel-polyfill', 'enqueued')) {
375 375
 			wp_enqueue_script(
376 376
 				'babel-polyfill',
377
-				GIVE_PLUGIN_URL . 'assets/dist/js/babel-polyfill.js',
378
-				array( 'jquery' ),
377
+				GIVE_PLUGIN_URL.'assets/dist/js/babel-polyfill.js',
378
+				array('jquery'),
379 379
 				GIVE_VERSION,
380 380
 				false
381 381
 			);
382 382
 		}
383 383
 
384
-		wp_enqueue_script( 'give' );
384
+		wp_enqueue_script('give');
385 385
 
386 386
 		$this->public_localize_scripts();
387 387
 	}
@@ -400,22 +400,22 @@  discard block
 block discarded – undo
400 400
 		 *
401 401
 		 * @return  string $message Send notice message for email access.
402 402
 		 */
403
-		$message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
403
+		$message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give'));
404 404
 
405
-		$localize_give_vars = apply_filters( 'give_global_script_vars', array(
405
+		$localize_give_vars = apply_filters('give_global_script_vars', array(
406 406
 			'ajaxurl'                     => give_get_ajax_url(),
407
-			'checkout_nonce'              => wp_create_nonce( 'give_checkout_nonce' ),
407
+			'checkout_nonce'              => wp_create_nonce('give_checkout_nonce'),
408 408
 			// Do not use this nonce. Its deprecated.
409 409
 			'currency'                    => give_get_currency(),
410
-			'currency_sign'               => give_currency_filter( '' ),
410
+			'currency_sign'               => give_currency_filter(''),
411 411
 			'currency_pos'                => give_get_currency_position(),
412 412
 			'thousands_separator'         => give_get_price_thousand_separator(),
413 413
 			'decimal_separator'           => give_get_price_decimal_separator(),
414
-			'no_gateway'                  => __( 'Please select a payment method.', 'give' ),
415
-			'bad_minimum'                 => __( 'The minimum custom donation amount for this form is', 'give' ),
416
-			'bad_maximum'                 => __( 'The maximum custom donation amount for this form is', 'give' ),
417
-			'general_loading'             => __( 'Loading...', 'give' ),
418
-			'purchase_loading'            => __( 'Please Wait...', 'give' ),
414
+			'no_gateway'                  => __('Please select a payment method.', 'give'),
415
+			'bad_minimum'                 => __('The minimum custom donation amount for this form is', 'give'),
416
+			'bad_maximum'                 => __('The maximum custom donation amount for this form is', 'give'),
417
+			'general_loading'             => __('Loading...', 'give'),
418
+			'purchase_loading'            => __('Please Wait...', 'give'),
419 419
 			'number_decimals'             => give_get_price_decimals(),
420 420
 			'give_version'                => GIVE_VERSION,
421 421
 			'magnific_options'            => apply_filters(
@@ -429,32 +429,32 @@  discard block
 block discarded – undo
429 429
 				'give_form_translation_js',
430 430
 				array(
431 431
 					// Field name               Validation message.
432
-					'payment-mode'           => __( 'Please select payment mode.', 'give' ),
433
-					'give_first'             => __( 'Please enter your first name.', 'give' ),
434
-					'give_email'             => __( 'Please enter a valid email address.', 'give' ),
435
-					'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
436
-					'give_user_pass'         => __( 'Enter a password.', 'give' ),
437
-					'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
438
-					'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
432
+					'payment-mode'           => __('Please select payment mode.', 'give'),
433
+					'give_first'             => __('Please enter your first name.', 'give'),
434
+					'give_email'             => __('Please enter a valid email address.', 'give'),
435
+					'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
436
+					'give_user_pass'         => __('Enter a password.', 'give'),
437
+					'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
438
+					'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
439 439
 				)
440 440
 			),
441 441
 			'confirm_email_sent_message'  => $message,
442
-			'ajax_vars'                   => apply_filters( 'give_global_ajax_vars', array(
442
+			'ajax_vars'                   => apply_filters('give_global_ajax_vars', array(
443 443
 				'ajaxurl'         => give_get_ajax_url(),
444
-				'ajaxNonce'       => wp_create_nonce( 'give_ajax_nonce' ),
445
-				'loading'         => __( 'Loading', 'give' ),
444
+				'ajaxNonce'       => wp_create_nonce('give_ajax_nonce'),
445
+				'loading'         => __('Loading', 'give'),
446 446
 				// General loading message.
447
-				'select_option'   => __( 'Please select an option', 'give' ),
447
+				'select_option'   => __('Please select an option', 'give'),
448 448
 				// Variable pricing error with multi-donation option enabled.
449
-				'default_gateway' => give_get_default_gateway( null ),
450
-				'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
449
+				'default_gateway' => give_get_default_gateway(null),
450
+				'permalinks'      => get_option('permalink_structure') ? '1' : '0',
451 451
 				'number_decimals' => give_get_price_decimals(),
452
-			) ),
452
+			)),
453 453
 			'cookie_hash'                 => COOKIEHASH,
454
-			'delete_session_nonce_cookie' => absint( Give()->session->is_delete_nonce_cookie() )
455
-		) );
454
+			'delete_session_nonce_cookie' => absint(Give()->session->is_delete_nonce_cookie())
455
+		));
456 456
 
457
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
457
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
458 458
 
459 459
 	}
460 460
 
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
 	 */
469 469
 	public function get_frontend_stylesheet_uri() {
470 470
 
471
-		$file          = 'give' . $this->direction . '.css';
471
+		$file          = 'give'.$this->direction.'.css';
472 472
 		$templates_dir = give_get_theme_template_dir_name();
473 473
 
474 474
 		// Directory paths to CSS files to support checking via file_exists().
475
-		$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
476
-		$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
477
-		$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
478
-		$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
479
-		$give_plugin_style_sheet    = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file;
475
+		$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
476
+		$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css';
477
+		$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
478
+		$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css';
479
+		$give_plugin_style_sheet    = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file;
480 480
 		$uri                        = false;
481 481
 
482 482
 		/**
@@ -487,23 +487,23 @@  discard block
 block discarded – undo
487 487
 		 * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme.
488 488
 		 * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin.
489 489
 		 */
490
-		if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
491
-			if ( ! empty( $nonmin ) ) {
492
-				$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css';
490
+		if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
491
+			if ( ! empty($nonmin)) {
492
+				$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css';
493 493
 			} else {
494
-				$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
494
+				$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
495 495
 			}
496
-		} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
497
-			if ( ! empty( $nonmin ) ) {
498
-				$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css';
496
+		} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
497
+			if ( ! empty($nonmin)) {
498
+				$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css';
499 499
 			} else {
500
-				$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
500
+				$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
501 501
 			}
502
-		} elseif ( file_exists( $give_plugin_style_sheet ) ) {
503
-			$uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file;
502
+		} elseif (file_exists($give_plugin_style_sheet)) {
503
+			$uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file;
504 504
 		}
505 505
 
506
-		return apply_filters( 'give_get_stylesheet_uri', $uri );
506
+		return apply_filters('give_get_stylesheet_uri', $uri);
507 507
 
508 508
 	}
509 509
 
@@ -515,18 +515,18 @@  discard block
 block discarded – undo
515 515
 		// Enqueue the bundled block JS file
516 516
 		wp_enqueue_script(
517 517
 			'give-blocks-js',
518
-			GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js',
519
-			array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ),
518
+			GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js',
519
+			array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'),
520 520
 			GIVE_VERSION
521 521
 		);
522 522
 
523 523
 		// Enqueue public styles
524
-		wp_enqueue_style( 'give-styles' );
524
+		wp_enqueue_style('give-styles');
525 525
 
526 526
 		// Enqueue the bundled block css file
527 527
 		wp_enqueue_style(
528 528
 			'give-blocks-css',
529
-			GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css',
529
+			GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css',
530 530
 			array( ),
531 531
 			GIVE_VERSION
532 532
 		);
Please login to merge, or discard this patch.
includes/class-give-db.php 1 patch
Spacing   +67 added lines, -67 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
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @access public
73 73
 	 */
74 74
 	public function __construct() {
75
-		if( is_multisite() ) {
76
-			add_action( 'switch_blog', array( $this, 'handle_switch_blog' ), 10, 2 );
75
+		if (is_multisite()) {
76
+			add_action('switch_blog', array($this, 'handle_switch_blog'), 10, 2);
77 77
 		}
78 78
 	}
79 79
 
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return object
113 113
 	 */
114
-	public function get( $row_id ) {
114
+	public function get($row_id) {
115 115
 		/* @var WPDB $wpdb */
116 116
 		global $wpdb;
117 117
 
118 118
 		// Bailout.
119
-		if ( empty( $row_id ) ) {
119
+		if (empty($row_id)) {
120 120
 			return null;
121 121
 		}
122 122
 
123
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
123
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
124 124
 	}
125 125
 
126 126
 	/**
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return object
136 136
 	 */
137
-	public function get_by( $column, $row_id ) {
137
+	public function get_by($column, $row_id) {
138 138
 		/* @var WPDB $wpdb */
139 139
 		global $wpdb;
140 140
 
141 141
 		// Bailout.
142
-		if ( empty( $column ) || empty( $row_id ) ) {
142
+		if (empty($column) || empty($row_id)) {
143 143
 			return null;
144 144
 		}
145 145
 
146
-		$column = esc_sql( $column );
146
+		$column = esc_sql($column);
147 147
 
148
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
148
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
149 149
 	}
150 150
 
151 151
 	/**
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @return array
161 161
 	 */
162
-	public function get_results_by( $column_args ) {
162
+	public function get_results_by($column_args) {
163 163
 		/* @var WPDB $wpdb */
164 164
 		global $wpdb;
165 165
 
166 166
 		// Bailout.
167
-		if ( empty( $column_args ) ) {
167
+		if (empty($column_args)) {
168 168
 			return null;
169 169
 		}
170 170
 
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 		unset($column_args['relation']);
180 180
 
181 181
 		$where = array();
182
-		foreach ( $column_args as $column_name => $column_value ) {
183
-			$where[] = esc_sql( $column_name ) . "='$column_value'";
182
+		foreach ($column_args as $column_name => $column_value) {
183
+			$where[] = esc_sql($column_name)."='$column_value'";
184 184
 		}
185
-		$where = implode( " {$relation} ", $where );
185
+		$where = implode(" {$relation} ", $where);
186 186
 
187
-		return $wpdb->get_results( "SELECT * FROM {$this->table_name} WHERE {$where};" );
187
+		return $wpdb->get_results("SELECT * FROM {$this->table_name} WHERE {$where};");
188 188
 	}
189 189
 
190 190
 	/**
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return string      Column value.
200 200
 	 */
201
-	public function get_column( $column, $row_id ) {
201
+	public function get_column($column, $row_id) {
202 202
 		/* @var WPDB $wpdb */
203 203
 		global $wpdb;
204 204
 
205 205
 		// Bailout.
206
-		if ( empty( $column ) || empty( $row_id ) ) {
206
+		if (empty($column) || empty($row_id)) {
207 207
 			return null;
208 208
 		}
209 209
 
210
-		$column = esc_sql( $column );
210
+		$column = esc_sql($column);
211 211
 
212
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
212
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
213 213
 	}
214 214
 
215 215
 	/**
@@ -224,19 +224,19 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return string
226 226
 	 */
227
-	public function get_column_by( $column, $column_where, $column_value ) {
227
+	public function get_column_by($column, $column_where, $column_value) {
228 228
 		/* @var WPDB $wpdb */
229 229
 		global $wpdb;
230 230
 
231 231
 		// Bailout.
232
-		if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) {
232
+		if (empty($column) || empty($column_where) || empty($column_value)) {
233 233
 			return null;
234 234
 		}
235 235
 
236
-		$column_where = esc_sql( $column_where );
237
-		$column       = esc_sql( $column );
236
+		$column_where = esc_sql($column_where);
237
+		$column       = esc_sql($column);
238 238
 
239
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
239
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
240 240
 	}
241 241
 
242 242
 	/**
@@ -250,12 +250,12 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return int
252 252
 	 */
253
-	public function insert( $data, $type = '' ) {
253
+	public function insert($data, $type = '') {
254 254
 		/* @var WPDB $wpdb */
255 255
 		global $wpdb;
256 256
 
257 257
 		// Set default values.
258
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
258
+		$data = wp_parse_args($data, $this->get_column_defaults());
259 259
 
260 260
 		/**
261 261
 		 * Fires before inserting data to the database.
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		 *
265 265
 		 * @param array $data
266 266
 		 */
267
-		do_action( "give_pre_insert_{$type}", $data );
267
+		do_action("give_pre_insert_{$type}", $data);
268 268
 
269 269
 		// Initialise column format array
270 270
 		$column_formats = $this->get_columns();
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 		// $data = array_change_key_case( $data );
274 274
 
275 275
 		// White list columns
276
-		$data = array_intersect_key( $data, $column_formats );
276
+		$data = array_intersect_key($data, $column_formats);
277 277
 
278 278
 		// Reorder $column_formats to match the order of columns given in $data
279
-		$data_keys      = array_keys( $data );
280
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
279
+		$data_keys      = array_keys($data);
280
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
281 281
 
282
-		$wpdb->insert( $this->table_name, $data, $column_formats );
282
+		$wpdb->insert($this->table_name, $data, $column_formats);
283 283
 
284 284
 		/**
285 285
 		 * Fires after inserting data to the database.
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		 * @param int   $insert_id
290 290
 		 * @param array $data
291 291
 		 */
292
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
292
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
293 293
 
294 294
 		return $wpdb->insert_id;
295 295
 	}
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @return bool
308 308
 	 */
309
-	public function update( $row_id, $data = array(), $where = '' ) {
309
+	public function update($row_id, $data = array(), $where = '') {
310 310
 		/* @var WPDB $wpdb */
311 311
 		global $wpdb;
312 312
 
313 313
 		// Row ID must be positive integer
314
-		$row_id = absint( $row_id );
314
+		$row_id = absint($row_id);
315 315
 
316
-		if ( empty( $row_id ) ) {
316
+		if (empty($row_id)) {
317 317
 			return false;
318 318
 		}
319 319
 
320
-		if ( empty( $where ) ) {
320
+		if (empty($where)) {
321 321
 			$where = $this->primary_key;
322 322
 		}
323 323
 
@@ -325,16 +325,16 @@  discard block
 block discarded – undo
325 325
 		$column_formats = $this->get_columns();
326 326
 
327 327
 		// Force fields to lower case
328
-		$data = array_change_key_case( $data );
328
+		$data = array_change_key_case($data);
329 329
 
330 330
 		// White list columns
331
-		$data = array_intersect_key( $data, $column_formats );
331
+		$data = array_intersect_key($data, $column_formats);
332 332
 
333 333
 		// Reorder $column_formats to match the order of columns given in $data
334
-		$data_keys      = array_keys( $data );
335
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
334
+		$data_keys      = array_keys($data);
335
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
336 336
 
337
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
337
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
338 338
 			return false;
339 339
 		}
340 340
 
@@ -351,18 +351,18 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return bool
353 353
 	 */
354
-	public function delete( $row_id = 0 ) {
354
+	public function delete($row_id = 0) {
355 355
 		/* @var WPDB $wpdb */
356 356
 		global $wpdb;
357 357
 
358 358
 		// Row ID must be positive integer
359
-		$row_id = absint( $row_id );
359
+		$row_id = absint($row_id);
360 360
 
361
-		if ( empty( $row_id ) ) {
361
+		if (empty($row_id)) {
362 362
 			return false;
363 363
 		}
364 364
 
365
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
365
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
366 366
 			return false;
367 367
 		}
368 368
 
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
379 379
 	 *
380 380
 	 * @return bool          If the table name exists.
381 381
 	 */
382
-	public function table_exists( $table ) {
382
+	public function table_exists($table) {
383 383
 		/* @var WPDB $wpdb */
384 384
 		global $wpdb;
385 385
 
386
-		$table = sanitize_text_field( $table );
386
+		$table = sanitize_text_field($table);
387 387
 
388
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
388
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
389 389
 	}
390 390
 
391 391
 	/**
@@ -399,16 +399,16 @@  discard block
 block discarded – undo
399 399
 	 *
400 400
 	 * @return bool
401 401
 	 */
402
-	public function does_column_exist( $column_name ) {
402
+	public function does_column_exist($column_name) {
403 403
 
404 404
 		global $wpdb;
405 405
 
406
-		$column = $wpdb->get_results( $wpdb->prepare(
406
+		$column = $wpdb->get_results($wpdb->prepare(
407 407
 			"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ",
408 408
 			DB_NAME, $this->table_name, $column_name
409
-		) );
409
+		));
410 410
 
411
-		if ( ! empty( $column ) ) {
411
+		if ( ! empty($column)) {
412 412
 			return true;
413 413
 		}
414 414
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
425 425
 	 */
426 426
 	public function installed() {
427
-		return $this->table_exists( $this->table_name );
427
+		return $this->table_exists($this->table_name);
428 428
 	}
429 429
 
430 430
 	/**
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @access public
435 435
 	 */
436 436
 	public function register_table() {
437
-		$current_version = get_option( $this->table_name . '_db_version' );
438
-		if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) {
437
+		$current_version = get_option($this->table_name.'_db_version');
438
+		if ( ! $current_version || version_compare($current_version, $this->version, '<')) {
439 439
 			$this->create_table();
440 440
 		}
441 441
 	}
@@ -460,23 +460,23 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @return int|bool                The normalized log ID or false if it's found to not be valid.
462 462
 	 */
463
-	public function sanitize_id( $id ) {
464
-		if ( ! is_numeric( $id ) ) {
463
+	public function sanitize_id($id) {
464
+		if ( ! is_numeric($id)) {
465 465
 			return false;
466 466
 		}
467 467
 
468 468
 		$id = (int) $id;
469 469
 
470 470
 		// We were given a non positive number.
471
-		if ( absint( $id ) !== $id ) {
471
+		if (absint($id) !== $id) {
472 472
 			return false;
473 473
 		}
474 474
 
475
-		if ( empty( $id ) ) {
475
+		if (empty($id)) {
476 476
 			return false;
477 477
 		}
478 478
 
479
-		return absint( $id );
479
+		return absint($id);
480 480
 
481 481
 	}
482 482
 
@@ -490,23 +490,23 @@  discard block
 block discarded – undo
490 490
 	 * @param $new_blog_id
491 491
 	 * @param $prev_blog_id
492 492
 	 */
493
-	public function handle_switch_blog( $new_blog_id, $prev_blog_id ) {
493
+	public function handle_switch_blog($new_blog_id, $prev_blog_id) {
494 494
 		global $wpdb;
495 495
 
496 496
 		// Bailout.
497
-		if ( $new_blog_id === $prev_blog_id ) {
497
+		if ($new_blog_id === $prev_blog_id) {
498 498
 			return;
499 499
 		}
500 500
 
501 501
 
502 502
 		$this->table_name = str_replace(
503
-			1 != $prev_blog_id ? $wpdb->get_blog_prefix( $prev_blog_id ) : $wpdb->base_prefix,
504
-			1 != $new_blog_id ? $wpdb->get_blog_prefix( $new_blog_id ) : $wpdb->base_prefix,
503
+			1 != $prev_blog_id ? $wpdb->get_blog_prefix($prev_blog_id) : $wpdb->base_prefix,
504
+			1 != $new_blog_id ? $wpdb->get_blog_prefix($new_blog_id) : $wpdb->base_prefix,
505 505
 			$this->table_name
506 506
 		);
507 507
 
508
-		if ( $this instanceof Give_DB_Meta ) {
509
-			$wpdb->{$this->get_meta_type() . 'meta'} = $this->table_name;
508
+		if ($this instanceof Give_DB_Meta) {
509
+			$wpdb->{$this->get_meta_type().'meta'} = $this->table_name;
510 510
 		}
511 511
 
512 512
 	}
Please login to merge, or discard this patch.
includes/donors/class-give-donors-query.php 1 patch
Spacing   +74 added lines, -74 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
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
88 88
 	 */
89
-	public function __construct( $args = array() ) {
89
+	public function __construct($args = array()) {
90 90
 		$defaults = array(
91 91
 			'number'          => 20,
92 92
 			'offset'          => 0,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			// 'form'       => array(),
117 117
 		);
118 118
 
119
-		$this->args            = wp_parse_args( $args, $defaults );
119
+		$this->args            = wp_parse_args($args, $defaults);
120 120
 		$this->table_name      = Give()->donors->table_name;
121 121
 		$this->meta_table_name = Give()->donor_meta->table_name;
122 122
 		$this->meta_type       = Give()->donor_meta->meta_type;
@@ -158,21 +158,21 @@  discard block
 block discarded – undo
158 158
 		 *
159 159
 		 * @param Give_Donors_Query $this Donors query object.
160 160
 		 */
161
-		do_action( 'give_pre_get_donors', $this );
161
+		do_action('give_pre_get_donors', $this);
162 162
 
163
-		$cache_key = Give_Cache::get_key( 'give_donor', $this->get_sql(), false );
163
+		$cache_key = Give_Cache::get_key('give_donor', $this->get_sql(), false);
164 164
 
165 165
 		// Get donors from cache.
166
-		$this->donors = Give_Cache::get_db_query( $cache_key );
166
+		$this->donors = Give_Cache::get_db_query($cache_key);
167 167
 
168
-		if ( is_null( $this->donors ) ) {
169
-			if ( empty( $this->args['count'] ) ) {
170
-				$this->donors = $wpdb->get_results( $this->get_sql() );
168
+		if (is_null($this->donors)) {
169
+			if (empty($this->args['count'])) {
170
+				$this->donors = $wpdb->get_results($this->get_sql());
171 171
 			} else {
172
-				$this->donors = $wpdb->get_var( $this->get_sql() );
172
+				$this->donors = $wpdb->get_var($this->get_sql());
173 173
 			}
174 174
 
175
-			Give_Cache::set_db_query( $cache_key, $this->donors );
175
+			Give_Cache::set_db_query($cache_key, $this->donors);
176 176
 		}
177 177
 
178 178
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		 *
184 184
 		 * @param Give_Donors_Query $this Donors query object.
185 185
 		 */
186
-		do_action( 'give_post_get_donors', $this );
186
+		do_action('give_post_get_donors', $this);
187 187
 
188 188
 		return $this->donors;
189 189
 	}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	public function get_sql() {
201 201
 		global $wpdb;
202 202
 
203
-		if ( $this->args['number'] < 1 ) {
203
+		if ($this->args['number'] < 1) {
204 204
 			$this->args['number'] = 99999999999;
205 205
 		}
206 206
 
@@ -208,32 +208,32 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		// Set offset.
211
-		if ( empty( $this->args['offset'] ) && ( 0 < $this->args['paged'] ) ) {
212
-			$this->args['offset'] = $this->args['number'] * ( $this->args['paged'] - 1 );
211
+		if (empty($this->args['offset']) && (0 < $this->args['paged'])) {
212
+			$this->args['offset'] = $this->args['number'] * ($this->args['paged'] - 1);
213 213
 		}
214 214
 
215 215
 		// Set fields.
216 216
 		$fields = "{$this->table_name}.*";
217
-		if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) {
218
-			if ( is_string( $this->args['fields'] ) ) {
217
+		if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) {
218
+			if (is_string($this->args['fields'])) {
219 219
 				$fields = "{$this->table_name}.{$this->args['fields']}";
220
-			} elseif ( is_array( $this->args['fields'] ) ) {
221
-				$fields = "{$this->table_name}." . implode( " , {$this->table_name}.", $this->args['fields'] );
220
+			} elseif (is_array($this->args['fields'])) {
221
+				$fields = "{$this->table_name}.".implode(" , {$this->table_name}.", $this->args['fields']);
222 222
 			}
223 223
 		}
224 224
 
225 225
 		// Set count.
226
-		if ( ! empty( $this->args['count'] ) ) {
226
+		if ( ! empty($this->args['count'])) {
227 227
 			$fields = "COUNT({$this->table_name}.id)";
228 228
 		}
229 229
 
230 230
 		$orderby = $this->get_order_query();
231 231
 
232
-		$sql = $wpdb->prepare( "SELECT {$fields} FROM {$this->table_name} LIMIT %d,%d;", absint( $this->args['offset'] ), absint( $this->args['number'] ) );
232
+		$sql = $wpdb->prepare("SELECT {$fields} FROM {$this->table_name} LIMIT %d,%d;", absint($this->args['offset']), absint($this->args['number']));
233 233
 
234 234
 		// $where, $orderby and order already prepared query they can generate notice if you re prepare them in above.
235 235
 		// WordPress consider LIKE condition as placeholder if start with s,f, or d.
236
-		$sql = str_replace( 'LIMIT', "{$where} {$orderby} LIMIT", $sql );
236
+		$sql = str_replace('LIMIT', "{$where} {$orderby} LIMIT", $sql);
237 237
 
238 238
 		return $sql;
239 239
 	}
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 	private function get_where_query() {
251 251
 
252 252
 		// Get sql query for meta.
253
-		if ( ! empty( $this->args['meta_query'] ) ) {
254
-			$meta_query_object = new WP_Meta_Query( $this->args['meta_query'] );
255
-			$meta_query        = $meta_query_object->get_sql( $this->meta_type, $this->table_name, 'id' );
253
+		if ( ! empty($this->args['meta_query'])) {
254
+			$meta_query_object = new WP_Meta_Query($this->args['meta_query']);
255
+			$meta_query        = $meta_query_object->get_sql($this->meta_type, $this->table_name, 'id');
256 256
 
257
-			$where[] = implode( '', $meta_query );
257
+			$where[] = implode('', $meta_query);
258 258
 		}
259 259
 
260 260
 		$where[] = 'WHERE 1=1';
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 		$where[] = $this->get_where_donation_count();
268 268
 		$where[] = $this->get_where_give_forms();
269 269
 
270
-		$where = array_filter( $where );
270
+		$where = array_filter($where);
271 271
 
272
-		return trim( implode( ' ', array_map( 'trim', $where ) ) );
272
+		return trim(implode(' ', array_map('trim', $where)));
273 273
 
274 274
 	}
275 275
 
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$where = '';
289 289
 
290
-		if ( ! empty( $this->args['email'] ) ) {
290
+		if ( ! empty($this->args['email'])) {
291 291
 
292
-			if ( is_array( $this->args['email'] ) ) {
292
+			if (is_array($this->args['email'])) {
293 293
 
294
-				$emails_count       = count( $this->args['email'] );
295
-				$emails_placeholder = array_fill( 0, $emails_count, '%s' );
296
-				$emails             = implode( ', ', $emails_placeholder );
294
+				$emails_count       = count($this->args['email']);
295
+				$emails_placeholder = array_fill(0, $emails_count, '%s');
296
+				$emails             = implode(', ', $emails_placeholder);
297 297
 
298
-				$where .= $wpdb->prepare( "AND {$this->table_name}.email IN( $emails )", $this->args['email'] );
298
+				$where .= $wpdb->prepare("AND {$this->table_name}.email IN( $emails )", $this->args['email']);
299 299
 			} else {
300
-				$where .= $wpdb->prepare( "AND {$this->table_name}.email = %s", $this->args['email'] );
300
+				$where .= $wpdb->prepare("AND {$this->table_name}.email = %s", $this->args['email']);
301 301
 			}
302 302
 		}
303 303
 
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 		$where = '';
318 318
 
319 319
 		// Specific donors.
320
-		if ( ! empty( $this->args['donor'] ) ) {
321
-			if ( ! is_array( $this->args['donor'] ) ) {
322
-				$this->args['donor'] = explode( ',', $this->args['donor'] );
320
+		if ( ! empty($this->args['donor'])) {
321
+			if ( ! is_array($this->args['donor'])) {
322
+				$this->args['donor'] = explode(',', $this->args['donor']);
323 323
 			}
324
-			$donor_ids = implode( ',', array_map( 'intval', $this->args['donor'] ) );
324
+			$donor_ids = implode(',', array_map('intval', $this->args['donor']));
325 325
 
326 326
 			$where .= "AND {$this->table_name}.id IN( {$donor_ids} )";
327 327
 		}
@@ -342,10 +342,10 @@  discard block
 block discarded – undo
342 342
 		$where = '';
343 343
 
344 344
 		// Donors created for a specific date or in a date range
345
-		if ( ! empty( $this->args['date_query'] ) ) {
346
-			$date_query_object = new WP_Date_Query( is_array( $this->args['date_query'] ) ? $this->args['date_query'] : wp_parse_args( $this->args['date_query'] ), "{$this->table_name}.date_created" );
345
+		if ( ! empty($this->args['date_query'])) {
346
+			$date_query_object = new WP_Date_Query(is_array($this->args['date_query']) ? $this->args['date_query'] : wp_parse_args($this->args['date_query']), "{$this->table_name}.date_created");
347 347
 
348
-			$where .= str_replace( array(
348
+			$where .= str_replace(array(
349 349
 				"\n",
350 350
 				'(   (',
351 351
 				'))',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 				'',
354 354
 				'( (',
355 355
 				') )',
356
-			), $date_query_object->get_sql() );
356
+			), $date_query_object->get_sql());
357 357
 		}
358 358
 
359 359
 		return $where;
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
 		$where = '';
373 373
 
374 374
 		// Donors created for a specific date or in a date range
375
-		if ( ! empty( $this->args['s'] ) && false !== strpos( $this->args['s'], ':' ) ) {
376
-			$search_parts = explode( ':', $this->args['s'] );
375
+		if ( ! empty($this->args['s']) && false !== strpos($this->args['s'], ':')) {
376
+			$search_parts = explode(':', $this->args['s']);
377 377
 
378
-			if ( ! empty( $search_parts[0] ) ) {
379
-				switch ( $search_parts[0] ) {
378
+			if ( ! empty($search_parts[0])) {
379
+				switch ($search_parts[0]) {
380 380
 					case 'name':
381 381
 						$where = "AND {$this->table_name}.name LIKE '%{$search_parts[1]}%'";
382 382
 						break;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 		$where = '';
405 405
 
406 406
 		// Donors create for specific wp user.
407
-		if ( ! empty( $this->args['user'] ) ) {
408
-			if ( ! is_array( $this->args['user'] ) ) {
409
-				$this->args['user'] = explode( ',', $this->args['user'] );
407
+		if ( ! empty($this->args['user'])) {
408
+			if ( ! is_array($this->args['user'])) {
409
+				$this->args['user'] = explode(',', $this->args['user']);
410 410
 			}
411
-			$user_ids = implode( ',', array_map( 'intval', $this->args['user'] ) );
411
+			$user_ids = implode(',', array_map('intval', $this->args['user']));
412 412
 
413 413
 			$where .= "AND {$this->table_name}.user_id IN( {$user_ids} )";
414 414
 		}
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		$query = array();
431 431
 		$ordersby = $this->args['orderby'];
432 432
 
433
-		if( ! is_array( $ordersby ) ) {
433
+		if ( ! is_array($ordersby)) {
434 434
 			$ordersby = array(
435 435
 				$this->args['orderby'] => $this->args['order']
436 436
 			);
@@ -438,23 +438,23 @@  discard block
 block discarded – undo
438 438
 
439 439
 		// Remove non existing column.
440 440
 		// Filter orderby values.
441
-		foreach ( $ordersby as $orderby => $order ) {
442
-			if( ! array_key_exists( $orderby, $table_columns ) ) {
443
-				unset( $ordersby[$orderby] );
441
+		foreach ($ordersby as $orderby => $order) {
442
+			if ( ! array_key_exists($orderby, $table_columns)) {
443
+				unset($ordersby[$orderby]);
444 444
 			}
445 445
 
446
-			$ordersby[ esc_sql( $orderby ) ] = esc_sql( $order );
446
+			$ordersby[esc_sql($orderby)] = esc_sql($order);
447 447
 		}
448 448
 
449
-		if( empty( $ordersby ) ) {
449
+		if (empty($ordersby)) {
450 450
 			$ordersby = array(
451 451
 				'id' => $this->args['order']
452 452
 			);
453 453
 		}
454 454
 
455 455
 		// Create query.
456
-		foreach ( $ordersby as $orderby => $order ) {
457
-			switch ( $table_columns[ $orderby ] ) {
456
+		foreach ($ordersby as $orderby => $order) {
457
+			switch ($table_columns[$orderby]) {
458 458
 				case '%d':
459 459
 				case '%f':
460 460
 					$query[] = "{$this->table_name}.{$orderby}+0 {$order}";
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 			}
466 466
 		}
467 467
 
468
-		return ! empty( $query ) ? 'ORDER BY ' . implode( ', ', $query ) : '';
468
+		return ! empty($query) ? 'ORDER BY '.implode(', ', $query) : '';
469 469
 	}
470 470
 
471 471
 	/**
@@ -481,10 +481,10 @@  discard block
 block discarded – undo
481 481
 	private function get_where_donation_count() {
482 482
 		$where = '';
483 483
 
484
-		if ( ! empty( $this->args['donation_count'] ) ) {
484
+		if ( ! empty($this->args['donation_count'])) {
485 485
 			$compare = '>';
486 486
 			$amount  = $this->args['donation_count'];
487
-			if ( is_array( $this->args['donation_count'] ) ) {
487
+			if (is_array($this->args['donation_count'])) {
488 488
 				$compare = $this->args['donation_count'] ['compare'];
489 489
 				$amount = $this->args['donation_count']['amount'];
490 490
 			}
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	private function get_where_donation_amount() {
509 509
 		$where = '';
510 510
 
511
-		if ( ! empty( $this->args['donation_amount'] ) ) {
511
+		if ( ! empty($this->args['donation_amount'])) {
512 512
 			$compare = '>';
513 513
 			$amount  = $this->args['donation_amount'];
514
-			if ( is_array( $this->args['donation_amount'] ) ) {
514
+			if (is_array($this->args['donation_amount'])) {
515 515
 				$compare = $this->args['donation_amount'] ['compare'];
516 516
 				$amount = $this->args['donation_amount']['amount'];
517 517
 			}
@@ -537,13 +537,13 @@  discard block
 block discarded – undo
537 537
 		global $wpdb;
538 538
 		$where = '';
539 539
 
540
-		if ( ! empty( $this->args['give_forms'] ) ) {
541
-			if ( ! is_array( $this->args['give_forms'] ) ) {
542
-				$this->args['give_forms'] = explode( ',', $this->args['give_forms'] );
540
+		if ( ! empty($this->args['give_forms'])) {
541
+			if ( ! is_array($this->args['give_forms'])) {
542
+				$this->args['give_forms'] = explode(',', $this->args['give_forms']);
543 543
 			}
544 544
 
545
-			$form_ids        = implode( ',', array_map( 'intval', $this->args['give_forms'] ) );
546
-			$donation_id_col = Give()->payment_meta->get_meta_type() . '_id';
545
+			$form_ids        = implode(',', array_map('intval', $this->args['give_forms']));
546
+			$donation_id_col = Give()->payment_meta->get_meta_type().'_id';
547 547
 
548 548
 			$query = $wpdb->prepare(
549 549
 				"
@@ -562,12 +562,12 @@  discard block
 block discarded – undo
562 562
 				$form_ids
563 563
 			);
564 564
 
565
-			$donor_ids = $wpdb->get_results( $query, ARRAY_A );
565
+			$donor_ids = $wpdb->get_results($query, ARRAY_A);
566 566
 
567
-			if ( ! empty( $donor_ids ) ) {
568
-				$donor_ids = wp_list_pluck( $donor_ids, 'donor_id' );
569
-				$donor_ids = implode( ',', array_map( 'intval', $donor_ids ) );
570
-				$where     .= "AND {$this->table_name}.id IN ({$donor_ids})";
567
+			if ( ! empty($donor_ids)) {
568
+				$donor_ids = wp_list_pluck($donor_ids, 'donor_id');
569
+				$donor_ids = implode(',', array_map('intval', $donor_ids));
570
+				$where .= "AND {$this->table_name}.id IN ({$donor_ids})";
571 571
 			} else {
572 572
 				$where .= "AND {$this->table_name}.id IN ('0')";
573 573
 			}
Please login to merge, or discard this patch.