Completed
Pull Request — master (#760)
by
unknown
20:22
created
give.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 	/**
49 49
 	 * Main Give Class
50 50
 	 *
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 		 * @return    Give
160 160
 		 */
161 161
 		public static function instance() {
162
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
162
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
163 163
 				self::$instance = new Give;
164 164
 				self::$instance->setup_constants();
165 165
 
166
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
166
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
167 167
 
168 168
 				self::$instance->includes();
169 169
 				self::$instance->roles           = new Give_Roles();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 */
196 196
 		public function __clone() {
197 197
 			// Cloning instances of the class is forbidden
198
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
198
+			_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
199 199
 		}
200 200
 
201 201
 		/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 */
208 208
 		public function __wakeup() {
209 209
 			// Unserializing instances of the class is forbidden
210
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
210
+			_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
211 211
 		}
212 212
 
213 213
 		/**
@@ -220,33 +220,33 @@  discard block
 block discarded – undo
220 220
 		private function setup_constants() {
221 221
 
222 222
 			// Plugin version
223
-			if ( ! defined( 'GIVE_VERSION' ) ) {
224
-				define( 'GIVE_VERSION', '1.5.2' );
223
+			if ( ! defined('GIVE_VERSION')) {
224
+				define('GIVE_VERSION', '1.5.2');
225 225
 			}
226 226
 
227 227
 			// Plugin Folder Path
228
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
229
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
228
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
229
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
230 230
 			}
231 231
 
232 232
 			// Plugin Folder URL
233
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
234
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
233
+			if ( ! defined('GIVE_PLUGIN_URL')) {
234
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
235 235
 			}
236 236
 
237 237
 			// Plugin Basename aka: "give/give.php"
238
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
239
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
238
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
239
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
240 240
 			}
241 241
 
242 242
 			// Plugin Root File
243
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
244
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
243
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
244
+				define('GIVE_PLUGIN_FILE', __FILE__);
245 245
 			}
246 246
 
247 247
 			// Make sure CAL_GREGORIAN is defined
248
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
249
-				define( 'CAL_GREGORIAN', 1 );
248
+			if ( ! defined('CAL_GREGORIAN')) {
249
+				define('CAL_GREGORIAN', 1);
250 250
 			}
251 251
 		}
252 252
 
@@ -260,109 +260,109 @@  discard block
 block discarded – undo
260 260
 		private function includes() {
261 261
 			global $give_options;
262 262
 
263
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
263
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
264 264
 			$give_options = give_get_settings();
265 265
 
266
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
267
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
268
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
269
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
270
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
271
-
272
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
273
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
274
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
275
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
276
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
277
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
278
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
279
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
280
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
281
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
282
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
283
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
284
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
285
-
286
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
287
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
288
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
289
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
290
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
291
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
292
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
293
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
294
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
295
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
296
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
297
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
298
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
299
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
300
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
301
-
302
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
303
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
305
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
306
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
307
-
308
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
311
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
313
-
314
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
319
-
320
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
321
-
322
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
323
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
324
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
325
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
326
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
327
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
328
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
329
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
330
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
331
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
332
-
333
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
334
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
335
-
336
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
337
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
338
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
339
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
340
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
341
-
342
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
343
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
344
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
345
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
346
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
347
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
348
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
349
-
350
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
352
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
353
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
354
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
355
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
356
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
359
-
360
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
361
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
266
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
267
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
268
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
269
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
270
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
271
+
272
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
273
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
274
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
275
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
276
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
277
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
278
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
279
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
280
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
281
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
282
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
283
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
284
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
285
+
286
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
287
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
288
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
289
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
290
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
291
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
292
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
293
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
294
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
295
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
296
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
297
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
298
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
299
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
300
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
301
+
302
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
305
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
307
+
308
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
311
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
313
+
314
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
319
+
320
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
321
+
322
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
323
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
324
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
325
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
326
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
327
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
328
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
329
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
330
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
331
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
332
+
333
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
334
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
335
+
336
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
337
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
338
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
339
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
340
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
341
+
342
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
343
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
344
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
345
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
346
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
347
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
348
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
349
+
350
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
352
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
353
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
354
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
355
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
356
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
359
+
360
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
361
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
362 362
 
363 363
 			}
364 364
 
365
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
365
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
366 366
 
367 367
 		}
368 368
 
@@ -375,26 +375,26 @@  discard block
 block discarded – undo
375 375
 		 */
376 376
 		public function load_textdomain() {
377 377
 			// Set filter for Give's languages directory
378
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
379
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
378
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
379
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
380 380
 
381 381
 			// Traditional WordPress plugin locale filter
382
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
383
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
382
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
383
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
384 384
 
385 385
 			// Setup paths to current locale file
386
-			$mofile_local  = $give_lang_dir . $mofile;
387
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
386
+			$mofile_local  = $give_lang_dir.$mofile;
387
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
388 388
 
389
-			if ( file_exists( $mofile_global ) ) {
389
+			if (file_exists($mofile_global)) {
390 390
 				// Look in global /wp-content/languages/give folder
391
-				load_textdomain( 'give', $mofile_global );
392
-			} elseif ( file_exists( $mofile_local ) ) {
391
+				load_textdomain('give', $mofile_global);
392
+			} elseif (file_exists($mofile_local)) {
393 393
 				// Look in local location from filter `give_languages_directory`
394
-				load_textdomain( 'give', $mofile_local );
394
+				load_textdomain('give', $mofile_local);
395 395
 			} else {
396 396
 				// Load the default language files packaged up w/ Give
397
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
397
+				load_plugin_textdomain('give', false, $give_lang_dir);
398 398
 			}
399 399
 		}
400 400
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : __( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Log Message', 'give' ); ?> "><?php _e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Log Message', 'give'); ?> "><?php _e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103 103
 
104
-				echo wpautop( $intro );
105
-				echo wpautop( '<strong>' . __( 'Log data:', 'give' ) . '</strong>' );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
104
+				echo wpautop($intro);
105
+				echo wpautop('<strong>'.__('Log data:', 'give').'</strong>');
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => __( 'Log ID', 'give' ),
126
-			'payment_id' => __( 'Payment ID', 'give' ),
127
-			'error'      => __( 'Error', 'give' ),
128
-			'message'    => __( 'Error Message', 'give' ),
129
-			'gateway'    => __( 'Gateway', 'give' ),
130
-			'date'       => __( 'Date', 'give' )
125
+			'ID'         => __('Log ID', 'give'),
126
+			'payment_id' => __('Payment ID', 'give'),
127
+			'error'      => __('Error', 'give'),
128
+			'message'    => __('Error Message', 'give'),
129
+			'gateway'    => __('Gateway', 'give'),
130
+			'date'       => __('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		give_log_views();
156 156
 	}
157 157
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		global $give_logs;
168 168
 
169 169
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
170
-		wp_suspend_cache_addition( true );
170
+		wp_suspend_cache_addition(true);
171 171
 
172 172
 		$logs_data = array();
173 173
 		$paged     = $this->get_paged();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 			'paged'    => $paged
177 177
 		);
178 178
 
179
-		$logs = $give_logs->get_connected_logs( $log_query );
179
+		$logs = $give_logs->get_connected_logs($log_query);
180 180
 
181
-		if ( $logs ) {
182
-			foreach ( $logs as $log ) {
181
+		if ($logs) {
182
+			foreach ($logs as $log) {
183 183
 
184 184
 				$logs_data[] = array(
185 185
 					'ID'         => $log->ID,
186
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
186
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
187 187
 					'payment_id' => $log->post_parent,
188 188
 					'error'      => 'error',
189
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
189
+					'gateway'    => give_get_payment_gateway($log->post_parent),
190 190
 					'date'       => $log->post_date
191 191
 				);
192 192
 			}
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
211
-		if ( 'top' === $which ) {
212
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
210
+	protected function display_tablenav($which) {
211
+		if ('top' === $which) {
212
+			wp_nonce_field('bulk-'.$this->_args['plural']);
213 213
 		}
214 214
 		?>
215
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
215
+		<div class="tablenav <?php echo esc_attr($which); ?>">
216 216
 
217 217
 			<div class="alignleft actions bulkactions">
218
-				<?php $this->bulk_actions( $which ); ?>
218
+				<?php $this->bulk_actions($which); ?>
219 219
 			</div>
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 		$columns               = $this->get_columns();
247 247
 		$hidden                = array(); // No hidden columns
248 248
 		$sortable              = $this->get_sortable_columns();
249
-		$this->_column_headers = array( $columns, $hidden, $sortable );
249
+		$this->_column_headers = array($columns, $hidden, $sortable);
250 250
 		$current_page          = $this->get_pagenum();
251 251
 		$this->items           = $this->get_logs();
252
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
252
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
253 253
 
254
-		$this->set_pagination_args( array(
254
+		$this->set_pagination_args(array(
255 255
 				'total_items' => $total_items,
256 256
 				'per_page'    => $this->per_page,
257
-				'total_pages' => ceil( $total_items / $this->per_page )
257
+				'total_pages' => ceil($total_items / $this->per_page)
258 258
 			)
259 259
 		);
260 260
 	}
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +95 added lines, -95 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
 
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
34
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
35 35
 
36
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
37
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
36
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
37
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
38 38
 
39
-	$to_email = give_get_payment_user_email( $payment_id );
39
+	$to_email = give_get_payment_user_email($payment_id);
40 40
 
41
-	$subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) );
42
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
43
-	$subject = give_do_email_tags( $subject, $payment_id );
41
+	$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
42
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
43
+	$subject = give_do_email_tags($subject, $payment_id);
44 44
 
45
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
46
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
45
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
46
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
47 47
 
48 48
 	$emails = Give()->emails;
49 49
 
50
-	$emails->__set( 'from_name', $from_name );
51
-	$emails->__set( 'from_email', $from_email );
52
-	$emails->__set( 'heading', __( 'Donation Receipt', 'give' ) );
50
+	$emails->__set('from_name', $from_name);
51
+	$emails->__set('from_email', $from_email);
52
+	$emails->__set('heading', __('Donation Receipt', 'give'));
53 53
 
54 54
 
55
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
56
-	$emails->__set( 'headers', $headers );
55
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
56
+	$emails->__set('headers', $headers);
57 57
 
58
-	$emails->send( $to_email, $subject, $message, $attachments );
58
+	$emails->send($to_email, $subject, $message, $attachments);
59 59
 
60
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
61
-		do_action( 'give_admin_sale_notice', $payment_id, $payment_data );
60
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
61
+		do_action('give_admin_sale_notice', $payment_id, $payment_data);
62 62
 	}
63 63
 }
64 64
 
@@ -71,29 +71,29 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function give_email_test_donation_receipt() {
73 73
 
74
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
75
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() );
74
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
75
+	$from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
76 76
 
77
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
78
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() );
77
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
78
+	$from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
79 79
 
80
-	$subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) );
81
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
82
-	$subject = give_do_email_tags( $subject, 0 );
80
+	$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
81
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
82
+	$subject = give_do_email_tags($subject, 0);
83 83
 
84
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
84
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
85 85
 
86
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
86
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
87 87
 
88 88
 	$emails = Give()->emails;
89
-	$emails->__set( 'from_name', $from_name );
90
-	$emails->__set( 'from_email', $from_email );
91
-	$emails->__set( 'heading', __( 'Donation Receipt', 'give' ) );
89
+	$emails->__set('from_name', $from_name);
90
+	$emails->__set('from_email', $from_email);
91
+	$emails->__set('heading', __('Donation Receipt', 'give'));
92 92
 
93
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
94
-	$emails->__set( 'headers', $headers );
93
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
94
+	$emails->__set('headers', $headers);
95 95
 
96
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
96
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
97 97
 
98 98
 }
