Completed
Push — master ( 589d3f...c5163f )
by Zack
12:27 queued 08:09
created

GravityView_Welcome::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 6
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 24 and the first side effect is on line 15.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Welcome Page Class
4
 *
5
 * @package   GravityView
6
 * @author    Zack Katz <[email protected]>
7
 * @license   ToBeDefined
8
 * @link      http://www.katzwebservices.com
9
 * @copyright Copyright 2014, Katz Web Services, Inc.
10
 *
11
 * @since 1.0.0
12
 */
13
14
// Exit if accessed directly
15
if ( ! defined( 'ABSPATH' ) ) exit;
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
16
17
/**
18
 * GravityView_Welcome Class
19
 *
20
 * A general class for About page.
21
 *
22
 * @since 1.0
23
 */
24
class GravityView_Welcome {
25
26
	/**
27
	 * @var string The capability users should have to view the page
28
	 */
29
	public $minimum_capability = 'gravityview_getting_started';
30
31
	/**
32
	 * Get things started
33
	 *
34
	 * @since 1.0
35
	 */
36
	public function __construct() {
37
		add_action( 'admin_menu', array( $this, 'admin_menus'), 200 );
0 ignored issues
show
introduced by
No space before closing parenthesis of array is bad style
Loading history...
38
		add_action( 'admin_head', array( $this, 'admin_head' ) );
39
		add_action( 'admin_init', array( $this, 'welcome'    ) );
40
		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 );
0 ignored issues
show
introduced by
No space before closing parenthesis of array is bad style
Loading history...
41
	}
42
43
	/**
44
	 * Register the Dashboard Pages which are later hidden but these pages
45
	 * are used to render the Welcome pages.
46
	 *
47
	 * @access public
48
	 * @since 1.0
49
	 * @return void
50
	 */
51
	public function admin_menus() {
52
53
		// Add help page to GravityView menu
54
		add_submenu_page(
55
			'edit.php?post_type=gravityview',
56
			__('GravityView: Getting Started', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
57
			__('Getting Started', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
58
			$this->minimum_capability,
59
			'gv-getting-started',
60
			array( $this, 'getting_started_screen' )
61
		);
62
63
		// Changelog Page
64
		add_submenu_page(
65
			'edit.php?post_type=gravityview',
66
			__( 'Changelog', 'gravityview' ),
67
			__( 'Changelog', 'gravityview' ),
68
			$this->minimum_capability,
69
			'gv-changelog',
70
			array( $this, 'changelog_screen' )
71
		);
72
73
		// Credits Page
74
		add_submenu_page(
75
			'edit.php?post_type=gravityview',
76
			__( 'Credits', 'gravityview' ),
77
			__( 'Credits', 'gravityview' ),
78
			$this->minimum_capability,
79
			'gv-credits',
80
			array( $this, 'credits_screen' )
81
		);
82
83
	}
84
85
	/**
86
	 * Is this page a GV dashboard page?
87
	 *
88
	 * @return boolean  $is_page   True: yep; false: nope
89
	 */
90
	public function is_dashboard_page($is_page = false, $hook = NULL) {
0 ignored issues
show
Unused Code introduced by
The parameter $hook is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
91
		global $plugin_page;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
92
93
		if($is_page) { return $is_page; }
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
94
95
		return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) );
96
	}
97
98
	/**
99
	 * Hide Individual Dashboard Pages
100
	 *
101
	 * @access public
102
	 * @since 1.0
103
	 * @return void
104
	 */
105
	public function admin_head() {
106
		global $plugin_page;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
107
108
		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' );
109
		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' );
110
111
		if( !$this->is_dashboard_page() ) { return; }
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
112
113
		?>
114
        <style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html">
115
		/*<![CDATA[*/
116
117
		.update-nag { display: none; }
118
		.clear { clear: both; display: block; width: 100%; }
119
		.gv-welcome-screenshots {
120
			float: right;
121
			clear:right;
122
			max-width:50%;
123
			border: 1px solid #ccc;
124
			margin: 0 10px 10px 1.25rem!important;
125
		}
126
		/*]]>*/
127
		</style>
128
		<?php
129
	}
130
131
	/**
132
	 * Navigation tabs
133
	 *
134
	 * @access public
135
	 * @since 1.0
136
	 * @return void
137
	 */
