Completed
Pull Request — master (#770)
by Devin
20:03
created
includes/admin/welcome.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,38 +51,38 @@  discard block
 block discarded – undo
51 51
 	public function admin_menus() {
52 52
 		// About Page
53 53
 		add_dashboard_page(
54
-			__( 'Welcome to Give', 'give' ),
55
-			__( 'Welcome to Give', 'give' ),
54
+			__('Welcome to Give', 'give'),
55
+			__('Welcome to Give', 'give'),
56 56
 			$this->minimum_capability,
57 57
 			'give-about',
58
-			array( $this, 'about_screen' )
58
+			array($this, 'about_screen')
59 59
 		);
60 60
 
61 61
 		// Changelog Page
62 62
 		add_dashboard_page(
63
-			__( 'Give Changelog', 'give' ),
64
-			__( 'Give Changelog', 'give' ),
63
+			__('Give Changelog', 'give'),
64
+			__('Give Changelog', 'give'),
65 65
 			$this->minimum_capability,
66 66
 			'give-changelog',
67
-			array( $this, 'changelog_screen' )
67
+			array($this, 'changelog_screen')
68 68
 		);
69 69
 
70 70
 		// Getting Started Page
71 71
 		add_dashboard_page(
72
-			__( 'Getting started with Give', 'give' ),
73
-			__( 'Getting started with Give', 'give' ),
72
+			__('Getting started with Give', 'give'),
73
+			__('Getting started with Give', 'give'),
74 74
 			$this->minimum_capability,
75 75
 			'give-getting-started',
76
-			array( $this, 'getting_started_screen' )
76
+			array($this, 'getting_started_screen')
77 77
 		);
78 78
 
79 79
 		// Credits Page
80 80
 		add_dashboard_page(
81
-			__( 'The people that build Give', 'give' ),
82
-			__( 'The people that build Give', 'give' ),
81
+			__('The people that build Give', 'give'),
82
+			__('The people that build Give', 'give'),
83 83
 			$this->minimum_capability,
84 84
 			'give-credits',
85
-			array( $this, 'credits_screen' )
85
+			array($this, 'credits_screen')
86 86
 		);
87 87
 	}
88 88
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function admin_head() {
97 97
 
98
-		remove_submenu_page( 'index.php', 'give-about' );
99
-		remove_submenu_page( 'index.php', 'give-changelog' );
100
-		remove_submenu_page( 'index.php', 'give-getting-started' );
101
-		remove_submenu_page( 'index.php', 'give-credits' );
98
+		remove_submenu_page('index.php', 'give-about');
99
+		remove_submenu_page('index.php', 'give-changelog');
100
+		remove_submenu_page('index.php', 'give-getting-started');
101
+		remove_submenu_page('index.php', 'give-credits');
102 102
 
103 103
 		// Badge for welcome page
104
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
104
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
105 105
 
106 106
 		?>
107 107
 		<style type="text/css" media="screen">
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 	 * @return void
216 216
 	 */
217 217
 	public function tabs() {
218
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
218
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
219 219
 		?>
220 220
 		<h1 class="nav-tab-wrapper">
221
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
222
-				<?php _e( "About Give", 'give' ); ?>
221
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
222
+				<?php _e("About Give", 'give'); ?>
223 223
 			</a>
224
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
225
-				<?php _e( 'Getting Started', 'give' ); ?>
224
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
225
+				<?php _e('Getting Started', 'give'); ?>
226 226
 			</a>
227
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
228
-				<?php _e( 'Credits', 'give' ); ?>
227
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
228
+				<?php _e('Credits', 'give'); ?>
229 229
 			</a>
230
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
-				<?php _e( 'Add-ons', 'give' ); ?>
230
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
+				<?php _e('Add-ons', 'give'); ?>
232 232
 			</a>
233 233
 		</h1>
234 234
 	<?php
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @return void
243 243
 	 */
244 244
 	public function about_screen() {
245
-		list( $display_version ) = explode( '-', GIVE_VERSION );
245
+		list($display_version) = explode('-', GIVE_VERSION);
246 246
 		?>
247 247
 		<div class="wrap about-wrap">
248 248
 			<h1 class="welcome-h1"><?php
249 249
 				printf(
250 250
 					/* translators: %s: Give version */
251
-					__( 'Welcome to Give %s', 'give' ),
251
+					__('Welcome to Give %s', 'give'),
252 252
 					$display_version
253 253
 				);
254 254
 			?></h1>
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 			<div class="about-text"><?php
259 259
 				printf(
260 260
 					/* translators: 1: https://givewp.com/documenation/ 2: title attribute text */
261
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
262
-					esc_url( 'https://givewp.com/documenation/' ),
263
-					esc_attr( 'View the Give plugin documentation online', 'give' )
261
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
262
+					esc_url('https://givewp.com/documenation/'),
263
+					esc_attr('View the Give plugin documentation online', 'give')
264 264
 				);
265 265
 			?></div>
266 266
 
267
-			<p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
267
+			<p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
268 268
 
269 269
 			<?php give_get_newsletter() ?>
270 270
 
271 271
 			<div class="give-badge"><?php
272 272
 				printf(
273 273
 					/* translators: %s: Give version */
274
-					__( 'Version %s', 'give' ),
274
+					__('Version %s', 'give'),
275 275
 					$display_version
276 276
 				);
277 277
 			?></div>
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 			<div class="feature-section clearfix introduction">
284 284
 
285 285
 				<div class="video feature-section-item">
286
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
286
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
287 287
 
288 288
 				</div>
289 289
 
290 290
 				<div class="content feature-section-item last-feature">
291 291
 
292
-					<h3><?php _e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
292
+					<h3><?php _e('Give - Democratizing Generosity', 'give'); ?></h3>
293 293
 
294
-					<p><?php _e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
294
+					<p><?php _e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
295 295
 					<a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More
296 296
 						<span class="dashicons dashicons-external"></span></a>
297 297
 
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 				<div class="content feature-section-item">
306 306
 
307
-					<h3><?php _e( 'Getting to Know Give', 'give' ); ?></h3>
307
+					<h3><?php _e('Getting to Know Give', 'give'); ?></h3>
308 308
 
309
-					<p><?php _e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
309
+					<p><?php _e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
310 310
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation
311 311
 						<span class="dashicons dashicons-external"></span></a>
312 312
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 				<div class="content  feature-section-item last-feature">
316 316
 
317
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
317
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
318 318
 
319 319
 				</div>
320 320
 
@@ -334,22 +334,22 @@  discard block
 block discarded – undo
334 334
 	 * @return void
335 335
 	 */
336 336
 	public function changelog_screen() {
337
-		list( $display_version ) = explode( '-', GIVE_VERSION );
337
+		list($display_version) = explode('-', GIVE_VERSION);
338 338
 		?>
339 339
 		<div class="wrap about-wrap">
340
-			<h1><?php _e( 'Give Changelog', 'give' ); ?></h1>
340
+			<h1><?php _e('Give Changelog', 'give'); ?></h1>
341 341
 
342 342
 			<div class="about-text"><?php
343 343
 				printf(
344 344
 					/* translators: %s: Give version */
345
-					__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
345
+					__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
346 346
 					$display_version
347 347
 				);
348 348
 			?></div>
349 349
 			<div class="give-badge"><?php
350 350
 				printf(
351 351
 					/* translators: %s: Give version */
352
-					__( 'Version %s', 'give' ),
352
+					__('Version %s', 'give'),
353 353
 					$display_version
354 354
 				);
355 355
 			?></div>
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			<?php $this->tabs(); ?>
358 358
 
359 359
 			<div class="changelog">
360
-				<h3><?php _e( 'Full Changelog', 'give' ); ?></h3>
360
+				<h3><?php _e('Full Changelog', 'give'); ?></h3>
361 361
 
362 362
 				<div class="feature-section">
363 363
 					<?php echo $this->parse_readme(); ?>
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
 			</div>
366 366
 
367 367
 			<div class="return-to-dashboard">
368
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
368
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
369 369
 					'post_type' => 'give_forms',
370 370
 					'page'      => 'give-settings'
371
-				), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Give Settings', 'give' ); ?></a>
371
+				), 'edit.php'))); ?>"><?php _e('Go to Give Settings', 'give'); ?></a>
372 372
 			</div>
373 373
 		</div>
374 374
 	<?php
@@ -382,29 +382,29 @@  discard block
 block discarded – undo
382 382
 	 * @return void
383 383
 	 */