99 99
 
@@ -107,49 +107,49 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return void
109 109
  */
110
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
110
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
111 111
 
112
-	$payment_id = absint( $payment_id );
112
+	$payment_id = absint($payment_id);
113 113
 
114
-	if ( empty( $payment_id ) ) {
114
+	if (empty($payment_id)) {
115 115
 		return;
116 116
 	}
117 117
 
118
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
118
+	if ( ! give_get_payment_by('id', $payment_id)) {
119 119
 		return;
120 120
 	}
121 121
 
122
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
123
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
122
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
123
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
124 124
 
125
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
126
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
125
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
126
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
127 127
 
128
-	$subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
129
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
130
-	$subject = give_do_email_tags( $subject, $payment_id );
128
+	$subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%s', 'give'), $payment_id));
129
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
130
+	$subject = give_do_email_tags($subject, $payment_id);
131 131
 
132
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
133
-	$headers .= "Reply-To: " . $from_email . "\r\n";
132
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
133
+	$headers .= "Reply-To: ".$from_email."\r\n";
134 134
 	//$headers  .= "MIME-Version: 1.0\r\n";
135 135
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
136
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
136
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
137 137
 
138
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
138
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
139 139
 
140
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
140
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
141 141
 
142 142
 	$emails = Give()->emails;
143
-	$emails->__set( 'from_name', $from_name );
144
-	$emails->__set( 'from_email', $from_email );
145
-	$emails->__set( 'headers', $headers );
146
-	$emails->__set( 'heading', __( 'New Donation!', 'give' ) );
143
+	$emails->__set('from_name', $from_name);
144
+	$emails->__set('from_email', $from_email);
145
+	$emails->__set('headers', $headers);
146
+	$emails->__set('heading', __('New Donation!', 'give'));
147 147
 
148
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
148
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
149 149
 
150 150
 }
151 151
 
152
-add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 );
152
+add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2);
153 153
 
154 154
 /**
155 155
  * Retrieves the emails for which admin notifications are sent to (these can be
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 function give_get_admin_notice_emails() {
163 163
 	global $give_options;
164 164
 
165
-	$emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' );
166
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
165
+	$emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email');
166
+	$emails = array_map('trim', explode("\n", $emails));
167 167
 
168
-	return apply_filters( 'give_admin_notice_emails', $emails );
168
+	return apply_filters('give_admin_notice_emails', $emails);
169 169
 }
170 170
 
171 171
 /**
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return mixed
179 179
  */
180
-function give_admin_notices_disabled( $payment_id = 0 ) {
180
+function give_admin_notices_disabled($payment_id = 0) {
181 181
 
182
-	$retval = give_get_option( 'disable_admin_notices' );
182
+	$retval = give_get_option('disable_admin_notices');
183 183
 
184
-	return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id );
184
+	return apply_filters('give_admin_notices_disabled', $retval, $payment_id);
185 185
 }
186 186
 
187 187
 /**
@@ -194,17 +194,17 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_get_default_donation_notification_email() {
196 196
 
197
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
198
-	$default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n";
199
-	$default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n";
200
-	$default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n";
201
-	$default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n";
202
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}';
197
+	$default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
198
+	$default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n";
199
+	$default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n";
200
+	$default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n";
201
+	$default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n";
202
+	$default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}';
203 203
 
204
-	$custom_message = give_get_option( 'donation_notification' );
205
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
204
+	$custom_message = give_get_option('donation_notification');
205
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
206 206
 
207
-	return apply_filters( 'give_default_donation_notification_email', $message );
207
+	return apply_filters('give_default_donation_notification_email', $message);
208 208
 }
209 209
 
210 210
 
@@ -218,26 +218,26 @@  discard block
 block discarded – undo
218 218
  */
219 219
 function give_get_default_donation_receipt_email() {
220 220
 
221
-	$default_email_body = __( 'Dear', 'give' ) . " {name},\n\n";
222
-	$default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
223
-	$default_email_body .= '<strong>' . __( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n";
224
-	$default_email_body .= '<strong>' . __( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n";
225
-	$default_email_body .= '<strong>' . __( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n";
226
-	$default_email_body .= '<strong>' . __( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n";
227
-	$default_email_body .= '<strong>' . __( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n";
228
-	$default_email_body .= '<strong>' . __( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n";
229
-	$default_email_body .= '<strong>' . __( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n";
230
-	$default_email_body .= '{receipt_link}' . "\n\n";
221
+	$default_email_body = __('Dear', 'give')." {name},\n\n";
222
+	$default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
223
+	$default_email_body .= '<strong>'.__('Donor', 'give').':</strong> '.'{fullname}'."\n";
224
+	$default_email_body .= '<strong>'.__('Donation', 'give').':</strong> '.'{donation}'."\n";
225
+	$default_email_body .= '<strong>'.__('Donation Date', 'give').':</strong> '.'{date}'."\n";
226
+	$default_email_body .= '<strong>'.__('Amount', 'give').':</strong> '.'{price}'."\n";
227
+	$default_email_body .= '<strong>'.__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n";
228
+	$default_email_body .= '<strong>'.__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n";
229
+	$default_email_body .= '<strong>'.__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n";
230
+	$default_email_body .= '{receipt_link}'."\n\n";
231 231
 
232 232
 	$default_email_body .= "\n\n";
233
-	$default_email_body .= __( 'Sincerely,', 'give' );
234
-	$default_email_body .= "\n" . '{sitename}' . "\n";
233
+	$default_email_body .= __('Sincerely,', 'give');
234
+	$default_email_body .= "\n".'{sitename}'."\n";
235 235
 
236
-	$custom_message = give_get_option( 'donation_receipt' );
236
+	$custom_message = give_get_option('donation_receipt');
237 237
 
238
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
238
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
239 239
 
240
-	return apply_filters( 'give_default_donation_receipt_email', $message );
240
+	return apply_filters('give_default_donation_receipt_email', $message);
241 241
 }
242 242
 
243 243
 /**
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @return array $email_names
251 251
  */
252
-function give_get_email_names( $user_info ) {
252
+function give_get_email_names($user_info) {
253 253
 	$email_names = array();
254
-	$user_info   = maybe_unserialize( $user_info );
254
+	$user_info   = maybe_unserialize($user_info);
255 255
 
256 256
 	$email_names['fullname'] = '';
257
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
258
-		$user_data               = get_userdata( $user_info['id'] );
257
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
258
+		$user_data               = get_userdata($user_info['id']);
259 259
 		$email_names['name']     = $user_info['first_name'];
260
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
260
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
261 261
 		$email_names['username'] = $user_data->user_login;
262
-	} elseif ( isset( $user_info['first_name'] ) ) {
262
+	} elseif (isset($user_info['first_name'])) {
263 263
 		$email_names['name']     = $user_info['first_name'];
264
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
264
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
265 265
 		$email_names['username'] = $user_info['first_name'];
266 266
 	} else {
267 267
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
33
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
32
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
33
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
34 34
 		);
35 35
 
36 36
 		return $rate_text;
@@ -39,4 +39,4 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 }
41 41
 
42
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
42
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/class-give-email-access.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since       1.4
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Class Give_Email_Access
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	function __construct() {
31 31
 
32 32
 		// get it started
33
-		add_action( 'init', array( $this, 'init' ) );
33
+		add_action('init', array($this, 'init'));
34 34
 	}
35 35
 
36 36
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	function init() {
41 41
 
42
-		$is_enabled = give_get_option( 'email_access' );
42
+		$is_enabled = give_get_option('email_access');
43 43
 
44 44
 		//Non-logged in users only
45
-		if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) {
45
+		if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) {
46 46
 			return;
47 47
 		}
48 48
 
49 49
 		//Are db columns setup?
50
-		$is_setup = give_get_option( 'email_access_installed' );
51
-		if ( empty( $is_setup ) ) {
50
+		$is_setup = give_get_option('email_access_installed');
51
+		if (empty($is_setup)) {
52 52
 			$this->create_columns();
53 53
 		}
54 54
 
55 55
 		// Timeouts
56
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
57
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
56
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
57
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
58 58
 
59 59
 		// Setup login
60 60
 		$this->check_for_token();
61 61
 
62
-		if ( $this->token_exists ) {
63
-			add_filter( 'give_can_view_receipt', '__return_true' );
64
-			add_filter( 'give_user_pending_verification', '__return_false' );
65
-			add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) );
62
+		if ($this->token_exists) {
63
+			add_filter('give_can_view_receipt', '__return_true');
64
+			add_filter('give_user_pending_verification', '__return_false');
65
+			add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args'));
66 66
 		}
67 67
 	}
68 68
 
@@ -73,24 +73,24 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return bool
75 75
 	 */
76
-	function can_send_email( $customer_id ) {
76
+	function can_send_email($customer_id) {
77 77
 		global $wpdb;
78 78
 
79 79
 		// Prevent multiple emails within X minutes
80
-		$throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle );
80
+		$throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle);
81 81
 
82 82
 		// Does a user row exist?
83 83
 		$exists = (int) $wpdb->get_var(
84
-			$wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id )
84
+			$wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id)
85 85
 		);
86 86
 
87
-		if ( 0 < $exists ) {
87
+		if (0 < $exists) {
88 88
 			$row_id = (int) $wpdb->get_var(
89
-				$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle )
89
+				$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle)
90 90
 			);
91 91
 
92
-			if ( $row_id < 1 ) {
93
-				give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) );
92
+			if ($row_id < 1) {
93
+				give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give'));
94 94
 
95 95
 				return false;
96 96
 			}
@@ -106,38 +106,38 @@  discard block
 block discarded – undo
106 106
 	 * @param $customer_id
107 107
 	 * @param $email
108 108
 	 */
109
-	function send_email( $customer_id, $email ) {
109
+	function send_email($customer_id, $email) {
110 110
 
111
-		$verify_key = wp_generate_password( 20, false );
111
+		$verify_key = wp_generate_password(20, false);
112 112
 
113 113
 		// Generate a new verify key
114
-		$this->set_verify_key( $customer_id, $email, $verify_key );
114
+		$this->set_verify_key($customer_id, $email, $verify_key);
115 115
 
116 116
 		// Get the purchase history URL
117
-		$page_id = give_get_option( 'history_page' );
117
+		$page_id = give_get_option('history_page');
118 118
 
119
-		$access_url = add_query_arg( array(
119
+		$access_url = add_query_arg(array(
120 120
 			'give_nl' => $verify_key,
121
-		), get_permalink( $page_id ) );
121
+		), get_permalink($page_id));
122 122
 
123 123
 		//Nice subject and message
124
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) );
124
+		$subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %s', 'give'), get_bloginfo('name')));
125 125
 
126
-		$message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
126
+		$message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n";
127 127
 
128
-		$message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access My Donation Details', 'give' ) . ' &raquo;</a>';
128
+		$message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access My Donation Details', 'give').' &raquo;</a>';
129 129
 
130 130
 		$message .= "\n\n";
131 131
 		$message .= "\n\n";
132
-		$message .= __( 'Sincerely,', 'give' );
133
-		$message .= "\n" . get_bloginfo( 'name' ) . "\n";
132
+		$message .= __('Sincerely,', 'give');
133
+		$message .= "\n".get_bloginfo('name')."\n";
134 134
 
135
-		$message = apply_filters( 'give_email_access_token_message', $message );
135
+		$message = apply_filters('give_email_access_token_message', $message);
136 136
 
137 137
 
138 138
 		// Send the email
139
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) );
140
-		Give()->emails->send( $email, $subject, $message );
139
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give')));
140
+		Give()->emails->send($email, $subject, $message);
141 141
 
142 142
 	}