138
	public function tabs() {
139
		global $plugin_page;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
140
141
		// Don't fetch -beta, etc.
142
		list( $display_version ) = explode( '-', GravityView_Plugin::version );
143
144
		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
145
146
		echo gravityview_get_floaty( 132 );
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'gravityview_get_floaty'
Loading history...
147
		?>
148
149
		<h1><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1>
150
		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
151
152
		<h2 class="nav-tab-wrapper clear">
153
			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$selected'
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
154
				<?php _e( "Getting Started", 'gravityview' ); ?>
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Getting Started does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
155
			</a>
156
			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$selected'
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
157
				<?php _e( "List of Changes", 'gravityview' ); ?>
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal List of Changes does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
158
			</a>
159
			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$selected'
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
160
				<?php _e( 'Credits', 'gravityview' ); ?>
161
			</a>
162
		</h2>
163
		<?php
164
	}
165
166
	/**
167
	 * Render About Screen
168
	 *
169
	 * @access public
170
	 * @since 1.0
171
	 * @return void
172
	 */
173
	public function getting_started_screen() {
174
	?>
175
		<div class="wrap about-wrap">
176
			<?php $this->tabs(); ?>
177
		</div>
178
179
		<div class="wrap">
180
181
			<div class="about-wrap">
182
                <h2 class="about-headline-callout">Configuring a View</h2>
183
184
                <div class="feature-video"  style="text-align:center;">
185
                    <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/WrXsZhqKRY8?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
186
187
                    <p style="text-align:center; padding-top: 1em;"><a class="button button-primary button-hero" href="http://docs.gravityview.co/category/24-category">Read more: Setting Up Your First View</a></p>
188
                </div>
189
            </div>
190
191
			<div class="feature-section col two-col" style="margin-top:1em;">
192
193
				<div>
194
195
					<h2>Create a View</h2>
196
197
					<ol class="ol-decimal">
198
						<li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views &gt; New View</a></li>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'admin_url'
Loading history...
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
199
						<li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li>
200
						<li>If you want to <strong>use an existing form&rsquo;s entries</strong>, select from the dropdown.</li>
201
						<li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>.
202
							<ul class="ul-square">
203
								<li><strong>Table Views</strong> output entries as tables; a grid of data.</li>
204
								<li><strong>Listing Views</strong> display entries in a more visual layout.</li>
205
							</ul>
206
						</li>
207
                        <li>On the View Configuration metabox, click on the "+Add Field" button to add form fields to the active areas of your View. These are the fields that will be displayed in the frontend.</li>
208
					</ol>
209
				</div>
210
211
				<div class="last-feature">
212
				<h2>Embed Views in Posts &amp; Pages</h2>
213
					<p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE ); ?>" class="gv-welcome-screenshots" />Views don&rsquo;t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
214
				</div>
215
			</div>
216
217
			<div class="feature-section clear">
218
				<h2>Configure Multiple Entry, Single Entry, and Edit Entry Layouts</h2>
219
220
                <p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE ); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
221
                    You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."
222
                </p>
223
224
				<ul class="ul-disc">
225
					<li>Click "+ Add Field" to add a field to a zone</li>
226
                    <li>Click the name of the field you want to display</li>
227
					<li>Once added, fields can be dragged and dropped to be re-arranged. Hover over the field until you see a cursor with four arrows, then drag the field.</li>
228
					<li>Click the <a href="#" style="text-decoration:none;"><i class="dashicons dashicons-admin-generic"></i></a> gear icon on each field to configure the <strong>Field Settings</strong></li>
229
				</ul>
230
			</div>
231
232
			<div class="clear">
233
				<h2>What is a View?</h2>
234
				<p>When a form is submitted in Gravity Forms, an entry is created. Without GravityView, Gravity Forms entries are visible only in the WordPress dashboard, and only to users with permission.</p>
235
236
				<p>GravityView allows you to display entries on the front of your site. In GravityView, when you arrange the fields you want displayed and save the configuration, it's called a "View".</p>
237
			</div>
238
		</div>
239
		<?php
240
	}
241
242
243
	/**
244
	 * Render Changelog Screen
245
	 *
246
	 * @since 1.0.1
247
	 * @return void
248
	 */
