Issues (4296)

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/welcome.php (32 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
 * @package     Give
7
 * @subpackage  Admin/Welcome
8
 * @copyright   Copyright (c) 2016, WordImpress
9
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
10
 * @since       1.0
11
 */
12
13
// Exit if accessed directly.
14
if ( ! defined( 'ABSPATH' ) ) {
15
	exit;
16
}
17
18
/**
19
 * Give_Welcome Class
20
 *
21
 * A general class for About and Credits page.
22
 *
23
 * @since 1.0
24
 */
25
class Give_Welcome {
26
27
	/**
28
	 * @var string The capability users should have to view the page
29
	 */
30
	public $minimum_capability = 'manage_options';
31
32
	/**
33
	 * Get things started
34
	 *
35
	 * @since 1.0
36
	 */
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' ) );
41
	}
42
43
	/**
44
	 * Register the Dashboard Pages which are later hidden but these pages
45
	 * are used to render the Welcome and Credits pages.
46
	 *
47
	 * @access public
48
	 * @since  1.0
49
	 * @return void
50
	 */
51
	public function admin_menus() {
52
		list( $display_version ) = explode( '-', GIVE_VERSION );
53
54
		// About Page
55
		add_dashboard_page(
56
		/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 8.
Loading history...
57
			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
			esc_html__( 'Welcome to Give', 'give' ),
59
			$this->minimum_capability,
60
			'give-about',
61
			array( $this, 'about_screen' )
62
		);
63
64
		// Changelog Page
65
		add_dashboard_page(
66
			esc_html__( 'Give Changelog', 'give' ),
67
			esc_html__( 'Give Changelog', 'give' ),
68
			$this->minimum_capability,
69
			'give-changelog',
70
			array( $this, 'changelog_screen' )
71
		);
72
73
		// Getting Started Page
74
		add_dashboard_page(
75
		/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 8.
Loading history...
76
			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
			esc_html__( 'Getting started with Give', 'give' ),
78
			$this->minimum_capability,
79
			'give-getting-started',
80
			array( $this, 'getting_started_screen' )
81
		);
82
83
		// Credits Page
84
		add_dashboard_page(
85
		/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 8.
Loading history...
86
			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
			esc_html__( 'The people that build Give', 'give' ),
88
			$this->minimum_capability,
89
			'give-credits',
90
			array( $this, 'credits_screen' )
91
		);
92
	}
93
94
	/**
95
	 * Hide Individual Dashboard Pages
96
	 *
97
	 * @access public
98
	 * @since  1.0
99
	 * @return void
100
	 */
101
	public function admin_head() {
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' );
107
108
	}
109
110
	/**
111
	 * Navigation tabs
112
	 *
113
	 * @access public
114
	 * @since  1.0
115
	 * @return void
116
	 */
117
	public function tabs() {
118
		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
0 ignored issues
show
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
Detected usage of a non-sanitized input variable: $_GET
Loading history...
119
		?>
120
		<h2 class="nav-tab-wrapper">
121
			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
0 ignored issues
show
Expected next thing to be a escaping function, not '$selected'
Loading history...
122
			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
				<?php esc_html_e( 'About Give', 'give' ); ?>
124
			</a>
125
			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
0 ignored issues
show
Expected next thing to be a escaping function, not '$selected'
Loading history...
126
			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
				<?php esc_html_e( 'Getting Started', 'give' ); ?>
128
			</a>
129
			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
0 ignored issues
show
Expected next thing to be a escaping function, not '$selected'
Loading history...
130
			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
				<?php esc_html_e( 'Credits', 'give' ); ?>
132
			</a>
133
			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
0 ignored issues
show
Expected next thing to be a escaping function, not '$selected'
Loading history...
134
			   href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
				<?php esc_html_e( 'Add-ons', 'give' ); ?>
136
			</a>
137
		</h2>
138
		<?php
139
	}
140
141
	/**
142
	 * Render About Screen
143
	 *
144
	 * @access public
145
	 * @since  1.0
146
	 * @return void
147
	 */
148
	public function about_screen() {
149
		list( $display_version ) = explode( '-', GIVE_VERSION );
150
		?>
151
		<div class="wrap about-wrap">
152
153
			<?php $this->get_welcome_header() ?>
154
155
			<p class="about-text"><?php
156
				printf(
157
				/* translators: %s: http://docs.givewp.com/docs */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
158
					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
					esc_url( 'http://docs.givewp.com/docs' )
160
				);
161
				?></p>
162
163
			<?php give_get_newsletter(); ?>
164
165
			<div class="give-badge"><?php
166
				printf(
167
				/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
168
					esc_html__( 'Version %s', 'give' ),
169
					$display_version
170
				);
171
				?></div>
172
173
			<?php $this->tabs(); ?>
174
175
			<div class="feature-section clearfix introduction">
176
177
				<div class="video feature-section-item">
178
					<img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>"
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GIVE_PLUGIN_URL'
Loading history...
179
						 alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
180
				</div>
181
182
				<div class="content feature-section-item last-feature">
183
184
					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
185
186
					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
187
					<a href="https://givewp.com" target="_blank" class="button-secondary">
188
						<?php esc_html_e( 'Learn More', 'give' ); ?>
189
						<span class="dashicons dashicons-external"></span>
190
					</a>
191
192
				</div>
193
194
			</div>
195
			<!-- /.intro-section -->
196
197
			<div class="feature-section clearfix">
198
199
				<div class="content feature-section-item">
200
201
					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
202
203
					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
204
205
					<h4>Find Out More:</h4>
206
					<ul class="ul-disc">
207
						<li><a href="https://givewp.com/"
208
							   target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
209
						<li><a href="https://givewp.com/features/"
210
							   target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
211
						<li><a href="https://givewp.com/documentation/"
212
							   target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
213
					</ul>
214
215
				</div>
216
217
				<div class="content  feature-section-item last-feature">
218
					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>"
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GIVE_PLUGIN_URL'
Loading history...
219
						 alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
220
				</div>
221
222
			</div>
223
			<!-- /.feature-section -->
224
225
226
		</div>
227
		<?php
228
	}
229
230
	/**
231
	 * Render Changelog Screen
232
	 *
233
	 * @access public
234
	 * @since  1.0
235
	 * @return void
236
	 */
237
	public function changelog_screen() {
238
		list( $display_version ) = explode( '-', GIVE_VERSION );
239
		?>
240
		<div class="wrap about-wrap">
241
			<h1><?php echo get_admin_page_title(); ?></h1>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'get_admin_page_title'
Loading history...
242
243
			<p class="about-text"><?php
244
				printf(
245
				/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
246
					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
247
					$display_version
248
				);
249
				?></p>
250
			<div class="give-badge"><?php
251
				printf(
252
				/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
253
					esc_html__( 'Version %s', 'give' ),
254
					$display_version
255
				);
256
				?></div>
257
258
			<?php $this->tabs(); ?>
259
260
			<div class="changelog">
261
				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
262
263
				<div class="feature-section">
264
					<?php echo $this->parse_readme(); ?>
0 ignored issues
show
Expected next thing to be a escaping function, not '$this'
Loading history...
265
				</div>
266
			</div>
267
268
			<div class="return-to-dashboard">
269
				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
270
					'post_type' => 'give_forms',
271
					'page'      => 'give-settings'
272
				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
273
			</div>
274
		</div>
275
		<?php
276
	}
277
278
	/**
279
	 * Render Getting Started Screen
280
	 *
281
	 * @access public
282
	 * @since  1.0
283
	 * @return void
284
	 */
285
	public function getting_started_screen() {
286
		list( $display_version ) = explode( '-', GIVE_VERSION );
287
		?>
288
		<div class="wrap about-wrap get-started">
289
290
			<?php $this->get_welcome_header() ?>
291
292
			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
293
294
			<?php give_get_newsletter(); ?>
295
296
			<div class="give-badge"><?php
297
				printf(
298
				/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
299
					esc_html__( 'Version %s', 'give' ),
300
					$display_version
301
				);
302
				?></div>
303
304
			<?php $this->tabs(); ?>
305
306
			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
307
308
			<div class="feature-section clearfix">
309
310
				<div class="content feature-section-item">
311
					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
312
313
					<p><?php esc_html_e( 'Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
314
315
					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p>
316
				</div>
317
318
				<div class="content feature-section-item last-feature">
319
					<img src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-add-new-form.png">
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GIVE_PLUGIN_URL'
Loading history...
320
				</div>
321
322
			</div>
323
			<!-- /.feature-section -->
324
325
			<div class="feature-section clearfix">
326
327
				<div class="content feature-section-item multi-level-gif">
328
					<img src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-new-form-multi-level.gif">
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GIVE_PLUGIN_URL'
Loading history...
329
				</div>
330
331
				<div class="content feature-section-item last-feature">
332
					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
333
334
					<p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
335
				</div>
336
337
			</div>
338
			<!-- /.feature-section -->
339
340
			<div class="feature-section clearfix">
341
342
				<div class="content feature-section-item add-content">
343
					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
344
345
					<p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
346
347
					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
348
				</div>
349
350
				<div class="content feature-section-item last-feature">
351
					<img src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-add-content.png">
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GIVE_PLUGIN_URL'
Loading history...
352
				</div>
353
354
			</div>
355
			<!-- /.feature-section -->
356
357
			<div class="feature-section clearfix">
358
359
				<div class="content feature-section-item display-options">
360
					<img src="<?php echo GIVE_PLUGIN_URL; ?>assets/dist/images/admin/getting-started-display-options.png">
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GIVE_PLUGIN_URL'
Loading history...
361
				</div>
362
363
				<div class="content feature-section-item last-feature">
364
					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
365
366
					<p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
367
				</div>
368
369
370
			</div>
371
			<!-- /.feature-section -->
372
373
374
		</div>
375
		<?php
376
	}
377
378
	/**
379
	 * Render Credits Screen
380
	 *
381
	 * @access public
382
	 * @since  1.0
383
	 * @return void
384
	 */
385
	public function credits_screen() {
386
		list( $display_version ) = explode( '-', GIVE_VERSION );
387
		?>
388
		<div class="wrap about-wrap">
389
390
			<?php $this->get_welcome_header() ?>
391
392
			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
393
394
			<?php give_get_newsletter(); ?>
395
396
			<div class="give-badge"><?php
397
				printf(
398
				/* translators: %s: Give version */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
399
					esc_html__( 'Version %s', 'give' ),
400
					$display_version
401
				);
402
				?></div>
403
404
			<?php $this->tabs(); ?>
405
406
			<p class="about-description"><?php
407
				printf(
408
				/* translators: %s: https://github.com/WordImpress/give */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
409
					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
410
					esc_url( 'https://github.com/WordImpress/give' )
411
				);
412
				?></p>
413
414
			<?php echo $this->contributors(); ?>
0 ignored issues
show
Expected next thing to be a escaping function, not '$this'
Loading history...
415
		</div>
416
		<?php
417
	}
418
419
420
	/**
421
	 * Parse the GIVE readme.txt file
422
	 *
423
	 * @since 1.0
424
	 * @return string $readme HTML formatted readme file
425
	 */
426
	public function parse_readme() {
427
		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
428
429
		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...
430
			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
431
		} else {
432
			$readme = file_get_contents( $file );
0 ignored issues
show
file_get_contents is highly discouraged, please use wpcom_vip_file_get_contents() instead.
Loading history...
433
			$readme = nl2br( esc_html( $readme ) );
434
			$readme = explode( '== Changelog ==', $readme );
435
			$readme = end( $readme );
436
437
			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
438
			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
439
			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
440
			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
441
			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
442
		}
443
444
		return $readme;
445
	}
446
447
448
	/**
449
	 * Render Contributors List
450
	 *
451
	 * @since 1.0
452
	 * @uses  Give_Welcome::get_contributors()
453
	 * @return string $contributor_list HTML formatted list of all the contributors for GIVE
454
	 */
455
	public function contributors() {
456
		$contributors = $this->get_contributors();
457
458
		if ( empty( $contributors ) ) {
459
			return '';
460
		}
461
462
		$contributor_list = '<ul class="wp-people-group">';
463
464
		foreach ( $contributors as $contributor ) {
465
			$contributor_list .= '<li class="wp-person">';
466
			$contributor_list .= sprintf(
467
				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
468
				esc_url( 'https://github.com/' . $contributor->login ),
469
				esc_url( $contributor->avatar_url ),
470
				esc_attr( $contributor->login )
471
			);
472
			$contributor_list .= sprintf(
473
				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
474
				esc_url( 'https://github.com/' . $contributor->login ),
475
				esc_html( $contributor->login )
476
			);
477
			$contributor_list .= '</li>';
478
		}
479
480
		$contributor_list .= '</ul>';
481
482
		return $contributor_list;
483
	}
484
485
	/**
486
	 * Retreive list of contributors from GitHub.
487
	 *
488
	 * @access public
489
	 * @since  1.0
490
	 * @return array $contributors List of contributors
491
	 */
492
	public function get_contributors() {
493
		$contributors = Give_Cache::get( 'give_contributors', true );
494
495
		if ( false !== $contributors ) {
496
			return $contributors;
497
		}
498
499
		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
0 ignored issues
show
wp_remote_get is highly discouraged, please use vip_safe_wp_remote_get() instead.
Loading history...
500
501
		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
502
			return array();
503
		}
504
505
		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
506
507
		if ( ! is_array( $contributors ) ) {
508
			return array();
509
		}
510
511
		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
512
513
		return $contributors;
514
	}
