Test Failed
Push — master ( 044ad2...ad363d )
by Devin
10:39 queued 05:12
created
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 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,10 +100,10 @@  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
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
 		<h2 class="nav-tab-wrapper">
121 121
 			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
 			</a>
125 125
 			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
 			</a>
129 129
 			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
 			</a>
133 133
 			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-			   href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+			   href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
 			</a>
137 137
 		</h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
 		<div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 			<p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: http://docs.givewp.com/docs */
158
-					__( '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' ),
159
-					esc_url( 'http://docs.givewp.com/docs' )
158
+					__('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'),
159
+					esc_url('http://docs.givewp.com/docs')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			<div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 			<div class="feature-section clearfix introduction">
176 176
 
177 177
 				<div class="video feature-section-item">
178
-					<img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
-						 alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+					<img src="<?php echo GIVE_PLUGIN_URL.'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
+						 alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
 				</div>
181 181
 
182 182
 				<div class="content feature-section-item last-feature">
183 183
 
184
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-					<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>
186
+					<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>
187 187
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
 						<span class="dashicons dashicons-external"></span>
190 190
 					</a>
191 191
 
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 
199 199
 				<div class="content feature-section-item">
200 200
 
201
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-					<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 a 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>
203
+					<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 a 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>
204 204
 
205 205
 					<h4>Find Out More:</h4>
206 206
 					<ul class="ul-disc">
207 207
 						<li><a href="https://givewp.com/"
208
-							   target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
+							   target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
209 209
 						<li><a href="https://givewp.com/features/"
210
-							   target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
210
+							   target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
211 211
 						<li><a href="https://givewp.com/documentation/"
212
-							   target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
212
+							   target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
213 213
 					</ul>
214 214
 
215 215
 				</div>
216 216
 
217 217
 				<div class="content  feature-section-item last-feature">
218
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>"
219
-						 alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
218
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/dist/images/admin/give-form-mockup.png' ?>"
219
+						 alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
220 220
 				</div>
221 221
 
222 222
 			</div>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return void
236 236
 	 */