384 384
 	public function getting_started_screen() {
385
-		list( $display_version ) = explode( '-', GIVE_VERSION );
385
+		list($display_version) = explode('-', GIVE_VERSION);
386 386
 		?>
387 387
 		<div class="wrap about-wrap get-started">
388 388
 			<h1 class="welcome-h1"><?php
389 389
 				printf(
390 390
 					/* translators: %s: Give version */
391
-					__( 'Give %s - Getting Started Guide', 'give' ),
391
+					__('Give %s - Getting Started Guide', 'give'),
392 392
 					$display_version
393 393
 				);
394 394
 			?></h1>
395 395
 
396 396
 			<?php give_social_media_elements() ?>
397 397
 
398
-			<div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div>
398
+			<div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div>
399 399
 
400
-			<p class="newsletter-intro"><?php _e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p>
400
+			<p class="newsletter-intro"><?php _e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p>
401 401
 
402 402
 			<?php give_get_newsletter() ?>
403 403
 
404 404
 			<div class="give-badge"><?php
405 405
 				printf(
406 406
 					/* translators: %s: Give version */
407
-					__( 'Version %s', 'give' ),
407
+					__('Version %s', 'give'),
408 408
 					$display_version
409 409
 				);
410 410
 			?></div>
@@ -412,17 +412,17 @@  discard block
 block discarded – undo
412 412
 			<?php $this->tabs(); ?>
413 413
 
414 414
 
415
-			<div class="about-text"><?php printf( __( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></div>
415
+			<div class="about-text"><?php printf(__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></div>
416 416
 
417 417
 
418 418
 			<div class="feature-section clearfix">
419 419
 
420 420
 				<div class="content feature-section-item">
421
-					<h3><?php _e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
421
+					<h3><?php _e('STEP 1: Create a New Form', 'give'); ?></h3>
422 422
 
423
-					<p><?php _e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p>
423
+					<p><?php _e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p>
424 424
 
425
-					<p><?php _e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p>
425
+					<p><?php _e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p>
426 426
 				</div>
427 427
 
428 428
 				<div class="content feature-section-item last-feature">
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 				</div>
440 440
 
441 441
 				<div class="content feature-section-item last-feature">
442
-					<h3><?php _e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3>
442
+					<h3><?php _e('STEP 2: Choose Your Levels', 'give'); ?></h3>
443 443
 
444
-					<p><?php _e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p>
444
+					<p><?php _e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p>
445 445
 				</div>
446 446
 
447 447
 			</div>
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 			<div class="feature-section clearfix">
451 451
 
452 452
 				<div class="content feature-section-item add-content">
453
-					<h3><?php _e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3>
453
+					<h3><?php _e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3>
454 454
 
455
-					<p><?php _e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p>
455
+					<p><?php _e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p>
456 456
 
457
-					<p><?php _e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
457
+					<p><?php _e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
458 458
 				</div>
459 459
 
460 460
 				<div class="content feature-section-item last-feature">
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 				</div>
472 472
 
473 473
 				<div class="content feature-section-item last-feature">
474
-					<h3><?php _e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
474
+					<h3><?php _e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
475 475
 
476
-					<p><?php _e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p>
476
+					<p><?php _e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p>
477 477
 				</div>
478 478
 
479 479
 
@@ -493,38 +493,38 @@  discard block
 block discarded – undo
493 493
 	 * @return void
494 494
 	 */
495 495
 	public function credits_screen() {
496
-		list( $display_version ) = explode( '-', GIVE_VERSION );
496
+		list($display_version) = explode('-', GIVE_VERSION);
497 497
 		?>
498 498
 		<div class="wrap about-wrap">
499 499
 			<h1 class="welcome-h1"><?php
500 500
 				printf(
501 501
 					/* translators: %s: Give version */
502
-					__( 'Give %s - Credits', 'give' ),
502
+					__('Give %s - Credits', 'give'),
503 503
 					$display_version
504 504
 				);
505 505
 			?></h1>
506 506
 
507 507
 			<?php give_social_media_elements() ?>
508 508
 
509
-			<div class="about-text"><?php _e( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ); ?></div>
509
+			<div class="about-text"><?php _e('Thanks to all those who have contributed code directly or indirectly. ', 'give'); ?></div>
510 510
 
511
-			<div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div>
511
+			<div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div>
512 512
 
513
-			<p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
513
+			<p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
514 514
 
515 515
 			<?php give_get_newsletter() ?>
516 516
 
517 517
 			<div class="give-badge"><?php
518 518
 				printf(
519 519
 					/* translators: %s: Give version */
520
-					__( 'Version %s', 'give' ),
520
+					__('Version %s', 'give'),
521 521
 					$display_version
522 522
 				);
523 523
 			?></div>
524 524
 
525 525
 			<?php $this->tabs(); ?>
526 526
 
527
-			<p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p>
527
+			<p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p>
528 528
 
529 529
 			<?php echo $this->contributors(); ?>
530 530
 		</div>
@@ -539,21 +539,21 @@  discard block
 block discarded – undo
539 539
 	 * @return string $readme HTML formatted readme file
540 540
 	 */
541 541
 	public function parse_readme() {
542
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
542
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
543 543
 
544
-		if ( ! $file ) {
545
-			$readme = '<p>' . __( 'No valid changlog was found.', 'give' ) . '</p>';
544
+		if ( ! $file) {
545
+			$readme = '<p>'.__('No valid changlog was found.', 'give').'</p>';
546 546
 		} else {
547
-			$readme = file_get_contents( $file );
548
-			$readme = nl2br( esc_html( $readme ) );
549
-			$readme = explode( '== Changelog ==', $readme );
550
-			$readme = end( $readme );
551
-
552
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
553
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
554
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
555
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
556
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
547
+			$readme = file_get_contents($file);
548
+			$readme = nl2br(esc_html($readme));
549
+			$readme = explode('== Changelog ==', $readme);
550
+			$readme = end($readme);
551
+
552
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
553
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
554
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
555
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
556
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
557 557
 		}
558 558
 
559 559
 		return $readme;
@@ -570,27 +570,27 @@  discard block
 block discarded – undo
570 570
 	public function contributors() {
571 571
 		$contributors = $this->get_contributors();
572 572
 
573
-		if ( empty( $contributors ) ) {
573
+		if (empty($contributors)) {
574 574
 			return '';
575 575
 		}
576 576
 
577 577
 		$contributor_list = '<ul class="wp-people-group">';
578 578
 
579
-		foreach ( $contributors as $contributor ) {
579
+		foreach ($contributors as $contributor) {
580 580
 			$contributor_list .= '<li class="wp-person">';
581
-			$contributor_list .= sprintf( '<a href="%s" title="%s">',
582
-				esc_url( 'https://github.com/' . $contributor->login ),
581
+			$contributor_list .= sprintf('<a href="%s" title="%s">',
582
+				esc_url('https://github.com/'.$contributor->login),
583 583
 				esc_html(
584 584
 					sprintf(
585 585
 						/* translators: %s: github contributor */
586
-						__( 'View %s', 'give' ),
586
+						__('View %s', 'give'),
587 587
 						$contributor->login
588 588
 					)
589 589
 				)
590 590
 			);
591
-			$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
591
+			$contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login));
592 592
 			$contributor_list .= '</a>';
593
-			$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
593
+			$contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login));
594 594
 			$contributor_list .= '</a>';
595 595
 			$contributor_list .= '</li>';
596 596
 		}
@@ -608,25 +608,25 @@  discard block
 block discarded – undo
608 608
 	 * @return array $contributors List of contributors
609 609
 	 */
610 610
 	public function get_contributors() {
611
-		$contributors = get_transient( 'give_contributors' );
611
+		$contributors = get_transient('give_contributors');
612 612
 
613
-		if ( false !== $contributors ) {
613
+		if (false !== $contributors) {
614 614
 			return $contributors;
615 615
 		}
616 616
 
617
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
617
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
618 618
 
619
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
619
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
620 620
 			return array();
621 621
 		}
622 622
 
623
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
623
+		$contributors = json_decode(wp_remote_retrieve_body($response));
624 624
 
625
-		if ( ! is_array( $contributors ) ) {
625
+		if ( ! is_array($contributors)) {
626 626
 			return array();
627 627
 		}
628 628
 
629
-		set_transient( 'give_contributors', $contributors, 3600 );
629
+		set_transient('give_contributors', $contributors, 3600);
630 630
 
631 631
 		return $contributors;
632 632
 	}
@@ -645,24 +645,24 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
 		// Bail if no activation redirect
648
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
648
+		if ( ! get_transient('_give_activation_redirect')) {
649 649
 			return;
650 650
 		}
651 651
 
652 652
 		// Delete the redirect transient
653
-		delete_transient( '_give_activation_redirect' );
653
+		delete_transient('_give_activation_redirect');
654 654
 
655 655
 		// Bail if activating from network, or bulk
656
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
656
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
657 657
 			return;
658 658
 		}
659 659
 
660
-		$upgrade = get_option( 'give_version_upgraded_from' );
660
+		$upgrade = get_option('give_version_upgraded_from');
661 661
 
662
-		if ( ! $upgrade ) { // First time install
663
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
662
+		if ( ! $upgrade) { // First time install
663
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
664 664
 			exit;
665
-		} elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings
665
+		} elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings
666 666
 
667 667
 		} else { // Welcome is NOT disabled in settings
668 668
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Exit if accessed directly
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param $_banner_details
28 28
 	 */
29
-	function __construct( $_banner_details ) {
29
+	function __construct($_banner_details) {
30 30
 
31 31
 		global $current_user;
32 32
 		$this->banner_details = $_banner_details;
33
-		$this->test_mode      = ( $this->banner_details['testing'] == 'true' ) ? true : false;
34
-		$this->nag_meta_key   = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
33
+		$this->test_mode      = ($this->banner_details['testing'] == 'true') ? true : false;
34
+		$this->nag_meta_key   = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
35 35
 
36 36
 		//Get current user
37 37
 		$this->user_id = $current_user->ID;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	public function init() {
51 51
 
52 52
 		//Testing?
53
-		if ( $this->test_mode ) {
54
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
53
+		if ($this->test_mode) {
54
+			delete_user_meta($this->user_id, $this->nag_meta_key);
55 55
 		}
56 56
 
57 57
 		//Get the current page to add the notice to
58
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
59
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
58
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
59
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
60 60
 
61 61
 
62 62
 	}
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 		global $pagenow;
72 72
 
73 73
 		//Make sure we're on the plugins page.
74
-		if ( $pagenow !== 'plugins.php' ) {
74
+		if ($pagenow !== 'plugins.php') {
75 75
 			return false;
76 76
 		}
77 77
 
78 78
 		// If the user hasn't already dismissed our alert,
79 79
 		// Output the activation banner
80
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?>
80
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?>
81 81
 
82 82
 			<!-- * I output inline styles here
83 83
 				 * because there's no reason to keep these
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
 				<h3><?php
158 158
 					printf(
159 159
 						/* translators: %s: Add-on name */
160
-						__( "Thank you for installing Give's %s Add-on!", 'give' ),
161
-						'<span>' . $this->banner_details['name'] . '</span>'
160
+						__("Thank you for installing Give's %s Add-on!", 'give'),
161
+						'<span>'.$this->banner_details['name'].'</span>'
162 162
 					);
163 163
 				?></h3>
164 164
 
165 165
 				<a href="<?php
166 166
 				//The Dismiss Button
167
-				$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
168
-				echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
167
+				$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
168
+				echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
169 169
 
170 170
 				<!-- * Now we output a few "actions"
171 171
 					 * that the user can take from here -->
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
 				<div class="alert-actions">
174 174
 
175 175
 					<?php //Point them to your settings page
176
-					if ( isset( $this->banner_details['settings_url'] ) ) { ?>
176
+					if (isset($this->banner_details['settings_url'])) { ?>
177 177
 						<a href="<?php echo $this->banner_details['settings_url']; ?>">
178
-							<span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?>
178
+							<span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?>
179 179
 						</a>
180 180
 					<?php } ?>
181 181
 
182 182
 					<?php
183 183
 					// Show them how to configure the Addon
184
-					if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
184
+					if (isset($this->banner_details['documentation_url'])) { ?>
185 185
 						<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
186 186
 							<span class="dashicons dashicons-media-text"></span>
187 187
 							<?php
188 188
 								printf(
189 189
 									/* translators: %s: Add-on name */
190
-									__( 'Documentation: %s Add-on', 'give' ),
190
+									__('Documentation: %s Add-on', 'give'),
191 191
 									$this->banner_details['name']
192 192
 								);
193 193
 							?>
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 					<?php } ?>
196 196
 					<?php
197 197
 					//Let them signup for plugin updates
198
-					if ( isset( $this->banner_details['support_url'] ) ) { ?>
198
+					if (isset($this->banner_details['support_url'])) { ?>
199 199
 
200 200
 						<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
201
-							<span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?>
201
+							<span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?>
202 202
 						</a>
203 203
 
204 204
 					<?php } ?>
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
 		/* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
221 221
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
222 222
 		 */
223
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
223
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
224 224
 
225 225
 			//Get the global user
226 226
 			global $current_user;
227 227
 			$user_id = $current_user->ID;
228 228
 
229
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
229
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
230 230
 		}
231 231
 	}
232 232
 
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 					/* translators: %s: day of the week */
54
-					__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59
-			<?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?>
59
+			<?php $earnings_today = $stats->get_earnings(0, 'today', false); ?>
60 60
 
61
-			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p>
61
+			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p>
62 62
 
63
-			<p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array(
63
+			<p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array(
64 64
 					'publish',
65 65
 					'revoked'
66
-				) ); ?><?php echo give_format_amount( $donations_today, false ); ?>
67
-				<span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span>
66
+				)); ?><?php echo give_format_amount($donations_today, false); ?>
67
+				<span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span>
68 68
 			</p>
69 69
 
70 70
 
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 		<table class="give-table-stats">
75 75
 			<thead style="display: none;">
76 76
 			<tr>
77
-				<th><?php _e( 'This Week', 'give' ); ?></th>
78
-				<th><?php _e( 'This Month', 'give' ); ?></th>
79
-				<th><?php _e( 'Past 30 Days', 'give' ); ?></th>
77
+				<th><?php _e('This Week', 'give'); ?></th>
78
+				<th><?php _e('This Month', 'give'); ?></th>
79
+				<th><?php _e('Past 30 Days', 'give'); ?></th>
80 80
 			</tr>
81 81
 			</thead>
82 82
 			<tbody>
83 83
 			<tr id="give-table-stats-tr-1">
84 84
 				<td>
85
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p>
85
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p>
86 86
 
87
-					<p class="give-dashboard-stat-total-label"><?php _e( 'this week', 'give' ); ?></p>
87
+					<p class="give-dashboard-stat-total-label"><?php _e('this week', 'give'); ?></p>
88 88
 				</td>
89 89
 				<td>
90
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p>
90
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p>
91 91
 
92
-					<p class="give-dashboard-stat-total-label"><?php _e( 'this month', 'give' ); ?></p>
92
+					<p class="give-dashboard-stat-total-label"><?php _e('this month', 'give'); ?></p>
93 93
 				</td>
94 94
 			</tr>
95 95
 			<tr id="give-table-stats-tr-2">
96 96
 				<td>
97
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p>
97
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p>
98 98
 
99
-					<p class="give-dashboard-stat-total-label"><?php _e( 'last month', 'give' ); ?></p>
99
+					<p class="give-dashboard-stat-total-label"><?php _e('last month', 'give'); ?></p>
100 100
 				</td>
101 101
 				<td>
102
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p>
102
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p>
103 103
 
104
-					<p class="give-dashboard-stat-total-label"><?php _e( 'this year', 'give' ); ?></p>
104
+					<p class="give-dashboard-stat-total-label"><?php _e('this year', 'give'); ?></p>
105 105
 				</td>
106 106
 			</tr>
107 107
 			</tbody>
@@ -121,25 +121,25 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return array
123 123
  */
124
-function give_dashboard_at_a_glance_widget( $items ) {
125
-	$num_posts = wp_count_posts( 'give_forms' );
124
+function give_dashboard_at_a_glance_widget($items) {
125
+	$num_posts = wp_count_posts('give_forms');
126 126
 
127
-	if ( $num_posts && $num_posts->publish ) {
127
+	if ($num_posts && $num_posts->publish) {
128 128
         
129 129
 		$text = sprintf(
130 130
 			/* translators: 1: number of posts published 2: forms singular label 3: forms plural label */
131
-			_n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ),
131
+			_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'),
132 132
 			$num_posts->publish,
133 133
 			give_get_forms_label_singular(),
134 134
 			give_get_forms_label_plural()
135 135
 		);
136 136
 
137
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
137
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
138 138
 
139
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
140
-			$text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text );
139
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
140
+			$text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text);
141 141
 		} else {
142
-			$text = sprintf( '<span class="give-forms-count">%1$s</span>', $text );
142
+			$text = sprintf('<span class="give-forms-count">%1$s</span>', $text);
143 143
 		}
144 144
 
145 145
 		$items[] = $text;
@@ -148,4 +148,4 @@  discard block
 block discarded – undo
148 148
 	return $items;
149 149
 }
150 150
 
151
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
151
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/reporting/tools.php 1 patch
Spacing   +29 added lines, -29 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
 
@@ -22,80 +22,80 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_tools_recount_stats_display() {
24 24
 
25
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
25
+	if ( ! current_user_can('manage_give_settings')) {
26 26
 		return;
27 27
 	}
28 28
 
29
-	do_action( 'give_tools_recount_stats_before' );
29
+	do_action('give_tools_recount_stats_before');
30 30
 	?>
31 31
 	<div id="poststuff">
32 32
 		<div class="postbox">
33 33
 
34
-			<h2 class="hndle ui-sortable-handle"><span><?php _e( 'Recount Stats', 'give' ); ?></span></h2>
34
+			<h2 class="hndle ui-sortable-handle"><span><?php _e('Recount Stats', 'give'); ?></span></h2>
35 35
 
36 36
 			<div class="inside recount-stats-controls">
37
-				<p><?php _e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
37
+				<p><?php _e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
38 38
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
39 39
 
40
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
40
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
41 41
 
42 42
 					<select name="give-export-class" id="recount-stats-type">
43
-						<option value="0" selected="selected" disabled="disabled"><?php _e( 'Please select an option', 'give' ); ?></option>
44
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php _e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
45
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php _e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
46
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php _e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
47
-						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php _e( 'Recalculate Donor Statistics', 'give' ); ?></option>
48
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php _e( 'Delete Test Transactions', 'give' ); ?></option>
49
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php _e( 'Delete All Data', 'give' ); ?></option>
50
-						<?php do_action( 'give_recount_tool_options' ); ?>
43
+						<option value="0" selected="selected" disabled="disabled"><?php _e('Please select an option', 'give'); ?></option>
44
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php _e('Recalculate Total Donation Income Amount', 'give'); ?></option>
45
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php _e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
46
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php _e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
47
+						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php _e('Recalculate Donor Statistics', 'give'); ?></option>
48
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php _e('Delete Test Transactions', 'give'); ?></option>
49
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php _e('Delete All Data', 'give'); ?></option>
50
+						<?php do_action('give_recount_tool_options'); ?>
51 51
 					</select>
52 52
 
53 53
 					<span id="tools-form-dropdown" style="display: none">
54 54
 						<?php
55 55
 						$args = array(
56 56
 							'name'   => 'form_id',
57
-							'number' => - 1,
57
+							'number' => -1,
58 58
 							'chosen' => true,
59 59
 						);
60
-						echo Give()->html->forms_dropdown( $args );
60
+						echo Give()->html->forms_dropdown($args);
61 61
 						?>
62 62
 					</span>
63 63
 
64
-					<input type="submit" id="recount-stats-submit" value="<?php _e( 'Submit', 'give' ); ?>" class="button-secondary"/>
64
+					<input type="submit" id="recount-stats-submit" value="<?php _e('Submit', 'give'); ?>" class="button-secondary"/>
65 65
 
66 66
 					<br/>
67 67
 
68 68
 					<span class="give-recount-stats-descriptions">
69
-						<span id="recount-stats"><?php _e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
69
+						<span id="recount-stats"><?php _e('Recalculates the overall donation income amount.', 'give'); ?></span>
70 70
 						<span id="recount-form"><?php
71 71
 							printf(
72 72
 								/* translators: %s: form singular label */
73
-								__( 'Recalculates the donation and income stats for a specific %s.', 'give' ),
74
-								give_get_forms_label_singular( true )
73
+								__('Recalculates the donation and income stats for a specific %s.', 'give'),
74
+								give_get_forms_label_singular(true)
75 75
 							);
76 76
 						?></span>
77 77
 						<span id="recount-all"><?php
78 78
 							printf(
79 79
 								/* translators: %s: form plural label */
80
-								__( 'Recalculates the earnings and sales stats for all %s.', 'give' ),
81
-								give_get_forms_label_plural( true )
80
+								__('Recalculates the earnings and sales stats for all %s.', 'give'),
81
+								give_get_forms_label_plural(true)
82 82
 							);
83 83
 						?></span>
84
-						<span id="recount-customer-stats"><?php _e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
85
-						<?php do_action( 'give_recount_tool_descriptions' ); ?>
86
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span>
87
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
84
+						<span id="recount-customer-stats"><?php _e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
85
+						<?php do_action('give_recount_tool_descriptions'); ?>
86
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span>
87
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
88 88
 					</span>
89 89
 
90 90
 					<span class="spinner"></span>
91 91
 
92 92
 				</form>
93
-				<?php do_action( 'give_tools_recount_forms' ); ?>
93
+				<?php do_action('give_tools_recount_forms'); ?>
94 94
 			</div><!-- .inside -->
95 95
 		</div><!-- .postbox -->
96 96
 	</div><!-- #poststuff -->
97 97
 	<?php
98
-	do_action( 'give_tools_recount_stats_after' );
98
+	do_action('give_tools_recount_stats_after');
99 99
 }
100 100
 
101
-add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' );
101
+add_action('give_reports_tab_tools', 'give_tools_recount_stats_display');
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-earnings.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		nocache_headers();
48
-		header( 'Content-Type: text/csv; charset=utf-8' );
49
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
50
-		header( "Expires: 0" );
48
+		header('Content-Type: text/csv; charset=utf-8');
49
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
50
+		header("Expires: 0");
51 51
 
52 52
 	}
53 53
 
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public function csv_cols() {
62 62
 
63 63
 		$cols = array(
64
-			'date'      => __( 'Date', 'give' ),
65
-			'donations' => __( 'Donations', 'give' ),
64
+			'date'      => __('Date', 'give'),
65
+			'donations' => __('Donations', 'give'),
66 66
 			/* translators: %s: currency */
67
-			'earnings'  => sprintf( __( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) )
67
+			'earnings'  => sprintf(__('Income (%s)', 'give'), html_entity_decode(give_currency_filter('')))
68 68
 		);
69 69
 
70 70
 		return $cols;
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function get_data() {
81 81
 
82
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
83
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
84
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
85
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
82
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
83
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
84
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
85
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
86 86
 
87 87
 		$data  = array();
88 88
 		$year  = $start_year;
89 89
 		$stats = new Give_Payment_Stats;
90 90
 
91
-		while ( $year <= $end_year ) {
91
+		while ($year <= $end_year) {
92 92
 
93
-			if ( $year == $start_year && $year == $end_year ) {
93
+			if ($year == $start_year && $year == $end_year) {
94 94
 
95 95
 				$m1 = $start_month;
96 96
 				$m2 = $end_month;
97 97
 
98
-			} elseif ( $year == $start_year ) {
98
+			} elseif ($year == $start_year) {
99 99
 
100 100
 				$m1 = $start_month;
101 101
 				$m2 = 12;
102 102
 
103
-			} elseif ( $year == $end_year ) {
103
+			} elseif ($year == $end_year) {
104 104
 
105 105
 				$m1 = 1;
106 106
 				$m2 = $end_month;
@@ -112,28 +112,28 @@  discard block
 block discarded – undo
112 112
 
113 113
 			}
114 114
 
115
-			while ( $m1 <= $m2 ) {
115
+			while ($m1 <= $m2) {
116 116
 
117
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
118
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
117
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
118
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
119 119
 
120 120
 				$data[] = array(
121
-					'date'      => date_i18n( 'F Y', $date1 ),
122
-					'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ),
123
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ),
121
+					'date'      => date_i18n('F Y', $date1),
122
+					'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')),
123
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2)),
124 124
 				);
125 125
 
126
-				$m1 ++;
126
+				$m1++;
127 127
 
128 128
 			}
129 129
 
130 130
 
131
-			$year ++;
131
+			$year++;
132 132
 
133 133
 		}
134 134
 
135
-		$data = apply_filters( 'give_export_get_data', $data );
136
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
135
+		$data = apply_filters('give_export_get_data', $data);
136
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
137 137
 
138 138
 		return $data;
139 139
 	}
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@
 block discarded – undo
182 182
 	 *
183 183
 	 * @param  array $data Array of attributes for a donation form
184 184
 	 *
185
-	 * @return mixed  false if data isn't passed and class not instantiated for creation, or New Form ID
185
+	 * @return boolean  false if data isn't passed and class not instantiated for creation, or New Form ID
186 186
 	 */
187 187
 	public function create( $data = array() ) {
188 188
 
Please login to merge, or discard this patch.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 	 * @param bool $_id
101 101
 	 * @param array $_args
102 102
 	 */
103
-	public function __construct( $_id = false, $_args = array() ) {
103
+	public function __construct($_id = false, $_args = array()) {
104 104
 
105 105
 
106
-		$donation_form = WP_Post::get_instance( $_id );
106
+		$donation_form = WP_Post::get_instance($_id);
107 107
 
108
-		return $this->setup_donation_form( $donation_form );
108
+		return $this->setup_donation_form($donation_form);
109 109
 	}
110 110
 
111 111
 	/**
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return bool             If the setup was successful or not
121 121
 	 */
122
-	private function setup_donation_form( $donation_form ) {
122
+	private function setup_donation_form($donation_form) {
123 123
 
124
-		if ( ! is_object( $donation_form ) ) {
124
+		if ( ! is_object($donation_form)) {
125 125
 			return false;
126 126
 		}
127 127
 
128
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
128
+		if ( ! is_a($donation_form, 'WP_Post')) {
129 129
 			return false;
130 130
 		}
131 131
 
132
-		if ( 'give_forms' !== $donation_form->post_type ) {
132
+		if ('give_forms' !== $donation_form->post_type) {
133 133
 			return false;
134 134
 		}
135 135
 
136
-		foreach ( $donation_form as $key => $value ) {
136
+		foreach ($donation_form as $key => $value) {
137 137
 
138
-			switch ( $key ) {
138
+			switch ($key) {
139 139
 
140 140
 				default:
141 141
 					$this->$key = $value;
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
 	 * @return mixed
160 160
 	 * @throws Exception
161 161
 	 */
162
-	public function __get( $key ) {
162
+	public function __get($key) {
163 163
 
164
-		if ( method_exists( $this, 'get_' . $key ) ) {
164
+		if (method_exists($this, 'get_'.$key)) {
165 165
 
166
-			return call_user_func( array( $this, 'get_' . $key ) );
166
+			return call_user_func(array($this, 'get_'.$key));
167 167
 
168 168
 		} else {
169 169
 
170 170
 			/* translators: %s: property key */
171
-			return new WP_Error( 'give-form-invalid-property', sprintf( __( 'Can\'t get property %s.', 'give' ), $key ) );
171
+			return new WP_Error('give-form-invalid-property', sprintf(__('Can\'t get property %s.', 'give'), $key));
172 172
 
173 173
 		}
174 174
 
@@ -184,30 +184,30 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @return mixed  false if data isn't passed and class not instantiated for creation, or New Form ID
186 186
 	 */
187
-	public function create( $data = array() ) {
187
+	public function create($data = array()) {
188 188
 
189
-		if ( $this->id != 0 ) {
189
+		if ($this->id != 0) {
190 190
 			return false;
191 191
 		}
192 192
 
193 193
 		$defaults = array(
194 194
 			'post_type'   => 'give_forms',
195 195
 			'post_status' => 'draft',
196
-			'post_title'  => __( 'New Donation Form', 'give' )
196
+			'post_title'  => __('New Donation Form', 'give')
197 197
 		);
198 198
 
199
-		$args = wp_parse_args( $data, $defaults );
199
+		$args = wp_parse_args($data, $defaults);
200 200
 
201 201
 		/**
202 202
 		 * Fired before a donation form is created
203 203
 		 *
204 204
 		 * @param array $args The post object arguments used for creation.
205 205
 		 */
206
-		do_action( 'give_form_pre_create', $args );
206
+		do_action('give_form_pre_create', $args);
207 207
 
208
-		$id = wp_insert_post( $args, true );
208
+		$id = wp_insert_post($args, true);
209 209
 
210
-		$donation_form = WP_Post::get_instance( $id );
210
+		$donation_form = WP_Post::get_instance($id);
211 211
 
212 212
 		/**
213 213
 		 * Fired after a donation form is created
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 		 * @param int $id The post ID of the created item.
216 216
 		 * @param array $args The post object arguments used for creation.
217 217
 		 */
218
-		do_action( 'give_form_post_create', $id, $args );
218
+		do_action('give_form_post_create', $id, $args);
219 219
 
220
-		return $this->setup_donation_form( $donation_form );
220
+		return $this->setup_donation_form($donation_form);
221 221
 
222 222
 	}
223 223
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @return string Name of the donation form
241 241
 	 */
242 242
 	public function get_name() {
243
-		return get_the_title( $this->ID );
243
+		return get_the_title($this->ID);
244 244
 	}
245 245
 
246 246
 	/**
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function get_price() {
253 253
 
254
-		if ( ! isset( $this->price ) ) {
254
+		if ( ! isset($this->price)) {
255 255
 
256
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
256
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
257 257
 
258
-			if ( $this->price ) {
258
+			if ($this->price) {
259 259
 
260
-				$this->price = give_sanitize_amount( $this->price );
260
+				$this->price = give_sanitize_amount($this->price);
261 261
 
262 262
 			} else {
263 263
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		 * @param string $price The donation form price.
276 276
 		 * @param string|int $id The form ID.
277 277
 		 */
278
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
278
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
279 279
 	}
280 280
 
281 281
 	/**
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function get_minimum_price() {
288 288
 
289
-		if ( ! isset( $this->minimum_price ) ) {
289
+		if ( ! isset($this->minimum_price)) {
290 290
 
291
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
292
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
291
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
292
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
293 293
 
294
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
294
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
295 295
 
296
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
296
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
297 297
 
298 298
 			} else {
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
 		}
305 305
 
306
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
306
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
307 307
 	}
308 308
 
309 309
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	public function get_prices() {
316 316
 
317
-		if ( ! isset( $this->prices ) ) {
317
+		if ( ! isset($this->prices)) {
318 318
 
319
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
319
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
320 320
 
321 321
 		}
322 322
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		 * @param array $prices The array of mulit-level prices.
329 329
 		 * @param int|string The ID of the form.
330 330
 		 */
331
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
331
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
332 332
 
333 333
 	}
334 334
 
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function get_goal() {
342 342
 
343
-		if ( ! isset( $this->goal ) ) {
343
+		if ( ! isset($this->goal)) {
344 344
 
345
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
345
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
346 346
 
347
-			if ( $this->goal ) {
347
+			if ($this->goal) {
348 348
 
349
-				$this->goal = give_sanitize_amount( $this->goal );
349
+				$this->goal = give_sanitize_amount($this->goal);
350 350
 
351 351
 			} else {
352 352
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
 		}
358 358
 
359
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
359
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
360 360
 
361 361
 	}
362 362
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	public function is_single_price_mode() {
370 370
 
371
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
371
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
372 372
 		$ret    = 0;
373 373
 
374
-		if ( empty( $option ) || $option === 'set' ) {
374
+		if (empty($option) || $option === 'set') {
375 375
 			$ret = 1;
376 376
 		}
377 377
 		
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		 * @param bool $ret Is donation form in single price mode?
384 384
 		 * @param int|string The ID of the donation form.
385 385
 		 */
386
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
386
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
387 387
 
388 388
 	}
389 389
 
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function is_custom_price_mode() {
397 397
 
398
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
398
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
399 399
 		$ret    = 0;
400 400
 
401
-		if ( $option === 'yes' ) {
401
+		if ($option === 'yes') {
402 402
 			$ret = 1;
403 403
 		}
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		 * @param bool $ret Is donation form in custom price mode?
411 411
 		 * @param int|string The ID of the donation form.
412 412
 		 */
413
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
413
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
414 414
 
415 415
 	}
416 416
 
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	public function has_variable_prices() {
426 426
 
427
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
427
+		$option = get_post_meta($this->ID, '_give_price_option', true);
428 428
 		$ret    = 0;
429 429
 
430
-		if ( $option === 'multi' ) {
430
+		if ($option === 'multi') {
431 431
 			$ret = 1;
432 432
 		}
433 433
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		 * @param bool $ret Does donation form have variable prices?
438 438
 		 * @param int|string The ID of the donation form.
439 439
 		 */
440
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
440
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
441 441
 
442 442
 	}
443 443
 
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	public function get_type() {
451 451
 
452
-		if ( ! isset( $this->type ) ) {
452
+		if ( ! isset($this->type)) {
453 453
 
454
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
454
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
455 455
 
456
-			if ( empty( $this->type ) ) {
456
+			if (empty($this->type)) {
457 457
 				$this->type = 'set';
458 458
 			}
459 459
 
460 460
 		}
461 461
 
462
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
462
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
463 463
 
464 464
 	}
465 465
 
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	public function get_sales() {
473 473
 
474
-		if ( ! isset( $this->sales ) ) {
474
+		if ( ! isset($this->sales)) {
475 475
 
476
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
477
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
476
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
477
+				add_post_meta($this->ID, '_give_form_sales', 0);
478 478
 			} // End if
479 479
 
480
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
480
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
481 481
 
482
-			if ( $this->sales < 0 ) {
482
+			if ($this->sales < 0) {
483 483
 				// Never let sales be less than zero
484 484
 				$this->sales = 0;
485 485
 			}
@@ -499,13 +499,13 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return int|false  New number of total sales
501 501
 	 */
502
-	public function increase_sales( $quantity = 1 ) {
502
+	public function increase_sales($quantity = 1) {
503 503
 
504
-		$sales       = give_get_form_sales_stats( $this->ID );
505
-		$quantity    = absint( $quantity );
504
+		$sales       = give_get_form_sales_stats($this->ID);
505
+		$quantity    = absint($quantity);
506 506
 		$total_sales = $sales + $quantity;
507 507
 
508
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
508
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
509 509
 
510 510
 			$this->sales = $total_sales;
511 511
 
@@ -525,17 +525,17 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @return int|false  New number of total sales
527 527
 	 */
528
-	public function decrease_sales( $quantity = 1 ) {
528
+	public function decrease_sales($quantity = 1) {
529 529
 
530
-		$sales = give_get_form_sales_stats( $this->ID );
530
+		$sales = give_get_form_sales_stats($this->ID);
531 531
 
532 532
 		// Only decrease if not already zero
533
-		if ( $sales > 0 ) {
533
+		if ($sales > 0) {
534 534
 
535
-			$quantity    = absint( $quantity );
535
+			$quantity    = absint($quantity);
536 536
 			$total_sales = $sales - $quantity;
537 537
 
538
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
538
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
539 539
 
540 540
 				$this->sales = $sales;
541 541
 
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	public function get_earnings() {
559 559
 
560
-		if ( ! isset( $this->earnings ) ) {
560
+		if ( ! isset($this->earnings)) {
561 561
 
562
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
563
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
562
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
563
+				add_post_meta($this->ID, '_give_form_earnings', 0);
564 564
 			}
565 565
 
566
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
566
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
567 567
 
568
-			if ( $this->earnings < 0 ) {
568
+			if ($this->earnings < 0) {
569 569
 				// Never let earnings be less than zero
570 570
 				$this->earnings = 0;
571 571
 			}
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
 	 * 
586 586
 	 * @return float|false
587 587
 	 */
588
-	public function increase_earnings( $amount = 0 ) {
588
+	public function increase_earnings($amount = 0) {
589 589
 
590
-		$earnings   = give_get_form_earnings_stats( $this->ID );
590
+		$earnings   = give_get_form_earnings_stats($this->ID);
591 591
 		$new_amount = $earnings + (float) $amount;
592 592
 
593
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
593
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
594 594
 
595 595
 			$this->earnings = $new_amount;
596 596
 
@@ -608,16 +608,16 @@  discard block
 block discarded – undo
608 608
 	 * @since 1.0
609 609
 	 * @return float|false
610 610
 	 */
611
-	public function decrease_earnings( $amount ) {
611
+	public function decrease_earnings($amount) {
612 612
 
613
-		$earnings = give_get_form_earnings_stats( $this->ID );
613
+		$earnings = give_get_form_earnings_stats($this->ID);
614 614
 
615
-		if ( $earnings > 0 ) {
615
+		if ($earnings > 0) {
616 616
 			// Only decrease if greater than zero
617 617
 			$new_amount = $earnings - (float) $amount;
618 618
 
619 619
 
620
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
620
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
621 621
 
622 622
 				$this->earnings = $new_amount;
623 623
 
@@ -637,22 +637,22 @@  discard block
 block discarded – undo
637 637
 	 * @since 1.0
638 638
 	 * @return bool
639 639
 	 */
640
-	public function is_free( $price_id = false ) {
640
+	public function is_free($price_id = false) {
641 641
 
642 642
 		$is_free          = false;
643
-		$variable_pricing = give_has_variable_prices( $this->ID );
643
+		$variable_pricing = give_has_variable_prices($this->ID);
644 644
 
645
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
646
-			$price = give_get_price_option_amount( $this->ID, $price_id );
647
-		} elseif ( ! $variable_pricing ) {
648
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
645
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
646
+			$price = give_get_price_option_amount($this->ID, $price_id);
647
+		} elseif ( ! $variable_pricing) {
648
+			$price = get_post_meta($this->ID, '_give_set_price', true);
649 649
 		}
650 650
 
651
-		if ( isset( $price ) && (float) $price == 0 ) {
651
+		if (isset($price) && (float) $price == 0) {
652 652
 			$is_free = true;
653 653
 		}
654 654
 
655
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
655
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
656 656
 
657 657
 	}
658 658
 
@@ -669,9 +669,9 @@  discard block
 block discarded – undo
669 669
 	 */
670 670
 	public function is_close_donation_form() {
671 671
 		return (
672
-				'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
673
-				&& ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
674
-				&& ( $this->get_goal() <= $this->get_earnings()
672
+				'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
673
+				&& ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
674
+				&& ($this->get_goal() <= $this->get_earnings()
675 675
 		);
676 676
 	}
677 677
 
@@ -687,29 +687,29 @@  discard block
 block discarded – undo
687 687
 	 *
688 688
 	 * @return bool                             The result of the update query
689 689
 	 */
690
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
690
+	private function update_meta($meta_key = '', $meta_value = '') {
691 691
 
692 692
 		/* @var WPDB $wpdb */
693 693
 		global $wpdb;
694 694
 
695
-		if ( empty( $meta_key ) || empty( $meta_value ) ) {
695
+		if (empty($meta_key) || empty($meta_value)) {
696 696
 			return false;
697 697
 		}
698 698
 
699 699
 		// Make sure if it needs to be serialized, we do
700
-		$meta_value = maybe_serialize( $meta_value );
700
+		$meta_value = maybe_serialize($meta_value);
701 701
 
702
-		if ( is_numeric( $meta_value ) ) {
703
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
702
+		if (is_numeric($meta_value)) {
703
+			$value_type = is_float($meta_value) ? '%f' : '%d';
704 704
 		} else {
705 705
 			$value_type = "'%s'";
706 706
 		}
707 707
 
708
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
708
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
709 709
 
710
-		if ( $wpdb->query( $sql ) ) {
710
+		if ($wpdb->query($sql)) {
711 711
 
712
-			clean_post_cache( $this->ID );
712
+			clean_post_cache($this->ID);
713 713
 
714 714
 			return true;
715 715
 
Please login to merge, or discard this patch.
includes/price-functions.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,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
  * 
124 124
  * @return bool
125 125
  */
126
-function give_is_custom_price_mode( $form_id = 0 ) {
126
+function give_is_custom_price_mode($form_id = 0) {
127 127
 
128
-	if ( empty( $form_id ) ) {
128
+	if (empty($form_id)) {
129 129
 		return false;
130 130
 	}
131 131
 
132
-	$form = new Give_Donate_Form( $form_id );
132
+	$form = new Give_Donate_Form($form_id);
133 133
 
134 134
 	return $form->is_custom_price_mode();
135 135
 }
136 136
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	// Retrieve the payment ID
38 38
 	$payment_id = absint( $data['give_payment_id'] );
39 39
 
40
-    /* @var Give_Payment $payment */
40
+	/* @var Give_Payment $payment */
41 41
 	$payment    = new Give_Payment( $payment_id );
42 42
 
43 43
 	// Retrieve existing payment meta
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 		$previous_customer->remove_payment( $payment_id, false );
152 152
 		$customer->attach_payment( $payment_id, false );
153 153
 
154
-        // Reduce previous user donation count and amoount.
155
-        $previous_customer->decrease_purchase_count();
156
-        $previous_customer->decrease_value( $curr_total );
154
+		// Reduce previous user donation count and amoount.
155
+		$previous_customer->decrease_purchase_count();
156
+		$previous_customer->decrease_value( $curr_total );
157 157
 
158 158
 		// If purchase was completed and not ever refunded, adjust stats of new customers.
159 159
 		if ( 'revoked' == $status || 'publish' == $status ) {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	} else{
166 166
 		// Update user donation stat.
167 167
 		$customer->update_donation_value( $curr_total, $new_total );
168
-    }
168
+	}
169 169
 
170 170
 	// Set new meta values
171 171
 	$payment->user_id    = $customer->user_id;
@@ -206,76 +206,76 @@  discard block
 block discarded – undo
206 206
 
207 207
 	$payment->save();
208 208
 
209
-    // Get new give form ID.
210
-    $new_form_id = absint( $data['forms'] );
211
-    $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
209
+	// Get new give form ID.
210
+	$new_form_id = absint( $data['forms'] );
211
+	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
212 212
 
213
-    // We are adding payment transfer code in last to remove any conflict with above functionality.
214
-    // For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
215
-    /* Check if user want to transfer current payment to new give form id. */
216
-    if( $new_form_id != $current_form_id  ) {
213
+	// We are adding payment transfer code in last to remove any conflict with above functionality.
214
+	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
215
+	/* Check if user want to transfer current payment to new give form id. */
216
+	if( $new_form_id != $current_form_id  ) {
217 217
 
218
-        // Get new give form title.
219
-        $new_form_title = get_the_title( $new_form_id );
218
+		// Get new give form title.
219
+		$new_form_title = get_the_title( $new_form_id );
220 220
 
221
-        // Update new give form data in payment data.
222
-        $payment_meta = $payment->get_meta();
223
-        $payment_meta['form_title'] = $new_form_title;
224
-        $payment_meta['form_id']    = $new_form_id;
221
+		// Update new give form data in payment data.
222
+		$payment_meta = $payment->get_meta();
223
+		$payment_meta['form_title'] = $new_form_title;
224
+		$payment_meta['form_id']    = $new_form_id;
225 225
 
226
-        // Update price id post meta data for set donation form.
227
-        if( ! give_has_variable_prices( $new_form_id ) ) {
228
-            $payment_meta['price_id'] = '';
229
-        }
226
+		// Update price id post meta data for set donation form.
227
+		if( ! give_has_variable_prices( $new_form_id ) ) {
228
+			$payment_meta['price_id'] = '';
229
+		}
230 230
 
231
-        // Update payment give form meta data.
232
-        $payment->update_meta( '_give_payment_form_id', $new_form_id );
233
-        $payment->update_meta( '_give_payment_form_title', $new_form_title );
234
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
231
+		// Update payment give form meta data.
232
+		$payment->update_meta( '_give_payment_form_id', $new_form_id );
233
+		$payment->update_meta( '_give_payment_form_title', $new_form_title );
234
+		$payment->update_meta( '_give_payment_meta', $payment_meta );
235 235
 
236
-        // Update price id payment metadata.
237
-        if( ! give_has_variable_prices( $new_form_id ) ) {
238
-            $payment->update_meta( '_give_payment_price_id', '' );
239
-        }
236
+		// Update price id payment metadata.
237
+		if( ! give_has_variable_prices( $new_form_id ) ) {
238
+			$payment->update_meta( '_give_payment_price_id', '' );
239
+		}
240 240
 
241 241
 
242
-        // If purchase was completed and not ever refunded, adjust stats of forms
243
-        if ( 'revoked' == $status || 'publish' == $status ) {
242
+		// If purchase was completed and not ever refunded, adjust stats of forms
243
+		if ( 'revoked' == $status || 'publish' == $status ) {
244 244
 
245
-            // Decrease sale of old give form. For other payment status 
246
-            $current_form = new Give_Donate_Form( $current_form_id );
247
-            $current_form->decrease_sales();
248
-            $current_form->decrease_earnings( $curr_total );
245
+			// Decrease sale of old give form. For other payment status 
246
+			$current_form = new Give_Donate_Form( $current_form_id );
247
+			$current_form->decrease_sales();
248
+			$current_form->decrease_earnings( $curr_total );
249 249
             
250
-            // Increase sale of new give form.
251
-            $new_form = new Give_Donate_Form($new_form_id);
252
-            $new_form->increase_sales();
253
-            $new_form->increase_earnings($new_total);
254
-        }
250
+			// Increase sale of new give form.
251
+			$new_form = new Give_Donate_Form($new_form_id);
252
+			$new_form->increase_sales();
253
+			$new_form->increase_earnings($new_total);
254
+		}
255 255
 
256
-        // Re setup payment to update new meta value in object.
257
-        $payment->update_payment_setup( $payment->ID );
258
-    }
256
+		// Re setup payment to update new meta value in object.
257
+		$payment->update_payment_setup( $payment->ID );
258
+	}
259 259
 
260
-    // Update price id if current form is variable form.
261
-    if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
260
+	// Update price id if current form is variable form.
261
+	if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
262 262
 
263
-        // Get payment meta data.
264
-        $payment_meta = $payment->get_meta();
263
+		// Get payment meta data.
264
+		$payment_meta = $payment->get_meta();
265 265
 
266
-        // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
267
-        $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
266
+		// Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
267
+		$data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
268 268
 
269
-        // Update payment meta data.
270
-        $payment_meta['price_id'] = $data['give-variable-price'];
269
+		// Update payment meta data.
270
+		$payment_meta['price_id'] = $data['give-variable-price'];
271 271
 
272
-        // Update payment give form meta data.
273
-        $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
274
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
272
+		// Update payment give form meta data.
273
+		$payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
274
+		$payment->update_meta( '_give_payment_meta', $payment_meta );
275 275
 
276
-        // Re setup payment to update new meta value in object.
277
-        $payment->update_payment_setup( $payment->ID );
278
-    }
276
+		// Re setup payment to update new meta value in object.
277
+		$payment->update_payment_setup( $payment->ID );
278
+	}
279 279
 
280 280
 	do_action( 'give_updated_edited_purchase', $payment_id );
281 281
 
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 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,109 +26,109 @@  discard block
 block discarded – undo
26 26
  * @return      void
27 27
  *
28 28
  */
29
-function give_update_payment_details( $data ) {
29
+function give_update_payment_details($data) {
30 30
 
31
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
32
-		wp_die( __( 'You do not have permission to edit payment records.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
31
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
32
+		wp_die(__('You do not have permission to edit payment records.', 'give'), __('Error', 'give'), array('response' => 403));
33 33
 	}
34 34
 
35
-	check_admin_referer( 'give_update_payment_details_nonce' );
35
+	check_admin_referer('give_update_payment_details_nonce');
36 36
 
37 37
 	// Retrieve the payment ID
38
-	$payment_id = absint( $data['give_payment_id'] );
38
+	$payment_id = absint($data['give_payment_id']);
39 39
 
40 40
     /* @var Give_Payment $payment */
41
-	$payment    = new Give_Payment( $payment_id );
41
+	$payment    = new Give_Payment($payment_id);
42 42
 
43 43
 	// Retrieve existing payment meta
44 44
 	$meta      = $payment->get_meta();
45 45
 	$user_info = $payment->user_info;
46 46
 
47 47
 	$status = $data['give-payment-status'];
48
-	$date   = sanitize_text_field( $data['give-payment-date'] );
49
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
48
+	$date   = sanitize_text_field($data['give-payment-date']);
49
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
50 50
 
51 51
 	// Restrict to our high and low
52
-	if ( $hour > 23 ) {
52
+	if ($hour > 23) {
53 53
 		$hour = 23;
54
-	} elseif ( $hour < 0 ) {
54
+	} elseif ($hour < 0) {
55 55
 		$hour = 00;
56 56
 	}
57 57
 
58
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
58
+	$minute = sanitize_text_field($data['give-payment-time-min']);
59 59
 
60 60
 	// Restrict to our high and low
61
-	if ( $minute > 59 ) {
61
+	if ($minute > 59) {
62 62
 		$minute = 59;
63
-	} elseif ( $minute < 0 ) {
63
+	} elseif ($minute < 0) {
64 64
 		$minute = 00;
65 65
 	}
66 66
 
67
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
67
+	$address = array_map('trim', $data['give-payment-address'][0]);
68 68
 
69
-	$curr_total = give_sanitize_amount( $payment->total );
70
-	$new_total  = give_sanitize_amount( $data['give-payment-total'] );
71
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
69
+	$curr_total = give_sanitize_amount($payment->total);
70
+	$new_total  = give_sanitize_amount($data['give-payment-total']);
71
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
72 72
 
73
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
74
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
73
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
74
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
75 75
 
76
-	do_action( 'give_update_edited_purchase', $payment_id );
76
+	do_action('give_update_edited_purchase', $payment_id);
77 77
 
78 78
 	$payment->date = $date;
79 79
 	$updated       = $payment->save();
80 80
 
81
-	if ( 0 === $updated ) {
82
-		wp_die( esc_attr__( 'Error Updating Payment.', 'give' ), esc_attr__( 'Error', 'give' ), array( 'response' => 400 ) );
81
+	if (0 === $updated) {
82
+		wp_die(esc_attr__('Error Updating Payment.', 'give'), esc_attr__('Error', 'give'), array('response' => 400));
83 83
 	}
84 84
 
85 85
 
86 86
 	$customer_changed = false;
87 87
 
88
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
88
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
89 89
 
90
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
91
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
90
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
91
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
92 92
 
93
-		if ( empty( $email ) || empty( $names ) ) {
94
-			wp_die( esc_attr__( 'New Customers require a name and email address.', 'give' ) );
93
+		if (empty($email) || empty($names)) {
94
+			wp_die(esc_attr__('New Customers require a name and email address.', 'give'));
95 95
 		}
96 96
 
97
-		$customer = new Give_Customer( $email );
98
-		if ( empty( $customer->id ) ) {
99
-			$customer_data = array( 'name' => $names, 'email' => $email );
100
-			$user_id       = email_exists( $email );
101
-			if ( false !== $user_id ) {
97
+		$customer = new Give_Customer($email);
98
+		if (empty($customer->id)) {
99
+			$customer_data = array('name' => $names, 'email' => $email);
100
+			$user_id       = email_exists($email);
101
+			if (false !== $user_id) {
102 102
 				$customer_data['user_id'] = $user_id;
103 103
 			}
104 104
 
105
-			if ( ! $customer->create( $customer_data ) ) {
105
+			if ( ! $customer->create($customer_data)) {
106 106
 				// Failed to crete the new donor, assume the previous donor
107 107
 				$customer_changed = false;
108
-				$customer         = new Give_Customer( $curr_customer_id );
109
-				give_set_error( 'give-payment-new-customer-fail', __( 'Error creating new donor.', 'give' ) );
108
+				$customer         = new Give_Customer($curr_customer_id);
109
+				give_set_error('give-payment-new-customer-fail', __('Error creating new donor.', 'give'));
110 110
 			}
111 111
 		}
112 112
 
113 113
 		$new_customer_id = $customer->id;
114 114
 
115
-		$previous_customer = new Give_Customer( $curr_customer_id );
115
+		$previous_customer = new Give_Customer($curr_customer_id);
116 116
 
117 117
 		$customer_changed = true;
118 118
 
119
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
119
+	} elseif ($curr_customer_id !== $new_customer_id) {
120 120
 
121
-		$customer = new Give_Customer( $new_customer_id );
121
+		$customer = new Give_Customer($new_customer_id);
122 122
 		$email    = $customer->email;
123 123
 		$names    = $customer->name;
124 124
 
125
-		$previous_customer = new Give_Customer( $curr_customer_id );
125
+		$previous_customer = new Give_Customer($curr_customer_id);
126 126
 
127 127
 		$customer_changed = true;
128 128
 
129 129
 	} else {
130 130
 
131
-		$customer = new Give_Customer( $curr_customer_id );
131
+		$customer = new Give_Customer($curr_customer_id);
132 132
 		$email    = $customer->email;
133 133
 		$names    = $customer->name;
134 134
 
@@ -136,35 +136,35 @@  discard block
 block discarded – undo
136 136
 
137 137
 
138 138
 	// Setup first and last name from input values
139
-	$names      = explode( ' ', $names );
140
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
139
+	$names      = explode(' ', $names);
140
+	$first_name = ! empty($names[0]) ? $names[0] : '';
141 141
 	$last_name  = '';
142
-	if ( ! empty( $names[1] ) ) {
143
-		unset( $names[0] );
144
-		$last_name = implode( ' ', $names );
142
+	if ( ! empty($names[1])) {
143
+		unset($names[0]);
144
+		$last_name = implode(' ', $names);
145 145
 	}
146 146
 
147 147
 
148
-	if ( $customer_changed ) {
148
+	if ($customer_changed) {
149 149
 
150 150
 		// Remove the stats and payment from the previous customer and attach it to the new customer
151
-		$previous_customer->remove_payment( $payment_id, false );
152
-		$customer->attach_payment( $payment_id, false );
151
+		$previous_customer->remove_payment($payment_id, false);
152
+		$customer->attach_payment($payment_id, false);
153 153
 
154 154
         // Reduce previous user donation count and amoount.
155 155
         $previous_customer->decrease_purchase_count();
156
-        $previous_customer->decrease_value( $curr_total );
156
+        $previous_customer->decrease_value($curr_total);
157 157
 
158 158
 		// If purchase was completed and not ever refunded, adjust stats of new customers.
159
-		if ( 'revoked' == $status || 'publish' == $status ) {
159
+		if ('revoked' == $status || 'publish' == $status) {
160 160
 			$customer->increase_purchase_count();
161
-			$customer->increase_value( $new_total );
161
+			$customer->increase_value($new_total);
162 162
 		}
163 163
 
164 164
 		$payment->customer_id = $customer->id;
165
-	} else{
165
+	} else {
166 166
 		// Update user donation stat.
167
-		$customer->update_donation_value( $curr_total, $new_total );
167
+		$customer->update_donation_value($curr_total, $new_total);
168 168
     }
169 169
 
170 170
 	// Set new meta values
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 
178 178
 
179 179
 	// Check for payment notes
180
-	if ( ! empty( $data['give-payment-note'] ) ) {
180
+	if ( ! empty($data['give-payment-note'])) {
181 181
 
182
-		$note = wp_kses( $data['give-payment-note'], array() );
183
-		give_insert_payment_note( $payment_id, $note );
182
+		$note = wp_kses($data['give-payment-note'], array());
183
+		give_insert_payment_note($payment_id, $note);
184 184
 
185 185
 	}
186 186
 
@@ -188,17 +188,17 @@  discard block
 block discarded – undo
188 188
 	$payment->status = $status;
189 189
 
190 190
 	// Adjust total store earnings if the payment total has been changed
191
-	if ( $new_total !== $curr_total && ( 'publish' == $status || 'revoked' == $status ) ) {
191
+	if ($new_total !== $curr_total && ('publish' == $status || 'revoked' == $status)) {
192 192
 
193
-		if ( $new_total > $curr_total ) {
193
+		if ($new_total > $curr_total) {
194 194
 			// Increase if our new total is higher
195 195
 			$difference = $new_total - $curr_total;
196
-			give_increase_total_earnings( $difference );
196
+			give_increase_total_earnings($difference);
197 197
 
198
-		} elseif ( $curr_total > $new_total ) {
198
+		} elseif ($curr_total > $new_total) {
199 199
 			// Decrease if our new total is lower
200 200
 			$difference = $curr_total - $new_total;
201
-			give_decrease_total_earnings( $difference );
201
+			give_decrease_total_earnings($difference);
202 202
 
203 203
 		}
204 204
 
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 	$payment->save();
208 208
 
209 209
     // Get new give form ID.
210
-    $new_form_id = absint( $data['forms'] );
211
-    $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
210
+    $new_form_id = absint($data['forms']);
211
+    $current_form_id = absint($payment->get_meta('_give_payment_form_id'));
212 212
 
213 213
     // We are adding payment transfer code in last to remove any conflict with above functionality.
214 214
     // For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
215 215
     /* Check if user want to transfer current payment to new give form id. */
216
-    if( $new_form_id != $current_form_id  ) {
216
+    if ($new_form_id != $current_form_id) {
217 217
 
218 218
         // Get new give form title.
219
-        $new_form_title = get_the_title( $new_form_id );
219
+        $new_form_title = get_the_title($new_form_id);
220 220
 
221 221
         // Update new give form data in payment data.
222 222
         $payment_meta = $payment->get_meta();
@@ -224,28 +224,28 @@  discard block
 block discarded – undo
224 224
         $payment_meta['form_id']    = $new_form_id;
225 225
 
226 226
         // Update price id post meta data for set donation form.
227
-        if( ! give_has_variable_prices( $new_form_id ) ) {
227
+        if ( ! give_has_variable_prices($new_form_id)) {
228 228
             $payment_meta['price_id'] = '';
229 229
         }
230 230
 
231 231
         // Update payment give form meta data.
232
-        $payment->update_meta( '_give_payment_form_id', $new_form_id );
233
-        $payment->update_meta( '_give_payment_form_title', $new_form_title );
234
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
232
+        $payment->update_meta('_give_payment_form_id', $new_form_id);
233
+        $payment->update_meta('_give_payment_form_title', $new_form_title);
234
+        $payment->update_meta('_give_payment_meta', $payment_meta);
235 235
 
236 236
         // Update price id payment metadata.
237
-        if( ! give_has_variable_prices( $new_form_id ) ) {
238
-            $payment->update_meta( '_give_payment_price_id', '' );
237
+        if ( ! give_has_variable_prices($new_form_id)) {
238
+            $payment->update_meta('_give_payment_price_id', '');
239 239
         }
240 240
 
241 241
 
242 242
         // If purchase was completed and not ever refunded, adjust stats of forms
243
-        if ( 'revoked' == $status || 'publish' == $status ) {
243
+        if ('revoked' == $status || 'publish' == $status) {
244 244
 
245 245
             // Decrease sale of old give form. For other payment status 
246
-            $current_form = new Give_Donate_Form( $current_form_id );
246
+            $current_form = new Give_Donate_Form($current_form_id);
247 247
             $current_form->decrease_sales();
248
-            $current_form->decrease_earnings( $curr_total );
248
+            $current_form->decrease_earnings($curr_total);
249 249
             
250 250
             // Increase sale of new give form.
251 251
             $new_form = new Give_Donate_Form($new_form_id);
@@ -254,36 +254,36 @@  discard block
 block discarded – undo
254 254
         }
255 255
 
256 256
         // Re setup payment to update new meta value in object.
257
-        $payment->update_payment_setup( $payment->ID );
257
+        $payment->update_payment_setup($payment->ID);
258 258
     }
259 259
 
260 260
     // Update price id if current form is variable form.
261
-    if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
261
+    if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) {
262 262
 
263 263
         // Get payment meta data.
264 264
         $payment_meta = $payment->get_meta();
265 265
 
266 266
         // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
267
-        $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
267
+        $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : '';
268 268
 
269 269
         // Update payment meta data.
270 270
         $payment_meta['price_id'] = $data['give-variable-price'];
271 271
 
272 272
         // Update payment give form meta data.
273
-        $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
274
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
273
+        $payment->update_meta('_give_payment_price_id', $data['give-variable-price']);
274
+        $payment->update_meta('_give_payment_meta', $payment_meta);
275 275
 
276 276
         // Re setup payment to update new meta value in object.
277
-        $payment->update_payment_setup( $payment->ID );
277
+        $payment->update_payment_setup($payment->ID);
278 278
     }
279 279
 
280
-	do_action( 'give_updated_edited_purchase', $payment_id );
280
+	do_action('give_updated_edited_purchase', $payment_id);
281 281
 
282
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
282
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
283 283
 	exit;
284 284
 }
285 285
 
286
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
286
+add_action('give_update_payment_details', 'give_update_payment_details');
287 287
 
288 288
 /**
289 289
  * Trigger a Purchase Deletion
@@ -294,48 +294,48 @@  discard block
 block discarded – undo
294 294
  *
295 295
  * @return void
296 296
  */
297
-function give_trigger_purchase_delete( $data ) {
298
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) {
297
+function give_trigger_purchase_delete($data) {
298
+	if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) {
299 299
 
300
-		$payment_id = absint( $data['purchase_id'] );
300
+		$payment_id = absint($data['purchase_id']);
301 301
 
302
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
303
-			wp_die( __( 'You do not have permission to edit payment records.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
302
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
303
+			wp_die(__('You do not have permission to edit payment records.', 'give'), __('Error', 'give'), array('response' => 403));
304 304
 		}
305 305
 
306
-		give_delete_purchase( $payment_id );
307
-		wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) );
306
+		give_delete_purchase($payment_id);
307
+		wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted'));
308 308
 		give_die();
309 309
 	}
310 310
 }
311 311
 
312
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
312
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
313 313
 
314 314
 /**
315 315
  * AJAX Store Payment Note
316 316
  */
317 317
 function give_ajax_store_payment_note() {
318 318
 
319
-	$payment_id = absint( $_POST['payment_id'] );
320
-	$note       = wp_kses( $_POST['note'], array() );
319
+	$payment_id = absint($_POST['payment_id']);
320
+	$note       = wp_kses($_POST['note'], array());
321 321
 
322
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
323
-		wp_die( __( 'You do not have permission to edit payment records.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
322
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
323
+		wp_die(__('You do not have permission to edit payment records.', 'give'), __('Error', 'give'), array('response' => 403));
324 324
 	}
325 325
 
326
-	if ( empty( $payment_id ) ) {
327
-		die( '-1' );
326
+	if (empty($payment_id)) {
327
+		die('-1');
328 328
 	}
329 329
 
330
-	if ( empty( $note ) ) {
331
-		die( '-1' );
330
+	if (empty($note)) {
331
+		die('-1');
332 332
 	}
333 333
 
334
-	$note_id = give_insert_payment_note( $payment_id, $note );
335
-	die( give_get_payment_note_html( $note_id ) );
334
+	$note_id = give_insert_payment_note($payment_id, $note);
335
+	die(give_get_payment_note_html($note_id));
336 336
 }
337 337
 
338
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
338
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
339 339
 
340 340
 /**
341 341
  * Triggers a payment note deletion without ajax
@@ -346,24 +346,24 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return void
348 348
  */
349
-function give_trigger_payment_note_deletion( $data ) {
349
+function give_trigger_payment_note_deletion($data) {
350 350
 
351
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
351
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
352 352
 		return;
353 353
 	}
354 354
 
355
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
356
-		wp_die( __( 'You do not have permission to edit payment records.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
355
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
356
+		wp_die(__('You do not have permission to edit payment records.', 'give'), __('Error', 'give'), array('response' => 403));
357 357
 	}
358 358
 
359
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) );
359
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id']));
360 360
 
361
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
361
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
362 362
 
363
-	wp_redirect( $edit_order_url );
363
+	wp_redirect($edit_order_url);
364 364
 }
365 365
 
366
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
366
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
367 367
 
368 368
 /**
369 369
  * Delete a payment note deletion with ajax
@@ -374,16 +374,16 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function give_ajax_delete_payment_note() {
376 376
 
377
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
378
-		wp_die( __( 'You do not have permission to edit payment records.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
377
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
378
+		wp_die(__('You do not have permission to edit payment records.', 'give'), __('Error', 'give'), array('response' => 403));
379 379
 	}
380 380
 
381
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
382
-		die( '1' );
381
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
382
+		die('1');
383 383
 	} else {
384
-		die( '-1' );
384
+		die('-1');
385 385
 	}
386 386
 
387 387
 }
388 388
 
389
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
390 389
\ No newline at end of file
390
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
391 391
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 					'row_classes'  => 'give-subfield',
76 76
 					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
77 77
 					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
78
-                    'sanitization_cb'   => 'give_sanitize_amount',
79
-                    'attributes'   => array(
78
+					'sanitization_cb'   => 'give_sanitize_amount',
79
+					'attributes'   => array(
80 80
 						'placeholder' => give_format_decimal( '1.00' ),
81 81
 						'value'       => give_format_decimal( $price ),
82 82
 						'class'       => 'cmb-type-text-small give-money-field',
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
112 112
 							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
113 113
 							'sanitization_cb'   => 'give_sanitize_amount',
114
-                            'attributes'        => array(
114
+							'attributes'        => array(
115 115
 								'placeholder' => '1.00',
116 116
 								'class'       => 'cmb-type-text-small give-money-field',
117 117
 							),
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 					'row_classes'  => 'give-subfield',
167 167
 					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
168 168
 					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
169
-                    'sanitization_cb'   => 'give_sanitize_amount',
170
-                    'attributes'   => array(
169
+					'sanitization_cb'   => 'give_sanitize_amount',
170
+					'attributes'   => array(
171 171
 						'placeholder' => give_format_decimal('1.00'),
172 172
 						'value'       => give_format_decimal( $custom_amount_minimum ),
173 173
 						'class'       => 'cmb-type-text-small give-money-field',
Please login to merge, or discard this patch.
Spacing   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' );
17
+add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array
25 25
  */
26
-function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
26
+function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
27 27
 
28 28
 	$post_id               = give_get_admin_post_id();
29
-	$price                 = give_get_form_price( $post_id );
30
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
31
-	$goal                  = give_get_form_goal( $post_id );
32
-	$variable_pricing      = give_has_variable_prices( $post_id );
33
-	$prices                = give_get_variable_prices( $post_id );
29
+	$price                 = give_get_form_price($post_id);
30
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
31
+	$goal                  = give_get_form_goal($post_id);
32
+	$variable_pricing      = give_has_variable_prices($post_id);
33
+	$prices                = give_get_variable_prices($post_id);
34 34
 
35 35
 	//No empty prices - min. 1.00 for new forms
36
-	if ( empty( $price ) && is_null( $post_id ) ) {
37
-		$price = esc_attr( give_format_amount( '1.00' ) );
36
+	if (empty($price) && is_null($post_id)) {
37
+		$price = esc_attr(give_format_amount('1.00'));
38 38
 	}
39 39
 
40 40
 	//Min. $1.00 for new forms
41
-	if ( empty( $custom_amount_minimum ) ) {
42
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
41
+	if (empty($custom_amount_minimum)) {
42
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
43 43
 	}
44 44
 
45 45
 	// Start with an underscore to hide fields from custom fields list
@@ -48,68 +48,68 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Repeatable Field Groups
50 50
 	 */
51
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
51
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
52 52
 		'id'           => 'form_field_options',
53
-		'title'        => __( 'Donation Options', 'give' ),
54
-		'object_types' => array( 'give_forms' ),
53
+		'title'        => __('Donation Options', 'give'),
54
+		'object_types' => array('give_forms'),
55 55
 		'context'      => 'normal',
56 56
 		'priority'     => 'high', //Show above Content WYSIWYG
57
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
57
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
58 58
 				//Donation Option
59 59
 				array(
60
-					'name'        => __( 'Donation Option', 'give' ),
61
-					'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
62
-					'id'          => $prefix . 'price_option',
60
+					'name'        => __('Donation Option', 'give'),
61
+					'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
62
+					'id'          => $prefix.'price_option',
63 63
 					'type'        => 'radio_inline',
64 64
 					'default'     => 'set',
65
-					'options'     => apply_filters( 'give_forms_price_options', array(
66
-						'set'   => __( 'Set Donation', 'give' ),
67
-						'multi' => __( 'Multi-level Donation', 'give' ),
68
-					) ),
65
+					'options'     => apply_filters('give_forms_price_options', array(
66
+						'set'   => __('Set Donation', 'give'),
67
+						'multi' => __('Multi-level Donation', 'give'),
68
+					)),
69 69
 				),
70 70
 				array(
71
-					'name'         => __( 'Set Donation', 'give' ),
72
-					'description'  => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
73
-					'id'           => $prefix . 'set_price',
71
+					'name'         => __('Set Donation', 'give'),
72
+					'description'  => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
73
+					'id'           => $prefix.'set_price',
74 74
 					'type'         => 'text_small',
75 75
 					'row_classes'  => 'give-subfield',
76
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
77
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
76
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
77
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
78 78
                     'sanitization_cb'   => 'give_sanitize_amount',
79 79
                     'attributes'   => array(
80
-						'placeholder' => give_format_decimal( '1.00' ),
81
-						'value'       => give_format_decimal( $price ),
80
+						'placeholder' => give_format_decimal('1.00'),
81
+						'value'       => give_format_decimal($price),
82 82
 						'class'       => 'cmb-type-text-small give-money-field',
83 83
 					),
84 84
 				),
85 85
 				//Donation levels: Header
86 86
 				array(
87
-					'id'   => $prefix . 'levels_header',
87
+					'id'   => $prefix.'levels_header',
88 88
 					'type' => 'levels_repeater_header',
89 89
 				),
90 90
 				//Donation Levels: Repeatable CMB2 Group
91 91
 				array(
92
-					'id'          => $prefix . 'donation_levels',
92
+					'id'          => $prefix.'donation_levels',
93 93
 					'type'        => 'group',
94 94
 					'row_classes' => 'give-subfield',
95 95
 					'options'     => array(
96
-						'add_button'    => __( 'Add Level', 'give' ),
96
+						'add_button'    => __('Add Level', 'give'),
97 97
 						'remove_button' => '<span class="dashicons dashicons-no"></span>',
98 98
 						'sortable'      => true, // beta
99 99
 					),
100 100
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
101
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
101
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
102 102
 						array(
103
-							'name' => __( 'ID', 'give' ),
104
-							'id'   => $prefix . 'id',
103
+							'name' => __('ID', 'give'),
104
+							'id'   => $prefix.'id',
105 105
 							'type' => 'levels_id',
106 106
 						),
107 107
 						array(
108
-							'name'              => __( 'Amount', 'give' ),
109
-							'id'                => $prefix . 'amount',
108
+							'name'              => __('Amount', 'give'),
109
+							'id'                => $prefix.'amount',
110 110
 							'type'              => 'text_small',
111
-							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
112
-							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
111
+							'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
112
+							'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
113 113
 							'sanitization_cb'   => 'give_sanitize_amount',
114 114
                             'attributes'        => array(
115 115
 								'placeholder' => '1.00',
@@ -118,260 +118,260 @@  discard block
 block discarded – undo
118 118
 							'before'       => 'give_format_admin_multilevel_amount',
119 119
 						),
120 120
 						array(
121
-							'name'       => __( 'Text', 'give' ),
122
-							'id'         => $prefix . 'text',
121
+							'name'       => __('Text', 'give'),
122
+							'id'         => $prefix.'text',
123 123
 							'type'       => 'text',
124 124
 							'attributes' => array(
125
-								'placeholder' => __( 'Donation Level', 'give' ),
125
+								'placeholder' => __('Donation Level', 'give'),
126 126
 								'class'       => 'give-multilevel-text-field',
127 127
 							),
128 128
 						),
129 129
 						array(
130
-							'name' => __( 'Default', 'give' ),
131
-							'id'   => $prefix . 'default',
130
+							'name' => __('Default', 'give'),
131
+							'id'   => $prefix.'default',
132 132
 							'type' => 'give_default_radio_inline'
133 133
 						),
134
-					) ),
134
+					)),
135 135
 				),
136 136
 				//Display Style
137 137
 				array(
138
-					'name'        => __( 'Display Style', 'give' ),
139
-					'description' => __( 'Set how the donations levels will display on the form.', 'give' ),
140
-					'id'          => $prefix . 'display_style',
138
+					'name'        => __('Display Style', 'give'),
139
+					'description' => __('Set how the donations levels will display on the form.', 'give'),
140
+					'id'          => $prefix.'display_style',
141 141
 					'type'        => 'radio_inline',
142 142
 					'default'     => 'buttons',
143 143
 					'options'     => array(
144
-						'buttons'  => __( 'Buttons', 'give' ),
145
-						'radios'   => __( 'Radios', 'give' ),
146
-						'dropdown' => __( 'Dropdown', 'give' ),
144
+						'buttons'  => __('Buttons', 'give'),
145
+						'radios'   => __('Radios', 'give'),
146
+						'dropdown' => __('Dropdown', 'give'),
147 147
 					),
148 148
 				),
149 149
 				//Custom Amount
150 150
 				array(
151
-					'name'        => __( 'Custom Amount', 'give' ),
152
-					'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
153
-					'id'          => $prefix . 'custom_amount',
151
+					'name'        => __('Custom Amount', 'give'),
152
+					'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
153
+					'id'          => $prefix.'custom_amount',
154 154
 					'type'        => 'radio_inline',
155 155
 					'default'     => 'no',
156 156
 					'options'     => array(
157
-						'yes' => __( 'Yes', 'give' ),
158
-						'no'  => __( 'No', 'give' ),
157
+						'yes' => __('Yes', 'give'),
158
+						'no'  => __('No', 'give'),
159 159
 					),
160 160
 				),
161 161
 				array(
162
-					'name'         => __( 'Custom Amount Minimum', 'give' ),
163
-					'description'  => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
164
-					'id'           => $prefix . 'custom_amount_minimum',
162
+					'name'         => __('Custom Amount Minimum', 'give'),
163
+					'description'  => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
164
+					'id'           => $prefix.'custom_amount_minimum',
165 165
 					'type'         => 'text_small',
166 166
 					'row_classes'  => 'give-subfield',
167
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
168
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
167
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
168
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
169 169
                     'sanitization_cb'   => 'give_sanitize_amount',
170 170
                     'attributes'   => array(
171 171
 						'placeholder' => give_format_decimal('1.00'),
172
-						'value'       => give_format_decimal( $custom_amount_minimum ),
172
+						'value'       => give_format_decimal($custom_amount_minimum),
173 173
 						'class'       => 'cmb-type-text-small give-money-field',
174 174
 					),
175 175
 				),
176 176
 				array(
177
-					'name'        => __( 'Custom Amount Text', 'give' ),
178
-					'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
179
-					'id'          => $prefix . 'custom_amount_text',
177
+					'name'        => __('Custom Amount Text', 'give'),
178
+					'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
179
+					'id'          => $prefix.'custom_amount_text',
180 180
 					'type'        => 'text',
181 181
 					'row_classes' => 'give-subfield',
182 182
 					'attributes'  => array(
183 183
 						'rows'        => 3,
184
-						'placeholder' => __( 'Give a Custom Amount', 'give' ),
184
+						'placeholder' => __('Give a Custom Amount', 'give'),
185 185
 					),
186 186
 				),
187 187
 				//Goals
188 188
 				array(
189
-					'name'        => __( 'Goal', 'give' ),
190
-					'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
191
-					'id'          => $prefix . 'goal_option',
189
+					'name'        => __('Goal', 'give'),
190
+					'description' => __('Do you want to set a donation goal for this form?', 'give'),
191
+					'id'          => $prefix.'goal_option',
192 192
 					'type'        => 'radio_inline',
193 193
 					'default'     => 'no',
194 194
 					'options'     => array(
195
-						'yes' => __( 'Yes', 'give' ),
196
-						'no'  => __( 'No', 'give' ),
195
+						'yes' => __('Yes', 'give'),
196
+						'no'  => __('No', 'give'),
197 197
 					),
198 198
 				),
199 199
 				array(
200
-					'name'              => __( 'Goal Amount', 'give' ),
201
-					'description'       => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
202
-					'id'                => $prefix . 'set_goal',
200
+					'name'              => __('Goal Amount', 'give'),
201
+					'description'       => __('This is the monetary goal amount you want to reach for this donation form.', 'give'),
202
+					'id'                => $prefix.'set_goal',
203 203
 					'type'              => 'text_small',
204 204
 					'row_classes'       => 'give-subfield',
205
-					'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
206
-					'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
205
+					'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
206
+					'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
207 207
 					'sanitization_cb'   => 'give_sanitize_amount',
208 208
 					'attributes'        => array(
209
-						'placeholder' => give_format_decimal( '0.00' ),
210
-						'value'       => give_format_decimal( $goal ),
209
+						'placeholder' => give_format_decimal('0.00'),
210
+						'value'       => give_format_decimal($goal),
211 211
 						'class'       => 'cmb-type-text-small give-money-field',
212 212
 					),
213 213
 				),
214 214
 
215 215
 				array(
216
-					'name'        => __( 'Goal Format', 'give' ),
217
-					'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
218
-					'id'          => $prefix . 'goal_format',
216
+					'name'        => __('Goal Format', 'give'),
217
+					'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
218
+					'id'          => $prefix.'goal_format',
219 219
 					'type'        => 'radio_inline',
220 220
 					'default'     => 'amount',
221 221
 					'row_classes' => 'give-subfield',
222 222
 					'options'     => array(
223
-						'amount'     => __( 'Amount ', 'give' ),
224
-						'percentage' => __( 'Percentage', 'give' ),
223
+						'amount'     => __('Amount ', 'give'),
224
+						'percentage' => __('Percentage', 'give'),
225 225
 					),
226 226
 				),
227 227
 				array(
228
-					'name'        => __( 'Goal Progress Bar Color', 'give' ),
229
-					'id'          => $prefix . 'goal_color',
228
+					'name'        => __('Goal Progress Bar Color', 'give'),
229
+					'id'          => $prefix.'goal_color',
230 230
 					'type'        => 'colorpicker',
231 231
 					'row_classes' => 'give-subfield',
232 232
 					'default'     => '#2bc253',
233 233
 				),
234 234
 
235 235
 				array(
236
-					'name'        => __( 'Close Form when Goal Achieved', 'give' ),
237
-					'desc'        => __( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
238
-					'id'          => $prefix . 'close_form_when_goal_achieved',
236
+					'name'        => __('Close Form when Goal Achieved', 'give'),
237
+					'desc'        => __('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
238
+					'id'          => $prefix.'close_form_when_goal_achieved',
239 239
 					'type'        => 'radio_inline',
240 240
 					'row_classes' => 'give-subfield',
241 241
 					'options'     => array(
242
-						'yes' => __( 'Yes', 'give' ),
243
-						'no'  => __( 'No', 'give' ),
242
+						'yes' => __('Yes', 'give'),
243
+						'no'  => __('No', 'give'),
244 244
 					),
245 245
 					'default'     => 'no',
246 246
 				),
247 247
 				array(
248
-					'name'        => __( 'Goal Achieved Message', 'give' ),
249
-					'desc'        => __( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
250
-					'id'          => $prefix . 'form_goal_achieved_message',
248
+					'name'        => __('Goal Achieved Message', 'give'),
249
+					'desc'        => __('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
250
+					'id'          => $prefix.'form_goal_achieved_message',
251 251
 					'type'        => 'textarea',
252 252
 					'row_classes' => 'give-subfield',
253 253
 					'attributes'  => array(
254
-						'placeholder' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
254
+						'placeholder' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
255 255
 					),
256 256
 				)
257 257
 			)
258 258
 		)
259
-	) );
259
+	));
260 260
 
261 261
 
262 262
 	/**
263 263
 	 * Content Field
264 264
 	 */
265
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
265
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
266 266
 		'id'           => 'form_content_options',
267
-		'title'        => __( 'Form Content', 'give' ),
268
-		'object_types' => array( 'give_forms' ),
267
+		'title'        => __('Form Content', 'give'),
268
+		'object_types' => array('give_forms'),
269 269
 		'context'      => 'normal',
270 270
 		'priority'     => 'high', //Show above Content WYSIWYG
271
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
271
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
272 272
 				//Donation Option
273 273
 				array(
274
-					'name'        => __( 'Display Content', 'give' ),
275
-					'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ),
276
-					'id'          => $prefix . 'content_option',
274
+					'name'        => __('Display Content', 'give'),
275
+					'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
276
+					'id'          => $prefix.'content_option',
277 277
 					'type'        => 'select',
278
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
279
-							'none'           => __( 'No content', 'give' ),
280
-							'give_pre_form'  => __( 'Yes, display content ABOVE the form fields', 'give' ),
281
-							'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ),
278
+					'options'     => apply_filters('give_forms_content_options_select', array(
279
+							'none'           => __('No content', 'give'),
280
+							'give_pre_form'  => __('Yes, display content ABOVE the form fields', 'give'),
281
+							'give_post_form' => __('Yes, display content BELOW the form fields', 'give'),
282 282
 						)
283 283
 					),
284 284
 					'default'     => 'none',
285 285
 				),
286 286
 				array(
287
-					'name'        => __( 'Content', 'give' ),
288
-					'description' => __( 'This content will display on the single give form page.', 'give' ),
289
-					'id'          => $prefix . 'form_content',
287
+					'name'        => __('Content', 'give'),
288
+					'description' => __('This content will display on the single give form page.', 'give'),
289
+					'id'          => $prefix.'form_content',
290 290
 					'row_classes' => 'give-subfield',
291 291
 					'type'        => 'wysiwyg'
292 292
 				),
293 293
 			)
294 294
 		)
295
-	) );
295
+	));
296 296
 
297 297
 
298 298
 	/**
299 299
 	 * Display Options
300 300
 	 */
301
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
301
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
302 302
 			'id'           => 'form_display_options',
303
-			'title'        => __( 'Form Display Options', 'give' ),
304
-			'object_types' => array( 'give_forms' ),
303
+			'title'        => __('Form Display Options', 'give'),
304
+			'object_types' => array('give_forms'),
305 305
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
306 306
 			'priority'     => 'high', //Show above Content WYSIWYG
307 307
 			'show_names'   => true, // Show field names on the left
308
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
308
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
309 309
 					array(
310
-						'name'    => __( 'Payment Fields', 'give' ),
311
-						'desc'    => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
312
-						'id'      => $prefix . 'payment_display',
310
+						'name'    => __('Payment Fields', 'give'),
311
+						'desc'    => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
312
+						'id'      => $prefix.'payment_display',
313 313
 						'type'    => 'select',
314 314
 						'options' => array(
315
-							'onpage' => __( 'Show on Page', 'give' ),
316
-							'reveal' => __( 'Reveal Upon Click', 'give' ),
317
-							'modal'  => __( 'Modal Window Upon Click', 'give' ),
315
+							'onpage' => __('Show on Page', 'give'),
316
+							'reveal' => __('Reveal Upon Click', 'give'),
317
+							'modal'  => __('Modal Window Upon Click', 'give'),
318 318
 						),
319 319
 						'default' => 'onpage',
320 320
 					),
321 321
 					array(
322
-						'id'          => $prefix . 'reveal_label',
323
-						'name'        => __( 'Reveal / Modal Open Text', 'give' ),
324
-						'desc'        => __( 'The button label for completing the donation.', 'give' ),
322
+						'id'          => $prefix.'reveal_label',
323
+						'name'        => __('Reveal / Modal Open Text', 'give'),
324
+						'desc'        => __('The button label for completing the donation.', 'give'),
325 325
 						'type'        => 'text_small',
326 326
 						'row_classes' => 'give-subfield',
327 327
 						'attributes'  => array(
328
-							'placeholder' => __( 'Donate Now', 'give' ),
328
+							'placeholder' => __('Donate Now', 'give'),
329 329
 						),
330 330
 					),
331 331
 					array(
332
-						'id'         => $prefix . 'checkout_label',
333
-						'name'       => __( 'Complete Donation Text', 'give' ),
334
-						'desc'       => __( 'The button label for completing a donation.', 'give' ),
332
+						'id'         => $prefix.'checkout_label',
333
+						'name'       => __('Complete Donation Text', 'give'),
334
+						'desc'       => __('The button label for completing a donation.', 'give'),
335 335
 						'type'       => 'text_small',
336 336
 						'attributes' => array(
337
-							'placeholder' => __( 'Donate Now', 'give' ),
337
+							'placeholder' => __('Donate Now', 'give'),
338 338
 						),
339 339
 					),
340 340
 					array(
341
-						'name' => __( 'Default Gateway', 'give' ),
342
-						'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
343
-						'id'   => $prefix . 'default_gateway',
341
+						'name' => __('Default Gateway', 'give'),
342
+						'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
343
+						'id'   => $prefix.'default_gateway',
344 344
 						'type' => 'default_gateway'
345 345
 					),
346 346
 					array(
347
-						'name' => __( 'Disable Guest Donations', 'give' ),
348
-						'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ),
349
-						'id'   => $prefix . 'logged_in_only',
347
+						'name' => __('Disable Guest Donations', 'give'),
348
+						'desc' => __('Do you want to require users be logged-in to make donations?', 'give'),
349
+						'id'   => $prefix.'logged_in_only',
350 350
 						'type' => 'checkbox'
351 351
 					),
352 352
 					array(
353
-						'name'    => __( 'Register / Login Form', 'give' ),
354
-						'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
355
-						'id'      => $prefix . 'show_register_form',
353
+						'name'    => __('Register / Login Form', 'give'),
354
+						'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
355
+						'id'      => $prefix.'show_register_form',
356 356
 						'type'    => 'select',
357 357
 						'options' => array(
358
-							'both'         => __( 'Registration and Login Forms', 'give' ),
359
-							'registration' => __( 'Registration Form Only', 'give' ),
360
-							'login'        => __( 'Login Form Only', 'give' ),
361
-							'none'         => __( 'None', 'give' ),
358
+							'both'         => __('Registration and Login Forms', 'give'),
359
+							'registration' => __('Registration Form Only', 'give'),
360
+							'login'        => __('Login Form Only', 'give'),
361
+							'none'         => __('None', 'give'),
362 362
 						),
363 363
 						'default' => 'none',
364 364
 					),
365 365
 					array(
366
-						'name'    => __( 'Floating Labels', 'give' ),
366
+						'name'    => __('Floating Labels', 'give'),
367 367
 						/* translators: %s: forms http://bradfrost.com/blog/post/float-label-pattern/ */
368
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ),
369
-						'id'      => $prefix . 'form_floating_labels',
368
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
369
+						'id'      => $prefix.'form_floating_labels',
370 370
 						'type'    => 'select',
371 371
 						'options' => array(
372
-							''         => __( 'Use the global setting', 'give' ),
373
-							'enabled'  => __( 'Enabled', 'give' ),
374
-							'disabled' => __( 'Disabled', 'give' ),
372
+							''         => __('Use the global setting', 'give'),
373
+							'enabled'  => __('Enabled', 'give'),
374
+							'disabled' => __('Disabled', 'give'),
375 375
 						),
376 376
 						'default' => 'none',
377 377
 					)
@@ -383,47 +383,47 @@  discard block
 block discarded – undo
383 383
 	/**
384 384
 	 * Terms & Conditions
385 385
 	 */
386
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
386
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
387 387
 		'id'           => 'form_terms_options',
388
-		'title'        => __( 'Terms and Conditions', 'give' ),
389
-		'object_types' => array( 'give_forms' ),
388
+		'title'        => __('Terms and Conditions', 'give'),
389
+		'object_types' => array('give_forms'),
390 390
 		'context'      => 'normal',
391 391
 		'priority'     => 'high', //Show above Content WYSIWYG
392
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
392
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
393 393
 				//Donation Option
394 394
 				array(
395
-					'name'        => __( 'Terms and Conditions', 'give' ),
396
-					'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
397
-					'id'          => $prefix . 'terms_option',
395
+					'name'        => __('Terms and Conditions', 'give'),
396
+					'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
397
+					'id'          => $prefix.'terms_option',
398 398
 					'type'        => 'select',
399
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
400
-							'none' => __( 'No', 'give' ),
401
-							'yes'  => __( 'Yes', 'give' ),
399
+					'options'     => apply_filters('give_forms_content_options_select', array(
400
+							'none' => __('No', 'give'),
401
+							'yes'  => __('Yes', 'give'),
402 402
 						)
403 403
 					),
404 404
 					'default'     => 'none',
405 405
 				),
406 406
 				array(
407
-					'id'          => $prefix . 'agree_label',
408
-					'name'        => __( 'Agree to Terms Label', 'give' ),
409
-					'desc'        => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
407
+					'id'          => $prefix.'agree_label',
408
+					'name'        => __('Agree to Terms Label', 'give'),
409
+					'desc'        => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
410 410
 					'type'        => 'text',
411 411
 					'row_classes' => 'give-subfield',
412 412
 					'size'        => 'regular',
413 413
 					'attributes'  => array(
414
-						'placeholder' => __( 'Agree to Terms?', 'give' ),
414
+						'placeholder' => __('Agree to Terms?', 'give'),
415 415
 					),
416 416
 				),
417 417
 				array(
418
-					'id'          => $prefix . 'agree_text',
418
+					'id'          => $prefix.'agree_text',
419 419
 					'row_classes' => 'give-subfield',
420
-					'name'        => __( 'Agreement Text', 'give' ),
421
-					'desc'        => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
420
+					'name'        => __('Agreement Text', 'give'),
421
+					'desc'        => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
422 422
 					'type'        => 'wysiwyg'
423 423
 				),
424 424
 			)
425 425
 		)
426
-	) );
426
+	));
427 427
 
428 428
 	return $meta_boxes;
429 429
 
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 
438 438
 	<div class="table-container">
439 439
 		<div class="table-row">
440
-			<div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div>
441
-			<div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div>
442
-			<div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div>
443
-			<?php do_action( 'give_donation_levels_table_head' ); ?>
444
-			<div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div>
440
+			<div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div>
441
+			<div class="table-cell col-text"><?php _e('Text', 'give'); ?></div>
442
+			<div class="table-cell col-default"><?php _e('Default', 'give'); ?></div>
443
+			<?php do_action('give_donation_levels_table_head'); ?>
444
+			<div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div>
445 445
 
446 446
 		</div>
447 447
 	</div>
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	<?php
450 450
 }
451 451
 
452
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
452
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
453 453
 
454 454
 
455 455
 /**
@@ -466,25 +466,25 @@  discard block
 block discarded – undo
466 466
  * @param $object_type
467 467
  * @param $field_type_object
468 468
  */
469
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
469
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
470 470
 
471
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
471
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
472 472
 
473 473
 	$field_options_array = array(
474 474
 		'class' => 'give-hidden give-level-id-input',
475
-		'name'  => $field_type_object->_name( '[level_id]' ),
476
-		'id'    => $field_type_object->_id( '_level_id' ),
475
+		'name'  => $field_type_object->_name('[level_id]'),
476
+		'id'    => $field_type_object->_id('_level_id'),
477 477
 		'value' => $escaped_value,
478 478
 		'type'  => 'number',
479 479
 		'desc'  => '',
480 480
 	);
481 481
 
482
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
483
-	echo $field_type_object->input( $field_options_array );
482
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
483
+	echo $field_type_object->input($field_options_array);
484 484
 
485 485
 }
486 486
 
487
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
487
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
488 488
 
489 489
 
490 490
 /**
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
  * @param $object_type
497 497
  * @param $field_type_object
498 498
  */
499
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
500
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
501
-	echo '<label for="' . $field_object->args['id'] . '">Default</label>';
499
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
500
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
501
+	echo '<label for="'.$field_object->args['id'].'">Default</label>';
502 502
 
503 503
 }
504 504
 
505
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
505
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
506 506
 
507 507
 
508 508
 /**
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
  */
513 513
 function give_add_shortcode_to_publish_metabox() {
514 514
 
515
-	if ( 'give_forms' !== get_post_type() ) {
515
+	if ('give_forms' !== get_post_type()) {
516 516
 		return false;
517 517
 	}
518 518
 
519 519
 	global $post;
520 520
 
521 521
 	//Only enqueue scripts for CPT on post type screen
522
-	if ( 'give_forms' === $post->post_type ) {
522
+	if ('give_forms' === $post->post_type) {
523 523
 		//Shortcode column with select all input
524
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
525
-		echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
524
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
525
+		echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
526 526
 
527 527
 	}
528 528
 
529 529
 }
530 530
 
531
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
531
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.