Completed
Pull Request — master (#1055)
by Rami
19:01
created
includes/admin/welcome.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 			/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 			/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 			/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 		// Badge for welcome page
109
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
109
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
110 110
 
111 111
 		?>
112 112
 		<style type="text/css" media="screen">
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 	 * @return void
187 187
 	 */
188 188
 	public function tabs() {
189
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
189
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
190 190
 		?>
191 191
 		<h2 class="nav-tab-wrapper">
192
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
193
-				<?php esc_html_e( 'About Give', 'give' ); ?>
192
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
193
+				<?php esc_html_e('About Give', 'give'); ?>
194 194
 			</a>
195
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
196
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
195
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
196
+				<?php esc_html_e('Getting Started', 'give'); ?>
197 197
 			</a>
198
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
199
-				<?php esc_html_e( 'Credits', 'give' ); ?>
198
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
199
+				<?php esc_html_e('Credits', 'give'); ?>
200 200
 			</a>
201
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>">
202
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
201
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>">
202
+				<?php esc_html_e('Add-ons', 'give'); ?>
203 203
 			</a>
204 204
 		</h2>
205 205
 	<?php
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return void
214 214
 	 */
215 215
 	public function about_screen() {
216
-		list( $display_version ) = explode( '-', GIVE_VERSION );
216
+		list($display_version) = explode('-', GIVE_VERSION);
217 217
 		?>
218 218
 		<div class="wrap about-wrap">
219 219
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 			<p class="about-text"><?php
224 224
 				printf(
225 225
 					/* translators: %s: https://givewp.com/documenation/ */
226
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
227
-					esc_url( 'https://givewp.com/documenation/' )
226
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
227
+					esc_url('https://givewp.com/documenation/')
228 228
 				);
229 229
 			?></p>
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			<div class="give-badge"><?php
234 234
 				printf(
235 235
 					/* translators: %s: Give version */
236
-					esc_html__( 'Version %s', 'give' ),
236
+					esc_html__('Version %s', 'give'),
237 237
 					$display_version
238 238
 				);
239 239
 			?></div>
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
 			<div class="feature-section clearfix introduction">
244 244
 
245 245
 				<div class="video feature-section-item">
246
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
246
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
247 247
 				</div>
248 248
 
249 249
 				<div class="content feature-section-item last-feature">
250 250
 
251
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
251
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
252 252
 
253
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
253
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
254 254
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
255
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
255
+						<?php esc_html_e('Learn More', 'give'); ?>
256 256
 						<span class="dashicons dashicons-external"></span>
257 257
 					</a>
258 258
 
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
 				<div class="content feature-section-item">
267 267
 
268
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
268
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
269 269
 
270
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
270
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
271 271
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary">
272
-						<?php esc_html_e( 'View Documentation', 'give' ); ?>
272
+						<?php esc_html_e('View Documentation', 'give'); ?>
273 273
 						<span class="dashicons dashicons-external"></span>
274 274
 					</a>
275 275
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 				<div class="content  feature-section-item last-feature">
279 279
 
280
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
280
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>">
281 281
 
282 282
 				</div>
283 283
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return void
298 298
 	 */
299 299
 	public function changelog_screen() {
300
-		list( $display_version ) = explode( '-', GIVE_VERSION );
300
+		list($display_version) = explode('-', GIVE_VERSION);
301 301
 		?>
302 302
 		<div class="wrap about-wrap">
303 303
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
 			<p class="about-text"><?php
306 306
 				printf(
307 307
 					/* translators: %s: Give version */
308
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
308
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
309 309
 					$display_version
310 310
 				);
311 311
 			?></p>
312 312
 			<div class="give-badge"><?php
313 313
 				printf(
314 314
 					/* translators: %s: Give version */
315
-					esc_html__( 'Version %s', 'give' ),
315
+					esc_html__('Version %s', 'give'),
316 316
 					$display_version
317 317
 				);
318 318
 			?></div>
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			<?php $this->tabs(); ?>
321 321
 
322 322
 			<div class="changelog">
323
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
323
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
324 324
 
325 325
 				<div class="feature-section">
326 326
 					<?php echo $this->parse_readme(); ?>
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			</div>
329 329
 
330 330
 			<div class="return-to-dashboard">
331
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
331
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
332 332
 					'post_type' => 'give_forms',
333 333
 					'page'      => 'give-settings'
334
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
334
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
335 335
 			</div>
336 336
 		</div>
337 337
 	<?php
@@ -345,37 +345,37 @@  discard block
 block discarded – undo
345 345
 	 * @return void
346 346
 	 */
347 347
 	public function getting_started_screen() {
348
-		list( $display_version ) = explode( '-', GIVE_VERSION );
348
+		list($display_version) = explode('-', GIVE_VERSION);
349 349
 		?>
350 350
 		<div class="wrap about-wrap get-started">
351 351
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
352 352
 
353 353
 			<?php give_social_media_elements() ?>
354 354
 
355
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
355
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
356 356
 
357 357
 			<?php give_get_newsletter(); ?>
358 358
 
359 359
 			<div class="give-badge"><?php
360 360
 				printf(
361 361
 					/* translators: %s: Give version */
362
-					esc_html__( 'Version %s', 'give' ),
362
+					esc_html__('Version %s', 'give'),
363 363
 					$display_version
364 364
 				);
365 365
 			?></div>
366 366
 
367 367
 			<?php $this->tabs(); ?>
368 368
 
369
-			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
369
+			<p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
370 370
 
371 371
 			<div class="feature-section clearfix">
372 372
 
373 373
 				<div class="content feature-section-item">
374
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
374
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
375 375
 
376
-					<p><?php esc_html_e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p>
376
+					<p><?php esc_html_e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p>
377 377
 
378
-					<p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add Form".', 'give' ); ?></p>
378
+					<p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add Form".', 'give'); ?></p>
379 379
 				</div>
380 380
 
381 381
 				<div class="content feature-section-item last-feature">
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 				</div>
393 393
 
394 394
 				<div class="content feature-section-item last-feature">
395
-					<h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3>
395
+					<h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3>
396 396
 
397
-					<p><?php esc_html_e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p>
397
+					<p><?php esc_html_e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p>
398 398
 				</div>
399 399
 
400 400
 			</div>
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 			<div class="feature-section clearfix">
404 404
 
405 405
 				<div class="content feature-section-item add-content">
406
-					<h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3>
406
+					<h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3>
407 407
 
408
-					<p><?php esc_html_e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p>
408
+					<p><?php esc_html_e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p>
409 409
 
410
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
410
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
411 411
 				</div>
412 412
 
413 413
 				<div class="content feature-section-item last-feature">
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 				</div>
425 425
 
426 426
 				<div class="content feature-section-item last-feature">
427
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
427
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
428 428
 
429
-					<p><?php esc_html_e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p>
429
+					<p><?php esc_html_e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p>
430 430
 				</div>
431 431
 
432 432
 
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 	 * @return void
447 447
 	 */
448 448
 	public function credits_screen() {
449
-		list( $display_version ) = explode( '-', GIVE_VERSION );
449
+		list($display_version) = explode('-', GIVE_VERSION);
450 450
 		?>
451 451
 		<div class="wrap about-wrap">
452 452
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
453 453
 
454 454
 			<?php give_social_media_elements() ?>
455 455
 
456
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
456
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
457 457
 
458
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
458
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
459 459
 
460 460
 			<?php give_get_newsletter(); ?>
461 461
 
462 462
 			<div class="give-badge"><?php
463 463
 				printf(
464 464
 					/* translators: %s: Give version */
465
-					esc_html__( 'Version %s', 'give' ),
465
+					esc_html__('Version %s', 'give'),
466 466
 					$display_version
467 467
 				);
468 468
 			?></div>
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 			<p class="about-description"><?php
473 473
 				printf(
474 474
 					/* translators: %s: https://github.com/WordImpress/give */
475
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
476
-					esc_url( 'https://github.com/WordImpress/give' )
475
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
476
+					esc_url('https://github.com/WordImpress/give')
477 477
 				);
478 478
 			?></p>
479 479
 
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
 	 * @return string $readme HTML formatted readme file
491 491
 	 */
492 492
 	public function parse_readme() {
493
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
493
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
494 494
 
495
-		if ( ! $file ) {
496
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
495
+		if ( ! $file) {
496
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
497 497
 		} else {
498
-			$readme = file_get_contents( $file );
499
-			$readme = nl2br( esc_html( $readme ) );
500
-			$readme = explode( '== Changelog ==', $readme );
501
-			$readme = end( $readme );
502
-
503
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
504
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
505
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
506
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
507
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
498
+			$readme = file_get_contents($file);
499
+			$readme = nl2br(esc_html($readme));
500
+			$readme = explode('== Changelog ==', $readme);
501
+			$readme = end($readme);
502
+
503
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
504
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
505
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
506
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
507
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
508 508
 		}
509 509
 
510 510
 		return $readme;
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 	public function contributors() {
522 522
 		$contributors = $this->get_contributors();
523 523
 
524
-		if ( empty( $contributors ) ) {
524
+		if (empty($contributors)) {
525 525
 			return '';
526 526
 		}
527 527
 
528 528
 		$contributor_list = '<ul class="wp-people-group">';
529 529
 
530
-		foreach ( $contributors as $contributor ) {
530
+		foreach ($contributors as $contributor) {
531 531
 			$contributor_list .= '<li class="wp-person">';
532 532
 			$contributor_list .= sprintf(
533 533
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
534
-				esc_url( 'https://github.com/' . $contributor->login ),
535
-				esc_url( $contributor->avatar_url ),
536
-				esc_attr( $contributor->login )
534
+				esc_url('https://github.com/'.$contributor->login),
535
+				esc_url($contributor->avatar_url),
536
+				esc_attr($contributor->login)
537 537
 			);
538 538
 			$contributor_list .= sprintf(
539 539
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
540
-				esc_url( 'https://github.com/' . $contributor->login ),
541
-				esc_html( $contributor->login )
540
+				esc_url('https://github.com/'.$contributor->login),
541
+				esc_html($contributor->login)
542 542
 			);
543 543
 			$contributor_list .= '</li>';
544 544
 		}
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 	 * @return array $contributors List of contributors
557 557
 	 */
558 558
 	public function get_contributors() {
559
-		$contributors = get_transient( 'give_contributors' );
559
+		$contributors = get_transient('give_contributors');
560 560
 
561
-		if ( false !== $contributors ) {
561
+		if (false !== $contributors) {
562 562
 			return $contributors;
563 563
 		}
564 564
 
565
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
565
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
566 566
 
567
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
567
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
568 568
 			return array();
569 569
 		}
570 570
 
571
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
571
+		$contributors = json_decode(wp_remote_retrieve_body($response));
572 572
 
573
-		if ( ! is_array( $contributors ) ) {
573
+		if ( ! is_array($contributors)) {
574 574
 			return array();
575 575
 		}
576 576
 
577
-		set_transient( 'give_contributors', $contributors, 3600 );
577
+		set_transient('give_contributors', $contributors, 3600);
578 578
 
579 579
 		return $contributors;
580 580
 	}
@@ -592,24 +592,24 @@  discard block
 block discarded – undo
592 592
 		$give_options = give_get_settings();
593 593
 
594 594
 		// Bail if no activation redirect
595
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
595
+		if ( ! get_transient('_give_activation_redirect')) {
596 596
 			return;
597 597
 		}
598 598
 
599 599
 		// Delete the redirect transient
600
-		delete_transient( '_give_activation_redirect' );
600
+		delete_transient('_give_activation_redirect');
601 601
 
602 602
 		// Bail if activating from network, or bulk
603
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
603
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
604 604
 			return;
605 605
 		}
606 606
 
607
-		$upgrade = get_option( 'give_version_upgraded_from' );
607
+		$upgrade = get_option('give_version_upgraded_from');
608 608
 
609
-		if ( ! $upgrade ) { // First time install
610
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
609
+		if ( ! $upgrade) { // First time install
610
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
611 611
 			exit;
612
-		} elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings
612
+		} elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings
613 613
 
614 614
 		} else { // Welcome is NOT disabled in settings
615 615
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Exit if accessed directly
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @param $_banner_details
27 27
 	 */
28
-	function __construct( $_banner_details ) {
28
+	function __construct($_banner_details) {
29 29
 
30 30
 		$current_user = wp_get_current_user();
31 31
 
32 32
 		$this->banner_details = $_banner_details;
33
-		$this->test_mode      = ( $this->banner_details['testing'] == 'true' ) ? true : false;
34
-		$this->nag_meta_key   = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
33
+		$this->test_mode      = ($this->banner_details['testing'] == 'true') ? true : false;
34
+		$this->nag_meta_key   = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
35 35
 
36 36
 		//Get current user
37 37
 		$this->user_id = $current_user->ID;
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	public function init() {
52 52
 
53 53
 		//Testing?
54
-		if ( $this->test_mode ) {
55
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
54
+		if ($this->test_mode) {
55
+			delete_user_meta($this->user_id, $this->nag_meta_key);
56 56
 		}
57 57
 
58 58
 		//Get the current page to add the notice to
59
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
60
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
59
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
60
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
61 61
 	}
62 62
 
63 63
 	/**
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 		global $pagenow;
73 73
 
74 74
 		//Make sure we're on the plugins page.
75
-		if ( $pagenow !== 'plugins.php' ) {
75
+		if ($pagenow !== 'plugins.php') {
76 76
 			return false;
77 77
 		}
78 78
 
79 79
 		// If the user hasn't already dismissed the alert, output activation banner.
80
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) {
80
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) {
81 81
 
82 82
 			// Output inline styles here because there's no reason
83 83
 			// to enqueued them after the alert is dismissed.
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			<div class="updated give-addon-alert">
160 160
 
161 161
 				<!-- Dismiss Button -->
162
-				<a href="<?php echo admin_url( 'plugins.php?' . $this->nag_meta_key . '=0' ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
162
+				<a href="<?php echo admin_url('plugins.php?'.$this->nag_meta_key.'=0'); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
163 163
 
164 164
 				<!-- Logo -->
165 165
 				<img src="<?php echo GIVE_PLUGIN_URL; ?>assets/images/svg/give-icon-full-circle.svg" class="give-logo" />
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 					<h3><?php
171 171
 						printf(
172 172
 							/* translators: %s: Add-on name */
173
-							esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ),
174
-							'<span>' . $this->banner_details['name'] . '</span>'
173
+							esc_html__("Thank you for installing Give's %s Add-on!", 'give'),
174
+							'<span>'.$this->banner_details['name'].'</span>'
175 175
 						);
176 176
 					?></h3>
177 177
 
@@ -180,23 +180,23 @@  discard block
 block discarded – undo
180 180
 
181 181
 						<?php
182 182
 						//Point them to your settings page
183
-						if ( isset( $this->banner_details['settings_url'] ) ) {
183
+						if (isset($this->banner_details['settings_url'])) {
184 184
 							?>
185 185
 							<a href="<?php echo $this->banner_details['settings_url']; ?>">
186
-								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?>
186
+								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?>
187 187
 							</a>
188 188
 							<?php
189 189
 						}
190 190
 
191 191
 						// Show them how to configure the Addon
192
-						if ( isset( $this->banner_details['documentation_url'] ) ) {
192
+						if (isset($this->banner_details['documentation_url'])) {
193 193
 							?>
194 194
 							<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
195 195
 								<span class="dashicons dashicons-media-text"></span>
196 196
 								<?php
197 197
 									printf(
198 198
 										/* translators: %s: Add-on name */
199
-										esc_html__( 'Documentation: %s Add-on', 'give' ),
199
+										esc_html__('Documentation: %s Add-on', 'give'),
200 200
 										$this->banner_details['name']
201 201
 									);
202 202
 								?>
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 						}
206 206
 
207 207
 						//Let them signup for plugin updates
208
-						if ( isset( $this->banner_details['support_url'] ) ) {
208
+						if (isset($this->banner_details['support_url'])) {
209 209
 							?>
210 210
 							<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
211
-								<span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?>
211
+								<span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?>
212 212
 							</a>
213 213
 							<?php
214 214
 						}
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 		/* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
237 237
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
238 238
 		 */
239
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
239
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
240 240
 
241 241
 			//Get the global user
242 242
 			$current_user = wp_get_current_user();
243 243
 			$user_id = $current_user->ID;
244 244
 
245
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
245
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
246 246
 		}
247 247
 	}
248 248
 
Please login to merge, or discard this patch.
includes/admin/plugins.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array An array of updated action links.
25 25
  */
26
-function give_plugin_action_links( $actions ) {
26
+function give_plugin_action_links($actions) {
27 27
 	$new_actions = array(
28 28
 		'settings' => sprintf(
29 29
 			'<a href="%1$s">%2$s</a>',
30
-			admin_url( 'edit.php?post_type=give_forms&page=give-settings' ),
31
-			esc_html__( 'Settings', 'give' )
30
+			admin_url('edit.php?post_type=give_forms&page=give-settings'),
31
+			esc_html__('Settings', 'give')
32 32
 		),
33 33
 	);
34 34
 
35
-	return array_merge( $new_actions, $actions );
35
+	return array_merge($new_actions, $actions);
36 36
 }
37 37
 
38
-add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' );
38
+add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links');
39 39
 
40 40
 
41 41
 /**
@@ -48,35 +48,35 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @return array
50 50
  */
51
-function give_plugin_row_meta( $plugin_meta, $plugin_file ) {
52
-	if ( $plugin_file != GIVE_PLUGIN_BASENAME ) {
51
+function give_plugin_row_meta($plugin_meta, $plugin_file) {
52
+	if ($plugin_file != GIVE_PLUGIN_BASENAME) {
53 53
 		return $plugin_meta;
54 54
 	}
55 55
 
56 56
 	$new_meta_links = array(
57 57
 		sprintf(
58 58
 			'<a href="%1$s" target="_blank">%2$s</a>',
59
-			esc_url( add_query_arg( array(
59
+			esc_url(add_query_arg(array(
60 60
 					'utm_source'   => 'plugins-page',
61 61
 					'utm_medium'   => 'plugin-row',
62 62
 					'utm_campaign' => 'admin',
63
-				), 'https://givewp.com/documentation/' )
63
+				), 'https://givewp.com/documentation/')
64 64
 			),
65
-			esc_html__( 'Documentation', 'give' )
65
+			esc_html__('Documentation', 'give')
66 66
 		),
67 67
 		sprintf(
68 68
 			'<a href="%1$s" target="_blank">%2$s</a>',
69
-			esc_url( add_query_arg( array(
69
+			esc_url(add_query_arg(array(
70 70
 					'utm_source'   => 'plugins-page',
71 71
 					'utm_medium'   => 'plugin-row',
72 72
 					'utm_campaign' => 'admin',
73
-				), 'https://givewp.com/addons/' )
73
+				), 'https://givewp.com/addons/')
74 74
 			),
75
-			esc_html__( 'Add-ons', 'give' )
75
+			esc_html__('Add-ons', 'give')
76 76
 		),
77 77
 	);
78 78
 
79
-	return array_merge( $plugin_meta, $new_meta_links );
79
+	return array_merge($plugin_meta, $new_meta_links);
80 80
 }
81 81
 
82
-add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 );
82
+add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2);
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
  * @global $wpdb
24 24
  * @return void
25 25
  */
26
-function give_install( $network_wide = false ) {
26
+function give_install($network_wide = false) {
27 27
 
28 28
 	global $wpdb;
29 29
 
30
-	if ( is_multisite() && $network_wide ) {
30
+	if (is_multisite() && $network_wide) {
31 31
 
32
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
32
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
33 33
 
34
-			switch_to_blog( $blog_id );
34
+			switch_to_blog($blog_id);
35 35
 			give_run_install();
36 36
 			restore_current_blog();
37 37
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 }
47 47
 
48
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
48
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
49 49
 
50 50
 /**
51 51
  * Run the Give Install process.
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
 	give_setup_post_types();
62 62
 
63 63
 	// Clear the permalinks.
64
-	flush_rewrite_rules( false );
64
+	flush_rewrite_rules(false);
65 65
 
66 66
 	// Add Upgraded From Option.
67
-	$current_version = get_option( 'give_version' );
68
-	if ( $current_version ) {
69
-		update_option( 'give_version_upgraded_from', $current_version );
67
+	$current_version = get_option('give_version');
68
+	if ($current_version) {
69
+		update_option('give_version_upgraded_from', $current_version);
70 70
 	}
71 71
 
72 72
 	// Setup some default options.
73 73
 	$options = array();
74 74
 
75 75
 	// Checks if the Success Page option exists AND that the page exists.
76
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
76
+	if ( ! get_post(give_get_option('success_page'))) {
77 77
 
78 78
 		// Donation Confirmation (Success) Page
79 79
 		$success = wp_insert_post(
80 80
 			array(
81
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
81
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
82 82
 				'post_content'   => '[give_receipt]',
83 83
 				'post_status'    => 'publish',
84 84
 				'post_author'    => 1,
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	// Checks if the Failure Page option exists AND that the page exists.
95
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
95
+	if ( ! get_post(give_get_option('failure_page'))) {
96 96
 
97 97
 		// Failed Donation Page
98 98
 		$failed = wp_insert_post(
99 99
 			array(
100
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
101
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
100
+				'post_title'     => esc_html__('Donation Failed', 'give'),
101
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
102 102
 				'post_status'    => 'publish',
103 103
 				'post_author'    => 1,
104 104
 				'post_type'      => 'page',
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	// Checks if the History Page option exists AND that the page exists.
113
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
113
+	if ( ! get_post(give_get_option('history_page'))) {
114 114
 		// Donation History Page
115 115
 		$history = wp_insert_post(
116 116
 			array(
117
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
117
+				'post_title'     => esc_html__('Donation History', 'give'),
118 118
 				'post_content'   => '[donation_history]',
119 119
 				'post_status'    => 'publish',
120 120
 				'post_author'    => 1,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
130
-	if ( empty( $current_version ) ) {
130
+	if (empty($current_version)) {
131 131
 		$options['base_country']       = 'US';
132 132
 		$options['test_mode']          = 1;
133 133
 		$options['currency']           = 'USD';
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	// Populate the default values.
154
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
155
-	update_option( 'give_version', GIVE_VERSION );
154
+	update_option('give_settings', array_merge($give_options, $options));
155
+	update_option('give_version', GIVE_VERSION);
156 156
 
157 157
 	// Create Give roles.
158 158
 	$roles = new Give_Roles();
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	$roles->add_caps();
161 161
 
162 162
 	$api = new Give_API();
163
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
163
+	update_option('give_default_api_version', 'v'.$api->get_version());
164 164
 
165 165
 	// Create the customers databases.
166 166
 	@Give()->customers->create_table();
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	Give()->session->use_php_sessions();
171 171
 
172 172
 	// Add a temporary option to note that Give pages have been created.
173
-	set_transient( '_give_installed', $options, 30 );
173
+	set_transient('_give_installed', $options, 30);
174 174
 
175
-	if ( ! $current_version ) {
175
+	if ( ! $current_version) {
176 176
 
177
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
177
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
178 178
 
179 179
 		// When new upgrade routines are added, mark them as complete on fresh install.
180 180
 		$upgrade_routines = array(
@@ -183,22 +183,22 @@  discard block
 block discarded – undo
183 183
 			'upgrade_give_offline_status'
184 184
 		);
185 185
 
186
-		foreach ( $upgrade_routines as $upgrade ) {
187
-			give_set_upgrade_complete( $upgrade );
186
+		foreach ($upgrade_routines as $upgrade) {
187
+			give_set_upgrade_complete($upgrade);
188 188
 		}
189 189
 	}
190 190
 
191 191
 	// Bail if activating from network, or bulk.
192
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
192
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
193 193
 		return;
194 194
 	}
195 195
 
196 196
 	// Add the transient to redirect.
197
-	set_transient( '_give_activation_redirect', true, 30 );
197
+	set_transient('_give_activation_redirect', true, 30);
198 198
 
199 199
 }
200 200
 
201
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
201
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
202 202
 
203 203
 /**
204 204
  * Network Activated New Site Setup.
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
  * @param  int    $site_id The Site ID.
215 215
  * @param  array  $meta Blog Meta.
216 216
  */
217
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
217
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
218 218
 
219
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
219
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
220 220
 
221
-		switch_to_blog( $blog_id );
221
+		switch_to_blog($blog_id);
222 222
 		give_install();
223 223
 		restore_current_blog();
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 }
228 228
 
229
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
229
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
230 230
 
231 231
 
232 232
 /**
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
  *
240 240
  * @return array          The tables to drop.
241 241
  */
242
-function give_wpmu_drop_tables( $tables, $blog_id ) {
242
+function give_wpmu_drop_tables($tables, $blog_id) {
243 243
 
244
-	switch_to_blog( $blog_id );
244
+	switch_to_blog($blog_id);
245 245
 	$customers_db     = new Give_DB_Customers();
246 246
 	$customer_meta_db = new Give_DB_Customer_Meta();
247 247
 
248
-	if ( $customers_db->installed() ) {
248
+	if ($customers_db->installed()) {
249 249
 		$tables[] = $customers_db->table_name;
250 250
 		$tables[] = $customer_meta_db->table_name;
251 251
 	}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
 }
257 257
 
258
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
258
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
259 259
 
260 260
 /**
261 261
  * Post-installation
@@ -267,16 +267,16 @@  discard block
 block discarded – undo
267 267
  */
268 268
 function give_after_install() {
269 269
 
270
-	if ( ! is_admin() ) {
270
+	if ( ! is_admin()) {
271 271
 		return;
272 272
 	}
273 273
 
274
-	$give_options     = get_transient( '_give_installed' );
275
-	$give_table_check = get_option( '_give_table_check', false );
274
+	$give_options     = get_transient('_give_installed');
275
+	$give_table_check = get_option('_give_table_check', false);
276 276
 
277
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
277
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
278 278
 
279
-		if ( ! @Give()->customer_meta->installed() ) {
279
+		if ( ! @Give()->customer_meta->installed()) {
280 280
 
281 281
 			// Create the customer meta database
282 282
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
 		}
286 286
 
287
-		if ( ! @Give()->customers->installed() ) {
287
+		if ( ! @Give()->customers->installed()) {
288 288
 			// Create the customers database
289 289
 			// (this ensures it creates it on multisite instances where it is network activated).
290 290
 			@Give()->customers->create_table();
@@ -296,22 +296,22 @@  discard block
 block discarded – undo
296 296
 			 *
297 297
 			 * @param array $give_options Give plugin options.
298 298
 			 */
299
-			do_action( 'give_after_install', $give_options );
299
+			do_action('give_after_install', $give_options);
300 300
 		}
301 301
 
302
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
302
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
303 303
 
304 304
 	}
305 305
 
306 306
 	// Delete the transient
307
-	if ( false !== $give_options ) {
308
-		delete_transient( '_give_installed' );
307
+	if (false !== $give_options) {
308
+		delete_transient('_give_installed');
309 309
 	}
310 310
 
311 311
 
312 312
 }
313 313
 
314
-add_action( 'admin_init', 'give_after_install' );
314
+add_action('admin_init', 'give_after_install');
315 315
 
316 316
 
317 317
 /**
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 
327 327
 	global $wp_roles;
328 328
 
329
-	if ( ! is_object( $wp_roles ) ) {
329
+	if ( ! is_object($wp_roles)) {
330 330
 		return;
331 331
 	}
332 332
 
333
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
333
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
334 334
 
335 335
 		// Create Give plugin roles
336 336
 		$roles = new Give_Roles();
@@ -341,4 +341,4 @@  discard block
 block discarded – undo
341 341
 
342 342
 }
343 343
 
344
-add_action( 'admin_init', 'give_install_roles_on_network' );
345 344
\ No newline at end of file
345
+add_action('admin_init', 'give_install_roles_on_network');
346 346
\ No newline at end of file
Please login to merge, or discard this patch.
includes/deprecated/deprecated-filters.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
  */
5 5
 $give_map_deprecated_filters = give_deprecated_filters();
6 6
 
7
-foreach ( $give_map_deprecated_filters as $new => $old ) {
8
-	add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 );
7
+foreach ($give_map_deprecated_filters as $new => $old) {
8
+	add_filter($new, 'give_deprecated_filter_mapping', 10, 4);
9 9
 }
10 10
 
11 11
 /**
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	);
59 59
 
60 60
 	// Dynamic filters.
61
-	switch ( true ) {
62
-		case ( ! empty( $_GET['payment-confirmation'] ) ) :
61
+	switch (true) {
62
+		case ( ! empty($_GET['payment-confirmation'])) :
63 63
 			$give_deprecated_filters["give_donation_confirm_{$_GET['payment-confirmation']}"] = "give_payment_confirm_{$_GET['payment-confirmation']}";
64 64
 	}
65 65
 
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * @return mixed|void
78 78
  */
79
-function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) {
79
+function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') {
80 80
 	$give_map_deprecated_filters = give_deprecated_filters();
81 81
 	$filter = current_filter();
82 82
 
83
-	if ( isset( $give_map_deprecated_filters[ $filter ] ) ) {
84
-		if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) {
85
-			$data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 );
83
+	if (isset($give_map_deprecated_filters[$filter])) {
84
+		if (has_filter($give_map_deprecated_filters[$filter])) {
85
+			$data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3);
86 86
 
87
-			if ( ! defined( 'DOING_AJAX' ) ) {
88
-				_give_deprecated_function( 'The ' . $give_map_deprecated_filters[ $filter ] . ' filter', '1.7', $filter );
87
+			if ( ! defined('DOING_AJAX')) {
88
+				_give_deprecated_function('The '.$give_map_deprecated_filters[$filter].' filter', '1.7', $filter);
89 89
 			}
90 90
 		}
91 91
 	}
Please login to merge, or discard this patch.
includes/deprecated/deprecated-functions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return bool $ret True if guest checkout is enabled, false otherwise
30 30
  */
31
-function give_no_guest_checkout( $form_id ) {
31
+function give_no_guest_checkout($form_id) {
32 32
 
33 33
 	$backtrace = debug_backtrace();
34 34
 
35
-	_give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace );
35
+	_give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace);
36 36
 
37
-	$ret = get_post_meta( $form_id, '_give_logged_in_only', true );
37
+	$ret = get_post_meta($form_id, '_give_logged_in_only', true);
38 38
 
39
-	return (bool) apply_filters( 'give_no_guest_checkout', $ret );
39
+	return (bool) apply_filters('give_no_guest_checkout', $ret);
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
includes/deprecated/deprecated-actions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 */
5 5
 $give_map_deprecated_actions = give_deprecated_actions();
6 6
 
7
-foreach ( $give_map_deprecated_actions as $new => $old ) {
8
-	add_action( $new, 'give_deprecated_action_mapping', 10, 4 );
7
+foreach ($give_map_deprecated_actions as $new => $old) {
8
+	add_action($new, 'give_deprecated_action_mapping', 10, 4);
9 9
 }
10 10
 
11 11
 /**
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
  *
79 79
  * @return mixed|void
80 80
  */
81
-function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) {
81
+function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') {
82 82
 	$give_map_deprecated_actions = give_deprecated_actions();
83 83
 	$action = current_filter();
84 84
 
85
-	if ( isset( $give_map_deprecated_actions[ $action ] ) ) {
86
-		if ( has_action( $give_map_deprecated_actions[ $action ] ) ) {
87
-			do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 );
85
+	if (isset($give_map_deprecated_actions[$action])) {
86
+		if (has_action($give_map_deprecated_actions[$action])) {
87
+			do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3);
88 88
 
89
-			if ( ! defined( 'DOING_AJAX' ) ) {
90
-				_give_deprecated_function( 'The ' . $give_map_deprecated_actions[ $action ] . ' action', '1.7', $action );
89
+			if ( ! defined('DOING_AJAX')) {
90
+				_give_deprecated_function('The '.$give_map_deprecated_actions[$action].' action', '1.7', $action);
91 91
 			}
92 92
 		}
93 93
 	}
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +102 added lines, -102 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
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,40 +56,40 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) );
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url()));
70 70
 	$receipt_link = sprintf(
71 71
 		'<a href="%1$s">%2$s</a>',
72 72
 		$receipt_link_url,
73
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
73
+		esc_html__('View the receipt in your browser &raquo;', 'give')
74 74
 	);
75 75
 
76 76
 	$user = wp_get_current_user();
77 77
 
78
-	$message = str_replace( '{name}', $user->display_name, $message );
79
-	$message = str_replace( '{fullname}', $user->display_name, $message );
80
-	$message = str_replace( '{username}', $user->user_login, $message );
81
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
82
-	$message = str_replace( '{price}', $price, $message );
83
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
84
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
85
-	$message = str_replace( '{payment_method}', $gateway, $message );
86
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
87
-	$message = str_replace( '{payment_id}', $payment_id, $message );
88
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
89
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
90
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
91
-
92
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
78
+	$message = str_replace('{name}', $user->display_name, $message);
79
+	$message = str_replace('{fullname}', $user->display_name, $message);
80
+	$message = str_replace('{username}', $user->user_login, $message);
81
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
82
+	$message = str_replace('{price}', $price, $message);
83
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
84
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
85
+	$message = str_replace('{payment_method}', $gateway, $message);
86
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
87
+	$message = str_replace('{payment_id}', $payment_id, $message);
88
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
89
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
90
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
91
+
92
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
93 93
 }
94 94
 
95 95
 /**
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
  * @since  1.0
102 102
  * @return array|bool
103 103
  */
104
-function give_email_template_preview( $array ) {
104
+function give_email_template_preview($array) {
105 105
 
106
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
106
+	if ( ! current_user_can('manage_give_settings')) {
107 107
 		return false;
108 108
 	}
109 109
 	$custom_field = array(
110
-		'name' => esc_html__( 'Preview Email', 'give' ),
111
-		'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ),
110
+		'name' => esc_html__('Preview Email', 'give'),
111
+		'desc' => esc_html__('Click the buttons to preview emails.', 'give'),
112 112
 		'id'   => 'give_email_preview_buttons',
113 113
 		'type' => 'email_preview_buttons'
114 114
 	);
115 115
 
116
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
116
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
117 117
 
118 118
 }
119 119
 
120
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
120
+add_filter('give_settings_emails', 'give_email_template_preview');
121 121
 
122 122
 /**
123 123
  * Output Email Template Preview Buttons.
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 function give_email_preview_buttons_callback() {
130 130
 	ob_start();
131 131
 	?>
132
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
133
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
132
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
133
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
134 134
 		'give_action'  => 'send_test_email',
135 135
 		'give-message' => 'sent-test-email',
136 136
 		'tag'          => 'emails'
137
-	) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
137
+	)), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
138 138
 	<?php
139 139
 	echo ob_get_clean();
140 140
 }
@@ -147,46 +147,46 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function give_display_email_template_preview() {
149 149
 
150
-	if ( empty( $_GET['give_action'] ) ) {
150
+	if (empty($_GET['give_action'])) {
151 151
 		return;
152 152
 	}
153 153
 
154
-	if ( 'preview_email' !== $_GET['give_action'] ) {
154
+	if ('preview_email' !== $_GET['give_action']) {
155 155
 		return;
156 156
 	}
157 157
 
158
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
158
+	if ( ! current_user_can('manage_give_settings')) {
159 159
 		return;
160 160
 	}
161 161
 
162 162
 
163
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
163
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
164 164
 
165
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
165
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
166 166
 
167 167
 	echo give_get_preview_email_header();
168 168
 
169 169
 	//Are we previewing an actual payment?
170
-	if ( ! empty( $payment_id ) ) {
170
+	if ( ! empty($payment_id)) {
171 171
 
172
-		$content = give_get_email_body_content( $payment_id );
172
+		$content = give_get_email_body_content($payment_id);
173 173
 
174
-		$preview_content = give_do_email_tags( $content, $payment_id );
174
+		$preview_content = give_do_email_tags($content, $payment_id);
175 175
 
176 176
 	} else {
177 177
 
178 178
 		//No payment ID, use sample preview content
179
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
179
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
180 180
 	}
181 181
 
182 182
 
183
-	echo Give()->emails->build_email( $preview_content );
183
+	echo Give()->emails->build_email($preview_content);
184 184
 
185 185
 	exit;
186 186
 
187 187
 }
188 188
 
189
-add_action( 'init', 'give_display_email_template_preview' );
189
+add_action('init', 'give_display_email_template_preview');
190 190
 
191 191
 /**
192 192
  * Email Template Body.
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
  *
199 199
  * @return string $email_body Body of the email
200 200
  */
201
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
201
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
202 202
 
203 203
 	$default_email_body = give_get_default_donation_receipt_email();
204 204
 
205
-	$email_content = give_get_option( 'donation_receipt' );
206
-	$email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
205
+	$email_content = give_get_option('donation_receipt');
206
+	$email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body;
207 207
 
208
-	$email_body = wpautop( $email_content );
208
+	$email_body = wpautop($email_content);
209 209
 
210
-	$email_body = apply_filters( "give_donation_receipt_{Give()->emails->get_template()}", $email_body, $payment_id, $payment_data );
210
+	$email_body = apply_filters("give_donation_receipt_{Give()->emails->get_template()}", $email_body, $payment_id, $payment_data);
211 211
 
212
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
212
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
213 213
 }
214 214
 
215 215
 /**
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return string $email_body Body of the email
224 224
  */
225
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
225
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
226 226
 
227
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
228
-	$email     = give_get_payment_user_email( $payment_id );
227
+	$user_info = maybe_unserialize($payment_data['user_info']);
228
+	$email     = give_get_payment_user_email($payment_id);
229 229
 
230
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
231
-		$user_data = get_userdata( $user_info['id'] );
230
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
231
+		$user_data = get_userdata($user_info['id']);
232 232
 		$name      = $user_data->display_name;
233
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
234
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
233
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
234
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
235 235
 	} else {
236 236
 		$name = $email;
237 237
 	}
238 238
 
239
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
239
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
240 240
 
241
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
242
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
243
-	$default_email_body .= esc_html__( 'Forms sold:', 'give' ) . "\n\n";
244
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
245
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
246
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
247
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
241
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
242
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
243
+	$default_email_body .= esc_html__('Forms sold:', 'give')."\n\n";
244
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
245
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
246
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
247
+	$default_email_body .= esc_html__('Thank you', 'give');
248 248
 
249
-	$email = give_get_option( 'donation_notification' );
250
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
249
+	$email = give_get_option('donation_notification');
250
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
251 251
 
252
-	$email_body = give_do_email_tags( $email, $payment_id );
252
+	$email_body = give_do_email_tags($email, $payment_id);
253 253
 
254
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
254
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
255 255
 }
256 256
 
257 257
 /**
@@ -264,19 +264,19 @@  discard block
 block discarded – undo
264 264
  * @since  1.0
265 265
  */
266 266
 function give_render_receipt_in_browser() {
267
-	if ( ! isset( $_GET['payment_key'] ) ) {
268
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
267
+	if ( ! isset($_GET['payment_key'])) {
268
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
269 269
 	}
270 270
 
271
-	$key = urlencode( $_GET['payment_key'] );
271
+	$key = urlencode($_GET['payment_key']);
272 272
 
273 273
 	ob_start();
274 274
 	//Disallows caching of the page
275
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
276
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
277
-	header( "Cache-Control: post-check=0, pre-check=0", false );
278
-	header( "Pragma: no-cache" ); // HTTP/1.0
279
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
275
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
276
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
277
+	header("Cache-Control: post-check=0, pre-check=0", false);
278
+	header("Pragma: no-cache"); // HTTP/1.0
279
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
280 280
 	?>
281 281
 	<!DOCTYPE html>
282 282
 	<html lang="en">
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		 *
288 288
 		 * @since 1.0
289 289
 		 */
290
-		do_action( 'give_receipt_head' );
290
+		do_action('give_receipt_head');
291 291
 		?>
292 292
 	</head>
293
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
293
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
294 294
 
295 295
 	<div id="give_receipt_wrapper">
296 296
 		<?php
@@ -299,16 +299,16 @@  discard block
 block discarded – undo
299 299
 		 *
300 300
 		 * @since 1.0
301 301
 		 */
302
-		do_action( 'give_render_receipt_in_browser_before' );
302
+		do_action('give_render_receipt_in_browser_before');
303 303
 
304
-		echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );
304
+		echo do_shortcode('[give_receipt payment_key='.$key.']');
305 305
 
306 306
 		/**
307 307
 		 * Fires in the receipt template after the content.
308 308
 		 *
309 309
 		 * @since 1.0
310 310
 		 */
311
-		do_action( 'give_render_receipt_in_browser_after' );
311
+		do_action('give_render_receipt_in_browser_after');
312 312
 		?>
313 313
 	</div>
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @since 1.0
320 320
 	 */
321
-	do_action( 'give_receipt_footer' );
321
+	do_action('give_receipt_footer');
322 322
 	?>
323 323
 	</body>
324 324
 	</html>
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	die();
328 328
 }
329 329
 
330
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
330
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
331 331
 
332 332
 
333 333
 /**
@@ -342,29 +342,29 @@  discard block
 block discarded – undo
342 342
 
343 343
 	//Payment receipt switcher
344 344
 	$payment_count = give_count_payments()->publish;
345
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
345
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
346 346
 
347
-	if ( $payment_count <= 0 ) {
347
+	if ($payment_count <= 0) {
348 348
 		return false;
349 349
 	}
350 350
 
351 351
 	//Get payments.
352
-	$payments = new Give_Payments_Query( array(
352
+	$payments = new Give_Payments_Query(array(
353 353
 		'number' => 100
354
-	) );
354
+	));
355 355
 	$payments = $payments->get_payments();
356 356
 	$options  = array();
357 357
 
358 358
 	//Provide nice human readable options.
359
-	if ( $payments ) {
360
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
361
-		foreach ( $payments as $payment ) {
359
+	if ($payments) {
360
+		$options[0] = esc_html__('- Select a donation -', 'give');
361
+		foreach ($payments as $payment) {
362 362
 
363
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
363
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
364 364
 
365 365
 		}
366 366
 	} else {
367
-		$options[0] = esc_html__( 'No donations found.', 'give' );
367
+		$options[0] = esc_html__('No donations found.', 'give');
368 368
 	}
369 369
 
370 370
 	//Start constructing HTML output.
@@ -377,16 +377,16 @@  discard block
 block discarded – undo
377 377
 			        var selected_trans = transactions.options[transactions.selectedIndex];
378 378
 				        console.log(selected_trans);
379 379
 				        if (selected_trans){
380
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
380
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
381 381
 				                window.location = url_string;
382 382
 				        }
383 383
 				    }
384 384
 			    </script>';
385 385
 
386
-	$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>';
386
+	$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>';
387 387
 
388 388
 	//The select field with 100 latest transactions
389
-	$transaction_header .= Give()->html->select( array(
389
+	$transaction_header .= Give()->html->select(array(
390 390
 		'name'             => 'preview_email_payment_id',
391 391
 		'selected'         => $payment_id,
392 392
 		'id'               => 'give_preview_email_payment_id',
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 		'select_atts'      => 'onchange="change_preview()">',
397 397
 		'show_option_all'  => false,
398 398
 		'show_option_none' => false
399
-	) );
399
+	));
400 400
 
401 401
 	//Closing tag
402 402
 	$transaction_header .= '</div>';
403 403
 
404
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
404
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
405 405
 
406 406
 }
407 407
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 function give_receipt_head_content() {
416 416
 
417 417
 	//Title.
418
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
418
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
419 419
 
420 420
 	//Meta.
421 421
 	$output .= '<meta charset="utf-8"/>
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 		<meta name="robots" content="noindex, nofollow"/>';
430 430
 
431 431
 	//CSS
432
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
432
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
433 433
 
434
-	echo apply_filters( 'give_receipt_head_content', $output );
434
+	echo apply_filters('give_receipt_head_content', $output);
435 435
 
436 436
 }
437 437
 
438
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
439 438
\ No newline at end of file
439
+add_action('give_receipt_head', 'give_receipt_head_content');
440 440
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +140 added lines, -140 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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function transactions_dropdown( $args = array() ) {
38
+	public function transactions_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'transactions',
@@ -45,34 +45,34 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => esc_html__( 'Select a transaction', 'give' )
48
+			'placeholder' => esc_html__('Select a transaction', 'give')
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53 53
 
54
-		$payments = new Give_Payments_Query( array(
54
+		$payments = new Give_Payments_Query(array(
55 55
 			'number' => $args['number']
56
-		) );
56
+		));
57 57
 
58 58
 		$payments = $payments->get_payments();
59 59
 
60 60
 		$options = array();
61 61
 
62 62
 		//Provide nice human readable options.
63
-		if ( $payments ) {
64
-			$options[0] = esc_html__( 'Select a donation', 'give' );
65
-			foreach ( $payments as $payment ) {
63
+		if ($payments) {
64
+			$options[0] = esc_html__('Select a donation', 'give');
65
+			foreach ($payments as $payment) {
66 66
 
67
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title);
67
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
68 68
 
69 69
 			}
70 70
 		} else {
71
-			$options[0] = esc_html__( 'No donations found.', 'give' );
71
+			$options[0] = esc_html__('No donations found.', 'give');
72 72
 		}
73 73
 
74 74
 
75
-		$output = $this->select( array(
75
+		$output = $this->select(array(
76 76
 			'name'             => $args['name'],
77 77
 			'selected'         => $args['selected'],
78 78
 			'id'               => $args['id'],
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			'select_atts'      => $args['select_atts'],
85 85
 			'show_option_all'  => false,
86 86
 			'show_option_none' => false
87
-		) );
87
+		));
88 88
 
89 89
 		return $output;
90 90
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string      Give forms dropdown.
103 103
 	 */
104
-	public function forms_dropdown( $args = array() ) {
104
+	public function forms_dropdown($args = array()) {
105 105
 
106 106
 		$defaults = array(
107 107
 			'name'        => 'forms',
@@ -111,43 +111,43 @@  discard block
 block discarded – undo
111 111
 			'selected'    => 0,
112 112
 			'chosen'      => false,
113 113
 			'number'      => 30,
114
-			'placeholder' => esc_attr__( 'Select a Form', 'give' )
114
+			'placeholder' => esc_attr__('Select a Form', 'give')
115 115
 		);
116 116
 
117
-		$args = wp_parse_args( $args, $defaults );
117
+		$args = wp_parse_args($args, $defaults);
118 118
 
119
-		$forms = get_posts( array(
119
+		$forms = get_posts(array(
120 120
 			'post_type'      => 'give_forms',
121 121
 			'orderby'        => 'title',
122 122
 			'order'          => 'ASC',
123 123
 			'posts_per_page' => $args['number']
124
-		) );
124
+		));
125 125
 
126 126
 		$options = array();
127 127
 
128
-		if ( $forms ) {
129
-			$options[0] = esc_attr__( 'Select a Form', 'give' );
130
-			foreach ( $forms as $form ) {
131
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
128
+		if ($forms) {
129
+			$options[0] = esc_attr__('Select a Form', 'give');
130
+			foreach ($forms as $form) {
131
+				$options[absint($form->ID)] = esc_html($form->post_title);
132 132
 			}
133 133
 		} else {
134
-			$options[0] = esc_html__( 'No forms found.', 'give' );
134
+			$options[0] = esc_html__('No forms found.', 'give');
135 135
 		}
136 136
 
137 137
 		// This ensures that any selected forms are included in the drop down
138
-		if ( is_array( $args['selected'] ) ) {
139
-			foreach ( $args['selected'] as $item ) {
140
-				if ( ! in_array( $item, $options ) ) {
141
-					$options[ $item ] = get_the_title( $item );
138
+		if (is_array($args['selected'])) {
139
+			foreach ($args['selected'] as $item) {
140
+				if ( ! in_array($item, $options)) {
141
+					$options[$item] = get_the_title($item);
142 142
 				}
143 143
 			}
144
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
145
-			if ( ! in_array( $args['selected'], $options ) ) {
146
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
144
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
145
+			if ( ! in_array($args['selected'], $options)) {
146
+				$options[$args['selected']] = get_the_title($args['selected']);
147 147
 			}
148 148
 		}
149 149
 
150
-		$output = $this->select( array(
150
+		$output = $this->select(array(
151 151
 			'name'             => $args['name'],
152 152
 			'selected'         => $args['selected'],
153 153
 			'id'               => $args['id'],
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'placeholder'      => $args['placeholder'],
159 159
 			'show_option_all'  => false,
160 160
 			'show_option_none' => false
161
-		) );
161
+		));
162 162
 
163 163
 		return $output;
164 164
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return string      Donors dropdown.
177 177
 	 */
178
-	public function donor_dropdown( $args = array() ) {
178
+	public function donor_dropdown($args = array()) {
179 179
 
180 180
 		$defaults = array(
181 181
 			'name'        => 'customers',
@@ -184,38 +184,38 @@  discard block
 block discarded – undo
184 184
 			'multiple'    => false,
185 185
 			'selected'    => 0,
186 186
 			'chosen'      => true,
187
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
187
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
188 188
 			'number'      => 30
189 189
 		);
190 190
 
191
-		$args = wp_parse_args( $args, $defaults );
191
+		$args = wp_parse_args($args, $defaults);
192 192
 
193
-		$customers = Give()->customers->get_customers( array(
193
+		$customers = Give()->customers->get_customers(array(
194 194
 			'number' => $args['number']
195
-		) );
195
+		));
196 196
 
197 197
 		$options = array();
198 198
 
199
-		if ( $customers ) {
200
-			$options[0] = esc_html__( 'No donor attached', 'give' );
201
-			foreach ( $customers as $customer ) {
202
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
199
+		if ($customers) {
200
+			$options[0] = esc_html__('No donor attached', 'give');
201
+			foreach ($customers as $customer) {
202
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
203 203
 			}
204 204
 		} else {
205
-			$options[0] = esc_html__( 'No donors found.', 'give' );
205
+			$options[0] = esc_html__('No donors found.', 'give');
206 206
 		}
207 207
 
208
-		if ( ! empty( $args['selected'] ) ) {
208
+		if ( ! empty($args['selected'])) {
209 209
 
210 210
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
211 211
 
212
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
212
+			if ( ! array_key_exists($args['selected'], $options)) {
213 213
 
214
-				$customer = new Give_Customer( $args['selected'] );
214
+				$customer = new Give_Customer($args['selected']);
215 215
 
216
-				if ( $customer ) {
216
+				if ($customer) {
217 217
 
218
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
218
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
219 219
 
220 220
 				}
221 221
 
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 
224 224
 		}
225 225
 
226
-		$output = $this->select( array(
226
+		$output = $this->select(array(
227 227
 			'name'             => $args['name'],
228 228
 			'selected'         => $args['selected'],
229 229
 			'id'               => $args['id'],
230
-			'class'            => $args['class'] . ' give-customer-select',
230
+			'class'            => $args['class'].' give-customer-select',
231 231
 			'options'          => $options,
232 232
 			'multiple'         => $args['multiple'],
233 233
 			'chosen'           => $args['chosen'],
234 234
 			'show_option_all'  => false,
235 235
 			'show_option_none' => false
236
-		) );
236
+		));
237 237
 
238 238
 		return $output;
239 239
 	}
@@ -251,21 +251,21 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return string           Categories dropdown.
253 253
 	 */
254
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
255
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
254
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
255
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
256 256
 		$options    = array();
257 257
 
258
-		foreach ( $categories as $category ) {
259
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
258
+		foreach ($categories as $category) {
259
+			$options[absint($category->term_id)] = esc_html($category->name);
260 260
 		}
261 261
 
262
-		$output = $this->select( array(
262
+		$output = $this->select(array(
263 263
 			'name'             => $name,
264 264
 			'selected'         => $selected,
265 265
 			'options'          => $options,
266
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
266
+			'show_option_all'  => esc_html__('All Categories', 'give'),
267 267
 			'show_option_none' => false
268
-		) );
268
+		));
269 269
 
270 270
 		return $output;
271 271
 	}
@@ -285,25 +285,25 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return string               Years dropdown.
287 287
 	 */
288
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
289
-		$current    = date( 'Y' );
290
-		$start_year = $current - absint( $years_before );
291
-		$end_year   = $current + absint( $years_after );
292
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
288
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
289
+		$current    = date('Y');
290
+		$start_year = $current - absint($years_before);
291
+		$end_year   = $current + absint($years_after);
292
+		$selected   = empty($selected) ? date('Y') : $selected;
293 293
 		$options    = array();
294 294
 
295
-		while ( $start_year <= $end_year ) {
296
-			$options[ absint( $start_year ) ] = $start_year;
297
-			$start_year ++;
295
+		while ($start_year <= $end_year) {
296
+			$options[absint($start_year)] = $start_year;
297
+			$start_year++;
298 298
 		}
299 299
 
300
-		$output = $this->select( array(
300
+		$output = $this->select(array(
301 301
 			'name'             => $name,
302 302
 			'selected'         => $selected,
303 303
 			'options'          => $options,
304 304
 			'show_option_all'  => false,
305 305
 			'show_option_none' => false
306
-		) );
306
+		));
307 307
 
308 308
 		return $output;
309 309
 	}
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return string           Months dropdown.
323 323
 	 */
324
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
324
+	public function month_dropdown($name = 'month', $selected = 0) {
325 325
 		$month    = 1;
326 326
 		$options  = array();
327
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
327
+		$selected = empty($selected) ? date('n') : $selected;
328 328
 
329
-		while ( $month <= 12 ) {
330
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
331
-			$month ++;
329
+		while ($month <= 12) {
330
+			$options[absint($month)] = give_month_num_to_name($month);
331
+			$month++;
332 332
 		}
333 333
 
334
-		$output = $this->select( array(
334
+		$output = $this->select(array(
335 335
 			'name'             => $name,
336 336
 			'selected'         => $selected,
337 337
 			'options'          => $options,
338 338
 			'show_option_all'  => false,
339 339
 			'show_option_none' => false
340
-		) );
340
+		));
341 341
 
342 342
 		return $output;
343 343
 	}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return string      The dropdown.
356 356
 	 */
357
-	public function select( $args = array() ) {
357
+	public function select($args = array()) {
358 358
 		$defaults = array(
359 359
 			'options'          => array(),
360 360
 			'name'             => null,
@@ -365,60 +365,60 @@  discard block
 block discarded – undo
365 365
 			'placeholder'      => null,
366 366
 			'multiple'         => false,
367 367
 			'select_atts'      => false,
368
-			'show_option_all'  => esc_html__( 'All', 'give' ),
369
-			'show_option_none' => esc_html__( 'None', 'give' )
368
+			'show_option_all'  => esc_html__('All', 'give'),
369
+			'show_option_none' => esc_html__('None', 'give')
370 370
 		);
371 371
 
372
-		$args = wp_parse_args( $args, $defaults );
372
+		$args = wp_parse_args($args, $defaults);
373 373
 
374
-		if ( $args['multiple'] ) {
374
+		if ($args['multiple']) {
375 375
 			$multiple = ' MULTIPLE';
376 376
 		} else {
377 377
 			$multiple = '';
378 378
 		}
379 379
 
380
-		if ( $args['chosen'] ) {
380
+		if ($args['chosen']) {
381 381
 			$args['class'] .= ' give-select-chosen';
382 382
 		}
383 383
 
384
-		if ( $args['placeholder'] ) {
384
+		if ($args['placeholder']) {
385 385
 			$placeholder = $args['placeholder'];
386 386
 		} else {
387 387
 			$placeholder = '';
388 388
 		}
389 389
 
390 390
 
391
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">';
391
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">';
392 392
 
393
-		if ( $args['show_option_all'] ) {
394
-			if ( $args['multiple'] ) {
395
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
393
+		if ($args['show_option_all']) {
394
+			if ($args['multiple']) {
395
+				$selected = selected(true, in_array(0, $args['selected']), false);
396 396
 			} else {
397
-				$selected = selected( $args['selected'], 0, false );
397
+				$selected = selected($args['selected'], 0, false);
398 398
 			}
399
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
399
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
400 400
 		}
401 401
 
402
-		if ( ! empty( $args['options'] ) ) {
402
+		if ( ! empty($args['options'])) {
403 403
 
404
-			if ( $args['show_option_none'] ) {
405
-				if ( $args['multiple'] ) {
406
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
404
+			if ($args['show_option_none']) {
405
+				if ($args['multiple']) {
406
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
407 407
 				} else {
408
-					$selected = selected( $args['selected'], - 1, false );
408
+					$selected = selected($args['selected'], - 1, false);
409 409
 				}
410
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
410
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
411 411
 			}
412 412
 
413
-			foreach ( $args['options'] as $key => $option ) {
413
+			foreach ($args['options'] as $key => $option) {
414 414
 
415
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
416
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
415
+				if ($args['multiple'] && is_array($args['selected'])) {
416
+					$selected = selected(true, in_array($key, $args['selected']), false);
417 417
 				} else {
418
-					$selected = selected( $args['selected'], $key, false );
418
+					$selected = selected($args['selected'], $key, false);
419 419
 				}
420 420
 
421
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
421
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
422 422
 			}
423 423
 		}
424 424
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * @return string      The checkbox.
441 441
 	 */
442
-	public function checkbox( $args = array() ) {
442
+	public function checkbox($args = array()) {
443 443
 		$defaults = array(
444 444
 			'name'    => null,
445 445
 			'current' => null,
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
 			)
451 451
 		);
452 452
 
453
-		$args = wp_parse_args( $args, $defaults );
453
+		$args = wp_parse_args($args, $defaults);
454 454
 
455 455
 		$options = '';
456
-		if ( ! empty( $args['options']['disabled'] ) ) {
456
+		if ( ! empty($args['options']['disabled'])) {
457 457
 			$options .= ' disabled="disabled"';
458
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
458
+		} elseif ( ! empty($args['options']['readonly'])) {
459 459
 			$options .= ' readonly';
460 460
 		}
461 461
 
462
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
462
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
463 463
 
464 464
 		return $output;
465 465
 	}
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * @return string      The text field.
478 478
 	 */
479
-	public function text( $args = array() ) {
479
+	public function text($args = array()) {
480 480
 		// Backwards compatibility
481
-		if ( func_num_args() > 1 ) {
481
+		if (func_num_args() > 1) {
482 482
 			$args = func_get_args();
483 483
 
484 484
 			$name  = $args[0];
485
-			$value = isset( $args[1] ) ? $args[1] : '';
486
-			$label = isset( $args[2] ) ? $args[2] : '';
487
-			$desc  = isset( $args[3] ) ? $args[3] : '';
485
+			$value = isset($args[1]) ? $args[1] : '';
486
+			$label = isset($args[2]) ? $args[2] : '';
487
+			$desc  = isset($args[3]) ? $args[3] : '';
488 488
 		}
489 489
 
490 490
 		$defaults = array(
491
-			'name'         => isset( $name ) ? $name : 'text',
492
-			'value'        => isset( $value ) ? $value : null,
493
-			'label'        => isset( $label ) ? $label : null,
494
-			'desc'         => isset( $desc ) ? $desc : null,
491
+			'name'         => isset($name) ? $name : 'text',
492
+			'value'        => isset($value) ? $value : null,
493
+			'label'        => isset($label) ? $label : null,
494
+			'desc'         => isset($desc) ? $desc : null,
495 495
 			'placeholder'  => '',
496 496
 			'class'        => 'regular-text',
497 497
 			'disabled'     => false,
@@ -499,29 +499,29 @@  discard block
 block discarded – undo
499 499
 			'data'         => false
500 500
 		);
501 501
 
502
-		$args = wp_parse_args( $args, $defaults );
502
+		$args = wp_parse_args($args, $defaults);
503 503
 
504 504
 		$disabled = '';
505
-		if ( $args['disabled'] ) {
505
+		if ($args['disabled']) {
506 506
 			$disabled = ' disabled="disabled"';
507 507
 		}
508 508
 
509 509
 		$data = '';
510
-		if ( ! empty( $args['data'] ) ) {
511
-			foreach ( $args['data'] as $key => $value ) {
512
-				$data .= 'data-' . $key . '="' . $value . '" ';
510
+		if ( ! empty($args['data'])) {
511
+			foreach ($args['data'] as $key => $value) {
512
+				$data .= 'data-'.$key.'="'.$value.'" ';
513 513
 			}
514 514
 		}
515 515
 
516
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
516
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
517 517
 
518
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
518
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
519 519
 
520
-		if ( ! empty( $args['desc'] ) ) {
521
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
520
+		if ( ! empty($args['desc'])) {
521
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
522 522
 		}
523 523
 
524
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
524
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
525 525
 
526 526
 		$output .= '</span>';
527 527
 
@@ -540,15 +540,15 @@  discard block
 block discarded – undo
540 540
 	 *
541 541
 	 * @return string      The date picker.
542 542
 	 */
543
-	public function date_field( $args = array() ) {
543
+	public function date_field($args = array()) {
544 544
 
545
-		if ( empty( $args['class'] ) ) {
545
+		if (empty($args['class'])) {
546 546
 			$args['class'] = 'give_datepicker';
547
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
547
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
548 548
 			$args['class'] .= ' give_datepicker';
549 549
 		}
550 550
 
551
-		return $this->text( $args );
551
+		return $this->text($args);
552 552
 	}
553 553
 
554 554
 	/**
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 *
564 564
 	 * @return string      The textarea.
565 565
 	 */
566
-	public function textarea( $args = array() ) {
566
+	public function textarea($args = array()) {
567 567
 		$defaults = array(
568 568
 			'name'     => 'textarea',
569 569
 			'value'    => null,
@@ -573,21 +573,21 @@  discard block
 block discarded – undo
573 573
 			'disabled' => false
574 574
 		);
575 575
 
576
-		$args = wp_parse_args( $args, $defaults );
576
+		$args = wp_parse_args($args, $defaults);
577 577
 
578 578
 		$disabled = '';
579
-		if ( $args['disabled'] ) {
579
+		if ($args['disabled']) {
580 580
 			$disabled = ' disabled="disabled"';
581 581
 		}
582 582
 
583
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
583
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
584 584
 
585
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
585
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
586 586
 
587
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
587
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
588 588
 
589
-		if ( ! empty( $args['desc'] ) ) {
590
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
589
+		if ( ! empty($args['desc'])) {
590
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
591 591
 		}
592 592
 
593 593
 		$output .= '</span>';
@@ -607,12 +607,12 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @return string      The text field with ajax search.
609 609
 	 */
610
-	public function ajax_user_search( $args = array() ) {
610
+	public function ajax_user_search($args = array()) {
611 611
 
612 612
 		$defaults = array(
613 613
 			'name'         => 'user_id',
614 614
 			'value'        => null,
615
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
615
+			'placeholder'  => esc_attr__('Enter username', 'give'),
616 616
 			'label'        => null,
617 617
 			'desc'         => null,
618 618
 			'class'        => '',
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
 			'data'         => false
622 622
 		);
623 623
 
624
-		$args = wp_parse_args( $args, $defaults );
624
+		$args = wp_parse_args($args, $defaults);
625 625
 
626
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
626
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
627 627
 
628 628
 		$output = '<span class="give_user_search_wrap">';
629
-		$output .= $this->text( $args );
630
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
629
+		$output .= $this->text($args);
630
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
631 631
 		$output .= '</span>';
632 632
 
633 633
 		return $output;
Please login to merge, or discard this patch.