Issues (1282)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

includes/admin/class-give-welcome.php (6 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Give Welcome Page Class
4
 *
5
 * Displays on plugin activation
6
 *
7
 * @package     Give
8
 * @subpackage  Admin/Welcome
9
 * @copyright   Copyright (c) 2019, GiveWP
10
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
11
 * @since       1.0
12
 */
13
14
// Exit if accessed directly.
15
if ( ! defined( 'ABSPATH' ) ) {
16
	exit;
17
}
18
19
/**
20
 * Give_Welcome Class
21
 *
22
 * A general class for Welcome and Credits pages.
23
 *
24
 * @since 1.0
25
 */
26
class Give_Welcome {
27
28
	/**
29
	 * @var string The capability users should have to view the page
30
	 */
31
	public $minimum_capability = 'manage_options';
32
33
	/**
34
	 * Get things started
35
	 *
36
	 * @since 1.0
37
	 */
38
	public function __construct() {
39
		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
40
		add_action( 'admin_head', array( $this, 'admin_head' ) );
41
		add_action( 'admin_init', array( $this, 'welcome' ) );
42
	}
43
44
	/**
45
	 * Register the Dashboard Pages which are later hidden but these pages
46
	 * are used to render the Welcome and Credits pages.
47
	 *
48
	 * @access public
49
	 * @return void
50
	 * @since  1.0
51
	 */
52
	public function admin_menus() {
53
		list( $display_version ) = explode( '-', GIVE_VERSION );
54
55
		// Changelog Page
56
		add_dashboard_page(
57
			esc_html__( 'What\'s New', 'give' ),
58
			esc_html__( 'What\'s New', 'give' ),
59
			$this->minimum_capability,
60
			'give-changelog',
61
			array( $this, 'changelog_screen' )
62
		);
63
64
		// Getting Started Page
65
		add_dashboard_page(
66
			/* translators: %s: Give version */
67
			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
68
			esc_html__( 'Getting started with Give', 'give' ),
69
			$this->minimum_capability,
70
			'give-getting-started',
71
			array( $this, 'getting_started_screen' )
72
		);
73
74
		// Credits Page
75
		add_dashboard_page(
76
			/* translators: %s: Give version */
77
			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
78
			esc_html__( 'The people that build Give', 'give' ),
79
			$this->minimum_capability,
80
			'give-credits',
81
			array( $this, 'credits_screen' )
82
		);
83
	}
84
85
	/**
86
	 * Hide Individual Dashboard Pages
87
	 *
88
	 * @access public
89
	 * @return void
90
	 * @since  1.0
91
	 */
92
	public function admin_head() {
93
94
		remove_submenu_page( 'index.php', 'give-changelog' );
95
		remove_submenu_page( 'index.php', 'give-getting-started' );
96
		remove_submenu_page( 'index.php', 'give-credits' );
97
98
	}
99
100
	/**
101
	 * Navigation tabs
102
	 *
103
	 * @access public
104
	 * @return void
105
	 * @since  1.0
106
	 */
107 View Code Duplication
	public function tabs() {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
108
		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-getting-started';
109
		?>
110
		<div class="nav-tab-wrapper give-nav-tab-wrapper">
111
			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
112
			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
113
				<?php esc_html_e( 'Getting Started', 'give' ); ?>
114
			</a>
115
			<a class="nav-tab <?php echo $selected == 'give-changelog' ? 'nav-tab-active' : ''; ?>"
116
			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-changelog' ), 'index.php' ) ) ); ?>">
117
				<?php esc_html_e( 'What\'s New', 'give' ); ?>
118
			</a>
119
			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
120
			   href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
121
				<?php esc_html_e( 'Add-ons', 'give' ); ?>
122
			</a>
123
			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
124
			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
125
				<?php esc_html_e( 'Credits', 'give' ); ?>
126
			</a>
127
		</div>
128
		<?php
129
	}
130
131
	/**
132
	 * The header section for the welcome screen.
133
	 *
134
	 * @since 1.8.8
135
	 */
136
	public function get_welcome_header() {
137
		// Badge for welcome page
138
		list( $display_version ) = explode( '-', GIVE_VERSION );
139
140
		$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
141
		if ( empty( $page ) ) {
142
			return;
143
		}
144
145
		switch ( $page ) {
146 View Code Duplication
			case 'give-getting-started':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
147
				$title   = sprintf( __( 'Welcome to Give %s', 'give' ), $display_version );
148
				$content = __( 'Thank you for activating the latest version of Give! Welcome to the best fundraising platform for WordPress. We encourage you to check out the plugin documentation and getting started guide below.', 'give' );
149
				break;
150
151 View Code Duplication
			case 'give-changelog':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
152
				$title   = sprintf( __( 'What\'s New in Give %s', 'give' ), $display_version );
153
				$content = __( 'Give is regularly updated with new features and fixes to ensure your fundraising campaigns run smoothly and securely. We always recommend keeping Give up to date with the latest version.', 'give' );
154
				break;
155
156
			case 'give-credits':
157
				$title   = sprintf( __( 'GitHub Contributors', 'give' ) );
158
				$content = sprintf(
159
					/* translators: %s: https://github.com/impress-org/give */
160
					__( 'Give is backed by a dedicated team of in-house developers and a vibrant open source community. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
161
					esc_url( 'https://github.com/impress-org/give' )
162
				);
163
164
				break;
165
166
			default:
167
				$title   = get_admin_page_title();
168
				$content = '';
169
				break;
170
171
		}
172
173
		?>
174
		<div class="give-welcome-header">
175
176
			<div class="give-welcome-header-inner">
177
178
				<h1 class="give-welcome-h1"><?php esc_html_e( $title ); ?></h1>
179
180
				<?php $this->social_media_elements(); ?>
181
182
				<p class="give-welcome-text"><?php _e( $content ); ?></p>
183
184
				<?php $this->get_newsletter(); ?>
185
186
				<div class="give-badge">
187
					<?php
188
					printf(
189
						/* translators: %s: Give version */
190
						esc_html__( 'Version %s', 'give' ),
191
						$display_version
192
					);
193
					?>
194
				</div>
195
196
			</div>
197
		</div>
198
199
		<?php
200
	}
201
202
	/**
203
	 * Render Getting Started Screen
204
	 *
205
	 * @access public
206
	 * @return void
207
	 * @since  1.0
208
	 */
209
	public function getting_started_screen() {
210
		?>
211
		<div class="give-welcome-wrap get-started">
212
213
			<?php $this->get_welcome_header(); ?>
214
215
			<?php $this->tabs(); ?>
216
217
			<div class="give-welcome-content-wrap">
218
219
				<p class="give-welcome-content-intro"><?php esc_html_e( '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' ); ?></p>
220
221
				<div class="give-feature-section give-clearfix">
222
					<div class="give-feature-section__inner">
223
						<div class="give-feature-section-item">
224
							<div class="give-feature-section-item__container">
225
								<h3>
226
									<span class="give-feature-section-item-number">1</span>
227
									<?php esc_html_e( 'Configure your payment methods', 'give' ); ?>
228
								</h3>
229
230
								<p><?php esc_html_e( 'Before you can begin fundraising, first you need to set up your payment gateway. Payment gateways allow you to accept payment methods through your donation forms. Give supports many of the top payment processors through our add-ons. Stripe and PayPal Standard are included for free in the core plugin. Please ensure your site is running securely with a valid SSL certificate before accepting online payments.', 'give' ); ?></p>
231
232
								<p><?php echo sprintf( __( 'Having Trouble? Our team is here to help if you need to ask any questions. If you need help setting up your payment gateway, contact our <a href="%s" target="_blank">support team</a>.', 'give' ), 'https://givewp.com/support/?utm_source=welcome-screen&utm_medium=getting-started' ); ?></p>
233
234
								<div class="give-welcome-connect-gateways">
235
236
									<ul class="give-feature-btns">
237
										<li>
238
											<?php echo give_stripe_connect_button(); ?>
239
										</li>
240
										<li>
241
											<?php echo give_paypal_connect_button(); ?>
242
										</li>
243
										<li style="display: block; margin: 20px 0 0;">
244
											<a href="https://givewp.com/addons/category/payment-gateways/?utm_source=welcome-screen&utm_medium=getting-started"
245
											   class="give-feature-btn-link"
246
											   target="_blank"
247
											   title="<?php esc_attr_e( 'View Premium Gateways', 'give' ); ?>"><?php esc_html_e( 'View Premium Gateways', 'give' ); ?></a>
248
										</li>
249
									</ul>
250
251
									<p class="give-welcome-gateway-notice give-field-description"><?php esc_html_e( 'Note: The free version of the Stripe payment gateway for Give does not include Apple or Google Pay. In the core plugin, using the free version of Stripe includes an additional 2% fee for a one-time donation in addition to the standard Stripe processing fee. Stripe Premium (the Stripe Add-on for Give) does not include this additional fee. Using PayPal standard does not include any additional fees. However, the donor will be taken to PayPal’s website to process their donation before being redirected back to your site.', 'give' ); ?></p>
252
253
								</div>
254
255
256
							</div>
257
						</div>
258
259
						<div class="give-feature-section-item">
260
							<div class="give-ipad-showcase-wrap">
261
								<div class="give-ipad-showcase-inner">
262
									<img
263
										src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-step-1.gif">
264
								</div>
265
							</div>
266
						</div>
267
268
					</div>
269
					<!-- /.give-feature-section__inner -->
270
				</div>
271
				<!-- /.give-feature-section -->
272
273
				<div class="give-feature-section give-feature-section__step2 give-clearfix">
274
					<div class="give-feature-section__inner">
275
						<div class="give-feature-section-item">
276
							<div class=" give-ipad-showcase-wrap">
277
								<div class="give-ipad-showcase-inner">
278
									<img
279
										src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-step-2.gif">
280
								</div>
281
							</div>
282
						</div>
283
284
						<div class="give-feature-section-item">
285
							<div
286
								class="give-feature-section-item__container give-feature-section-item__container-right">
287
								<h3>
288
									<span class="give-feature-section-item-number">2</span>
289
									<?php esc_html_e( 'Create your first donation form', 'give' ); ?>
290
								</h3>
291
292
								<p><?php esc_html_e( 'Donations are accepted through customizable forms. Forms can be stand-alone pages or embedded throughout your website using a block, shortcode, or widget. You can create multi-level forms which allow donors to choose from preconfigured donation amount, allow for custom amounts, and even set a fundraising goal. Customizing your forms with content and images is a breeze. You can also allow donors to leave comments, embed the form throughout your site and more.', 'give' ); ?></p>
293
294
								<ul class="give-feature-btns">
295
									<li>
296
										<a href="<?php echo admin_url( 'post-new.php?post_type=give_forms' ); ?>"
297
										   class="button button-primary button-large"
298
										   title="<?php esc_attr_e( 'Add new donation form', 'give' ); ?>"><?php esc_html_e( 'Add Donation Form', 'give' ); ?></a>
299
									</li>
300
									<li>
301
										<a href="http://docs.givewp.com/give-forms" class="give-feature-btn-link"
302
										   target="_blank"
303
										   title="<?php esc_attr_e( 'Learn more about Test Mode', 'give' ); ?>"><?php esc_html_e( 'Learn more', 'give' ); ?></a>
304
									</li>
305
								</ul>
306
307
							</div>
308
						</div>
309
310
					</div>
311
					<!-- /.give-feature-section__inner -->
312
				</div>
313
				<!-- /.give-feature-section -->
314
315
				<div class="give-feature-section give-clearfix">
316
					<div class="give-feature-section__inner">
317
318
						<div class="give-feature-section-item">
319
							<div class="give-feature-section-item__container">
320
								<h3>
321
									<span class="give-feature-section-item-number">3</span>
322
									<?php esc_html_e( 'Test and launch your campaign!', 'give' ); ?>
323
								</h3>
324
325
								<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>
326
327
								<ul class="give-feature-btns">
328
									<li>
329
										<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ); ?>"
330
										   class="button button-primary button-large"
331
										   title="<?php esc_attr_e( 'Configure Test Mode', 'give' ); ?>"><?php esc_html_e( 'Configure Test Mode', 'give' ); ?></a>
332
									</li>
333
									<li>
334
										<a href="http://docs.givewp.com/test-mode" class="give-feature-btn-link"
335
										   target="_blank"
336
										   title="<?php esc_attr_e( 'Learn more about Test Mode', 'give' ); ?>"><?php esc_html_e( 'Learn more', 'give' ); ?></a>
337
									</li>
338
								</ul>
339
340
							</div>
341
						</div>
342
343
						<div class="give-feature-section-item">
344
							<div class="give-ipad-showcase-wrap">
345
								<div class="give-ipad-showcase-inner">
346
									<img
347
										src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-step-3.gif">
348
								</div>
349
							</div>
350
						</div>
351
352
					</div>
353
					<!-- /.give-feature-section__inner -->
354
				</div>
355
				<!-- /.give-feature-section -->
356
357
			</div>
358
			<!-- /.give-welcome-content-wrap -->
359
360
			<?php $this->support_widgets(); ?>
361
362
		</div>
363
		<?php
364
	}
365
366
	/**
367
	 * Render Changelog Screen
368
	 *
369
	 * @access public
370
	 * @return void
371
	 * @since  1.0
372
	 */
373
	public function changelog_screen() {
374
		?>
375
		<div class="give-welcome-wrap">
376
377
			<?php $this->get_welcome_header(); ?>
378
379
			<?php $this->tabs(); ?>
380
381
			<div class="give-welcome-content-wrap give-changelog-wrap">
382
383
				<p class="give-welcome-content-intro"><?php printf( __( 'See what\'s new in version %1$s of Give! If you feel we\'ve missed a fix or there\'s a feature you\'d like to see developed please <a href="%2$s" target="_blank">contact support</a>.', 'give' ), GIVE_VERSION, 'https://givewp.com/support/?utm_source=welcome-screen&utm_medium=getting-started' ); ?></p>
384
385
				<div class="give-changelog">
386
					<?php echo $this->parse_readme(); ?>
387
				</div>
388
389
			</div>
390
391
			<?php $this->support_widgets(); ?>
392
393
		</div>
394
		<?php
395
	}
396
397
	/**
398
	 * Render Credits Screen
399
	 *
400
	 * @access public
401
	 * @return void
402
	 * @since  1.0
403
	 */
404
	public function credits_screen() {
405
		?>
406
		<div class="wrap give-welcome-wrap">
407
408
			<?php $this->get_welcome_header(); ?>
409
410
			<?php $this->tabs(); ?>
411
412
			<div class="give-welcome-content-wrap give-changelog-wrap">
413
414
				<p class="give-welcome-content-intro">
415
416
					<?php
417
					printf(
418
						/* translators: %s: https://github.com/impress-org/give */
419
						__( 'Give is backed by a dedicated team of in-house developers and a vibrant open source community. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
420
						esc_url( 'https://github.com/impress-org/give' )
421
					);
422
					?>
423
				</p>
424
425
				<?php echo $this->contributors(); ?>
426
427
			</div>
428
429
		</div>
430
		<?php
431
	}
432
433
434
	/**
435
	 * Parse the GIVE readme.txt file
436
	 *
437
	 * @return string $readme HTML formatted readme file
438
	 * @since 1.0
439
	 */
440
	public function parse_readme() {
441
		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
442
443
		if ( ! $file ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $file of type string|null is loosely compared to false; this is ambiguous if the string can be empty. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
444
			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
445
		} else {
446
			$readme = file_get_contents( $file );
447
			$readme = nl2br( esc_html( $readme ) );
448
			$readme = explode( '== Changelog ==', $readme );
449
			$readme = end( $readme );
450
451
			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
452
			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
453
			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
454
			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
455
			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
456
		}
457
458
		return $readme;
459
	}
460
461
462
	/**
463
	 * Render Contributors List
464
	 *
465
	 * @return string $contributor_list HTML formatted list of all the contributors for GIVE
466
	 * @uses  Give_Welcome::get_contributors()
467
	 * @since 1.0
468
	 */
469
	public function contributors() {
470
		$contributors = $this->get_contributors();
471
472
		if ( empty( $contributors ) ) {
473
			return '';
474
		}
475
476
		$contributor_list = '<ul class="give-contributor-group">';
477
478
		foreach ( $contributors as $contributor ) {
479
			$contributor_list .= '<li class="give-contributor">';
480
			$contributor_list .= sprintf(
481
				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /><span>%3$s</span></a>',
482
				esc_url( 'https://github.com/' . $contributor->login ),
483
				esc_url( $contributor->avatar_url ),
484
				esc_attr( $contributor->login )
485
			);
486
			$contributor_list .= '</li>';
487
		}
488
489
		$contributor_list .= '</ul>';
490
491
		return $contributor_list;
492
	}
493
494
	/**
495
	 * Retrieve list of contributors from GitHub.
496
	 *
497
	 * @access public
498
	 * @return array $contributors List of contributors
499
	 * @since  1.0
500
	 */
501 View Code Duplication
	public function get_contributors() {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
502
		$contributors = Give_Cache::get( 'give_contributors', true );
503
504
		if ( false !== $contributors ) {
505
			return $contributors;
506
		}
507
508
		$response = wp_remote_get( 'https://api.github.com/repos/impress-org/give/contributors', array( 'sslverify' => false ) );
509
510
		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
511
			return array();
512
		}
513
514
		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
515
516
		if ( ! is_array( $contributors ) ) {
517
			return array();
518
		}
519
520
		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
521
522
		return $contributors;
523
	}
524
525
	/**
526
	 * Social Media Like Buttons
527
	 *
528
	 * Various social media elements to Give
529
	 */
530
	public function social_media_elements() {
531
		?>
532
533
		<div class="social-items-wrap">
534
535
			<iframe
536
				src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fwpgive&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=220596284639969"
537
				scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;"
538
				allowTransparency="true"></iframe>
539
540
			<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false">
541
				<?php
542
				printf(
543
					/* translators: %s: Give twitter user @givewp */
544
					esc_html_e( 'Follow %s', 'give' ),
545
					'@givewp'
546
				);
547
				?>
548
			</a>
549
			<script>!function( d, s, id ) {
550
					var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
551
					if ( !d.getElementById( id ) ) {
552
						js = d.createElement( s );
553
						js.id = id;
554
						js.src = p + '://platform.twitter.com/widgets.js';
555
						fjs.parentNode.insertBefore( js, fjs );
556
					}
557
				}( document, 'script', 'twitter-wjs' );
558
			</script>
559
560
		</div>
561
		<!--/.social-items-wrap -->
562
563
		<?php
564
	}
565
566
	/**
567
	 * Support widgets.
568
	 *
569
	 * @since 2.5.0
570
	 */
571
	public function support_widgets() {
572
	?>
573
574
			<div class="give-welcome-widgets give-clearfix">
575
			<div class="give-welcome-widgets__inner">
576
577
				<div class="give-welcome-widgets__heading">
578
					<h2><?php esc_html_e( 'Start off on the right foot', 'give' ); ?></h2>
579
					<p><?php esc_html_e( 'If you aren’t quite sure how to get started or you want to see the best ways to use Give for your fundraising needs, book a demo. Our Customer Success Team is happy to help.', 'give' ); ?></p>
580
581
					<a href="https://givewp.com/schedule-a-demo/?utm_source=welcome-screen&utm_medium=getting-started"
582
					   class="give-welcome-widgets__demo-btn button button-large"
583
					   target="_blank"><?php esc_html_e( 'Schedule a Demo', 'give' ); ?></a>
584
				</div>
585
586
				<div class="give-welcome-widgets__col give-welcome-widgets__support">
587
					<div class="give-welcome-widgets__col-inner">
588
						<h3><?php esc_html_e( 'Support', 'give' ); ?></h3>
589
						<p><?php esc_html_e( 'Inevitably questions arise when building great fundraising websites. That’s exactly why we have a dedicated support staff of Give experts to help you succeed with your campaign. ', 'give' ); ?></p>
590
591
						<a href="https://givewp.com/support/?utm_source=welcome-screen&utm_medium=getting-started" class="give-welcome-widgets__link"
592
						   target="_blank"><?php esc_html_e( 'How support works', 'give' ); ?></a>
593
594
					</div>
595
				</div>
596
				<div class="give-welcome-widgets__col give-welcome-widgets__addons">
597
					<div class="give-welcome-widgets__col-inner">
598
						<h3><?php esc_html_e( 'Add-ons', 'give' ); ?></h3>
599
						<p><?php esc_html_e( 'Accept recurring donations, add custom donation form fields, ask donors to cover processing fees and more! Level up your fundraisers by extending Give with add-ons.', 'give' ); ?></p>
600
						<a href="https://givewp.com/addons/?utm_source=welcome-screen&utm_medium=getting-started" class="give-welcome-widgets__link"
601
						   target="_blank"><?php esc_html_e( 'Power up my fundraising', 'give' ); ?></a>
602
					</div>
603
				</div>
604
				<div class="give-welcome-widgets__col give-welcome-widgets__documentation">
605
					<div class="give-welcome-widgets__col-inner">
606
						<h3><?php esc_html_e( 'Documentation', 'give' ); ?></h3>
607
						<p><?php esc_html_e( 'Learn the ins and outs of Give with well organized and clearly written documentation. You can search using a keyword to find articles for Give Core and each add-on. ', 'give' ); ?></p>
608
						<a href="https://givewp.com/documentation/?utm_source=welcome-screen&utm_medium=getting-started" class="give-welcome-widgets__link"
609
						   target="_blank"><?php esc_html_e( 'Check out the docs', 'give' ); ?></a>
610
					</div>
611
				</div>
612
613
			</div>
614
			</div>
615
	<?php
616
	}
617
618
	/**
619
	 * Sends user to the Welcome page on first activation of Give.
620
	 *
621
	 * @access public
622
	 * @return void
623
	 * @since  1.0
624
	 */
625 View Code Duplication
	public function welcome() {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
626
627
		// Bail if no activation redirect
628
		if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) {
629
			return;
630
		}
631
632
		// Delete the redirect transient
633
		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
634
635
		// Bail if activating from network, or bulk
636
		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
637
			return;
638
		}
639
640
		$upgrade = get_option( 'give_version_upgraded_from' );
641
642
		if ( ! $upgrade ) {
643
			// First time install
644
			wp_safe_redirect( admin_url( 'index.php?page=give-getting-started' ) );
645
			exit;
646
		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) {
647
			// Welcome is disabled in settings
648
		} else { // Welcome is NOT disabled in settings
649
			wp_safe_redirect( admin_url( 'index.php?page=give-changelog' ) );
650
			exit;
651
		}
652
	}