237 237
 	public function changelog_screen() {
238
-		list( $display_version ) = explode( '-', GIVE_VERSION );
238
+		list($display_version) = explode('-', GIVE_VERSION);
239 239
 		?>
240 240
 		<div class="wrap about-wrap">
241 241
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 			<p class="about-text"><?php
244 244
 				printf(
245 245
 				/* translators: %s: Give version */
246
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
246
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
247 247
 					$display_version
248 248
 				);
249 249
 				?></p>
250 250
 			<div class="give-badge"><?php
251 251
 				printf(
252 252
 				/* translators: %s: Give version */
253
-					esc_html__( 'Version %s', 'give' ),
253
+					esc_html__('Version %s', 'give'),
254 254
 					$display_version
255 255
 				);
256 256
 				?></div>
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			<?php $this->tabs(); ?>
259 259
 
260 260
 			<div class="changelog">
261
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
261
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
262 262
 
263 263
 				<div class="feature-section">
264 264
 					<?php echo $this->parse_readme(); ?>
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 			</div>
267 267
 
268 268
 			<div class="return-to-dashboard">
269
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
269
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
270 270
 					'post_type' => 'give_forms',
271 271
 					'page'      => 'give-settings'
272
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
272
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
273 273
 			</div>
274 274
 		</div>
275 275
 		<?php
@@ -283,36 +283,36 @@  discard block
 block discarded – undo
283 283
 	 * @return void
284 284
 	 */
285 285
 	public function getting_started_screen() {
286
-		list( $display_version ) = explode( '-', GIVE_VERSION );
286
+		list($display_version) = explode('-', GIVE_VERSION);
287 287
 		?>
288 288
 		<div class="wrap about-wrap get-started">
289 289
 
290 290
 			<?php $this->get_welcome_header() ?>
291 291
 
292
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
292
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
293 293
 
294 294
 			<?php give_get_newsletter(); ?>
295 295
 
296 296
 			<div class="give-badge"><?php
297 297
 				printf(
298 298
 				/* translators: %s: Give version */
299
-					esc_html__( 'Version %s', 'give' ),
299
+					esc_html__('Version %s', 'give'),
300 300
 					$display_version
301 301
 				);
302 302
 				?></div>
303 303
 
304 304
 			<?php $this->tabs(); ?>
305 305
 
306
-			<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>
306
+			<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>
307 307
 
308 308
 			<div class="feature-section clearfix">
309 309
 
310 310
 				<div class="content feature-section-item">
311
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
311
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
312 312
 
313
-					<p><?php esc_html_e( 'Give is driven by its 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>
313
+					<p><?php esc_html_e('Give is driven by its 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>
314 314
 
315
-					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p>
315
+					<p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give'); ?></p>
316 316
 				</div>
317 317
 
318 318
 				<div class="content feature-section-item last-feature">
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 				</div>
330 330
 
331 331
 				<div class="content feature-section-item last-feature">
332
-					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
332
+					<h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
333 333
 
334
-					<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>
334
+					<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>
335 335
 				</div>
336 336
 
337 337
 			</div>
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 			<div class="feature-section clearfix">
341 341
 
342 342
 				<div class="content feature-section-item add-content">
343
-					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
343
+					<h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
344 344
 
345
-					<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>
345
+					<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>
346 346
 
347
-					<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>
347
+					<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>
348 348
 				</div>
349 349
 
350 350
 				<div class="content feature-section-item last-feature">
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 				</div>
362 362
 
363 363
 				<div class="content feature-section-item last-feature">
364
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
364
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
365 365
 
366
-					<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>
366
+					<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>
367 367
 				</div>
368 368
 
369 369
 
@@ -383,20 +383,20 @@  discard block
 block discarded – undo
383 383
 	 * @return void
384 384
 	 */
385 385
 	public function credits_screen() {
386
-		list( $display_version ) = explode( '-', GIVE_VERSION );
386
+		list($display_version) = explode('-', GIVE_VERSION);
387 387
 		?>
388 388
 		<div class="wrap about-wrap">
389 389
 
390 390
 			<?php $this->get_welcome_header() ?>
391 391
 
392
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
392
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
393 393
 
394 394
 			<?php give_get_newsletter(); ?>
395 395
 
396 396
 			<div class="give-badge"><?php
397 397
 				printf(
398 398
 				/* translators: %s: Give version */
399
-					esc_html__( 'Version %s', 'give' ),
399
+					esc_html__('Version %s', 'give'),
400 400
 					$display_version
401 401
 				);
402 402
 				?></div>
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 			<p class="about-description"><?php
407 407
 				printf(
408 408
 				/* translators: %s: https://github.com/WordImpress/give */
409
-					__( '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' ),
410
-					esc_url( 'https://github.com/WordImpress/give' )
409
+					__('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'),
410
+					esc_url('https://github.com/WordImpress/give')
411 411
 				);
412 412
 				?></p>
413 413
 
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 	 * @return string $readme HTML formatted readme file
425 425
 	 */
426 426
 	public function parse_readme() {
427
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
427
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
428 428
 
429
-		if ( ! $file ) {
430
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
429
+		if ( ! $file) {
430
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
431 431
 		} else {
432
-			$readme = file_get_contents( $file );
433
-			$readme = nl2br( esc_html( $readme ) );
434
-			$readme = explode( '== Changelog ==', $readme );
435
-			$readme = end( $readme );
436
-
437
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
438
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
439
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
440
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
441
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
432
+			$readme = file_get_contents($file);
433
+			$readme = nl2br(esc_html($readme));
434
+			$readme = explode('== Changelog ==', $readme);
435
+			$readme = end($readme);
436
+
437
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
438
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
439
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
440
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
441
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
442 442
 		}
443 443
 
444 444
 		return $readme;
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
 	public function contributors() {
456 456
 		$contributors = $this->get_contributors();
457 457
 
458
-		if ( empty( $contributors ) ) {
458
+		if (empty($contributors)) {
459 459
 			return '';
460 460
 		}
461 461
 
462 462
 		$contributor_list = '<ul class="wp-people-group">';
463 463
 
464
-		foreach ( $contributors as $contributor ) {
464
+		foreach ($contributors as $contributor) {
465 465
 			$contributor_list .= '<li class="wp-person">';
466 466
 			$contributor_list .= sprintf(
467 467
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
468
-				esc_url( 'https://github.com/' . $contributor->login ),
469
-				esc_url( $contributor->avatar_url ),
470
-				esc_attr( $contributor->login )
468
+				esc_url('https://github.com/'.$contributor->login),
469
+				esc_url($contributor->avatar_url),
470
+				esc_attr($contributor->login)
471 471
 			);
472 472
 			$contributor_list .= sprintf(
473 473
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
474
-				esc_url( 'https://github.com/' . $contributor->login ),
475
-				esc_html( $contributor->login )
474
+				esc_url('https://github.com/'.$contributor->login),
475
+				esc_html($contributor->login)
476 476
 			);
477 477
 			$contributor_list .= '</li>';
478 478
 		}
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 	 * @return array $contributors List of contributors
491 491
 	 */
492 492
 	public function get_contributors() {
493
-		$contributors = Give_Cache::get( 'give_contributors', true );
493
+		$contributors = Give_Cache::get('give_contributors', true);
494 494
 
495
-		if ( false !== $contributors ) {
495
+		if (false !== $contributors) {
496 496
 			return $contributors;
497 497
 		}
498 498
 
499
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
499
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
500 500
 
501
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
501
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
502 502
 			return array();
503 503
 		}
504 504
 
505
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
505
+		$contributors = json_decode(wp_remote_retrieve_body($response));
506 506
 
507
-		if ( ! is_array( $contributors ) ) {
507
+		if ( ! is_array($contributors)) {
508 508
 			return array();
509 509
 		}
510 510
 
511
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
511
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
512 512
 
513 513
 		return $contributors;
514 514
 	}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function get_welcome_header() {
522 522
 		// Badge for welcome page
523
-		$badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png';
523
+		$badge_url = GIVE_PLUGIN_URL.'assets/dist/images/give-badge.png';
524 524
 		?>
525 525
 		<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
526 526
 		<?php $this->social_media_elements(); ?>
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 			<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
614 614
 				printf(
615 615
 				/* translators: %s: Give twitter user @givewp */
616
-					esc_html_e( 'Follow %s', 'give' ),
616
+					esc_html_e('Follow %s', 'give'),
617 617
 					'@givewp'
618 618
 				);
619 619
 				?></a>
@@ -647,27 +647,27 @@  discard block
 block discarded – undo
647 647
 	public function welcome() {
648 648
 
649 649
 		// Bail if no activation redirect
650
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) {
650
+		if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) {
651 651
 			return;
652 652
 		}
653 653
 
654 654
 		// Delete the redirect transient
655
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
655
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
656 656
 
657 657
 		// Bail if activating from network, or bulk
658
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
658
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
659 659
 			return;
660 660
 		}
661 661
 
662
-		$upgrade = get_option( 'give_version_upgraded_from' );
662
+		$upgrade = get_option('give_version_upgraded_from');
663 663
 
664
-		if ( ! $upgrade ) { // First time install
665
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
664
+		if ( ! $upgrade) { // First time install
665
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
666 666
 			exit;
667
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
667
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
668 668
 
669 669
 		} else { // Welcome is NOT disabled in settings
670
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
670
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
671 671
 			exit;
672 672
 		}
673 673
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notification-table.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 * @access public
37 37
 	 */
38 38
 	public function __construct() {
39
-		parent::__construct( array(
40
-			'singular' => __( 'Give Email Notification', 'give' ),
41
-			'plural'   => __( 'Give Email Notifications', 'give' ),
42
-		) );
39
+		parent::__construct(array(
40
+			'singular' => __('Give Email Notification', 'give'),
41
+			'plural'   => __('Give Email Notifications', 'give'),
42
+		));
43 43
 
44 44
 		$this->email_notifications = Give_Email_Notifications::get_instance();
45 45
 	}
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 2.0
61 61
 		 */
62
-		return apply_filters( 'give_email_notification_setting_columns', array(
63
-			'cb'         => __( 'Email Status', 'give' ),
64
-			'name'       => __( 'Email', 'give' ),
65
-			'email_type' => __( 'Content Type', 'give' ),
66
-			'recipient'  => __( 'Recipient(s)', 'give' ),
67
-			'setting'    => __( 'Edit Email', 'give' ),
68
-		) );
62
+		return apply_filters('give_email_notification_setting_columns', array(
63
+			'cb'         => __('Email Status', 'give'),
64
+			'name'       => __('Email', 'give'),
65
+			'email_type' => __('Content Type', 'give'),
66
+			'recipient'  => __('Recipient(s)', 'give'),
67
+			'setting'    => __('Edit Email', 'give'),
68
+		));
69 69
 	}
70 70
 
71 71
 	/**
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return  string
80 80
 	 */
81
-	public function column_name( $email ) {
82
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
83
-		$actions  = $this->get_row_actions( $email );
81
+	public function column_name($email) {
82
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
83
+		$actions  = $this->get_row_actions($email);
84 84
 
85 85
 		ob_start();
86 86
 		?>
87 87
 		<a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a>
88 88
 
89
-		<?php if ( $desc = $email->config['description'] ) : ?>
90
-			<?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?>
89
+		<?php if ($desc = $email->config['description']) : ?>
90
+			<?php echo Give()->tooltips->render_help(esc_attr($desc)); ?>
91 91
 		<?php endif; ?>
92 92
 
93
-		<?php echo $this->row_actions( $actions ); ?>
93
+		<?php echo $this->row_actions($actions); ?>
94 94
 		<?php
95 95
 		return ob_get_clean();
96 96
 	}
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string
107 107
 	 */
108
-	public function column_recipient( $email ) {
108
+	public function column_recipient($email) {
109 109
 		ob_start();
110 110
 
111
-		if( Give_Email_Notification_Util::has_recipient_field( $email ) ) {
111
+		if (Give_Email_Notification_Util::has_recipient_field($email)) {
112 112
 			$recipients = $email->get_recipient();
113
-			if ( is_array( $recipients ) ) {
114
-				$recipients = implode( '<br>', $recipients );
113
+			if (is_array($recipients)) {
114
+				$recipients = implode('<br>', $recipients);
115 115
 			}
116 116
 
117 117
 			echo $recipients;
118 118
 
119
-		} elseif ( ! empty( $email->config['recipient_group_name'] ) ) {
119
+		} elseif ( ! empty($email->config['recipient_group_name'])) {
120 120
 			echo $email->config['recipient_group_name'];
121 121
 		}
122 122
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return string
135 135
 	 */
136
-	public function column_cb( $email ) {
136
+	public function column_cb($email) {
137 137
 		$notification_status  = $email->get_notification_status();
138
-		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email );
139
-		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active( $email )
138
+		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email);
139
+		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active($email)
140 140
 			? 'dashicons dashicons-yes'
141 141
 			: 'dashicons dashicons-no-alt';
142 142
 		$attributes           = array(
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 			'data-edit'   => $user_can_edit_status,
147 147
 		);
148 148
 
149
-		if ( ! $user_can_edit_status ) {
150
-			$icon_classes         = 'dashicons dashicons-lock';
149
+		if ( ! $user_can_edit_status) {
150
+			$icon_classes = 'dashicons dashicons-lock';
151 151
 
152
-			$attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] );
152
+			$attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']);
153 153
 		}
154 154
 
155 155
 		$html = sprintf(
156 156
 			'<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>',
157
-			give_get_attribute_str( $attributes ),
157
+			give_get_attribute_str($attributes),
158 158
 			$icon_classes
159 159
 		);
160 160
 
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string
174 174
 	 */
175
-	public function column_email_type( Give_Email_Notification $email ) {
175
+	public function column_email_type(Give_Email_Notification $email) {
176 176
 		$email_content_type_label = apply_filters(
177 177
 			"give_email_list_render_{$email->config['id']}_email_content_type",
178
-			Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ),
178
+			Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']),
179 179
 			$email
180 180
 		);
181 181
 
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string
194 194
 	 */
195
-	public function column_setting( Give_Email_Notification $email ) {
196
-		return Give()->tooltips->render_link( array(
197
-			'label'       => __( 'Edit', 'give' ) . " {$email->config['label']}",
195
+	public function column_setting(Give_Email_Notification $email) {
196
+		return Give()->tooltips->render_link(array(
197
+			'label'       => __('Edit', 'give')." {$email->config['label']}",
198 198
 			'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>',
199
-			'link'        => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) ),
199
+			'link'        => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id'])),
200 200
 			'attributes'  => array(
201 201
 				'class' => 'button button-small',
202 202
 			),
203
-		) );
203
+		));
204 204
 	}
205 205
 
206 206
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return array
216 216
 	 */
217
-	private function get_row_actions( $email ) {
218
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
217
+	private function get_row_actions($email) {
218
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
219 219
 
220 220
 		/**
221 221
 		 * Filter the row actions
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$row_actions = apply_filters(
228 228
 			'give_email_notification_row_actions',
229 229
 			array(
230
-				'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>',
230
+				'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>',
231 231
 			),
232 232
 			$email
233 233
 		);
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 		$hidden                = array();
249 249
 		$email_notifications   = array();
250 250
 		$sortable              = $this->get_sortable_columns();
251
-		$this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() );
251
+		$this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name());
252 252
 
253 253
 		// Set email notifications.
254 254
 		/* @var Give_Email_Notification $email_notification */
255
-		foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) {
256
-			if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) {
255
+		foreach ($this->email_notifications->get_email_notifications() as $email_notification) {
256
+			if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) {
257 257
 				$email_notifications[] = $email_notification;
258 258
 			}
259 259
 		}
260 260
 
261
-		$totalItems  = count( $email_notifications );
261
+		$totalItems  = count($email_notifications);
262 262
 		$this->items = $email_notifications;
263
-		$this->set_pagination_args( array(
263
+		$this->set_pagination_args(array(
264 264
 			'total_items' => $totalItems,
265 265
 			'per_page'    => $this->per_page,
266
-		) );
266
+		));
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @access public
274 274
 	 */
275 275
 	public function no_items() {
276
-		_e( 'No give email notification found.', 'give' );
276
+		_e('No give email notification found.', 'give');
277 277
 	}
278 278
 
279 279
 	/**
Please login to merge, or discard this patch.
includes/admin/emails/class-email-setting-field.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return array
23 23
 	 */
24
-	public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) {
25
-		$setting_fields = self::get_default_setting_fields( $email, $form_id );
24
+	public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) {
25
+		$setting_fields = self::get_default_setting_fields($email, $form_id);
26 26
 
27 27
 		// Recipient field.
28
-		$setting_fields[] = self::get_recipient_setting_field( $email, $form_id, Give_Email_Notification_Util::has_recipient_field( $email ) );
28
+		$setting_fields[] = self::get_recipient_setting_field($email, $form_id, Give_Email_Notification_Util::has_recipient_field($email));
29 29
 
30 30
 		// Add extra setting field.
31
-		if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) {
32
-			$setting_fields = array_merge( $setting_fields, $extra_setting_field );
31
+		if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) {
32
+			$setting_fields = array_merge($setting_fields, $extra_setting_field);
33 33
 		}
34 34
 
35 35
 		// Preview field.
36
-		if ( Give_Email_Notification_Util::has_preview( $email ) ) {
37
-			$setting_fields[] = self::get_preview_setting_field( $email, $form_id );
36
+		if (Give_Email_Notification_Util::has_preview($email)) {
37
+			$setting_fields[] = self::get_preview_setting_field($email, $form_id);
38 38
 		}
39 39
 
40
-		$setting_fields = self::add_section_end( $email, $setting_fields );
40
+		$setting_fields = self::add_section_end($email, $setting_fields);
41 41
 
42 42
 		/**
43 43
 		 * Filter the email notification settings.
44 44
 		 *
45 45
 		 * @since 2.0
46 46
 		 */
47
-		return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id );
47
+		return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id);
48 48
 	}
49 49
 
50 50
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool
60 60
 	 */
61
-	public static function has_section_end( $setting ) {
62
-		$last_field      = end( $setting );
61
+	public static function has_section_end($setting) {
62
+		$last_field      = end($setting);
63 63
 		$has_section_end = false;
64 64
 
65
-		if ( 'sectionend' === $last_field['type'] ) {
65
+		if ('sectionend' === $last_field['type']) {
66 66
 			$has_section_end = true;
67 67
 		}
68 68
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public static function get_section_start( Give_Email_Notification $email, $form_id = null ) {
83
+	public static function get_section_start(Give_Email_Notification $email, $form_id = null) {
84 84
 		// Add section end field.
85 85
 		$setting = array(
86 86
 			'id'    => "give_title_email_settings_{$email->config['id']}",
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public static function add_section_end( Give_Email_Notification $email, $setting ) {
106
-		if ( ! self::has_section_end( $setting ) ) {
105
+	public static function add_section_end(Give_Email_Notification $email, $setting) {
106
+		if ( ! self::has_section_end($setting)) {
107 107
 			// Add section end field.
108 108
 			$setting[] = array(
109 109
 				'id'   => "give_title_email_settings_{$email->config['id']}",
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return array
127 127
 	 */
128
-	public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) {
129
-		$settings[] = self::get_section_start( $email, $form_id );
130
-		$settings[] = self::get_notification_status_field( $email, $form_id );
128
+	public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) {
129
+		$settings[] = self::get_section_start($email, $form_id);
130
+		$settings[] = self::get_notification_status_field($email, $form_id);
131 131
 
132
-		if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) {
133
-			if ( $form_id || give_is_add_new_form_page() ) {
132
+		if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) {
133
+			if ($form_id || give_is_add_new_form_page()) {
134 134
 				// Do not allow admin to disable notification on perform basis.
135
-				unset( $settings[1]['options']['disabled'] );
135
+				unset($settings[1]['options']['disabled']);
136 136
 			} else {
137 137
 				// Do not allow admin to edit notification status globally.
138
-				unset( $settings[1] );
138
+				unset($settings[1]);
139 139
 			}
140 140
 		}
141 141
 
142
-		$settings[] = self::get_email_subject_field( $email, $form_id );
143
-		$settings[] = self::get_email_header_field( $email, $form_id );
144
-		$settings[] = self::get_email_message_field( $email, $form_id );
142
+		$settings[] = self::get_email_subject_field($email, $form_id);
143
+		$settings[] = self::get_email_header_field($email, $form_id);
144
+		$settings[] = self::get_email_message_field($email, $form_id);
145 145
 
146
-		if ( Give_Email_Notification_Util::is_content_type_editable( $email ) ) {
147
-			$settings[] = self::get_email_content_type_field( $email, $form_id );
146
+		if (Give_Email_Notification_Util::is_content_type_editable($email)) {
147
+			$settings[] = self::get_email_content_type_field($email, $form_id);
148 148
 		}
149 149
 
150 150
 		return $settings;
@@ -161,31 +161,31 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return array
163 163
 	 */
164
-	public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) {
164
+	public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) {
165 165
 		$option = array(
166
-			'enabled'  => __( 'Enabled', 'give' ),
167
-			'disabled' => __( 'Disabled', 'give' ),
166
+			'enabled'  => __('Enabled', 'give'),
167
+			'disabled' => __('Disabled', 'give'),
168 168
 		);
169 169
 
170 170
 		$default_value = $email->get_notification_status();
171 171
 
172 172
 		// Add global options.
173
-		if ( $form_id || give_is_add_new_form_page() ) {
173
+		if ($form_id || give_is_add_new_form_page()) {
174 174
 			$option = array(
175
-				'global'   => __( 'Global Options' ),
176
-				'enabled'  => __( 'Customize', 'give' ),
177
-				'disabled' => __( 'Disabled', 'give' ),
175
+				'global'   => __('Global Options'),
176
+				'enabled'  => __('Customize', 'give'),
177
+				'disabled' => __('Disabled', 'give'),
178 178
 			);
179 179
 
180 180
 			$default_value = 'global';
181 181
 		}
182 182
 
183
-		$description = isset( $_GET['page'] ) && 'give-settings' === $_GET['page'] ? __( 'Choose whether you want this email enabled or not.', 'give' ) : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) );
183
+		$description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails'));
184 184
 
185 185
 		return array(
186
-			'name'          => esc_html__( 'Notification', 'give' ),
186
+			'name'          => esc_html__('Notification', 'give'),
187 187
 			'desc'          => $description,
188
-			'id'            => self::get_prefix( $email, $form_id ) . 'notification',
188
+			'id'            => self::get_prefix($email, $form_id).'notification',
189 189
 			'type'          => 'radio_inline',
190 190
 			'default'       => $default_value,
191 191
 			'options'       => $option,
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array
206 206
 	 */
207
-	public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) {
207
+	public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) {
208 208
 		return array(
209
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_subject',
210
-			'name'    => esc_html__( 'Email Subject', 'give' ),
211
-			'desc'    => esc_html__( 'Enter the email subject line.', 'give' ),
209
+			'id'      => self::get_prefix($email, $form_id).'email_subject',
210
+			'name'    => esc_html__('Email Subject', 'give'),
211
+			'desc'    => esc_html__('Enter the email subject line.', 'give'),
212 212
 			'default' => $email->config['default_email_subject'],
213 213
 			'type'    => 'text',
214 214
 		);
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return array
226 226
 	 */
227
-	public static function get_email_header_field( Give_Email_Notification $email, $form_id = null ) {
227
+	public static function get_email_header_field(Give_Email_Notification $email, $form_id = null) {
228 228
 		return array(
229
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_header',
230
-			'name'    => esc_html__( 'Email Header', 'give' ),
231
-			'desc'    => esc_html__( 'Enter the email header that appears at the top of the email.', 'give' ),
229
+			'id'      => self::get_prefix($email, $form_id).'email_header',
230
+			'name'    => esc_html__('Email Header', 'give'),
231
+			'desc'    => esc_html__('Enter the email header that appears at the top of the email.', 'give'),
232 232
 			'default' => $email->config['default_email_header'],
233 233
 			'type'    => 'text',
234 234
 		);
@@ -245,28 +245,28 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return array
247 247
 	 */
248
-	public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) {
249
-		$desc = esc_html__( 'Enter the email message.', 'give' );
248
+	public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) {
249
+		$desc = esc_html__('Enter the email message.', 'give');
250 250
 
251
-		if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) {
251
+		if ($email_tag_list = $email->get_allowed_email_tags(true)) {
252 252
 			$desc = sprintf(
253 253
 				'%1$s <br> %2$s: %3$s %4$s',
254
-				__( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ),
255
-				__( 'Available template tags', 'give' ),
254
+				__('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'),
255
+				__('Available template tags', 'give'),
256 256
 				$email_tag_list,
257 257
 				sprintf(
258 258
 					'<br><a href="%1$s" target="_blank">%2$s</a> %3$s',
259
-					esc_url( 'http://docs.givewp.com/meta-email-tags' ),
260
-					__( 'See our documentation', 'give' ),
261
-					__( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' )
259
+					esc_url('http://docs.givewp.com/meta-email-tags'),
260
+					__('See our documentation', 'give'),
261
+					__('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give')
262 262
 				)
263 263
 			);
264 264
 
265 265
 		}
266 266
 
267 267
 		return array(
268
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_message',
269
-			'name'    => esc_html__( 'Email message', 'give' ),
268
+			'id'      => self::get_prefix($email, $form_id).'email_message',
269
+			'name'    => esc_html__('Email message', 'give'),
270 270
 			'desc'    => $desc,
271 271
 			'type'    => 'wysiwyg',
272 272
 			'default' => $email->config['default_email_message'],
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return array
286 286
 	 */
287
-	public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) {
287
+	public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) {
288 288
 		return array(
289
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_content_type',
290
-			'name'    => esc_html__( 'Email Content Type', 'give' ),
291
-			'desc'    => __( 'Choose email type.', 'give' ),
289
+			'id'      => self::get_prefix($email, $form_id).'email_content_type',
290
+			'name'    => esc_html__('Email Content Type', 'give'),
291
+			'desc'    => __('Choose email type.', 'give'),
292 292
 			'type'    => 'select',
293 293
 			'options' => array(
294
-				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ),
295
-				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ),
294
+				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type('text/html'),
295
+				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'),
296 296
 			),
297 297
 			'default' => $email->config['content_type'],
298 298
 		);
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return array
314 314
 	 */
315
-	public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null, $edit_recipient = true ) {
315
+	public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null, $edit_recipient = true) {
316 316
 		$recipient = array(
317
-			'id'               => self::get_prefix( $email, $form_id ) . 'recipient',
318
-			'name'             => esc_html__( 'Email Recipients', 'give' ),
319
-			'desc'             => __( 'Enter the email address(es) that should receive a notification.', 'give' ),
317
+			'id'               => self::get_prefix($email, $form_id).'recipient',
318
+			'name'             => esc_html__('Email Recipients', 'give'),
319
+			'desc'             => __('Enter the email address(es) that should receive a notification.', 'give'),
320 320
 			'type'             => 'email',
321
-			'default'          => get_bloginfo( 'admin_email' ),
321
+			'default'          => get_bloginfo('admin_email'),
322 322
 			'repeat'           => true,
323
-			'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ),
323
+			'repeat_btn_title' => esc_html__('Add Recipient', 'give'),
324 324
 		);
325 325
 
326
-		if ( $form_id || give_is_add_new_form_page() ) {
327
-			$recipient['name']    = __( 'Email', 'give' );
326
+		if ($form_id || give_is_add_new_form_page()) {
327
+			$recipient['name']    = __('Email', 'give');
328 328
 			$recipient['default'] = '';
329 329
 			$recipient['id']      = 'email';
330
-			$recipient['desc']    = __( 'Enter the email address that should receive a notification.', 'give' );
330
+			$recipient['desc']    = __('Enter the email address that should receive a notification.', 'give');
331 331
 
332 332
 			$recipient = array(
333
-				'id'      => self::get_prefix( $email, $form_id ) . 'recipient',
333
+				'id'      => self::get_prefix($email, $form_id).'recipient',
334 334
 				'type'    => 'group',
335 335
 				'options' => array(
336
-					'add_button'    => __( 'Add Email', 'give' ),
337
-					'header_title'  => __( 'Email Recipient', 'give' ),
336
+					'add_button'    => __('Add Email', 'give'),
337
+					'header_title'  => __('Email Recipient', 'give'),
338 338
 					'remove_button' => '<span class="dashicons dashicons-no"></span>',
339 339
 				),
340 340
 				'fields'  => array(
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 
346 346
 		// Disable field if email donor has recipient field.
347 347
 		// @see https://github.com/WordImpress/Give/issues/2657
348
-		if ( ! $edit_recipient ) {
349
-			if ( 'group' == $recipient['type'] ) {
350
-				$recipient         = current( $recipient['fields'] );
348
+		if ( ! $edit_recipient) {
349
+			if ('group' == $recipient['type']) {
350
+				$recipient         = current($recipient['fields']);
351 351
 				$recipient['type'] = 'text';
352 352
 			}
353 353
 
354 354
 			$recipient['attributes']['disabled'] = 'disabled';
355 355
 			$recipient['value']                  = $recipient['default'] = '{donor_email}';
356 356
 			$recipient['repeat']                 = false;
357
-			$recipient['desc']                   = __( 'This email is automatically sent to the donor and the recipient cannot be customized.', 'give' );
357
+			$recipient['desc']                   = __('This email is automatically sent to the donor and the recipient cannot be customized.', 'give');
358 358
 		}
359 359
 
360 360
 		return $recipient;
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return array
373 373
 	 */
374
-	public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) {
374
+	public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) {
375 375
 		return array(
376
-			'name' => __( 'Preview Email', 'give' ),
377
-			'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
-				'give' ),
379
-			'id'   => self::get_prefix( $email, $form_id ) . 'preview_buttons',
376
+			'name' => __('Preview Email', 'give'),
377
+			'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
+				'give'),
379
+			'id'   => self::get_prefix($email, $form_id).'preview_buttons',
380 380
 			'type' => 'email_preview_buttons',
381 381
 		);
382 382
 	}
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string
395 395
 	 */
396
-	public static function get_prefix( Give_Email_Notification $email, $form_id = null ) {
396
+	public static function get_prefix(Give_Email_Notification $email, $form_id = null) {
397 397
 		$meta_key = "{$email->config['id']}_";
398 398
 
399
-		if ( $form_id || give_is_add_new_form_page() ) {
399
+		if ($form_id || give_is_add_new_form_page()) {
400 400
 			$meta_key = "_give_{$email->config['id']}_";
401 401
 		}
402 402
 
Please login to merge, or discard this patch.
templates/shortcode-goal.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Sanity check - ensure form has pass all condition to show goal.
10 10
 if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) )
11
-     || empty( $form->ID )
12
-     || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
-     || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
11
+	 || empty( $form->ID )
12
+	 || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
+	 || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
14 14
 	return false;
15 15
 }
16 16
 
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 				echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */
98 98
 					__( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) );
99 99
 
100
-            elseif ( 'percentage' === $goal_format ) :
100
+			elseif ( 'percentage' === $goal_format ) :
101 101
 
102 102
 				echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */
103 103
 					__( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) );
104 104
 
105
-            elseif ( 'donation' === $goal_format ) :
105
+			elseif ( 'donation' === $goal_format ) :
106 106
 
107 107
 				echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */
108 108
 					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal );
109 109
 
110
-            elseif ( 'donors' === $goal_format ) :
110
+			elseif ( 'donors' === $goal_format ) :
111 111
 
112 112
 				echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */
113 113
 					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal );
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -3,46 +3,46 @@  discard block
 block discarded – undo
3 3
  * This template is used to display the goal with [give_goal]
4 4
  */
5 5
 
6
-$form        = new Give_Donate_Form( $form_id );
7
-$goal_option = give_get_meta( $form->ID, '_give_goal_option', true );
6
+$form        = new Give_Donate_Form($form_id);
7
+$goal_option = give_get_meta($form->ID, '_give_goal_option', true);
8 8
 
9 9
 // Sanity check - ensure form has pass all condition to show goal.
10
-if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) )
11
-     || empty( $form->ID )
12
-     || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
-     || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
10
+if ((isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN))
11
+     || empty($form->ID)
12
+     || (is_singular('give_forms') && ! give_is_setting_enabled($goal_option))
13
+     || ! give_is_setting_enabled($goal_option) || 0 === $form->goal) {
14 14
 	return false;
15 15
 }
16 16
 
17
-$goal_format         = give_get_form_goal_format( $form_id );
18
-$price               = give_get_meta( $form_id, '_give_set_price', true );
19
-$color               = give_get_meta( $form_id, '_give_goal_color', true );
20
-$show_text           = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
21
-$show_bar            = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
22
-$goal_progress_stats = give_goal_progress_stats( $form );
17
+$goal_format         = give_get_form_goal_format($form_id);
18
+$price               = give_get_meta($form_id, '_give_set_price', true);
19
+$color               = give_get_meta($form_id, '_give_goal_color', true);
20
+$show_text           = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
21
+$show_bar            = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
22
+$goal_progress_stats = give_goal_progress_stats($form);
23 23
 
24 24
 $income = $goal_progress_stats['raw_actual'];
25 25
 $goal   = $goal_progress_stats['raw_goal'];
26 26
 
27
-switch ( $goal_format ) {
27
+switch ($goal_format) {
28 28
 
29 29
 	case 'donation':
30
-		$progress           = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
30
+		$progress           = $goal ? round(($income / $goal) * 100, 2) : 0;
31 31
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
32 32
 		break;
33 33
 
34 34
 	case 'donors':
35
-		$progress_bar_value = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
35
+		$progress_bar_value = $goal ? round(($income / $goal) * 100, 2) : 0;
36 36
 		$progress           = $progress_bar_value;
37 37
 		break;
38 38
 
39 39
 	case 'percentage':
40
-		$progress           = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
40
+		$progress           = $goal ? round(($income / $goal) * 100, 2) : 0;
41 41
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
42 42
 		break;
43 43
 
44 44
 	default:
45
-		$progress           = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
45
+		$progress           = $goal ? round(($income / $goal) * 100, 2) : 0;
46 46
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
47 47
 		break;
48 48
 
@@ -53,64 +53,64 @@  discard block
 block discarded – undo
53 53
  *
54 54
  * @since 1.8.8
55 55
  */
56
-$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form_id, $form );
56
+$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form_id, $form);
57 57
 ?>
58 58
 <div class="give-goal-progress">
59
-	<?php if ( ! empty( $show_text ) ) : ?>
59
+	<?php if ( ! empty($show_text)) : ?>
60 60
         <div class="raised">
61 61
 			<?php
62
-			if ( 'amount' === $goal_format ) :
62
+			if ('amount' === $goal_format) :
63 63
 
64 64
 				/**
65 65
 				 * Filter the give currency.
66 66
 				 *
67 67
 				 * @since 1.8.17
68 68
 				 */
69
-				$form_currency = apply_filters( 'give_goal_form_currency', give_get_currency( $form_id ), $form_id );
69
+				$form_currency = apply_filters('give_goal_form_currency', give_get_currency($form_id), $form_id);
70 70
 
71 71
 				/**
72 72
 				 * Filter the income formatting arguments.
73 73
 				 *
74 74
 				 * @since 1.8.17
75 75
 				 */
76
-				$income_format_args = apply_filters( 'give_goal_income_format_args', array(
76
+				$income_format_args = apply_filters('give_goal_income_format_args', array(
77 77
 					'sanitize' => false,
78 78
 					'currency' => $form_currency,
79 79
 					'decimal'  => false,
80
-				), $form_id );
80
+				), $form_id);
81 81
 
82 82
 				/**
83 83
 				 * Filter the goal formatting arguments.
84 84
 				 *
85 85
 				 * @since 1.8.17
86 86
 				 */
87
-				$goal_format_args = apply_filters( 'give_goal_amount_format_args', array(
87
+				$goal_format_args = apply_filters('give_goal_amount_format_args', array(
88 88
 					'sanitize' => false,
89 89
 					'currency' => $form_currency,
90 90
 					'decimal'  => false,
91
-				), $form_id );
91
+				), $form_id);
92 92
 
93 93
 				// Get formatted amount.
94
-				$income = give_human_format_large_amount( give_format_amount( $income, $income_format_args ), array( 'currency' => $form_currency ) );
95
-				$goal   = give_human_format_large_amount( give_format_amount( $goal, $goal_format_args ), array( 'currency' => $form_currency ) );
94
+				$income = give_human_format_large_amount(give_format_amount($income, $income_format_args), array('currency' => $form_currency));
95
+				$goal   = give_human_format_large_amount(give_format_amount($goal, $goal_format_args), array('currency' => $form_currency));
96 96
 
97 97
 				echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */
98
-					__( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) );
98
+					__('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give'), give_currency_filter($income, array('form_id' => $form_id)), give_currency_filter($goal, array('form_id' => $form_id)) );
99 99
 
100
-            elseif ( 'percentage' === $goal_format ) :
100
+            elseif ('percentage' === $goal_format) :
101 101
 
102 102
 				echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */
103
-					__( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) );
103
+					__('<span class="give-percentage">%s%%</span> funded', 'give'), round($progress) );
104 104
 
105
-            elseif ( 'donation' === $goal_format ) :
105
+            elseif ('donation' === $goal_format) :
106 106
 
107 107
 				echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */
108
-					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal );
108
+					_n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give'), $income, $goal );
109 109
 
110
-            elseif ( 'donors' === $goal_format ) :
110
+            elseif ('donors' === $goal_format) :
111 111
 
112 112
 				echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */
113
-					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal );
113
+					_n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give'), $income, $goal );
114 114
 
115 115
 			endif;
116 116
 			?>
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	<?php endif; ?>
119 119
 
120 120
 
121
-	<?php if ( ! empty( $show_bar ) ) : ?>
121
+	<?php if ( ! empty($show_bar)) : ?>
122 122
         <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100"
123
-             aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>">
124
-			<span style="width: <?php echo esc_attr( $progress_bar_value ); ?>%;<?php if ( ! empty( $color ) ) {
125
-				echo 'background-color:' . $color;
123
+             aria-valuenow="<?php echo esc_attr($progress_bar_value); ?>">
124
+			<span style="width: <?php echo esc_attr($progress_bar_value); ?>%;<?php if ( ! empty($color)) {
125
+				echo 'background-color:'.$color;
126 126
 			} ?>"></span>
127 127
         </div><!-- /.give-progress-bar -->
128 128
 	<?php endif; ?>
Please login to merge, or discard this patch.
templates/email-login-form.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
 global $give_access_form_outputted;
10 10
 
11 11
 // Only output the form once.
12
-if ( $give_access_form_outputted ) {
12
+if ($give_access_form_outputted) {
13 13
 	return;
14 14
 }
15 15
 
16
-$recaptcha_key    = give_get_option( 'recaptcha_key' );
17
-$recaptcha_secret = give_get_option( 'recaptcha_secret' );
16
+$recaptcha_key    = give_get_option('recaptcha_key');
17
+$recaptcha_secret = give_get_option('recaptcha_secret');
18 18
 
19
-$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false;
19
+$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false;
20 20
 
21 21
 // Email already sent?
22
-if ( isset( $_POST['email-access-sent'] ) ) {
22
+if (isset($_POST['email-access-sent'])) {
23 23
 
24 24
 	/**
25 25
 	 * Filter to modify access mail send notice
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return  string $message Send notice message for email access.
32 32
 	 */
33
-	$message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
33
+	$message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give'));
34 34
 
35 35
 	Give()->notices->print_frontend_notice(
36 36
 		$message,
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	);
40 40
 
41 41
 	return;
42
-} elseif ( isset( $_POST['email-access-exhausted'] ) ) {
42
+} elseif (isset($_POST['email-access-exhausted'])) {
43 43
 
44 44
 	$value = Give()->email_access->verify_throttle / 60;
45 45
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	$message = (string) apply_filters(
57 57
 		'give_email_access_requests_exceed_notice',
58 58
 		sprintf(
59
-			__( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ),
60
-			sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value )
59
+			__('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'),
60
+			sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value)
61 61
 		),
62 62
 		$value
63 63
 	);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  *
79 79
  * @since 1.8.17
80 80
  */
81
-do_action( 'give_email_access_form_login' );
81
+do_action('give_email_access_form_login');
82 82
 
83 83
 // Print any other messages & errors.
84 84
 Give()->notices->render_frontend_notices();
@@ -97,20 +97,20 @@  discard block
 block discarded – undo
97 97
 				 *
98 98
 				 * @return string $message email access welcome message
99 99
 				 */
100
-				echo esc_html( apply_filters( 'give_email_access_welcome_message', __( 'Please verify your email to access your donation history.', 'give' ) ) );
100
+				echo esc_html(apply_filters('give_email_access_welcome_message', __('Please verify your email to access your donation history.', 'give')));
101 101
 				?>
102 102
             </p>
103 103
 
104
-            <label for="give-email"><?php esc_attr_e( 'Donation Email:', 'give' ); ?></label>
104
+            <label for="give-email"><?php esc_attr_e('Donation Email:', 'give'); ?></label>
105 105
             <input id="give-email" type="email" name="give_email" value=""
106
-                   placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"/>
107
-            <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>"/>
106
+                   placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"/>
107
+            <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>"/>
108 108
             <input type="hidden" name="give_action" value="email_access_form_login"/>
109 109
             <input type="hidden" name="give_access_page" value="<?php the_ID(); ?>"/>
110 110
 
111 111
 			<?php
112 112
 			// Enable reCAPTCHA?
113
-			if ( $enable_recaptcha ) :
113
+			if ($enable_recaptcha) :
114 114
 				?>
115 115
                 <script>
116 116
                     // IP verify for reCAPTCHA.
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 <input type="hidden" name="give_ip" class="give_ip" value=""/>
129 129
 			<?php endif; ?>
130 130
 
131
-            <input type="submit" class="give-submit" value="<?php esc_attr_e( 'Verify Email', 'give' ); ?>"/>
131
+            <input type="submit" class="give-submit" value="<?php esc_attr_e('Verify Email', 'give'); ?>"/>
132 132
         </form>
133 133
     </div>
134 134
 <?php
Please login to merge, or discard this patch.
includes/process-donation.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @throws ReflectionException Exception Handling.
26 26
  *
27
- * @return mixed
27
+ * @return false|null
28 28
  */
29 29
 function give_process_donation_form() {
30 30
 
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
  *
1320 1320
  * @param array $valid_data List of Valid Data.
1321 1321
  *
1322
- * @return bool
1322
+ * @return boolean|null
1323 1323
  */
1324 1324
 function give_validate_donation_amount( $valid_data ) {
1325 1325
 
Please login to merge, or discard this patch.
Spacing   +296 added lines, -297 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
 
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 function give_process_donation_form() {
30 30
 
31 31
 	// Sanitize Posted Data.
32
-	$post_data  = give_clean( $_POST ); // WPCS: input var ok, CSRF ok.
32
+	$post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok.
33 33
 
34 34
 	// Check whether the form submitted via AJAX or not.
35
-	$is_ajax = isset( $post_data['give_ajax'] );
35
+	$is_ajax = isset($post_data['give_ajax']);
36 36
 
37 37
 	// Verify donation form nonce.
38
-	if ( ! give_verify_donation_form_nonce( $post_data['give-form-hash'], $post_data['give-form-id'] ) ) {
39
-		if ( $is_ajax ) {
38
+	if ( ! give_verify_donation_form_nonce($post_data['give-form-hash'], $post_data['give-form-id'])) {
39
+		if ($is_ajax) {
40 40
 			/**
41 41
 			 * Fires when AJAX sends back errors from the donation form.
42 42
 			 *
43 43
 			 * @since 1.0
44 44
 			 */
45
-			do_action( 'give_ajax_donation_errors' );
45
+			do_action('give_ajax_donation_errors');
46 46
 			give_die();
47 47
 		} else {
48 48
 			give_send_back_to_checkout();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @since 1.0
56 56
 	 */
57
-	do_action( 'give_pre_process_donation' );
57
+	do_action('give_pre_process_donation');
58 58
 
59 59
 	// Validate the form $_POST data.
60 60
 	$valid_data = give_donation_form_validate_fields();
@@ -70,24 +70,24 @@  discard block
 block discarded – undo
70 70
 	 * @param array $deprecated Deprecated Since 2.0.2. Use $_POST instead.
71 71
 	 */
72 72
 	$deprecated = $post_data;
73
-	do_action( 'give_checkout_error_checks', $valid_data, $deprecated );
73
+	do_action('give_checkout_error_checks', $valid_data, $deprecated);
74 74
 
75 75
 	// Process the login form.
76
-	if ( isset( $post_data['give_login_submit'] ) ) {
76
+	if (isset($post_data['give_login_submit'])) {
77 77
 		give_process_form_login();
78 78
 	}
79 79
 
80 80
 	// Validate the user.
81
-	$user = give_get_donation_form_user( $valid_data );
81
+	$user = give_get_donation_form_user($valid_data);
82 82
 
83
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
84
-		if ( $is_ajax ) {
83
+	if (false === $valid_data || give_get_errors() || ! $user) {
84
+		if ($is_ajax) {
85 85
 			/**
86 86
 			 * Fires when AJAX sends back errors from the donation form.
87 87
 			 *
88 88
 			 * @since 1.0
89 89
 			 */
90
-			do_action( 'give_ajax_donation_errors' );
90
+			do_action('give_ajax_donation_errors');
91 91
 			give_die();
92 92
 		} else {
93 93
 			return false;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 
97 97
 	// If AJAX send back success to proceed with form submission.
98
-	if ( $is_ajax ) {
98
+	if ($is_ajax) {
99 99
 		echo 'success';
100 100
 		give_die();
101 101
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @since 2.2.0
107 107
 	 */
108
-	do_action( 'give_process_donation_after_validation' );
108
+	do_action('give_process_donation_after_validation');
109 109
 
110 110
 	// Setup user information.
111 111
 	$user_info = array(
@@ -117,15 +117,14 @@  discard block
 block discarded – undo
117 117
 		'address'    => $user['address'],
118 118
 	);
119 119
 
120
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
120
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
121 121
 
122 122
 	// Donation form ID.
123
-	$form_id = isset( $post_data['give-form-id'] ) ? absint( $post_data['give-form-id'] ) : 0;
123
+	$form_id = isset($post_data['give-form-id']) ? absint($post_data['give-form-id']) : 0;
124 124
 
125
-	$price = isset( $post_data['give-amount'] ) ?
126
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => give_get_currency( $form_id ) ) ) ) :
127
-		'0.00';
128
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
125
+	$price = isset($post_data['give-amount']) ?
126
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => give_get_currency($form_id)))) : '0.00';
127
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
129 128
 
130 129
 	/**
131 130
 	 * Update donation Purchase key.
@@ -155,8 +154,8 @@  discard block
 block discarded – undo
155 154
 		'price'         => $price,
156 155
 		'purchase_key'  => $purchase_key,
157 156
 		'user_email'    => $user['user_email'],
158
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
159
-		'user_info'     => stripslashes_deep( $user_info ),
157
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
158
+		'user_info'     => stripslashes_deep($user_info),
160 159
 		'post_data'     => $post_data,
161 160
 		'gateway'       => $valid_data['gateway'],
162 161
 		'card_info'     => $valid_data['cc_info'],
@@ -176,10 +175,10 @@  discard block
 block discarded – undo
176 175
 	 * @param array      $user_info  Array containing basic user information.
177 176
 	 * @param bool|array $valid_data Validate fields.
178 177
 	 */
179
-	do_action( 'give_checkout_before_gateway', $post_data, $user_info, $valid_data );
178
+	do_action('give_checkout_before_gateway', $post_data, $user_info, $valid_data);
180 179
 
181 180
 	// Sanity check for price.
182
-	if ( ! $donation_data['price'] ) {
181
+	if ( ! $donation_data['price']) {
183 182
 		// Revert to manual.
184 183
 		$donation_data['gateway'] = 'manual';
185 184
 		$_POST['give-gateway']    = 'manual';
@@ -190,26 +189,26 @@  discard block
 block discarded – undo
190 189
 	 *
191 190
 	 * @since 1.7
192 191
 	 */
193
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
192
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
194 193
 
195 194
 	// Setup the data we're storing in the donation session.
196 195
 	$session_data = $donation_data;
197 196
 
198 197
 	// Make sure credit card numbers are never stored in sessions.
199
-	unset( $session_data['card_info']['card_number'] );
200
-	unset( $session_data['post_data']['card_number'] );
198
+	unset($session_data['card_info']['card_number']);
199
+	unset($session_data['post_data']['card_number']);
201 200
 
202 201
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
203
-	give_set_purchase_session( $session_data );
202
+	give_set_purchase_session($session_data);
204 203
 
205 204
 	// Send info to the gateway for payment processing.
206
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
205
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
207 206
 	give_die();
208 207
 }
209 208
 
210
-add_action( 'give_purchase', 'give_process_donation_form' );
211
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
212
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
209
+add_action('give_purchase', 'give_process_donation_form');
210
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
211
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
213 212
 
214 213
 /**
215 214
  * Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer.
@@ -220,27 +219,27 @@  discard block
 block discarded – undo
220 219
  *
221 220
  * @return void
222 221
  */
223
-function give_check_logged_in_user_for_existing_email( $valid_data ) {
222
+function give_check_logged_in_user_for_existing_email($valid_data) {
224 223
 
225 224
 	// Verify that the email address belongs to this customer.
226
-	if ( is_user_logged_in() ) {
225
+	if (is_user_logged_in()) {
227 226
 
228 227
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
229
-		$donor           = new Give_Donor( get_current_user_id(), true );
228
+		$donor           = new Give_Donor(get_current_user_id(), true);
230 229
 
231 230
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
232 231
 		if (
233 232
 			$submitted_email !== $donor->email
234
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails, true ) )
233
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails, true))
235 234
 		) {
236
-			$found_donor = new Give_Donor( $submitted_email );
235
+			$found_donor = new Give_Donor($submitted_email);
237 236
 
238
-			if ( $found_donor->id > 0 ) {
237
+			if ($found_donor->id > 0) {
239 238
 				give_set_error(
240 239
 					'give-customer-email-exists',
241 240
 					sprintf(
242 241
 						/* translators: 1. Donor Email, 2. Submitted Email */
243
-						__( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give' ),
242
+						__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'),
244 243
 						$donor->email,
245 244
 						$submitted_email
246 245
 					)
@@ -250,7 +249,7 @@  discard block
 block discarded – undo
250 249
 	}
251 250
 }
252 251
 
253
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 );
252
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1);
254 253
 
255 254
 /**
256 255
  * Process the checkout login form
@@ -262,49 +261,49 @@  discard block
 block discarded – undo
262 261
  */
263 262
 function give_process_form_login() {
264 263
 
265
-	$is_ajax   = ! empty( $_POST['give_ajax'] ) ? give_clean( $_POST['give_ajax'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
264
+	$is_ajax   = ! empty($_POST['give_ajax']) ? give_clean($_POST['give_ajax']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
266 265
 	$referrer  = wp_get_referer();
267 266
 	$user_data = give_donation_form_validate_user_login();
268 267
 
269
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
270
-		if ( $is_ajax ) {
268
+	if (give_get_errors() || $user_data['user_id'] < 1) {
269
+		if ($is_ajax) {
271 270
 			/**
272 271
 			 * Fires when AJAX sends back errors from the donation form.
273 272
 			 *
274 273
 			 * @since 1.0
275 274
 			 */
276 275
 			ob_start();
277
-			do_action( 'give_ajax_donation_errors' );
276
+			do_action('give_ajax_donation_errors');
278 277
 			$message = ob_get_contents();
279 278
 			ob_end_clean();
280
-			wp_send_json_error( $message );
279
+			wp_send_json_error($message);
281 280
 		} else {
282
-			wp_safe_redirect( $referrer );
281
+			wp_safe_redirect($referrer);
283 282
 			exit;
284 283
 		}
285 284
 	}
286 285
 
287
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
286
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
288 287
 
289
-	if ( $is_ajax ) {
288
+	if ($is_ajax) {
290 289
 		$message = Give()->notices->print_frontend_notice(
291 290
 			sprintf(
292 291
 				/* translators: %s: user first name */
293
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
294
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
292
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
293
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
295 294
 			),
296 295
 			false,
297 296
 			'success'
298 297
 		);
299 298
 
300
-		wp_send_json_success( $message );
299
+		wp_send_json_success($message);
301 300
 	} else {
302
-		wp_safe_redirect( $referrer );
301
+		wp_safe_redirect($referrer);
303 302
 	}
304 303
 }
305 304
 
306
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
307
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
305
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
306
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
308 307
 
309 308
 /**
310 309
  * Donation Form Validate Fields.
@@ -316,49 +315,49 @@  discard block
 block discarded – undo
316 315
  */
317 316
 function give_donation_form_validate_fields() {
318 317
 
319
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
318
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
320 319
 
321 320
 	// Validate Honeypot First.
322
-	if ( ! empty( $post_data['give-honeypot'] ) ) {
323
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
321
+	if ( ! empty($post_data['give-honeypot'])) {
322
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
324 323
 	}
325 324
 
326 325
 	// Check spam detect.
327 326
 	if (
328
-		isset( $post_data['action'] ) &&
329
-		give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) ) &&
327
+		isset($post_data['action']) &&
328
+		give_is_setting_enabled(give_get_option('akismet_spam_protection')) &&
330 329
 		give_is_spam_donation()
331 330
 	) {
332
-		give_set_error( 'spam_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
331
+		give_set_error('spam_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
333 332
 	}
334 333
 
335 334
 	// Start an array to collect valid data.
336 335
 	$valid_data = array(
337 336
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
338
-		'need_new_user'    => false,     // New user flag.
339
-		'need_user_login'  => false,     // Login user flag.
340
-		'logged_user_data' => array(),   // Logged user collected data.
341
-		'new_user_data'    => array(),   // New user collected data.
342
-		'login_user_data'  => array(),   // Login user collected data.
343
-		'guest_user_data'  => array(),   // Guest user collected data.
337
+		'need_new_user'    => false, // New user flag.
338
+		'need_user_login'  => false, // Login user flag.
339
+		'logged_user_data' => array(), // Logged user collected data.
340
+		'new_user_data'    => array(), // New user collected data.
341
+		'login_user_data'  => array(), // Login user collected data.
342
+		'guest_user_data'  => array(), // Guest user collected data.
344 343
 		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
345 344
 	);
346 345
 
347
-	$form_id = intval( $post_data['give-form-id'] );
346
+	$form_id = intval($post_data['give-form-id']);
348 347
 
349 348
 	// Validate agree to terms.
350
-	if ( give_is_terms_enabled( $form_id ) ) {
349
+	if (give_is_terms_enabled($form_id)) {
351 350
 		give_donation_form_validate_agree_to_terms();
352 351
 	}
353 352
 
354
-	if ( is_user_logged_in() ) {
353
+	if (is_user_logged_in()) {
355 354
 
356 355
 		// Collect logged in user data.
357 356
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
358 357
 	} elseif (
359
-		isset( $post_data['give-purchase-var'] ) &&
358
+		isset($post_data['give-purchase-var']) &&
360 359
 		'needs-to-register' === $post_data['give-purchase-var'] &&
361
-		! empty( $post_data['give_create_account'] )
360
+		! empty($post_data['give_create_account'])
362 361
 	) {
363 362
 
364 363
 		// Set new user registration as required.
@@ -367,7 +366,7 @@  discard block
 block discarded – undo
367 366
 		// Validate new user data.
368 367
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
369 368
 	} elseif (
370
-		isset( $post_data['give-purchase-var'] ) &&
369
+		isset($post_data['give-purchase-var']) &&
371 370
 		'needs-to-login' === $post_data['give-purchase-var']
372 371
 	) {
373 372
 
@@ -396,14 +395,14 @@  discard block
 block discarded – undo
396 395
 function give_is_spam_donation() {
397 396
 	$spam = false;
398 397
 
399
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
398
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
400 399
 
401
-	if ( strlen( $user_agent ) < 2 ) {
400
+	if (strlen($user_agent) < 2) {
402 401
 		$spam = true;
403 402
 	}
404 403
 
405 404
 	// Allow developer to customized Akismet spam detect API call and it's response.
406
-	return apply_filters( 'give_spam', $spam );
405
+	return apply_filters('give_spam', $spam);
407 406
 }
408 407
 
409 408
 /**
@@ -418,33 +417,33 @@  discard block
 block discarded – undo
418 417
  */
419 418
 function give_donation_form_validate_gateway() {
420 419
 
421
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
422
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
423
-	$amount    = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'] ) : 0;
424
-	$gateway   = ! empty( $post_data['give-gateway'] ) ? $post_data['give-gateway'] : 0;
420
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
421
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
422
+	$amount    = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount']) : 0;
423
+	$gateway   = ! empty($post_data['give-gateway']) ? $post_data['give-gateway'] : 0;
425 424
 
426 425
 	// Bailout, if payment gateway is not submitted with donation form data.
427
-	if ( empty( $gateway ) ) {
426
+	if (empty($gateway)) {
428 427
 
429
-		give_set_error( 'empty_gateway', __( 'The donation form will process with a valid payment gateway.', 'give' ) );
428
+		give_set_error('empty_gateway', __('The donation form will process with a valid payment gateway.', 'give'));
430 429
 
431
-	} elseif ( ! give_is_gateway_active( $gateway ) ) {
430
+	} elseif ( ! give_is_gateway_active($gateway)) {
432 431
 
433
-		give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
432
+		give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
434 433
 
435
-	} elseif ( empty( $amount ) ) {
434
+	} elseif (empty($amount)) {
436 435
 
437
-		give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
436
+		give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
438 437
 
439
-	} elseif ( ! give_verify_minimum_price( 'minimum' ) ) {
438
+	} elseif ( ! give_verify_minimum_price('minimum')) {
440 439
 
441 440
 		give_set_error(
442 441
 			'invalid_donation_minimum',
443 442
 			sprintf(
444 443
 				/* translators: %s: minimum donation amount */
445
-				__( 'This form has a minimum donation amount of %s.', 'give' ),
444
+				__('This form has a minimum donation amount of %s.', 'give'),
446 445
 				give_currency_filter(
447
-					give_format_amount( give_get_form_minimum_price( $form_id ),
446
+					give_format_amount(give_get_form_minimum_price($form_id),
448 447
 						array(
449 448
 							'sanitize' => false,
450 449
 						)
@@ -452,15 +451,15 @@  discard block
 block discarded – undo
452 451
 				)
453 452
 			)
454 453
 		);
455
-	} elseif ( ! give_verify_minimum_price( 'maximum' ) ) {
454
+	} elseif ( ! give_verify_minimum_price('maximum')) {
456 455
 
457 456
 		give_set_error(
458 457
 			'invalid_donation_maximum',
459 458
 			sprintf(
460 459
 				/* translators: %s: Maximum donation amount */
461
-				__( 'This form has a maximum donation amount of %s.', 'give' ),
460
+				__('This form has a maximum donation amount of %s.', 'give'),
462 461
 				give_currency_filter(
463
-					give_format_amount( give_get_form_maximum_price( $form_id ),
462
+					give_format_amount(give_get_form_maximum_price($form_id),
464 463
 						array(
465 464
 							'sanitize' => false,
466 465
 						)
@@ -486,33 +485,33 @@  discard block
 block discarded – undo
486 485
  *
487 486
  * @return bool
488 487
  */
489
-function give_verify_minimum_price( $amount_range = 'minimum' ) {
488
+function give_verify_minimum_price($amount_range = 'minimum') {
490 489
 
491
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
492
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
493
-	$amount    = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => give_get_currency( $form_id ) ) ) : 0;
494
-	$price_id  = isset( $post_data['give-price-id'] ) ? absint( $post_data['give-price-id'] ) : '';
490
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
491
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
492
+	$amount    = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => give_get_currency($form_id))) : 0;
493
+	$price_id  = isset($post_data['give-price-id']) ? absint($post_data['give-price-id']) : '';
495 494
 
496
-	$variable_prices = give_has_variable_prices( $form_id );
497
-	$price_ids       = array_map( 'absint', give_get_variable_price_ids( $form_id ) );
495
+	$variable_prices = give_has_variable_prices($form_id);
496
+	$price_ids       = array_map('absint', give_get_variable_price_ids($form_id));
498 497
 	$verified_stat   = false;
499 498
 
500
-	if ( $variable_prices && in_array( $price_id, $price_ids, true ) ) {
499
+	if ($variable_prices && in_array($price_id, $price_ids, true)) {
501 500
 
502
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
501
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
503 502
 
504
-		if ( $price_level_amount == $amount ) {
503
+		if ($price_level_amount == $amount) {
505 504
 			$verified_stat = true;
506 505
 		}
507 506
 	}
508 507
 
509
-	if ( ! $verified_stat ) {
510
-		switch ( $amount_range ) {
508
+	if ( ! $verified_stat) {
509
+		switch ($amount_range) {
511 510
 			case 'minimum' :
512
-				$verified_stat = ( give_get_form_minimum_price( $form_id ) > $amount ) ? false : true;
511
+				$verified_stat = (give_get_form_minimum_price($form_id) > $amount) ? false : true;
513 512
 				break;
514 513
 			case 'maximum' :
515
-				$verified_stat = ( give_get_form_maximum_price( $form_id ) < $amount ) ? false : true;
514
+				$verified_stat = (give_get_form_maximum_price($form_id) < $amount) ? false : true;
516 515
 				break;
517 516
 		}
518 517
 	}
@@ -526,7 +525,7 @@  discard block
 block discarded – undo
526 525
 	 * @param string  $amount_range  Type of the amount.
527 526
 	 * @param integer $form_id       Give Donation Form ID.
528 527
 	 */
529
-	return apply_filters( 'give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id );
528
+	return apply_filters('give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id);
530 529
 }
531 530
 
532 531
 /**
@@ -539,13 +538,13 @@  discard block
 block discarded – undo
539 538
  */
540 539
 function give_donation_form_validate_agree_to_terms() {
541 540
 
542
-	$agree_to_terms = ! empty( $_POST['give_agree_to_terms'] ) ? give_clean( $_POST['give_agree_to_terms'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
541
+	$agree_to_terms = ! empty($_POST['give_agree_to_terms']) ? give_clean($_POST['give_agree_to_terms']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
543 542
 
544 543
 	// Proceed only, if donor agreed to terms.
545
-	if ( ! $agree_to_terms ) {
544
+	if ( ! $agree_to_terms) {
546 545
 
547 546
 		// User did not agree.
548
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
547
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
549 548
 	}
550 549
 }
551 550
 
@@ -559,92 +558,92 @@  discard block
 block discarded – undo
559 558
  *
560 559
  * @return array
561 560
  */
562
-function give_get_required_fields( $form_id ) {
561
+function give_get_required_fields($form_id) {
563 562
 
564
-	$payment_mode = give_get_chosen_gateway( $form_id );
563
+	$payment_mode = give_get_chosen_gateway($form_id);
565 564
 
566 565
 	$required_fields = array(
567 566
 		'give_email' => array(
568 567
 			'error_id'      => 'invalid_email',
569
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
568
+			'error_message' => __('Please enter a valid email address.', 'give'),
570 569
 		),
571 570
 		'give_first' => array(
572 571
 			'error_id'      => 'invalid_first_name',
573
-			'error_message' => __( 'Please enter your first name.', 'give' ),
572
+			'error_message' => __('Please enter your first name.', 'give'),
574 573
 		),
575 574
 	);
576 575
 
577
-	$name_title_prefix = give_is_name_title_prefix_required( $form_id );
578
-	if ( $name_title_prefix ) {
576
+	$name_title_prefix = give_is_name_title_prefix_required($form_id);
577
+	if ($name_title_prefix) {
579 578
 		$required_fields['give_title'] = array(
580 579
 			'error_id'      => 'invalid_title',
581
-			'error_message' => __( 'Please enter your title.', 'give' ),
580
+			'error_message' => __('Please enter your title.', 'give'),
582 581
 		);
583 582
 	}
584 583
 
585
-	$require_address = give_require_billing_address( $payment_mode );
584
+	$require_address = give_require_billing_address($payment_mode);
586 585
 
587
-	if ( $require_address ) {
588
-		$required_fields['card_address']    = array(
586
+	if ($require_address) {
587
+		$required_fields['card_address'] = array(
589 588
 			'error_id'      => 'invalid_card_address',
590
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
589
+			'error_message' => __('Please enter your primary billing address.', 'give'),
591 590
 		);
592
-		$required_fields['card_zip']        = array(
591
+		$required_fields['card_zip'] = array(
593 592
 			'error_id'      => 'invalid_zip_code',
594
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
593
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
595 594
 		);
596
-		$required_fields['card_city']       = array(
595
+		$required_fields['card_city'] = array(
597 596
 			'error_id'      => 'invalid_city',
598
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
597
+			'error_message' => __('Please enter your billing city.', 'give'),
599 598
 		);
600 599
 		$required_fields['billing_country'] = array(
601 600
 			'error_id'      => 'invalid_country',
602
-			'error_message' => __( 'Please select your billing country.', 'give' ),
601
+			'error_message' => __('Please select your billing country.', 'give'),
603 602
 		);
604 603
 
605 604
 
606 605
 		$required_fields['card_state'] = array(
607 606
 			'error_id'      => 'invalid_state',
608
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
607
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
609 608
 		);
610 609
 
611
-		$country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
610
+		$country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
612 611
 
613 612
 		// Check if billing country already exists.
614
-		if ( $country ) {
613
+		if ($country) {
615 614
 
616 615
 			// Get the country list that does not required any states init.
617 616
 			$states_country = give_states_not_required_country_list();
618 617
 
619 618
 			// Check if states is empty or not.
620
-			if ( array_key_exists( $country, $states_country ) ) {
619
+			if (array_key_exists($country, $states_country)) {
621 620
 				// If states is empty remove the required fields of state in billing cart.
622
-				unset( $required_fields['card_state'] );
621
+				unset($required_fields['card_state']);
623 622
 			}
624 623
 		}
625 624
 	} // End if().
626 625
 
627
-	if ( give_is_company_field_enabled( $form_id ) ) {
628
-		$form_option    = give_get_meta( $form_id, '_give_company_field', true );
629
-		$global_setting = give_get_option( 'company_field' );
626
+	if (give_is_company_field_enabled($form_id)) {
627
+		$form_option    = give_get_meta($form_id, '_give_company_field', true);
628
+		$global_setting = give_get_option('company_field');
630 629
 
631 630
 		$is_company_field_required = false;
632 631
 
633
-		if ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) {
632
+		if ( ! empty($form_option) && give_is_setting_enabled($form_option, array('required'))) {
634 633
 			$is_company_field_required = true;
635 634
 
636
-		} elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
635
+		} elseif ('global' === $form_option && give_is_setting_enabled($global_setting, array('required'))) {
637 636
 			$is_company_field_required = true;
638 637
 
639
-		} elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
638
+		} elseif (empty($form_option) && give_is_setting_enabled($global_setting, array('required'))) {
640 639
 			$is_company_field_required = true;
641 640
 
642 641
 		}
643 642
 
644
-		if ( $is_company_field_required ) {
643
+		if ($is_company_field_required) {
645 644
 			$required_fields['give_company_name'] = array(
646 645
 				'error_id'      => 'invalid_company',
647
-				'error_message' => __( 'Please enter Company Name.', 'give' ),
646
+				'error_message' => __('Please enter Company Name.', 'give'),
648 647
 			);
649 648
 		}
650 649
 	}
@@ -654,7 +653,7 @@  discard block
 block discarded – undo
654 653
 	 *
655 654
 	 * @since 1.7
656 655
 	 */
657
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
656
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
658 657
 
659 658
 	return $required_fields;
660 659
 
@@ -669,17 +668,17 @@  discard block
 block discarded – undo
669 668
  *
670 669
  * @return bool
671 670
  */
672
-function give_require_billing_address( $payment_mode ) {
671
+function give_require_billing_address($payment_mode) {
673 672
 
674 673
 	$return          = false;
675
-	$billing_country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
674
+	$billing_country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
676 675
 
677
-	if ( $billing_country || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
676
+	if ($billing_country || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
678 677
 		$return = true;
679 678
 	}
680 679
 
681 680
 	// Let payment gateways and other extensions determine if address fields should be required.
682
-	return apply_filters( 'give_require_billing_address', $return );
681
+	return apply_filters('give_require_billing_address', $return);
683 682
 
684 683
 }
685 684
 
@@ -693,47 +692,47 @@  discard block
 block discarded – undo
693 692
  */
694 693
 function give_donation_form_validate_logged_in_user() {
695 694
 
696
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
695
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
697 696
 	$user_id   = get_current_user_id();
698
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
697
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
699 698
 
700 699
 	// Start empty array to collect valid user data.
701 700
 	$valid_user_data = array(
702 701
 
703 702
 		// Assume there will be errors.
704
-		'user_id' => - 1,
703
+		'user_id' => -1,
705 704
 	);
706 705
 
707 706
 	// Proceed on;y, if valid $user_id found.
708
-	if ( $user_id > 0 ) {
707
+	if ($user_id > 0) {
709 708
 
710 709
 		// Get the logged in user data.
711
-		$user_data = get_userdata( $user_id );
710
+		$user_data = get_userdata($user_id);
712 711
 
713 712
 		// Validate Required Form Fields.
714
-		give_validate_required_form_fields( $form_id );
713
+		give_validate_required_form_fields($form_id);
715 714
 
716 715
 		// Verify data.
717
-		if ( is_object( $user_data ) && $user_data->ID > 0 ) {
716
+		if (is_object($user_data) && $user_data->ID > 0) {
718 717
 
719 718
 			// Collected logged in user data.
720 719
 			$valid_user_data = array(
721 720
 				'user_id'    => $user_id,
722
-				'user_email' => ! empty( $post_data['give_email'] ) ? sanitize_email( $post_data['give_email'] ) : $user_data->user_email,
723
-				'user_first' => ! empty( $post_data['give_first'] ) ? $post_data['give_first'] : $user_data->first_name,
724
-				'user_last'  => ! empty( $post_data['give_last'] ) ? $post_data['give_last'] : $user_data->last_name,
721
+				'user_email' => ! empty($post_data['give_email']) ? sanitize_email($post_data['give_email']) : $user_data->user_email,
722
+				'user_first' => ! empty($post_data['give_first']) ? $post_data['give_first'] : $user_data->first_name,
723
+				'user_last'  => ! empty($post_data['give_last']) ? $post_data['give_last'] : $user_data->last_name,
725 724
 			);
726 725
 
727 726
 			// Validate essential form fields.
728
-			give_donation_form_validate_name_fields( $post_data );
727
+			give_donation_form_validate_name_fields($post_data);
729 728
 
730
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
731
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
729
+			if ( ! is_email($valid_user_data['user_email'])) {
730
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
732 731
 			}
733 732
 		} else {
734 733
 
735 734
 			// Set invalid user information error.
736
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
735
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
737 736
 		}
738 737
 	}
739 738
 
@@ -754,7 +753,7 @@  discard block
 block discarded – undo
754 753
 	$auto_generated_password = wp_generate_password();
755 754
 	$default_user_data       = array(
756 755
 		'give-form-id'           => '',
757
-		'user_id'                => - 1, // Assume there will be errors.
756
+		'user_id'                => -1, // Assume there will be errors.
758 757
 		'user_first'             => '',
759 758
 		'user_last'              => '',
760 759
 		'give_user_login'        => false,
@@ -764,26 +763,26 @@  discard block
 block discarded – undo
764 763
 	);
765 764
 
766 765
 	// Get data.
767
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
768
-	$user_data = wp_parse_args( $post_data, $default_user_data );
766
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
767
+	$user_data = wp_parse_args($post_data, $default_user_data);
769 768
 
770
-	$form_id = absint( $user_data['give-form-id'] );
771
-	$nonce   = ! empty( $post_data['give-form-user-register-hash'] ) ? $post_data['give-form-user-register-hash'] : '';
769
+	$form_id = absint($user_data['give-form-id']);
770
+	$nonce   = ! empty($post_data['give-form-user-register-hash']) ? $post_data['give-form-user-register-hash'] : '';
772 771
 
773 772
 	// Validate user creation nonce.
774
-	if ( ! wp_verify_nonce( $nonce, "give_form_create_user_nonce_{$form_id}" ) ) {
775
-		give_set_error( 'invalid_nonce', __( 'Nonce verification has failed.', 'give' ) );
773
+	if ( ! wp_verify_nonce($nonce, "give_form_create_user_nonce_{$form_id}")) {
774
+		give_set_error('invalid_nonce', __('Nonce verification has failed.', 'give'));
776 775
 	}
777 776
 
778 777
 	$registering_new_user = false;
779 778
 
780
-	give_donation_form_validate_name_fields( $user_data );
779
+	give_donation_form_validate_name_fields($user_data);
781 780
 
782 781
 	// Start an empty array to collect valid user data.
783 782
 	$valid_user_data = array(
784 783
 
785 784
 		// Assume there will be errors.
786
-		'user_id'    => - 1,
785
+		'user_id'    => -1,
787 786
 
788 787
 		// Get first name.
789 788
 		'user_first' => $user_data['give_first'],
@@ -796,13 +795,13 @@  discard block
 block discarded – undo
796 795
 	);
797 796
 
798 797
 	// Validate Required Form Fields.
799
-	give_validate_required_form_fields( $form_id );
798
+	give_validate_required_form_fields($form_id);
800 799
 
801 800
 	// Set Email as Username.
802 801
 	$valid_user_data['user_login'] = $user_data['give_email'];
803 802
 
804 803
 	// Check if we have an email to verify.
805
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
804
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
806 805
 		$valid_user_data['user_email'] = $user_data['give_email'];
807 806
 	}
808 807
 
@@ -819,47 +818,47 @@  discard block
 block discarded – undo
819 818
  */
820 819
 function give_donation_form_validate_user_login() {
821 820
 
822
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
821
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
823 822
 
824 823
 	// Start an array to collect valid user data.
825 824
 	$valid_user_data = array(
826 825
 
827 826
 		// Assume there will be errors.
828
-		'user_id' => - 1,
827
+		'user_id' => -1,
829 828
 	);
830 829
 
831 830
 	// Bailout, if Username is empty.
832
-	if ( empty( $post_data['give_user_login'] ) ) {
833
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
831
+	if (empty($post_data['give_user_login'])) {
832
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
834 833
 
835 834
 		return $valid_user_data;
836 835
 	}
837 836
 
838 837
 	// Get the user by login.
839
-	$user_data = get_user_by( 'login', strip_tags( $post_data['give_user_login'] ) );
838
+	$user_data = get_user_by('login', strip_tags($post_data['give_user_login']));
840 839
 
841 840
 	// Check if user exists.
842
-	if ( $user_data ) {
841
+	if ($user_data) {
843 842
 
844 843
 		// Get password.
845
-		$user_pass = ! empty( $post_data['give_user_pass'] ) ? $post_data['give_user_pass'] : false;
844
+		$user_pass = ! empty($post_data['give_user_pass']) ? $post_data['give_user_pass'] : false;
846 845
 
847 846
 		// Check user_pass.
848
-		if ( $user_pass ) {
847
+		if ($user_pass) {
849 848
 
850 849
 			// Check if password is valid.
851
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
850
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
852 851
 
853
-				$current_page_url = site_url() . '/' . get_page_uri();
852
+				$current_page_url = site_url().'/'.get_page_uri();
854 853
 
855 854
 				// Incorrect password.
856 855
 				give_set_error(
857 856
 					'password_incorrect',
858 857
 					sprintf(
859 858
 						'%1$s <a href="%2$s">%3$s</a>',
860
-						__( 'The password you entered is incorrect.', 'give' ),
861
-						wp_lostpassword_url( $current_page_url ),
862
-						__( 'Reset Password', 'give' )
859
+						__('The password you entered is incorrect.', 'give'),
860
+						wp_lostpassword_url($current_page_url),
861
+						__('Reset Password', 'give')
863 862
 					)
864 863
 				);
865 864
 
@@ -877,11 +876,11 @@  discard block
 block discarded – undo
877 876
 			}
878 877
 		} else {
879 878
 			// Empty password.
880
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
879
+			give_set_error('password_empty', __('Enter a password.', 'give'));
881 880
 		}
882 881
 	} else {
883 882
 		// No username.
884
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
883
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
885 884
 	} // End if().
886 885
 
887 886
 	return $valid_user_data;
@@ -897,8 +896,8 @@  discard block
 block discarded – undo
897 896
  */
898 897
 function give_donation_form_validate_guest_user() {
899 898
 
900
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
901
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
899
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
900
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
902 901
 
903 902
 	// Start an array to collect valid user data.
904 903
 	$valid_user_data = array(
@@ -907,22 +906,22 @@  discard block
 block discarded – undo
907 906
 	);
908 907
 
909 908
 	// Validate name fields.
910
-	give_donation_form_validate_name_fields( $post_data );
909
+	give_donation_form_validate_name_fields($post_data);
911 910
 
912 911
 	// Validate Required Form Fields.
913
-	give_validate_required_form_fields( $form_id );
912
+	give_validate_required_form_fields($form_id);
914 913
 
915 914
 	// Get the guest email.
916
-	$guest_email = ! empty( $post_data['give_email'] ) ? $post_data['give_email'] : false;
915
+	$guest_email = ! empty($post_data['give_email']) ? $post_data['give_email'] : false;
917 916
 
918 917
 	// Check email.
919
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
918
+	if ($guest_email && strlen($guest_email) > 0) {
920 919
 
921 920
 		// Validate email.
922
-		if ( ! is_email( $guest_email ) ) {
921
+		if ( ! is_email($guest_email)) {
923 922
 
924 923
 			// Invalid email.
925
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
924
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
926 925
 
927 926
 		} else {
928 927
 
@@ -930,15 +929,15 @@  discard block
 block discarded – undo
930 929
 			$valid_user_data['user_email'] = $guest_email;
931 930
 
932 931
 			// Get user_id from donor if exist.
933
-			$donor = new Give_Donor( $guest_email );
932
+			$donor = new Give_Donor($guest_email);
934 933
 
935
-			if ( $donor->id && $donor->user_id ) {
934
+			if ($donor->id && $donor->user_id) {
936 935
 				$valid_user_data['user_id'] = $donor->user_id;
937 936
 			}
938 937
 		}
939 938
 	} else {
940 939
 		// No email.
941
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
940
+		give_set_error('email_empty', __('Enter an email.', 'give'));
942 941
 	}
943 942
 
944 943
 	return $valid_user_data;
@@ -954,36 +953,36 @@  discard block
 block discarded – undo
954 953
  *
955 954
  * @return  integer
956 955
  */
957
-function give_register_and_login_new_user( $user_data = array() ) {
956
+function give_register_and_login_new_user($user_data = array()) {
958 957
 	// Verify the array.
959
-	if ( empty( $user_data ) ) {
960
-		return - 1;
958
+	if (empty($user_data)) {
959
+		return -1;
961 960
 	}
962 961
 
963
-	if ( give_get_errors() ) {
964
-		return - 1;
962
+	if (give_get_errors()) {
963
+		return -1;
965 964
 	}
966 965
 
967
-	$user_args = apply_filters( 'give_insert_user_args', array(
968
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
969
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
970
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
971
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
972
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
973
-		'user_registered' => date( 'Y-m-d H:i:s' ),
974
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
975
-	), $user_data );
966
+	$user_args = apply_filters('give_insert_user_args', array(
967
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
968
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
969
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
970
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
971
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
972
+		'user_registered' => date('Y-m-d H:i:s'),
973
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
974
+	), $user_data);
976 975
 
977 976
 	// Insert new user.
978
-	$user_id = wp_insert_user( $user_args );
977
+	$user_id = wp_insert_user($user_args);
979 978
 
980 979
 	// Validate inserted user.
981
-	if ( is_wp_error( $user_id ) ) {
982
-		return - 1;
980
+	if (is_wp_error($user_id)) {
981
+		return -1;
983 982
 	}
984 983
 
985 984
 	// Allow themes and plugins to filter the user data.
986
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
985
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
987 986
 
988 987
 	/**
989 988
 	 * Fires after inserting user.
@@ -993,7 +992,7 @@  discard block
 block discarded – undo
993 992
 	 * @param int $user_id User id.
994 993
 	 * @param array $user_data Array containing user data.
995 994
 	 */
996
-	do_action( 'give_insert_user', $user_id, $user_data );
995
+	do_action('give_insert_user', $user_id, $user_data);
997 996
 
998 997
 	/**
999 998
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -1002,9 +1001,9 @@  discard block
 block discarded – undo
1002 1001
 	 *
1003 1002
 	 * return bool True if login with registration and False if only want to register.
1004 1003
 	 */
1005
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
1004
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
1006 1005
 		// Login new user.
1007
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
1006
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
1008 1007
 	}
1009 1008
 
1010 1009
 	// Return user id.
@@ -1021,33 +1020,33 @@  discard block
 block discarded – undo
1021 1020
  *
1022 1021
  * @return  array|bool
1023 1022
  */
1024
-function give_get_donation_form_user( $valid_data = array() ) {
1023
+function give_get_donation_form_user($valid_data = array()) {
1025 1024
 
1026 1025
 	// Initialize user.
1027 1026
 	$user      = false;
1028
-	$is_ajax   = defined( 'DOING_AJAX' ) && DOING_AJAX;
1029
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1027
+	$is_ajax   = defined('DOING_AJAX') && DOING_AJAX;
1028
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1030 1029
 
1031
-	if ( $is_ajax ) {
1030
+	if ($is_ajax) {
1032 1031
 
1033 1032
 		// Do not create or login the user during the ajax submission (check for errors only).
1034 1033
 		return true;
1035
-	} elseif ( is_user_logged_in() ) {
1034
+	} elseif (is_user_logged_in()) {
1036 1035
 
1037 1036
 		// Set the valid user as the logged in collected data.
1038 1037
 		$user = $valid_data['logged_in_user'];
1039
-	} elseif ( true === $valid_data['need_new_user'] || true === $valid_data['need_user_login'] ) {
1038
+	} elseif (true === $valid_data['need_new_user'] || true === $valid_data['need_user_login']) {
1040 1039
 
1041 1040
 		// New user registration.
1042
-		if ( true === $valid_data['need_new_user'] ) {
1041
+		if (true === $valid_data['need_new_user']) {
1043 1042
 
1044 1043
 			// Set user.
1045 1044
 			$user = $valid_data['new_user_data'];
1046 1045
 
1047 1046
 			// Register and login new user.
1048
-			$user['user_id'] = give_register_and_login_new_user( $user );
1047
+			$user['user_id'] = give_register_and_login_new_user($user);
1049 1048
 
1050
-		} elseif ( true === $valid_data['need_user_login'] && ! $is_ajax ) {
1049
+		} elseif (true === $valid_data['need_user_login'] && ! $is_ajax) {
1051 1050
 
1052 1051
 			/**
1053 1052
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -1059,47 +1058,47 @@  discard block
 block discarded – undo
1059 1058
 			$user = $valid_data['login_user_data'];
1060 1059
 
1061 1060
 			// Login user.
1062
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
1061
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
1063 1062
 		}
1064 1063
 	} // End if().
1065 1064
 
1066 1065
 	// Check guest checkout.
1067
-	if ( false === $user && false === give_logged_in_only( $post_data['give-form-id'] ) ) {
1066
+	if (false === $user && false === give_logged_in_only($post_data['give-form-id'])) {
1068 1067
 
1069 1068
 		// Set user.
1070 1069
 		$user = $valid_data['guest_user_data'];
1071 1070
 	}
1072 1071
 
1073 1072
 	// Verify we have an user.
1074
-	if ( false === $user || empty( $user ) ) {
1073
+	if (false === $user || empty($user)) {
1075 1074
 		return false;
1076 1075
 	}
1077 1076
 
1078 1077
 	// Get user first name.
1079
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
1080
-		$user['user_first'] = isset( $post_data['give_first'] ) ? strip_tags( trim( $post_data['give_first'] ) ) : '';
1078
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
1079
+		$user['user_first'] = isset($post_data['give_first']) ? strip_tags(trim($post_data['give_first'])) : '';
1081 1080
 	}
1082 1081
 
1083 1082
 	// Get user last name.
1084
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
1085
-		$user['user_last'] = isset( $post_data['give_last'] ) ? strip_tags( trim( $post_data['give_last'] ) ) : '';
1083
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
1084
+		$user['user_last'] = isset($post_data['give_last']) ? strip_tags(trim($post_data['give_last'])) : '';
1086 1085
 	}
1087 1086
 
1088 1087
 	// Add Title Prefix to user information.
1089
-	if ( empty( $user['user_title'] ) || strlen( trim( $user['user_title'] ) ) < 1 ) {
1090
-		$user['user_title'] = ! empty( $post_data['give_title'] ) ? strip_tags( trim( $post_data['give_title'] ) ) : '';
1088
+	if (empty($user['user_title']) || strlen(trim($user['user_title'])) < 1) {
1089
+		$user['user_title'] = ! empty($post_data['give_title']) ? strip_tags(trim($post_data['give_title'])) : '';
1091 1090
 	}
1092 1091
 
1093 1092
 	// Get the user's billing address details.
1094 1093
 	$user['address']            = array();
1095
-	$user['address']['line1']   = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : false;
1096
-	$user['address']['line2']   = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : false;
1097
-	$user['address']['city']    = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : false;
1098
-	$user['address']['state']   = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : false;
1099
-	$user['address']['zip']     = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : false;
1100
-	$user['address']['country'] = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : false;
1101
-
1102
-	if ( empty( $user['address']['country'] ) ) {
1094
+	$user['address']['line1']   = ! empty($post_data['card_address']) ? $post_data['card_address'] : false;
1095
+	$user['address']['line2']   = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : false;
1096
+	$user['address']['city']    = ! empty($post_data['card_city']) ? $post_data['card_city'] : false;
1097
+	$user['address']['state']   = ! empty($post_data['card_state']) ? $post_data['card_state'] : false;
1098
+	$user['address']['zip']     = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : false;
1099
+	$user['address']['country'] = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : false;
1100
+
1101
+	if (empty($user['address']['country'])) {
1103 1102
 		$user['address'] = false;
1104 1103
 	} // End if().
1105 1104
 
@@ -1120,16 +1119,16 @@  discard block
 block discarded – undo
1120 1119
 	$card_data = give_get_donation_cc_info();
1121 1120
 
1122 1121
 	// Validate the card zip.
1123
-	if ( ! empty( $card_data['card_zip'] ) ) {
1124
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
1125
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
1122
+	if ( ! empty($card_data['card_zip'])) {
1123
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
1124
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
1126 1125
 		}
1127 1126
 	}
1128 1127
 
1129 1128
 	// Ensure no spaces.
1130
-	if ( ! empty( $card_data['card_number'] ) ) {
1131
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs.
1132
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces.
1129
+	if ( ! empty($card_data['card_number'])) {
1130
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs.
1131
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces.
1133 1132
 	}
1134 1133
 
1135 1134
 	// This should validate card numbers at some point too.
@@ -1147,20 +1146,20 @@  discard block
 block discarded – undo
1147 1146
 function give_get_donation_cc_info() {
1148 1147
 
1149 1148
 	// Sanitize the values submitted with donation form.
1150
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1149
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1151 1150
 
1152 1151
 	$cc_info                   = array();
1153
-	$cc_info['card_name']      = ! empty( $post_data['card_name'] ) ? $post_data['card_name'] : '';
1154
-	$cc_info['card_number']    = ! empty( $post_data['card_number'] ) ? $post_data['card_number'] : '';
1155
-	$cc_info['card_cvc']       = ! empty( $post_data['card_cvc'] ) ? $post_data['card_cvc'] : '';
1156
-	$cc_info['card_exp_month'] = ! empty( $post_data['card_exp_month'] ) ? $post_data['card_exp_month'] : '';
1157
-	$cc_info['card_exp_year']  = ! empty( $post_data['card_exp_year'] ) ? $post_data['card_exp_year'] : '';
1158
-	$cc_info['card_address']   = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : '';
1159
-	$cc_info['card_address_2'] = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : '';
1160
-	$cc_info['card_city']      = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : '';
1161
-	$cc_info['card_state']     = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : '';
1162
-	$cc_info['card_country']   = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : '';
1163
-	$cc_info['card_zip']       = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : '';
1152
+	$cc_info['card_name']      = ! empty($post_data['card_name']) ? $post_data['card_name'] : '';
1153
+	$cc_info['card_number']    = ! empty($post_data['card_number']) ? $post_data['card_number'] : '';
1154
+	$cc_info['card_cvc']       = ! empty($post_data['card_cvc']) ? $post_data['card_cvc'] : '';
1155
+	$cc_info['card_exp_month'] = ! empty($post_data['card_exp_month']) ? $post_data['card_exp_month'] : '';
1156
+	$cc_info['card_exp_year']  = ! empty($post_data['card_exp_year']) ? $post_data['card_exp_year'] : '';
1157
+	$cc_info['card_address']   = ! empty($post_data['card_address']) ? $post_data['card_address'] : '';
1158
+	$cc_info['card_address_2'] = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : '';
1159
+	$cc_info['card_city']      = ! empty($post_data['card_city']) ? $post_data['card_city'] : '';
1160
+	$cc_info['card_state']     = ! empty($post_data['card_state']) ? $post_data['card_state'] : '';
1161
+	$cc_info['card_country']   = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : '';
1162
+	$cc_info['card_zip']       = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : '';
1164 1163
 
1165 1164
 	// Return cc info.
1166 1165
 	return $cc_info;
@@ -1176,14 +1175,14 @@  discard block
 block discarded – undo
1176 1175
  *
1177 1176
  * @return bool|mixed
1178 1177
  */
1179
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
1178
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
1180 1179
 	$ret = false;
1181 1180
 
1182
-	if ( empty( $zip ) || empty( $country_code ) ) {
1181
+	if (empty($zip) || empty($country_code)) {
1183 1182
 		return $ret;
1184 1183
 	}
1185 1184
 
1186
-	$country_code = strtoupper( $country_code );
1185
+	$country_code = strtoupper($country_code);
1187 1186
 
1188 1187
 	$zip_regex = array(
1189 1188
 		'AD' => 'AD\d{3}',
@@ -1343,11 +1342,11 @@  discard block
 block discarded – undo
1343 1342
 		'ZM' => '\d{5}',
1344 1343
 	);
1345 1344
 
1346
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1345
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1347 1346
 		$ret = true;
1348 1347
 	}
1349 1348
 
1350
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1349
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1351 1350
 }
1352 1351
 
1353 1352
 /**
@@ -1359,60 +1358,60 @@  discard block
 block discarded – undo
1359 1358
  *
1360 1359
  * @return bool
1361 1360
  */
1362
-function give_validate_donation_amount( $valid_data ) {
1361
+function give_validate_donation_amount($valid_data) {
1363 1362
 
1364
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1363
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1365 1364
 
1366 1365
 	/* @var Give_Donate_Form $form */
1367
-	$form = new Give_Donate_Form( $post_data['give-form-id'] );
1366
+	$form = new Give_Donate_Form($post_data['give-form-id']);
1368 1367
 
1369 1368
 	// Get the form currency.
1370
-	$form_currency = give_get_currency( $post_data['give-form-id'] );
1369
+	$form_currency = give_get_currency($post_data['give-form-id']);
1371 1370
 
1372 1371
 	$donation_level_matched = false;
1373 1372
 
1374
-	if ( $form->is_set_type_donation_form() ) {
1373
+	if ($form->is_set_type_donation_form()) {
1375 1374
 
1376 1375
 		// Sanitize donation amount.
1377
-		$post_data['give-amount'] = give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => $form_currency ) );
1376
+		$post_data['give-amount'] = give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => $form_currency));
1378 1377
 
1379 1378
 		// Backward compatibility.
1380
-		if ( $form->is_custom_price( $post_data['give-amount'] ) ) {
1379
+		if ($form->is_custom_price($post_data['give-amount'])) {
1381 1380
 			$post_data['give-price-id'] = 'custom';
1382 1381
 		}
1383 1382
 
1384 1383
 		$donation_level_matched = true;
1385 1384
 
1386
-	} elseif ( $form->is_multi_type_donation_form() ) {
1385
+	} elseif ($form->is_multi_type_donation_form()) {
1387 1386
 
1388 1387
 		$variable_prices = $form->get_prices();
1389 1388
 
1390 1389
 		// Bailout.
1391
-		if ( ! $variable_prices ) {
1390
+		if ( ! $variable_prices) {
1392 1391
 			return false;
1393 1392
 		}
1394 1393
 
1395 1394
 		// Sanitize donation amount.
1396
-		$post_data['give-amount']     = give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => $form_currency ) );
1397
-		$variable_price_option_amount = give_maybe_sanitize_amount( give_get_price_option_amount( $post_data['give-form-id'], $post_data['give-price-id'] ), array( 'currency' => $form_currency ) );
1395
+		$post_data['give-amount']     = give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => $form_currency));
1396
+		$variable_price_option_amount = give_maybe_sanitize_amount(give_get_price_option_amount($post_data['give-form-id'], $post_data['give-price-id']), array('currency' => $form_currency));
1398 1397
 		$new_price_id                 = '';
1399 1398
 
1400
-		if ( $post_data['give-amount'] === $variable_price_option_amount ) {
1399
+		if ($post_data['give-amount'] === $variable_price_option_amount) {
1401 1400
 			return true;
1402 1401
 		}
1403 1402
 
1404
-		if ( $form->is_custom_price( $post_data['give-amount'] ) ) {
1403
+		if ($form->is_custom_price($post_data['give-amount'])) {
1405 1404
 			$new_price_id = 'custom';
1406 1405
 		} else {
1407 1406
 
1408 1407
 			// Find correct donation level from all donation levels.
1409
-			foreach ( $variable_prices as $variable_price ) {
1408
+			foreach ($variable_prices as $variable_price) {
1410 1409
 
1411 1410
 				// Sanitize level amount.
1412
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1411
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1413 1412
 
1414 1413
 				// Set first match donation level ID.
1415
-				if ( $post_data['give-amount'] === $variable_price['_give_amount'] ) {
1414
+				if ($post_data['give-amount'] === $variable_price['_give_amount']) {
1416 1415
 					$new_price_id = $variable_price['_give_id']['level_id'];
1417 1416
 					break;
1418 1417
 				}
@@ -1421,26 +1420,26 @@  discard block
 block discarded – undo
1421 1420
 
1422 1421
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1423 1422
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1424
-		if ( $post_data['give-price-id'] === $new_price_id ) {
1423
+		if ($post_data['give-price-id'] === $new_price_id) {
1425 1424
 			$donation_level_matched = true;
1426 1425
 		}
1427 1426
 	} // End if().
1428 1427
 
1429
-	if ( ! $donation_level_matched ) {
1428
+	if ( ! $donation_level_matched) {
1430 1429
 		give_set_error(
1431 1430
 			'invalid_donation_amount',
1432 1431
 			sprintf(
1433 1432
 			/* translators: %s: invalid donation amount */
1434
-				__( 'Donation amount %s is invalid.', 'give' ),
1433
+				__('Donation amount %s is invalid.', 'give'),
1435 1434
 				give_currency_filter(
1436
-					give_format_amount( $post_data['give-amount'], array( 'sanitize' => false, ) )
1435
+					give_format_amount($post_data['give-amount'], array('sanitize' => false,))
1437 1436
 				)
1438 1437
 			)
1439 1438
 		);
1440 1439
 	}
1441 1440
 }
1442 1441
 
1443
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 );
1442
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 1);
1444 1443
 
1445 1444
 /**
1446 1445
  * Validate Required Form Fields.
@@ -1449,20 +1448,20 @@  discard block
 block discarded – undo
1449 1448
  *
1450 1449
  * @since 2.0
1451 1450
  */
1452
-function give_validate_required_form_fields( $form_id ) {
1451
+function give_validate_required_form_fields($form_id) {
1453 1452
 
1454 1453
 	// Sanitize values submitted with donation form.
1455
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1454
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1456 1455
 
1457 1456
 	// Loop through required fields and show error messages.
1458
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1457
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1459 1458
 
1460 1459
 		// Clean Up Data of the input fields.
1461
-		$field_value = $post_data[ $field_name ];
1460
+		$field_value = $post_data[$field_name];
1462 1461
 
1463 1462
 		// Check whether the required field is empty, then show the error message.
1464
-		if ( in_array( $value, give_get_required_fields( $form_id ), true ) && empty( $field_value ) ) {
1465
-			give_set_error( $value['error_id'], $value['error_message'] );
1463
+		if (in_array($value, give_get_required_fields($form_id), true) && empty($field_value)) {
1464
+			give_set_error($value['error_id'], $value['error_message']);
1466 1465
 		}
1467 1466
 	}
1468 1467
 }
@@ -1476,12 +1475,12 @@  discard block
 block discarded – undo
1476 1475
  *
1477 1476
  * @return void
1478 1477
  */
1479
-function give_donation_form_validate_name_fields( $post_data ) {
1478
+function give_donation_form_validate_name_fields($post_data) {
1480 1479
 
1481
-	$is_alpha_first_name = ( ! is_email( $post_data['give_first'] ) && ! preg_match( '~[0-9]~', $post_data['give_first'] ) );
1482
-	$is_alpha_last_name  = ( ! is_email( $post_data['give_last'] ) && ! preg_match( '~[0-9]~', $post_data['give_last'] ) );
1480
+	$is_alpha_first_name = ( ! is_email($post_data['give_first']) && ! preg_match('~[0-9]~', $post_data['give_first']));
1481
+	$is_alpha_last_name  = ( ! is_email($post_data['give_last']) && ! preg_match('~[0-9]~', $post_data['give_last']));
1483 1482
 
1484
-	if ( ! $is_alpha_first_name || ( ! empty( $post_data['give_last'] ) && ! $is_alpha_last_name ) ) {
1485
-		give_set_error( 'invalid_name', esc_html__( 'The First Name and Last Name fields cannot contain an email address or numbers.', 'give' ) );
1483
+	if ( ! $is_alpha_first_name || ( ! empty($post_data['give_last']) && ! $is_alpha_last_name)) {
1484
+		give_set_error('invalid_name', esc_html__('The First Name and Last Name fields cannot contain an email address or numbers.', 'give'));
1486 1485
 	}
1487 1486
 }
Please login to merge, or discard this patch.
includes/class-give-readme-parser.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
9 9
  * @since       2.1.4
10 10
  */
11
-class Give_Readme_Parser{
11
+class Give_Readme_Parser {
12 12
 	/**
13 13
 	 * Readme file url
14 14
 	 *
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $file_url
34 34
 	 */
35
-	function __construct( $file_url ) {
35
+	function __construct($file_url) {
36 36
 		$this->file_url     = $file_url;
37
-		$this->file_content = wp_remote_retrieve_body( wp_remote_get( $this->file_url ) );
37
+		$this->file_content = wp_remote_retrieve_body(wp_remote_get($this->file_url));
38 38
 	}
39 39
 
40 40
 	/**
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function requires_at_least() {
49 49
 		// Regex to extract Give core minimum version from the readme.txt file.
50
-		preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least );
50
+		preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least);
51 51
 
52
-		if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) {
53
-			$_requires_at_least = trim( $_requires_at_least[1] );
54
-		}else{
52
+		if (is_array($_requires_at_least) && 1 < count($_requires_at_least)) {
53
+			$_requires_at_least = trim($_requires_at_least[1]);
54
+		} else {
55 55
 			$_requires_at_least = null;
56 56
 		}
57 57
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 
52 52
 		if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) {
53 53
 			$_requires_at_least = trim( $_requires_at_least[1] );
54
-		}else{
54
+		} else{
55 55
 			$_requires_at_least = null;
56 56
 		}
57 57
 
Please login to merge, or discard this patch.
includes/emails/template.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
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return string $message Fully formatted message
44 44
  */
45
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
46
-	return give_do_email_tags( $message, $payment_id );
45
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
46
+	return give_do_email_tags($message, $payment_id);
47 47
 }
48 48
 
49 49
 /**
@@ -57,45 +57,45 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return string $message Fully formatted message
59 59
  */
60
-function give_email_preview_template_tags( $message ) {
60
+function give_email_preview_template_tags($message) {
61 61
 
62
-	$price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) );
62
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
63 63
 
64 64
 	$gateway = 'PayPal';
65 65
 
66
-	$receipt_id = strtolower( md5( uniqid() ) );
66
+	$receipt_id = strtolower(md5(uniqid()));
67 67
 
68
-	$payment_id = rand( 1, 100 );
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) );
68
+	$payment_id = rand(1, 100);
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri()));
70 70
 
71 71
 	$receipt_link     = sprintf(
72 72
 		'<a href="%1$s">%2$s</a>',
73 73
 		$receipt_link_url,
74
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
74
+		esc_html__('View the receipt in your browser &raquo;', 'give')
75 75
 	);
76 76
 
77 77
 	// Set user.
78 78
 	$user = wp_get_current_user();
79 79
 
80
-	$message = str_replace( '{name}', $user->display_name, $message );
81
-	$message = str_replace( '{fullname}', $user->display_name, $message );
82
-	$message = str_replace( '{username}', $user->user_login, $message );
83
-	$message = str_replace( '{user_email}', $user->user_email, $message );
84
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
85
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
86
-	$message = str_replace( '{amount}', $price, $message );
87
-	$message = str_replace( '{price}', $price, $message );
88
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
89
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
90
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
91
-	$message = str_replace( '{payment_method}', $gateway, $message );
92
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
93
-	$message = str_replace( '{payment_id}', $payment_id, $message );
94
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
95
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
96
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
97
-
98
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
80
+	$message = str_replace('{name}', $user->display_name, $message);
81
+	$message = str_replace('{fullname}', $user->display_name, $message);
82
+	$message = str_replace('{username}', $user->user_login, $message);
83
+	$message = str_replace('{user_email}', $user->user_email, $message);
84
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
85
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
86
+	$message = str_replace('{amount}', $price, $message);
87
+	$message = str_replace('{price}', $price, $message);
88
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
89
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
90
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
91
+	$message = str_replace('{payment_method}', $gateway, $message);
92
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
93
+	$message = str_replace('{payment_id}', $payment_id, $message);
94
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
95
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
96
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
97
+
98
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
99 99
 }
100 100
 
101 101
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return array
113 113
  */
114
-function give_email_preview_buttons_callback( $field ) {
115
-	$field_id = str_replace( '_preview_buttons', '', $field['id'] );
114
+function give_email_preview_buttons_callback($field) {
115
+	$field_id = str_replace('_preview_buttons', '', $field['id']);
116 116
 
117 117
 	ob_start();
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		'<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>',
121 121
 		wp_nonce_url(
122 122
 			add_query_arg(
123
-				array( 'give_action' => 'preview_email', 'email_type' => $field_id ),
123
+				array('give_action' => 'preview_email', 'email_type' => $field_id),
124 124
 				home_url()
125 125
 			), 'give-preview-email'
126 126
 		),
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	echo sprintf(
131 131
 		' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>',
132 132
 		wp_nonce_url(
133
-				add_query_arg( array(
133
+				add_query_arg(array(
134 134
 			'give_action'  => 'send_preview_email',
135 135
 			'email_type' => $field_id,
136 136
 			'give-messages[]' => 'sent-test-email',
137
-		) ), 'give-send-preview-email' ),
138
-		esc_attr__( 'Send Test Email.', 'give' ),
139
-		esc_html__( 'Send Test Email', 'give' )
137
+		)), 'give-send-preview-email' ),
138
+		esc_attr__('Send Test Email.', 'give'),
139
+		esc_html__('Send Test Email', 'give')
140 140
 	);
141 141
 
142 142
 	echo ob_get_clean();
@@ -155,34 +155,34 @@  discard block
 block discarded – undo
155 155
 
156 156
 	//Payment receipt switcher
157 157
 	$payment_count = give_count_payments()->publish;
158
-	$payment_id    = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' );
158
+	$payment_id    = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id');
159 159
 
160
-	if ( $payment_count <= 0 ) {
160
+	if ($payment_count <= 0) {
161 161
 		return false;
162 162
 	}
163 163
 
164 164
 	//Get payments.
165
-	$donations = new Give_Payments_Query( array(
165
+	$donations = new Give_Payments_Query(array(
166 166
 		'number' => 100,
167 167
 		'output' => '',
168 168
 		'fields' => 'ids'
169
-	) );
169
+	));
170 170
 	$donations = $donations->get_payments();
171
-	$options  = array();
171
+	$options = array();
172 172
 
173 173
 	// Default option.
174
-	$options[0] = esc_html__( 'No donations found.', 'give' );
174
+	$options[0] = esc_html__('No donations found.', 'give');
175 175
 
176 176
 	//Provide nice human readable options.
177
-	if ( $donations ) {
178
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
179
-		foreach ( $donations as $donation_id ) {
177
+	if ($donations) {
178
+		$options[0] = esc_html__('- Select a donation -', 'give');
179
+		foreach ($donations as $donation_id) {
180 180
 
181
-			$options[ $donation_id ] = sprintf(
181
+			$options[$donation_id] = sprintf(
182 182
 				'#%1$s - %2$s - %3$s',
183 183
 				$donation_id,
184
-				give_get_donation_donor_email( $donation_id ),
185
-				get_the_title( $donation_id )
184
+				give_get_donation_donor_email($donation_id),
185
+				get_the_title($donation_id)
186 186
 			);
187 187
 		}
188 188
 	}
@@ -191,27 +191,27 @@  discard block
 block discarded – undo
191 191
 	$transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">';
192 192
 
193 193
 	// Remove payment id query param if set from request url.
194
-	$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
194
+	$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
195 195
 	$query            = $request_url_data['query'];
196
-	$query            = remove_query_arg( array( 'preview_id' ), $query );
196
+	$query            = remove_query_arg(array('preview_id'), $query);
197 197
 
198
-	$request_url = home_url( '/?' . str_replace( '', '', $query ) );
198
+	$request_url = home_url('/?'.str_replace('', '', $query));
199 199
 
200 200
 	$transaction_header .= '<script>
201 201
 				 function change_preview(){
202 202
 				  var transactions = document.getElementById("give_preview_email_payment_id");
203 203
 			        var selected_trans = transactions.options[transactions.selectedIndex];
204 204
 				        if (selected_trans){
205
-				            var url_string = "' . $request_url . '&preview_id=" + selected_trans.value;
205
+				            var url_string = "' . $request_url.'&preview_id=" + selected_trans.value;
206 206
 				                window.location = url_string;
207 207
 				        }
208 208
 				    }
209 209
 			    </script>';
210 210
 
211
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
211
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
212 212
 
213 213
 	//The select field with 100 latest transactions
214
-	$transaction_header .= Give()->html->select( array(
214
+	$transaction_header .= Give()->html->select(array(
215 215
 		'name'             => 'preview_email_payment_id',
216 216
 		'selected'         => $payment_id,
217 217
 		'id'               => 'give_preview_email_payment_id',
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 		'select_atts'      => 'onchange="change_preview()"',
222 222
 		'show_option_all'  => false,
223 223
 		'show_option_none' => false,
224
-	) );
224
+	));
225 225
 
226 226
 	//Closing tag
227 227
 	$transaction_header .= '</div>';
228 228
 
229
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
229
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
230 230
 
231 231
 }
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-totals.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = __( 'Give Totals', 'give' );
27
-		$this->shortcode['label'] = __( 'Give Totals', 'give' );
26
+		$this->shortcode['title'] = __('Give Totals', 'give');
27
+		$this->shortcode['label'] = __('Give Totals', 'give');
28 28
 
29
-		parent::__construct( 'give_totals' );
29
+		parent::__construct('give_totals');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,69 +39,69 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$category_options = array();
41 41
 		$category_lists   = array();
42
-		$categories       = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
43
-		if ( give_is_setting_enabled( give_get_option( 'categories' ) ) && ! is_wp_error( $categories ) ) {
44
-			foreach ( $categories as $category ) {
45
-				$category_options[ absint( $category->term_id ) ] = esc_html( $category->name );
42
+		$categories       = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
43
+		if (give_is_setting_enabled(give_get_option('categories')) && ! is_wp_error($categories)) {
44
+			foreach ($categories as $category) {
45
+				$category_options[absint($category->term_id)] = esc_html($category->name);
46 46
 			}
47 47
 
48 48
 			$category_lists['type']    = 'listbox';
49 49
 			$category_lists['name']    = 'cats';
50
-			$category_lists['label']   = __( 'Select a Donation Form Category:', 'give' );
51
-			$category_lists['tooltip'] = __( 'Select a Donation Form Category', 'give' );
50
+			$category_lists['label']   = __('Select a Donation Form Category:', 'give');
51
+			$category_lists['tooltip'] = __('Select a Donation Form Category', 'give');
52 52
 			$category_lists['options'] = $category_options;
53 53
 		}
54 54
 
55 55
 		$tag_options = array();
56 56
 		$tag_lists   = array();
57
-		$tags        = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
58
-		if ( give_is_setting_enabled( give_get_option( 'tags' ) ) && ! is_wp_error( $tags ) ) {
59
-			$tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
60
-			foreach ( $tags as $tag ) {
61
-				$tag_options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
57
+		$tags        = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
58
+		if (give_is_setting_enabled(give_get_option('tags')) && ! is_wp_error($tags)) {
59
+			$tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
60
+			foreach ($tags as $tag) {
61
+				$tag_options[absint($tag->term_id)] = esc_html($tag->name);
62 62
 			}
63 63
 
64 64
 			$tag_lists['type']    = 'listbox';
65 65
 			$tag_lists['name']    = 'tags';
66
-			$tag_lists['label']   = __( 'Select a Donation Form Tag:', 'give' );
67
-			$tag_lists['tooltip'] = __( 'Select a Donation Form Tag', 'give' );
66
+			$tag_lists['label']   = __('Select a Donation Form Tag:', 'give');
67
+			$tag_lists['tooltip'] = __('Select a Donation Form Tag', 'give');
68 68
 			$tag_lists['options'] = $tag_options;
69 69
 		}
70 70
 
71 71
 		return array(
72 72
 			array(
73 73
 				'type' => 'container',
74
-				'html' => sprintf( '<p class="give-totals-shortcode-container-message">%s</p>',
75
-					__( 'This shortcode shows the total amount raised towards a custom goal for one or several forms regardless of whether they have goals enabled or not.', 'give' )
74
+				'html' => sprintf('<p class="give-totals-shortcode-container-message">%s</p>',
75
+					__('This shortcode shows the total amount raised towards a custom goal for one or several forms regardless of whether they have goals enabled or not.', 'give')
76 76
 				),
77 77
 			),
78 78
 			array(
79 79
 				'type' => 'container',
80
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Shortcode Configuration', 'give' ) ),
80
+				'html' => sprintf('<p class="strong margin-top">%s</p>', __('Shortcode Configuration', 'give')),
81 81
 			),
82 82
 			array(
83 83
 				'type'    => 'textbox',
84 84
 				'name'    => 'ids',
85
-				'label'   => __( 'Donation Form IDs:', 'give' ),
86
-				'tooltip' => __( 'Enter the IDs separated by commas for the donation forms you would like to combine within the totals.', 'give' ),
85
+				'label'   => __('Donation Form IDs:', 'give'),
86
+				'tooltip' => __('Enter the IDs separated by commas for the donation forms you would like to combine within the totals.', 'give'),
87 87
 			),
88 88
 			$category_lists,
89 89
 			$tag_lists,
90 90
 			array(
91 91
 				'type'     => 'textbox',
92 92
 				'name'     => 'total_goal',
93
-				'label'    => __( 'Total Goal:', 'give' ),
94
-				'tooltip'  => __( 'Enter the total goal amount that you would like to display.', 'give' ),
93
+				'label'    => __('Total Goal:', 'give'),
94
+				'tooltip'  => __('Enter the total goal amount that you would like to display.', 'give'),
95 95
 				'required' => array(
96
-					'alert' => esc_html__( 'Please enter a valid total goal amount.', 'give' ),
96
+					'alert' => esc_html__('Please enter a valid total goal amount.', 'give'),
97 97
 				),
98 98
 			),
99 99
 			array(
100 100
 				'type'      => 'textbox',
101 101
 				'name'      => 'message',
102
-				'label'     => __( 'Message:', 'give' ),
103
-				'tooltip'   => __( 'Enter a message to display encouraging donors to support the goal.', 'give' ),
104
-				'value'     => apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) ),
102
+				'label'     => __('Message:', 'give'),
103
+				'tooltip'   => __('Enter a message to display encouraging donors to support the goal.', 'give'),
104
+				'value'     => apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give')),
105 105
 				'multiline' => true,
106 106
 				'minWidth'  => 300,
107 107
 				'minHeight' => 60,
@@ -109,24 +109,24 @@  discard block
 block discarded – undo
109 109
 			array(
110 110
 				'type'    => 'textbox',
111 111
 				'name'    => 'link',
112
-				'label'   => __( 'Link:', 'give' ),
113
-				'tooltip' => __( 'Enter a link to the main campaign donation form.', 'give' ),
112
+				'label'   => __('Link:', 'give'),
113
+				'tooltip' => __('Enter a link to the main campaign donation form.', 'give'),
114 114
 			),
115 115
 			array(
116 116
 				'type'    => 'textbox',
117 117
 				'name'    => 'link_text',
118
-				'label'   => __( 'Link Text:', 'give' ),
119
-				'tooltip' => __( 'Enter hyperlink text for the link to the main campaign donation form.', 'give' ),
120
-				'value'   => __( 'Donate!', 'give' ),
118
+				'label'   => __('Link Text:', 'give'),
119
+				'tooltip' => __('Enter hyperlink text for the link to the main campaign donation form.', 'give'),
120
+				'value'   => __('Donate!', 'give'),
121 121
 			),
122 122
 			array(
123 123
 				'type'    => 'listbox',
124 124
 				'name'    => 'progress_bar',
125
-				'label'   => __( 'Show Progress Bar:', 'give' ),
126
-				'tooltip' => __( 'Select whether you would like to show a goal progress bar.', 'give' ),
125
+				'label'   => __('Show Progress Bar:', 'give'),
126
+				'tooltip' => __('Select whether you would like to show a goal progress bar.', 'give'),
127 127
 				'options' => array(
128
-					'true'  => __( 'Show', 'give' ),
129
-					'false' => __( 'Hide', 'give' ),
128
+					'true'  => __('Show', 'give'),
129
+					'false' => __('Hide', 'give'),
130 130
 				),
131 131
 				'value'   => 'true',
132 132
 			),
Please login to merge, or discard this patch.