143 143
 
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	function check_for_token() {
149 149
 
150
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
150
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
151 151
 
152 152
 		// Check for cookie
153
-		if ( empty( $token ) ) {
154
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
153
+		if (empty($token)) {
154
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
155 155
 		}
156 156
 
157
-		if ( ! empty( $token ) ) {
158
-			if ( ! $this->is_valid_token( $token ) ) {
159
-				if ( ! $this->is_valid_verify_key( $token ) ) {
157
+		if ( ! empty($token)) {
158
+			if ( ! $this->is_valid_token($token)) {
159
+				if ( ! $this->is_valid_verify_key($token)) {
160 160
 					return;
161 161
 				}
162 162
 			}
163 163
 
164 164
 			$this->token_exists = true;
165 165
 			// Set cookie
166
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
167
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
166
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
167
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
168 168
 		}
169 169
 	}
170 170
 
@@ -175,18 +175,18 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return bool
177 177
 	 */
178
-	function is_valid_token( $token ) {
178
+	function is_valid_token($token) {
179 179
 
180 180
 		global $wpdb;
181 181
 
182 182
 		// Make sure token isn't expired
183
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
183
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
184 184
 
185 185
 		$email = $wpdb->get_var(
186
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
186
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
187 187
 		);
188 188
 
189
-		if ( ! empty( $email ) ) {
189
+		if ( ! empty($email)) {
190 190
 			$this->token_email = $email;
191 191
 			$this->token       = $token;
192 192
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		//Set error only if email access form isn't being submitted
197
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
198
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give' ) );
197
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
198
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give'));
199 199
 		}
200 200
 
201 201
 
@@ -210,25 +210,25 @@  discard block
 block discarded – undo
210 210
 	 * @param $email
211 211
 	 * @param $verify_key
212 212
 	 */
213
-	function set_verify_key( $customer_id, $email, $verify_key ) {
213
+	function set_verify_key($customer_id, $email, $verify_key) {
214 214
 		global $wpdb;
215 215
 
216
-		$now = date( 'Y-m-d H:i:s' );
216
+		$now = date('Y-m-d H:i:s');
217 217
 
218 218
 		// Insert or update?
219 219
 		$row_id = (int) $wpdb->get_var(
220
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
220
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
221 221
 		);
222 222
 
223 223
 		// Update
224
-		if ( ! empty( $row_id ) ) {
224
+		if ( ! empty($row_id)) {
225 225
 			$wpdb->query(
226
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
226
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
227 227
 			);
228 228
 		} // Insert
229 229
 		else {
230 230
 			$wpdb->query(
231
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
231
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
232 232
 			);
233 233
 		}
234 234
 	}
@@ -240,20 +240,20 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool
242 242
 	 */
243
-	function is_valid_verify_key( $token ) {
243
+	function is_valid_verify_key($token) {
244 244
 		global $wpdb;
245 245
 
246 246
 		// See if the verify_key exists
247 247
 		$row = $wpdb->get_row(
248
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
248
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
249 249
 		);
250 250
 
251
-		$now = date( 'Y-m-d H:i:s' );
251
+		$now = date('Y-m-d H:i:s');
252 252
 
253 253
 		// Set token
254
-		if ( ! empty( $row ) ) {
254
+		if ( ! empty($row)) {
255 255
 			$wpdb->query(
256
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
256
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
257 257
 			);
258 258
 
259 259
 			$this->token_email = $row->email;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return mixed
274 274
 	 */
275
-	function users_purchases_args( $args ) {
275
+	function users_purchases_args($args) {
276 276
 		$args['user'] = $this->token_email;
277 277
 
278 278
 		return $args;
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 		global $wpdb;
290 290
 
291 291
 		//Create columns in customers table
292
-		$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
292
+		$query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
293 293
 
294 294
 		//Columns added properly
295
-		if ( $query ) {
296
-			give_update_option( 'email_access_installed', 1 );
295
+		if ($query) {
296
+			give_update_option('email_access_installed', 1);
297 297
 		}
298 298
 
299 299
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,36 +29,36 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? $_GET['tab'] : 'reports';
34 34
 	?>
35 35
 	<div class="wrap">
36 36
 		<h1 class="nav-tab-wrapper">
37
-			<a href="<?php echo esc_url( add_query_arg( array(
37
+			<a href="<?php echo esc_url(add_query_arg(array(
38 38
 				'tab'              => 'reports',
39 39
 				'settings-updated' => false
40
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a>
41
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
40
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a>
41
+			<?php if (current_user_can('export_give_reports')) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => 'export',
44 44
 					'settings-updated' => false
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a>
46 46
 			<?php } ?>
47
-			<a href="<?php echo esc_url( add_query_arg( array(
47
+			<a href="<?php echo esc_url(add_query_arg(array(
48 48
 				'tab'              => 'logs',
49 49
 				'settings-updated' => false
50
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a>
51
-			<a href="<?php echo esc_url( add_query_arg( array(
50
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a>
51
+			<a href="<?php echo esc_url(add_query_arg(array(
52 52
 				'tab'              => 'tools',
53 53
 				'settings-updated' => false
54
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a>
55
-			<?php do_action( 'give_reports_tabs' ); ?>
54
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a>
55
+			<?php do_action('give_reports_tabs'); ?>
56 56
 		</h1>
57 57
 
58 58
 		<?php
59
-		do_action( 'give_reports_page_top' );
60
-		do_action( 'give_reports_tab_' . $active_tab );
61
-		do_action( 'give_reports_page_bottom' );
59
+		do_action('give_reports_page_top');
60
+		do_action('give_reports_tab_'.$active_tab);
61
+		do_action('give_reports_page_bottom');
62 62
 		?>
63 63
 	</div><!-- .wrap -->
64 64
 	<?php
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function give_reports_default_views() {
74 74
 	$views = array(
75
-		'earnings' => __( 'Income', 'give' ),
75
+		'earnings' => __('Income', 'give'),
76 76
 		'forms'    => give_get_forms_label_plural(),
77
-		'donors'   => __( 'Donors', 'give' ),
78
-		'gateways' => __( 'Payment Methods', 'give' )
77
+		'donors'   => __('Donors', 'give'),
78
+		'gateways' => __('Payment Methods', 'give')
79 79
 	);
80 80
 
81
-	$views = apply_filters( 'give_report_views', $views );
81
+	$views = apply_filters('give_report_views', $views);
82 82
 
83 83
 	return $views;
84 84
 }
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $view Report View
95 95
  *
96 96
  */
97
-function give_get_reporting_view( $default = 'earnings' ) {
97
+function give_get_reporting_view($default = 'earnings') {
98 98
 
99
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
99
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
100 100
 		$view = $default;
101 101
 	} else {
102 102
 		$view = $_GET['view'];
103 103
 	}
104 104
 
105
-	return apply_filters( 'give_get_reporting_view', $view );
105
+	return apply_filters('give_get_reporting_view', $view);
106 106
 }
107 107
 
108 108
 /**
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	$current_view = 'earnings';
116 116
 	$views        = give_reports_default_views();
117 117
 
118
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) {
118
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
119 119
 		$current_view = $_GET['view'];
120 120
 	}
121 121
 
122
-	do_action( 'give_reports_view_' . $current_view );
122
+	do_action('give_reports_view_'.$current_view);
123 123
 }
124 124
 
125
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
125
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
126 126
 
127 127
 /**
128 128
  * Renders the Reports Page Views Drop Downs
@@ -132,25 +132,25 @@  discard block
 block discarded – undo
132 132
  */
133 133
 function give_report_views() {
134 134
 	$views        = give_reports_default_views();
135
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
136
-	do_action( 'give_report_view_actions_before' );
135
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
136
+	do_action('give_report_view_actions_before');
137 137
 	?>
138 138
 	<form id="give-reports-filter" method="get">
139 139
 		<select id="give-reports-view" name="view">
140
-			<option value="-1"><?php _e( 'Report Type', 'give' ); ?></option>
141
-			<?php foreach ( $views as $view_id => $label ) : ?>
142
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
140
+			<option value="-1"><?php _e('Report Type', 'give'); ?></option>
141
+			<?php foreach ($views as $view_id => $label) : ?>
142
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
143 143
 			<?php endforeach; ?>
144 144
 		</select>
145 145
 
146
-		<?php do_action( 'give_report_view_actions' ); ?>
146
+		<?php do_action('give_report_view_actions'); ?>
147 147
 
148 148
 		<input type="hidden" name="post_type" value="give_forms"/>
149 149
 		<input type="hidden" name="page" value="give-reports"/>
150
-		<?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
150
+		<?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?>
151 151
 	</form>
152 152
 	<?php
153
-	do_action( 'give_report_view_actions_after' );
153
+	do_action('give_report_view_actions_after');
154 154
 }
155 155
 
156 156
 /**
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function give_reports_forms_table() {
165 165
 
166
-	if ( isset( $_GET['form-id'] ) ) {
166
+	if (isset($_GET['form-id'])) {
167 167
 		return;
168 168
 	}
169 169
 
170
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
170
+	include(dirname(__FILE__).'/class-form-reports-table.php');
171 171
 
172 172
 	$give_table = new Give_Form_Reports_Table();
173 173
 	$give_table->prepare_items();
174 174
 	$give_table->display();
175 175
 }
176 176
 
177
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
177
+add_action('give_reports_view_forms', 'give_reports_forms_table');
178 178
 
179 179
 /**
180 180
  * Renders the detailed report for a specific give form
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
  * @return void
184 184
  */
185 185
 function give_reports_form_details() {
186
-	if ( ! isset( $_GET['form-id'] ) ) {
186
+	if ( ! isset($_GET['form-id'])) {
187 187
 		return;
188 188
 	}
189 189
 	?>
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 		<div class="actions bulkactions">
192 192
 			<?php give_report_views(); ?>
193 193
 			&nbsp;
194
-			<button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button>
194
+			<button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button>
195 195
 		</div>
196 196
 	</div>
197 197
 	<?php
198
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
198
+	give_reports_graph_of_form(absint($_GET['form-id']));
199 199
 }
200 200
 
201
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
201
+add_action('give_reports_view_forms', 'give_reports_form_details');
202 202
 
203 203
 /**
204 204
  * Renders the Reports Donors Table
@@ -209,28 +209,28 @@  discard block
 block discarded – undo
209 209
  * @return void
210 210
  */
211 211
 function give_reports_donors_table() {
212
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
212
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
213 213
 
214 214
 	$give_table = new Give_Donor_Reports_Table();
215 215
 	$give_table->prepare_items();
216 216
 	?>
217 217
 	<div class="wrap give-reports-donors-wrap">
218
-		<?php do_action( 'give_logs_donors_table_top' ); ?>
219
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>">
218
+		<?php do_action('give_logs_donors_table_top'); ?>
219
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>">
220 220
 			<?php
221
-			$give_table->search_box( __( 'Search', 'give' ), 'give-donors' );
221
+			$give_table->search_box(__('Search', 'give'), 'give-donors');
222 222
 			$give_table->display();
223 223
 			?>
224 224
 			<input type="hidden" name="post_type" value="give_forms"/>
225 225
 			<input type="hidden" name="page" value="give-reports"/>
226 226
 			<input type="hidden" name="view" value="donors"/>
227 227
 		</form>
228
-		<?php do_action( 'give_logs_donors_table_bottom' ); ?>
228
+		<?php do_action('give_logs_donors_table_bottom'); ?>
229 229
 	</div>
230 230
 	<?php
231 231
 }
232 232
 
233
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
233
+add_action('give_reports_view_donors', 'give_reports_donors_table');
234 234
 
235 235
 
236 236
 /**
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
  * @return void
243 243
  */
244 244
 function give_reports_gateways_table() {
245
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
245
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
246 246
 
247 247
 	$give_table = new Give_Gateawy_Reports_Table();
248 248
 	$give_table->prepare_items();
249 249
 	$give_table->display();
250 250
 }
251 251
 
252
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
252
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
253 253
 
254 254
 
255 255
 /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 function give_reports_earnings() {
262 262
 	?>
263 263
 	<div class="tablenav top reports-table-nav">
264
-		<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3>
264
+		<h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3>
265 265
 
266 266
 		<div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div>
267 267
 	</div>
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	give_reports_graph();
270 270
 }
271 271
 
272
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
272
+add_action('give_reports_view_earnings', 'give_reports_earnings');
273 273
 
274 274
 
275 275
 /**
@@ -284,52 +284,52 @@  discard block
 block discarded – undo
284 284
 		<div id="post-body">
285 285
 			<div id="post-body-content">
286 286
 
287
-				<?php do_action( 'give_reports_tab_export_content_top' ); ?>
287
+				<?php do_action('give_reports_tab_export_content_top'); ?>
288 288
 
289 289
 				<table class="widefat export-options-table give-table">
290 290
 					<thead>
291 291
 					<tr>
292
-						<th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th>
293
-						<th><?php _e( 'Export Options', 'give' ); ?></th>
292
+						<th class="row-title"><?php _e('Export Type', 'give'); ?></th>
293
+						<th><?php _e('Export Options', 'give'); ?></th>
294 294
 					</tr>
295 295
 					</thead>
296 296
 					<tbody>
297
-					<?php do_action( 'give_reports_tab_export_table_top' ); ?>
297
+					<?php do_action('give_reports_tab_export_table_top'); ?>
298 298
 					<tr class="give-export-pdf-sales-earnings">
299 299
 						<td class="row-title">
300
-							<h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3>
300
+							<h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3>
301 301
 
302
-							<p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
302
+							<p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
303 303
 						</td>
304 304
 						<td>
305
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a>
305
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a>
306 306
 						</td>
307 307
 					</tr>
308 308
 					<tr class="alternate give-export-sales-earnings">
309 309
 						<td class="row-title">
310
-							<h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
310
+							<h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3>
311 311
 
312
-							<p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
312
+							<p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p>
313 313
 						</td>
314 314
 						<td>
315 315
 							<form method="post">
316 316
 								<?php
317 317
 									printf(
318
-										__( '%1$s to %2$s', 'give' ),
319
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
320
-										Give()->html->year_dropdown( 'end_year' )   . ' ' . Give()->html->month_dropdown( 'end_month' )
318
+										__('%1$s to %2$s', 'give'),
319
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
320
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
321 321
 									);
322 322
 								?>
323 323
 								<input type="hidden" name="give-action" value="earnings_export"/>
324
-								<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
324
+								<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
325 325
 							</form>
326 326
 						</td>
327 327
 					</tr>
328 328
 					<tr class="give-export-payment-history">
329 329
 						<td class="row-title">
330
-							<h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3>
330
+							<h3><span><?php _e('Export Donation History', 'give'); ?></span></h3>
331 331
 
332
-							<p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
332
+							<p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p>
333 333
 						</td>
334 334
 						<td>
335 335
 							<form id="give-export-payments" class="give-export-form" method="post">
@@ -337,29 +337,29 @@  discard block
 block discarded – undo
337 337
 								$args = array(
338 338
 									'id'          => 'give-payment-export-start',
339 339
 									'name'        => 'start',
340
-									'placeholder' => __( 'Start date', 'give' )
340
+									'placeholder' => __('Start date', 'give')
341 341
 								);
342
-								echo Give()->html->date_field( $args ); ?>
342
+								echo Give()->html->date_field($args); ?>
343 343
 								<?php
344 344
 								$args = array(
345 345
 									'id'          => 'give-payment-export-end',
346 346
 									'name'        => 'end',
347
-									'placeholder' => __( 'End date', 'give' )
347
+									'placeholder' => __('End date', 'give')
348 348
 								);
349
-								echo Give()->html->date_field( $args ); ?>
349
+								echo Give()->html->date_field($args); ?>
350 350
 								<select name="status">
351
-									<option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
351
+									<option value="any"><?php _e('All Statuses', 'give'); ?></option>
352 352
 									<?php
353 353
 									$statuses = give_get_payment_statuses();
354
-									foreach ( $statuses as $status => $label ) {
355
-										echo '<option value="' . $status . '">' . $label . '</option>';
354
+									foreach ($statuses as $status => $label) {
355
+										echo '<option value="'.$status.'">'.$label.'</option>';
356 356
 									}
357 357
 									?>
358 358
 								</select>
359
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
359
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
360 360
 								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
361 361
 								<span>
362
-									<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
362
+									<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
363 363
 									<span class="spinner"></span>
364 364
 								</span>
365 365
 							</form>
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 					</tr>
369 369
 					<tr class="alternate give-export-donors">
370 370
 						<td class="row-title">
371
-							<h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3>
371
+							<h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3>
372 372
 
373
-							<p><?php _e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
373
+							<p><?php _e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
374 374
 						</td>
375 375
 						<td>
376 376
 							<form method="post" id="give_donor_export" class="give-export-form">
@@ -381,54 +381,54 @@  discard block
 block discarded – undo
381 381
 										'id'     => 'give_customer_export_form',
382 382
 										'chosen' => true
383 383
 									);
384
-									echo Give()->html->forms_dropdown( $args ); ?>
384
+									echo Give()->html->forms_dropdown($args); ?>
385 385
 								
386
-								<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
386
+								<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
387 387
 
388 388
 								<div id="export-donor-options-wrap" class="give-clearfix">
389
-									<p><?php _e( 'Export Columns', 'give' ); ?>:</p>
389
+									<p><?php _e('Export Columns', 'give'); ?>:</p>
390 390
 									<ul id="give-export-option-ul">
391 391
 										<li>
392
-											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e( 'Name', 'give' ); ?>
392
+											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e('Name', 'give'); ?>
393 393
 											</label>
394 394
 										</li>
395 395
 										<li>
396
-											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e( 'Email', 'give' ); ?>
396
+											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e('Email', 'give'); ?>
397 397
 											</label>
398 398
 										</li>
399 399
 										<li>
400
-											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e( 'Address', 'give' ); ?>
400
+											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e('Address', 'give'); ?>
401 401
 											</label>
402 402
 										</li>
403 403
 										<li>
404
-											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
404
+											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e('User ID', 'give'); ?>
405 405
 											</label>
406 406
 										</li>
407 407
 										<li>
408
-											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e( 'First Donation Date', 'give' ); ?>
408
+											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e('First Donation Date', 'give'); ?>
409 409
 											</label>
410 410
 										</li>
411 411
 										<li>
412
-											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?>
412
+											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?>
413 413
 											</label>
414 414
 										</li>
415 415
 										<li>
416
-											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?>
416
+											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?>
417 417
 											</label>
418 418
 										</li>
419 419
 									</ul>
420 420
 								</div>
421
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
421
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
422 422
 								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
423 423
 								<input type="hidden" name="give-action" value="email_export"/>
424 424
 							</form>
425 425
 						</td>
426 426
 					</tr>
427
-					<?php do_action( 'give_reports_tab_export_table_bottom' ); ?>
427
+					<?php do_action('give_reports_tab_export_table_bottom'); ?>
428 428
 					</tbody>
429 429
 				</table>
430 430
 
431
-				<?php do_action( 'give_reports_tab_export_content_bottom' ); ?>
431
+				<?php do_action('give_reports_tab_export_content_bottom'); ?>
432 432
 
433 433
 			</div>
434 434
 			<!-- .post-body-content -->
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	<?php
439 439
 }
440 440
 
441
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
441
+add_action('give_reports_tab_export', 'give_reports_tab_export');
442 442
 
443 443
 /**
444 444
  * Renders the Reports page
@@ -448,19 +448,19 @@  discard block
 block discarded – undo
448 448
  */
449 449
 function give_reports_tab_logs() {
450 450
 
451
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
451
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
452 452
 
453 453
 	$current_view = 'sales';
454 454
 	$log_views    = give_log_default_views();
455 455
 
456
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) {
456
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) {
457 457
 		$current_view = $_GET['view'];
458 458
 	}
459 459
 
460
-	do_action( 'give_logs_view_' . $current_view );
460
+	do_action('give_logs_view_'.$current_view);
461 461
 }
462 462
 
463
-add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' );
463
+add_action('give_reports_tab_logs', 'give_reports_tab_logs');
464 464
 
465 465
 /**
466 466
  * Retrieves estimated monthly earnings and sales
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
  */
471 471
 function give_estimated_monthly_stats() {
472 472
 
473
-	$estimated = get_transient( 'give_estimated_monthly_stats' );
473
+	$estimated = get_transient('give_estimated_monthly_stats');
474 474
 
475
-	if ( false === $estimated ) {
475
+	if (false === $estimated) {
476 476
 
477 477
 		$estimated = array(
478 478
 			'earnings' => 0,
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
 
482 482
 		$stats = new Give_Payment_Stats;
483 483
 
484
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
485
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
484
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
485
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
486 486
 
487
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
488
-		$current_month = date( 'n', current_time( 'timestamp' ) );
489
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
490
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
487
+		$current_day   = date('d', current_time('timestamp'));
488
+		$current_month = date('n', current_time('timestamp'));
489
+		$current_year  = date('Y', current_time('timestamp'));
490
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
491 491
 
492
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
493
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
492
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
493
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
494 494
 
495 495
 		// Cache for one day
496
-		set_transient( 'give_estimated_monthly_stats', $estimated, 86400 );
496
+		set_transient('give_estimated_monthly_stats', $estimated, 86400);
497 497
 	}
498 498
 
499
-	return maybe_unserialize( $estimated );
499
+	return maybe_unserialize($estimated);
500 500
 }
Please login to merge, or discard this patch.
includes/admin/customers/customers.php 2 patches
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -259,8 +259,11 @@  discard block
 block discarded – undo
259 259
 								<span class="customer-user-id info-item editable">
260 260
 									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
261 261
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
262
-									<?php else : ?>
263
-										<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
262
+									<?php else {
263
+	: ?>
264
+										<span data-key="user_id"><?php _e( 'None', 'give' );
265
+}
266
+?></span>
264 267
 									<?php endif; ?>
265 268
 									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
266 269
 										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span>
@@ -329,8 +332,11 @@  discard block
 block discarded – undo
329 332
 													}
330 333
 													?>
331 334
 												</select>
332
-											<?php else : ?>
333
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" />
335
+											<?php else {
336
+	: ?>
337
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' );
338
+}
339
+?>" />
334 340
 											<?php endif; ?>
335 341
 											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
336 342
 													</span>
@@ -420,9 +426,12 @@  discard block
 block discarded – undo
420 426
 						</td>
421 427
 					</tr>
422 428
 				<?php endforeach; ?>
423
-			<?php else: ?>
429
+			<?php else {
430
+	: ?>
424 431
 				<tr>
425
-					<td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td>
432
+					<td colspan="5"><?php _e( 'No Donations Found', 'give' );
433
+}
434
+?></td>
426 435
 				</tr>
427 436
 			<?php endif; ?>
428 437
 			</tbody>
@@ -451,9 +460,12 @@  discard block
 block discarded – undo
451 460
 						</td>
452 461
 					</tr>
453 462
 				<?php endforeach; ?>
454
-			<?php else: ?>
463
+			<?php else {
464
+	: ?>
455 465
 				<tr>
456
-					<td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td>
466
+					<td colspan="2"><?php _e( 'No Completed Donations Found', 'give' );
467
+}
468
+?></td>
457 469
 				</tr>
458 470
 			<?php endif; ?>
459 471
 			</tbody>
@@ -527,9 +539,12 @@  discard block
 block discarded – undo
527 539
 					</span>
528 540
 					</div>
529 541
 				<?php endforeach; ?>
530
-			<?php else: ?>
542
+			<?php else {
543
+	: ?>
531 544
 				<div class="give-no-customer-notes">
532
-					<?php _e( 'No Donor Notes', 'give' ); ?>
545
+					<?php _e( 'No Donor Notes', 'give' );
546
+}
547
+?>
533 548
 				</div>
534 549
 			<?php endif; ?>
535 550
 		</div>
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 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
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_customers_page() {
26 26
 	$default_views  = give_customer_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_customer_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_customer_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_customers_list();
32 32
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	$views = array();
44 44
 
45
-	return apply_filters( 'give_customer_views', $views );
45
+	return apply_filters('give_customer_views', $views);
46 46
 
47 47
 }
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	$tabs = array();
58 58
 
59
-	return apply_filters( 'give_customer_tabs', $tabs );
59
+	return apply_filters('give_customer_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_customers_list() {
70
-	include( dirname( __FILE__ ) . '/class-customer-table.php' );
70
+	include(dirname(__FILE__).'/class-customer-table.php');
71 71
 
72 72
 	$customers_table = new Give_Customer_Reports_Table();
73 73
 	$customers_table->prepare_items();
74 74
 	?>
75 75
 	<div class="wrap">
76
-		<h2><?php _e( 'Donors', 'give' ); ?></h2>
77
-		<?php do_action( 'give_donors_table_top' ); ?>
78
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
76
+		<h2><?php _e('Donors', 'give'); ?></h2>
77
+		<?php do_action('give_donors_table_top'); ?>
78
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
79 79
 			<?php
80
-			$customers_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' );
80
+			$customers_table->search_box(__('Search Donors', 'give'), 'give-donors');
81 81
 			$customers_table->display();
82 82
 			?>
83 83
 			<input type="hidden" name="post_type" value="give_forms" />
84 84
 			<input type="hidden" name="page" value="give-donors" />
85 85
 			<input type="hidden" name="view" value="customers" />
86 86
 		</form>
87
-		<?php do_action( 'give_donors_table_bottom' ); ?>
87
+		<?php do_action('give_donors_table_bottom'); ?>
88 88
 	</div>
89 89
 	<?php
90 90
 }
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * @return void
101 101
  */
102
-function give_render_customer_view( $view, $callbacks ) {
102
+function give_render_customer_view($view, $callbacks) {
103 103
 
104 104
 	$render = true;
105 105
 
106
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
106
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
107 107
 
108
-	if ( ! current_user_can( $customer_view_role ) ) {
109
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
108
+	if ( ! current_user_can($customer_view_role)) {
109
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
110 110
 		$render = false;
111 111
 	}
112 112
  
113
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
114
-		give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) );
113
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
114
+		give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give'));
115 115
 		$render = false;
116 116
 	}
117 117
 
118 118
 	$customer_id = (int) $_GET['id'];
119
-	$customer    = new Give_Customer( $customer_id );
119
+	$customer    = new Give_Customer($customer_id);
120 120
 
121
-	if ( empty( $customer->id ) ) {
122
-		give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) );
121
+	if (empty($customer->id)) {
122
+		give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give'));
123 123
 		$render = false;
124 124
 	}
125 125
 
@@ -128,27 +128,27 @@  discard block
 block discarded – undo
128 128
 
129 129
 	<div class='wrap'>
130 130
 
131
-		<?php if ( give_get_errors() ) : ?>
131
+		<?php if (give_get_errors()) : ?>
132 132
 			<div class="error settings-error">
133
-				<?php give_print_errors( 0 ); ?>
133
+				<?php give_print_errors(0); ?>
134 134
 			</div>
135 135
 		<?php endif; ?>
136 136
 
137
-		<?php if ( $customer && $render ) : ?>
137
+		<?php if ($customer && $render) : ?>
138 138
 
139 139
 			<div id="customer-tab-wrapper">
140 140
 				<ul id="customer-tab-wrapper-list" class="nav-tab-wrapper">
141
-					<?php foreach ( $customer_tabs as $key => $tab ) : ?>
141
+					<?php foreach ($customer_tabs as $key => $tab) : ?>
142 142
 						<?php $active = $key === $view ? true : false; ?>
143 143
 						<?php $class = $active ? 'active' : 'inactive'; ?>
144 144
 
145
-						<li class="<?php echo sanitize_html_class( $class ); ?>">
146
-							<?php if ( ! $active ) : ?>
147
-							<a title="<?php echo esc_attr( $tab['title'] ); ?>" aria-label="<?php echo esc_attr( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>">
145
+						<li class="<?php echo sanitize_html_class($class); ?>">
146
+							<?php if ( ! $active) : ?>
147
+							<a title="<?php echo esc_attr($tab['title']); ?>" aria-label="<?php echo esc_attr($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>">
148 148
 								<?php endif; ?>
149 149
 
150
-								<span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php echo esc_attr( $tab['title'] ); ?>
151
-								<?php if ( ! $active ) : ?>
150
+								<span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php echo esc_attr($tab['title']); ?>
151
+								<?php if ( ! $active) : ?>
152 152
 							</a>
153 153
 						<?php endif; ?>
154 154
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			</div>
161 161
 
162 162
 			<div id="give-customer-card-wrapper">
163
-				<?php $callbacks[ $view ]( $customer ) ?>
163
+				<?php $callbacks[$view]($customer) ?>
164 164
 			</div>
165 165
 
166 166
 		<?php endif; ?>
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function give_customers_view( $customer ) {
183
+function give_customers_view($customer) {
184 184
 
185
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
185
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
186 186
 
187 187
 	?>
188 188
 
189
-	<?php do_action( 'give_donor_card_top', $customer ); ?>
189
+	<?php do_action('give_donor_card_top', $customer); ?>
190 190
 
191 191
 	<div id="donor-summary" class="info-wrapper customer-section postbox">
192 192
 
193
-		<form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>">
193
+		<form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>">
194 194
 
195 195
 			<div class="customer-info">
196 196
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 				<div class="donor-bio-header clearfix">
199 199
 
200 200
 					<div class="avatar-wrap left" id="customer-avatar">
201
-						<?php echo get_avatar( $customer->email ); ?>
201
+						<?php echo get_avatar($customer->email); ?>
202 202
 					</div>
203 203
 
204 204
 					<div class="customer-id" class="left">
205 205
 						#<?php echo $customer->id; ?>
206 206
 					</div>
207 207
 					<div id="customer-name-wrap" class="left">
208
-						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span>
208
+						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span>
209 209
 						<span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span>
210 210
 					</div>
211 211
 					<p class="customer-since info-item">
212
-						<?php _e( 'Donor since', 'give' ); ?>
213
-						<?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?>
212
+						<?php _e('Donor since', 'give'); ?>
213
+						<?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?>
214 214
 					</p>
215
-					<?php if ( current_user_can( $customer_edit_role ) ): ?>
216
-						<a title="<?php _e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
215
+					<?php if (current_user_can($customer_edit_role)): ?>
216
+						<a title="<?php _e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
217 217
 					<?php endif; ?>
218 218
 				</div>
219 219
 				<!-- /donor-bio-header -->
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
 					<table class="widefat">
224 224
 						<tbody>
225 225
 						<tr>
226
-							<td><label for="tablecell"><?php esc_attr_e( 'Email', 'give' ); ?></label>:</td>
226
+							<td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?></label>:</td>
227 227
 							<td class="row-title">
228
-								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e( 'Donor Email', 'give' ); ?>" /></span>
228
+								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e('Donor Email', 'give'); ?>" /></span>
229 229
 								<span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span>
230 230
 							</td>
231 231
 						</tr>
232 232
 						<tr class="alternate">
233
-							<td><label for="tablecell"><?php esc_attr_e( 'User ID', 'give' ); ?></label>:</td>
233
+							<td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?></label>:</td>
234 234
 							<td class="row-title">
235 235
 								<span class="customer-user-id info-item edit-item">
236 236
 									<?php
@@ -246,38 +246,38 @@  discard block
 block discarded – undo
246 246
 										'data'  => $data_atts,
247 247
 									);
248 248
 
249
-									if ( ! empty( $user_id ) ) {
250
-										$userdata           = get_userdata( $user_id );
249
+									if ( ! empty($user_id)) {
250
+										$userdata           = get_userdata($user_id);
251 251
 										$user_args['value'] = $userdata->user_login;
252 252
 									}
253 253
 
254
-									echo Give()->html->ajax_user_search( $user_args );
254
+									echo Give()->html->ajax_user_search($user_args);
255 255
 									?>
256 256
 									<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" />
257 257
 								</span>
258 258
 			
259 259
 								<span class="customer-user-id info-item editable">
260
-									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
260
+									<?php if (intval($customer->user_id) > 0) : ?>
261 261
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
262 262
 									<?php else : ?>
263
-										<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
263
+										<span data-key="user_id"><?php _e('None', 'give'); ?></span>
264 264
 									<?php endif; ?>
265
-									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
266
-										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span>
265
+									<?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?>
266
+										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php _e('Disconnect User', 'give'); ?></a></span>
267 267
 									<?php endif; ?>
268 268
 								</span>
269 269
 							</td>
270 270
 						</tr>
271
-						<?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?>
271
+						<?php if (isset($customer->user_id) && $customer->user_id > 0) : ?>
272 272
 
273 273
 							<tr>
274
-								<td><?php esc_attr_e( 'Address', 'give' ); ?>:</td>
274
+								<td><?php esc_attr_e('Address', 'give'); ?>:</td>
275 275
 								<td class="row-title">
276 276
 
277 277
 									<div class="customer-address-wrapper">
278 278
 
279 279
 										<?php
280
-										$address  = get_user_meta( $customer->user_id, '_give_user_address', true );
280
+										$address  = get_user_meta($customer->user_id, '_give_user_address', true);
281 281
 										$defaults = array(
282 282
 											'line1'   => '',
283 283
 											'line2'   => '',
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 											'zip'     => ''
288 288
 										);
289 289
 
290
-										$address = wp_parse_args( $address, $defaults );
290
+										$address = wp_parse_args($address, $defaults);
291 291
 										?>
292 292
 
293
-										<?php if ( ! empty( $address ) ) { ?>
293
+										<?php if ( ! empty($address)) { ?>
294 294
 											<span class="customer-address info-item editable">
295 295
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
296 296
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -301,38 +301,38 @@  discard block
 block discarded – undo
301 301
 											</span>
302 302
 										<?php } ?>
303 303
 										<span class="customer-address info-item edit-item">
304
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
305
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
306
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
304
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
305
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
306
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
307 307
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
308 308
 												<?php
309 309
 
310 310
 												$selected_country = $address['country'];
311 311
 
312 312
 												$countries = give_get_country_list();
313
-												foreach ( $countries as $country_code => $country ) {
314
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
313
+												foreach ($countries as $country_code => $country) {
314
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
315 315
 												}
316 316
 												?>
317 317
 											</select>
318 318
 											<?php
319 319
 											$selected_state = give_get_state();
320
-											$states         = give_get_states( $selected_country );
320
+											$states         = give_get_states($selected_country);
321 321
 
322
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
322
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
323 323
 
324
-											if ( ! empty( $states ) ) : ?>
324
+											if ( ! empty($states)) : ?>
325 325
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
326 326
 													<?php
327
-													foreach ( $states as $state_code => $state ) {
328
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
327
+													foreach ($states as $state_code => $state) {
328
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
329 329
 													}
330 330
 													?>
331 331
 												</select>
332 332
 											<?php else : ?>
333
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" />
333
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?>" />
334 334
 											<?php endif; ?>
335
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
335
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
336 336
 													</span>
337 337
 
338 338
 									</div>
@@ -350,98 +350,98 @@  discard block
 block discarded – undo
350 350
 
351 351
 			<span id="customer-edit-actions" class="edit-item">
352 352
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" />
353
-				<?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?>
353
+				<?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?>
354 354
 				<input type="hidden" name="give_action" value="edit-customer" />
355
-				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" />
356
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
355
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" />
356
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
357 357
 			</span>
358 358
 
359 359
 		</form>
360 360
 	</div>
361 361
 
362
-	<?php do_action( 'give_donor_before_stats', $customer ); ?>
362
+	<?php do_action('give_donor_before_stats', $customer); ?>
363 363
 
364 364
 	<div id="customer-stats-wrapper" class="customer-section postbox clear">
365 365
 		<ul>
366 366
 			<li>
367
-				<a title="<?php _e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>">
367
+				<a title="<?php _e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>">
368 368
 					<span class="dashicons dashicons-heart"></span>
369 369
 					<?php
370 370
 					//Completed Donations
371
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count );
372
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer );
371
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count);
372
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer);
373 373
 					?>
374 374
 				</a>
375 375
 			</li>
376 376
 			<li>
377 377
 				<span class="dashicons dashicons-chart-area"></span>
378
-				<?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
378
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?>
379 379
 			</li>
380
-			<?php do_action( 'give_donor_stats_list', $customer ); ?>
380
+			<?php do_action('give_donor_stats_list', $customer); ?>
381 381
 		</ul>
382 382
 	</div>
383 383
 
384
-	<?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?>
384
+	<?php do_action('give_donor_before_tables_wrapper', $customer); ?>
385 385
 
386 386
 	<div id="customer-tables-wrapper" class="customer-section">
387 387
 
388
-		<?php do_action( 'give_donor_before_tables', $customer ); ?>
388
+		<?php do_action('give_donor_before_tables', $customer); ?>
389 389
 
390
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
390
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
391 391
 		<?php
392
-		$payment_ids = explode( ',', $customer->payment_ids );
393
-		$payments    = give_get_payments( array( 'post__in' => $payment_ids ) );
394
-		$payments    = array_slice( $payments, 0, 10 );
392
+		$payment_ids = explode(',', $customer->payment_ids);
393
+		$payments    = give_get_payments(array('post__in' => $payment_ids));
394
+		$payments    = array_slice($payments, 0, 10);
395 395
 		?>
396 396
 		<table class="wp-list-table widefat striped payments">
397 397
 			<thead>
398 398
 			<tr>
399
-				<th><?php _e( 'ID', 'give' ); ?></th>
400
-				<th><?php _e( 'Amount', 'give' ); ?></th>
401
-				<th><?php _e( 'Date', 'give' ); ?></th>
402
-				<th><?php _e( 'Status', 'give' ); ?></th>
403
-				<th><?php _e( 'Actions', 'give' ); ?></th>
399
+				<th><?php _e('ID', 'give'); ?></th>
400
+				<th><?php _e('Amount', 'give'); ?></th>
401
+				<th><?php _e('Date', 'give'); ?></th>
402
+				<th><?php _e('Status', 'give'); ?></th>
403
+				<th><?php _e('Actions', 'give'); ?></th>
404 404
 			</tr>
405 405
 			</thead>
406 406
 			<tbody>
407
-			<?php if ( ! empty( $payments ) ) : ?>
408
-				<?php foreach ( $payments as $payment ) : ?>
407
+			<?php if ( ! empty($payments)) : ?>
408
+				<?php foreach ($payments as $payment) : ?>
409 409
 					<tr>
410 410
 						<td><?php echo $payment->ID; ?></td>
411
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
412
-						<td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td>
413
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
411
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
412
+						<td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td>
413
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
414 414
 						<td>
415
-							<a title="<?php _e( 'View Details for Donation', 'give' );
416
-							echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>">
417
-								<?php _e( 'View Details', 'give' ); ?>
415
+							<a title="<?php _e('View Details for Donation', 'give');
416
+							echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>">
417
+								<?php _e('View Details', 'give'); ?>
418 418
 							</a>
419
-							<?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?>
419
+							<?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?>
420 420
 						</td>
421 421
 					</tr>
422 422
 				<?php endforeach; ?>
423 423
 			<?php else: ?>
424 424
 				<tr>
425
-					<td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td>
425
+					<td colspan="5"><?php _e('No Donations Found', 'give'); ?></td>
426 426
 				</tr>
427 427
 			<?php endif; ?>
428 428
 			</tbody>
429 429
 		</table>
430 430
 
431
-		<h3><?php _e( 'Completed Donations', 'give' ); ?></h3>
431
+		<h3><?php _e('Completed Donations', 'give'); ?></h3>
432 432
 		<?php
433
-		$donations = give_get_users_completed_donations( $customer->email );
433
+		$donations = give_get_users_completed_donations($customer->email);
434 434
 		?>
435 435
 		<table class="wp-list-table widefat striped donations">
436 436
 			<thead>
437 437
 			<tr>
438 438
 				<th><?php echo give_get_forms_label_singular(); ?></th>
439
-				<th width="120px"><?php _e( 'Actions', 'give' ); ?></th>
439
+				<th width="120px"><?php _e('Actions', 'give'); ?></th>
440 440
 			</tr>
441 441
 			</thead>
442 442
 			<tbody>
443
-			<?php if ( ! empty( $donations ) ) : ?>
444
-				<?php foreach ( $donations as $donation ) : ?>
443
+			<?php if ( ! empty($donations)) : ?>
444
+				<?php foreach ($donations as $donation) : ?>
445 445
 					<tr>
446 446
 						<td><?php echo $donation->post_title; ?></td>
447 447
 						<td>
@@ -449,15 +449,15 @@  discard block
 block discarded – undo
449 449
 								echo esc_attr(
450 450
 									sprintf(
451 451
 										/* translators: %s: post title */
452
-										__( 'View %s', 'give' ),
452
+										__('View %s', 'give'),
453 453
 										$donation->post_title
454 454
 									)
455
-								); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) );
455
+								); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID));
456 456
 							?>">
457 457
 								<?php
458 458
 									printf(
459 459
 										/* translators: %s: forms singular label */
460
-										__( 'View %s', 'give' ),
460
+										__('View %s', 'give'),
461 461
 										give_get_forms_label_singular()
462 462
 									);
463 463
 								?>
@@ -467,17 +467,17 @@  discard block
 block discarded – undo
467 467
 				<?php endforeach; ?>
468 468
 			<?php else: ?>
469 469
 				<tr>
470
-					<td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td>
470
+					<td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?></td>
471 471
 				</tr>
472 472
 			<?php endif; ?>
473 473
 			</tbody>
474 474
 		</table>
475 475
 
476
-		<?php do_action( 'give_donor_after_tables', $customer ); ?>
476
+		<?php do_action('give_donor_after_tables', $customer); ?>
477 477
 
478 478
 	</div>
479 479
 
480
-	<?php do_action( 'give_donor_card_bottom', $customer ); ?>
480
+	<?php do_action('give_donor_card_bottom', $customer); ?>
481 481
 
482 482
 	<?php
483 483
 }
@@ -491,30 +491,30 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return void
493 493
  */
494
-function give_customer_notes_view( $customer ) {
494
+function give_customer_notes_view($customer) {
495 495
 
496
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
497
-	$paged          = absint( $paged );
496
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
497
+	$paged          = absint($paged);
498 498
 	$note_count     = $customer->get_notes_count();
499
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
500
-	$total_pages    = ceil( $note_count / $per_page );
501
-	$customer_notes = $customer->get_notes( $per_page, $paged );
499
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
500
+	$total_pages    = ceil($note_count / $per_page);
501
+	$customer_notes = $customer->get_notes($per_page, $paged);
502 502
 	?>
503 503
 
504 504
 	<div id="customer-notes-wrapper">
505 505
 		<div class="customer-notes-header">
506
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
506
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
507 507
 		</div>
508
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
508
+		<h3><?php _e('Notes', 'give'); ?></h3>
509 509
 
510
-		<?php if ( 1 == $paged ) : ?>
510
+		<?php if (1 == $paged) : ?>
511 511
 			<div style="display: block; margin-bottom: 55px;">
512
-				<form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>">
512
+				<form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>">
513 513
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
514 514
 					<br />
515 515
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
516 516
 					<input type="hidden" name="give_action" value="add-customer-note" />
517
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
517
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
518 518
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
519 519
 				</form>
520 520
 			</div>
@@ -529,46 +529,46 @@  discard block
 block discarded – undo
529 529
 			'show_all' => true
530 530
 		);
531 531
 
532
-		echo paginate_links( $pagination_args );
532
+		echo paginate_links($pagination_args);
533 533
 		?>
534 534
 
535 535
 		<div id="give-customer-notes" class="postbox">
536
-			<?php if ( count( $customer_notes ) > 0 ) : ?>
537
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
536
+			<?php if (count($customer_notes) > 0) : ?>
537
+				<?php foreach ($customer_notes as $key => $note) : ?>
538 538
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
539 539
 					<span class="note-content-wrap">
540
-						<?php echo stripslashes( $note ); ?>
540
+						<?php echo stripslashes($note); ?>
541 541
 					</span>
542 542
 					</div>
543 543
 				<?php endforeach; ?>
544 544
 			<?php else: ?>
545 545
 				<div class="give-no-customer-notes">
546
-					<?php _e( 'No Donor Notes', 'give' ); ?>
546
+					<?php _e('No Donor Notes', 'give'); ?>
547 547
 				</div>
548 548
 			<?php endif; ?>
549 549
 		</div>
550 550
 
551
-		<?php echo paginate_links( $pagination_args ); ?>
551
+		<?php echo paginate_links($pagination_args); ?>
552 552
 
553 553
 	</div>
554 554
 
555 555
 	<?php
556 556
 }
557 557
 
558
-function give_customers_delete_view( $customer ) {
558
+function give_customers_delete_view($customer) {
559 559
 
560
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
560
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
561 561
 
562 562
 	?>
563 563
 
564
-	<?php do_action( 'give_customer_delete_top', $customer ); ?>
564
+	<?php do_action('give_customer_delete_top', $customer); ?>
565 565
 
566 566
 	<div class="info-wrapper customer-section">
567 567
 
568
-		<form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>">
568
+		<form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>">
569 569
 
570 570
 			<div class="customer-notes-header">
571
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
571
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
572 572
 			</div>
573 573
 
574 574
 
@@ -576,27 +576,27 @@  discard block
 block discarded – undo
576 576
 
577 577
 				<span class="delete-customer-options">
578 578
 					<p>
579
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
580
-						<label for="give-customer-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
579
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
580
+						<label for="give-customer-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
581 581
 					</p>
582 582
 
583 583
 					<p>
584
-						<?php echo Give()->html->checkbox( array(
584
+						<?php echo Give()->html->checkbox(array(
585 585
 							'name'    => 'give-customer-delete-records',
586
-							'options' => array( 'disabled' => true )
587
-						) ); ?>
588
-						<label for="give-customer-delete-records"><?php _e( 'Delete all associated payments and records?', 'give' ); ?></label>
586
+							'options' => array('disabled' => true)
587
+						)); ?>
588
+						<label for="give-customer-delete-records"><?php _e('Delete all associated payments and records?', 'give'); ?></label>
589 589
 					</p>
590 590
 
591
-					<?php do_action( 'give_customer_delete_inputs', $customer ); ?>
591
+					<?php do_action('give_customer_delete_inputs', $customer); ?>
592 592
 				</span>
593 593
 
594 594
 				<span id="customer-edit-actions">
595 595
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
596
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
596
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
597 597
 					<input type="hidden" name="give_action" value="delete-customer" />
598
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" />
599
-					<a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
598
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" />
599
+					<a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a>
600 600
 				</span>
601 601
 
602 602
 			</div>
@@ -606,5 +606,5 @@  discard block
 block discarded – undo
606 606
 
607 607
 	<?php
608 608
 
609
-	do_action( 'give_customer_delete_bottom', $customer );
609
+	do_action('give_customer_delete_bottom', $customer);
610 610
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +68 added lines, -68 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,18 +25,18 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_show_upgrade_notices() {
27 27
 
28
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
28
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
29 29
 		return;
30 30
 	} // Don't show notices on the upgrades page
31 31
 
32
-	$give_version = get_option( 'give_version' );
32
+	$give_version = get_option('give_version');
33 33
 
34
-	if ( ! $give_version ) {
34
+	if ( ! $give_version) {
35 35
 		// 1.0 is the first version to use this option so we must add it
36 36
 		$give_version = '1.0';
37 37
 	}
38 38
 
39
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
39
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
40 40
 
41 41
 	/*
42 42
 	 *  NOTICE:
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 
49 49
 	//v1.3.2 Upgrades
50
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
50
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
51 51
 		printf(
52
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
53
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
52
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
53
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
54 54
 		);
55 55
 	}
56 56
 
57 57
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
58
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
58
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
59 59
 		printf(
60
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
61
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
60
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
61
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
62 62
 		);
63 63
 	}
64 64
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 }
70 70
 
71
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
71
+add_action('admin_notices', 'give_show_upgrade_notices');
72 72
 
73 73
 /**
74 74
  * Triggers all upgrade functions
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function give_trigger_upgrades() {
82 82
 
83
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
84
-		wp_die( __( 'You do not have permission to do Give upgrades.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
83
+	if ( ! current_user_can('manage_give_settings')) {
84
+		wp_die(__('You do not have permission to do Give upgrades.', 'give'), __('Error', 'give'), array('response' => 403));
85 85
 	}
86 86
 
87
-	$give_version = get_option( 'give_version' );
87
+	$give_version = get_option('give_version');
88 88
 
89
-	if ( ! $give_version ) {
89
+	if ( ! $give_version) {
90 90
 		// 1.0 is the first version to use this option so we must add it
91 91
 		$give_version = '1.0';
92
-		add_option( 'give_version', $give_version );
92
+		add_option('give_version', $give_version);
93 93
 	}
94 94
 
95
-	update_option( 'give_version', GIVE_VERSION );
95
+	update_option('give_version', GIVE_VERSION);
96 96
 
97
-	if ( DOING_AJAX ) {
98
-		die( 'complete' );
97
+	if (DOING_AJAX) {
98
+		die('complete');
99 99
 	} // Let AJAX know that the upgrade is complete
100 100
 }
101 101
 
102
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
102
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
103 103
 
104 104
 /**
105 105
  * Check if the upgrade routine has been run for a specific action
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
  *
111 111
  * @return bool                   If the action has been added to the completed actions array
112 112
  */
113
-function give_has_upgrade_completed( $upgrade_action = '' ) {
113
+function give_has_upgrade_completed($upgrade_action = '') {
114 114
 
115
-	if ( empty( $upgrade_action ) ) {
115
+	if (empty($upgrade_action)) {
116 116
 		return false;
117 117
 	}
118 118
 
119 119
 	$completed_upgrades = give_get_completed_upgrades();
120 120
 
121
-	return in_array( $upgrade_action, $completed_upgrades );
121
+	return in_array($upgrade_action, $completed_upgrades);
122 122
 
123 123
 }
124 124
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @return bool                   If the function was successfully added
133 133
  */
134
-function give_set_upgrade_complete( $upgrade_action = '' ) {
134
+function give_set_upgrade_complete($upgrade_action = '') {
135 135
 
136
-	if ( empty( $upgrade_action ) ) {
136
+	if (empty($upgrade_action)) {
137 137
 		return false;
138 138
 	}
139 139
 
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	$completed_upgrades[] = $upgrade_action;
142 142
 
143 143
 	// Remove any blanks, and only show uniques
144
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
144
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
145 145
 
146
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
146
+	return update_option('give_completed_upgrades', $completed_upgrades);
147 147
 }
148 148
 
149 149
 /**
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  */
155 155
 function give_get_completed_upgrades() {
156 156
 
157
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
157
+	$completed_upgrades = get_option('give_completed_upgrades');
158 158
 
159
-	if ( false === $completed_upgrades ) {
159
+	if (false === $completed_upgrades) {
160 160
 		$completed_upgrades = array();
161 161
 	}
162 162
 
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function give_v132_upgrade_give_payment_customer_id() {
177 177
 	global $wpdb;
178
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
179
-		wp_die( __( 'You do not have permission to do Give upgrades.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
178
+	if ( ! current_user_can('manage_give_settings')) {
179
+		wp_die(__('You do not have permission to do Give upgrades.', 'give'), __('Error', 'give'), array('response' => 403));
180 180
 	}
181 181
 
182
-	ignore_user_abort( true );
182
+	ignore_user_abort(true);
183 183
 
184
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
185
-		@set_time_limit( 0 );
184
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
185
+		@set_time_limit(0);
186 186
 	}
187 187
 
188 188
 	//UPDATE DB METAKEYS
189 189
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
190
-	$query = $wpdb->query( $sql );
190
+	$query = $wpdb->query($sql);
191 191
 
192
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
193
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
194
-	delete_option( 'give_doing_upgrade' );
195
-	wp_redirect( admin_url() );
192
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
193
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
194
+	delete_option('give_doing_upgrade');
195
+	wp_redirect(admin_url());
196 196
 	exit;
197 197
 
198 198
 
199 199
 }
200 200
 
201
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
201
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
202 202
 
203 203
 /**
204 204
  * Upgrades the Offline Status
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 
213 213
 	global $wpdb;
214 214
 
215
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
216
-		wp_die( __( 'You do not have permission to do Give upgrades.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
215
+	if ( ! current_user_can('manage_give_settings')) {
216
+		wp_die(__('You do not have permission to do Give upgrades.', 'give'), __('Error', 'give'), array('response' => 403));
217 217
 	}
218 218
 
219
-	ignore_user_abort( true );
219
+	ignore_user_abort(true);
220 220
 
221
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
222
-		@set_time_limit( 0 );
221
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
222
+		@set_time_limit(0);
223 223
 	}
224 224
 
225 225
 	// Get abandoned offline payments
@@ -229,35 +229,35 @@  discard block
 block discarded – undo
229 229
 	$where .= "AND ( p.post_status = 'abandoned' )";
230 230
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
231 231
 
232
-	$sql            = $select . $join . $where;
233
-	$found_payments = $wpdb->get_col( $sql );
232
+	$sql            = $select.$join.$where;
233
+	$found_payments = $wpdb->get_col($sql);
234 234
 
235 235
 
236
-	foreach ( $found_payments as $payment ) {
236
+	foreach ($found_payments as $payment) {
237 237
 
238 238
 		//Only change ones marked abandoned since our release last week
239 239
 		//because the admin may have marked some abandoned themselves
240
-		$modified_time = get_post_modified_time( 'U', false, $payment );
240
+		$modified_time = get_post_modified_time('U', false, $payment);
241 241
 
242 242
 		//1450124863 =  12/10/2015 20:42:25
243
-		if ( $modified_time >= 1450124863 ) {
243
+		if ($modified_time >= 1450124863) {
244 244
 
245
-			give_update_payment_status( $payment, 'pending' );
245
+			give_update_payment_status($payment, 'pending');
246 246
 
247 247
 		}
248 248
 
249 249
 	}
250 250
 
251
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
252
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
253
-	delete_option( 'give_doing_upgrade' );
254
-	wp_redirect( admin_url() );
251
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
252
+	give_set_upgrade_complete('upgrade_give_offline_status');
253
+	delete_option('give_doing_upgrade');
254
+	wp_redirect(admin_url());
255 255
 	exit;
256 256
 
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
260
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
261 261
 
262 262
 
263 263
 /**
@@ -269,17 +269,17 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function give_v152_cleanup_users() {
271 271
 
272
-	$give_version = get_option( 'give_version' );
272
+	$give_version = get_option('give_version');
273 273
 
274
-	if ( ! $give_version ) {
274
+	if ( ! $give_version) {
275 275
 		// 1.0 is the first version to use this option so we must add it
276 276
 		$give_version = '1.0';
277 277
 	}
278 278
 
279
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
279
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
280 280
 
281 281
 	//v1.5.2 Upgrades
282
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
282
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
283 283
 
284 284
 		//Delete all caps with "ss"
285 285
 		//Also delete all unused "campaign" roles
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 		);
327 327
 	
328 328
 		global $wp_roles;
329
-		foreach ( $delete_caps as $cap ) {
330
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
331
-				$wp_roles->remove_cap( $role, $cap );
329
+		foreach ($delete_caps as $cap) {
330
+			foreach (array_keys($wp_roles->roles) as $role) {
331
+				$wp_roles->remove_cap($role, $cap);
332 332
 			}
333 333
 		}
334 334
 	
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 		$roles->add_caps();
339 339
 		
340 340
 		//The Update Ran
341
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
342
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
343
-		delete_option( 'give_doing_upgrade' );
341
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
342
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
343
+		delete_option('give_doing_upgrade');
344 344
 
345 345
 	}
346 346
 
347 347
 }
348 348
 
349
-add_action( 'admin_init', 'give_v152_cleanup_users' );
350 349
\ No newline at end of file
350
+add_action('admin_init', 'give_v152_cleanup_users');
351 351
\ No newline at end of file
Please login to merge, or discard this patch.
includes/emails/actions.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return void
25 25
  */
26
-function give_trigger_donation_receipt( $payment_id ) {
26
+function give_trigger_donation_receipt($payment_id) {
27 27
 	// Make sure we don't send a purchase receipt while editing a payment
28
-	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) {
28
+	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) {
29 29
 		return;
30 30
 	}
31 31
 
32 32
 	// Send email
33
-	give_email_donation_receipt( $payment_id );
33
+	give_email_donation_receipt($payment_id);
34 34
 }
35 35
 
36
-add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 );
36
+add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1);
37 37
 
38 38
 /**
39 39
  * Resend the Email Purchase Receipt. (This can be done from the Payment History page)
@@ -44,29 +44,29 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return void
46 46
  */
47
-function give_resend_donation_receipt( $data ) {
47
+function give_resend_donation_receipt($data) {
48 48
 
49
-	$purchase_id = absint( $data['purchase_id'] );
49
+	$purchase_id = absint($data['purchase_id']);
50 50
 
51
-	if ( empty( $purchase_id ) ) {
51
+	if (empty($purchase_id)) {
52 52
 		return;
53 53
 	}
54 54
 
55
-	if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) {
56
-		wp_die( __( 'You do not have permission to edit payment records.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
55
+	if ( ! current_user_can('edit_give_payments', $purchase_id)) {
56
+		wp_die(__('You do not have permission to edit payment records.', 'give'), __('Error', 'give'), array('response' => 403));
57 57
 	}
58 58
 
59
-	give_email_donation_receipt( $purchase_id, false );
59
+	give_email_donation_receipt($purchase_id, false);
60 60
 
61
-	wp_redirect( add_query_arg( array(
61
+	wp_redirect(add_query_arg(array(
62 62
 		'give-message' => 'email_sent',
63 63
 		'give-action'  => false,
64 64
 		'purchase_id'  => false
65
-	) ) );
65
+	)));
66 66
 	exit;
67 67
 }
68 68
 
69
-add_action( 'give_email_links', 'give_resend_donation_receipt' );
69
+add_action('give_email_links', 'give_resend_donation_receipt');
70 70
 
71 71
 /**
72 72
  * Trigger the sending of a Test Email
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
  *
78 78
  * @return void
79 79
  */
80
-function give_send_test_email( $data ) {
81
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) {
80
+function give_send_test_email($data) {
81
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) {
82 82
 		return;
83 83
 	}
84 84
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	give_email_test_donation_receipt();
87 87
 
88 88
 	// Remove the test email query arg
89
-	wp_redirect( remove_query_arg( 'give_action' ) );
89
+	wp_redirect(remove_query_arg('give_action'));
90 90
 	exit;
91 91
 }
92 92
 
93
-add_action( 'give_send_test_email', 'give_send_test_email' );
93
+add_action('give_send_test_email', 'give_send_test_email');
Please login to merge, or discard this patch.