Test Failed
Push — master ( 3bffa6...6a44ef )
by Ravinder
08:43
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   +297 added lines, -298 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 Purchase key.
@@ -140,15 +139,15 @@  discard block
 block discarded – undo
140 139
 	 *
141 140
 	 * @return string $purchase_key
142 141
 	 */
143
-	$purchase_key = apply_filters( 'give_purchase_key', $purchase_key, $valid_data['gateway'] );
142
+	$purchase_key = apply_filters('give_purchase_key', $purchase_key, $valid_data['gateway']);
144 143
 
145 144
 	// Setup donation information.
146 145
 	$donation_data = array(
147 146
 		'price'         => $price,
148 147
 		'purchase_key'  => $purchase_key,
149 148
 		'user_email'    => $user['user_email'],
150
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
151
-		'user_info'     => stripslashes_deep( $user_info ),
149
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
150
+		'user_info'     => stripslashes_deep($user_info),
152 151
 		'post_data'     => $post_data,
153 152
 		'gateway'       => $valid_data['gateway'],
154 153
 		'card_info'     => $valid_data['cc_info'],
@@ -168,10 +167,10 @@  discard block
 block discarded – undo
168 167
 	 * @param array      $user_info  Array containing basic user information.
169 168
 	 * @param bool|array $valid_data Validate fields.
170 169
 	 */
171
-	do_action( 'give_checkout_before_gateway', $post_data, $user_info, $valid_data );
170
+	do_action('give_checkout_before_gateway', $post_data, $user_info, $valid_data);
172 171
 
173 172
 	// Sanity check for price.
174
-	if ( ! $donation_data['price'] ) {
173
+	if ( ! $donation_data['price']) {
175 174
 		// Revert to manual.
176 175
 		$donation_data['gateway'] = 'manual';
177 176
 		$_POST['give-gateway']    = 'manual';
@@ -182,26 +181,26 @@  discard block
 block discarded – undo
182 181
 	 *
183 182
 	 * @since 1.7
184 183
 	 */
185
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
184
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
186 185
 
187 186
 	// Setup the data we're storing in the donation session.
188 187
 	$session_data = $donation_data;
189 188
 
190 189
 	// Make sure credit card numbers are never stored in sessions.
191
-	unset( $session_data['card_info']['card_number'] );
192
-	unset( $session_data['post_data']['card_number'] );
190
+	unset($session_data['card_info']['card_number']);
191
+	unset($session_data['post_data']['card_number']);
193 192
 
194 193
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
195
-	give_set_purchase_session( $session_data );
194
+	give_set_purchase_session($session_data);
196 195
 
197 196
 	// Send info to the gateway for payment processing.
198
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
197
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
199 198
 	give_die();
200 199
 }
201 200
 
202
-add_action( 'give_purchase', 'give_process_donation_form' );
203
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
204
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
201
+add_action('give_purchase', 'give_process_donation_form');
202
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
203
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
205 204
 
206 205
 /**
207 206
  * Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer.
@@ -212,27 +211,27 @@  discard block
 block discarded – undo
212 211
  *
213 212
  * @return void
214 213
  */
215
-function give_check_logged_in_user_for_existing_email( $valid_data ) {
214
+function give_check_logged_in_user_for_existing_email($valid_data) {
216 215
 
217 216
 	// Verify that the email address belongs to this customer.
218
-	if ( is_user_logged_in() ) {
217
+	if (is_user_logged_in()) {
219 218
 
220 219
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
221
-		$donor           = new Give_Donor( get_current_user_id(), true );
220
+		$donor           = new Give_Donor(get_current_user_id(), true);
222 221
 
223 222
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
224 223
 		if (
225 224
 			$submitted_email !== $donor->email
226
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails, true ) )
225
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails, true))
227 226
 		) {
228
-			$found_donor = new Give_Donor( $submitted_email );
227
+			$found_donor = new Give_Donor($submitted_email);
229 228
 
230
-			if ( $found_donor->id > 0 ) {
229
+			if ($found_donor->id > 0) {
231 230
 				give_set_error(
232 231
 					'give-customer-email-exists',
233 232
 					sprintf(
234 233
 						/* translators: 1. Donor Email, 2. Submitted Email */
235
-						__( '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' ),
234
+						__('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'),
236 235
 						$donor->email,
237 236
 						$submitted_email
238 237
 					)
@@ -242,7 +241,7 @@  discard block
 block discarded – undo
242 241
 	}
243 242
 }
244 243
 
245
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 );
244
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1);
246 245
 
247 246
 /**
248 247
  * Process the checkout login form
@@ -254,49 +253,49 @@  discard block
 block discarded – undo
254 253
  */
255 254
 function give_process_form_login() {
256 255
 
257
-	$is_ajax   = ! empty( $_POST['give_ajax'] ) ? give_clean( $_POST['give_ajax'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
256
+	$is_ajax   = ! empty($_POST['give_ajax']) ? give_clean($_POST['give_ajax']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
258 257
 	$referrer  = wp_get_referer();
259 258
 	$user_data = give_donation_form_validate_user_login();
260 259
 
261
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
262
-		if ( $is_ajax ) {
260
+	if (give_get_errors() || $user_data['user_id'] < 1) {
261
+		if ($is_ajax) {
263 262
 			/**
264 263
 			 * Fires when AJAX sends back errors from the donation form.
265 264
 			 *
266 265
 			 * @since 1.0
267 266
 			 */
268 267
 			ob_start();
269
-			do_action( 'give_ajax_donation_errors' );
268
+			do_action('give_ajax_donation_errors');
270 269
 			$message = ob_get_contents();
271 270
 			ob_end_clean();
272
-			wp_send_json_error( $message );
271
+			wp_send_json_error($message);
273 272
 		} else {
274
-			wp_safe_redirect( $referrer );
273
+			wp_safe_redirect($referrer);
275 274
 			exit;
276 275
 		}
277 276
 	}
278 277
 
279
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
278
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
280 279
 
281
-	if ( $is_ajax ) {
280
+	if ($is_ajax) {
282 281
 		$message = Give()->notices->print_frontend_notice(
283 282
 			sprintf(
284 283
 				/* translators: %s: user first name */
285
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
286
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
284
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
285
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
287 286
 			),
288 287
 			false,
289 288
 			'success'
290 289
 		);
291 290
 
292
-		wp_send_json_success( $message );
291
+		wp_send_json_success($message);
293 292
 	} else {
294
-		wp_safe_redirect( $referrer );
293
+		wp_safe_redirect($referrer);
295 294
 	}
296 295
 }
297 296
 
298
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
299
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
297
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
298
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
300 299
 
301 300
 /**
302 301
  * Donation Form Validate Fields.
@@ -308,49 +307,49 @@  discard block
 block discarded – undo
308 307
  */
309 308
 function give_donation_form_validate_fields() {
310 309
 
311
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
310
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
312 311
 
313 312
 	// Validate Honeypot First.
314
-	if ( ! empty( $post_data['give-honeypot'] ) ) {
315
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
313
+	if ( ! empty($post_data['give-honeypot'])) {
314
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
316 315
 	}
317 316
 
318 317
 	// Check spam detect.
319 318
 	if (
320
-		isset( $post_data['action'] ) &&
321
-		give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) ) &&
319
+		isset($post_data['action']) &&
320
+		give_is_setting_enabled(give_get_option('akismet_spam_protection')) &&
322 321
 		give_is_spam_donation()
323 322
 	) {
324
-		give_set_error( 'spam_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
323
+		give_set_error('spam_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
325 324
 	}
326 325
 
327 326
 	// Start an array to collect valid data.
328 327
 	$valid_data = array(
329 328
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
330
-		'need_new_user'    => false,     // New user flag.
331
-		'need_user_login'  => false,     // Login user flag.
332
-		'logged_user_data' => array(),   // Logged user collected data.
333
-		'new_user_data'    => array(),   // New user collected data.
334
-		'login_user_data'  => array(),   // Login user collected data.
335
-		'guest_user_data'  => array(),   // Guest user collected data.
329
+		'need_new_user'    => false, // New user flag.
330
+		'need_user_login'  => false, // Login user flag.
331
+		'logged_user_data' => array(), // Logged user collected data.
332
+		'new_user_data'    => array(), // New user collected data.
333
+		'login_user_data'  => array(), // Login user collected data.
334
+		'guest_user_data'  => array(), // Guest user collected data.
336 335
 		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
337 336
 	);
338 337
 
339
-	$form_id = intval( $post_data['give-form-id'] );
338
+	$form_id = intval($post_data['give-form-id']);
340 339
 
341 340
 	// Validate agree to terms.
342
-	if ( give_is_terms_enabled( $form_id ) ) {
341
+	if (give_is_terms_enabled($form_id)) {
343 342
 		give_donation_form_validate_agree_to_terms();
344 343
 	}
345 344
 
346
-	if ( is_user_logged_in() ) {
345
+	if (is_user_logged_in()) {
347 346
 
348 347
 		// Collect logged in user data.
349 348
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
350 349
 	} elseif (
351
-		isset( $post_data['give-purchase-var'] ) &&
350
+		isset($post_data['give-purchase-var']) &&
352 351
 		'needs-to-register' === $post_data['give-purchase-var'] &&
353
-		! empty( $post_data['give_create_account'] )
352
+		! empty($post_data['give_create_account'])
354 353
 	) {
355 354
 
356 355
 		// Set new user registration as required.
@@ -359,7 +358,7 @@  discard block
 block discarded – undo
359 358
 		// Validate new user data.
360 359
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
361 360
 	} elseif (
362
-		isset( $post_data['give-purchase-var'] ) &&
361
+		isset($post_data['give-purchase-var']) &&
363 362
 		'needs-to-login' === $post_data['give-purchase-var']
364 363
 	) {
365 364
 
@@ -388,14 +387,14 @@  discard block
 block discarded – undo
388 387
 function give_is_spam_donation() {
389 388
 	$spam = false;
390 389
 
391
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
390
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
392 391
 
393
-	if ( strlen( $user_agent ) < 2 ) {
392
+	if (strlen($user_agent) < 2) {
394 393
 		$spam = true;
395 394
 	}
396 395
 
397 396
 	// Allow developer to customized Akismet spam detect API call and it's response.
398
-	return apply_filters( 'give_spam', $spam );
397
+	return apply_filters('give_spam', $spam);
399 398
 }
400 399
 
401 400
 /**
@@ -410,33 +409,33 @@  discard block
 block discarded – undo
410 409
  */
411 410
 function give_donation_form_validate_gateway() {
412 411
 
413
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
414
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
415
-	$amount    = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'] ) : 0;
416
-	$gateway   = ! empty( $post_data['give-gateway'] ) ? $post_data['give-gateway'] : 0;
412
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
413
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
414
+	$amount    = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount']) : 0;
415
+	$gateway   = ! empty($post_data['give-gateway']) ? $post_data['give-gateway'] : 0;
417 416
 
418 417
 	// Bailout, if payment gateway is not submitted with donation form data.
419
-	if ( empty( $gateway ) ) {
418
+	if (empty($gateway)) {
420 419
 
421
-		give_set_error( 'empty_gateway', __( 'The donation form will process with a valid payment gateway.', 'give' ) );
420
+		give_set_error('empty_gateway', __('The donation form will process with a valid payment gateway.', 'give'));
422 421
 
423
-	} elseif ( ! give_is_gateway_active( $gateway ) ) {
422
+	} elseif ( ! give_is_gateway_active($gateway)) {
424 423
 
425
-		give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
424
+		give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
426 425
 
427
-	} elseif ( empty( $amount ) ) {
426
+	} elseif (empty($amount)) {
428 427
 
429
-		give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
428
+		give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
430 429
 
431
-	} elseif ( ! give_verify_minimum_price( 'minimum' ) ) {
430
+	} elseif ( ! give_verify_minimum_price('minimum')) {
432 431
 
433 432
 		give_set_error(
434 433
 			'invalid_donation_minimum',
435 434
 			sprintf(
436 435
 				/* translators: %s: minimum donation amount */
437
-				__( 'This form has a minimum donation amount of %s.', 'give' ),
436
+				__('This form has a minimum donation amount of %s.', 'give'),
438 437
 				give_currency_filter(
439
-					give_format_amount( give_get_form_minimum_price( $form_id ),
438
+					give_format_amount(give_get_form_minimum_price($form_id),
440 439
 						array(
441 440
 							'sanitize' => false,
442 441
 						)
@@ -444,15 +443,15 @@  discard block
 block discarded – undo
444 443
 				)
445 444
 			)
446 445
 		);
447
-	} elseif ( ! give_verify_minimum_price( 'maximum' ) ) {
446
+	} elseif ( ! give_verify_minimum_price('maximum')) {
448 447
 
449 448
 		give_set_error(
450 449
 			'invalid_donation_maximum',
451 450
 			sprintf(
452 451
 				/* translators: %s: Maximum donation amount */
453
-				__( 'This form has a maximum donation amount of %s.', 'give' ),
452
+				__('This form has a maximum donation amount of %s.', 'give'),
454 453
 				give_currency_filter(
455
-					give_format_amount( give_get_form_maximum_price( $form_id ),
454
+					give_format_amount(give_get_form_maximum_price($form_id),
456 455
 						array(
457 456
 							'sanitize' => false,
458 457
 						)
@@ -478,33 +477,33 @@  discard block
 block discarded – undo
478 477
  *
479 478
  * @return bool
480 479
  */
481
-function give_verify_minimum_price( $amount_range = 'minimum' ) {
480
+function give_verify_minimum_price($amount_range = 'minimum') {
482 481
 
483
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
484
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
485
-	$amount    = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => give_get_currency( $form_id ) ) ) : 0;
486
-	$price_id  = isset( $post_data['give-price-id'] ) ? absint( $post_data['give-price-id'] ) : '';
482
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
483
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
484
+	$amount    = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => give_get_currency($form_id))) : 0;
485
+	$price_id  = isset($post_data['give-price-id']) ? absint($post_data['give-price-id']) : '';
487 486
 
488
-	$variable_prices = give_has_variable_prices( $form_id );
489
-	$price_ids       = array_map( 'absint', give_get_variable_price_ids( $form_id ) );
487
+	$variable_prices = give_has_variable_prices($form_id);
488
+	$price_ids       = array_map('absint', give_get_variable_price_ids($form_id));
490 489
 	$verified_stat   = false;
491 490
 
492
-	if ( $variable_prices && in_array( $price_id, $price_ids, true ) ) {
491
+	if ($variable_prices && in_array($price_id, $price_ids, true)) {
493 492
 
494
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
493
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
495 494
 
496
-		if ( $price_level_amount == $amount ) {
495
+		if ($price_level_amount == $amount) {
497 496
 			$verified_stat = true;
498 497
 		}
499 498
 	}
500 499
 
501
-	if ( ! $verified_stat ) {
502
-		switch ( $amount_range ) {
500
+	if ( ! $verified_stat) {
501
+		switch ($amount_range) {
503 502
 			case 'minimum' :
504
-				$verified_stat = ( give_get_form_minimum_price( $form_id ) > $amount ) ? false : true;
503
+				$verified_stat = (give_get_form_minimum_price($form_id) > $amount) ? false : true;
505 504
 				break;
506 505
 			case 'maximum' :
507
-				$verified_stat = ( give_get_form_maximum_price( $form_id ) < $amount ) ? false : true;
506
+				$verified_stat = (give_get_form_maximum_price($form_id) < $amount) ? false : true;
508 507
 				break;
509 508
 		}
510 509
 	}
@@ -518,7 +517,7 @@  discard block
 block discarded – undo
518 517
 	 * @param string  $amount_range  Type of the amount.
519 518
 	 * @param integer $form_id       Give Donation Form ID.
520 519
 	 */
521
-	return apply_filters( 'give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id );
520
+	return apply_filters('give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id);
522 521
 }
523 522
 
524 523
 /**
@@ -531,13 +530,13 @@  discard block
 block discarded – undo
531 530
  */
532 531
 function give_donation_form_validate_agree_to_terms() {
533 532
 
534
-	$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.
533
+	$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.
535 534
 
536 535
 	// Proceed only, if donor agreed to terms.
537
-	if ( ! $agree_to_terms ) {
536
+	if ( ! $agree_to_terms) {
538 537
 
539 538
 		// User did not agree.
540
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
539
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
541 540
 	}
542 541
 }
543 542
 
@@ -551,92 +550,92 @@  discard block
 block discarded – undo
551 550
  *
552 551
  * @return array
553 552
  */
554
-function give_get_required_fields( $form_id ) {
553
+function give_get_required_fields($form_id) {
555 554
 
556
-	$payment_mode = give_get_chosen_gateway( $form_id );
555
+	$payment_mode = give_get_chosen_gateway($form_id);
557 556
 
558 557
 	$required_fields = array(
559 558
 		'give_email' => array(
560 559
 			'error_id'      => 'invalid_email',
561
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
560
+			'error_message' => __('Please enter a valid email address.', 'give'),
562 561
 		),
563 562
 		'give_first' => array(
564 563
 			'error_id'      => 'invalid_first_name',
565
-			'error_message' => __( 'Please enter your first name.', 'give' ),
564
+			'error_message' => __('Please enter your first name.', 'give'),
566 565
 		),
567 566
 	);
568 567
 
569
-	$name_title_prefix = give_is_name_title_prefix_required( $form_id );
570
-	if ( $name_title_prefix ) {
568
+	$name_title_prefix = give_is_name_title_prefix_required($form_id);
569
+	if ($name_title_prefix) {
571 570
 		$required_fields['give_title'] = array(
572 571
 			'error_id'      => 'invalid_title',
573
-			'error_message' => __( 'Please enter your title.', 'give' ),
572
+			'error_message' => __('Please enter your title.', 'give'),
574 573
 		);
575 574
 	}
576 575
 
577
-	$require_address = give_require_billing_address( $payment_mode );
576
+	$require_address = give_require_billing_address($payment_mode);
578 577
 
579
-	if ( $require_address ) {
580
-		$required_fields['card_address']    = array(
578
+	if ($require_address) {
579
+		$required_fields['card_address'] = array(
581 580
 			'error_id'      => 'invalid_card_address',
582
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
581
+			'error_message' => __('Please enter your primary billing address.', 'give'),
583 582
 		);
584
-		$required_fields['card_zip']        = array(
583
+		$required_fields['card_zip'] = array(
585 584
 			'error_id'      => 'invalid_zip_code',
586
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
585
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
587 586
 		);
588
-		$required_fields['card_city']       = array(
587
+		$required_fields['card_city'] = array(
589 588
 			'error_id'      => 'invalid_city',
590
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
589
+			'error_message' => __('Please enter your billing city.', 'give'),
591 590
 		);
592 591
 		$required_fields['billing_country'] = array(
593 592
 			'error_id'      => 'invalid_country',
594
-			'error_message' => __( 'Please select your billing country.', 'give' ),
593
+			'error_message' => __('Please select your billing country.', 'give'),
595 594
 		);
596 595
 
597 596
 
598 597
 		$required_fields['card_state'] = array(
599 598
 			'error_id'      => 'invalid_state',
600
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
599
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
601 600
 		);
602 601
 
603
-		$country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
602
+		$country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
604 603
 
605 604
 		// Check if billing country already exists.
606
-		if ( $country ) {
605
+		if ($country) {
607 606
 
608 607
 			// Get the country list that does not required any states init.
609 608
 			$states_country = give_states_not_required_country_list();
610 609
 
611 610
 			// Check if states is empty or not.
612
-			if ( array_key_exists( $country, $states_country ) ) {
611
+			if (array_key_exists($country, $states_country)) {
613 612
 				// If states is empty remove the required fields of state in billing cart.
614
-				unset( $required_fields['card_state'] );
613
+				unset($required_fields['card_state']);
615 614
 			}
616 615
 		}
617 616
 	} // End if().
618 617
 
619
-	if ( give_is_company_field_enabled( $form_id ) ) {
620
-		$form_option    = give_get_meta( $form_id, '_give_company_field', true );
621
-		$global_setting = give_get_option( 'company_field' );
618
+	if (give_is_company_field_enabled($form_id)) {
619
+		$form_option    = give_get_meta($form_id, '_give_company_field', true);
620
+		$global_setting = give_get_option('company_field');
622 621
 
623 622
 		$is_company_field_required = false;
624 623
 
625
-		if ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) {
624
+		if ( ! empty($form_option) && give_is_setting_enabled($form_option, array('required'))) {
626 625
 			$is_company_field_required = true;
627 626
 
628
-		} elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
627
+		} elseif ('global' === $form_option && give_is_setting_enabled($global_setting, array('required'))) {
629 628
 			$is_company_field_required = true;
630 629
 
631
-		} elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
630
+		} elseif (empty($form_option) && give_is_setting_enabled($global_setting, array('required'))) {
632 631
 			$is_company_field_required = true;
633 632
 
634 633
 		}
635 634
 
636
-		if ( $is_company_field_required ) {
635
+		if ($is_company_field_required) {
637 636
 			$required_fields['give_company_name'] = array(
638 637
 				'error_id'      => 'invalid_company',
639
-				'error_message' => __( 'Please enter Company Name.', 'give' ),
638
+				'error_message' => __('Please enter Company Name.', 'give'),
640 639
 			);
641 640
 		}
642 641
 	}
@@ -646,7 +645,7 @@  discard block
 block discarded – undo
646 645
 	 *
647 646
 	 * @since 1.7
648 647
 	 */
649
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
648
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
650 649
 
651 650
 	return $required_fields;
652 651
 
@@ -661,17 +660,17 @@  discard block
 block discarded – undo
661 660
  *
662 661
  * @return bool
663 662
  */
664
-function give_require_billing_address( $payment_mode ) {
663
+function give_require_billing_address($payment_mode) {
665 664
 
666 665
 	$return          = false;
667
-	$billing_country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
666
+	$billing_country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
668 667
 
669
-	if ( $billing_country || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
668
+	if ($billing_country || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
670 669
 		$return = true;
671 670
 	}
672 671
 
673 672
 	// Let payment gateways and other extensions determine if address fields should be required.
674
-	return apply_filters( 'give_require_billing_address', $return );
673
+	return apply_filters('give_require_billing_address', $return);
675 674
 
676 675
 }
677 676
 
@@ -685,47 +684,47 @@  discard block
 block discarded – undo
685 684
  */
686 685
 function give_donation_form_validate_logged_in_user() {
687 686
 
688
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
687
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
689 688
 	$user_id   = get_current_user_id();
690
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
689
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
691 690
 
692 691
 	// Start empty array to collect valid user data.
693 692
 	$valid_user_data = array(
694 693
 
695 694
 		// Assume there will be errors.
696
-		'user_id' => - 1,
695
+		'user_id' => -1,
697 696
 	);
698 697
 
699 698
 	// Proceed on;y, if valid $user_id found.
700
-	if ( $user_id > 0 ) {
699
+	if ($user_id > 0) {
701 700
 
702 701
 		// Get the logged in user data.
703
-		$user_data = get_userdata( $user_id );
702
+		$user_data = get_userdata($user_id);
704 703
 
705 704
 		// Validate Required Form Fields.
706
-		give_validate_required_form_fields( $form_id );
705
+		give_validate_required_form_fields($form_id);
707 706
 
708 707
 		// Verify data.
709
-		if ( is_object( $user_data ) && $user_data->ID > 0 ) {
708
+		if (is_object($user_data) && $user_data->ID > 0) {
710 709
 
711 710
 			// Collected logged in user data.
712 711
 			$valid_user_data = array(
713 712
 				'user_id'    => $user_id,
714
-				'user_email' => ! empty( $post_data['give_email'] ) ? sanitize_email( $post_data['give_email'] ) : $user_data->user_email,
715
-				'user_first' => ! empty( $post_data['give_first'] ) ? $post_data['give_first'] : $user_data->first_name,
716
-				'user_last'  => ! empty( $post_data['give_last'] ) ? $post_data['give_last'] : $user_data->last_name,
713
+				'user_email' => ! empty($post_data['give_email']) ? sanitize_email($post_data['give_email']) : $user_data->user_email,
714
+				'user_first' => ! empty($post_data['give_first']) ? $post_data['give_first'] : $user_data->first_name,
715
+				'user_last'  => ! empty($post_data['give_last']) ? $post_data['give_last'] : $user_data->last_name,
717 716
 			);
718 717
 
719 718
 			// Validate essential form fields.
720
-			give_donation_form_validate_name_fields( $post_data );
719
+			give_donation_form_validate_name_fields($post_data);
721 720
 
722
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
723
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
721
+			if ( ! is_email($valid_user_data['user_email'])) {
722
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
724 723
 			}
725 724
 		} else {
726 725
 
727 726
 			// Set invalid user information error.
728
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
727
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
729 728
 		}
730 729
 	}
731 730
 
@@ -746,7 +745,7 @@  discard block
 block discarded – undo
746 745
 	$auto_generated_password = wp_generate_password();
747 746
 	$default_user_data       = array(
748 747
 		'give-form-id'           => '',
749
-		'user_id'                => - 1, // Assume there will be errors.
748
+		'user_id'                => -1, // Assume there will be errors.
750 749
 		'user_first'             => '',
751 750
 		'user_last'              => '',
752 751
 		'give_user_login'        => false,
@@ -756,26 +755,26 @@  discard block
 block discarded – undo
756 755
 	);
757 756
 
758 757
 	// Get data.
759
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
760
-	$user_data = wp_parse_args( $post_data, $default_user_data );
758
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
759
+	$user_data = wp_parse_args($post_data, $default_user_data);
761 760
 
762
-	$form_id = absint( $user_data['give-form-id'] );
763
-	$nonce   = ! empty( $post_data['give-form-user-register-hash'] ) ? $post_data['give-form-user-register-hash'] : '';
761
+	$form_id = absint($user_data['give-form-id']);
762
+	$nonce   = ! empty($post_data['give-form-user-register-hash']) ? $post_data['give-form-user-register-hash'] : '';
764 763
 
765 764
 	// Validate user creation nonce.
766
-	if ( ! wp_verify_nonce( $nonce, "give_form_create_user_nonce_{$form_id}" ) ) {
767
-		give_set_error( 'invalid_nonce', __( 'Nonce verification has failed.', 'give' ) );
765
+	if ( ! wp_verify_nonce($nonce, "give_form_create_user_nonce_{$form_id}")) {
766
+		give_set_error('invalid_nonce', __('Nonce verification has failed.', 'give'));
768 767
 	}
769 768
 
770 769
 	$registering_new_user = false;
771 770
 
772
-	give_donation_form_validate_name_fields( $user_data );
771
+	give_donation_form_validate_name_fields($user_data);
773 772
 
774 773
 	// Start an empty array to collect valid user data.
775 774
 	$valid_user_data = array(
776 775
 
777 776
 		// Assume there will be errors.
778
-		'user_id'    => - 1,
777
+		'user_id'    => -1,
779 778
 
780 779
 		// Get first name.
781 780
 		'user_first' => $user_data['give_first'],
@@ -788,13 +787,13 @@  discard block
 block discarded – undo
788 787
 	);
789 788
 
790 789
 	// Validate Required Form Fields.
791
-	give_validate_required_form_fields( $form_id );
790
+	give_validate_required_form_fields($form_id);
792 791
 
793 792
 	// Set Email as Username.
794 793
 	$valid_user_data['user_login'] = $user_data['give_email'];
795 794
 
796 795
 	// Check if we have an email to verify.
797
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
796
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
798 797
 		$valid_user_data['user_email'] = $user_data['give_email'];
799 798
 	}
800 799
 
@@ -811,47 +810,47 @@  discard block
 block discarded – undo
811 810
  */
812 811
 function give_donation_form_validate_user_login() {
813 812
 
814
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
813
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
815 814
 
816 815
 	// Start an array to collect valid user data.
817 816
 	$valid_user_data = array(
818 817
 
819 818
 		// Assume there will be errors.
820
-		'user_id' => - 1,
819
+		'user_id' => -1,
821 820
 	);
822 821
 
823 822
 	// Bailout, if Username is empty.
824
-	if ( empty( $post_data['give_user_login'] ) ) {
825
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
823
+	if (empty($post_data['give_user_login'])) {
824
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
826 825
 
827 826
 		return $valid_user_data;
828 827
 	}
829 828
 
830 829
 	// Get the user by login.
831
-	$user_data = get_user_by( 'login', strip_tags( $post_data['give_user_login'] ) );
830
+	$user_data = get_user_by('login', strip_tags($post_data['give_user_login']));
832 831
 
833 832
 	// Check if user exists.
834
-	if ( $user_data ) {
833
+	if ($user_data) {
835 834
 
836 835
 		// Get password.
837
-		$user_pass = ! empty( $post_data['give_user_pass'] ) ? $post_data['give_user_pass'] : false;
836
+		$user_pass = ! empty($post_data['give_user_pass']) ? $post_data['give_user_pass'] : false;
838 837
 
839 838
 		// Check user_pass.
840
-		if ( $user_pass ) {
839
+		if ($user_pass) {
841 840
 
842 841
 			// Check if password is valid.
843
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
842
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
844 843
 
845
-				$current_page_url = site_url() . '/' . get_page_uri();
844
+				$current_page_url = site_url().'/'.get_page_uri();
846 845
 
847 846
 				// Incorrect password.
848 847
 				give_set_error(
849 848
 					'password_incorrect',
850 849
 					sprintf(
851 850
 						'%1$s <a href="%2$s">%3$s</a>',
852
-						__( 'The password you entered is incorrect.', 'give' ),
853
-						wp_lostpassword_url( $current_page_url ),
854
-						__( 'Reset Password', 'give' )
851
+						__('The password you entered is incorrect.', 'give'),
852
+						wp_lostpassword_url($current_page_url),
853
+						__('Reset Password', 'give')
855 854
 					)
856 855
 				);
857 856
 
@@ -869,11 +868,11 @@  discard block
 block discarded – undo
869 868
 			}
870 869
 		} else {
871 870
 			// Empty password.
872
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
871
+			give_set_error('password_empty', __('Enter a password.', 'give'));
873 872
 		}
874 873
 	} else {
875 874
 		// No username.
876
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
875
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
877 876
 	} // End if().
878 877
 
879 878
 	return $valid_user_data;
@@ -889,8 +888,8 @@  discard block
 block discarded – undo
889 888
  */
890 889
 function give_donation_form_validate_guest_user() {
891 890
 
892
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
893
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
891
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
892
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
894 893
 
895 894
 	// Start an array to collect valid user data.
896 895
 	$valid_user_data = array(
@@ -899,22 +898,22 @@  discard block
 block discarded – undo
899 898
 	);
900 899
 
901 900
 	// Validate name fields.
902
-	give_donation_form_validate_name_fields( $post_data );
901
+	give_donation_form_validate_name_fields($post_data);
903 902
 
904 903
 	// Validate Required Form Fields.
905
-	give_validate_required_form_fields( $form_id );
904
+	give_validate_required_form_fields($form_id);
906 905
 
907 906
 	// Get the guest email.
908
-	$guest_email = ! empty( $post_data['give_email'] ) ? $post_data['give_email'] : false;
907
+	$guest_email = ! empty($post_data['give_email']) ? $post_data['give_email'] : false;
909 908
 
910 909
 	// Check email.
911
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
910
+	if ($guest_email && strlen($guest_email) > 0) {
912 911
 
913 912
 		// Validate email.
914
-		if ( ! is_email( $guest_email ) ) {
913
+		if ( ! is_email($guest_email)) {
915 914
 
916 915
 			// Invalid email.
917
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
916
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
918 917
 
919 918
 		} else {
920 919
 
@@ -922,15 +921,15 @@  discard block
 block discarded – undo
922 921
 			$valid_user_data['user_email'] = $guest_email;
923 922
 
924 923
 			// Get user_id from donor if exist.
925
-			$donor = new Give_Donor( $guest_email );
924
+			$donor = new Give_Donor($guest_email);
926 925
 
927
-			if ( $donor->id && $donor->user_id ) {
926
+			if ($donor->id && $donor->user_id) {
928 927
 				$valid_user_data['user_id'] = $donor->user_id;
929 928
 			}
930 929
 		}
931 930
 	} else {
932 931
 		// No email.
933
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
932
+		give_set_error('email_empty', __('Enter an email.', 'give'));
934 933
 	}
935 934
 
936 935
 	return $valid_user_data;
@@ -946,36 +945,36 @@  discard block
 block discarded – undo
946 945
  *
947 946
  * @return  integer
948 947
  */
949
-function give_register_and_login_new_user( $user_data = array() ) {
948
+function give_register_and_login_new_user($user_data = array()) {
950 949
 	// Verify the array.
951
-	if ( empty( $user_data ) ) {
952
-		return - 1;
950
+	if (empty($user_data)) {
951
+		return -1;
953 952
 	}
954 953
 
955
-	if ( give_get_errors() ) {
956
-		return - 1;
954
+	if (give_get_errors()) {
955
+		return -1;
957 956
 	}
958 957
 
959
-	$user_args = apply_filters( 'give_insert_user_args', array(
960
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
961
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
962
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
963
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
964
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
965
-		'user_registered' => date( 'Y-m-d H:i:s' ),
966
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
967
-	), $user_data );
958
+	$user_args = apply_filters('give_insert_user_args', array(
959
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
960
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
961
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
962
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
963
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
964
+		'user_registered' => date('Y-m-d H:i:s'),
965
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
966
+	), $user_data);
968 967
 
969 968
 	// Insert new user.
970
-	$user_id = wp_insert_user( $user_args );
969
+	$user_id = wp_insert_user($user_args);
971 970
 
972 971
 	// Validate inserted user.
973
-	if ( is_wp_error( $user_id ) ) {
974
-		return - 1;
972
+	if (is_wp_error($user_id)) {
973
+		return -1;
975 974
 	}
976 975
 
977 976
 	// Allow themes and plugins to filter the user data.
978
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
977
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
979 978
 
980 979
 	/**
981 980
 	 * Fires after inserting user.
@@ -985,7 +984,7 @@  discard block
 block discarded – undo
985 984
 	 * @param int $user_id User id.
986 985
 	 * @param array $user_data Array containing user data.
987 986
 	 */
988
-	do_action( 'give_insert_user', $user_id, $user_data );
987
+	do_action('give_insert_user', $user_id, $user_data);
989 988
 
990 989
 	/**
991 990
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -994,9 +993,9 @@  discard block
 block discarded – undo
994 993
 	 *
995 994
 	 * return bool True if login with registration and False if only want to register.
996 995
 	 */
997
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
996
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
998 997
 		// Login new user.
999
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
998
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
1000 999
 	}
1001 1000
 
1002 1001
 	// Return user id.
@@ -1013,33 +1012,33 @@  discard block
 block discarded – undo
1013 1012
  *
1014 1013
  * @return  array|bool
1015 1014
  */
1016
-function give_get_donation_form_user( $valid_data = array() ) {
1015
+function give_get_donation_form_user($valid_data = array()) {
1017 1016
 
1018 1017
 	// Initialize user.
1019 1018
 	$user      = false;
1020
-	$is_ajax   = defined( 'DOING_AJAX' ) && DOING_AJAX;
1021
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1019
+	$is_ajax   = defined('DOING_AJAX') && DOING_AJAX;
1020
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1022 1021
 
1023
-	if ( $is_ajax ) {
1022
+	if ($is_ajax) {
1024 1023
 
1025 1024
 		// Do not create or login the user during the ajax submission (check for errors only).
1026 1025
 		return true;
1027
-	} elseif ( is_user_logged_in() ) {
1026
+	} elseif (is_user_logged_in()) {
1028 1027
 
1029 1028
 		// Set the valid user as the logged in collected data.
1030 1029
 		$user = $valid_data['logged_in_user'];
1031
-	} elseif ( true === $valid_data['need_new_user'] || true === $valid_data['need_user_login'] ) {
1030
+	} elseif (true === $valid_data['need_new_user'] || true === $valid_data['need_user_login']) {
1032 1031
 
1033 1032
 		// New user registration.
1034
-		if ( true === $valid_data['need_new_user'] ) {
1033
+		if (true === $valid_data['need_new_user']) {
1035 1034
 
1036 1035
 			// Set user.
1037 1036
 			$user = $valid_data['new_user_data'];
1038 1037
 
1039 1038
 			// Register and login new user.
1040
-			$user['user_id'] = give_register_and_login_new_user( $user );
1039
+			$user['user_id'] = give_register_and_login_new_user($user);
1041 1040
 
1042
-		} elseif ( true === $valid_data['need_user_login'] && ! $is_ajax ) {
1041
+		} elseif (true === $valid_data['need_user_login'] && ! $is_ajax) {
1043 1042
 
1044 1043
 			/**
1045 1044
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -1051,47 +1050,47 @@  discard block
 block discarded – undo
1051 1050
 			$user = $valid_data['login_user_data'];
1052 1051
 
1053 1052
 			// Login user.
1054
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
1053
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
1055 1054
 		}
1056 1055
 	} // End if().
1057 1056
 
1058 1057
 	// Check guest checkout.
1059
-	if ( false === $user && false === give_logged_in_only( $post_data['give-form-id'] ) ) {
1058
+	if (false === $user && false === give_logged_in_only($post_data['give-form-id'])) {
1060 1059
 
1061 1060
 		// Set user.
1062 1061
 		$user = $valid_data['guest_user_data'];
1063 1062
 	}
1064 1063
 
1065 1064
 	// Verify we have an user.
1066
-	if ( false === $user || empty( $user ) ) {
1065
+	if (false === $user || empty($user)) {
1067 1066
 		return false;
1068 1067
 	}
1069 1068
 
1070 1069
 	// Get user first name.
1071
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
1072
-		$user['user_first'] = isset( $post_data['give_first'] ) ? strip_tags( trim( $post_data['give_first'] ) ) : '';
1070
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
1071
+		$user['user_first'] = isset($post_data['give_first']) ? strip_tags(trim($post_data['give_first'])) : '';
1073 1072
 	}
1074 1073
 
1075 1074
 	// Get user last name.
1076
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
1077
-		$user['user_last'] = isset( $post_data['give_last'] ) ? strip_tags( trim( $post_data['give_last'] ) ) : '';
1075
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
1076
+		$user['user_last'] = isset($post_data['give_last']) ? strip_tags(trim($post_data['give_last'])) : '';
1078 1077
 	}
1079 1078
 
1080 1079
 	// Add Title Prefix to user information.
1081
-	if ( empty( $user['user_title'] ) || strlen( trim( $user['user_title'] ) ) < 1 ) {
1082
-		$user['user_title'] = ! empty( $post_data['give_title'] ) ? strip_tags( trim( $post_data['give_title'] ) ) : '';
1080
+	if (empty($user['user_title']) || strlen(trim($user['user_title'])) < 1) {
1081
+		$user['user_title'] = ! empty($post_data['give_title']) ? strip_tags(trim($post_data['give_title'])) : '';
1083 1082
 	}
1084 1083
 
1085 1084
 	// Get the user's billing address details.
1086 1085
 	$user['address']            = array();
1087
-	$user['address']['line1']   = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : false;
1088
-	$user['address']['line2']   = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : false;
1089
-	$user['address']['city']    = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : false;
1090
-	$user['address']['state']   = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : false;
1091
-	$user['address']['zip']     = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : false;
1092
-	$user['address']['country'] = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : false;
1093
-
1094
-	if ( empty( $user['address']['country'] ) ) {
1086
+	$user['address']['line1']   = ! empty($post_data['card_address']) ? $post_data['card_address'] : false;
1087
+	$user['address']['line2']   = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : false;
1088
+	$user['address']['city']    = ! empty($post_data['card_city']) ? $post_data['card_city'] : false;
1089
+	$user['address']['state']   = ! empty($post_data['card_state']) ? $post_data['card_state'] : false;
1090
+	$user['address']['zip']     = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : false;
1091
+	$user['address']['country'] = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : false;
1092
+
1093
+	if (empty($user['address']['country'])) {
1095 1094
 		$user['address'] = false;
1096 1095
 	} // End if().
1097 1096
 
@@ -1112,16 +1111,16 @@  discard block
 block discarded – undo
1112 1111
 	$card_data = give_get_donation_cc_info();
1113 1112
 
1114 1113
 	// Validate the card zip.
1115
-	if ( ! empty( $card_data['card_zip'] ) ) {
1116
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
1117
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
1114
+	if ( ! empty($card_data['card_zip'])) {
1115
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
1116
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
1118 1117
 		}
1119 1118
 	}
1120 1119
 
1121 1120
 	// Ensure no spaces.
1122
-	if ( ! empty( $card_data['card_number'] ) ) {
1123
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs.
1124
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces.
1121
+	if ( ! empty($card_data['card_number'])) {
1122
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs.
1123
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces.
1125 1124
 	}
1126 1125
 
1127 1126
 	// This should validate card numbers at some point too.
@@ -1139,20 +1138,20 @@  discard block
 block discarded – undo
1139 1138
 function give_get_donation_cc_info() {
1140 1139
 
1141 1140
 	// Sanitize the values submitted with donation form.
1142
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1141
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1143 1142
 
1144 1143
 	$cc_info                   = array();
1145
-	$cc_info['card_name']      = ! empty( $post_data['card_name'] ) ? $post_data['card_name'] : '';
1146
-	$cc_info['card_number']    = ! empty( $post_data['card_number'] ) ? $post_data['card_number'] : '';
1147
-	$cc_info['card_cvc']       = ! empty( $post_data['card_cvc'] ) ? $post_data['card_cvc'] : '';
1148
-	$cc_info['card_exp_month'] = ! empty( $post_data['card_exp_month'] ) ? $post_data['card_exp_month'] : '';
1149
-	$cc_info['card_exp_year']  = ! empty( $post_data['card_exp_year'] ) ? $post_data['card_exp_year'] : '';
1150
-	$cc_info['card_address']   = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : '';
1151
-	$cc_info['card_address_2'] = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : '';
1152
-	$cc_info['card_city']      = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : '';
1153
-	$cc_info['card_state']     = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : '';
1154
-	$cc_info['card_country']   = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : '';
1155
-	$cc_info['card_zip']       = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : '';
1144
+	$cc_info['card_name']      = ! empty($post_data['card_name']) ? $post_data['card_name'] : '';
1145
+	$cc_info['card_number']    = ! empty($post_data['card_number']) ? $post_data['card_number'] : '';
1146
+	$cc_info['card_cvc']       = ! empty($post_data['card_cvc']) ? $post_data['card_cvc'] : '';
1147
+	$cc_info['card_exp_month'] = ! empty($post_data['card_exp_month']) ? $post_data['card_exp_month'] : '';
1148
+	$cc_info['card_exp_year']  = ! empty($post_data['card_exp_year']) ? $post_data['card_exp_year'] : '';
1149
+	$cc_info['card_address']   = ! empty($post_data['card_address']) ? $post_data['card_address'] : '';
1150
+	$cc_info['card_address_2'] = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : '';
1151
+	$cc_info['card_city']      = ! empty($post_data['card_city']) ? $post_data['card_city'] : '';
1152
+	$cc_info['card_state']     = ! empty($post_data['card_state']) ? $post_data['card_state'] : '';
1153
+	$cc_info['card_country']   = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : '';
1154
+	$cc_info['card_zip']       = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : '';
1156 1155
 
1157 1156
 	// Return cc info.
1158 1157
 	return $cc_info;
@@ -1168,14 +1167,14 @@  discard block
 block discarded – undo
1168 1167
  *
1169 1168
  * @return bool|mixed
1170 1169
  */
1171
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
1170
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
1172 1171
 	$ret = false;
1173 1172
 
1174
-	if ( empty( $zip ) || empty( $country_code ) ) {
1173
+	if (empty($zip) || empty($country_code)) {
1175 1174
 		return $ret;
1176 1175
 	}
1177 1176
 
1178
-	$country_code = strtoupper( $country_code );
1177
+	$country_code = strtoupper($country_code);
1179 1178
 
1180 1179
 	$zip_regex = array(
1181 1180
 		'AD' => 'AD\d{3}',
@@ -1335,11 +1334,11 @@  discard block
 block discarded – undo
1335 1334
 		'ZM' => '\d{5}',
1336 1335
 	);
1337 1336
 
1338
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1337
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1339 1338
 		$ret = true;
1340 1339
 	}
1341 1340
 
1342
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1341
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1343 1342
 }
1344 1343
 
1345 1344
 /**
@@ -1351,60 +1350,60 @@  discard block
 block discarded – undo
1351 1350
  *
1352 1351
  * @return bool
1353 1352
  */
1354
-function give_validate_donation_amount( $valid_data ) {
1353
+function give_validate_donation_amount($valid_data) {
1355 1354
 
1356
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1355
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1357 1356
 
1358 1357
 	/* @var Give_Donate_Form $form */
1359
-	$form = new Give_Donate_Form( $post_data['give-form-id'] );
1358
+	$form = new Give_Donate_Form($post_data['give-form-id']);
1360 1359
 
1361 1360
 	// Get the form currency.
1362
-	$form_currency = give_get_currency( $post_data['give-form-id'] );
1361
+	$form_currency = give_get_currency($post_data['give-form-id']);
1363 1362
 
1364 1363
 	$donation_level_matched = false;
1365 1364
 
1366
-	if ( $form->is_set_type_donation_form() ) {
1365
+	if ($form->is_set_type_donation_form()) {
1367 1366
 
1368 1367
 		// Sanitize donation amount.
1369
-		$post_data['give-amount'] = give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => $form_currency ) );
1368
+		$post_data['give-amount'] = give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => $form_currency));
1370 1369
 
1371 1370
 		// Backward compatibility.
1372
-		if ( $form->is_custom_price( $post_data['give-amount'] ) ) {
1371
+		if ($form->is_custom_price($post_data['give-amount'])) {
1373 1372
 			$post_data['give-price-id'] = 'custom';
1374 1373
 		}
1375 1374
 
1376 1375
 		$donation_level_matched = true;
1377 1376
 
1378
-	} elseif ( $form->is_multi_type_donation_form() ) {
1377
+	} elseif ($form->is_multi_type_donation_form()) {
1379 1378
 
1380 1379
 		$variable_prices = $form->get_prices();
1381 1380
 
1382 1381
 		// Bailout.
1383
-		if ( ! $variable_prices ) {
1382
+		if ( ! $variable_prices) {
1384 1383
 			return false;
1385 1384
 		}
1386 1385
 
1387 1386
 		// Sanitize donation amount.
1388
-		$post_data['give-amount']     = give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => $form_currency ) );
1389
-		$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 ) );
1387
+		$post_data['give-amount']     = give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => $form_currency));
1388
+		$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));
1390 1389
 		$new_price_id                 = '';
1391 1390
 
1392
-		if ( $post_data['give-amount'] === $variable_price_option_amount ) {
1391
+		if ($post_data['give-amount'] === $variable_price_option_amount) {
1393 1392
 			return true;
1394 1393
 		}
1395 1394
 
1396
-		if ( $form->is_custom_price( $post_data['give-amount'] ) ) {
1395
+		if ($form->is_custom_price($post_data['give-amount'])) {
1397 1396
 			$new_price_id = 'custom';
1398 1397
 		} else {
1399 1398
 
1400 1399
 			// Find correct donation level from all donation levels.
1401
-			foreach ( $variable_prices as $variable_price ) {
1400
+			foreach ($variable_prices as $variable_price) {
1402 1401
 
1403 1402
 				// Sanitize level amount.
1404
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1403
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1405 1404
 
1406 1405
 				// Set first match donation level ID.
1407
-				if ( $post_data['give-amount'] === $variable_price['_give_amount'] ) {
1406
+				if ($post_data['give-amount'] === $variable_price['_give_amount']) {
1408 1407
 					$new_price_id = $variable_price['_give_id']['level_id'];
1409 1408
 					break;
1410 1409
 				}
@@ -1413,26 +1412,26 @@  discard block
 block discarded – undo
1413 1412
 
1414 1413
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1415 1414
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1416
-		if ( $post_data['give-price-id'] === $new_price_id ) {
1415
+		if ($post_data['give-price-id'] === $new_price_id) {
1417 1416
 			$donation_level_matched = true;
1418 1417
 		}
1419 1418
 	} // End if().
1420 1419
 
1421
-	if ( ! $donation_level_matched ) {
1420
+	if ( ! $donation_level_matched) {
1422 1421
 		give_set_error(
1423 1422
 			'invalid_donation_amount',
1424 1423
 			sprintf(
1425 1424
 			/* translators: %s: invalid donation amount */
1426
-				__( 'Donation amount %s is invalid.', 'give' ),
1425
+				__('Donation amount %s is invalid.', 'give'),
1427 1426
 				give_currency_filter(
1428
-					give_format_amount( $post_data['give-amount'], array( 'sanitize' => false, ) )
1427
+					give_format_amount($post_data['give-amount'], array('sanitize' => false,))
1429 1428
 				)
1430 1429
 			)
1431 1430
 		);
1432 1431
 	}
1433 1432
 }
1434 1433
 
1435
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 );
1434
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 1);
1436 1435
 
1437 1436
 /**
1438 1437
  * Validate Required Form Fields.
@@ -1441,20 +1440,20 @@  discard block
 block discarded – undo
1441 1440
  *
1442 1441
  * @since 2.0
1443 1442
  */
1444
-function give_validate_required_form_fields( $form_id ) {
1443
+function give_validate_required_form_fields($form_id) {
1445 1444
 
1446 1445
 	// Sanitize values submitted with donation form.
1447
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1446
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1448 1447
 
1449 1448
 	// Loop through required fields and show error messages.
1450
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1449
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1451 1450
 
1452 1451
 		// Clean Up Data of the input fields.
1453
-		$field_value = $post_data[ $field_name ];
1452
+		$field_value = $post_data[$field_name];
1454 1453
 
1455 1454
 		// Check whether the required field is empty, then show the error message.
1456
-		if ( in_array( $value, give_get_required_fields( $form_id ), true ) && empty( $field_value ) ) {
1457
-			give_set_error( $value['error_id'], $value['error_message'] );
1455
+		if (in_array($value, give_get_required_fields($form_id), true) && empty($field_value)) {
1456
+			give_set_error($value['error_id'], $value['error_message']);
1458 1457
 		}
1459 1458
 	}
1460 1459
 }
@@ -1468,12 +1467,12 @@  discard block
 block discarded – undo
1468 1467
  *
1469 1468
  * @return void
1470 1469
  */
1471
-function give_donation_form_validate_name_fields( $post_data ) {
1470
+function give_donation_form_validate_name_fields($post_data) {
1472 1471
 
1473
-	$is_alpha_first_name = ( ! is_email( $post_data['give_first'] ) && ! preg_match( '~[0-9]~', $post_data['give_first'] ) );
1474
-	$is_alpha_last_name  = ( ! is_email( $post_data['give_last'] ) && ! preg_match( '~[0-9]~', $post_data['give_last'] ) );
1472
+	$is_alpha_first_name = ( ! is_email($post_data['give_first']) && ! preg_match('~[0-9]~', $post_data['give_first']));
1473
+	$is_alpha_last_name  = ( ! is_email($post_data['give_last']) && ! preg_match('~[0-9]~', $post_data['give_last']));
1475 1474
 
1476
-	if ( ! $is_alpha_first_name || ( ! empty( $post_data['give_last'] ) && ! $is_alpha_last_name ) ) {
1477
-		give_set_error( 'invalid_name', esc_html__( 'The First Name and Last Name fields cannot contain an email address or numbers.', 'give' ) );
1475
+	if ( ! $is_alpha_first_name || ( ! empty($post_data['give_last']) && ! $is_alpha_last_name)) {
1476
+		give_set_error('invalid_name', esc_html__('The First Name and Last Name fields cannot contain an email address or numbers.', 'give'));
1478 1477
 	}
1479 1478
 }
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.