515
516
	/**
517
	 * The header section for the welcome screen.
518
	 *
519
	 * @since 1.8.8
520
	 */
521
	public function get_welcome_header() {
522
		// Badge for welcome page
523
		$badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png';
524
		?>
525
		<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'get_admin_page_title'
Loading history...
526
		<?php $this->social_media_elements(); ?>
527
528
		<style type="text/css" media="screen">
529
			/*<![CDATA[*/
530
			.give-badge {
531
				background: url('<?php echo $badge_url; ?>') no-repeat;
0 ignored issues
show
Expected next thing to be a escaping function, not '$badge_url'
Loading history...
532
			}
533
534
			/*]]>*/
535
		</style>
536
		<script>
537
			//FitVids
538
			(function (e) {
539
				"use strict";
540
				e.fn.fitVids = function (t) {
541
					var n = {customSelector: null, ignore: null};
542
					if (!document.getElementById("fit-vids-style")) {
543
						var r = document.head || document.getElementsByTagName("head")[0];
544
						var i = ".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}";
545
						var s = document.createElement("div");
546
						s.innerHTML = '<p>x</p><style id="fit-vids-style">' + i + "</style>";
547
						r.appendChild(s.childNodes[1])
548
					}
549
					if (t) {
550
						e.extend(n, t)
551
					}
552
					return this.each(function () {
553
						var t = ['iframe[src*="player.vimeo.com"]', 'iframe[src*="youtube.com"]', 'iframe[src*="youtube-nocookie.com"]', 'iframe[src*="kickstarter.com"][src*="video.html"]', "object", "embed"];
554
						if (n.customSelector) {
555
							t.push(n.customSelector)
556
						}
557
						var r = ".fitvidsignore";
558
						if (n.ignore) {
559
							r = r + ", " + n.ignore
560
						}
561
						var i = e(this).find(t.join(","));
562
						i = i.not("object object");
563
						i = i.not(r);
564
						i.each(function () {
565
							var t = e(this);
566
							if (t.parents(r).length > 0) {
567
								return
568
							}
569
							if (this.tagName.toLowerCase() === "embed" && t.parent("object").length || t.parent(".fluid-width-video-wrapper").length) {
570
								return
571
							}
572
							if (!t.css("height") && !t.css("width") && (isNaN(t.attr("height")) || isNaN(t.attr("width")))) {
573
								t.attr("height", 9);
574
								t.attr("width", 16)
575
							}
576
							var n = this.tagName.toLowerCase() === "object" || t.attr("height") && !isNaN(parseInt(t.attr("height"), 10)) ? parseInt(t.attr("height"), 10) : t.height(),
577
								i = !isNaN(parseInt(t.attr("width"), 10)) ? parseInt(t.attr("width"), 10) : t.width(),
578
								s = n / i;
579
							if (!t.attr("id")) {
580
								var o = "fitvid" + Math.floor(Math.random() * 999999);
581
								t.attr("id", o)
582
							}
583
							t.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top", s * 100 + "%");
584
							t.removeAttr("height").removeAttr("width")
585
						})
586
					})
587
				}
588
			})(window.jQuery || window.Zepto);
589
			jQuery(document).ready(function ($) {
590
591
				// Target your .container, .wrapper, .post, etc.
592
				$(".wrap").fitVids();
593
594
			});
595
596
		</script>
597
	<?php }