249
	public function changelog_screen() {
250
251
	?>
252
		<div class="wrap about-wrap">
253
254
			<?php $this->tabs(); ?>
255
256
			<div class="changelog point-releases" style="border-bottom: 0">
257
258
				<div class="feature-section col two-col" style="margin:0; padding: 0;">
259
					<div class="col col-1">
260
                        <div class="media-container"><img alt="{current_post}" src="<?php echo plugins_url( 'assets/images/screenshots/current_post.png', GRAVITYVIEW_FILE ); ?>" style="border: none"></div>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
261
                        <h4 class="higher">New <code>{current_post}</code> Merge Tag</h4>
262
                        <p>It may not sound like much, but it's powerful! Use it together with the <code>[gvlogic]</code> shortcode to show or hide content based on the page your View is embedded on. Use with the Advanced Filter Extension.</p>
263
                        <p><a href="https://docs.gravityview.co/article/412-currentpost-merge-tag" class="button-primary button button-large">Learn more about using the Merge Tag</a></p>
264
                    </div>
265
                    <div class="col col-2">
266
                        <div class="media-container"><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ) ); ?>"><img alt="Beta!" src="<?php echo plugins_url( 'assets/images/screenshots/beta-program.jpg', GRAVITYVIEW_FILE ); ?>" style="border: none"></a></div>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
267
                        <h4 class="higher">Beta Program</h4>
268
                        <p>We have a new Beta Program that gives you access to the latest pre-release versions of GravityView. We&rsquo;ve got big updates coming, and by opting-in, you&rsquo;ll get access early.</p>
269
                        <p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ) ); ?>" class="button button-primary button-large">Turn on &ldquo;Become a Beta Tester&rdquo; in Settings</a></p>
270
					</div>
271
				</div>
272
273
				<div class="headline-feature" style="max-width: 100%">
274
					<h2 style="border-bottom: 1px solid #ccc; padding-bottom: 1em; margin-bottom: 0;"><?php esc_html_e( 'What&rsquo;s New', 'gravityview' ); ?></h2>
275
				</div>
276
277
                <h3>1.21.5 on June 8, 2017</h3>
278
279
                <ul>
280
                    <li>Added: The <code>{current_post}</code> Merge Tag adds information about the current post. <a href="http://docs.gravityview.co/article/412-currentpost-merge-tag">Read more about it</a>.</li>
281
                    <li>Added: <code>gravityview/gvlogic/parse_atts/after</code> action to modify <code>[gvlogic]</code> shortcode attributes after it&#39;s been parsed</li>
282
                    <li>Added: A new setting to opt-in for access to the latest pre-release versions of GravityView (in <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ) ); ?>">Views &gt; Settings)</a></li>
283
                    <li>Added: Support for Restrict Content Pro when in &quot;No-Conflict Mode&quot;</li>
284
                    <li>Fixed: Saving an entry could strip the entry creator information. Now, when the entry creator is not in the &quot;Change Entry Creator&quot; users list, we add them back in to the list.</li>
285
                    <li>Fixed: Potential security issue</li>
286
                    <li>Fixed: Multiple notifications could sometimes be sent when editing an entry in GravityView.</li>
287
                    <li>Fixed: Gravity Forms tooltip scripts being loaded admin-wide.</li>
288
                </ul>
289
290
                <h3>1.21.4 on April 13, 2017</h3>
291
292
                <ul>
293
                    <li>Fixed: &quot;Enable sorting by column&quot; not visible when using table-based View Presets</li>
294
                    <li>Fixed: Error activating the plugin when Gravity Forms is not active</li>
295
                    <li>Fixed: Numeric sorting</li>
296
                    <li>Fixed: Compatibility issue with WPML 3.6.1 and lower</li>
297
                    <li>Tweak: When using <code>?cache</code> to disable entries caching, cached data is removed</li>
298
                </ul>
299
300
                <h3>1.21.3 on April 4, 2017</h3>
301
302
                <ul>
303
                    <li>Fixed: Post Images stopped working in Edit Entry</li>
304
                    <li>Fixed: Conflict with our Social Sharing &amp; SEO Extension</li>
305
                    <li>Fixed: Unable to search for a value of <code>0</code></li>