653
654
	/**
655
	 * Give Newsletter
656
	 *
657
	 * Returns the main Give newsletter form
658
	 */
659
	public function get_newsletter() {
660
		$current_user = wp_get_current_user();
661
		?>
662
		<div class="give-newsletter-form-wrap">
663
664
			<p class="give-newsletter-intro"><?php esc_html_e( 'Sign up for the below to stay informed about important updates, release notes, fundraising tips, and more! We\'ll never spam you.', 'give' ); ?></p>
665
666
			<form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&amp;id=12a081aa13"
667
				  method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form"
668
				  class="give-newsletter-form validate"
669
				  target="_blank">
670
				<div class="give-newsletter-confirmation">
671
					<p><?php esc_html_e( 'To complete your subscription, click the confirmation link in your email. Thank you!', 'give' ); ?></p>
672
				</div>
673
674
				<table class="form-table give-newsletter-form">
675
					<tr valign="middle">
676
						<td>
677
							<label for="mce-EMAIL"
678
								   class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
679
							<input type="email" name="EMAIL" id="mce-EMAIL"
680
								   placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
681
								   class="required email" value="<?php echo $current_user->user_email; ?>" required>
682
						</td>
683
						<td>
684
							<label for="mce-FNAME"
685
								   class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
686
							<input type="text" name="FNAME" id="mce-FNAME"
687
								   placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class=""
688
								   value="<?php echo $current_user->user_firstname; ?>" required>
689
						</td>
690
						<td>
691
							<label for="mce-LNAME"
692
								   class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
693
							<input type="text" name="LNAME" id="mce-LNAME"
694
								   placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class=""
695
								   value="<?php echo $current_user->user_lastname; ?>">
696
						</td>
697
						<td>
698
							<input type="submit" name="subscribe" id="mc-embedded-subscribe"
699
								   class="button button-primary"
700
								   value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
701
						</td>
702
					</tr>
703
				</table>
704
			</form>
705
706
			<div style="position: absolute; left: -5000px;">
707
				<input type="text" name="b_3ccb75d68bda4381e2f45794c_12a081aa13" tabindex="-1" value="">
708
			</div>
709
710
		</div>
711
712
		<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script>
713
		<script type='text/javascript'>(
714
				function( $ ) {
715
					window.fnames = new Array();
716
					window.ftypes = new Array();
717
					fnames[ 0 ] = 'EMAIL';
718
					ftypes[ 0 ] = 'email';
719
					fnames[ 1 ] = 'FNAME';
720
					ftypes[ 1 ] = 'text';
721
					fnames[ 2 ] = 'LNAME';
722
					ftypes[ 2 ] = 'text';
723
724
					$( 'form[name="mc-embedded-subscribe-form"]' ).removeAttr( 'novalidate' );
725
726
					//Successful submission
727
					$( 'form[name="mc-embedded-subscribe-form"]' ).on( 'submit', function() {
728
729
						var email_field = $( this ).find( '#mce-EMAIL' ).val();
730
						if ( !email_field ) {
731
							return false;
732
						}
733
						$( this ).find( '.give-newsletter-confirmation' ).show();
734
						$( this ).find( '.give-newsletter-form' ).hide();
735
736
					} );
737
738
				}( jQuery )
739
			);
740
			var $mcj = jQuery.noConflict( true );
741
742
743
		</script>
744
		<!--End mc_embed_signup-->
745
746
		<?php
747
	}
748
749
}
750
751
new Give_Welcome();
752