598
599
600
	/**
601
	 * Social Media Like Buttons
602
	 *
603
	 * Various social media elements to Give
604
	 */
605
	public function social_media_elements() { ?>
606
607
		<div class="social-items-wrap">
608
609
			<iframe 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"
610
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;"
611
					allowTransparency="true"></iframe>
612
613
			<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
614
				printf(
615
				/* translators: %s: Give twitter user @givewp */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 16.
Loading history...
616
					esc_html_e( 'Follow %s', 'give' ),
617
					'@givewp'
618
				);
619
				?></a>
620
			<script>!function (d, s, id) {
621
					var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
622
					if (!d.getElementById(id)) {
623
						js = d.createElement(s);
624
						js.id = id;
625
						js.src = p + '://platform.twitter.com/widgets.js';
626
						fjs.parentNode.insertBefore(js, fjs);
627
					}
628
				}(document, 'script', 'twitter-wjs');
629
			</script>
630
631
		</div>
632
		<!--/.social-items-wrap -->
633
634
		<?php
635
	}
636
637
638
	/**
639
	 * Sends user to the Welcome page on first activation of GIVE as well as each
640
	 * time GIVE is upgraded to a new version
641
	 *
642
	 * @access public
643
	 * @since  1.0
644
	 *
645
	 * @return void
646
	 */
647
	public function welcome() {
648
649
		// Bail if no activation redirect
650
		if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) {
651
			return;
652
		}
653
654
		// Delete the redirect transient
655
		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
656
657
		// Bail if activating from network, or bulk
658
		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
0 ignored issues
show
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
659
			return;
660
		}
661
662
		$upgrade = get_option( 'give_version_upgraded_from' );
663
664
		if ( ! $upgrade ) { // First time install
665
			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
666
			exit;
667
		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
668
669
		} else { // Welcome is NOT disabled in settings
670
			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
671
			exit;
672
		}
673
	}
674
675
}
676
677
new Give_Welcome();
678