306
                    <li>Fixed: Inaccurate search results when using the <code>search_field</code> and <code>search_value</code> settings in the <code>[gravityview]</code> shortcode
307
308
                        <ul>
309
                            <li>The search mode will now always be set to <code>all</code> when using these settings</li>
310
                        </ul></li>
311
                </ul>
312
313
                <p><strong>Developer Updates:</strong></p>
314
315
                <ul>
316
                    <li>We decided to not throw exceptions in the new <code>gravityview()</code> wrapper function. Instead, we will log errors via Gravity Forms logging.</li>
317
                </ul>
318
319
320
                <h3>1.21.2 on March 31, 2017</h3>
321
322
                <ul>
323
                    <li>Added: Support for embedding <code>[gravityview]</code> shortcodes in Advanced Custom Fields (ACF) fields</li>
324
                    <li>Fixed: PHP warnings and notices</li>
325
                </ul>
326
327
                
328
                <h3>1.21.1 on March 30, 2017</h3>
329
330
                <ul>
331
                    <li>Fixed: Advanced Filters no longer filtered 😕</li>
332
                    <li>Fixed: Fatal error when viewing Single Entry with a Single Entry Title setting that included Merge Tags</li>
333
                    <li>Fixed: Cache wasn&#39;t cleared when an entry was created using Gravity Forms API (thanks Steve with Gravity Flow!)</li>
334
                </ul>
335
336
337
                <h3>1.21 on March 29, 2017</h3>
338
339
                <ul>
340
                    <li>Fixed: Edit Entry compatibility with Gravity Forms 2.2</li>
341
                    <li>Fixed: Single Entry not accessible when filtering a View by Gravity Flow&#39;s &quot;Final Status&quot; field</li>
342
                    <li>Fixed: Needed to re-save permalink settings for Single Entry and Edit Entry to work</li>
343
                    <li>Fixed: Incorrect pagination calculations when passing <code>offset</code> via the <code>[gravityview]</code> shortcode</li>
344
                </ul>
345
346
                <p><strong>Developer Updates:</strong></p>
347
348
                <ul>
349
                    <li>Modified: <code>GVCommon::check_entry_display()</code> now returns WP_Error instead of <code>false</code> when an error occurs. This allows for additional information to be passed.</li>
350
                    <li>Added: <code>gravityview/search-all-split-words</code> filter to change search behavior for the &quot;Search All&quot; search input. Default (<code>true</code>) converts words separated by spaces into separate search terms. <code>false</code> will search whole word.</li>
351
                    <li>Much progress has been made on the <code>gravityview()</code> wrapper function behind the scenes. Getting closer to parity all the time.</li>
352
                </ul>
353
354
				<p style="text-align: center">
355
					<a href="https://gravityview.co/changelog/" class="aligncenter button button-primary button-hero" style="margin: 0 auto; display: inline-block; text-transform: capitalize"><?php esc_html_e( 'View change history', 'gravityview' ); ?></a>
356
				</p>
357
358
				<div class="clear"></div>
359
			</div>
360
361
		</div>
362
	<?php
363
	}
364
365
	/**
366
	 * Render Credits Screen
367
	 *
368
	 * @access public
369
	 * @since 1.0
370
	 * @return void
371
	 */
