Completed
Push — master ( bcc91e...18de6c )
by Devin
14:07 queued 10:35
created
includes/admin/welcome.php 1 patch
Spacing   +103 added lines, -103 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
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 			/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 			/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 			/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 		// Badge for welcome page
109
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
109
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
110 110
 
111 111
 		?>
112 112
 		<style type="text/css" media="screen">
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 	 * @return void
187 187
 	 */
188 188
 	public function tabs() {
189
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
189
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
190 190
 		?>
191 191
 		<h2 class="nav-tab-wrapper">
192
-			<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' ) ) ); ?>">
193
-				<?php esc_html_e( 'About Give', 'give' ); ?>
192
+			<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'))); ?>">
193
+				<?php esc_html_e('About Give', 'give'); ?>
194 194
 			</a>
195
-			<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' ) ) ); ?>">
196
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
195
+			<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'))); ?>">
196
+				<?php esc_html_e('Getting Started', 'give'); ?>
197 197
 			</a>
198
-			<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' ) ) ); ?>">
199
-				<?php esc_html_e( 'Credits', 'give' ); ?>
198
+			<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'))); ?>">
199
+				<?php esc_html_e('Credits', 'give'); ?>
200 200
 			</a>
201
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
202
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
201
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
202
+				<?php esc_html_e('Add-ons', 'give'); ?>
203 203
 			</a>
204 204
 		</h2>
205 205
 	<?php
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return void
214 214
 	 */
215 215
 	public function about_screen() {
216
-		list( $display_version ) = explode( '-', GIVE_VERSION );
216
+		list($display_version) = explode('-', GIVE_VERSION);
217 217
 		?>
218 218
 		<div class="wrap about-wrap">
219 219
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 			<p class="about-text"><?php
224 224
 				printf(
225 225
 					/* translators: %s: https://givewp.com/documenation/ */
226
-					__( '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. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
227
-					esc_url( 'https://givewp.com/documenation/' )
226
+					__('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. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
227
+					esc_url('https://givewp.com/documenation/')
228 228
 				);
229 229
 			?></p>
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			<div class="give-badge"><?php
234 234
 				printf(
235 235
 					/* translators: %s: Give version */
236
-					esc_html__( 'Version %s', 'give' ),
236
+					esc_html__('Version %s', 'give'),
237 237
 					$display_version
238 238
 				);
239 239
 			?></div>
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
 			<div class="feature-section clearfix introduction">
244 244
 
245 245
 				<div class="video feature-section-item">
246
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
246
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
247 247
 				</div>
248 248
 
249 249
 				<div class="content feature-section-item last-feature">
250 250
 
251
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
251
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
252 252
 
253
-					<p><?php esc_html_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>
253
+					<p><?php esc_html_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>
254 254
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
255
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
255
+						<?php esc_html_e('Learn More', 'give'); ?>
256 256
 						<span class="dashicons dashicons-external"></span>
257 257
 					</a>
258 258
 
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
 				<div class="content feature-section-item">
267 267
 
268
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
268
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
269 269
 
270
-					<p><?php esc_html_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>
270
+					<p><?php esc_html_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>
271 271
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary">
272
-						<?php esc_html_e( 'View Documentation', 'give' ); ?>
272
+						<?php esc_html_e('View Documentation', 'give'); ?>
273 273
 						<span class="dashicons dashicons-external"></span>
274 274
 					</a>
275 275
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 				<div class="content  feature-section-item last-feature">
279 279
 
280
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
280
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>">
281 281
 
282 282
 				</div>
283 283
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return void
298 298
 	 */
299 299
 	public function changelog_screen() {
300
-		list( $display_version ) = explode( '-', GIVE_VERSION );
300
+		list($display_version) = explode('-', GIVE_VERSION);
301 301
 		?>
302 302
 		<div class="wrap about-wrap">
303 303
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
 			<p class="about-text"><?php
306 306
 				printf(
307 307
 					/* translators: %s: Give version */
308
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
308
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
309 309
 					$display_version
310 310
 				);
311 311
 			?></p>
312 312
 			<div class="give-badge"><?php
313 313
 				printf(
314 314
 					/* translators: %s: Give version */
315
-					esc_html__( 'Version %s', 'give' ),
315
+					esc_html__('Version %s', 'give'),
316 316
 					$display_version
317 317
 				);
318 318
 			?></div>
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			<?php $this->tabs(); ?>
321 321
 
322 322
 			<div class="changelog">
323
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
323
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
324 324
 
325 325
 				<div class="feature-section">
326 326
 					<?php echo $this->parse_readme(); ?>
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			</div>
329 329
 
330 330
 			<div class="return-to-dashboard">
331
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
331
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
332 332
 					'post_type' => 'give_forms',
333 333
 					'page'      => 'give-settings'
334
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
334
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
335 335
 			</div>
336 336
 		</div>
337 337
 	<?php
@@ -345,37 +345,37 @@  discard block
 block discarded – undo
345 345
 	 * @return void
346 346
 	 */
347 347
 	public function getting_started_screen() {
348
-		list( $display_version ) = explode( '-', GIVE_VERSION );
348
+		list($display_version) = explode('-', GIVE_VERSION);
349 349
 		?>
350 350
 		<div class="wrap about-wrap get-started">
351 351
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
352 352
 
353 353
 			<?php give_social_media_elements() ?>
354 354
 
355
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
355
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
356 356
 
357 357
 			<?php give_get_newsletter(); ?>
358 358
 
359 359
 			<div class="give-badge"><?php
360 360
 				printf(
361 361
 					/* translators: %s: Give version */
362
-					esc_html__( 'Version %s', 'give' ),
362
+					esc_html__('Version %s', 'give'),
363 363
 					$display_version
364 364
 				);
365 365
 			?></div>
366 366
 
367 367
 			<?php $this->tabs(); ?>
368 368
 
369
-			<p class="about-text"><?php printf( esc_html__( '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 ); ?></p>
369
+			<p class="about-text"><?php printf(esc_html__('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); ?></p>
370 370
 
371 371
 			<div class="feature-section clearfix">
372 372
 
373 373
 				<div class="content feature-section-item">
374
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
374
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
375 375
 
376
-					<p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
376
+					<p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
377 377
 
378
-					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
378
+					<p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
379 379
 				</div>
380 380
 
381 381
 				<div class="content feature-section-item last-feature">
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 				</div>
393 393
 
394 394
 				<div class="content feature-section-item last-feature">
395
-					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
395
+					<h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
396 396
 
397
-					<p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
397
+					<p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
398 398
 				</div>
399 399
 
400 400
 			</div>
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 			<div class="feature-section clearfix">
404 404
 
405 405
 				<div class="content feature-section-item add-content">
406
-					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
406
+					<h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
407 407
 
408
-					<p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
408
+					<p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
409 409
 
410
-					<p><?php esc_html_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>
410
+					<p><?php esc_html_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>
411 411
 				</div>
412 412
 
413 413
 				<div class="content feature-section-item last-feature">
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 				</div>
425 425
 
426 426
 				<div class="content feature-section-item last-feature">
427
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
427
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
428 428
 
429
-					<p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
429
+					<p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
430 430
 				</div>
431 431
 
432 432
 
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 	 * @return void
447 447
 	 */
448 448
 	public function credits_screen() {
449
-		list( $display_version ) = explode( '-', GIVE_VERSION );
449
+		list($display_version) = explode('-', GIVE_VERSION);
450 450
 		?>
451 451
 		<div class="wrap about-wrap">
452 452
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
453 453
 
454 454
 			<?php give_social_media_elements() ?>
455 455
 
456
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
456
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
457 457
 
458
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
458
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
459 459
 
460 460
 			<?php give_get_newsletter(); ?>
461 461
 
462 462
 			<div class="give-badge"><?php
463 463
 				printf(
464 464
 					/* translators: %s: Give version */
465
-					esc_html__( 'Version %s', 'give' ),
465
+					esc_html__('Version %s', 'give'),
466 466
 					$display_version
467 467
 				);
468 468
 			?></div>
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 			<p class="about-description"><?php
473 473
 				printf(
474 474
 					/* translators: %s: https://github.com/WordImpress/give */
475
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
476
-					esc_url( 'https://github.com/WordImpress/give' )
475
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
476
+					esc_url('https://github.com/WordImpress/give')
477 477
 				);
478 478
 			?></p>
479 479
 
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
 	 * @return string $readme HTML formatted readme file
491 491
 	 */
492 492
 	public function parse_readme() {
493
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
493
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
494 494
 
495
-		if ( ! $file ) {
496
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
495
+		if ( ! $file) {
496
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
497 497
 		} else {
498
-			$readme = file_get_contents( $file );
499
-			$readme = nl2br( esc_html( $readme ) );
500
-			$readme = explode( '== Changelog ==', $readme );
501
-			$readme = end( $readme );
502
-
503
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
504
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
505
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
506
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
507
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
498
+			$readme = file_get_contents($file);
499
+			$readme = nl2br(esc_html($readme));
500
+			$readme = explode('== Changelog ==', $readme);
501
+			$readme = end($readme);
502
+
503
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
504
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
505
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
506
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
507
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
508 508
 		}
509 509
 
510 510
 		return $readme;
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 	public function contributors() {
522 522
 		$contributors = $this->get_contributors();
523 523
 
524
-		if ( empty( $contributors ) ) {
524
+		if (empty($contributors)) {
525 525
 			return '';
526 526
 		}
527 527
 
528 528
 		$contributor_list = '<ul class="wp-people-group">';
529 529
 
530
-		foreach ( $contributors as $contributor ) {
530
+		foreach ($contributors as $contributor) {
531 531
 			$contributor_list .= '<li class="wp-person">';
532 532
 			$contributor_list .= sprintf(
533 533
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
534
-				esc_url( 'https://github.com/' . $contributor->login ),
535
-				esc_url( $contributor->avatar_url ),
536
-				esc_attr( $contributor->login )
534
+				esc_url('https://github.com/'.$contributor->login),
535
+				esc_url($contributor->avatar_url),
536
+				esc_attr($contributor->login)
537 537
 			);
538 538
 			$contributor_list .= sprintf(
539 539
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
540
-				esc_url( 'https://github.com/' . $contributor->login ),
541
-				esc_html( $contributor->login )
540
+				esc_url('https://github.com/'.$contributor->login),
541
+				esc_html($contributor->login)
542 542
 			);
543 543
 			$contributor_list .= '</li>';
544 544
 		}
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 	 * @return array $contributors List of contributors
557 557
 	 */
558 558
 	public function get_contributors() {
559
-		$contributors = Give_Cache::get( 'give_contributors', true );
559
+		$contributors = Give_Cache::get('give_contributors', true);
560 560
 
561
-		if ( false !== $contributors ) {
561
+		if (false !== $contributors) {
562 562
 			return $contributors;
563 563
 		}
564 564
 
565
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
565
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
566 566
 
567
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
567
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
568 568
 			return array();
569 569
 		}
570 570
 
571
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
571
+		$contributors = json_decode(wp_remote_retrieve_body($response));
572 572
 
573
-		if ( ! is_array( $contributors ) ) {
573
+		if ( ! is_array($contributors)) {
574 574
 			return array();
575 575
 		}
576 576
 
577
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
577
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
578 578
 
579 579
 		return $contributors;
580 580
 	}
@@ -592,24 +592,24 @@  discard block
 block discarded – undo
592 592
 		$give_options = give_get_settings();
593 593
 
594 594
 		// Bail if no activation redirect
595
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
595
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
596 596
 			return;
597 597
 		}
598 598
 
599 599
 		// Delete the redirect transient
600
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
600
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
601 601
 
602 602
 		// Bail if activating from network, or bulk
603
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
603
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
604 604
 			return;
605 605
 		}
606 606
 
607
-		$upgrade = get_option( 'give_version_upgraded_from' );
607
+		$upgrade = get_option('give_version_upgraded_from');
608 608
 
609
-		if ( ! $upgrade ) { // First time install
610
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
609
+		if ( ! $upgrade) { // First time install
610
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
611 611
 			exit;
612
-		} elseif( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
612
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
613 613
 
614 614
 		} else { // Welcome is NOT disabled in settings
615 615
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/payments/actions.php 1 patch
Spacing   +49 added lines, -49 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
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once.
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete.
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_purchase', $payment_id );
61
+	do_action('give_pre_complete_purchase', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever.
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 		 * @param int   $payment_id   The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID.
82
-	give_increase_earnings( $form_id, $amount );
83
-	give_increase_purchase_count( $form_id );
82
+	give_increase_earnings($form_id, $amount);
83
+	give_increase_purchase_count($form_id);
84 84
 
85 85
 	// @todo: Refresh only range related stat cache
86 86
 	give_delete_donation_stats();
87 87
 
88 88
 	// Increase the donor's donation stats.
89
-	$customer = new Give_Customer( $customer_id );
89
+	$customer = new Give_Customer($customer_id);
90 90
 	$customer->increase_purchase_count();
91
-	$customer->increase_value( $amount );
91
+	$customer->increase_value($amount);
92 92
 
93
-	give_increase_total_earnings( $amount );
93
+	give_increase_total_earnings($amount);
94 94
 
95 95
 	// Ensure this action only runs once ever.
96
-	if ( empty( $completed_date ) ) {
96
+	if (empty($completed_date)) {
97 97
 
98 98
 		// Save the completed date.
99
-		$payment->completed_date = current_time( 'mysql' );
99
+		$payment->completed_date = current_time('mysql');
100 100
 		$payment->save();
101 101
 
102 102
 		/**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @param int $payment_id The ID of the payment.
108 108
 		 */
109
-		do_action( 'give_complete_donation', $payment_id );
109
+		do_action('give_complete_donation', $payment_id);
110 110
 	}
111 111
 
112 112
 }
113 113
 
114
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
114
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
115 115
 
116 116
 
117 117
 /**
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
128
+function give_record_status_change($payment_id, $new_status, $old_status) {
129 129
 
130 130
 	// Get the list of statuses so that status in the payment note can be translated.
131 131
 	$stati      = give_get_payment_statuses();
132
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
132
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
133
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
134 134
 
135 135
 	// translators: 1: old status 2: new status.
136 136
 	$status_change = sprintf(
137
-		esc_html__( 'Status changed from %1$s to %2$s.', 'give' ),
137
+		esc_html__('Status changed from %1$s to %2$s.', 'give'),
138 138
 		$old_status,
139 139
 		$new_status
140 140
 	);
141 141
 
142
-	give_insert_payment_note( $payment_id, $status_change );
142
+	give_insert_payment_note($payment_id, $status_change);
143 143
 }
144 144
 
145
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
145
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
146 146
 
147 147
 
148 148
 /**
@@ -158,25 +158,25 @@  discard block
 block discarded – undo
158 158
  *
159 159
  * @return void
160 160
  */
161
-function give_update_old_payments_with_totals( $data ) {
162
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
161
+function give_update_old_payments_with_totals($data) {
162
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
163 163
 		return;
164 164
 	}
165 165
 
166
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
166
+	if (get_option('give_payment_totals_upgraded')) {
167 167
 		return;
168 168
 	}
169 169
 
170
-	$payments = give_get_payments( array(
170
+	$payments = give_get_payments(array(
171 171
 		'offset' => 0,
172
-		'number' => - 1,
172
+		'number' => -1,
173 173
 		'mode'   => 'all',
174
-	) );
174
+	));
175 175
 
176
-	if ( $payments ) {
177
-		foreach ( $payments as $payment ) {
176
+	if ($payments) {
177
+		foreach ($payments as $payment) {
178 178
 
179
-			$payment = new Give_Payment( $payment->ID );
179
+			$payment = new Give_Payment($payment->ID);
180 180
 			$meta    = $payment->get_meta();
181 181
 
182 182
 			$payment->total = $meta['amount'];
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 	}
187 187
 
188
-	add_option( 'give_payment_totals_upgraded', 1 );
188
+	add_option('give_payment_totals_upgraded', 1);
189 189
 }
190 190
 
191
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
191
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
192 192
 
193 193
 /**
194 194
  * Mark Abandoned Donations
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
 function give_mark_abandoned_donations() {
203 203
 	$args = array(
204 204
 		'status' => 'pending',
205
-		'number' => - 1,
205
+		'number' => -1,
206 206
 		'output' => 'give_payments',
207 207
 	);
208 208
 
209
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	add_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	$payments = give_get_payments( $args );
211
+	$payments = give_get_payments($args);
212 212
 
213
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
213
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
214 214
 
215
-	if ( $payments ) {
215
+	if ($payments) {
216 216
 		/**
217 217
 		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
218 218
 		 *
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
 		 *
221 221
 		 * @param array $skip_payment_gateways Array of payment gateways
222 222
 		 */
223
-		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
223
+		$skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
224 224
 
225
-		foreach ( $payments as $payment ) {
226
-			$gateway = give_get_payment_gateway( $payment );
225
+		foreach ($payments as $payment) {
226
+			$gateway = give_get_payment_gateway($payment);
227 227
 
228 228
 			// Skip payment gateways.
229
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
229
+			if (in_array($gateway, $skip_payment_gateways)) {
230 230
 				continue;
231 231
 			}
232 232
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	}
237 237
 }
238 238
 
239
-add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' );
239
+add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations');
240 240
 
241 241
 
242 242
 /**
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
  *
249 249
  * @return void
250 250
  */
251
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
251
+function give_refresh_thismonth_stat_transients($payment_ID) {
252 252
 	// Monthly stats.
253
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
253
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
254 254
 
255 255
 	// @todo: Refresh only range related stat cache
256 256
 	give_delete_donation_stats();
257 257
 }
258 258
 
259
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
259
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
Please login to merge, or discard this patch.
includes/formatting.php 1 patch
Spacing   +100 added lines, -100 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,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-	return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
26
+	return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0));
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-	return give_get_option( 'thousands_separator', ',' );
37
+	return give_get_option('thousands_separator', ',');
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-	return give_get_option( 'decimal_separator', '.' );
48
+	return give_get_option('decimal_separator', '.');
49 49
 }
50 50
 
51 51
 /**
@@ -61,67 +61,67 @@  discard block
 block discarded – undo
61 61
  *
62 62
  * @return string $amount Newly sanitized amount
63 63
  */
64
-function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
64
+function give_sanitize_amount($number, $dp = false, $trim_zeros = false) {
65 65
 
66 66
 	// Bailout.
67
-	if ( empty( $number ) ) {
67
+	if (empty($number)) {
68 68
 		return $number;
69 69
 	}
70 70
 
71 71
 	// Remove slash from amount.
72 72
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
73 73
 	// To prevent notices and warning remove slash from amount/number.
74
-	$number = wp_unslash( $number );
74
+	$number = wp_unslash($number);
75 75
 
76 76
 	$thousand_separator = give_get_price_thousand_separator();
77 77
 
78 78
 	$locale   = localeconv();
79
-	$decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
79
+	$decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']);
80 80
 
81 81
 	// Remove locale from string
82
-	if ( ! is_float( $number ) ) {
83
-		$number = str_replace( $decimals, '.', $number );
82
+	if ( ! is_float($number)) {
83
+		$number = str_replace($decimals, '.', $number);
84 84
 	}
85 85
 
86 86
 	// Remove thousand amount formatting if amount has.
87 87
 	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
88 88
 	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
89
-	if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
90
-		$number = str_replace( $thousand_separator, '', $number );
91
-	} elseif ( in_array( $thousand_separator, $decimals ) ) {
92
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
89
+	if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
90
+		$number = str_replace($thousand_separator, '', $number);
91
+	} elseif (in_array($thousand_separator, $decimals)) {
92
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
93 93
 	}
94 94
 
95 95
 	// Remove non numeric entity before decimal separator.
96
-	$number     = preg_replace( '/[^0-9\.]/', '', $number );
96
+	$number     = preg_replace('/[^0-9\.]/', '', $number);
97 97
 	$default_dp = give_get_price_decimals();
98 98
 
99 99
 	// Reset negative amount to zero.
100
-	if ( 0 > $number ) {
101
-		$number = number_format( 0, $default_dp, '.' );
100
+	if (0 > $number) {
101
+		$number = number_format(0, $default_dp, '.');
102 102
 	}
103 103
 
104 104
 	// If number does not have decimal then add number of decimals to it.
105 105
 	if (
106
-		false === strpos( $number, '.' )
107
-		|| ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) )
106
+		false === strpos($number, '.')
107
+		|| ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
108 108
 	) {
109
-		$number = number_format( $number, $default_dp, '.', '' );
109
+		$number = number_format($number, $default_dp, '.', '');
110 110
 	}
111 111
 
112 112
 	// Format number by custom number of decimals.
113
-	if ( false !== $dp ) {
114
-		$dp     = intval( is_bool( $dp ) ? $default_dp : $dp );
115
-		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
116
-		$number = number_format( floatval( $number ), $dp, '.', '' );
113
+	if (false !== $dp) {
114
+		$dp     = intval(is_bool($dp) ? $default_dp : $dp);
115
+		$dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
116
+		$number = number_format(floatval($number), $dp, '.', '');
117 117
 	}
118 118
 
119 119
 	// Trim zeros.
120
-	if ( $trim_zeros && strstr( $number, '.' ) ) {
121
-		$number = rtrim( rtrim( $number, '0' ), '.' );
120
+	if ($trim_zeros && strstr($number, '.')) {
121
+		$number = rtrim(rtrim($number, '0'), '.');
122 122
 	}
123 123
 
124
-	return apply_filters( 'give_sanitize_amount', $number );
124
+	return apply_filters('give_sanitize_amount', $number);
125 125
 }
126 126
 
127 127
 /**
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return string $amount   Newly formatted amount or Price Not Available
136 136
  */
137
-function give_format_amount( $amount, $decimals = true ) {
138
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
139
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
137
+function give_format_amount($amount, $decimals = true) {
138
+	$thousands_sep = give_get_option('thousands_separator', ',');
139
+	$decimal_sep   = give_get_option('decimal_separator', '.');
140 140
 
141
-	if ( empty( $amount ) ) {
141
+	if (empty($amount)) {
142 142
 		$amount = 0;
143 143
 	} else {
144 144
 		// Sanitize amount before formatting.
145
-		$amount = give_sanitize_amount( $amount );
145
+		$amount = give_sanitize_amount($amount);
146 146
 	}
147 147
 
148 148
 	$decimals = $decimals ? give_get_price_decimals() : 0;
149 149
 
150
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
150
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
151 151
 
152
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
152
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
153 153
 }
154 154
 
155 155
 
@@ -166,33 +166,33 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @return float|string  formatted amount number with large number names.
168 168
  */
169
-function give_human_format_large_amount( $amount ) {
169
+function give_human_format_large_amount($amount) {
170 170
 
171 171
 	// Get thousand separator.
172 172
 	$thousands_sep = give_get_price_thousand_separator();
173 173
 
174 174
 	// Sanitize amount.
175
-	$sanitize_amount = give_sanitize_amount( $amount );
175
+	$sanitize_amount = give_sanitize_amount($amount);
176 176
 
177 177
 	// Explode amount to calculate name of large numbers.
178
-	$amount_array = explode( $thousands_sep, $amount );
178
+	$amount_array = explode($thousands_sep, $amount);
179 179
 
180 180
 	// Calculate amount parts count.
181
-	$amount_count_parts = count( $amount_array );
181
+	$amount_count_parts = count($amount_array);
182 182
 
183 183
 	// Human format amount (default).
184 184
 	$human_format_amount = $amount;
185 185
 
186 186
 	// Calculate large number formatted amount.
187
-	if ( 4 < $amount_count_parts ) {
188
-		$human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
189
-	} elseif ( 3 < $amount_count_parts ) {
190
-		$human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
191
-	} elseif ( 2 < $amount_count_parts ) {
192
-		$human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) );
187
+	if (4 < $amount_count_parts) {
188
+		$human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
189
+	} elseif (3 < $amount_count_parts) {
190
+		$human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
191
+	} elseif (2 < $amount_count_parts) {
192
+		$human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
193 193
 	}
194 194
 
195
-	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
195
+	return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
196 196
 }
197 197
 
198 198
 /**
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @return string $amount Newly formatted amount or Price Not Available
207 207
  */
208
-function give_format_decimal( $amount, $dp = false ) {
208
+function give_format_decimal($amount, $dp = false) {
209 209
 	$decimal_separator = give_get_price_decimal_separator();
210
-	$formatted_amount  = give_sanitize_amount( $amount, $dp );
210
+	$formatted_amount  = give_sanitize_amount($amount, $dp);
211 211
 
212
-	if ( false !== strpos( $formatted_amount, '.' ) ) {
213
-		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
212
+	if (false !== strpos($formatted_amount, '.')) {
213
+		$formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
214 214
 	}
215 215
 
216
-	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
216
+	return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
217 217
 }
218 218
 
219 219
 /**
@@ -226,24 +226,24 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return mixed|string
228 228
  */
229
-function give_currency_filter( $price = '', $currency = '' ) {
229
+function give_currency_filter($price = '', $currency = '') {
230 230
 
231
-	if ( empty( $currency ) ) {
231
+	if (empty($currency)) {
232 232
 		$currency = give_get_currency();
233 233
 	}
234 234
 
235
-	$position = give_get_option( 'currency_position', 'before' );
235
+	$position = give_get_option('currency_position', 'before');
236 236
 
237 237
 	$negative = $price < 0;
238 238
 
239
-	if ( $negative ) {
239
+	if ($negative) {
240 240
 		// Remove proceeding "-".
241
-		$price = substr( $price, 1 );
241
+		$price = substr($price, 1);
242 242
 	}
243 243
 
244
-	$symbol = give_currency_symbol( $currency );
244
+	$symbol = give_currency_symbol($currency);
245 245
 
246
-	switch ( $currency ) :
246
+	switch ($currency) :
247 247
 		case 'GBP' :
248 248
 		case 'BRL' :
249 249
 		case 'EUR' :
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
 		case 'MAD' :
273 273
 		case 'KRW' :
274 274
 		case 'ZAR' :
275
-			$formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
275
+			$formatted = ('before' === $position ? $symbol.$price : $price.$symbol);
276 276
 			break;
277 277
 		case 'NOK' :
278
-			$formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
278
+			$formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol);
279 279
 			break;
280 280
 		default :
281
-			$formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
281
+			$formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency);
282 282
 			break;
283 283
 	endswitch;
284 284
 
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	 *           and if currency is USD and currency position is after then
294 294
 	 *           filter name will be give_usd_currency_filter_after
295 295
 	 */
296
-	$formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
296
+	$formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price);
297 297
 
298
-	if ( $negative ) {
298
+	if ($negative) {
299 299
 		// Prepend the minus sign before the currency sign.
300
-		$formatted = '-' . $formatted;
300
+		$formatted = '-'.$formatted;
301 301
 	}
302 302
 
303 303
 	return $formatted;
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function give_currency_decimal_filter() {
315 315
 
316
-	remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
316
+	remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
317 317
 
318 318
 	// Set default number of decimals.
319 319
 	$decimals = give_get_price_decimals();
320 320
 
321
-	add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
321
+	add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
322 322
 
323 323
 	// Get number of decimals with backward compatibility ( version < 1.6 )
324
-	if ( 1 <= func_num_args() ) {
325
-		$decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
324
+	if (1 <= func_num_args()) {
325
+		$decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0)));
326 326
 	}
327 327
 
328 328
 	$currency = give_get_currency();
329 329
 
330
-	switch ( $currency ) {
330
+	switch ($currency) {
331 331
 		case 'RIAL' :
332 332
 		case 'JPY' :
333 333
 		case 'TWD' :
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 			break;
338 338
 	}
339 339
 
340
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
340
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
341 341
 }
342 342
 
343
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
344
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
343
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
344
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
345 345
 
346 346
 
347 347
 /**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
  *
354 354
  * @return string                  Date format string
355 355
  */
356
-function give_date_format( $date_context = '' ) {
356
+function give_date_format($date_context = '') {
357 357
 	/**
358 358
 	 * Filter the date context
359 359
 	 *
@@ -374,19 +374,19 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 *    }
376 376
 	 */
377
-	$date_format_contexts = apply_filters( 'give_date_format_contexts', array() );
377
+	$date_format_contexts = apply_filters('give_date_format_contexts', array());
378 378
 
379 379
 	// Set date format to default date format.
380
-	$date_format = get_option( 'date_format' );
380
+	$date_format = get_option('date_format');
381 381
 
382 382
 	// Update date format if we have non empty date format context array and non empty date format string for that context.
383
-	if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) {
384
-		$date_format = ! empty( $date_format_contexts[ $date_context ] )
385
-			? $date_format_contexts[ $date_context ]
383
+	if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) {
384
+		$date_format = ! empty($date_format_contexts[$date_context])
385
+			? $date_format_contexts[$date_context]
386 386
 			: $date_format;
387 387
 	}
388 388
 
389
-	return apply_filters( 'give_date_format', $date_format );
389
+	return apply_filters('give_date_format', $date_format);
390 390
 }
391 391
 
392 392
 /**
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string
402 402
  */
403
-function give_get_cache_key( $action, $query_args ) {
404
-	return Give_Cache::get_key( $action, $query_args );
403
+function give_get_cache_key($action, $query_args) {
404
+	return Give_Cache::get_key($action, $query_args);
405 405
 }
406 406
 
407 407
 /**
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
  *
415 415
  * @return string|array
416 416
  */
417
-function give_clean( $var ) {
418
-	if ( is_array( $var ) ) {
419
-		return array_map( 'give_clean', $var );
417
+function give_clean($var) {
418
+	if (is_array($var)) {
419
+		return array_map('give_clean', $var);
420 420
 	} else {
421
-		return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
421
+		return is_scalar($var) ? sanitize_text_field($var) : $var;
422 422
 	}
423 423
 }
424 424
 
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
  *
432 432
  * @return int
433 433
  */
434
-function give_let_to_num( $size ) {
435
-	$l   = substr( $size, - 1 );
436
-	$ret = substr( $size, 0, - 1 );
437
-	switch ( strtoupper( $l ) ) {
434
+function give_let_to_num($size) {
435
+	$l   = substr($size, - 1);
436
+	$ret = substr($size, 0, - 1);
437
+	switch (strtoupper($l)) {
438 438
 		case 'P':
439 439
 			$ret *= 1024;
440 440
 		case 'T':
@@ -459,17 +459,17 @@  discard block
 block discarded – undo
459 459
  * @param int   $action
460 460
  * @param array $wp_die_args
461 461
  */
462
-function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) {
462
+function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) {
463 463
 
464 464
 	$default_wp_die_args = array(
465
-		'message' => esc_html__( 'Nonce verification has failed.', 'give' ),
466
-		'title'   => esc_html__( 'Error', 'give' ),
467
-		'args'    => array( 'response' => 403 ),
465
+		'message' => esc_html__('Nonce verification has failed.', 'give'),
466
+		'title'   => esc_html__('Error', 'give'),
467
+		'args'    => array('response' => 403),
468 468
 	);
469 469
 
470
-	$wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args );
470
+	$wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args);
471 471
 
472
-	if ( ! wp_verify_nonce( $nonce, $action ) ) {
472
+	if ( ! wp_verify_nonce($nonce, $action)) {
473 473
 		wp_die(
474 474
 			$wp_die_args['message'],
475 475
 			$wp_die_args['title'],
@@ -491,23 +491,23 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return mixed
493 493
  */
494
-function give_check_variable( $variable, $conditional = '', $default = false ) {
494
+function give_check_variable($variable, $conditional = '', $default = false) {
495 495
 
496
-	switch ( $conditional ) {
496
+	switch ($conditional) {
497 497
 		case 'isset_empty':
498
-			$variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default;
498
+			$variable = (isset($variable) && ! empty($variable)) ? $variable : $default;
499 499
 			break;
500 500
 
501 501
 		case 'empty':
502
-			$variable = ! empty( $variable ) ? $variable : $default;
502
+			$variable = ! empty($variable) ? $variable : $default;
503 503
 			break;
504 504
 
505 505
 		case 'null':
506
-			$variable = ! is_null( $variable ) ? $variable : $default;
506
+			$variable = ! is_null($variable) ? $variable : $default;
507 507
 			break;
508 508
 
509 509
 		default:
510
-			$variable = isset( $variable ) ? $variable : $default;
510
+			$variable = isset($variable) ? $variable : $default;
511 511
 
512 512
 	}
513 513
 
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +55 added lines, -55 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,15 +26,15 @@  discard block
 block discarded – undo
26 26
  * @global     $wpdb
27 27
  * @return void
28 28
  */
29
-function give_install( $network_wide = false ) {
29
+function give_install($network_wide = false) {
30 30
 
31 31
 	global $wpdb;
32 32
 
33
-	if ( is_multisite() && $network_wide ) {
33
+	if (is_multisite() && $network_wide) {
34 34
 
35
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
35
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
36 36
 
37
-			switch_to_blog( $blog_id );
37
+			switch_to_blog($blog_id);
38 38
 			give_run_install();
39 39
 			restore_current_blog();
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 }
50 50
 
51
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
51
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
52 52
 
53 53
 /**
54 54
  * Run the Give Install process.
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 	give_setup_post_types();
65 65
 
66 66
 	// Clear the permalinks.
67
-	flush_rewrite_rules( false );
67
+	flush_rewrite_rules(false);
68 68
 
69 69
 	// Add Upgraded From Option.
70
-	$current_version = get_option( 'give_version' );
71
-	if ( $current_version ) {
72
-		update_option( 'give_version_upgraded_from', $current_version );
70
+	$current_version = get_option('give_version');
71
+	if ($current_version) {
72
+		update_option('give_version_upgraded_from', $current_version);
73 73
 	}
74 74
 
75 75
 	// Setup some default options.
76 76
 	$options = array();
77 77
 
78 78
 	// Checks if the Success Page option exists AND that the page exists.
79
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
79
+	if ( ! get_post(give_get_option('success_page'))) {
80 80
 
81 81
 		// Donation Confirmation (Success) Page
82 82
 		$success = wp_insert_post(
83 83
 			array(
84
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
84
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
85 85
 				'post_content'   => '[give_receipt]',
86 86
 				'post_status'    => 'publish',
87 87
 				'post_author'    => 1,
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 
97 97
 	// Checks if the Failure Page option exists AND that the page exists.
98
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
98
+	if ( ! get_post(give_get_option('failure_page'))) {
99 99
 
100 100
 		// Failed Donation Page
101 101
 		$failed = wp_insert_post(
102 102
 			array(
103
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
104
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
103
+				'post_title'     => esc_html__('Donation Failed', 'give'),
104
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
105 105
 				'post_status'    => 'publish',
106 106
 				'post_author'    => 1,
107 107
 				'post_type'      => 'page',
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 
115 115
 	// Checks if the History Page option exists AND that the page exists.
116
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
116
+	if ( ! get_post(give_get_option('history_page'))) {
117 117
 		// Donation History Page
118 118
 		$history = wp_insert_post(
119 119
 			array(
120
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
120
+				'post_title'     => esc_html__('Donation History', 'give'),
121 121
 				'post_content'   => '[donation_history]',
122 122
 				'post_status'    => 'publish',
123 123
 				'post_author'    => 1,
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 	}
131 131
 
132 132
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
133
-	if ( empty( $current_version ) ) {
134
-		$options = array_merge( $options, give_get_default_settings() );
133
+	if (empty($current_version)) {
134
+		$options = array_merge($options, give_get_default_settings());
135 135
 	}
136 136
 
137 137
 	// Populate the default values.
138
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
138
+	update_option('give_settings', array_merge($give_options, $options));
139 139
 
140 140
 	/**
141 141
 	 * Run plugin upgrades.
142 142
 	 *
143 143
 	 * @since 1.8
144 144
 	 */
145
-	do_action( 'give_upgrades' );
145
+	do_action('give_upgrades');
146 146
 
147 147
 
148
-	if( GIVE_VERSION !== get_option( 'give_version' ) ) {
149
-		update_option( 'give_version', GIVE_VERSION );
148
+	if (GIVE_VERSION !== get_option('give_version')) {
149
+		update_option('give_version', GIVE_VERSION);
150 150
 	}
151 151
 
152 152
 	// Create Give roles.
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	$roles->add_caps();
156 156
 
157 157
 	$api = new Give_API();
158
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
158
+	update_option('give_default_api_version', 'v'.$api->get_version());
159 159
 
160 160
 	// Create the customers databases.
161 161
 	@Give()->customers->create_table();
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 	Give()->session->use_php_sessions();
166 166
 
167 167
 	// Add a temporary option to note that Give pages have been created.
168
-	Give_Cache::set( '_give_installed', $options, 30, true );
168
+	Give_Cache::set('_give_installed', $options, 30, true);
169 169
 
170
-	if ( ! $current_version ) {
170
+	if ( ! $current_version) {
171 171
 
172
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
172
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
173 173
 
174 174
 		// When new upgrade routines are added, mark them as complete on fresh install.
175 175
 		$upgrade_routines = array(
@@ -180,22 +180,22 @@  discard block
 block discarded – undo
180 180
 			'v18_upgrades_form_metadata'
181 181
 		);
182 182
 
183
-		foreach ( $upgrade_routines as $upgrade ) {
184
-			give_set_upgrade_complete( $upgrade );
183
+		foreach ($upgrade_routines as $upgrade) {
184
+			give_set_upgrade_complete($upgrade);
185 185
 		}
186 186
 	}
187 187
 
188 188
 	// Bail if activating from network, or bulk.
189
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
189
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
190 190
 		return;
191 191
 	}
192 192
 
193 193
 	// Add the transient to redirect.
194
-	Give_Cache::set( '_give_activation_redirect', true, 30, true );
194
+	Give_Cache::set('_give_activation_redirect', true, 30, true);
195 195
 
196 196
 }
197 197
 
198
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
198
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
199 199
 
200 200
 /**
201 201
  * Network Activated New Site Setup.
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
  * @param  int    $site_id The Site ID.
212 212
  * @param  array  $meta    Blog Meta.
213 213
  */
214
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
214
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
215 215
 
216
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
216
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
217 217
 
218
-		switch_to_blog( $blog_id );
218
+		switch_to_blog($blog_id);
219 219
 		give_install();
220 220
 		restore_current_blog();
221 221
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 }
225 225
 
226
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
226
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
227 227
 
228 228
 
229 229
 /**
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
  *
237 237
  * @return array          The tables to drop.
238 238
  */
239
-function give_wpmu_drop_tables( $tables, $blog_id ) {
239
+function give_wpmu_drop_tables($tables, $blog_id) {
240 240
 
241
-	switch_to_blog( $blog_id );
241
+	switch_to_blog($blog_id);
242 242
 	$customers_db     = new Give_DB_Customers();
243 243
 	$customer_meta_db = new Give_DB_Customer_Meta();
244 244
 
245
-	if ( $customers_db->installed() ) {
245
+	if ($customers_db->installed()) {
246 246
 		$tables[] = $customers_db->table_name;
247 247
 		$tables[] = $customer_meta_db->table_name;
248 248
 	}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 }
254 254
 
255
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
255
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
256 256
 
257 257
 /**
258 258
  * Post-installation
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function give_after_install() {
266 266
 
267
-	if ( ! is_admin() ) {
267
+	if ( ! is_admin()) {
268 268
 		return;
269 269
 	}
270 270
 
271
-	$give_options     = Give_Cache::get( '_give_installed', true );
272
-	$give_table_check = get_option( '_give_table_check', false );
271
+	$give_options     = Give_Cache::get('_give_installed', true);
272
+	$give_table_check = get_option('_give_table_check', false);
273 273
 
274
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
274
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
275 275
 
276
-		if ( ! @Give()->customer_meta->installed() ) {
276
+		if ( ! @Give()->customer_meta->installed()) {
277 277
 
278 278
 			// Create the customer meta database
279 279
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 		}
283 283
 
284
-		if ( ! @Give()->customers->installed() ) {
284
+		if ( ! @Give()->customers->installed()) {
285 285
 			// Create the customers database
286 286
 			// (this ensures it creates it on multisite instances where it is network activated).
287 287
 			@Give()->customers->create_table();
@@ -293,22 +293,22 @@  discard block
 block discarded – undo
293 293
 			 *
294 294
 			 * @param array $give_options Give plugin options.
295 295
 			 */
296
-			do_action( 'give_after_install', $give_options );
296
+			do_action('give_after_install', $give_options);
297 297
 		}
298 298
 
299
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
299
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
300 300
 
301 301
 	}
302 302
 
303 303
 	// Delete the transient
304
-	if ( false !== $give_options ) {
305
-		Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) );
304
+	if (false !== $give_options) {
305
+		Give_Cache::delete(Give_Cache::get_key('_give_installed'));
306 306
 	}
307 307
 
308 308
 
309 309
 }
310 310
 
311
-add_action( 'admin_init', 'give_after_install' );
311
+add_action('admin_init', 'give_after_install');
312 312
 
313 313
 
314 314
 /**
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
 
324 324
 	global $wp_roles;
325 325
 
326
-	if ( ! is_object( $wp_roles ) ) {
326
+	if ( ! is_object($wp_roles)) {
327 327
 		return;
328 328
 	}
329 329
 
330
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
330
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
331 331
 
332 332
 		// Create Give plugin roles
333 333
 		$roles = new Give_Roles();
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
 }
340 340
 
341
-add_action( 'admin_init', 'give_install_roles_on_network' );
341
+add_action('admin_init', 'give_install_roles_on_network');
342 342
 
343 343
 /**
344 344
  * Default core setting values.
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		'paypal_verification'                         => 'enabled',
379 379
 
380 380
 		// Default is manual gateway.
381
-		'gateways'                                    => array( 'manual' => 1, 'offline' => 1 ),
381
+		'gateways'                                    => array('manual' => 1, 'offline' => 1),
382 382
 		'default_gateway'                             => 'manual',
383 383
 
384 384
 		// Offline gateway setup.
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param $url
74 74
 	 *
75
-	 * @return mixed
75
+	 * @return string
76 76
 	 */
77 77
 	public function give_update_cmb_meta_box_url( $url ) {
78 78
 		// Path to Give's CMB
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
  * @since      1.3.5
936 936
  *
937 937
  * @param $array
938
- * @param $position |int|string Expects an array key or 'id' of the settings field to appear after
938
+ * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after
939 939
  * @param $insert   |array a valid array of options to insert
940 940
  *
941 941
  * @return array
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  * @since 1.0
975 975
  *
976 976
  * @param array $field_arr
977
- * @param array $saved_values
977
+ * @param string|boolean $saved_values
978 978
  *
979 979
  * @return void
980 980
  */
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  * @since  1.0
1010 1010
  *
1011 1011
  * @param  array $field_arr
1012
- * @param  array $saved_value
1012
+ * @param  string|boolean $saved_value
1013 1013
  *
1014 1014
  * @return void
1015 1015
  */
Please login to merge, or discard this patch.
Spacing   +362 added lines, -362 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 
45 45
 		// Custom CMB2 Settings Fields
46
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
47
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
48
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
49
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
50
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
51
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
52
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
53
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
46
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
47
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
48
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
49
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
50
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
51
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
52
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
53
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
54 54
 	}
55 55
 
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @since  1.0
61 61
 	 */
62 62
 	public function init() {
63
-		register_setting( $this->key, $this->key );
63
+		register_setting($this->key, $this->key);
64 64
 
65 65
 	}
66 66
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed
76 76
 	 */
77
-	public function give_update_cmb_meta_box_url( $url ) {
77
+	public function give_update_cmb_meta_box_url($url) {
78 78
 		// Path to Give's CMB
79
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
79
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
80 80
 	}
81 81
 
82 82
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function give_get_settings_tabs() {
90 90
 
91
-		$settings = $this->give_settings( null );
91
+		$settings = $this->give_settings(null);
92 92
 
93 93
 		$tabs             = array();
94
-		$tabs['general']  = __( 'General', 'give' );
95
-		$tabs['gateways'] = __( 'Payment Gateways', 'give' );
96
-		$tabs['display']  = __( 'Display Options', 'give' );
97
-		$tabs['emails']   = __( 'Emails', 'give' );
94
+		$tabs['general']  = __('General', 'give');
95
+		$tabs['gateways'] = __('Payment Gateways', 'give');
96
+		$tabs['display']  = __('Display Options', 'give');
97
+		$tabs['emails']   = __('Emails', 'give');
98 98
 
99
-		if ( ! empty( $settings['addons']['fields'] ) ) {
100
-			$tabs['addons'] = __( 'Add-ons', 'give' );
99
+		if ( ! empty($settings['addons']['fields'])) {
100
+			$tabs['addons'] = __('Add-ons', 'give');
101 101
 		}
102 102
 
103
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
104
-			$tabs['licenses'] = __( 'Licenses', 'give' );
103
+		if ( ! empty($settings['licenses']['fields'])) {
104
+			$tabs['licenses'] = __('Licenses', 'give');
105 105
 		}
106 106
 
107
-		$tabs['advanced']    = __( 'Advanced', 'give' );
108
-		$tabs['api']         = __( 'API', 'give' );
109
-		$tabs['system_info'] = __( 'System Info', 'give' );
107
+		$tabs['advanced']    = __('Advanced', 'give');
108
+		$tabs['api']         = __('API', 'give');
109
+		$tabs['system_info'] = __('System Info', 'give');
110 110
 
111
-		return apply_filters( 'give_settings_tabs', $tabs );
111
+		return apply_filters('give_settings_tabs', $tabs);
112 112
 	}
113 113
 
114 114
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function admin_page_display() {
121 121
 
122
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
122
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
123 123
 
124 124
 		?>
125 125
 
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 
130 130
 			<h2 class="nav-tab-wrapper">
131 131
 				<?php
132
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
132
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
133 133
 
134
-					$tab_url = esc_url( add_query_arg( array(
134
+					$tab_url = esc_url(add_query_arg(array(
135 135
 						'settings-updated' => false,
136 136
 						'tab'              => $tab_id,
137
-					) ) );
137
+					)));
138 138
 
139 139
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
140 140
 
141
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
141
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
142 142
 
143 143
 				}
144 144
 				?>
145 145
 			</h2>
146 146
 
147
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
147
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
148 148
 
149 149
 		</div><!-- .wrap -->
150 150
 
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return string
168 168
 	 */
169
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
169
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
170 170
 
171 171
 		// only modify the give settings form
172
-		if ( 'give_settings' == $object_id ) {
172
+		if ('give_settings' == $object_id) {
173 173
 
174
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
174
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>';
175 175
 
176 176
 		}
177 177
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return array
190 190
 	 */
191
-	public function give_settings( $active_tab ) {
191
+	public function give_settings($active_tab) {
192 192
 
193 193
 		$give_settings = array(
194 194
 			/**
@@ -196,99 +196,99 @@  discard block
 block discarded – undo
196 196
 			 */
197 197
 			'general'     => array(
198 198
 				'id'         => 'general_settings',
199
-				'give_title' => __( 'General Settings', 'give' ),
200
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
201
-				'fields'     => apply_filters( 'give_settings_general', array(
199
+				'give_title' => __('General Settings', 'give'),
200
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
201
+				'fields'     => apply_filters('give_settings_general', array(
202 202
 						array(
203
-							'name' => __( 'General Settings', 'give' ),
203
+							'name' => __('General Settings', 'give'),
204 204
 							'desc' => '',
205 205
 							'type' => 'give_title',
206 206
 							'id'   => 'give_title_general_settings_1',
207 207
 						),
208 208
 						array(
209
-							'name'    => __( 'Success Page', 'give' ),
209
+							'name'    => __('Success Page', 'give'),
210 210
 							/* translators: %s: [give_receipt] */
211
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
211
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
212 212
 							'id'      => 'success_page',
213 213
 							'type'    => 'select',
214
-							'options' => give_cmb2_get_post_options( array(
214
+							'options' => give_cmb2_get_post_options(array(
215 215
 								'post_type'   => 'page',
216
-								'numberposts' => - 1,
217
-							) ),
216
+								'numberposts' => -1,
217
+							)),
218 218
 						),
219 219
 						array(
220
-							'name'    => __( 'Failed Donation Page', 'give' ),
221
-							'desc'    => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
220
+							'name'    => __('Failed Donation Page', 'give'),
221
+							'desc'    => __('The page donors are sent to if their donation is cancelled or fails.', 'give'),
222 222
 							'id'      => 'failure_page',
223 223
 							'type'    => 'select',
224
-							'options' => give_cmb2_get_post_options( array(
224
+							'options' => give_cmb2_get_post_options(array(
225 225
 								'post_type'   => 'page',
226
-								'numberposts' => - 1,
227
-							) ),
226
+								'numberposts' => -1,
227
+							)),
228 228
 						),
229 229
 						array(
230
-							'name'    => __( 'Donation History Page', 'give' ),
230
+							'name'    => __('Donation History Page', 'give'),
231 231
 							/* translators: %s: [donation_history] */
232
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
232
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
233 233
 							'id'      => 'history_page',
234 234
 							'type'    => 'select',
235
-							'options' => give_cmb2_get_post_options( array(
235
+							'options' => give_cmb2_get_post_options(array(
236 236
 								'post_type'   => 'page',
237
-								'numberposts' => - 1,
238
-							) ),
237
+								'numberposts' => -1,
238
+							)),
239 239
 						),
240 240
 						array(
241
-							'name'    => __( 'Base Country', 'give' ),
242
-							'desc'    => __( 'The country your site operates from.', 'give' ),
241
+							'name'    => __('Base Country', 'give'),
242
+							'desc'    => __('The country your site operates from.', 'give'),
243 243
 							'id'      => 'base_country',
244 244
 							'type'    => 'select',
245 245
 							'options' => give_get_country_list(),
246 246
 						),
247 247
 						array(
248
-							'name' => __( 'Currency Settings', 'give' ),
248
+							'name' => __('Currency Settings', 'give'),
249 249
 							'desc' => '',
250 250
 							'type' => 'give_title',
251 251
 							'id'   => 'give_title_general_settings_2',
252 252
 						),
253 253
 						array(
254
-							'name'    => __( 'Currency', 'give' ),
255
-							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
254
+							'name'    => __('Currency', 'give'),
255
+							'desc'    => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
256 256
 							'id'      => 'currency',
257 257
 							'type'    => 'select',
258 258
 							'options' => give_get_currencies(),
259 259
 							'default' => 'USD',
260 260
 						),
261 261
 						array(
262
-							'name'    => __( 'Currency Position', 'give' ),
263
-							'desc'    => __( 'The position of the currency symbol.', 'give' ),
262
+							'name'    => __('Currency Position', 'give'),
263
+							'desc'    => __('The position of the currency symbol.', 'give'),
264 264
 							'id'      => 'currency_position',
265 265
 							'type'    => 'select',
266 266
 							'options' => array(
267 267
 								/* translators: %s: currency symbol */
268
-								'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
268
+								'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
269 269
 								/* translators: %s: currency symbol */
270
-								'after'  => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ),
270
+								'after'  => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())),
271 271
 							),
272 272
 							'default' => 'before',
273 273
 						),
274 274
 						array(
275
-							'name'            => __( 'Thousands Separator', 'give' ),
276
-							'desc'            => __( 'The symbol (usually , or .) to separate thousands.', 'give' ),
275
+							'name'            => __('Thousands Separator', 'give'),
276
+							'desc'            => __('The symbol (usually , or .) to separate thousands.', 'give'),
277 277
 							'id'              => 'thousands_separator',
278 278
 							'type'            => 'text_small',
279 279
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
280 280
 							'default'         => ',',
281 281
 						),
282 282
 						array(
283
-							'name'    => __( 'Decimal Separator', 'give' ),
284
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
283
+							'name'    => __('Decimal Separator', 'give'),
284
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
285 285
 							'id'      => 'decimal_separator',
286 286
 							'type'    => 'text_small',
287 287
 							'default' => '.',
288 288
 						),
289 289
 						array(
290
-							'name'            => __( 'Number of Decimals', 'give' ),
291
-							'desc'            => __( 'The number of decimal points displayed in amounts.', 'give' ),
290
+							'name'            => __('Number of Decimals', 'give'),
291
+							'desc'            => __('The number of decimal points displayed in amounts.', 'give'),
292 292
 							'id'              => 'number_decimals',
293 293
 							'type'            => 'text_small',
294 294
 							'default'         => 2,
@@ -302,83 +302,83 @@  discard block
 block discarded – undo
302 302
 			 */
303 303
 			'gateways'    => array(
304 304
 				'id'         => 'payment_gateways',
305
-				'give_title' => __( 'Payment Gateways', 'give' ),
306
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
307
-				'fields'     => apply_filters( 'give_settings_gateways', array(
305
+				'give_title' => __('Payment Gateways', 'give'),
306
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
307
+				'fields'     => apply_filters('give_settings_gateways', array(
308 308
 						array(
309
-							'name' => __( 'Gateways Settings', 'give' ),
309
+							'name' => __('Gateways Settings', 'give'),
310 310
 							'desc' => '',
311 311
 							'id'   => 'give_title_gateway_settings_1',
312 312
 							'type' => 'give_title',
313 313
 						),
314 314
 						array(
315
-							'name' => __( 'Test Mode', 'give' ),
316
-							'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
315
+							'name' => __('Test Mode', 'give'),
316
+							'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
317 317
 							'id'   => 'test_mode',
318 318
 							'type' => 'checkbox',
319 319
 						),
320 320
 						array(
321
-							'name' => __( 'Enabled Gateways', 'give' ),
322
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
321
+							'name' => __('Enabled Gateways', 'give'),
322
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
323 323
 							'id'   => 'gateways',
324 324
 							'type' => 'enabled_gateways',
325 325
 						),
326 326
 						array(
327
-							'name' => __( 'Default Gateway', 'give' ),
328
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
327
+							'name' => __('Default Gateway', 'give'),
328
+							'desc' => __('The gateway that will be selected by default.', 'give'),
329 329
 							'id'   => 'default_gateway',
330 330
 							'type' => 'default_gateway',
331 331
 						),
332 332
 						array(
333
-							'name' => __( 'PayPal Standard', 'give' ),
333
+							'name' => __('PayPal Standard', 'give'),
334 334
 							'desc' => '',
335 335
 							'type' => 'give_title',
336 336
 							'id'   => 'give_title_gateway_settings_2',
337 337
 						),
338 338
 						array(
339
-							'name' => __( 'PayPal Email', 'give' ),
340
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
339
+							'name' => __('PayPal Email', 'give'),
340
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
341 341
 							'id'   => 'paypal_email',
342 342
 							'type' => 'text_email',
343 343
 						),
344 344
 						array(
345
-							'name' => __( 'PayPal Page Style', 'give' ),
346
-							'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
345
+							'name' => __('PayPal Page Style', 'give'),
346
+							'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
347 347
 							'id'   => 'paypal_page_style',
348 348
 							'type' => 'text',
349 349
 						),
350 350
 						array(
351
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
352
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
351
+							'name'    => __('PayPal Transaction Type', 'give'),
352
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
353 353
 							'id'      => 'paypal_button_type',
354 354
 							'type'    => 'radio_inline',
355 355
 							'options' => array(
356
-								'donation' => __( 'Donation', 'give' ),
357
-								'standard' => __( 'Standard Transaction', 'give' ),
356
+								'donation' => __('Donation', 'give'),
357
+								'standard' => __('Standard Transaction', 'give'),
358 358
 							),
359 359
 							'default' => 'donation',
360 360
 						),
361 361
 						array(
362
-							'name' => __( 'Disable PayPal IPN Verification', 'give' ),
363
-							'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
362
+							'name' => __('Disable PayPal IPN Verification', 'give'),
363
+							'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
364 364
 							'id'   => 'disable_paypal_verification',
365 365
 							'type' => 'checkbox',
366 366
 						),
367 367
 						array(
368
-							'name' => __( 'Offline Donations', 'give' ),
368
+							'name' => __('Offline Donations', 'give'),
369 369
 							'desc' => '',
370 370
 							'type' => 'give_title',
371 371
 							'id'   => 'give_title_gateway_settings_3',
372 372
 						),
373 373
 						array(
374
-							'name' => __( 'Collect Billing Details', 'give' ),
375
-							'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
374
+							'name' => __('Collect Billing Details', 'give'),
375
+							'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
376 376
 							'id'   => 'give_offline_donation_enable_billing_fields',
377 377
 							'type' => 'checkbox',
378 378
 						),
379 379
 						array(
380
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
381
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
380
+							'name'    => __('Offline Donation Instructions', 'give'),
381
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
382 382
 							'id'      => 'global_offline_donation_content',
383 383
 							'default' => give_get_default_offline_donation_content(),
384 384
 							'type'    => 'wysiwyg',
@@ -387,15 +387,15 @@  discard block
 block discarded – undo
387 387
 							),
388 388
 						),
389 389
 						array(
390
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
391
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
390
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
391
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
392 392
 							'id'      => 'offline_donation_subject',
393
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
393
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
394 394
 							'type'    => 'text',
395 395
 						),
396 396
 						array(
397
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
398
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
397
+							'name'    => __('Offline Donation Email Instructions', 'give'),
398
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
399 399
 							'id'      => 'global_offline_donation_email',
400 400
 							'default' => give_get_default_offline_donation_email_content(),
401 401
 							'type'    => 'wysiwyg',
@@ -409,104 +409,104 @@  discard block
 block discarded – undo
409 409
 			/** Display Settings */
410 410
 			'display'     => array(
411 411
 				'id'         => 'display_settings',
412
-				'give_title' => __( 'Display Settings', 'give' ),
413
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
414
-				'fields'     => apply_filters( 'give_settings_display', array(
412
+				'give_title' => __('Display Settings', 'give'),
413
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
414
+				'fields'     => apply_filters('give_settings_display', array(
415 415
 						array(
416
-							'name' => __( 'Display Settings', 'give' ),
416
+							'name' => __('Display Settings', 'give'),
417 417
 							'desc' => '',
418 418
 							'id'   => 'give_title_display_settings_1',
419 419
 							'type' => 'give_title',
420 420
 						),
421 421
 						array(
422
-							'name' => __( 'Disable CSS', 'give' ),
423
-							'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
422
+							'name' => __('Disable CSS', 'give'),
423
+							'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
424 424
 							'id'   => 'disable_css',
425 425
 							'type' => 'checkbox',
426 426
 						),
427 427
 						array(
428
-							'name' => __( 'Enable Floating Labels', 'give' ),
428
+							'name' => __('Enable Floating Labels', 'give'),
429 429
 							/* translators: %s: http://docs.givewp.com/form-floating-labels */
430
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array(
430
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array(
431 431
 								'a' => array(
432 432
 									'href'   => array(),
433 433
 									'target' => array(),
434 434
 								),
435
-							) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
435
+							)), esc_url('http://docs.givewp.com/form-floating-labels')),
436 436
 							'id'   => 'floatlabels',
437 437
 							'type' => 'checkbox',
438 438
 						),
439 439
 						array(
440
-							'name' => __( 'Disable Welcome Screen', 'give' ),
440
+							'name' => __('Disable Welcome Screen', 'give'),
441 441
 							/* translators: %s: about page URL */
442
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array(
442
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array(
443 443
 								'a' => array(
444 444
 									'href'   => array(),
445 445
 									'target' => array(),
446 446
 								),
447
-							) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
447
+							)), esc_url(admin_url('index.php?page=give-about'))),
448 448
 							'id'   => 'disable_welcome',
449 449
 							'type' => 'checkbox',
450 450
 						),
451 451
 						array(
452
-							'name' => __( 'Post Types', 'give' ),
452
+							'name' => __('Post Types', 'give'),
453 453
 							'desc' => '',
454 454
 							'id'   => 'give_title_display_settings_2',
455 455
 							'type' => 'give_title',
456 456
 						),
457 457
 						array(
458
-							'name' => __( 'Disable Form Single Views', 'give' ),
459
-							'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
458
+							'name' => __('Disable Form Single Views', 'give'),
459
+							'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
460 460
 							'id'   => 'disable_forms_singular',
461 461
 							'type' => 'checkbox',
462 462
 						),
463 463
 						array(
464
-							'name' => __( 'Disable Form Archives', 'give' ),
465
-							'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
464
+							'name' => __('Disable Form Archives', 'give'),
465
+							'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
466 466
 							'id'   => 'disable_forms_archives',
467 467
 							'type' => 'checkbox',
468 468
 						),
469 469
 						array(
470
-							'name' => __( 'Disable Form Excerpts', 'give' ),
471
-							'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
470
+							'name' => __('Disable Form Excerpts', 'give'),
471
+							'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
472 472
 							'id'   => 'disable_forms_excerpt',
473 473
 							'type' => 'checkbox',
474 474
 						),
475 475
 						array(
476
-							'name'    => __( 'Featured Image Size', 'give' ),
477
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
476
+							'name'    => __('Featured Image Size', 'give'),
477
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
478 478
 							'id'      => 'featured_image_size',
479 479
 							'type'    => 'select',
480 480
 							'default' => 'large',
481 481
 							'options' => give_get_featured_image_sizes(),
482 482
 						),
483 483
 						array(
484
-							'name' => __( 'Disable Form Featured Image', 'give' ),
485
-							'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
484
+							'name' => __('Disable Form Featured Image', 'give'),
485
+							'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
486 486
 							'id'   => 'disable_form_featured_img',
487 487
 							'type' => 'checkbox',
488 488
 						),
489 489
 						array(
490
-							'name' => __( 'Disable Single Form Sidebar', 'give' ),
491
-							'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
490
+							'name' => __('Disable Single Form Sidebar', 'give'),
491
+							'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
492 492
 							'id'   => 'disable_form_sidebar',
493 493
 							'type' => 'checkbox',
494 494
 						),
495 495
 						array(
496
-							'name' => __( 'Taxonomies', 'give' ),
496
+							'name' => __('Taxonomies', 'give'),
497 497
 							'desc' => '',
498 498
 							'id'   => 'give_title_display_settings_3',
499 499
 							'type' => 'give_title',
500 500
 						),
501 501
 						array(
502
-							'name' => __( 'Enable Form Categories', 'give' ),
503
-							'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
502
+							'name' => __('Enable Form Categories', 'give'),
503
+							'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'),
504 504
 							'id'   => 'categories',
505 505
 							'type' => 'checkbox',
506 506
 						),
507 507
 						array(
508
-							'name' => __( 'Enable Form Tags', 'give' ),
509
-							'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
508
+							'name' => __('Enable Form Tags', 'give'),
509
+							'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'),
510 510
 							'id'   => 'tags',
511 511
 							'type' => 'checkbox',
512 512
 						),
@@ -519,101 +519,101 @@  discard block
 block discarded – undo
519 519
 			 */
520 520
 			'emails'      => array(
521 521
 				'id'         => 'email_settings',
522
-				'give_title' => __( 'Email Settings', 'give' ),
523
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
524
-				'fields'     => apply_filters( 'give_settings_emails', array(
522
+				'give_title' => __('Email Settings', 'give'),
523
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
524
+				'fields'     => apply_filters('give_settings_emails', array(
525 525
 						array(
526
-							'name' => __( 'Email Settings', 'give' ),
526
+							'name' => __('Email Settings', 'give'),
527 527
 							'desc' => '',
528 528
 							'id'   => 'give_title_email_settings_1',
529 529
 							'type' => 'give_title',
530 530
 						),
531 531
 						array(
532 532
 							'id'      => 'email_template',
533
-							'name'    => __( 'Email Template', 'give' ),
534
-							'desc'    => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
533
+							'name'    => __('Email Template', 'give'),
534
+							'desc'    => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
535 535
 							'type'    => 'select',
536 536
 							'options' => give_get_email_templates(),
537 537
 						),
538 538
 						array(
539 539
 							'id'   => 'email_logo',
540
-							'name' => __( 'Logo', 'give' ),
541
-							'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
540
+							'name' => __('Logo', 'give'),
541
+							'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
542 542
 							'type' => 'file',
543 543
 						),
544 544
 						array(
545 545
 							'id'      => 'from_name',
546
-							'name'    => __( 'From Name', 'give' ),
547
-							'desc'    => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ),
548
-							'default' => get_bloginfo( 'name' ),
546
+							'name'    => __('From Name', 'give'),
547
+							'desc'    => __('The name that appears in the "From" field in donation receipt emails.', 'give'),
548
+							'default' => get_bloginfo('name'),
549 549
 							'type'    => 'text',
550 550
 						),
551 551
 						array(
552 552
 							'id'      => 'from_email',
553
-							'name'    => __( 'From Email', 'give' ),
554
-							'desc'    => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
555
-							'default' => get_bloginfo( 'admin_email' ),
553
+							'name'    => __('From Email', 'give'),
554
+							'desc'    => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
555
+							'default' => get_bloginfo('admin_email'),
556 556
 							'type'    => 'text',
557 557
 						),
558 558
 						array(
559
-							'name' => __( 'Donation Receipt', 'give' ),
559
+							'name' => __('Donation Receipt', 'give'),
560 560
 							'desc' => '',
561 561
 							'id'   => 'give_title_email_settings_2',
562 562
 							'type' => 'give_title',
563 563
 						),
564 564
 						array(
565 565
 							'id'      => 'donation_subject',
566
-							'name'    => __( 'Donation Email Subject', 'give' ),
567
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
568
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
566
+							'name'    => __('Donation Email Subject', 'give'),
567
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
568
+							'default' => esc_attr__('Donation Receipt', 'give'),
569 569
 							'type'    => 'text',
570 570
 						),
571 571
 						array(
572 572
 							'id'      => 'donation_receipt',
573
-							'name'    => __( 'Donation Receipt', 'give' ),
573
+							'name'    => __('Donation Receipt', 'give'),
574 574
 							'desc'    => sprintf(
575 575
 								/* translators: %s: emails tags list */
576
-								__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
577
-								'<br/>' . give_get_emails_tags_list()
576
+								__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
577
+								'<br/>'.give_get_emails_tags_list()
578 578
 							),
579 579
 							'type'    => 'wysiwyg',
580 580
 							'default' => give_get_default_donation_receipt_email(),
581 581
 						),
582 582
 						array(
583
-							'name' => __( 'New Donation Notification', 'give' ),
583
+							'name' => __('New Donation Notification', 'give'),
584 584
 							'desc' => '',
585 585
 							'id'   => 'give_title_email_settings_3',
586 586
 							'type' => 'give_title',
587 587
 						),
588 588
 						array(
589 589
 							'id'      => 'donation_notification_subject',
590
-							'name'    => __( 'Donation Notification Subject', 'give' ),
591
-							'desc'    => __( 'Enter the subject line for the donation notification email.', 'give' ),
590
+							'name'    => __('Donation Notification Subject', 'give'),
591
+							'desc'    => __('Enter the subject line for the donation notification email.', 'give'),
592 592
 							'type'    => 'text',
593
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
593
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give'),
594 594
 						),
595 595
 						array(
596 596
 							'id'      => 'donation_notification',
597
-							'name'    => __( 'Donation Notification', 'give' ),
597
+							'name'    => __('Donation Notification', 'give'),
598 598
 							'desc'    => sprintf(
599 599
 								/* translators: %s: emails tags list */
600
-								__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
601
-								'<br/>' . give_get_emails_tags_list()
600
+								__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
601
+								'<br/>'.give_get_emails_tags_list()
602 602
 							),
603 603
 							'type'    => 'wysiwyg',
604 604
 							'default' => give_get_default_donation_notification_email(),
605 605
 						),
606 606
 						array(
607 607
 							'id'      => 'admin_notice_emails',
608
-							'name'    => __( 'Donation Notification Emails', 'give' ),
609
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
608
+							'name'    => __('Donation Notification Emails', 'give'),
609
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
610 610
 							'type'    => 'textarea',
611
-							'default' => get_bloginfo( 'admin_email' ),
611
+							'default' => get_bloginfo('admin_email'),
612 612
 						),
613 613
 						array(
614 614
 							'id'   => 'disable_admin_notices',
615
-							'name' => __( 'Disable Admin Notifications', 'give' ),
616
-							'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
615
+							'name' => __('Disable Admin Notifications', 'give'),
616
+							'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'),
617 617
 							'type' => 'checkbox',
618 618
 						),
619 619
 					)
@@ -622,99 +622,99 @@  discard block
 block discarded – undo
622 622
 			/** Extension Settings */
623 623
 			'addons'      => array(
624 624
 				'id'         => 'addons',
625
-				'give_title' => __( 'Give Add-ons Settings', 'give' ),
626
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
627
-				'fields'     => apply_filters( 'give_settings_addons', array()
625
+				'give_title' => __('Give Add-ons Settings', 'give'),
626
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
627
+				'fields'     => apply_filters('give_settings_addons', array()
628 628
 				),
629 629
 			),
630 630
 			/** Licenses Settings */
631 631
 			'licenses'    => array(
632 632
 				'id'         => 'licenses',
633
-				'give_title' => __( 'Give Licenses', 'give' ),
634
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
635
-				'fields'     => apply_filters( 'give_settings_licenses', array()
633
+				'give_title' => __('Give Licenses', 'give'),
634
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
635
+				'fields'     => apply_filters('give_settings_licenses', array()
636 636
 				),
637 637
 			),
638 638
 			/** Advanced Options */
639 639
 			'advanced'    => array(
640 640
 				'id'         => 'advanced_options',
641
-				'give_title' => __( 'Advanced Options', 'give' ),
642
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
643
-				'fields'     => apply_filters( 'give_settings_advanced', array(
641
+				'give_title' => __('Advanced Options', 'give'),
642
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
643
+				'fields'     => apply_filters('give_settings_advanced', array(
644 644
 						array(
645
-							'name' => __( 'Access Control', 'give' ),
645
+							'name' => __('Access Control', 'give'),
646 646
 							'desc' => '',
647 647
 							'id'   => 'give_title_session_control_1',
648 648
 							'type' => 'give_title',
649 649
 						),
650 650
 						array(
651 651
 							'id'      => 'session_lifetime',
652
-							'name'    => __( 'Session Lifetime', 'give' ),
653
-							'desc'    => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
652
+							'name'    => __('Session Lifetime', 'give'),
653
+							'desc'    => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
654 654
 							'type'    => 'select',
655 655
 							'options' => array(
656
-								'86400'  => __( '24 Hours', 'give' ),
657
-								'172800' => __( '48 Hours', 'give' ),
658
-								'259200' => __( '72 Hours', 'give' ),
659
-								'604800' => __( '1 Week', 'give' ),
656
+								'86400'  => __('24 Hours', 'give'),
657
+								'172800' => __('48 Hours', 'give'),
658
+								'259200' => __('72 Hours', 'give'),
659
+								'604800' => __('1 Week', 'give'),
660 660
 							),
661 661
 						),
662 662
 						array(
663
-							'name' => __( 'Email Access', 'give' ),
664
-							'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
663
+							'name' => __('Email Access', 'give'),
664
+							'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
665 665
 							'id'   => 'email_access',
666 666
 							'type' => 'checkbox',
667 667
 						),
668 668
 						array(
669 669
 							'id'      => 'recaptcha_key',
670
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
670
+							'name'    => __('reCAPTCHA Site Key', 'give'),
671 671
 							/* translators: %s: https://www.google.com/recaptcha/ */
672
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
672
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
673 673
 							'default' => '',
674 674
 							'type'    => 'text',
675 675
 						),
676 676
 						array(
677 677
 							'id'      => 'recaptcha_secret',
678
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
679
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
678
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
679
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
680 680
 							'default' => '',
681 681
 							'type'    => 'text',
682 682
 						),
683 683
 						array(
684
-							'name' => __( 'Data Control', 'give' ),
684
+							'name' => __('Data Control', 'give'),
685 685
 							'desc' => '',
686 686
 							'id'   => 'give_title_data_control_2',
687 687
 							'type' => 'give_title',
688 688
 						),
689 689
 						array(
690
-							'name' => __( 'Remove All Data on Uninstall?', 'give' ),
691
-							'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
690
+							'name' => __('Remove All Data on Uninstall?', 'give'),
691
+							'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'),
692 692
 							'id'   => 'uninstall_on_delete',
693 693
 							'type' => 'checkbox',
694 694
 						),
695 695
 						array(
696
-							'name' => __( 'Filter Control', 'give' ),
696
+							'name' => __('Filter Control', 'give'),
697 697
 							'desc' => '',
698 698
 							'id'   => 'give_title_filter_control',
699 699
 							'type' => 'give_title',
700 700
 						),
701 701
 						array(
702 702
 							/* translators: %s: the_content */
703
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
703
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
704 704
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
705
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
705
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
706 706
 							'id'   => 'disable_the_content_filter',
707 707
 							'type' => 'checkbox',
708 708
 						),
709 709
 						array(
710
-							'name' => __( 'Script Loading', 'give' ),
710
+							'name' => __('Script Loading', 'give'),
711 711
 							'desc' => '',
712 712
 							'id'   => 'give_title_script_control',
713 713
 							'type' => 'give_title',
714 714
 						),
715 715
 						array(
716
-							'name' => __( 'Load Scripts in Footer?', 'give' ),
717
-							'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
716
+							'name' => __('Load Scripts in Footer?', 'give'),
717
+							'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
718 718
 							'id'   => 'scripts_footer',
719 719
 							'type' => 'checkbox',
720 720
 						),
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
 			/** API Settings */
725 725
 			'api'         => array(
726 726
 				'id'         => 'api',
727
-				'give_title' => __( 'API', 'give' ),
728
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
727
+				'give_title' => __('API', 'give'),
728
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
729 729
 				'show_names' => false, // Hide field names on the left
730
-				'fields'     => apply_filters( 'give_settings_system', array(
730
+				'fields'     => apply_filters('give_settings_system', array(
731 731
 						array(
732 732
 							'id'   => 'api',
733
-							'name' => __( 'API', 'give' ),
733
+							'name' => __('API', 'give'),
734 734
 							'type' => 'api',
735 735
 						),
736 736
 					)
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
 			/** Licenses Settings */
740 740
 			'system_info' => array(
741 741
 				'id'         => 'system_info',
742
-				'give_title' => __( 'System Info', 'give' ),
743
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
744
-				'fields'     => apply_filters( 'give_settings_system', array(
742
+				'give_title' => __('System Info', 'give'),
743
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
744
+				'fields'     => apply_filters('give_settings_system', array(
745 745
 						array(
746 746
 							'id'   => 'system-info-textarea',
747
-							'name' => __( 'System Info', 'give' ),
748
-							'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
747
+							'name' => __('System Info', 'give'),
748
+							'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'),
749 749
 							'type' => 'system_info',
750 750
 						),
751 751
 					)
@@ -753,15 +753,15 @@  discard block
 block discarded – undo
753 753
 			),
754 754
 		);
755 755
 
756
-		$give_settings = apply_filters( 'give_registered_settings', $give_settings );
756
+		$give_settings = apply_filters('give_registered_settings', $give_settings);
757 757
 
758 758
 		// Return all settings array if no active tab
759
-		if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) {
759
+		if (empty($active_tab) || ! isset($give_settings[$active_tab])) {
760 760
 			return $give_settings;
761 761
 		}
762 762
 
763 763
 		// Add other tabs and settings fields as needed
764
-		return $give_settings[ $active_tab ];
764
+		return $give_settings[$active_tab];
765 765
 
766 766
 	}
767 767
 
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 	 */
771 771
 	public function settings_notices() {
772 772
 
773
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
773
+		if ( ! isset($_POST['give_settings_saved'])) {
774 774
 			return;
775 775
 		}
776 776
 
777
-		add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' );
777
+		add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated');
778 778
 
779 779
 	}
780 780
 
@@ -789,14 +789,14 @@  discard block
 block discarded – undo
789 789
 	 * @return mixed         Field value or exception is thrown.
790 790
 	 * @throws Exception     Throws an exception if the field is invalid.
791 791
 	 */
792
-	public function __get( $field ) {
792
+	public function __get($field) {
793 793
 
794 794
 		// Allowed fields to retrieve
795
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
795
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
796 796
 			return $this->{$field};
797 797
 		}
798 798
 
799
-		throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) );
799
+		throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field));
800 800
 	}
801 801
 
802 802
 
@@ -815,12 +815,12 @@  discard block
 block discarded – undo
815 815
  *
816 816
  * @return mixed        Option value
817 817
  */
818
-function give_get_option( $key = '', $default = false ) {
818
+function give_get_option($key = '', $default = false) {
819 819
 	$give_options = give_get_settings();
820
-	$value        = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
821
-	$value        = apply_filters( 'give_get_option', $value, $key, $default );
820
+	$value        = ! empty($give_options[$key]) ? $give_options[$key] : $default;
821
+	$value        = apply_filters('give_get_option', $value, $key, $default);
822 822
 
823
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
823
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
824 824
 }
825 825
 
826 826
 
@@ -838,33 +838,33 @@  discard block
 block discarded – undo
838 838
  *
839 839
  * @return boolean True if updated, false if not.
840 840
  */
841
-function give_update_option( $key = '', $value = false ) {
841
+function give_update_option($key = '', $value = false) {
842 842
 
843 843
 	// If no key, exit
844
-	if ( empty( $key ) ) {
844
+	if (empty($key)) {
845 845
 		return false;
846 846
 	}
847 847
 
848
-	if ( empty( $value ) ) {
849
-		$remove_option = give_delete_option( $key );
848
+	if (empty($value)) {
849
+		$remove_option = give_delete_option($key);
850 850
 
851 851
 		return $remove_option;
852 852
 	}
853 853
 
854 854
 	// First let's grab the current settings
855
-	$options = get_option( 'give_settings' );
855
+	$options = get_option('give_settings');
856 856
 
857 857
 	// Let's let devs alter that value coming in
858
-	$value = apply_filters( 'give_update_option', $value, $key );
858
+	$value = apply_filters('give_update_option', $value, $key);
859 859
 
860 860
 	// Next let's try to update the value
861
-	$options[ $key ] = $value;
862
-	$did_update      = update_option( 'give_settings', $options );
861
+	$options[$key] = $value;
862
+	$did_update      = update_option('give_settings', $options);
863 863
 
864 864
 	// If it updated, let's update the global variable
865
-	if ( $did_update ) {
865
+	if ($did_update) {
866 866
 		global $give_options;
867
-		$give_options[ $key ] = $value;
867
+		$give_options[$key] = $value;
868 868
 	}
869 869
 
870 870
 	return $did_update;
@@ -883,25 +883,25 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return boolean True if updated, false if not.
885 885
  */
886
-function give_delete_option( $key = '' ) {
886
+function give_delete_option($key = '') {
887 887
 
888 888
 	// If no key, exit
889
-	if ( empty( $key ) ) {
889
+	if (empty($key)) {
890 890
 		return false;
891 891
 	}
892 892
 
893 893
 	// First let's grab the current settings
894
-	$options = get_option( 'give_settings' );
894
+	$options = get_option('give_settings');
895 895
 
896 896
 	// Next let's try to update the value
897
-	if ( isset( $options[ $key ] ) ) {
898
-		unset( $options[ $key ] );
897
+	if (isset($options[$key])) {
898
+		unset($options[$key]);
899 899
 	}
900 900
 
901
-	$did_update = update_option( 'give_settings', $options );
901
+	$did_update = update_option('give_settings', $options);
902 902
 
903 903
 	// If it updated, let's update the global variable
904
-	if ( $did_update ) {
904
+	if ($did_update) {
905 905
 		global $give_options;
906 906
 		$give_options = $options;
907 907
 	}
@@ -920,9 +920,9 @@  discard block
 block discarded – undo
920 920
  */
921 921
 function give_get_settings() {
922 922
 
923
-	$settings = get_option( 'give_settings' );
923
+	$settings = get_option('give_settings');
924 924
 
925
-	return (array) apply_filters( 'give_get_settings', $settings );
925
+	return (array) apply_filters('give_get_settings', $settings);
926 926
 
927 927
 }
928 928
 
@@ -940,25 +940,25 @@  discard block
 block discarded – undo
940 940
  *
941 941
  * @return array
942 942
  */
943
-function give_settings_array_insert( $array, $position, $insert ) {
944
-	if ( is_int( $position ) ) {
945
-		array_splice( $array, $position, 0, $insert );
943
+function give_settings_array_insert($array, $position, $insert) {
944
+	if (is_int($position)) {
945
+		array_splice($array, $position, 0, $insert);
946 946
 	} else {
947 947
 
948
-		foreach ( $array as $index => $subarray ) {
949
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
948
+		foreach ($array as $index => $subarray) {
949
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
950 950
 				$pos = $index;
951 951
 			}
952 952
 		}
953 953
 
954
-		if ( ! isset( $pos ) ) {
954
+		if ( ! isset($pos)) {
955 955
 			return $array;
956 956
 		}
957 957
 
958 958
 		$array = array_merge(
959
-			array_slice( $array, 0, $pos ),
959
+			array_slice($array, 0, $pos),
960 960
 			$insert,
961
-			array_slice( $array, $pos )
961
+			array_slice($array, $pos)
962 962
 		);
963 963
 	}
964 964
 
@@ -978,23 +978,23 @@  discard block
 block discarded – undo
978 978
  *
979 979
  * @return void
980 980
  */
981
-function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) {
981
+function give_enabled_gateways_callback($field_arr, $saved_values = array()) {
982 982
 
983 983
 	$id       = $field_arr['id'];
984
-	$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
984
+	$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
985 985
 
986 986
 	echo '<ul class="give-checklist-fields give-payment-gatways-list">';
987 987
 
988
-	foreach ( $gateways as $key => $option ) :
988
+	foreach ($gateways as $key => $option) :
989 989
 
990
-		if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) {
990
+		if (is_array($saved_values) && array_key_exists($key, $saved_values)) {
991 991
 			$enabled = '1';
992 992
 		} else {
993 993
 			$enabled = null;
994 994
 		}
995 995
 
996
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
997
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
996
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
997
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
998 998
 
999 999
 	endforeach;
1000 1000
 
@@ -1013,16 +1013,16 @@  discard block
 block discarded – undo
1013 1013
  *
1014 1014
  * @return void
1015 1015
  */
1016
-function give_default_gateway_callback( $field_arr, $saved_value ) {
1016
+function give_default_gateway_callback($field_arr, $saved_value) {
1017 1017
 	$id          = $field_arr['id'];
1018 1018
 	$gateways    = give_get_enabled_payment_gateways();
1019
-	$saved_value = give_get_default_gateway( null );
1019
+	$saved_value = give_get_default_gateway(null);
1020 1020
 
1021
-	echo '<select class="give-select" name="' . $id . '" id="' . $id . '">';
1021
+	echo '<select class="give-select" name="'.$id.'" id="'.$id.'">';
1022 1022
 
1023
-	foreach ( $gateways as $key => $option ) :
1024
-		$selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : '';
1025
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1023
+	foreach ($gateways as $key => $option) :
1024
+		$selected = isset($saved_value) ? selected($key, $saved_value, false) : '';
1025
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1026 1026
 	endforeach;
1027 1027
 
1028 1028
 	echo '</select>';
@@ -1040,13 +1040,13 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return void
1042 1042
  */
1043
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1043
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1044 1044
 
1045 1045
 	$id                = $field_type_object->field->args['id'];
1046 1046
 	$title             = $field_type_object->field->args['name'];
1047 1047
 	$field_description = $field_type_object->field->args['desc'];
1048 1048
 
1049
-	echo '<hr>' . $field_description;
1049
+	echo '<hr>'.$field_description;
1050 1050
 
1051 1051
 }
1052 1052
 
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
  *
1062 1062
  * @return void
1063 1063
  */
1064
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1064
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1065 1065
 
1066 1066
 	$id                = $field_type_object->field->args['id'];
1067 1067
 	$title             = $field_type_object->field->args['name'];
@@ -1080,25 +1080,25 @@  discard block
 block discarded – undo
1080 1080
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1081 1081
  * @return array An array of options that matches the CMB2 options array
1082 1082
  */
1083
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1083
+function give_cmb2_get_post_options($query_args, $force = false) {
1084 1084
 
1085
-	$post_options = array( '' => '' ); // Blank option
1085
+	$post_options = array('' => ''); // Blank option
1086 1086
 
1087
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1087
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1088 1088
 		return $post_options;
1089 1089
 	}
1090 1090
 
1091
-	$args = wp_parse_args( $query_args, array(
1091
+	$args = wp_parse_args($query_args, array(
1092 1092
 		'post_type'   => 'page',
1093 1093
 		'numberposts' => 10,
1094
-	) );
1094
+	));
1095 1095
 
1096
-	$posts = get_posts( $args );
1096
+	$posts = get_posts($args);
1097 1097
 
1098
-	if ( $posts ) {
1099
-		foreach ( $posts as $post ) {
1098
+	if ($posts) {
1099
+		foreach ($posts as $post) {
1100 1100
 
1101
-			$post_options[ $post->ID ] = $post->post_title;
1101
+			$post_options[$post->ID] = $post->post_title;
1102 1102
 
1103 1103
 		}
1104 1104
 	}
@@ -1124,20 +1124,20 @@  discard block
 block discarded – undo
1124 1124
 	$get_sizes = get_intermediate_image_sizes();
1125 1125
 
1126 1126
 	// check whether intermediate image sizes exist first
1127
-	if ( empty( $get_sizes ) ) {
1128
-		$get_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
1127
+	if (empty($get_sizes)) {
1128
+		$get_sizes = array('thumbnail', 'medium', 'medium_large', 'large');
1129 1129
 	}
1130 1130
 
1131
-	foreach ( $get_sizes as $_size ) {
1131
+	foreach ($get_sizes as $_size) {
1132 1132
 
1133
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1134
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1135
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1136
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1133
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1134
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1135
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1136
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1137 1137
 		}
1138 1138
 	}
1139 1139
 
1140
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1140
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1141 1141
 }
1142 1142
 
1143 1143
 
@@ -1152,18 +1152,18 @@  discard block
 block discarded – undo
1152 1152
  *
1153 1153
  * @return void
1154 1154
  */
1155
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1155
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1156 1156
 	/* @var CMB2_Types $field_type_object */
1157 1157
 
1158 1158
 	$id                 = $field_type_object->field->args['id'];
1159 1159
 	$field_description  = $field_type_object->field->args['desc'];
1160 1160
 	$license            = $field_type_object->field->args['options']['license'];
1161 1161
 	$license_key        = $escaped_value;
1162
-	$is_license_key     = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1163
-	$is_valid_license   = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1162
+	$is_license_key     = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1163
+	$is_valid_license   = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1164 1164
 	$shortname          = $field_type_object->field->args['options']['shortname'];
1165 1165
 	$field_classes      = 'regular-text give-license-field';
1166
-	$type               = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1166
+	$type               = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1167 1167
 	$custom_html        = '';
1168 1168
 	$messages           = array();
1169 1169
 	$class              = '';
@@ -1175,135 +1175,135 @@  discard block
 block discarded – undo
1175 1175
 
1176 1176
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1177 1177
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1178
-	if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1178
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1179 1179
 		$is_license_key = false;
1180 1180
 	}
1181 1181
 
1182 1182
 	// Check if current license is part of subscription or not.
1183
-	$subscriptions = get_option( 'give_subscriptions' );
1183
+	$subscriptions = get_option('give_subscriptions');
1184 1184
 
1185
-	if ( $is_license_key && $subscriptions ) {
1186
-		foreach ( $subscriptions as $subscription ) {
1187
-			if ( in_array( $license_key, $subscription['licenses'] ) ) {
1185
+	if ($is_license_key && $subscriptions) {
1186
+		foreach ($subscriptions as $subscription) {
1187
+			if (in_array($license_key, $subscription['licenses'])) {
1188 1188
 				$is_in_subscription = $subscription['id'];
1189 1189
 				break;
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
1193 1193
 
1194
-	if ( $is_license_key ) {
1195
-		if ( $is_in_subscription ) {
1196
-			$subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] );
1197
-			$subscription_status  = __( 'renew', 'give' );
1194
+	if ($is_license_key) {
1195
+		if ($is_in_subscription) {
1196
+			$subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1197
+			$subscription_status  = __('renew', 'give');
1198 1198
 
1199
-			if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) {
1200
-				$subscription_status = __( 'expire', 'give' );
1199
+			if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1200
+				$subscription_status = __('expire', 'give');
1201 1201
 			}
1202 1202
 
1203
-			if ( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1204
-				$messages[]     = sprintf(
1205
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1206
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1207
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1208
-					$checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1203
+			if ($subscription_expires < current_time('timestamp', 1)) {
1204
+				$messages[] = sprintf(
1205
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1206
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1207
+					$subscriptions[$is_in_subscription]['payment_id'],
1208
+					$checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1209 1209
 				);
1210 1210
 				$license_status = 'license-expired';
1211
-			} elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1211
+			} elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1212 1212
 				$messages[]     = sprintf(
1213
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ),
1214
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1215
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1213
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'),
1214
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1215
+					$subscriptions[$is_in_subscription]['payment_id'],
1216 1216
 					$subscription_status,
1217
-					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) )
1217
+					human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1218 1218
 				);
1219 1219
 				$license_status = 'license-expires-soon';
1220 1220
 			} else {
1221 1221
 				$messages[]     = sprintf(
1222
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ),
1223
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1224
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1222
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'),
1223
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1224
+					$subscriptions[$is_in_subscription]['payment_id'],
1225 1225
 					$subscription_status,
1226
-					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) )
1226
+					date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1227 1227
 				);
1228 1228
 				$license_status = 'license-expiration-date';
1229 1229
 			}
1230
-		} elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1230
+		} elseif (empty($license->success) && property_exists($license, 'error')) {
1231 1231
 
1232 1232
 			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1233
-			switch ( $license->error ) {
1233
+			switch ($license->error) {
1234 1234
 				case 'expired' :
1235 1235
 					$class          = $license->error;
1236 1236
 					$messages[]     = sprintf(
1237
-						__( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1238
-						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1239
-						$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1237
+						__('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1238
+						date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1239
+						$checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1240 1240
 					);
1241
-					$license_status = 'license-' . $class;
1241
+					$license_status = 'license-'.$class;
1242 1242
 					break;
1243 1243
 
1244 1244
 				case 'missing' :
1245 1245
 					$class          = $license->error;
1246 1246
 					$messages[]     = sprintf(
1247
-						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1248
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1247
+						__('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1248
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1249 1249
 					);
1250
-					$license_status = 'license-' . $class;
1250
+					$license_status = 'license-'.$class;
1251 1251
 					break;
1252 1252
 
1253 1253
 				case 'invalid' :
1254 1254
 					$class          = $license->error;
1255 1255
 					$messages[]     = sprintf(
1256
-						__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1256
+						__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1257 1257
 						$addon_name,
1258
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1258
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1259 1259
 					);
1260
-					$license_status = 'license-' . $class;
1260
+					$license_status = 'license-'.$class;
1261 1261
 					break;
1262 1262
 
1263 1263
 				case 'site_inactive' :
1264 1264
 					$class          = $license->error;
1265 1265
 					$messages[]     = sprintf(
1266
-						__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1266
+						__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1267 1267
 						$addon_name,
1268
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1268
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1269 1269
 					);
1270
-					$license_status = 'license-' . $class;
1270
+					$license_status = 'license-'.$class;
1271 1271
 					break;
1272 1272
 
1273 1273
 				case 'item_name_mismatch' :
1274 1274
 					$class          = $license->error;
1275
-					$messages[]     = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name );
1276
-					$license_status = 'license-' . $class;
1275
+					$messages[]     = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name);
1276
+					$license_status = 'license-'.$class;
1277 1277
 					break;
1278 1278
 
1279 1279
 				case 'no_activations_left':
1280 1280
 					$class          = $license->error;
1281
-					$messages[]     = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1282
-					$license_status = 'license-' . $class;
1281
+					$messages[]     = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1282
+					$license_status = 'license-'.$class;
1283 1283
 					break;
1284 1284
 			}
1285 1285
 		} else {
1286
-			switch ( $license->license ) {
1286
+			switch ($license->license) {
1287 1287
 				case 'valid' :
1288 1288
 				default:
1289 1289
 					$class      = 'valid';
1290
-					$now        = current_time( 'timestamp' );
1291
-					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1290
+					$now        = current_time('timestamp');
1291
+					$expiration = strtotime($license->expires, current_time('timestamp'));
1292 1292
 
1293
-					if ( 'lifetime' === $license->expires ) {
1294
-						$messages[]     = __( 'License key never expires.', 'give' );
1293
+					if ('lifetime' === $license->expires) {
1294
+						$messages[]     = __('License key never expires.', 'give');
1295 1295
 						$license_status = 'license-lifetime-notice';
1296
-					} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1296
+					} elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1297 1297
 						$messages[]     = sprintf(
1298
-							__( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1299
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1300
-							$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1298
+							__('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1299
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1300
+							$checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1301 1301
 						);
1302 1302
 						$license_status = 'license-expires-soon';
1303 1303
 					} else {
1304 1304
 						$messages[]     = sprintf(
1305
-							__( 'Your license key expires on %s.', 'give' ),
1306
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1305
+							__('Your license key expires on %s.', 'give'),
1306
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1307 1307
 						);
1308 1308
 						$license_status = 'license-expiration-date';
1309 1309
 					}
@@ -1311,15 +1311,15 @@  discard block
 block discarded – undo
1311 1311
 			}
1312 1312
 		}
1313 1313
 	} else {
1314
-		$messages[]     = sprintf(
1315
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1314
+		$messages[] = sprintf(
1315
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1316 1316
 			$addon_name
1317 1317
 		);
1318 1318
 		$license_status = 'inactive';
1319 1319
 	}
1320 1320
 
1321 1321
 	// Add class for input field if license is active.
1322
-	if ( $is_valid_license ) {
1322
+	if ($is_valid_license) {
1323 1323
 		$field_classes .= ' give-license-active';
1324 1324
 	}
1325 1325
 
@@ -1327,33 +1327,33 @@  discard block
 block discarded – undo
1327 1327
 	$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">";
1328 1328
 
1329 1329
 	// If license is active so show deactivate button.
1330
-	if ( $is_valid_license ) {
1330
+	if ($is_valid_license) {
1331 1331
 		// Get input field html.
1332 1332
 		$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">";
1333 1333
 
1334
-		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1334
+		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1335 1335
 
1336 1336
 	}
1337 1337
 
1338 1338
 	// Field description.
1339
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1339
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1340 1340
 
1341 1341
 	// If no messages found then inform user that to get updated in future register yourself.
1342
-	if ( empty( $messages ) ) {
1343
-		$messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) );
1342
+	if (empty($messages)) {
1343
+		$messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give'));
1344 1344
 	}
1345 1345
 
1346
-	foreach ( $messages as $message ) {
1347
-		$custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">';
1348
-		$custom_html .= '<p>' . $message . '</p>';
1346
+	foreach ($messages as $message) {
1347
+		$custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">';
1348
+		$custom_html .= '<p>'.$message.'</p>';
1349 1349
 		$custom_html .= '</div>';
1350 1350
 	}
1351 1351
 
1352 1352
 	// Field html.
1353
-	$custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object );
1353
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1354 1354
 
1355 1355
 	// Nonce.
1356
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1356
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1357 1357
 
1358 1358
 	// Print field html.
1359 1359
 	echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>";
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
  */
1369 1369
 function give_api_callback() {
1370 1370
 
1371
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1371
+	if ( ! current_user_can('manage_give_settings')) {
1372 1372
 		return;
1373 1373
 	}
1374 1374
 
@@ -1377,9 +1377,9 @@  discard block
 block discarded – undo
1377 1377
 	 *
1378 1378
 	 * @since 1.0
1379 1379
 	 */
1380
-	do_action( 'give_tools_api_keys_before' );
1380
+	do_action('give_tools_api_keys_before');
1381 1381
 
1382
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1382
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1383 1383
 
1384 1384
 	$api_keys_table = new Give_API_Keys_Table();
1385 1385
 	$api_keys_table->prepare_items();
@@ -1388,9 +1388,9 @@  discard block
 block discarded – undo
1388 1388
 	<span class="cmb2-metabox-description api-description">
1389 1389
 		<?php echo sprintf(
1390 1390
 			/* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */
1391
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1392
-			esc_url( 'http://docs.givewp.com/api' ),
1393
-			esc_url( 'http://docs.givewp.com/addon-zapier' )
1391
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1392
+			esc_url('http://docs.givewp.com/api'),
1393
+			esc_url('http://docs.givewp.com/addon-zapier')
1394 1394
 		); ?>
1395 1395
 	</span>
1396 1396
 	<?php
@@ -1400,10 +1400,10 @@  discard block
 block discarded – undo
1400 1400
 	 *
1401 1401
 	 * @since 1.0
1402 1402
 	 */
1403
-	do_action( 'give_tools_api_keys_after' );
1403
+	do_action('give_tools_api_keys_after');
1404 1404
 }
1405 1405
 
1406
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1406
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1407 1407
 
1408 1408
 /**
1409 1409
  * Hook Callback
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
  *
1417 1417
  * @return void
1418 1418
  */
1419
-function give_hook_callback( $args ) {
1419
+function give_hook_callback($args) {
1420 1420
 
1421 1421
 	$id = $args['id'];
1422 1422
 
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 	 *
1426 1426
 	 * @since 1.0
1427 1427
 	 */
1428
-	do_action( "give_{$id}" );
1428
+	do_action("give_{$id}");
1429 1429
 
1430 1430
 }
1431 1431
 
@@ -1440,19 +1440,19 @@  discard block
 block discarded – undo
1440 1440
  *
1441 1441
  * @return bool
1442 1442
  */
1443
-function give_is_setting_enabled( $value, $compare_with = null ) {
1444
-	if ( ! is_null( $compare_with ) ) {
1443
+function give_is_setting_enabled($value, $compare_with = null) {
1444
+	if ( ! is_null($compare_with)) {
1445 1445
 
1446
-		if ( is_array( $compare_with ) ) {
1446
+		if (is_array($compare_with)) {
1447 1447
 			// Output.
1448
-			return in_array( $value, $compare_with );
1448
+			return in_array($value, $compare_with);
1449 1449
 		}
1450 1450
 
1451 1451
 		// Output.
1452
-		return ( $value === $compare_with );
1452
+		return ($value === $compare_with);
1453 1453
 	}
1454 1454
 
1455 1455
 	// Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled
1456 1456
 	// Output.
1457
-	return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false );
1457
+	return (in_array($value, array('enabled', 'on', 'yes')) ? true : false);
1458 1458
 }
Please login to merge, or discard this patch.
includes/class-give-customer.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 	 * @access public
890 890
 	 *
891 891
 	 * @param  string $meta_key Metadata name. Default is empty.
892
-	 * @param  mixed $meta_value Metadata value.
892
+	 * @param  string $meta_value Metadata value.
893 893
 	 * @param  bool $unique Optional. Whether the same key should not be added. Default is false.
894 894
 	 *
895 895
 	 * @return bool               False for failure. True for success.
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	 * @access public
922 922
 	 *
923 923
 	 * @param  string $meta_key Metadata name. Default is empty.
924
-	 * @param  mixed $meta_value Optional. Metadata value. Default is empty.
924
+	 * @param  string $meta_value Optional. Metadata value. Default is empty.
925 925
 	 *
926 926
 	 * @return bool               False for failure. True for success.
927 927
 	 */
Please login to merge, or discard this patch.
Spacing   +170 added lines, -170 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
 
@@ -144,32 +144,32 @@  discard block
 block discarded – undo
144 144
 	 * @param  bool $_id_or_email
145 145
 	 * @param  bool $by_user_id
146 146
 	 */
147
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
147
+	public function __construct($_id_or_email = false, $by_user_id = false) {
148 148
 
149 149
 		$this->db = new Give_DB_Customers;
150 150
 
151 151
 		if (
152 152
 			false === $_id_or_email
153
-			|| ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) )
153
+			|| (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))
154 154
 		) {
155 155
 			return false;
156 156
 		}
157 157
 
158
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
158
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
159 159
 
160
-		if ( is_numeric( $_id_or_email ) ) {
160
+		if (is_numeric($_id_or_email)) {
161 161
 			$field = $by_user_id ? 'user_id' : 'id';
162 162
 		} else {
163 163
 			$field = 'email';
164 164
 		}
165 165
 
166
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
166
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
167 167
 
168
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
168
+		if (empty($customer) || ! is_object($customer)) {
169 169
 			return false;
170 170
 		}
171 171
 
172
-		$this->setup_customer( $customer );
172
+		$this->setup_customer($customer);
173 173
 
174 174
 	}
175 175
 
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return bool             If the setup was successful or not.
187 187
 	 */
188
-	private function setup_customer( $customer ) {
188
+	private function setup_customer($customer) {
189 189
 
190
-		if ( ! is_object( $customer ) ) {
190
+		if ( ! is_object($customer)) {
191 191
 			return false;
192 192
 		}
193 193
 
194
-		foreach ( $customer as $key => $value ) {
194
+		foreach ($customer as $key => $value) {
195 195
 
196
-			switch ( $key ) {
196
+			switch ($key) {
197 197
 
198 198
 				case 'notes':
199 199
 					$this->$key = $this->get_notes();
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 		}
208 208
 
209 209
 		// Get donor's all email including primary email.
210
-		$this->emails = (array) $this->get_meta( 'additional_email', false );
211
-		$this->emails = array( 'primary' => $this->email ) + $this->emails;
210
+		$this->emails = (array) $this->get_meta('additional_email', false);
211
+		$this->emails = array('primary' => $this->email) + $this->emails;
212 212
 
213 213
 		// Customer ID and email are the only things that are necessary, make sure they exist.
214
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
214
+		if ( ! empty($this->id) && ! empty($this->email)) {
215 215
 			return true;
216 216
 		}
217 217
 
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 	 * @since  1.0
226 226
 	 * @access public
227 227
 	 */
228
-	public function __get( $key ) {
228
+	public function __get($key) {
229 229
 
230
-		if ( method_exists( $this, 'get_' . $key ) ) {
230
+		if (method_exists($this, 'get_'.$key)) {
231 231
 
232
-			return call_user_func( array( $this, 'get_' . $key ) );
232
+			return call_user_func(array($this, 'get_'.$key));
233 233
 
234 234
 		} else {
235 235
 
236 236
 			/* translators: %s: property key */
237
-			return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
237
+			return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
238 238
 
239 239
 		}
240 240
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return bool|int    False if not a valid creation, customer ID if user is found or valid creation.
252 252
 	 */
253
-	public function create( $data = array() ) {
253
+	public function create($data = array()) {
254 254
 
255
-		if ( $this->id != 0 || empty( $data ) ) {
255
+		if ($this->id != 0 || empty($data)) {
256 256
 			return false;
257 257
 		}
258 258
 
@@ -260,15 +260,15 @@  discard block
 block discarded – undo
260 260
 			'payment_ids' => '',
261 261
 		);
262 262
 
263
-		$args = wp_parse_args( $data, $defaults );
264
-		$args = $this->sanitize_columns( $args );
263
+		$args = wp_parse_args($data, $defaults);
264
+		$args = $this->sanitize_columns($args);
265 265
 
266
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
266
+		if (empty($args['email']) || ! is_email($args['email'])) {
267 267
 			return false;
268 268
 		}
269 269
 
270
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
271
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
270
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
271
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
272 272
 		}
273 273
 
274 274
 		/**
@@ -278,18 +278,18 @@  discard block
 block discarded – undo
278 278
 		 *
279 279
 		 * @param array $args Customer attributes.
280 280
 		 */
281
-		do_action( 'give_customer_pre_create', $args );
281
+		do_action('give_customer_pre_create', $args);
282 282
 
283 283
 		$created = false;
284 284
 
285 285
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
286
-		if ( $this->db->add( $data ) ) {
286
+		if ($this->db->add($data)) {
287 287
 
288 288
 			// We've successfully added/updated the customer, reset the class vars with the new data
289
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
289
+			$customer = $this->db->get_customer_by('email', $args['email']);
290 290
 
291 291
 			// Setup the customer data with the values from DB
292
-			$this->setup_customer( $customer );
292
+			$this->setup_customer($customer);
293 293
 
294 294
 			$created = $this->id;
295 295
 		}
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		 *                          customer ID if user is found or valid creation.
304 304
 		 * @param array $args Customer attributes.
305 305
 		 */
306
-		do_action( 'give_customer_post_create', $created, $args );
306
+		do_action('give_customer_post_create', $created, $args);
307 307
 
308 308
 		return $created;
309 309
 
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @return bool        If the update was successful or not.
321 321
 	 */
322
-	public function update( $data = array() ) {
322
+	public function update($data = array()) {
323 323
 
324
-		if ( empty( $data ) ) {
324
+		if (empty($data)) {
325 325
 			return false;
326 326
 		}
327 327
 
328
-		$data = $this->sanitize_columns( $data );
328
+		$data = $this->sanitize_columns($data);
329 329
 
330 330
 		/**
331 331
 		 * Fires before updating customers.
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 		 * @param int $customer_id Customer id.
336 336
 		 * @param array $data Customer attributes.
337 337
 		 */
338
-		do_action( 'give_customer_pre_update', $this->id, $data );
338
+		do_action('give_customer_pre_update', $this->id, $data);
339 339
 
340 340
 		$updated = false;
341 341
 
342
-		if ( $this->db->update( $this->id, $data ) ) {
342
+		if ($this->db->update($this->id, $data)) {
343 343
 
344
-			$customer = $this->db->get_customer_by( 'id', $this->id );
345
-			$this->setup_customer( $customer );
344
+			$customer = $this->db->get_customer_by('id', $this->id);
345
+			$this->setup_customer($customer);
346 346
 
347 347
 			$updated = true;
348 348
 		}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 		 * @param int $customer_id Customer id.
357 357
 		 * @param array $data Customer attributes.
358 358
 		 */
359
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
359
+		do_action('give_customer_post_update', $updated, $this->id, $data);
360 360
 
361 361
 		return $updated;
362 362
 	}
@@ -374,27 +374,27 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return bool            If the attachment was successfuly.
376 376
 	 */
377
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
377
+	public function attach_payment($payment_id = 0, $update_stats = true) {
378 378
 
379
-		if ( empty( $payment_id ) ) {
379
+		if (empty($payment_id)) {
380 380
 			return false;
381 381
 		}
382 382
 
383
-		if ( empty( $this->payment_ids ) ) {
383
+		if (empty($this->payment_ids)) {
384 384
 
385 385
 			$new_payment_ids = $payment_id;
386 386
 
387 387
 		} else {
388 388
 
389
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
389
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
390 390
 
391
-			if ( in_array( $payment_id, $payment_ids ) ) {
391
+			if (in_array($payment_id, $payment_ids)) {
392 392
 				$update_stats = false;
393 393
 			}
394 394
 
395 395
 			$payment_ids[] = $payment_id;
396 396
 
397
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
397
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
398 398
 
399 399
 		}
400 400
 
@@ -406,20 +406,20 @@  discard block
 block discarded – undo
406 406
 		 * @param int $payment_id Payment id.
407 407
 		 * @param int $customer_id Customer id.
408 408
 		 */
409
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
409
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
410 410
 
411
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
411
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
412 412
 
413
-		if ( $payment_added ) {
413
+		if ($payment_added) {
414 414
 
415 415
 			$this->payment_ids = $new_payment_ids;
416 416
 
417 417
 			// We added this payment successfully, increment the stats
418
-			if ( $update_stats ) {
419
-				$payment_amount = give_get_payment_amount( $payment_id );
418
+			if ($update_stats) {
419
+				$payment_amount = give_get_payment_amount($payment_id);
420 420
 
421
-				if ( ! empty( $payment_amount ) ) {
422
-					$this->increase_value( $payment_amount );
421
+				if ( ! empty($payment_amount)) {
422
+					$this->increase_value($payment_amount);
423 423
 				}
424 424
 
425 425
 				$this->increase_purchase_count();
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		 * @param int $payment_id Payment id.
436 436
 		 * @param int $customer_id Customer id.
437 437
 		 */
438
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
438
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
439 439
 
440 440
 		return $payment_added;
441 441
 	}
@@ -453,33 +453,33 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return boolean               If the removal was successful.
455 455
 	 */
456
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
456
+	public function remove_payment($payment_id = 0, $update_stats = true) {
457 457
 
458
-		if ( empty( $payment_id ) ) {
458
+		if (empty($payment_id)) {
459 459
 			return false;
460 460
 		}
461 461
 
462
-		$payment = new Give_Payment( $payment_id );
462
+		$payment = new Give_Payment($payment_id);
463 463
 
464
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
464
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
465 465
 			$update_stats = false;
466 466
 		}
467 467
 
468 468
 		$new_payment_ids = '';
469 469
 
470
-		if ( ! empty( $this->payment_ids ) ) {
470
+		if ( ! empty($this->payment_ids)) {
471 471
 
472
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
472
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
473 473
 
474
-			$pos = array_search( $payment_id, $payment_ids );
475
-			if ( false === $pos ) {
474
+			$pos = array_search($payment_id, $payment_ids);
475
+			if (false === $pos) {
476 476
 				return false;
477 477
 			}
478 478
 
479
-			unset( $payment_ids[ $pos ] );
480
-			$payment_ids = array_filter( $payment_ids );
479
+			unset($payment_ids[$pos]);
480
+			$payment_ids = array_filter($payment_ids);
481 481
 
482
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
482
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
483 483
 
484 484
 		}
485 485
 
@@ -491,20 +491,20 @@  discard block
 block discarded – undo
491 491
 		 * @param int $payment_id Payment id.
492 492
 		 * @param int $customer_id Customer id.
493 493
 		 */
494
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
494
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
495 495
 
496
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
496
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
497 497
 
498
-		if ( $payment_removed ) {
498
+		if ($payment_removed) {
499 499
 
500 500
 			$this->payment_ids = $new_payment_ids;
501 501
 
502
-			if ( $update_stats ) {
502
+			if ($update_stats) {
503 503
 				// We removed this payment successfully, decrement the stats
504
-				$payment_amount = give_get_payment_amount( $payment_id );
504
+				$payment_amount = give_get_payment_amount($payment_id);
505 505
 
506
-				if ( ! empty( $payment_amount ) ) {
507
-					$this->decrease_value( $payment_amount );
506
+				if ( ! empty($payment_amount)) {
507
+					$this->decrease_value($payment_amount);
508 508
 				}
509 509
 
510 510
 				$this->decrease_purchase_count();
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		 * @param int $payment_id Payment id.
521 521
 		 * @param int $customer_id Customer id.
522 522
 		 */
523
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
523
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
524 524
 
525 525
 		return $payment_removed;
526 526
 
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 	 *
537 537
 	 * @return int        The donation count.
538 538
 	 */
539
-	public function increase_purchase_count( $count = 1 ) {
539
+	public function increase_purchase_count($count = 1) {
540 540
 
541 541
 		// Make sure it's numeric and not negative.
542
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
542
+		if ( ! is_numeric($count) || $count != absint($count)) {
543 543
 			return false;
544 544
 		}
545 545
 
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 		 * @param int $count The number to increase by.
554 554
 		 * @param int $customer_id Customer id.
555 555
 		 */
556
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
556
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
557 557
 
558
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
558
+		if ($this->update(array('purchase_count' => $new_total))) {
559 559
 			$this->purchase_count = $new_total;
560 560
 		}
561 561
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param int $count The number increased by.
569 569
 		 * @param int $customer_id Customer id.
570 570
 		 */
571
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
571
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
572 572
 
573 573
 		return $this->purchase_count;
574 574
 	}
@@ -583,16 +583,16 @@  discard block
 block discarded – undo
583 583
 	 *
584 584
 	 * @return mixed      If successful, the new count, otherwise false.
585 585
 	 */
586
-	public function decrease_purchase_count( $count = 1 ) {
586
+	public function decrease_purchase_count($count = 1) {
587 587
 
588 588
 		// Make sure it's numeric and not negative
589
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
589
+		if ( ! is_numeric($count) || $count != absint($count)) {
590 590
 			return false;
591 591
 		}
592 592
 
593 593
 		$new_total = (int) $this->purchase_count - (int) $count;
594 594
 
595
-		if ( $new_total < 0 ) {
595
+		if ($new_total < 0) {
596 596
 			$new_total = 0;
597 597
 		}
598 598
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 		 * @param int $count The number to decrease by.
605 605
 		 * @param int $customer_id Customer id.
606 606
 		 */
607
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
607
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
608 608
 
609
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
609
+		if ($this->update(array('purchase_count' => $new_total))) {
610 610
 			$this->purchase_count = $new_total;
611 611
 		}
612 612
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		 * @param int $count The number decreased by.
620 620
 		 * @param int $customer_id Customer id.
621 621
 		 */
622
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
622
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
623 623
 
624 624
 		return $this->purchase_count;
625 625
 	}
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @return mixed        If successful, the new value, otherwise false.
636 636
 	 */
637
-	public function increase_value( $value = 0.00 ) {
637
+	public function increase_value($value = 0.00) {
638 638
 
639
-		$new_value = floatval( $this->purchase_value ) + $value;
639
+		$new_value = floatval($this->purchase_value) + $value;
640 640
 
641 641
 		/**
642 642
 		 * Fires before increasing customer lifetime value.
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 		 * @param float $value The value to increase by.
647 647
 		 * @param int $customer_id Customer id.
648 648
 		 */
649
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
649
+		do_action('give_customer_pre_increase_value', $value, $this->id);
650 650
 
651
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
651
+		if ($this->update(array('purchase_value' => $new_value))) {
652 652
 			$this->purchase_value = $new_value;
653 653
 		}
654 654
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 		 * @param float $value The value increased by.
662 662
 		 * @param int $customer_id Customer id.
663 663
 		 */
664
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
664
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
665 665
 
666 666
 		return $this->purchase_value;
667 667
 	}
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 	 *
677 677
 	 * @return mixed        If successful, the new value, otherwise false.
678 678
 	 */
679
-	public function decrease_value( $value = 0.00 ) {
679
+	public function decrease_value($value = 0.00) {
680 680
 
681
-		$new_value = floatval( $this->purchase_value ) - $value;
681
+		$new_value = floatval($this->purchase_value) - $value;
682 682
 
683
-		if ( $new_value < 0 ) {
683
+		if ($new_value < 0) {
684 684
 			$new_value = 0.00;
685 685
 		}
686 686
 
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
 		 * @param float $value The value to decrease by.
693 693
 		 * @param int $customer_id Customer id.
694 694
 		 */
695
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
695
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
696 696
 
697
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
697
+		if ($this->update(array('purchase_value' => $new_value))) {
698 698
 			$this->purchase_value = $new_value;
699 699
 		}
700 700
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		 * @param float $value The value decreased by.
708 708
 		 * @param int $customer_id Customer id.
709 709
 		 */
710
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
710
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
711 711
 
712 712
 		return $this->purchase_value;
713 713
 	}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
728 728
 	 */
729
-	public function update_donation_value( $curr_amount, $new_amount ) {
729
+	public function update_donation_value($curr_amount, $new_amount) {
730 730
 		/**
731 731
 		 * Payment total difference value can be:
732 732
 		 *  zero   (in case amount not change)
@@ -736,15 +736,15 @@  discard block
 block discarded – undo
736 736
 		$payment_total_diff = $new_amount - $curr_amount;
737 737
 
738 738
 		// We do not need to update donation stat if donation did not change.
739
-		if ( ! $payment_total_diff ) {
739
+		if ( ! $payment_total_diff) {
740 740
 			return false;
741 741
 		}
742 742
 
743
-		if ( $payment_total_diff > 0 ) {
744
-			$this->increase_value( $payment_total_diff );
743
+		if ($payment_total_diff > 0) {
744
+			$this->increase_value($payment_total_diff);
745 745
 		} else {
746 746
 			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
747
-			$this->decrease_value( - $payment_total_diff );
747
+			$this->decrease_value( -$payment_total_diff );
748 748
 		}
749 749
 
750 750
 		return $this->purchase_value;
@@ -761,15 +761,15 @@  discard block
 block discarded – undo
761 761
 	 *
762 762
 	 * @return array       The notes requested.
763 763
 	 */
764
-	public function get_notes( $length = 20, $paged = 1 ) {
764
+	public function get_notes($length = 20, $paged = 1) {
765 765
 
766
-		$length = is_numeric( $length ) ? $length : 20;
767
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
766
+		$length = is_numeric($length) ? $length : 20;
767
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
768 768
 
769 769
 		$all_notes   = $this->get_raw_notes();
770
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
770
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
771 771
 
772
-		$desired_notes = array_slice( $notes_array, $offset, $length );
772
+		$desired_notes = array_slice($notes_array, $offset, $length);
773 773
 
774 774
 		return $desired_notes;
775 775
 
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	public function get_notes_count() {
787 787
 
788 788
 		$all_notes   = $this->get_raw_notes();
789
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
789
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
790 790
 
791
-		return count( $notes_array );
791
+		return count($notes_array);
792 792
 
793 793
 	}
794 794
 
@@ -802,22 +802,22 @@  discard block
 block discarded – undo
802 802
 	 *
803 803
 	 * @return string|boolean The new note if added successfully, false otherwise.
804 804
 	 */
805
-	public function add_note( $note = '' ) {
805
+	public function add_note($note = '') {
806 806
 
807
-		$note = trim( $note );
808
-		if ( empty( $note ) ) {
807
+		$note = trim($note);
808
+		if (empty($note)) {
809 809
 			return false;
810 810
 		}
811 811
 
812 812
 		$notes = $this->get_raw_notes();
813 813
 
814
-		if ( empty( $notes ) ) {
814
+		if (empty($notes)) {
815 815
 			$notes = '';
816 816
 		}
817 817
 
818
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
819
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
820
-		$notes       .= "\n\n" . $new_note;
818
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
819
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
820
+		$notes .= "\n\n".$new_note;
821 821
 
822 822
 		/**
823 823
 		 * Fires before customer note added.
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 		 * @param string $new_note New note to add.
828 828
 		 * @param int $customer_id Customer id.
829 829
 		 */
830
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
830
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
831 831
 
832
-		$updated = $this->update( array( 'notes' => $notes ) );
832
+		$updated = $this->update(array('notes' => $notes));
833 833
 
834
-		if ( $updated ) {
834
+		if ($updated) {
835 835
 			$this->notes = $this->get_notes();
836 836
 		}
837 837
 
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 		 * @param string $new_note New note added.
845 845
 		 * @param int $customer_id Customer id.
846 846
 		 */
847
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
847
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
848 848
 
849 849
 		// Return the formatted note, so we can test, as well as update any displays
850 850
 		return $new_note;
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	private function get_raw_notes() {
863 863
 
864
-		$all_notes = $this->db->get_column( 'notes', $this->id );
864
+		$all_notes = $this->db->get_column('notes', $this->id);
865 865
 
866 866
 		return $all_notes;
867 867
 
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	 *
879 879
 	 * @return mixed            Will be an array if $single is false. Will be value of meta data field if $single is true.
880 880
 	 */
881
-	public function get_meta( $meta_key = '', $single = true ) {
882
-		return Give()->customer_meta->get_meta( $this->id, $meta_key, $single );
881
+	public function get_meta($meta_key = '', $single = true) {
882
+		return Give()->customer_meta->get_meta($this->id, $meta_key, $single);
883 883
 	}
884 884
 
885 885
 	/**
@@ -894,8 +894,8 @@  discard block
 block discarded – undo
894 894
 	 *
895 895
 	 * @return bool               False for failure. True for success.
896 896
 	 */
897
-	public function add_meta( $meta_key = '', $meta_value, $unique = false ) {
898
-		return Give()->customer_meta->add_meta( $this->id, $meta_key, $meta_value, $unique );
897
+	public function add_meta($meta_key = '', $meta_value, $unique = false) {
898
+		return Give()->customer_meta->add_meta($this->id, $meta_key, $meta_value, $unique);
899 899
 	}
900 900
 
901 901
 	/**
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 	 *
911 911
 	 * @return bool               False on failure, true if success.
912 912
 	 */
913
-	public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) {
914
-		return Give()->customer_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value );
913
+	public function update_meta($meta_key = '', $meta_value, $prev_value = '') {
914
+		return Give()->customer_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value);
915 915
 	}
916 916
 
917 917
 	/**
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
 	 *
926 926
 	 * @return bool               False for failure. True for success.
927 927
 	 */
928
-	public function delete_meta( $meta_key = '', $meta_value = '' ) {
929
-		return Give()->customer_meta->delete_meta( $this->id, $meta_key, $meta_value );
928
+	public function delete_meta($meta_key = '', $meta_value = '') {
929
+		return Give()->customer_meta->delete_meta($this->id, $meta_key, $meta_value);
930 930
 	}
931 931
 
932 932
 	/**
@@ -939,51 +939,51 @@  discard block
 block discarded – undo
939 939
 	 *
940 940
 	 * @return array       The sanitized data, based off column defaults.
941 941
 	 */
942
-	private function sanitize_columns( $data ) {
942
+	private function sanitize_columns($data) {
943 943
 
944 944
 		$columns        = $this->db->get_columns();
945 945
 		$default_values = $this->db->get_column_defaults();
946 946
 
947
-		foreach ( $columns as $key => $type ) {
947
+		foreach ($columns as $key => $type) {
948 948
 
949 949
 			// Only sanitize data that we were provided
950
-			if ( ! array_key_exists( $key, $data ) ) {
950
+			if ( ! array_key_exists($key, $data)) {
951 951
 				continue;
952 952
 			}
953 953
 
954
-			switch ( $type ) {
954
+			switch ($type) {
955 955
 
956 956
 				case '%s':
957
-					if ( 'email' == $key ) {
958
-						$data[ $key ] = sanitize_email( $data[ $key ] );
959
-					} elseif ( 'notes' == $key ) {
960
-						$data[ $key ] = strip_tags( $data[ $key ] );
957
+					if ('email' == $key) {
958
+						$data[$key] = sanitize_email($data[$key]);
959
+					} elseif ('notes' == $key) {
960
+						$data[$key] = strip_tags($data[$key]);
961 961
 					} else {
962
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
962
+						$data[$key] = sanitize_text_field($data[$key]);
963 963
 					}
964 964
 					break;
965 965
 
966 966
 				case '%d':
967
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
968
-						$data[ $key ] = $default_values[ $key ];
967
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
968
+						$data[$key] = $default_values[$key];
969 969
 					} else {
970
-						$data[ $key ] = absint( $data[ $key ] );
970
+						$data[$key] = absint($data[$key]);
971 971
 					}
972 972
 					break;
973 973
 
974 974
 				case '%f':
975 975
 					// Convert what was given to a float
976
-					$value = floatval( $data[ $key ] );
976
+					$value = floatval($data[$key]);
977 977
 
978
-					if ( ! is_float( $value ) ) {
979
-						$data[ $key ] = $default_values[ $key ];
978
+					if ( ! is_float($value)) {
979
+						$data[$key] = $default_values[$key];
980 980
 					} else {
981
-						$data[ $key ] = $value;
981
+						$data[$key] = $value;
982 982
 					}
983 983
 					break;
984 984
 
985 985
 				default:
986
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
986
+					$data[$key] = sanitize_text_field($data[$key]);
987 987
 					break;
988 988
 
989 989
 			}
@@ -1003,33 +1003,33 @@  discard block
 block discarded – undo
1003 1003
 	 *
1004 1004
 	 * @return bool            If the email was added successfully
1005 1005
 	 */
1006
-	public function add_email( $email = '', $primary = false ) {
1007
-		if ( ! is_email( $email ) ) {
1006
+	public function add_email($email = '', $primary = false) {
1007
+		if ( ! is_email($email)) {
1008 1008
 			return false;
1009 1009
 		}
1010
-		$existing = new Give_Customer( $email );
1010
+		$existing = new Give_Customer($email);
1011 1011
 
1012
-		if ( $existing->id > 0 ) {
1012
+		if ($existing->id > 0) {
1013 1013
 			// Email address already belongs to another customer
1014 1014
 			return false;
1015 1015
 		}
1016 1016
 
1017
-		if ( email_exists( $email ) ) {
1018
-			$user = get_user_by( 'email', $email );
1019
-			if ( $user->ID != $this->user_id ) {
1017
+		if (email_exists($email)) {
1018
+			$user = get_user_by('email', $email);
1019
+			if ($user->ID != $this->user_id) {
1020 1020
 				return false;
1021 1021
 			}
1022 1022
 		}
1023 1023
 
1024
-		do_action( 'give_donor_pre_add_email', $email, $this->id, $this );
1024
+		do_action('give_donor_pre_add_email', $email, $this->id, $this);
1025 1025
 
1026 1026
 		// Add is used to ensure duplicate emails are not added
1027
-		$ret = (bool) $this->add_meta( 'additional_email', $email );
1027
+		$ret = (bool) $this->add_meta('additional_email', $email);
1028 1028
 
1029
-		do_action( 'give_donor_post_add_email', $email, $this->id, $this );
1029
+		do_action('give_donor_post_add_email', $email, $this->id, $this);
1030 1030
 
1031
-		if ( $ret && true === $primary ) {
1032
-			$this->set_primary_email( $email );
1031
+		if ($ret && true === $primary) {
1032
+			$this->set_primary_email($email);
1033 1033
 		}
1034 1034
 
1035 1035
 		return $ret;
@@ -1045,16 +1045,16 @@  discard block
 block discarded – undo
1045 1045
 	 *
1046 1046
 	 * @return bool          If the email was removed successfully
1047 1047
 	 */
1048
-	public function remove_email( $email = '' ) {
1049
-		if ( ! is_email( $email ) ) {
1048
+	public function remove_email($email = '') {
1049
+		if ( ! is_email($email)) {
1050 1050
 			return false;
1051 1051
 		}
1052 1052
 
1053
-		do_action( 'give_donor_pre_remove_email', $email, $this->id, $this );
1053
+		do_action('give_donor_pre_remove_email', $email, $this->id, $this);
1054 1054
 
1055
-		$ret = (bool) $this->delete_meta( 'additional_email', $email );
1055
+		$ret = (bool) $this->delete_meta('additional_email', $email);
1056 1056
 
1057
-		do_action( 'give_donor_post_remove_email', $email, $this->id, $this );
1057
+		do_action('give_donor_post_remove_email', $email, $this->id, $this);
1058 1058
 
1059 1059
 		return $ret;
1060 1060
 	}
@@ -1071,16 +1071,16 @@  discard block
 block discarded – undo
1071 1071
 	 *
1072 1072
 	 * @return bool                      If the email was set as primary successfully
1073 1073
 	 */
1074
-	public function set_primary_email( $new_primary_email = '' ) {
1075
-		if ( ! is_email( $new_primary_email ) ) {
1074
+	public function set_primary_email($new_primary_email = '') {
1075
+		if ( ! is_email($new_primary_email)) {
1076 1076
 			return false;
1077 1077
 		}
1078 1078
 
1079
-		do_action( 'give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this );
1079
+		do_action('give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this);
1080 1080
 
1081
-		$existing = new Give_Customer( $new_primary_email );
1081
+		$existing = new Give_Customer($new_primary_email);
1082 1082
 
1083
-		if ( $existing->id > 0 && (int) $existing->id !== (int) $this->id ) {
1083
+		if ($existing->id > 0 && (int) $existing->id !== (int) $this->id) {
1084 1084
 			// This email belongs to another customer
1085 1085
 			return false;
1086 1086
 		}
@@ -1088,21 +1088,21 @@  discard block
 block discarded – undo
1088 1088
 		$old_email = $this->email;
1089 1089
 
1090 1090
 		// Update customer record with new email
1091
-		$update = $this->update( array( 'email' => $new_primary_email ) );
1091
+		$update = $this->update(array('email' => $new_primary_email));
1092 1092
 
1093 1093
 		// Remove new primary from list of additional emails
1094
-		$remove = $this->remove_email( $new_primary_email );
1094
+		$remove = $this->remove_email($new_primary_email);
1095 1095
 
1096 1096
 		// Add old email to additional emails list
1097
-		$add = $this->add_email( $old_email );
1097
+		$add = $this->add_email($old_email);
1098 1098
 
1099 1099
 		$ret = $update && $remove && $add;
1100 1100
 
1101
-		if ( $ret ) {
1101
+		if ($ret) {
1102 1102
 			$this->email = $new_primary_email;
1103 1103
 		}
1104 1104
 
1105
-		do_action( 'give_donor_post_set_primary_email', $new_primary_email, $this->id, $this );
1105
+		do_action('give_donor_post_set_primary_email', $new_primary_email, $this->id, $this);
1106 1106
 
1107 1107
 		return $ret;
1108 1108
 	}
Please login to merge, or discard this patch.
includes/class-give-license-handler.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		 * @access public
488 488
 		 * @since  1.7
489 489
 		 *
490
-		 * @return bool|void
490
+		 * @return false|null
491 491
 		 */
492 492
 		public function weekly_license_check() {
493 493
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		 * @access public
541 541
 		 * @since  1.7
542 542
 		 *
543
-		 * @return bool|void
543
+		 * @return false|null
544 544
 		 */
545 545
 		public function weekly_subscription_check() {
546 546
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		 * @access private
622 622
 		 * @since  1.7
623 623
 		 *
624
-		 * @return bool|void
624
+		 * @return false|null
625 625
 		 */
626 626
 		private function __single_subscription_check() {
627 627
 			// Do not fire if license key is not set.
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		 * @access private
834 834
 		 * @since  1.7
835 835
 		 *
836
-		 * @return void|bool
836
+		 * @return false|null
837 837
 		 */
838 838
 		private function __remove_license_key_from_subscriptions() {
839 839
 			$subscriptions = get_option( 'give_subscriptions', array() );
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		 * @param $plugin_data
933 933
 		 * @param $status
934 934
 		 *
935
-		 * @return bool
935
+		 * @return false|null
936 936
 		 */
937 937
 		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
938 938
 			// Bailout.
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 		 *
955 955
 		 * @since  1.8.7
956 956
 		 * @access public
957
-		 * @return array
957
+		 * @return string
958 958
 		 */
959 959
 		public function license_state_message() {
960 960
 			$message_data = array();
Please login to merge, or discard this patch.
Spacing   +156 added lines, -156 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
-if ( ! class_exists( 'Give_License' ) ) :
17
+if ( ! class_exists('Give_License')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_License Class
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 		 * @param string $_checkout_url
143 143
 		 * @param string $_account_url
144 144
 		 */
145
-		public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null ) {
145
+		public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null) {
146 146
 
147 147
 			$give_options = give_get_settings();
148 148
 
149 149
 			$this->file             = $_file;
150 150
 			$this->item_name        = $_item_name;
151
-			$this->item_shortname   = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) );
151
+			$this->item_shortname   = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($this->item_name)));
152 152
 			$this->version          = $_version;
153
-			$this->license          = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : '';
154
-			$this->license_data     = get_option( $this->item_shortname . '_license_active' );
153
+			$this->license          = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : '';
154
+			$this->license_data     = get_option($this->item_shortname.'_license_active');
155 155
 			$this->author           = $_author;
156
-			$this->api_url          = is_null( $_api_url ) ? $this->api_url : $_api_url;
157
-			$this->checkout_url     = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url;
158
-			$this->account_url      = is_null( $_account_url ) ? $this->account_url : $_account_url;
156
+			$this->api_url          = is_null($_api_url) ? $this->api_url : $_api_url;
157
+			$this->checkout_url     = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url;
158
+			$this->account_url      = is_null($_account_url) ? $this->account_url : $_account_url;
159 159
 			$this->auto_updater_obj = null;
160 160
 
161 161
 			// Setup hooks
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 */
177 177
 		private function includes() {
178 178
 
179
-			if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
179
+			if ( ! class_exists('EDD_SL_Plugin_Updater')) {
180 180
 				require_once 'admin/EDD_SL_Plugin_Updater.php';
181 181
 			}
182 182
 		}
@@ -194,29 +194,29 @@  discard block
 block discarded – undo
194 194
 		private function hooks() {
195 195
 
196 196
 			// Register settings
197
-			add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 );
197
+			add_filter('give_settings_licenses', array($this, 'settings'), 1);
198 198
 
199 199
 			// Activate license key on settings save
200
-			add_action( 'admin_init', array( $this, 'activate_license' ) );
200
+			add_action('admin_init', array($this, 'activate_license'));
201 201
 
202 202
 			// Deactivate license key
203
-			add_action( 'admin_init', array( $this, 'deactivate_license' ) );
203
+			add_action('admin_init', array($this, 'deactivate_license'));
204 204
 
205 205
 			// Updater
206
-			add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
207
-			add_action( 'admin_notices', array( $this, 'notices' ) );
206
+			add_action('admin_init', array($this, 'auto_updater'), 0);
207
+			add_action('admin_notices', array($this, 'notices'));
208 208
 
209 209
 			// Check license weekly.
210
-			add_action( 'give_weekly_scheduled_events', array( $this, 'weekly_license_check' ) );
211
-			add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_license_check' ) );
210
+			add_action('give_weekly_scheduled_events', array($this, 'weekly_license_check'));
211
+			add_action('give_validate_license_when_site_migrated', array($this, 'weekly_license_check'));
212 212
 
213 213
 			// Check subscription weekly.
214
-			add_action( 'give_weekly_scheduled_events', array( $this, 'weekly_subscription_check' ) );
215
-			add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_subscription_check' ) );
214
+			add_action('give_weekly_scheduled_events', array($this, 'weekly_subscription_check'));
215
+			add_action('give_validate_license_when_site_migrated', array($this, 'weekly_subscription_check'));
216 216
 
217 217
 			// Show addon notice on plugin page.
218
-			$plugin_name = end( explode( 'plugins/', $this->file ) );
219
-			add_action( "after_plugin_row_{$plugin_name}", array( $this, 'plugin_page_notices' ), 10, 3 );
218
+			$plugin_name = end(explode('plugins/', $this->file));
219
+			add_action("after_plugin_row_{$plugin_name}", array($this, 'plugin_page_notices'), 10, 3);
220 220
 
221 221
 		}
222 222
 
@@ -256,16 +256,16 @@  discard block
 block discarded – undo
256 256
 		 *
257 257
 		 * @return array           License settings.
258 258
 		 */
259
-		public function settings( $settings ) {
259
+		public function settings($settings) {
260 260
 
261 261
 			$give_license_settings = array(
262 262
 				array(
263 263
 					'name'    => $this->item_name,
264
-					'id'      => $this->item_shortname . '_license_key',
264
+					'id'      => $this->item_shortname.'_license_key',
265 265
 					'desc'    => '',
266 266
 					'type'    => 'license_key',
267 267
 					'options' => array(
268
-						'license'      => get_option( $this->item_shortname . '_license_active' ),
268
+						'license'      => get_option($this->item_shortname.'_license_active'),
269 269
 						'shortname'    => $this->item_shortname,
270 270
 						'item_name'    => $this->item_name,
271 271
 						'api_url'      => $this->api_url,
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 				),
277 277
 			);
278 278
 
279
-			return array_merge( $settings, $give_license_settings );
279
+			return array_merge($settings, $give_license_settings);
280 280
 		}
281 281
 
282 282
 		/**
@@ -291,18 +291,18 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @return array           License settings content.
293 293
 		 */
294
-		public function license_settings_content( $settings ) {
294
+		public function license_settings_content($settings) {
295 295
 
296 296
 			$give_license_settings = array(
297 297
 				array(
298
-					'name' => __( 'Add-on Licenses', 'give' ),
298
+					'name' => __('Add-on Licenses', 'give'),
299 299
 					'desc' => '<hr>',
300 300
 					'type' => 'give_title',
301 301
 					'id'   => 'give_title',
302 302
 				),
303 303
 			);
304 304
 
305
-			return array_merge( $settings, $give_license_settings );
305
+			return array_merge($settings, $give_license_settings);
306 306
 		}
307 307
 
308 308
 		/**
@@ -317,52 +317,52 @@  discard block
 block discarded – undo
317 317
 		 */
318 318
 		public function activate_license() {
319 319
 			// Bailout: Check if license key set of not.
320
-			if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) {
320
+			if ( ! isset($_POST[$this->item_shortname.'_license_key'])) {
321 321
 				return;
322 322
 			}
323 323
 
324 324
 			// Security check.
325
-			if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) {
326
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
325
+			if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) {
326
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
327 327
 			}
328 328
 
329 329
 			// Check if user have correct permissions.
330
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
330
+			if ( ! current_user_can('manage_give_settings')) {
331 331
 				return;
332 332
 			}
333 333
 
334 334
 			// Allow third party addon developers to handle license activation.
335
-			if ( $this->__is_third_party_addon() ) {
336
-				do_action( 'give_activate_license', $this );
335
+			if ($this->__is_third_party_addon()) {
336
+				do_action('give_activate_license', $this);
337 337
 
338 338
 				return;
339 339
 			}
340 340
 
341 341
 			// Delete previous license setting if a empty license key submitted.
342
-			if ( empty( $_POST[ $this->item_shortname . '_license_key' ] ) ) {
343
-				delete_option( $this->item_shortname . '_license_active' );
342
+			if (empty($_POST[$this->item_shortname.'_license_key'])) {
343
+				delete_option($this->item_shortname.'_license_active');
344 344
 
345 345
 				return;
346 346
 			}
347 347
 
348 348
 			// Do not simultaneously activate add-ons if the user want to deactivate a specific add-on.
349
-			foreach ( $_POST as $key => $value ) {
350
-				if ( false !== strpos( $key, 'license_key_deactivate' ) ) {
349
+			foreach ($_POST as $key => $value) {
350
+				if (false !== strpos($key, 'license_key_deactivate')) {
351 351
 					// Don't activate a key when deactivating a different key
352 352
 					return;
353 353
 				}
354 354
 			}
355 355
 
356 356
 			// Check if plugin previously installed.
357
-			if ( $this->is_valid_license() ) {
357
+			if ($this->is_valid_license()) {
358 358
 				return;
359 359
 			}
360 360
 
361 361
 			// Get license key.
362
-			$license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] );
362
+			$license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']);
363 363
 
364 364
 			// Bailout.
365
-			if ( empty( $license ) ) {
365
+			if (empty($license)) {
366 366
 				return;
367 367
 			}
368 368
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			$api_params = array(
374 374
 				'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
375 375
 				'license'    => $license,
376
-				'item_name'  => urlencode( $this->item_name ),
376
+				'item_name'  => urlencode($this->item_name),
377 377
 				'url'        => home_url(),
378 378
 			);
379 379
 
@@ -388,19 +388,19 @@  discard block
 block discarded – undo
388 388
 			);
389 389
 
390 390
 			// Make sure there are no errors
391
-			if ( is_wp_error( $response ) ) {
391
+			if (is_wp_error($response)) {
392 392
 				return;
393 393
 			}
394 394
 
395 395
 			// Tell WordPress to look for updates
396
-			set_site_transient( 'update_plugins', null );
396
+			set_site_transient('update_plugins', null);
397 397
 
398 398
 			// Decode license data
399
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
400
-			update_option( $this->item_shortname . '_license_active', $license_data );
399
+			$license_data = json_decode(wp_remote_retrieve_body($response));
400
+			update_option($this->item_shortname.'_license_active', $license_data);
401 401
 
402 402
 			// Add license key.
403
-			give_update_option( "{$this->item_shortname}_license_key", $license );
403
+			give_update_option("{$this->item_shortname}_license_key", $license);
404 404
 
405 405
 			// Check subscription for license key and store this to db (if any).
406 406
 			$this->__single_subscription_check();
@@ -418,33 +418,33 @@  discard block
 block discarded – undo
418 418
 		 */
419 419
 		public function deactivate_license() {
420 420
 
421
-			if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) {
421
+			if ( ! isset($_POST[$this->item_shortname.'_license_key'])) {
422 422
 				return;
423 423
 			}
424 424
 
425
-			if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) {
426
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
425
+			if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) {
426
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
427 427
 			}
428 428
 
429
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
429
+			if ( ! current_user_can('manage_give_settings')) {
430 430
 				return;
431 431
 			}
432 432
 
433 433
 			// Allow third party add-on developers to handle license deactivation.
434
-			if ( $this->__is_third_party_addon() ) {
435
-				do_action( 'give_deactivate_license', $this );
434
+			if ($this->__is_third_party_addon()) {
435
+				do_action('give_deactivate_license', $this);
436 436
 
437 437
 				return;
438 438
 			}
439 439
 
440 440
 			// Run on deactivate button press
441
-			if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) {
441
+			if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) {
442 442
 
443 443
 				// Data to send to the API
444 444
 				$api_params = array(
445 445
 					'edd_action' => 'deactivate_license', // never change from "edd_" to "give_"!
446 446
 					'license'    => $this->license,
447
-					'item_name'  => urlencode( $this->item_name ),
447
+					'item_name'  => urlencode($this->item_name),
448 448
 					'url'        => home_url(),
449 449
 				);
450 450
 
@@ -459,20 +459,20 @@  discard block
 block discarded – undo
459 459
 				);
460 460
 
461 461
 				// Make sure there are no errors
462
-				if ( is_wp_error( $response ) ) {
462
+				if (is_wp_error($response)) {
463 463
 					return;
464 464
 				}
465 465
 
466 466
 				// Decode the license data
467
-				$license_data = json_decode( wp_remote_retrieve_body( $response ) );
467
+				$license_data = json_decode(wp_remote_retrieve_body($response));
468 468
 
469 469
 				// Ensure deactivated successfully.
470
-				if ( isset( $license_data->success ) ) {
470
+				if (isset($license_data->success)) {
471 471
 
472 472
 					// Remove license data.
473
-					delete_option( $this->item_shortname . '_license_active' );
473
+					delete_option($this->item_shortname.'_license_active');
474 474
 					
475
-					give_delete_option( $this->item_shortname . '_license_key' );
475
+					give_delete_option($this->item_shortname.'_license_key');
476 476
 
477 477
 					// Remove license key from subscriptions if exist.
478 478
 					$this->__remove_license_key_from_subscriptions();
@@ -491,18 +491,18 @@  discard block
 block discarded – undo
491 491
 		 */
492 492
 		public function weekly_license_check() {
493 493
 
494
-			if ( ! empty( $_POST['give_settings'] ) ) {
494
+			if ( ! empty($_POST['give_settings'])) {
495 495
 				// Don't fire when saving settings
496 496
 				return false;
497 497
 			}
498 498
 
499
-			if ( empty( $this->license ) ) {
499
+			if (empty($this->license)) {
500 500
 				return false;
501 501
 			}
502 502
 
503 503
 			// Allow third party add-on developers to handle their license check.
504
-			if ( $this->__is_third_party_addon() ) {
505
-				do_action( 'give_weekly_license_check', $this );
504
+			if ($this->__is_third_party_addon()) {
505
+				do_action('give_weekly_license_check', $this);
506 506
 
507 507
 				return false;
508 508
 			}
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 			$api_params = array(
512 512
 				'edd_action' => 'check_license',
513 513
 				'license'    => $this->license,
514
-				'item_name'  => urlencode( $this->item_name ),
514
+				'item_name'  => urlencode($this->item_name),
515 515
 				'url'        => home_url(),
516 516
 			);
517 517
 
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 			);
527 527
 
528 528
 			// Make sure the response came back okay.
529
-			if ( is_wp_error( $response ) ) {
529
+			if (is_wp_error($response)) {
530 530
 				return false;
531 531
 			}
532 532
 
533
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
534
-			update_option( $this->item_shortname . '_license_active', $license_data );
533
+			$license_data = json_decode(wp_remote_retrieve_body($response));
534
+			update_option($this->item_shortname.'_license_active', $license_data);
535 535
 		}
536 536
 
537 537
 		/**
@@ -544,24 +544,24 @@  discard block
 block discarded – undo
544 544
 		 */
545 545
 		public function weekly_subscription_check() {
546 546
 
547
-			if ( ! empty( $_POST['give_settings'] ) ) {
547
+			if ( ! empty($_POST['give_settings'])) {
548 548
 				// Don't fire when saving settings
549 549
 				return false;
550 550
 			}
551 551
 
552 552
 			// Remove old subscription data.
553
-			if ( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp', 1 ) ) {
554
-				delete_option( 'give_subscriptions' );
555
-				update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp', 1 ) ) );
553
+			if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) {
554
+				delete_option('give_subscriptions');
555
+				update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1)));
556 556
 			}
557 557
 
558
-			if ( empty( $this->license ) ) {
558
+			if (empty($this->license)) {
559 559
 				return false;
560 560
 			}
561 561
 
562 562
 			// Allow third party add-on developers to handle their subscription check.
563
-			if ( $this->__is_third_party_addon() ) {
564
-				do_action( 'give_weekly_subscription_check', $this );
563
+			if ($this->__is_third_party_addon()) {
564
+				do_action('give_weekly_subscription_check', $this);
565 565
 
566 566
 				return false;
567 567
 			}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 				// This is a custom feature to check subscriptions.
577 577
 				'edd_action' => 'check_subscription',
578 578
 				'license'    => $this->license,
579
-				'item_name'  => urlencode( $this->item_name ),
579
+				'item_name'  => urlencode($this->item_name),
580 580
 				'url'        => home_url(),
581 581
 			);
582 582
 
@@ -591,27 +591,27 @@  discard block
 block discarded – undo
591 591
 			);
592 592
 
593 593
 			// Make sure the response came back okay.
594
-			if ( is_wp_error( $response ) ) {
594
+			if (is_wp_error($response)) {
595 595
 				return false;
596 596
 			}
597 597
 
598
-			$subscription_data = json_decode( wp_remote_retrieve_body( $response ), true );
598
+			$subscription_data = json_decode(wp_remote_retrieve_body($response), true);
599 599
 
600
-			if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) {
601
-				$subscriptions = get_option( 'give_subscriptions', array() );
600
+			if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) {
601
+				$subscriptions = get_option('give_subscriptions', array());
602 602
 
603 603
 				// Update subscription data only if subscription does not exist already.
604
-				if ( ! array_key_exists( $subscription_data['id'], $subscriptions ) ) {
605
-					$subscriptions[ $subscription_data['id'] ]             = $subscription_data;
606
-					$subscriptions[ $subscription_data['id'] ]['licenses'] = array();
604
+				if ( ! array_key_exists($subscription_data['id'], $subscriptions)) {
605
+					$subscriptions[$subscription_data['id']]             = $subscription_data;
606
+					$subscriptions[$subscription_data['id']]['licenses'] = array();
607 607
 				}
608 608
 
609 609
 				// Store licenses for subscription.
610
-				if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
611
-					$subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license;
610
+				if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) {
611
+					$subscriptions[$subscription_data['id']]['licenses'][] = $this->license;
612 612
 				}
613 613
 
614
-				update_option( 'give_subscriptions', $subscriptions );
614
+				update_option('give_subscriptions', $subscriptions);
615 615
 			}
616 616
 		}
617 617
 
@@ -625,11 +625,11 @@  discard block
 block discarded – undo
625 625
 		 */
626 626
 		private function __single_subscription_check() {
627 627
 			// Do not fire if license key is not set.
628
-			if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) {
628
+			if ( ! isset($_POST[$this->item_shortname.'_license_key'])) {
629 629
 				return false;
630 630
 			}
631 631
 
632
-			if ( empty( $this->license ) ) {
632
+			if (empty($this->license)) {
633 633
 				return false;
634 634
 			}
635 635
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 				// This is a custom feature to check subscriptions.
641 641
 				'edd_action' => 'check_subscription',
642 642
 				'license'    => $this->license,
643
-				'item_name'  => urlencode( $this->item_name ),
643
+				'item_name'  => urlencode($this->item_name),
644 644
 				'url'        => home_url(),
645 645
 			);
646 646
 
@@ -655,27 +655,27 @@  discard block
 block discarded – undo
655 655
 			);
656 656
 
657 657
 			// Make sure the response came back okay.
658
-			if ( is_wp_error( $response ) ) {
658
+			if (is_wp_error($response)) {
659 659
 				return false;
660 660
 			}
661 661
 
662
-			$subscription_data = json_decode( wp_remote_retrieve_body( $response ), true );
662
+			$subscription_data = json_decode(wp_remote_retrieve_body($response), true);
663 663
 
664
-			if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) {
665
-				$subscriptions = get_option( 'give_subscriptions', array() );
664
+			if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) {
665
+				$subscriptions = get_option('give_subscriptions', array());
666 666
 
667 667
 				// Update subscription data only if subscription does not exist already.
668
-				if ( ! array_key_exists( $subscription_data['id'], $subscriptions ) ) {
669
-					$subscriptions[ $subscription_data['id'] ]             = $subscription_data;
670
-					$subscriptions[ $subscription_data['id'] ]['licenses'] = array();
668
+				if ( ! array_key_exists($subscription_data['id'], $subscriptions)) {
669
+					$subscriptions[$subscription_data['id']]             = $subscription_data;
670
+					$subscriptions[$subscription_data['id']]['licenses'] = array();
671 671
 				}
672 672
 
673 673
 				// Store licenses for subscription.
674
-				if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
675
-					$subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license;
674
+				if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) {
675
+					$subscriptions[$subscription_data['id']]['licenses'][] = $this->license;
676 676
 				}
677 677
 
678
-				update_option( 'give_subscriptions', $subscriptions );
678
+				update_option('give_subscriptions', $subscriptions);
679 679
 			}
680 680
 		}
681 681
 
@@ -689,12 +689,12 @@  discard block
 block discarded – undo
689 689
 		 */
690 690
 		public function notices() {
691 691
 
692
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
692
+			if ( ! current_user_can('manage_give_settings')) {
693 693
 				return;
694 694
 			}
695 695
 
696 696
 			// Do not show licenses notices on license tab.
697
-			if ( 'licenses' === give_get_current_setting_tab() ) {
697
+			if ('licenses' === give_get_current_setting_tab()) {
698 698
 				return;
699 699
 			}
700 700
 
@@ -703,93 +703,93 @@  discard block
 block discarded – undo
703 703
 			static $addon_license_key_in_subscriptions;
704 704
 
705 705
 			// Set default value.
706
-			$addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array();
706
+			$addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array();
707 707
 			$messages                           = array();
708 708
 
709 709
 			if (
710
-				empty( $this->license )
711
-				&& ! $this->__is_notice_dismissed( 'general' )
712
-				&& empty( $showed_invalid_message )
710
+				empty($this->license)
711
+				&& ! $this->__is_notice_dismissed('general')
712
+				&& empty($showed_invalid_message)
713 713
 			) {
714
-				$messages['general']    = sprintf(
715
-					__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
716
-					admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
714
+				$messages['general'] = sprintf(
715
+					__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
716
+					admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
717 717
 				);
718 718
 				$showed_invalid_message = true;
719 719
 
720 720
 			}
721 721
 
722 722
 			// Get subscriptions.
723
-			$subscriptions = get_option( 'give_subscriptions' );
723
+			$subscriptions = get_option('give_subscriptions');
724 724
 
725 725
 			// Show subscription messages.
726
-			if ( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) {
726
+			if ( ! empty($subscriptions) && ! $showed_subscriptions_message) {
727 727
 
728
-				foreach ( $subscriptions as $subscription ) {
728
+				foreach ($subscriptions as $subscription) {
729 729
 					// Subscription expires timestamp.
730
-					$subscription_expires = strtotime( $subscription['expires'] );
730
+					$subscription_expires = strtotime($subscription['expires']);
731 731
 
732 732
 					// Start showing subscriptions message before one week of renewal date.
733
-					if ( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) {
733
+					if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) {
734 734
 						continue;
735 735
 					}
736 736
 
737 737
 					// Check if subscription message already exist in messages.
738
-					if ( array_key_exists( $subscription['id'], $messages ) ) {
738
+					if (array_key_exists($subscription['id'], $messages)) {
739 739
 						continue;
740 740
 					}
741 741
 
742
-					if ( ( ! $this->__is_notice_dismissed( $subscription['id'] ) && 'active' !== $subscription['status'] ) ) {
742
+					if (( ! $this->__is_notice_dismissed($subscription['id']) && 'active' !== $subscription['status'])) {
743 743
 
744
-						if ( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) {// Check if license already expired.
745
-							$messages[ $subscription['id'] ] = sprintf(
746
-								__( 'Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or <a href="%4$s">Click here if already renewed</a>.', 'give' ),
747
-								urldecode( $subscription['invoice_url'] ),
744
+						if (strtotime($subscription['expires']) < current_time('timestamp', 1)) {// Check if license already expired.
745
+							$messages[$subscription['id']] = sprintf(
746
+								__('Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or <a href="%4$s">Click here if already renewed</a>.', 'give'),
747
+								urldecode($subscription['invoice_url']),
748 748
 								$subscription['payment_id'],
749 749
 								"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
750
-								esc_url( add_query_arg( '_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI'] ) )
750
+								esc_url(add_query_arg('_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI']))
751 751
 							);
752 752
 						} else {
753
-							$messages[ $subscription['id'] ] = sprintf(
754
-								__( 'Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or <a href="%5$s">Click here if already renewed</a>.', 'give' ),
755
-								human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ),
756
-								urldecode( $subscription['invoice_url'] ),
753
+							$messages[$subscription['id']] = sprintf(
754
+								__('Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or <a href="%5$s">Click here if already renewed</a>.', 'give'),
755
+								human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])),
756
+								urldecode($subscription['invoice_url']),
757 757
 								$subscription['payment_id'],
758 758
 								"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
759
-								esc_url( add_query_arg( '_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI'] ) )
759
+								esc_url(add_query_arg('_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI']))
760 760
 							);
761 761
 						}
762 762
 					}
763 763
 
764 764
 					// Stop validation for these license keys.
765
-					$addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] );
765
+					$addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']);
766 766
 				}// End foreach().
767 767
 				$showed_subscriptions_message = true;
768 768
 			}// End if().
769 769
 
770 770
 			// Show non subscription addon messages.
771 771
 			if (
772
-				! in_array( $this->license, $addon_license_key_in_subscriptions )
773
-				&& ! $this->__is_notice_dismissed( 'general' )
772
+				! in_array($this->license, $addon_license_key_in_subscriptions)
773
+				&& ! $this->__is_notice_dismissed('general')
774 774
 				&& ! $this->is_valid_license()
775
-				&& empty( $showed_invalid_message )
775
+				&& empty($showed_invalid_message)
776 776
 			) {
777 777
 
778
-				$messages['general']    = sprintf(
779
-					__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
780
-					admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
778
+				$messages['general'] = sprintf(
779
+					__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
780
+					admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
781 781
 				);
782 782
 				$showed_invalid_message = true;
783 783
 
784 784
 			}
785 785
 
786 786
 			// Print messages.
787
-			if ( ! empty( $messages ) ) {
788
-				foreach ( $messages as $notice_id => $message ) {
787
+			if ( ! empty($messages)) {
788
+				foreach ($messages as $notice_id => $message) {
789 789
 
790 790
 					echo sprintf(
791 791
 						'<div class="notice notice-error is-dismissible give-license-notice" data-dismiss-notice-shortly="%1$s"><p>%2$s</p></div>',
792
-						esc_url( add_query_arg( '_give_hide_license_notices_shortly', $notice_id, $_SERVER['REQUEST_URI'] ) ),
792
+						esc_url(add_query_arg('_give_hide_license_notices_shortly', $notice_id, $_SERVER['REQUEST_URI'])),
793 793
 						$message
794 794
 					);
795 795
 				}
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		 * @return bool
806 806
 		 */
807 807
 		public function is_valid_license() {
808
-			if ( apply_filters( 'give_is_valid_license', ( is_object( $this->license_data ) && ! empty( $this->license_data ) && property_exists( $this->license_data, 'license' ) && 'valid' === $this->license_data->license ) ) ) {
808
+			if (apply_filters('give_is_valid_license', (is_object($this->license_data) && ! empty($this->license_data) && property_exists($this->license_data, 'license') && 'valid' === $this->license_data->license))) {
809 809
 				return true;
810 810
 			}
811 811
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		 * @return bool
822 822
 		 */
823 823
 		private function __is_third_party_addon() {
824
-			return ( false === strpos( $this->api_url, 'givewp.com/' ) );
824
+			return (false === strpos($this->api_url, 'givewp.com/'));
825 825
 		}
826 826
 
827 827
 		/**
@@ -836,25 +836,25 @@  discard block
 block discarded – undo
836 836
 		 * @return void|bool
837 837
 		 */
838 838
 		private function __remove_license_key_from_subscriptions() {
839
-			$subscriptions = get_option( 'give_subscriptions', array() );
839
+			$subscriptions = get_option('give_subscriptions', array());
840 840
 
841 841
 			// Bailout.
842
-			if ( empty( $this->license ) ) {
842
+			if (empty($this->license)) {
843 843
 				return false;
844 844
 			}
845 845
 
846
-			if ( ! empty( $subscriptions ) ) {
847
-				foreach ( $subscriptions as $subscription_id => $subscription ) {
848
-					$license_index = array_search( $this->license, $subscription['licenses'] );
849
-					if ( false !== $license_index ) {
846
+			if ( ! empty($subscriptions)) {
847
+				foreach ($subscriptions as $subscription_id => $subscription) {
848
+					$license_index = array_search($this->license, $subscription['licenses']);
849
+					if (false !== $license_index) {
850 850
 						// Remove license key.
851
-						unset( $subscriptions[ $subscription_id ]['licenses'][ $license_index ] );
851
+						unset($subscriptions[$subscription_id]['licenses'][$license_index]);
852 852
 
853 853
 						// Rearrange license keys.
854
-						$subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] );
854
+						$subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']);
855 855
 
856 856
 						// Update subscription information.
857
-						update_option( 'give_subscriptions', $subscriptions );
857
+						update_option('give_subscriptions', $subscriptions);
858 858
 						break;
859 859
 					}
860 860
 				}
@@ -907,18 +907,18 @@  discard block
 block discarded – undo
907 907
 		 *
908 908
 		 * @return bool
909 909
 		 */
910
-		private function __is_notice_dismissed( $notice_id ) {
910
+		private function __is_notice_dismissed($notice_id) {
911 911
 			$current_user        = wp_get_current_user();
912 912
 			$is_notice_dismissed = false;
913 913
 
914 914
 			// Ge is notice dismissed permanently.
915
-			$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
915
+			$already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
916 916
 				? $already_dismiss_notices
917 917
 				: array();
918 918
 
919 919
 			if (
920
-				in_array( $notice_id, $already_dismiss_notices )
921
-				|| Give_Cache::get( "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}", true )
920
+				in_array($notice_id, $already_dismiss_notices)
921
+				|| Give_Cache::get("_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}", true)
922 922
 			) {
923 923
 				$is_notice_dismissed = true;
924 924
 			}
@@ -934,17 +934,17 @@  discard block
 block discarded – undo
934 934
 		 *
935 935
 		 * @return bool
936 936
 		 */
937
-		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
937
+		public function plugin_page_notices($plugin_file, $plugin_data, $status) {
938 938
 			// Bailout.
939
-			if ( $this->is_valid_license() ) {
939
+			if ($this->is_valid_license()) {
940 940
 				return false;
941 941
 			}
942 942
 
943 943
 			$update_notice_wrap = '<tr class="give-addon-notice-tr active"><td colspan="3" class="colspanchange"><div class="notice inline notice-warning notice-alt give-invalid-license"><p><span class="dashicons dashicons-info"></span> %s</p></div></td></tr>';
944 944
 			$message            = $this->license_state_message();
945 945
 
946
-			if ( ! empty( $message['message'] ) ) {
947
-				echo sprintf( $update_notice_wrap, $message['message'] );
946
+			if ( ! empty($message['message'])) {
947
+				echo sprintf($update_notice_wrap, $message['message']);
948 948
 			}
949 949
 		}
950 950
 
@@ -959,11 +959,11 @@  discard block
 block discarded – undo
959 959
 		public function license_state_message() {
960 960
 			$message_data = array();
961 961
 
962
-			if ( ! $this->is_valid_license() ) {
962
+			if ( ! $this->is_valid_license()) {
963 963
 
964 964
 				$message_data['message'] = sprintf(
965 965
 					'Please <a href="%1$s">activate your license</a> to receive updates and support for the %2$s add-on.',
966
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) ),
966
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')),
967 967
 					$this->item_name
968 968
 				);
969 969
 			}
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @since  1.0
369 369
  *
370
- * @param  int|bool $form_id Form ID (default: false).
370
+ * @param  boolean $form_id Form ID (default: false).
371 371
  * @param  int $payment_id Payment ID.
372 372
  *
373 373
  * @return void
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
  * @param  int $year Year number. Default is null.
692 692
  * @param  int $hour Hour number. Default is null.
693 693
  *
694
- * @return int $earnings  Earnings
694
+ * @return double $earnings  Earnings
695 695
  */
696 696
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
697 697
 
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
  *
998 998
  * @param int $payment_id Payment ID.
999 999
  *
1000
- * @return int $form_id Form ID.
1000
+ * @return string $form_id Form ID.
1001 1001
  */
1002 1002
 function give_get_payment_form_id( $payment_id ) {
1003 1003
 	$payment = new Give_Payment( $payment_id );
Please login to merge, or discard this patch.
Spacing   +405 added lines, -405 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return array $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility.
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise.
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	$payment    = new Give_Payment();
142
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
143
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
144
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
145
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
146
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
142
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
143
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
144
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
145
+	$price_id   = give_get_payment_meta_price_id($payment_data);
146
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
147 147
 
148 148
 	// Set properties.
149 149
 	$payment->total          = $payment_data['price'];
150
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
151
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency();
150
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
151
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency();
152 152
 	$payment->user_info      = $payment_data['user_info'];
153 153
 	$payment->gateway        = $gateway;
154 154
 	$payment->form_title     = $form_title;
@@ -162,31 +162,31 @@  discard block
 block discarded – undo
162 162
 	$payment->ip             = give_get_ip();
163 163
 	$payment->key            = $payment_data['purchase_key'];
164 164
 	$payment->mode           = give_is_test_mode() ? 'test' : 'live';
165
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
166 166
 
167 167
 	// Add the donation.
168 168
 	$args = array(
169 169
 		'price'    => $payment->total,
170 170
 		'price_id' => $payment->price_id,
171
-		'fees'     => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array(),
171
+		'fees'     => isset($payment_data['fees']) ? $payment_data['fees'] : array(),
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 	// Set date if present.
177
-	if ( isset( $payment_data['post_date'] ) ) {
177
+	if (isset($payment_data['post_date'])) {
178 178
 		$payment->date = $payment_data['post_date'];
179 179
 	}
180 180
 
181 181
 	// Handle sequential payments.
182
-	if ( give_get_option( 'enable_sequential' ) ) {
182
+	if (give_get_option('enable_sequential')) {
183 183
 		$number          = give_get_next_payment_number();
184
-		$payment->number = give_format_payment_number( $number );
185
-		update_option( 'give_last_payment_number', $number );
184
+		$payment->number = give_format_payment_number($number);
185
+		update_option('give_last_payment_number', $number);
186 186
 	}
187 187
 
188 188
 	// Clear the user's donation cache.
189
-	delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' );
189
+	delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases');
190 190
 
191 191
 	// Save payment.
192 192
 	$payment->save();
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param int $payment_id The payment ID.
200 200
 	 * @param array $payment_data Arguments passed.
201 201
 	 */
202
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
202
+	do_action('give_insert_payment', $payment->ID, $payment_data);
203 203
 
204 204
 	// Return payment ID upon success.
205
-	if ( ! empty( $payment->ID ) ) {
205
+	if ( ! empty($payment->ID)) {
206 206
 		return $payment->ID;
207 207
 	}
208 208
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return bool|int
220 220
  */
221
-function give_create_payment( $payment_data ) {
221
+function give_create_payment($payment_data) {
222 222
 
223
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
224
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
223
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
224
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
225 225
 
226 226
 	// Collect payment data.
227 227
 	$insert_payment_data = array(
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @param array $insert_payment_data
247 247
 	 */
248
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
248
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
249 249
 
250 250
 	// Record the pending payment.
251
-	return give_insert_payment( $insert_payment_data );
251
+	return give_insert_payment($insert_payment_data);
252 252
 }
253 253
 
254 254
 /**
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return bool
263 263
  */
264
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
264
+function give_update_payment_status($payment_id, $new_status = 'publish') {
265 265
 
266
-	$payment         = new Give_Payment( $payment_id );
266
+	$payment         = new Give_Payment($payment_id);
267 267
 	$payment->status = $new_status;
268 268
 	$updated         = $payment->save();
269 269
 
@@ -282,38 +282,38 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @return void
284 284
  */
285
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
285
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
286 286
 	global $give_logs;
287 287
 
288
-	$payment     = new Give_Payment( $payment_id );
289
-	$amount      = give_get_payment_amount( $payment_id );
288
+	$payment     = new Give_Payment($payment_id);
289
+	$amount      = give_get_payment_amount($payment_id);
290 290
 	$status      = $payment->post_status;
291
-	$customer_id = give_get_payment_customer_id( $payment_id );
292
-	$customer    = new Give_Customer( $customer_id );
291
+	$customer_id = give_get_payment_customer_id($payment_id);
292
+	$customer    = new Give_Customer($customer_id);
293 293
 
294 294
 	// Only undo donations that aren't these statuses.
295
-	$dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array(
295
+	$dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array(
296 296
 		'pending',
297 297
 		'cancelled',
298
-	) );
298
+	));
299 299
 
300
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
301
-		give_undo_purchase( false, $payment_id );
300
+	if ( ! in_array($status, $dont_undo_statuses)) {
301
+		give_undo_purchase(false, $payment_id);
302 302
 	}
303 303
 
304
-	if ( $status == 'publish' ) {
304
+	if ($status == 'publish') {
305 305
 
306 306
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
307
-		give_decrease_total_earnings( $amount );
307
+		give_decrease_total_earnings($amount);
308 308
 
309 309
 		// @todo: Refresh only range related stat cache
310 310
 		give_delete_donation_stats();
311 311
 
312
-		if ( $customer->id && $update_customer ) {
312
+		if ($customer->id && $update_customer) {
313 313
 
314 314
 			// Decrement the stats for the donor.
315 315
 			$customer->decrease_purchase_count();
316
-			$customer->decrease_value( $amount );
316
+			$customer->decrease_value($amount);
317 317
 
318 318
 		}
319 319
 	}
@@ -325,17 +325,17 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @param int $payment_id Payment ID.
327 327
 	 */
328
-	do_action( 'give_payment_delete', $payment_id );
328
+	do_action('give_payment_delete', $payment_id);
329 329
 
330
-	if ( $customer->id && $update_customer ) {
330
+	if ($customer->id && $update_customer) {
331 331
 
332 332
 		// Remove the payment ID from the donor.
333
-		$customer->remove_payment( $payment_id );
333
+		$customer->remove_payment($payment_id);
334 334
 
335 335
 	}
336 336
 
337 337
 	// Remove the payment.
338
-	wp_delete_post( $payment_id, true );
338
+	wp_delete_post($payment_id, true);
339 339
 
340 340
 	// Remove related sale log entries.
341 341
 	$give_logs->delete_logs(
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @param int $payment_id Payment ID.
358 358
 	 */
359
-	do_action( 'give_payment_deleted', $payment_id );
359
+	do_action('give_payment_deleted', $payment_id);
360 360
 }
361 361
 
362 362
 /**
@@ -372,25 +372,25 @@  discard block
 block discarded – undo
372 372
  *
373 373
  * @return void
374 374
  */
375
-function give_undo_purchase( $form_id = false, $payment_id ) {
375
+function give_undo_purchase($form_id = false, $payment_id) {
376 376
 
377
-	if ( ! empty( $form_id ) ) {
377
+	if ( ! empty($form_id)) {
378 378
 		$form_id = false;
379
-		_give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' );
379
+		_give_deprected_argument('form_id', 'give_undo_purchase', '1.5');
380 380
 	}
381 381
 
382
-	$payment = new Give_Payment( $payment_id );
382
+	$payment = new Give_Payment($payment_id);
383 383
 
384
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
385
-	if ( true === $maybe_decrease_earnings ) {
384
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
385
+	if (true === $maybe_decrease_earnings) {
386 386
 		// Decrease earnings.
387
-		give_decrease_earnings( $payment->form_id, $payment->total );
387
+		give_decrease_earnings($payment->form_id, $payment->total);
388 388
 	}
389 389
 
390
-	$maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id );
391
-	if ( true === $maybe_decrease_sales ) {
390
+	$maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id);
391
+	if (true === $maybe_decrease_sales) {
392 392
 		// Decrease donation count.
393
-		give_decrease_purchase_count( $payment->form_id );
393
+		give_decrease_purchase_count($payment->form_id);
394 394
 	}
395 395
 
396 396
 }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
  *
408 408
  * @return object $stats Contains the number of payments per payment status.
409 409
  */
410
-function give_count_payments( $args = array() ) {
410
+function give_count_payments($args = array()) {
411 411
 
412 412
 	global $wpdb;
413 413
 
@@ -419,18 +419,18 @@  discard block
 block discarded – undo
419 419
 		'form_id'    => null,
420 420
 	);
421 421
 
422
-	$args = wp_parse_args( $args, $defaults );
422
+	$args = wp_parse_args($args, $defaults);
423 423
 
424 424
 	$select = 'SELECT p.post_status,count( * ) AS num_posts';
425 425
 	$join   = '';
426 426
 	$where  = "WHERE p.post_type = 'give_payment'";
427 427
 
428 428
 	// Count payments for a specific user.
429
-	if ( ! empty( $args['user'] ) ) {
429
+	if ( ! empty($args['user'])) {
430 430
 
431
-		if ( is_email( $args['user'] ) ) {
431
+		if (is_email($args['user'])) {
432 432
 			$field = 'email';
433
-		} elseif ( is_numeric( $args['user'] ) ) {
433
+		} elseif (is_numeric($args['user'])) {
434 434
 			$field = 'id';
435 435
 		} else {
436 436
 			$field = '';
@@ -438,105 +438,105 @@  discard block
 block discarded – undo
438 438
 
439 439
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
440 440
 
441
-		if ( ! empty( $field ) ) {
441
+		if ( ! empty($field)) {
442 442
 			$where .= "
443 443
 				AND m.meta_key = '_give_payment_user_{$field}'
444 444
 				AND m.meta_value = '{$args['user']}'";
445 445
 		}
446 446
 
447 447
 		// Count payments for a search.
448
-	} elseif ( ! empty( $args['s'] ) ) {
448
+	} elseif ( ! empty($args['s'])) {
449 449
 
450
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
450
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
451 451
 
452
-			if ( is_email( $args['s'] ) ) {
452
+			if (is_email($args['s'])) {
453 453
 				$field = '_give_payment_user_email';
454 454
 			} else {
455 455
 				$field = '_give_payment_purchase_key';
456 456
 			}
457 457
 
458
-			$join  = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
459
-			$where .= $wpdb->prepare( '
458
+			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
459
+			$where .= $wpdb->prepare('
460 460
                 AND m.meta_key = %s
461 461
                 AND m.meta_value = %s',
462 462
 				$field,
463 463
 				$args['s']
464 464
 			);
465 465
 
466
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
466
+		} elseif ('#' == substr($args['s'], 0, 1)) {
467 467
 
468
-			$search = str_replace( '#:', '', $args['s'] );
469
-			$search = str_replace( '#', '', $search );
468
+			$search = str_replace('#:', '', $args['s']);
469
+			$search = str_replace('#', '', $search);
470 470
 
471 471
 			$select = 'SELECT p2.post_status,count( * ) AS num_posts ';
472 472
 			$join   = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID ";
473 473
 			$join   .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID ";
474 474
 			$where  = "WHERE p.post_type = 'give_log' ";
475
-			$where  .= $wpdb->prepare( 'AND p.post_parent = %d} ', $search );
475
+			$where  .= $wpdb->prepare('AND p.post_parent = %d} ', $search);
476 476
 
477
-		} elseif ( is_numeric( $args['s'] ) ) {
477
+		} elseif (is_numeric($args['s'])) {
478 478
 
479
-			$join  = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
480
-			$where .= $wpdb->prepare( "
479
+			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
480
+			$where .= $wpdb->prepare("
481 481
 				AND m.meta_key = '_give_payment_user_id'
482 482
 				AND m.meta_value = %d",
483 483
 				$args['s']
484 484
 			);
485 485
 
486 486
 		} else {
487
-			$search = $wpdb->esc_like( $args['s'] );
488
-			$search = '%' . $search . '%';
487
+			$search = $wpdb->esc_like($args['s']);
488
+			$search = '%'.$search.'%';
489 489
 
490
-			$where .= $wpdb->prepare( 'AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search );
490
+			$where .= $wpdb->prepare('AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search);
491 491
 		}
492 492
 	}
493 493
 
494
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
494
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
495 495
 
496
-		$where .= $wpdb->prepare( ' AND p.post_parent = %d', $args['form_id'] );
496
+		$where .= $wpdb->prepare(' AND p.post_parent = %d', $args['form_id']);
497 497
 
498 498
 	}
499 499
 	// Limit payments count by date.
500
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
500
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
501 501
 
502
-		$date_parts = explode( '/', $args['start-date'] );
503
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
504
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
505
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
502
+		$date_parts = explode('/', $args['start-date']);
503
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
504
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
505
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
506 506
 
507
-		$is_date = checkdate( $month, $day, $year );
508
-		if ( false !== $is_date ) {
507
+		$is_date = checkdate($month, $day, $year);
508
+		if (false !== $is_date) {
509 509
 
510
-			$date  = new DateTime( $args['start-date'] );
511
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
510
+			$date = new DateTime($args['start-date']);
511
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
512 512
 
513 513
 		}
514 514
 
515 515
 		// Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class).
516
-		if ( empty( $args['end-date'] ) ) {
516
+		if (empty($args['end-date'])) {
517 517
 			$args['end-date'] = $args['start-date'];
518 518
 		}
519 519
 	}
520 520
 
521
-	if ( ! empty( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
521
+	if ( ! empty($args['end-date']) && false !== strpos($args['end-date'], '/')) {
522 522
 
523
-		$date_parts = explode( '/', $args['end-date'] );
523
+		$date_parts = explode('/', $args['end-date']);
524 524
 
525
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
526
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
527
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
525
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
526
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
527
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
528 528
 
529
-		$is_date = checkdate( $month, $day, $year );
530
-		if ( false !== $is_date ) {
529
+		$is_date = checkdate($month, $day, $year);
530
+		if (false !== $is_date) {
531 531
 
532
-			$date  = new DateTime( $args['end-date'] );
533
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
532
+			$date = new DateTime($args['end-date']);
533
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
534 534
 
535 535
 		}
536 536
 	}
537 537
 
538
-	$where = apply_filters( 'give_count_payments_where', $where );
539
-	$join  = apply_filters( 'give_count_payments_join', $join );
538
+	$where = apply_filters('give_count_payments_where', $where);
539
+	$join  = apply_filters('give_count_payments_join', $join);
540 540
 
541 541
 	$query = "$select
542 542
 		FROM $wpdb->posts p
@@ -545,36 +545,36 @@  discard block
 block discarded – undo
545 545
 		GROUP BY p.post_status
546 546
 	";
547 547
 
548
-	$cache_key = md5( $query );
548
+	$cache_key = md5($query);
549 549
 
550
-	$count = wp_cache_get( $cache_key, 'counts' );
551
-	if ( false !== $count ) {
550
+	$count = wp_cache_get($cache_key, 'counts');
551
+	if (false !== $count) {
552 552
 		return $count;
553 553
 	}
554 554
 
555
-	$count = $wpdb->get_results( $query, ARRAY_A );
555
+	$count = $wpdb->get_results($query, ARRAY_A);
556 556
 
557 557
 	$stats    = array();
558 558
 	$statuses = get_post_stati();
559
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
560
-		unset( $statuses['private'] );
559
+	if (isset($statuses['private']) && empty($args['s'])) {
560
+		unset($statuses['private']);
561 561
 	}
562 562
 
563
-	foreach ( $statuses as $state ) {
564
-		$stats[ $state ] = 0;
563
+	foreach ($statuses as $state) {
564
+		$stats[$state] = 0;
565 565
 	}
566 566
 
567
-	foreach ( (array) $count as $row ) {
567
+	foreach ((array) $count as $row) {
568 568
 
569
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
569
+		if ('private' == $row['post_status'] && empty($args['s'])) {
570 570
 			continue;
571 571
 		}
572 572
 
573
-		$stats[ $row['post_status'] ] = $row['num_posts'];
573
+		$stats[$row['post_status']] = $row['num_posts'];
574 574
 	}
575 575
 
576 576
 	$stats = (object) $stats;
577
-	wp_cache_set( $cache_key, $stats, 'counts' );
577
+	wp_cache_set($cache_key, $stats, 'counts');
578 578
 
579 579
 	return $stats;
580 580
 }
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return bool $exists True if payment exists, false otherwise.
591 591
  */
592
-function give_check_for_existing_payment( $payment_id ) {
592
+function give_check_for_existing_payment($payment_id) {
593 593
 	$exists  = false;
594
-	$payment = new Give_Payment( $payment_id );
594
+	$payment = new Give_Payment($payment_id);
595 595
 
596
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
596
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
597 597
 		$exists = true;
598 598
 	}
599 599
 
@@ -611,31 +611,31 @@  discard block
 block discarded – undo
611 611
  *
612 612
  * @return bool|mixed True if payment status exists, false otherwise.
613 613
  */
614
-function give_get_payment_status( $payment, $return_label = false ) {
614
+function give_get_payment_status($payment, $return_label = false) {
615 615
 
616
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
616
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
617 617
 		return false;
618 618
 	}
619 619
 
620 620
 	$statuses = give_get_payment_statuses();
621 621
 
622
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
622
+	if ( ! is_array($statuses) || empty($statuses)) {
623 623
 		return false;
624 624
 	}
625 625
 
626 626
 	// Get payment object if no already given.
627
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
627
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
628 628
 
629
-	if ( array_key_exists( $payment->status, $statuses ) ) {
630
-		if ( true === $return_label ) {
629
+	if (array_key_exists($payment->status, $statuses)) {
630
+		if (true === $return_label) {
631 631
 			// Return translated status label.
632
-			return $statuses[ $payment->status ];
632
+			return $statuses[$payment->status];
633 633
 		} else {
634 634
 			// Account that our 'publish' status is labeled 'Complete'
635 635
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
636 636
 
637 637
 			// Make sure we're matching cases, since they matter
638
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
638
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
639 639
 		}
640 640
 	}
641 641
 
@@ -651,18 +651,18 @@  discard block
 block discarded – undo
651 651
  */
652 652
 function give_get_payment_statuses() {
653 653
 	$payment_statuses = array(
654
-		'pending'     => __( 'Pending', 'give' ),
655
-		'publish'     => __( 'Complete', 'give' ),
656
-		'refunded'    => __( 'Refunded', 'give' ),
657
-		'failed'      => __( 'Failed', 'give' ),
658
-		'cancelled'   => __( 'Cancelled', 'give' ),
659
-		'abandoned'   => __( 'Abandoned', 'give' ),
660
-		'preapproval' => __( 'Pre-Approved', 'give' ),
661
-		'processing'  => __( 'Processing', 'give' ),
662
-		'revoked'     => __( 'Revoked', 'give' ),
654
+		'pending'     => __('Pending', 'give'),
655
+		'publish'     => __('Complete', 'give'),
656
+		'refunded'    => __('Refunded', 'give'),
657
+		'failed'      => __('Failed', 'give'),
658
+		'cancelled'   => __('Cancelled', 'give'),
659
+		'abandoned'   => __('Abandoned', 'give'),
660
+		'preapproval' => __('Pre-Approved', 'give'),
661
+		'processing'  => __('Processing', 'give'),
662
+		'revoked'     => __('Revoked', 'give'),
663 663
 	);
664 664
 
665
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
665
+	return apply_filters('give_payment_statuses', $payment_statuses);
666 666
 }
667 667
 
668 668
 /**
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
  * @return array $payment_status All the available payment statuses.
676 676
  */
677 677
 function give_get_payment_status_keys() {
678
-	$statuses = array_keys( give_get_payment_statuses() );
679
-	asort( $statuses );
678
+	$statuses = array_keys(give_get_payment_statuses());
679
+	asort($statuses);
680 680
 
681
-	return array_values( $statuses );
681
+	return array_values($statuses);
682 682
 }
683 683
 
684 684
 /**
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
  *
694 694
  * @return int $earnings  Earnings
695 695
  */
696
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
696
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
697 697
 
698 698
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
699 699
 	global $wpdb;
@@ -703,41 +703,41 @@  discard block
 block discarded – undo
703 703
 		'nopaging'               => true,
704 704
 		'year'                   => $year,
705 705
 		'monthnum'               => $month_num,
706
-		'post_status'            => array( 'publish' ),
706
+		'post_status'            => array('publish'),
707 707
 		'fields'                 => 'ids',
708 708
 		'update_post_term_cache' => false,
709 709
 	);
710
-	if ( ! empty( $day ) ) {
710
+	if ( ! empty($day)) {
711 711
 		$args['day'] = $day;
712 712
 	}
713 713
 
714
-	if ( ! empty( $hour ) ) {
714
+	if ( ! empty($hour)) {
715 715
 		$args['hour'] = $hour;
716 716
 	}
717 717
 
718
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
719
-	$key  = Give_Cache::get_key( 'give_stats', $args );
718
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
719
+	$key  = Give_Cache::get_key('give_stats', $args);
720 720
 
721
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
721
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
722 722
 		$earnings = false;
723 723
 	} else {
724
-		$earnings = Give_Cache::get( $key );
724
+		$earnings = Give_Cache::get($key);
725 725
 	}
726 726
 
727
-	if ( false === $earnings ) {
728
-		$sales    = get_posts( $args );
727
+	if (false === $earnings) {
728
+		$sales    = get_posts($args);
729 729
 		$earnings = 0;
730
-		if ( $sales ) {
731
-			$sales = implode( ',', $sales );
730
+		if ($sales) {
731
+			$sales = implode(',', $sales);
732 732
 
733
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" );
733
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})");
734 734
 
735 735
 		}
736 736
 		// Cache the results for one hour.
737
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
737
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
738 738
 	}
739 739
 
740
-	return round( $earnings, 2 );
740
+	return round($earnings, 2);
741 741
 }
742 742
 
743 743
 /**
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
  *
753 753
  * @return int $count     Sales
754 754
  */
755
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
755
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
756 756
 
757 757
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
758 758
 	$args = array(
@@ -760,14 +760,14 @@  discard block
 block discarded – undo
760 760
 		'nopaging'               => true,
761 761
 		'year'                   => $year,
762 762
 		'fields'                 => 'ids',
763
-		'post_status'            => array( 'publish' ),
763
+		'post_status'            => array('publish'),
764 764
 		'update_post_meta_cache' => false,
765 765
 		'update_post_term_cache' => false,
766 766
 	);
767 767
 
768
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
768
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
769 769
 
770
-	if ( false === $show_free ) {
770
+	if (false === $show_free) {
771 771
 		$args['meta_query'] = array(
772 772
 			array(
773 773
 				'key'     => '_give_payment_total',
@@ -778,33 +778,33 @@  discard block
 block discarded – undo
778 778
 		);
779 779
 	}
780 780
 
781
-	if ( ! empty( $month_num ) ) {
781
+	if ( ! empty($month_num)) {
782 782
 		$args['monthnum'] = $month_num;
783 783
 	}
784 784
 
785
-	if ( ! empty( $day ) ) {
785
+	if ( ! empty($day)) {
786 786
 		$args['day'] = $day;
787 787
 	}
788 788
 
789
-	if ( ! empty( $hour ) ) {
789
+	if ( ! empty($hour)) {
790 790
 		$args['hour'] = $hour;
791 791
 	}
792 792
 
793
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
793
+	$args = apply_filters('give_get_sales_by_date_args', $args);
794 794
 
795
-	$key = Give_Cache::get_key( 'give_stats', $args );
795
+	$key = Give_Cache::get_key('give_stats', $args);
796 796
 
797
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
797
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
798 798
 		$count = false;
799 799
 	} else {
800
-		$count = Give_Cache::get( $key );
800
+		$count = Give_Cache::get($key);
801 801
 	}
802 802
 
803
-	if ( false === $count ) {
804
-		$sales = new WP_Query( $args );
803
+	if (false === $count) {
804
+		$sales = new WP_Query($args);
805 805
 		$count = (int) $sales->post_count;
806 806
 		// Cache the results for one hour.
807
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
807
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
808 808
 	}
809 809
 
810 810
 	return $count;
@@ -819,19 +819,19 @@  discard block
 block discarded – undo
819 819
  *
820 820
  * @return bool $ret True if complete, false otherwise.
821 821
  */
822
-function give_is_payment_complete( $payment_id ) {
823
-	$payment = new Give_Payment( $payment_id );
822
+function give_is_payment_complete($payment_id) {
823
+	$payment = new Give_Payment($payment_id);
824 824
 
825 825
 	$ret = false;
826 826
 
827
-	if ( $payment->ID > 0 ) {
827
+	if ($payment->ID > 0) {
828 828
 
829
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
829
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
830 830
 			$ret = true;
831 831
 		}
832 832
 	}
833 833
 
834
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
834
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
835 835
 }
836 836
 
837 837
 /**
@@ -857,49 +857,49 @@  discard block
 block discarded – undo
857 857
  *
858 858
  * @return float $total Total earnings.
859 859
  */
860
-function give_get_total_earnings( $recalculate = false ) {
860
+function give_get_total_earnings($recalculate = false) {
861 861
 
862
-	$total = get_option( 'give_earnings_total', 0 );
862
+	$total = get_option('give_earnings_total', 0);
863 863
 
864 864
 	// Calculate total earnings.
865
-	if ( ! $total || $recalculate ) {
865
+	if ( ! $total || $recalculate) {
866 866
 		global $wpdb;
867 867
 
868 868
 		$total = (float) 0;
869 869
 
870
-		$args = apply_filters( 'give_get_total_earnings_args', array(
870
+		$args = apply_filters('give_get_total_earnings_args', array(
871 871
 			'offset' => 0,
872
-			'number' => - 1,
873
-			'status' => array( 'publish' ),
872
+			'number' => -1,
873
+			'status' => array('publish'),
874 874
 			'fields' => 'ids',
875
-		) );
875
+		));
876 876
 
877
-		$payments = give_get_payments( $args );
878
-		if ( $payments ) {
877
+		$payments = give_get_payments($args);
878
+		if ($payments) {
879 879
 
880 880
 			/**
881 881
 			 * If performing a donation, we need to skip the very last payment in the database,
882 882
 			 * since it calls give_increase_total_earnings() on completion,
883 883
 			 * which results in duplicated earnings for the very first donation.
884 884
 			 */
885
-			if ( did_action( 'give_update_payment_status' ) ) {
886
-				array_pop( $payments );
885
+			if (did_action('give_update_payment_status')) {
886
+				array_pop($payments);
887 887
 			}
888 888
 
889
-			if ( ! empty( $payments ) ) {
890
-				$payments = implode( ',', $payments );
891
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
889
+			if ( ! empty($payments)) {
890
+				$payments = implode(',', $payments);
891
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
892 892
 			}
893 893
 		}
894 894
 
895
-		update_option( 'give_earnings_total', $total, 'no' );
895
+		update_option('give_earnings_total', $total, 'no');
896 896
 	}
897 897
 
898
-	if ( $total < 0 ) {
898
+	if ($total < 0) {
899 899
 		$total = 0; // Don't ever show negative earnings.
900 900
 	}
901 901
 
902
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
902
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
903 903
 }
904 904
 
905 905
 /**
@@ -912,10 +912,10 @@  discard block
 block discarded – undo
912 912
  *
913 913
  * @return float $total  Total earnings.
914 914
  */
915
-function give_increase_total_earnings( $amount = 0 ) {
915
+function give_increase_total_earnings($amount = 0) {
916 916
 	$total = give_get_total_earnings();
917 917
 	$total += $amount;
918
-	update_option( 'give_earnings_total', $total );
918
+	update_option('give_earnings_total', $total);
919 919
 
920 920
 	return $total;
921 921
 }
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
  *
930 930
  * @return float $total Total earnings.
931 931
  */
932
-function give_decrease_total_earnings( $amount = 0 ) {
932
+function give_decrease_total_earnings($amount = 0) {
933 933
 	$total = give_get_total_earnings();
934 934
 	$total -= $amount;
935
-	if ( $total < 0 ) {
935
+	if ($total < 0) {
936 936
 		$total = 0;
937 937
 	}
938
-	update_option( 'give_earnings_total', $total );
938
+	update_option('give_earnings_total', $total);
939 939
 
940 940
 	return $total;
941 941
 }
@@ -951,10 +951,10 @@  discard block
 block discarded – undo
951 951
  *
952 952
  * @return mixed $meta Payment Meta.
953 953
  */
954
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
955
-	$payment = new Give_Payment( $payment_id );
954
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
955
+	$payment = new Give_Payment($payment_id);
956 956
 
957
-	return $payment->get_meta( $meta_key, $single );
957
+	return $payment->get_meta($meta_key, $single);
958 958
 }
959 959
 
960 960
 /**
@@ -967,10 +967,10 @@  discard block
 block discarded – undo
967 967
  *
968 968
  * @return mixed Meta ID if successful, false if unsuccessful.
969 969
  */
970
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
971
-	$payment = new Give_Payment( $payment_id );
970
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
971
+	$payment = new Give_Payment($payment_id);
972 972
 
973
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
973
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
974 974
 }
975 975
 
976 976
 /**
@@ -982,8 +982,8 @@  discard block
 block discarded – undo
982 982
  *
983 983
  * @return string $user_info User Info Meta Values.
984 984
  */
985
-function give_get_payment_meta_user_info( $payment_id ) {
986
-	$payment = new Give_Payment( $payment_id );
985
+function give_get_payment_meta_user_info($payment_id) {
986
+	$payment = new Give_Payment($payment_id);
987 987
 
988 988
 	return $payment->user_info;
989 989
 }
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return int $form_id Form ID.
1001 1001
  */
1002
-function give_get_payment_form_id( $payment_id ) {
1003
-	$payment = new Give_Payment( $payment_id );
1002
+function give_get_payment_form_id($payment_id) {
1003
+	$payment = new Give_Payment($payment_id);
1004 1004
 
1005 1005
 	return $payment->form_id;
1006 1006
 }
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
  *
1015 1015
  * @return string $email User email.
1016 1016
  */
1017
-function give_get_payment_user_email( $payment_id ) {
1018
-	$payment = new Give_Payment( $payment_id );
1017
+function give_get_payment_user_email($payment_id) {
1018
+	$payment = new Give_Payment($payment_id);
1019 1019
 
1020 1020
 	return $payment->email;
1021 1021
 }
@@ -1029,11 +1029,11 @@  discard block
 block discarded – undo
1029 1029
  *
1030 1030
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
1031 1031
  */
1032
-function give_is_guest_payment( $payment_id ) {
1033
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
1034
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
1032
+function give_is_guest_payment($payment_id) {
1033
+	$payment_user_id  = give_get_payment_user_id($payment_id);
1034
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
1035 1035
 
1036
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
1036
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
1037 1037
 }
1038 1038
 
1039 1039
 /**
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
  *
1046 1046
  * @return int $user_id User ID.
1047 1047
  */
1048
-function give_get_payment_user_id( $payment_id ) {
1049
-	$payment = new Give_Payment( $payment_id );
1048
+function give_get_payment_user_id($payment_id) {
1049
+	$payment = new Give_Payment($payment_id);
1050 1050
 
1051 1051
 	return $payment->user_id;
1052 1052
 }
@@ -1060,8 +1060,8 @@  discard block
 block discarded – undo
1060 1060
  *
1061 1061
  * @return int $customer_id Customer ID.
1062 1062
  */
1063
-function give_get_payment_customer_id( $payment_id ) {
1064
-	$payment = new Give_Payment( $payment_id );
1063
+function give_get_payment_customer_id($payment_id) {
1064
+	$payment = new Give_Payment($payment_id);
1065 1065
 
1066 1066
 	return $payment->customer_id;
1067 1067
 }
@@ -1075,8 +1075,8 @@  discard block
 block discarded – undo
1075 1075
  *
1076 1076
  * @return string $ip User IP.
1077 1077
  */
1078
-function give_get_payment_user_ip( $payment_id ) {
1079
-	$payment = new Give_Payment( $payment_id );
1078
+function give_get_payment_user_ip($payment_id) {
1079
+	$payment = new Give_Payment($payment_id);
1080 1080
 
1081 1081
 	return $payment->ip;
1082 1082
 }
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
  *
1091 1091
  * @return string $date The date the payment was completed.
1092 1092
  */
1093
-function give_get_payment_completed_date( $payment_id = 0 ) {
1094
-	$payment = new Give_Payment( $payment_id );
1093
+function give_get_payment_completed_date($payment_id = 0) {
1094
+	$payment = new Give_Payment($payment_id);
1095 1095
 
1096 1096
 	return $payment->completed_date;
1097 1097
 }
@@ -1105,8 +1105,8 @@  discard block
 block discarded – undo
1105 1105
  *
1106 1106
  * @return string $gateway Gateway.
1107 1107
  */
1108
-function give_get_payment_gateway( $payment_id ) {
1109
-	$payment = new Give_Payment( $payment_id );
1108
+function give_get_payment_gateway($payment_id) {
1109
+	$payment = new Give_Payment($payment_id);
1110 1110
 
1111 1111
 	return $payment->gateway;
1112 1112
 }
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
  *
1121 1121
  * @return string $currency The currency code.
1122 1122
  */
1123
-function give_get_payment_currency_code( $payment_id = 0 ) {
1124
-	$payment = new Give_Payment( $payment_id );
1123
+function give_get_payment_currency_code($payment_id = 0) {
1124
+	$payment = new Give_Payment($payment_id);
1125 1125
 
1126 1126
 	return $payment->currency;
1127 1127
 }
@@ -1135,10 +1135,10 @@  discard block
 block discarded – undo
1135 1135
  *
1136 1136
  * @return string $currency The currency name.
1137 1137
  */
1138
-function give_get_payment_currency( $payment_id = 0 ) {
1139
-	$currency = give_get_payment_currency_code( $payment_id );
1138
+function give_get_payment_currency($payment_id = 0) {
1139
+	$currency = give_get_payment_currency_code($payment_id);
1140 1140
 
1141
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1141
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1142 1142
 }
1143 1143
 
1144 1144
 /**
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
  *
1151 1151
  * @return string $key Donation key.
1152 1152
  */
1153
-function give_get_payment_key( $payment_id = 0 ) {
1154
-	$payment = new Give_Payment( $payment_id );
1153
+function give_get_payment_key($payment_id = 0) {
1154
+	$payment = new Give_Payment($payment_id);
1155 1155
 
1156 1156
 	return $payment->key;
1157 1157
 }
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
  *
1168 1168
  * @return string $number Payment order number.
1169 1169
  */
1170
-function give_get_payment_number( $payment_id = 0 ) {
1171
-	$payment = new Give_Payment( $payment_id );
1170
+function give_get_payment_number($payment_id = 0) {
1171
+	$payment = new Give_Payment($payment_id);
1172 1172
 
1173 1173
 	return $payment->number;
1174 1174
 }
@@ -1182,23 +1182,23 @@  discard block
 block discarded – undo
1182 1182
  *
1183 1183
  * @return string      The formatted payment number.
1184 1184
  */
1185
-function give_format_payment_number( $number ) {
1185
+function give_format_payment_number($number) {
1186 1186
 
1187
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1187
+	if ( ! give_get_option('enable_sequential')) {
1188 1188
 		return $number;
1189 1189
 	}
1190 1190
 
1191
-	if ( ! is_numeric( $number ) ) {
1191
+	if ( ! is_numeric($number)) {
1192 1192
 		return $number;
1193 1193
 	}
1194 1194
 
1195
-	$prefix  = give_get_option( 'sequential_prefix' );
1196
-	$number  = absint( $number );
1197
-	$postfix = give_get_option( 'sequential_postfix' );
1195
+	$prefix  = give_get_option('sequential_prefix');
1196
+	$number  = absint($number);
1197
+	$postfix = give_get_option('sequential_postfix');
1198 1198
 
1199
-	$formatted_number = $prefix . $number . $postfix;
1199
+	$formatted_number = $prefix.$number.$postfix;
1200 1200
 
1201
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1201
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1211,17 +1211,17 @@  discard block
 block discarded – undo
1211 1211
  */
1212 1212
 function give_get_next_payment_number() {
1213 1213
 
1214
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1214
+	if ( ! give_get_option('enable_sequential')) {
1215 1215
 		return false;
1216 1216
 	}
1217 1217
 
1218
-	$number           = get_option( 'give_last_payment_number' );
1219
-	$start            = give_get_option( 'sequential_start', 1 );
1218
+	$number           = get_option('give_last_payment_number');
1219
+	$start            = give_get_option('sequential_start', 1);
1220 1220
 	$increment_number = true;
1221 1221
 
1222
-	if ( false !== $number ) {
1222
+	if (false !== $number) {
1223 1223
 
1224
-		if ( empty( $number ) ) {
1224
+		if (empty($number)) {
1225 1225
 
1226 1226
 			$number           = $start;
1227 1227
 			$increment_number = false;
@@ -1230,24 +1230,24 @@  discard block
 block discarded – undo
1230 1230
 	} else {
1231 1231
 
1232 1232
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1233
-		$payments     = new Give_Payments_Query( array(
1233
+		$payments = new Give_Payments_Query(array(
1234 1234
 			'number'  => 1,
1235 1235
 			'order'   => 'DESC',
1236 1236
 			'orderby' => 'ID',
1237 1237
 			'output'  => 'posts',
1238 1238
 			'fields'  => 'ids',
1239
-		) );
1239
+		));
1240 1240
 		$last_payment = $payments->get_payments();
1241 1241
 
1242
-		if ( ! empty( $last_payment ) ) {
1242
+		if ( ! empty($last_payment)) {
1243 1243
 
1244
-			$number = give_get_payment_number( $last_payment[0] );
1244
+			$number = give_get_payment_number($last_payment[0]);
1245 1245
 
1246 1246
 		}
1247 1247
 
1248
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1248
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1249 1249
 
1250
-			$number = give_remove_payment_prefix_postfix( $number );
1250
+			$number = give_remove_payment_prefix_postfix($number);
1251 1251
 
1252 1252
 		} else {
1253 1253
 
@@ -1256,13 +1256,13 @@  discard block
 block discarded – undo
1256 1256
 		}
1257 1257
 	}
1258 1258
 
1259
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1259
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1260 1260
 
1261
-	if ( $increment_number ) {
1262
-		$number ++;
1261
+	if ($increment_number) {
1262
+		$number++;
1263 1263
 	}
1264 1264
 
1265
-	return apply_filters( 'give_get_next_payment_number', $number );
1265
+	return apply_filters('give_get_next_payment_number', $number);
1266 1266
 }
1267 1267
 
1268 1268
 /**
@@ -1274,25 +1274,25 @@  discard block
 block discarded – undo
1274 1274
  *
1275 1275
  * @return string The new Payment number without prefix and postfix.
1276 1276
  */
1277
-function give_remove_payment_prefix_postfix( $number ) {
1277
+function give_remove_payment_prefix_postfix($number) {
1278 1278
 
1279
-	$prefix  = give_get_option( 'sequential_prefix' );
1280
-	$postfix = give_get_option( 'sequential_postfix' );
1279
+	$prefix  = give_get_option('sequential_prefix');
1280
+	$postfix = give_get_option('sequential_postfix');
1281 1281
 
1282 1282
 	// Remove prefix.
1283
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1283
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1284 1284
 
1285 1285
 	// Remove the postfix.
1286
-	$length      = strlen( $number );
1287
-	$postfix_pos = strrpos( $number, $postfix );
1288
-	if ( false !== $postfix_pos ) {
1289
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1286
+	$length      = strlen($number);
1287
+	$postfix_pos = strrpos($number, $postfix);
1288
+	if (false !== $postfix_pos) {
1289
+		$number = substr_replace($number, '', $postfix_pos, $length);
1290 1290
 	}
1291 1291
 
1292 1292
 	// Ensure it's a whole number.
1293
-	$number = intval( $number );
1293
+	$number = intval($number);
1294 1294
 
1295
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1295
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1296 1296
 
1297 1297
 }
1298 1298
 
@@ -1309,10 +1309,10 @@  discard block
 block discarded – undo
1309 1309
  *
1310 1310
  * @return string $amount Fully formatted payment amount.
1311 1311
  */
1312
-function give_payment_amount( $payment_id = 0 ) {
1313
-	$amount = give_get_payment_amount( $payment_id );
1312
+function give_payment_amount($payment_id = 0) {
1313
+	$amount = give_get_payment_amount($payment_id);
1314 1314
 
1315
-	return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) );
1315
+	return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
1316 1316
 }
1317 1317
 
1318 1318
 /**
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
  *
1326 1326
  * @return mixed|void
1327 1327
  */
1328
-function give_get_payment_amount( $payment_id ) {
1328
+function give_get_payment_amount($payment_id) {
1329 1329
 
1330
-	$payment = new Give_Payment( $payment_id );
1330
+	$payment = new Give_Payment($payment_id);
1331 1331
 
1332
-	return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id );
1332
+	return apply_filters('give_payment_amount', floatval($payment->total), $payment_id);
1333 1333
 }
1334 1334
 
1335 1335
 /**
@@ -1346,10 +1346,10 @@  discard block
 block discarded – undo
1346 1346
  *
1347 1347
  * @return array Fully formatted payment subtotal.
1348 1348
  */
1349
-function give_payment_subtotal( $payment_id = 0 ) {
1350
-	$subtotal = give_get_payment_subtotal( $payment_id );
1349
+function give_payment_subtotal($payment_id = 0) {
1350
+	$subtotal = give_get_payment_subtotal($payment_id);
1351 1351
 
1352
-	return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) );
1352
+	return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id));
1353 1353
 }
1354 1354
 
1355 1355
 /**
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
  *
1364 1364
  * @return float $subtotal Subtotal for payment (non formatted).
1365 1365
  */
1366
-function give_get_payment_subtotal( $payment_id = 0 ) {
1367
-	$payment = new G_Payment( $payment_id );
1366
+function give_get_payment_subtotal($payment_id = 0) {
1367
+	$payment = new G_Payment($payment_id);
1368 1368
 
1369 1369
 	return $payment->subtotal;
1370 1370
 }
@@ -1379,10 +1379,10 @@  discard block
 block discarded – undo
1379 1379
  *
1380 1380
  * @return mixed array if payment fees found, false otherwise.
1381 1381
  */
1382
-function give_get_payment_fees( $payment_id = 0, $type = 'all' ) {
1383
-	$payment = new Give_Payment( $payment_id );
1382
+function give_get_payment_fees($payment_id = 0, $type = 'all') {
1383
+	$payment = new Give_Payment($payment_id);
1384 1384
 
1385
-	return $payment->get_fees( $type );
1385
+	return $payment->get_fees($type);
1386 1386
 }
1387 1387
 
1388 1388
 /**
@@ -1394,8 +1394,8 @@  discard block
 block discarded – undo
1394 1394
  *
1395 1395
  * @return string The donation ID.
1396 1396
  */
1397
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1398
-	$payment = new Give_Payment( $payment_id );
1397
+function give_get_payment_transaction_id($payment_id = 0) {
1398
+	$payment = new Give_Payment($payment_id);
1399 1399
 
1400 1400
 	return $payment->transaction_id;
1401 1401
 }
@@ -1410,15 +1410,15 @@  discard block
 block discarded – undo
1410 1410
  *
1411 1411
  * @return bool|mixed
1412 1412
  */
1413
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1413
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1414 1414
 
1415
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1415
+	if (empty($payment_id) || empty($transaction_id)) {
1416 1416
 		return false;
1417 1417
 	}
1418 1418
 
1419
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1419
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1420 1420
 
1421
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1421
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1422 1422
 }
1423 1423
 
1424 1424
 /**
@@ -1431,12 +1431,12 @@  discard block
 block discarded – undo
1431 1431
  *
1432 1432
  * @return int $purchase Donation ID.
1433 1433
  */
1434
-function give_get_purchase_id_by_key( $key ) {
1434
+function give_get_purchase_id_by_key($key) {
1435 1435
 	global $wpdb;
1436 1436
 
1437
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) );
1437
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key));
1438 1438
 
1439
-	if ( $purchase != null ) {
1439
+	if ($purchase != null) {
1440 1440
 		return $purchase;
1441 1441
 	}
1442 1442
 
@@ -1454,12 +1454,12 @@  discard block
 block discarded – undo
1454 1454
  *
1455 1455
  * @return int $purchase Donation ID.
1456 1456
  */
1457
-function give_get_purchase_id_by_transaction_id( $key ) {
1457
+function give_get_purchase_id_by_transaction_id($key) {
1458 1458
 	global $wpdb;
1459 1459
 
1460
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1460
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1461 1461
 
1462
-	if ( $purchase != null ) {
1462
+	if ($purchase != null) {
1463 1463
 		return $purchase;
1464 1464
 	}
1465 1465
 
@@ -1476,19 +1476,19 @@  discard block
 block discarded – undo
1476 1476
  *
1477 1477
  * @return array $notes Donation Notes
1478 1478
  */
1479
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1479
+function give_get_payment_notes($payment_id = 0, $search = '') {
1480 1480
 
1481
-	if ( empty( $payment_id ) && empty( $search ) ) {
1481
+	if (empty($payment_id) && empty($search)) {
1482 1482
 		return false;
1483 1483
 	}
1484 1484
 
1485
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1486
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1485
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1486
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1487 1487
 
1488
-	$notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) );
1488
+	$notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search));
1489 1489
 
1490
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1491
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1490
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1491
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1492 1492
 
1493 1493
 	return $notes;
1494 1494
 }
@@ -1504,8 +1504,8 @@  discard block
 block discarded – undo
1504 1504
  *
1505 1505
  * @return int The new note ID
1506 1506
  */
1507
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1508
-	if ( empty( $payment_id ) ) {
1507
+function give_insert_payment_note($payment_id = 0, $note = '') {
1508
+	if (empty($payment_id)) {
1509 1509
 		return false;
1510 1510
 	}
1511 1511
 
@@ -1517,14 +1517,14 @@  discard block
 block discarded – undo
1517 1517
 	 * @param int $payment_id Payment ID.
1518 1518
 	 * @param string $note The note.
1519 1519
 	 */
1520
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1520
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1521 1521
 
1522
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1522
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1523 1523
 		'comment_post_ID'      => $payment_id,
1524 1524
 		'comment_content'      => $note,
1525 1525
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1526
-		'comment_date'         => current_time( 'mysql' ),
1527
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1526
+		'comment_date'         => current_time('mysql'),
1527
+		'comment_date_gmt'     => current_time('mysql', 1),
1528 1528
 		'comment_approved'     => 1,
1529 1529
 		'comment_parent'       => 0,
1530 1530
 		'comment_author'       => '',
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 		'comment_author_email' => '',
1534 1534
 		'comment_type'         => 'give_payment_note',
1535 1535
 
1536
-	) ) );
1536
+	)));
1537 1537
 
1538 1538
 	/**
1539 1539
 	 * Fires after payment note inserted.
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 	 * @param int $payment_id Payment ID.
1545 1545
 	 * @param string $note The note.
1546 1546
 	 */
1547
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1547
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1548 1548
 
1549 1549
 	return $note_id;
1550 1550
 }
@@ -1559,8 +1559,8 @@  discard block
 block discarded – undo
1559 1559
  *
1560 1560
  * @return bool True on success, false otherwise.
1561 1561
  */
1562
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1563
-	if ( empty( $comment_id ) ) {
1562
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1563
+	if (empty($comment_id)) {
1564 1564
 		return false;
1565 1565
 	}
1566 1566
 
@@ -1572,9 +1572,9 @@  discard block
 block discarded – undo
1572 1572
 	 * @param int $comment_id Note ID.
1573 1573
 	 * @param int $payment_id Payment ID.
1574 1574
 	 */
1575
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1575
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1576 1576
 
1577
-	$ret = wp_delete_comment( $comment_id, true );
1577
+	$ret = wp_delete_comment($comment_id, true);
1578 1578
 
1579 1579
 	/**
1580 1580
 	 * Fires after donation note deleted.
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 	 * @param int $comment_id Note ID.
1585 1585
 	 * @param int $payment_id Payment ID.
1586 1586
 	 */
1587
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1587
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1588 1588
 
1589 1589
 	return $ret;
1590 1590
 }
@@ -1599,34 +1599,34 @@  discard block
 block discarded – undo
1599 1599
  *
1600 1600
  * @return string
1601 1601
  */
1602
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1602
+function give_get_payment_note_html($note, $payment_id = 0) {
1603 1603
 
1604
-	if ( is_numeric( $note ) ) {
1605
-		$note = get_comment( $note );
1604
+	if (is_numeric($note)) {
1605
+		$note = get_comment($note);
1606 1606
 	}
1607 1607
 
1608
-	if ( ! empty( $note->user_id ) ) {
1609
-		$user = get_userdata( $note->user_id );
1608
+	if ( ! empty($note->user_id)) {
1609
+		$user = get_userdata($note->user_id);
1610 1610
 		$user = $user->display_name;
1611 1611
 	} else {
1612
-		$user = esc_html__( 'System', 'give' );
1612
+		$user = esc_html__('System', 'give');
1613 1613
 	}
1614 1614
 
1615
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1615
+	$date_format = give_date_format().', '.get_option('time_format');
1616 1616
 
1617
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1617
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1618 1618
 		'give-action' => 'delete_payment_note',
1619 1619
 		'note_id'     => $note->comment_ID,
1620 1620
 		'payment_id'  => $payment_id,
1621
-	) ),
1622
-		'give_delete_payment_note_' . $note->comment_ID
1621
+	)),
1622
+		'give_delete_payment_note_'.$note->comment_ID
1623 1623
 	);
1624 1624
 
1625
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1625
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1626 1626
 	$note_html .= '<p>';
1627
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1627
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1628 1628
 	$note_html .= $note->comment_content;
1629
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . esc_attr__( 'Delete this donation note.', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
1629
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.esc_attr__('Delete this donation note.', 'give').'">'.esc_html__('Delete', 'give').'</a>';
1630 1630
 	$note_html .= '</p>';
1631 1631
 	$note_html .= '</div>';
1632 1632
 
@@ -1644,18 +1644,18 @@  discard block
 block discarded – undo
1644 1644
  *
1645 1645
  * @return void
1646 1646
  */
1647
-function give_hide_payment_notes( $query ) {
1648
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1649
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1650
-		if ( ! is_array( $types ) ) {
1651
-			$types = array( $types );
1647
+function give_hide_payment_notes($query) {
1648
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1649
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1650
+		if ( ! is_array($types)) {
1651
+			$types = array($types);
1652 1652
 		}
1653 1653
 		$types[]                           = 'give_payment_note';
1654 1654
 		$query->query_vars['type__not_in'] = $types;
1655 1655
 	}
1656 1656
 }
1657 1657
 
1658
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1658
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1659 1659
 
1660 1660
 /**
1661 1661
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1667,15 +1667,15 @@  discard block
 block discarded – undo
1667 1667
  *
1668 1668
  * @return array $clauses Updated comment clauses.
1669 1669
  */
1670
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1671
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1670
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1671
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1672 1672
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1673 1673
 	}
1674 1674
 
1675 1675
 	return $clauses;
1676 1676
 }
1677 1677
 
1678
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1678
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1679 1679
 
1680 1680
 
1681 1681
 /**
@@ -1688,15 +1688,15 @@  discard block
 block discarded – undo
1688 1688
  *
1689 1689
  * @return string $where
1690 1690
  */
1691
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1691
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1692 1692
 	global $wpdb;
1693 1693
 
1694
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1694
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1695 1695
 
1696 1696
 	return $where;
1697 1697
 }
1698 1698
 
1699
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1699
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1700 1700
 
1701 1701
 
1702 1702
 /**
@@ -1710,32 +1710,32 @@  discard block
 block discarded – undo
1710 1710
  *
1711 1711
  * @return array Array of comment counts.
1712 1712
  */
1713
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1713
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1714 1714
 	global $wpdb, $pagenow;
1715 1715
 
1716
-	if ( 'index.php' != $pagenow ) {
1716
+	if ('index.php' != $pagenow) {
1717 1717
 		return $stats;
1718 1718
 	}
1719 1719
 
1720 1720
 	$post_id = (int) $post_id;
1721 1721
 
1722
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1722
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1723 1723
 		return $stats;
1724 1724
 	}
1725 1725
 
1726
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1726
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1727 1727
 
1728
-	if ( false !== $stats ) {
1728
+	if (false !== $stats) {
1729 1729
 		return $stats;
1730 1730
 	}
1731 1731
 
1732 1732
 	$where = 'WHERE comment_type != "give_payment_note"';
1733 1733
 
1734
-	if ( $post_id > 0 ) {
1735
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1734
+	if ($post_id > 0) {
1735
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1736 1736
 	}
1737 1737
 
1738
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1738
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1739 1739
 
1740 1740
 	$total    = 0;
1741 1741
 	$approved = array(
@@ -1745,30 +1745,30 @@  discard block
 block discarded – undo
1745 1745
 		'trash'        => 'trash',
1746 1746
 		'post-trashed' => 'post-trashed',
1747 1747
 	);
1748
-	foreach ( (array) $count as $row ) {
1748
+	foreach ((array) $count as $row) {
1749 1749
 		// Don't count post-trashed toward totals.
1750
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1750
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1751 1751
 			$total += $row['num_comments'];
1752 1752
 		}
1753
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1754
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1753
+		if (isset($approved[$row['comment_approved']])) {
1754
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1755 1755
 		}
1756 1756
 	}
1757 1757
 
1758 1758
 	$stats['total_comments'] = $total;
1759
-	foreach ( $approved as $key ) {
1760
-		if ( empty( $stats[ $key ] ) ) {
1761
-			$stats[ $key ] = 0;
1759
+	foreach ($approved as $key) {
1760
+		if (empty($stats[$key])) {
1761
+			$stats[$key] = 0;
1762 1762
 		}
1763 1763
 	}
1764 1764
 
1765 1765
 	$stats = (object) $stats;
1766
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1766
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1767 1767
 
1768 1768
 	return $stats;
1769 1769
 }
1770 1770
 
1771
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1771
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1772 1772
 
1773 1773
 
1774 1774
 /**
@@ -1781,9 +1781,9 @@  discard block
 block discarded – undo
1781 1781
  *
1782 1782
  * @return string $where Modified where clause.
1783 1783
  */
1784
-function give_filter_where_older_than_week( $where = '' ) {
1784
+function give_filter_where_older_than_week($where = '') {
1785 1785
 	// Payments older than one week.
1786
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1786
+	$start = date('Y-m-d', strtotime('-7 days'));
1787 1787
 	$where .= " AND post_date <= '{$start}'";
1788 1788
 
1789 1789
 	return $where;
@@ -1803,38 +1803,38 @@  discard block
 block discarded – undo
1803 1803
  *
1804 1804
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1805 1805
  */
1806
-function give_get_payment_form_title( $payment_meta, $only_level = false, $separator = '' ) {
1806
+function give_get_payment_form_title($payment_meta, $only_level = false, $separator = '') {
1807 1807
 
1808
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1809
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1810
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1808
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1809
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1810
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1811 1811
 
1812
-	if ( $only_level == true ) {
1812
+	if ($only_level == true) {
1813 1813
 		$form_title = '';
1814 1814
 	}
1815 1815
 
1816 1816
 	//If multi-level, append to the form title.
1817
-	if ( give_has_variable_prices( $form_id ) ) {
1817
+	if (give_has_variable_prices($form_id)) {
1818 1818
 
1819 1819
 		//Only add separator if there is a form title.
1820
-		if ( ! empty( $form_title ) ) {
1821
-			$form_title .= ' ' . $separator . ' ';
1820
+		if ( ! empty($form_title)) {
1821
+			$form_title .= ' '.$separator.' ';
1822 1822
 		}
1823 1823
 
1824 1824
 		$form_title .= '<span class="donation-level-text-wrap">';
1825 1825
 
1826
-		if ( $price_id == 'custom' ) {
1827
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
1828
-			$form_title         .= ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1826
+		if ($price_id == 'custom') {
1827
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
1828
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1829 1829
 		} else {
1830
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1830
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1831 1831
 		}
1832 1832
 
1833 1833
 		$form_title .= '</span>';
1834 1834
 
1835 1835
 	}
1836 1836
 
1837
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1837
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1838 1838
 
1839 1839
 }
1840 1840
 
@@ -1848,20 +1848,20 @@  discard block
 block discarded – undo
1848 1848
  *
1849 1849
  * @return string $price_id
1850 1850
  */
1851
-function give_get_price_id( $form_id, $price ) {
1851
+function give_get_price_id($form_id, $price) {
1852 1852
 
1853 1853
 	$price_id = 0;
1854 1854
 
1855
-	if ( give_has_variable_prices( $form_id ) ) {
1855
+	if (give_has_variable_prices($form_id)) {
1856 1856
 
1857
-		$levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1857
+		$levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1858 1858
 
1859
-		foreach ( $levels as $level ) {
1859
+		foreach ($levels as $level) {
1860 1860
 
1861
-			$level_amount = (float) give_sanitize_amount( $level['_give_amount'] );
1861
+			$level_amount = (float) give_sanitize_amount($level['_give_amount']);
1862 1862
 
1863 1863
 			// Check that this indeed the recurring price.
1864
-			if ( $level_amount == $price ) {
1864
+			if ($level_amount == $price) {
1865 1865
 
1866 1866
 				$price_id = $level['_give_id']['level_id'];
1867 1867
 
@@ -1886,10 +1886,10 @@  discard block
 block discarded – undo
1886 1886
  *
1887 1887
  * @return string|void
1888 1888
  */
1889
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1890
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1889
+function give_get_form_dropdown($args = array(), $echo = false) {
1890
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1891 1891
 
1892
-	if ( ! $echo ) {
1892
+	if ( ! $echo) {
1893 1893
 		return $form_dropdown_html;
1894 1894
 	}
1895 1895
 
@@ -1906,17 +1906,17 @@  discard block
 block discarded – undo
1906 1906
  *
1907 1907
  * @return string|bool
1908 1908
  */
1909
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1909
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1910 1910
 
1911 1911
 	// Check for give form id.
1912
-	if ( empty( $args['id'] ) ) {
1912
+	if (empty($args['id'])) {
1913 1913
 		return false;
1914 1914
 	}
1915 1915
 
1916
-	$form = new Give_Donate_Form( $args['id'] );
1916
+	$form = new Give_Donate_Form($args['id']);
1917 1917
 
1918 1918
 	// Check if form has variable prices or not.
1919
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1919
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1920 1920
 		return false;
1921 1921
 	}
1922 1922
 
@@ -1924,22 +1924,22 @@  discard block
 block discarded – undo
1924 1924
 	$variable_price_options = array();
1925 1925
 
1926 1926
 	// Check if multi donation form support custom donation or not.
1927
-	if ( $form->is_custom_price_mode() ) {
1928
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1927
+	if ($form->is_custom_price_mode()) {
1928
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1929 1929
 	}
1930 1930
 
1931 1931
 	// Get variable price and ID from variable price array.
1932
-	foreach ( $variable_prices as $variable_price ) {
1933
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'] ) );
1932
+	foreach ($variable_prices as $variable_price) {
1933
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount']));
1934 1934
 	}
1935 1935
 
1936 1936
 	// Update options.
1937
-	$args = array_merge( $args, array( 'options' => $variable_price_options ) );
1937
+	$args = array_merge($args, array('options' => $variable_price_options));
1938 1938
 
1939 1939
 	// Generate select html.
1940
-	$form_dropdown_html = Give()->html->select( $args );
1940
+	$form_dropdown_html = Give()->html->select($args);
1941 1941
 
1942
-	if ( ! $echo ) {
1942
+	if ( ! $echo) {
1943 1943
 		return $form_dropdown_html;
1944 1944
 	}
1945 1945
 
@@ -1958,16 +1958,16 @@  discard block
 block discarded – undo
1958 1958
  *
1959 1959
  * @return string
1960 1960
  */
1961
-function give_get_payment_meta_price_id( $payment_meta ) {
1961
+function give_get_payment_meta_price_id($payment_meta) {
1962 1962
 
1963
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1963
+	if (isset($payment_meta['give_price_id'])) {
1964 1964
 		$price_id = $payment_meta['give_price_id'];
1965
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1965
+	} elseif (isset($payment_meta['price_id'])) {
1966 1966
 		$price_id = $payment_meta['price_id'];
1967 1967
 	} else {
1968
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1968
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1969 1969
 	}
1970 1970
 
1971
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id );
1971
+	return apply_filters('give_get_payment_meta_price_id', $price_id);
1972 1972
 
1973 1973
 }
1974 1974
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-session.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -74,57 +74,57 @@  discard block
 block discarded – undo
74 74
 	public function __construct() {
75 75
 
76 76
 		$this->use_php_sessions = $this->use_php_sessions();
77
-		$this->exp_option       = give_get_option( 'session_lifetime' );
77
+		$this->exp_option       = give_get_option('session_lifetime');
78 78
 
79 79
 		// PHP Sessions.
80
-		if ( $this->use_php_sessions ) {
80
+		if ($this->use_php_sessions) {
81 81
 
82
-			if ( is_multisite() ) {
82
+			if (is_multisite()) {
83 83
 
84
-				$this->prefix = '_' . get_current_blog_id();
84
+				$this->prefix = '_'.get_current_blog_id();
85 85
 
86 86
 			}
87 87
 
88
-			add_action( 'init', array( $this, 'maybe_start_session' ), - 2 );
88
+			add_action('init', array($this, 'maybe_start_session'), - 2);
89 89
 
90 90
 		} else {
91 91
 
92
-			if ( ! $this->should_start_session() ) {
92
+			if ( ! $this->should_start_session()) {
93 93
 				return;
94 94
 			}
95 95
 
96 96
 			// Use WP_Session.
97
-			if ( ! defined( 'WP_SESSION_COOKIE' ) ) {
98
-				define( 'WP_SESSION_COOKIE', 'give_wp_session' );
97
+			if ( ! defined('WP_SESSION_COOKIE')) {
98
+				define('WP_SESSION_COOKIE', 'give_wp_session');
99 99
 			}
100 100
 
101
-			if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
102
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php';
101
+			if ( ! class_exists('Recursive_ArrayAccess')) {
102
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php';
103 103
 			}
104 104
 
105 105
 			// Include utilities class
106
-			if ( ! class_exists( 'WP_Session_Utils' ) ) {
107
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session-utils.php';
106
+			if ( ! class_exists('WP_Session_Utils')) {
107
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session-utils.php';
108 108
 			}
109
-			if ( ! class_exists( 'WP_Session' ) ) {
110
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php';
111
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php';
109
+			if ( ! class_exists('WP_Session')) {
110
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php';
111
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php';
112 112
 			}
113 113
 
114
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
115
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
114
+			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999);
115
+			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999);
116 116
 
117 117
 		}
118 118
 
119 119
 		// Init Session.
120
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
121
-			add_action( 'plugins_loaded', array( $this, 'init' ), - 1 );
120
+		if (empty($this->session) && ! $this->use_php_sessions) {
121
+			add_action('plugins_loaded', array($this, 'init'), - 1);
122 122
 		} else {
123
-			add_action( 'init', array( $this, 'init' ), - 1 );
123
+			add_action('init', array($this, 'init'), - 1);
124 124
 		}
125 125
 
126 126
 		// Set cookie on Donation Completion page.
127
-		add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) );
127
+		add_action('give_pre_process_donation', array($this, 'set_session_cookies'));
128 128
 
129 129
 	}
130 130
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function init() {
142 142
 
143
-		if ( $this->use_php_sessions ) {
144
-			$this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array();
143
+		if ($this->use_php_sessions) {
144
+			$this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array();
145 145
 		} else {
146 146
 			$this->session = WP_Session::get_instance();
147 147
 		}
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string      Session variable.
178 178
 	 */
179
-	public function get( $key ) {
180
-		$key = sanitize_key( $key );
179
+	public function get($key) {
180
+		$key = sanitize_key($key);
181 181
 
182
-		return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
182
+		return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false;
183 183
 
184 184
 	}
185 185
 
@@ -196,21 +196,21 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return string        Session variable.
198 198
 	 */
199
-	public function set( $key, $value ) {
199
+	public function set($key, $value) {
200 200
 
201
-		$key = sanitize_key( $key );
201
+		$key = sanitize_key($key);
202 202
 
203
-		if ( is_array( $value ) ) {
204
-			$this->session[ $key ] = serialize( $value );
203
+		if (is_array($value)) {
204
+			$this->session[$key] = serialize($value);
205 205
 		} else {
206
-			$this->session[ $key ] = $value;
206
+			$this->session[$key] = $value;
207 207
 		}
208 208
 
209
-		if ( $this->use_php_sessions ) {
210
-			$_SESSION[ 'give' . $this->prefix ] = $this->session;
209
+		if ($this->use_php_sessions) {
210
+			$_SESSION['give'.$this->prefix] = $this->session;
211 211
 		}
212 212
 
213
-		return $this->session[ $key ];
213
+		return $this->session[$key];
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 	 * @hook
225 225
 	 */
226 226
 	public function set_session_cookies() {
227
-		if ( ! headers_sent() ) {
228
-			$lifetime = current_time( 'timestamp' ) + $this->set_expiration_time();
229
-			@setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
230
-			@setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
227
+		if ( ! headers_sent()) {
228
+			$lifetime = current_time('timestamp') + $this->set_expiration_time();
229
+			@setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
230
+			@setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
231 231
 		}
232 232
 	}
233 233
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	public function set_expiration_variant_time() {
245 245
 
246
-		return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 );
246
+		return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23);
247 247
 	}
248 248
 
249 249
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function set_expiration_time() {
260 260
 
261
-		return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 );
261
+		return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24);
262 262
 	}
263 263
 
264 264
 	/**
@@ -276,21 +276,21 @@  discard block
 block discarded – undo
276 276
 		$ret = false;
277 277
 
278 278
 		// If the database variable is already set, no need to run auto detection.
279
-		$give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' );
279
+		$give_use_php_sessions = (bool) get_option('give_use_php_sessions');
280 280
 
281
-		if ( ! $give_use_php_sessions ) {
281
+		if ( ! $give_use_php_sessions) {
282 282
 
283 283
 			// Attempt to detect if the server supports PHP sessions.
284
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
284
+			if (function_exists('session_start') && ! ini_get('safe_mode')) {
285 285
 
286
-				$this->set( 'give_use_php_sessions', 1 );
286
+				$this->set('give_use_php_sessions', 1);
287 287
 
288
-				if ( $this->get( 'give_use_php_sessions' ) ) {
288
+				if ($this->get('give_use_php_sessions')) {
289 289
 
290 290
 					$ret = true;
291 291
 
292 292
 					// Set the database option.
293
-					update_option( 'give_use_php_sessions', true );
293
+					update_option('give_use_php_sessions', true);
294 294
 
295 295
 				}
296 296
 			}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 		}
301 301
 
302 302
 		// Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant.
303
-		if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) {
303
+		if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) {
304 304
 			$ret = true;
305
-		} elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) {
305
+		} elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) {
306 306
 			$ret = false;
307 307
 		}
308 308
 
309
-		return (bool) apply_filters( 'give_use_php_sessions', $ret );
309
+		return (bool) apply_filters('give_use_php_sessions', $ret);
310 310
 	}
311 311
 
312 312
 	/**
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 
324 324
 		$start_session = true;
325 325
 
326
-		if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
326
+		if ( ! empty($_SERVER['REQUEST_URI'])) {
327 327
 
328
-			$blacklist = apply_filters( 'give_session_start_uri_blacklist', array(
328
+			$blacklist = apply_filters('give_session_start_uri_blacklist', array(
329 329
 				'feed',
330 330
 				'feed',
331 331
 				'feed/rss',
@@ -333,21 +333,21 @@  discard block
 block discarded – undo
333 333
 				'feed/rdf',
334 334
 				'feed/atom',
335 335
 				'comments/feed/',
336
-			) );
337
-			$uri       = ltrim( $_SERVER['REQUEST_URI'], '/' );
338
-			$uri       = untrailingslashit( $uri );
339
-			if ( in_array( $uri, $blacklist ) ) {
336
+			));
337
+			$uri       = ltrim($_SERVER['REQUEST_URI'], '/');
338
+			$uri       = untrailingslashit($uri);
339
+			if (in_array($uri, $blacklist)) {
340 340
 				$start_session = false;
341 341
 			}
342
-			if ( false !== strpos( $uri, 'feed=' ) ) {
342
+			if (false !== strpos($uri, 'feed=')) {
343 343
 				$start_session = false;
344 344
 			}
345
-			if ( is_admin() ) {
345
+			if (is_admin()) {
346 346
 				$start_session = false;
347 347
 			}
348 348
 		}
349 349
 
350
-		return apply_filters( 'give_start_session', $start_session );
350
+		return apply_filters('give_start_session', $start_session);
351 351
 	}
352 352
 
353 353
 	/**
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	public function maybe_start_session() {
365 365
 
366
-		if ( ! $this->should_start_session() ) {
366
+		if ( ! $this->should_start_session()) {
367 367
 			return;
368 368
 		}
369 369
 
370
-		if ( ! session_id() && ! headers_sent() ) {
370
+		if ( ! session_id() && ! headers_sent()) {
371 371
 			session_start();
372 372
 		}
373 373
 
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$expiration = false;
388 388
 
389
-		if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) {
389
+		if (session_id() && isset($_COOKIE[session_name().'_expiration'])) {
390 390
 
391
-			$expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) );
391
+			$expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration']));
392 392
 
393 393
 		}
394 394
 
Please login to merge, or discard this patch.