372
	public function credits_screen() { ?>
373
		<div class="wrap about-wrap">
374
375
			<?php $this->tabs(); ?>
376
			<p class="about-description"><?php _e( 'GravityView is brought to you by:', 'gravityview' ); ?></p>
377
378
			<div class="feature-section col two-col">
379
380
				<div class="col">
381
					<h3>Zack Katz</h3>
382
					<h4 style="font-weight:0; margin-top:0">Project Lead &amp; Developer</h4>
383
					<p></p>
384
					<p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url( 'assets/images/zack.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
385
					<p><a href="https://katz.co">View Zack&rsquo;s website</a></p>
386
				</div>
387
388
				<div class="col last-feature">
389
					<h3>Rafael Ehlers</h3>
390
					<h4 style="font-weight:0; margin-top:0">Project Manager, Support Lead &amp; Customer Advocate</h4>
391
					<p><img style="margin: 0 15px 10px 0;"  class="alignleft avatar" src="<?php echo plugins_url( 'assets/images/rafael.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Rafael helps guide GravityView development priorities and keep us on track. He&rsquo;s the face of our customer support and helps customers get the most out of the product. Rafael hails from Porto Alegre, Brazil.</p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
392
					<p><a href="http://heropress.com/essays/journey-resilience/">View Rafael&rsquo;s WordPress Journey</a></p>
393
				</div>
394
			</div>
395
396
			<hr class="clear" />
397
398
			<div class="feature-section">
399
				<div>
400
					<h2><?php esc_attr_e( 'Contributors', 'gravityview' ); ?></h2>
401
402
					<ul class="wp-people-group">
403
						<li class="wp-person">Core &amp; Extension development by <a href="http://tinygod.pt" class="block">Luis Godinho</a> and <a href="https://codeseekah.com" class="block">Gennady Kovshenin</a></li>
404
						<li class="wp-person">Bengali translation by <a href="https://www.transifex.com/accounts/profile/tareqhi/">@tareqhi</a></li>
405
						<li class="wp-person">German translation by <a href="https://www.transifex.com/user/profile/hubert123456/">@hubert123456</a>, <a href="https://www.transifex.com/accounts/profile/seschwarz/">@seschwarz</a>, <a href="https://www.transifex.com/accounts/profile/abdmc/">@abdmc</a>, <a href="https://www.transifex.com/accounts/profile/deckerweb/">@deckerweb</a></li>
406
						<li class="wp-person">Turkish translation by <a href="https://www.transifex.com/accounts/profile/suhakaralar/">@suhakaralar</a></li>
407
						<li class="wp-person">Dutch translation by <a href="https://www.transifex.com/accounts/profile/leooosterloo/">@leooosterloo</a>, <a href="https://www.transifex.com/accounts/profile/Weergeven/">@Weergeven</a>, and <a href="https://www.transifex.com/accounts/profile/erikvanbeek/">@erikvanbeek</a></li>
408
						<li class="wp-person">Hungarian translation by <a href="https://www.transifex.com/accounts/profile/dbalage/">@dbalage</a> and <a href="https://www.transifex.com/accounts/profile/Darqebus/">@Darqebus</a></li>
409
						<li class="wp-person">Italian translation by <a href="https://www.transifex.com/accounts/profile/Lurtz/">@Lurtz</a> and <a href="https://www.transifex.com/accounts/profile/ClaraDiGennaro/">@ClaraDiGennaro</a></li>
410
						<li class="wp-person">French translation by <a href="https://www.transifex.com/accounts/profile/franckt/">@franckt</a> and <a href="https://www.transifex.com/accounts/profile/Newbdev/">@Newbdev</a></li>
411
						<li class="wp-person">Portuguese translation by <a href="https://www.transifex.com/accounts/profile/luistinygod/">@luistinygod</a>, <a href="https://www.transifex.com/accounts/profile/marlosvinicius.info/">@marlosvinicius</a>, and <a href="https://www.transifex.com/user/profile/rafaehlers/">@rafaehlers</a></li>
412
						<li class="wp-person">Romanian translation by <a href="https://www.transifex.com/accounts/profile/ArianServ/">@ArianServ</a></li>
413
						<li class="wp-person">Finnish translation by <a href="https://www.transifex.com/accounts/profile/harjuja/">@harjuja</a></li>
414
						<li class="wp-person">Spanish translation by <a href="https://www.transifex.com/accounts/profile/jorgepelaez/">@jorgepelaez</a>, <a href="https://www.transifex.com/accounts/profile/luisdiazvenero/">@luisdiazvenero</a>, <a href="https://www.transifex.com/accounts/profile/josemv/">@josemv</a>, <a href="https://www.transifex.com/accounts/profile/janolima/">@janolima</a> and <a href="https://www.transifex.com/accounts/profile/matrixmercury/">@matrixmercury</a></li>
415
						<li class="wp-person">Swedish translation by <a href="https://www.transifex.com/accounts/profile/adamrehal/">@adamrehal</a></li>
416
						<li class="wp-person">Indonesian translation by <a href="https://www.transifex.com/accounts/profile/sariyanta/">@sariyanta</a></li>
417
						<li class="wp-person">Norwegian translation by <a href="https://www.transifex.com/accounts/profile/aleksanderespegard/">@aleksanderespegard</a></li>
418
						<li class="wp-person">Danish translation by <a href="https://www.transifex.com/accounts/profile/jaegerbo/">@jaegerbo</a></li>
419
						<li class="wp-person">Chinese translation by <a href="https://www.transifex.com/user/profile/michaeledi/">@michaeledi</a></li>
420
						<li class="wp-person">Persian translation by <a href="https://www.transifex.com/user/profile/azadmojtaba/">@azadmojtaba</a></li>
421
						<li class="wp-person">Russian translation by <a href="https://www.transifex.com/user/profile/gkovaleff/">@gkovaleff</a></li>
422
						<li class="wp-person">Code contributions by <a href="https://github.com/ryanduff">@ryanduff</a>, <a href="https://github.com/dmlinn">@dmlinn</a>, <a href="https://github.com/mgratch">@mgratch</a>, and <a href="https://github.com/stevehenty">@stevehenty</a></li>
423
					</ul>
424
425
					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
426
					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
427
				</div>
428
			</div>
429
430
			<hr class="clear" />
431
432
			<div class="changelog">
433
434
				<h4>Thanks to the following open-source software:</h4>
435
436
				<ul>
437
					<li><a href="http://datatables.net/">DataTables</a> - amazing tool for table data display. Many thanks!</li>
438
					<li><a href="https://github.com/10up/flexibility">Flexibility</a> - Adds support for CSS flexbox to Internet Explorer 8 &amp; 9</li>
439
					<li><a href="https://github.com/GaryJones/Gamajo-Template-Loader">Gamajo Template Loader</a> - makes it easy to load template files with user overrides</li>
440
					<li><a href="https://github.com/carhartl/jquery-cookie">jQuery Cookie plugin</a> - Access and store cookie values with jQuery</li>
441
					<li><a href="https://katz.si/gf">Gravity Forms</a> - If Gravity Forms weren't such a great plugin, GravityView wouldn't exist!</li>
442
					<li>GravityView uses icons made by Freepik, Adam Whitcroft, Amit Jakhu, Zurb, Scott de Jonge, Yannick, Picol, Icomoon, TutsPlus, Dave Gandy, SimpleIcon from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a></li>
443
					<li>GravityView uses free vector art by <a href="https://www.vecteezy.com">vecteezy.com</a></li>
444
					<li><a href="https://github.com/jnicol/standalone-phpenkoder">PHPEnkoder</a> script encodes the email addresses.</li>
445
					<li>The Duplicate View functionality is based on the excellent <a href="https://lopo.it/duplicate-post-plugin/">Duplicate Post plugin</a> by Enrico Battocchi</li>
446
					<li>Browser testing by <a href="https://www.browserstack.com">BrowserStack</a></li>
447
					<li><a href="https://easydigitaldownloads.com/downloads/software-licensing/">Easy Digital Downloads</a> makes auto-upgrades possible</li>
448
				</ul>
449
450
			</div>
451
452
		</div>
453
	<?php
454
	}
455
456
457
	/**
458
	 * Sends user to the Welcome page on first activation of GravityView as well as each
459
	 * time GravityView is upgraded to a new version
460
	 *
461
	 * @access public
462
	 * @since 1.0
463
	 * @return void
464
	 */
465
	public function welcome() {
466
		global $plugin_page;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
467
468
		// Bail if we're just editing the plugin
469
		if( $plugin_page === 'plugin-editor.php' ) { return; }
0 ignored issues
show
introduced by
Found "=== '". Use Yoda Condition checks, you must
Loading history...
470
471
		// Bail if no activation redirect
472
		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
473
474
		// Delete the redirect transient
475
		delete_transient( '_gv_activation_redirect' );
476
477
		$upgrade = get_option( 'gv_version_upgraded_from' );
478
479
		// Don't do anything if they've already seen the new version info
480
		if( $upgrade === GravityView_Plugin::version ) {
481
			return;
482
		}
483
484
		// Add "Upgraded From" Option
485
		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
486
487
		// Bail if activating from network, or bulk
488
		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; }
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
489
490
		// First time install
491
		if( ! $upgrade ) {
492
			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method welcome() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
493
		}
494
		// Update
495
		else {
496
			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-changelog' ) ); exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method welcome() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
497
		}
498
	}
499
}
500
new GravityView_Welcome;
501