Completed
Push — master ( c38d6c...15bc19 )
by Zack
14:07 queued 10:41
created

GravityView_Welcome::credits_screen()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 94
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 94
ccs 0
cts 70
cp 0
crap 2
rs 8.4378
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
		.update-nag { display: none; }
117
		/*]]>*/
118
		</style>
119
		<?php
120
	}
121
122
	/**
123
	 * Navigation tabs
124
	 *
125
	 * @access public
126
	 * @since 1.0
127
	 * @return void
128
	 */
129
	public function tabs() {
130
		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...
131
132
		// Don't fetch -beta, etc.
133
		list( $display_version ) = explode( '-', GravityView_Plugin::version );
134
135
		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
136
137
		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...
138
		?>
139
140
		<h1><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1>
141
		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
142
143
		<h2 class="nav-tab-wrapper clear">
144
			<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...
145
				<?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...
146
			</a>
147
			<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...
148
				<?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...
149
			</a>
150
			<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...
151
				<?php _e( 'Credits', 'gravityview' ); ?>
152
			</a>
153
		</h2>
154
		<?php
155
	}
156
157
	/**
158
	 * Render About Screen
159
	 *
160
	 * @access public
161
	 * @since 1.0
162
	 * @return void
163
	 */
164
	public function getting_started_screen() {
165
	?>
166
		<div class="wrap about-wrap">
167
			<?php $this->tabs(); ?>
168
		</div>
169
170
		<div class="about-wrap">
171
172
            <h2 class="about-headline-callout">Configuring a View</h2>
173
174
            <div class="feature-video"  style="text-align:center;">
175
                <iframe height="315" src="https://www.youtube-nocookie.com/embed/WrXsZhqKRY8?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
176
177
                <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>
178
            </div>
179
180
			<div class="feature-section two-col">
181
				<div class="col">
182
					<h3>Create a View</h3>
183
184
                    <ol class="ol-decimal">
185
						<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...
186
						<li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li>
187
						<li>If you want to <strong>use an existing form&rsquo;s entries</strong>, select from the dropdown.</li>
188
						<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>.
189
							<ul class="ul-square">
190
								<li><strong>Table Views</strong> output entries as tables; a grid of data.</li>
191
								<li><strong>Listing Views</strong> display entries in a more visual layout.</li>
192
							</ul>
193
						</li>
194
                        <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>
195
					</ol>
196
				</div>
197
                <div class="col">
198
                    <h4>What is a View?</h4>
199
                    <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>
200
                    <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>
201
                </div>
202
			</div>
203
204
            <hr />
205
206
            <div class="feature-section two-col">
207
                <div class="col">
208
                    <h3>Embed Views in Posts &amp; Pages</h3>
209
                    <p>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>
210
                </div>
211
                <div class="col">
212
                    <img src="<?php echo plugins_url( 'assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE ); ?>" />
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
213
                </div>
214
            </div>
215
216
            <hr />
217
218
			<div class="feature-section two-col">
219
                <div class="col">
220
                    <h3>Configure Multiple Entry, Single Entry, and Edit Entry Layouts</h3>
221
222
                    <p>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."</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
                <div class="col">
232
                    <img src="<?php echo plugins_url( 'assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE ); ?>" alt="Add a field dialog box" />
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
233
                </div>
234
			</div>
235
		</div>
236
		<?php
237
	}
238
239
240
	/**
241
	 * Render Changelog Screen
242
	 *
243
	 * @since 1.0.1
244
	 * @return void
245
	 */
246
	public function changelog_screen() {
247
248
	?>
249
		<div class="wrap about-wrap">
250
251
			<?php $this->tabs(); ?>
252
253
			<div class="changelog point-releases" style="border-bottom: 0">
254
255
				<div class="feature-section col two-col" style="margin:0; padding: 0;">
256
					<div class="col col-1">
257
                        <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...
258
                        <h4 class="higher">New <code>{current_post}</code> Merge Tag</h4>
259
                        <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>
260
                        <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>
261
                    </div>
262
                    <div class="col col-2">
263
                        <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...
264
                        <h4 class="higher">Beta Program</h4>
265
                        <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>
266
                        <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>
267
					</div>
268
				</div>
269
270
				<div class="headline-feature" style="max-width: 100%">
271
					<h2 style="border-bottom: 1px solid #ccc; padding-bottom: 1em; margin-bottom: 0;"><?php esc_html_e( 'What&rsquo;s New', 'gravityview' ); ?></h2>
272
				</div>
273
274
                <h3>1.21.5.3 on July 24, 2017</h3>
275
276
                <ul>
277
                    <li>Fixed: For some field types, the value &quot;No&quot; would be interpreted as <code>false</code></li>
278
                    <li>Fixed: In Edit Entry, when editing a form that has a Post Custom Field field type—configured as checkboxes—file upload fields would not be saved</li>
279
                    <li>Fixed: If a form connected to a View is in the trash, there will be an error when editing the View</li>
280
                    <li>Fixed: Embedding single entries with WordPress 4.8</li>
281
                    <li>Fixed: Fatal error when using older version of WPML</li>
282
                </ul>
283
284
285
                <h3>1.21.5.2 on June 26, 2017</h3>
286
287
                <ul>
288
                    <li>Tweak: Improved plugin speed by reducing amount of information logged</li>
289
                    <li>Fixed: Duplicate descriptions on the settings screen</li>
290
                    <li>Fixed: Our &quot;No-Conflict Mode&quot; made the settings screen look bad. Yes, we recognize the irony.</li>
291
                    <li>Updated: Translations - thank you, translators!
292
293
                        <ul>
294
                            <li>Turkish translation by <a href="https://www.transifex.com/accounts/profile/suhakaralar/">@suhakaralar</a></li>
295
                            <li>Dutch translations by Thom</li>
296
                        </ul></li>
297
                </ul>
298
299
                <h3>1.21.5.1 on June 13, 2017</h3>
300
301
                <ul>
302
                    <li>Modified: We stopped allowing any HTML in Paragraph Text fields in 1.21.5, but this functionality was used by lots of people. We now use a different function to allow safe HTML by default.</li>
303
                    <li>Added: `gravityview/fields/textarea/allowed_kses` filter to modify the allowed HTML to be displayed.</li>
304
                </ul>
305
306
                
307
                <h3>1.21.5 on June 8, 2017</h3>
308
309
                <ul>
310
                    <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>
311
                    <li>Added: <code>gravityview/gvlogic/parse_atts/after</code> action to modify <code>[gvlogic]</code> shortcode attributes after it&#39;s been parsed</li>
312
                    <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>
313
                    <li>Added: Support for Restrict Content Pro when in &quot;No-Conflict Mode&quot;</li>
314
                    <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>
315
                    <li>Fixed: Potential security issue</li>
316
                    <li>Fixed: Multiple notifications could sometimes be sent when editing an entry in GravityView.</li>
317
                    <li>Fixed: Gravity Forms tooltip scripts being loaded admin-wide.</li>
318
                </ul>
319
320
                <h3>1.21.4 on April 13, 2017</h3>
321
322
                <ul>
323
                    <li>Fixed: &quot;Enable sorting by column&quot; not visible when using table-based View Presets</li>
324
                    <li>Fixed: Error activating the plugin when Gravity Forms is not active</li>
325
                    <li>Fixed: Numeric sorting</li>
326
                    <li>Fixed: Compatibility issue with WPML 3.6.1 and lower</li>
327
                    <li>Tweak: When using <code>?cache</code> to disable entries caching, cached data is removed</li>
328
                </ul>
329
330
                <h3>1.21.3 on April 4, 2017</h3>
331
332
                <ul>
333
                    <li>Fixed: Post Images stopped working in Edit Entry</li>
334
                    <li>Fixed: Conflict with our Social Sharing &amp; SEO Extension</li>
335
                    <li>Fixed: Unable to search for a value of <code>0</code></li>
336
                    <li>Fixed: Inaccurate search results when using the <code>search_field</code> and <code>search_value</code> settings in the <code>[gravityview]</code> shortcode
337
338
                        <ul>
339
                            <li>The search mode will now always be set to <code>all</code> when using these settings</li>
340
                        </ul></li>
341
                </ul>
342
343
                <p><strong>Developer Updates:</strong></p>
344
345
                <ul>
346
                    <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>
347
                </ul>
348
349
350
                <h3>1.21.2 on March 31, 2017</h3>
351
352
                <ul>
353
                    <li>Added: Support for embedding <code>[gravityview]</code> shortcodes in Advanced Custom Fields (ACF) fields</li>
354
                    <li>Fixed: PHP warnings and notices</li>
355
                </ul>
356
357
                
358
                <h3>1.21.1 on March 30, 2017</h3>
359
360
                <ul>
361
                    <li>Fixed: Advanced Filters no longer filtered 😕</li>
362
                    <li>Fixed: Fatal error when viewing Single Entry with a Single Entry Title setting that included Merge Tags</li>
363
                    <li>Fixed: Cache wasn&#39;t cleared when an entry was created using Gravity Forms API (thanks Steve with Gravity Flow!)</li>
364
                </ul>
365
366
367
                <h3>1.21 on March 29, 2017</h3>
368
369
                <ul>
370
                    <li>Fixed: Edit Entry compatibility with Gravity Forms 2.2</li>
371
                    <li>Fixed: Single Entry not accessible when filtering a View by Gravity Flow&#39;s &quot;Final Status&quot; field</li>
372
                    <li>Fixed: Needed to re-save permalink settings for Single Entry and Edit Entry to work</li>
373
                    <li>Fixed: Incorrect pagination calculations when passing <code>offset</code> via the <code>[gravityview]</code> shortcode</li>
374
                </ul>
375
376
                <p><strong>Developer Updates:</strong></p>
377
378
                <ul>
379
                    <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>
380
                    <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>
381
                    <li>Much progress has been made on the <code>gravityview()</code> wrapper function behind the scenes. Getting closer to parity all the time.</li>
382
                </ul>
383
384
				<p style="text-align: center">
385
					<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>
386
				</p>
387
388
				<div class="clear"></div>
389
			</div>
390
391
		</div>
392
	<?php
393
	}
394
395
	/**
396
	 * Render Credits Screen
397
	 *
398
	 * @access public
399
	 * @since 1.0
400
	 * @return void
401
	 */
402
	public function credits_screen() { ?>
403
		<div class="wrap about-wrap">
404
405
			<?php $this->tabs(); ?>
406
			<p class="about-description"><?php _e( 'GravityView is brought to you by:', 'gravityview' ); ?></p>
407
408
            <style>
409
                .feature-section h3 a {
410
                    text-decoration: none;
411
                    display: inline-block;
412
                    margin-left: .2em;
413
                    line-height: 1em;
414
                }
415
            </style>
416
			<div class="feature-section col three-col">
417
418
				<div class="col">
419
					<h3>Zack Katz <a href="https://twitter.com/zackkatz"><span class="dashicons dashicons-twitter" title="Follow Zack on Twitter"></span></a> <a href="https://katz.co" title="View Zack&rsquo;s website"><span class="dashicons dashicons-admin-site"></span></a></h3>
420
					<h4 style="font-weight:0; margin-top:0">Project Lead &amp; Developer</h4>
421
					<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 runs GravityView and lives with his wife (and cat) in <a href="https://wikipedia.org/wiki/Denver">Denver, Colorado</a>.</p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
422
				</div>
423
424
                <div class="col">
425
					<h3>Rafael Ehlers <a href="https://twitter.com/rafaehlers" title="Follow Rafael on Twitter"><span class="dashicons dashicons-twitter"></span></a> <a href="https://heropress.com/essays/journey-resilience/" title="View Rafael&rsquo;s WordPress Journey"><span class="dashicons dashicons-admin-site"></span></a></p></h3>
426
					<h4 style="font-weight:0; margin-top:0">Project Manager, Support Lead &amp; Customer&nbsp;Advocate</h4>
427
					<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 <a href="https://wikipedia.org/wiki/Porto_Alegre">Porto Alegre, Brazil</a>.</p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
428
				</div>
429
430
                <div class="col last-feature">
431
                    <h3>Gennady Kovshenin <a href="https://twitter.com/soulseekah" title="Follow Gennady on Twitter"><span class="dashicons dashicons-twitter"></span></a> <a href="https://codeseekah.com" title="View Gennady&rsquo;s Blog"><span class="dashicons dashicons-admin-site"></span></a></h3>
432
                    <h4 style="font-weight:0; margin-top:0">Core Developer</h4>
433
                    <p><img style="margin: 0 15px 10px 0;"  class="alignleft avatar" src="<?php echo plugins_url( 'assets/images/gennady.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Gennady works on the GravityView core, improving everything behind the scenes. He is an active member of the WordPress community and loves exotic tea. Gennady lives and runs long distances in <a href="https://wikipedia.org/wiki/Magnitogorsk" rel="external">Magnitogorsk, Russia</a>.</p>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'plugins_url'
Loading history...
434
                </div>
435
			</div>
436
437
			<hr class="clear" />
438
439
			<div class="feature-section">
440
				<div>
441
					<h2><?php esc_attr_e( 'Contributors', 'gravityview' ); ?></h2>
442
443
					<ul class="wp-people-group">
444
						<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>
445
						<li class="wp-person">Bengali translation by <a href="https://www.transifex.com/accounts/profile/tareqhi/">@tareqhi</a></li>
446
						<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>
447
						<li class="wp-person">Turkish translation by <a href="https://www.transifex.com/accounts/profile/suhakaralar/">@suhakaralar</a></li>
448
						<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>, and <a href="https://www.transifex.com/user/profile/SilverXp/">Thom (@SilverXp)</a></li>
449
						<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>
450
						<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>
451
						<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>
452
						<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>
453
						<li class="wp-person">Romanian translation by <a href="https://www.transifex.com/accounts/profile/ArianServ/">@ArianServ</a></li>
454
						<li class="wp-person">Finnish translation by <a href="https://www.transifex.com/accounts/profile/harjuja/">@harjuja</a></li>
455
						<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>
456
						<li class="wp-person">Swedish translation by <a href="https://www.transifex.com/accounts/profile/adamrehal/">@adamrehal</a></li>
457
						<li class="wp-person">Indonesian translation by <a href="https://www.transifex.com/accounts/profile/sariyanta/">@sariyanta</a></li>
458
						<li class="wp-person">Norwegian translation by <a href="https://www.transifex.com/accounts/profile/aleksanderespegard/">@aleksanderespegard</a></li>
459
						<li class="wp-person">Danish translation by <a href="https://www.transifex.com/accounts/profile/jaegerbo/">@jaegerbo</a></li>
460
						<li class="wp-person">Chinese translation by <a href="https://www.transifex.com/user/profile/michaeledi/">@michaeledi</a></li>
461
						<li class="wp-person">Persian translation by <a href="https://www.transifex.com/user/profile/azadmojtaba/">@azadmojtaba</a></li>
462
						<li class="wp-person">Russian translation by <a href="https://www.transifex.com/user/profile/gkovaleff/">@gkovaleff</a></li>
463
						<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>
464
					</ul>
465
466
					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
467
					<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...
468
				</div>
469
			</div>
470
471
			<hr class="clear" />
472
473
			<div class="changelog">
474
475
				<h4>Thanks to the following open-source software:</h4>
476
477
				<ul>
478
					<li><a href="http://datatables.net/">DataTables</a> - amazing tool for table data display. Many thanks!</li>
479
					<li><a href="https://github.com/10up/flexibility">Flexibility</a> - Adds support for CSS flexbox to Internet Explorer 8 &amp; 9</li>
480
					<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>
481
					<li><a href="https://github.com/carhartl/jquery-cookie">jQuery Cookie plugin</a> - Access and store cookie values with jQuery</li>
482
					<li><a href="https://katz.si/gf">Gravity Forms</a> - If Gravity Forms weren't such a great plugin, GravityView wouldn't exist!</li>
483
					<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>
484
					<li>GravityView uses free vector art by <a href="https://www.vecteezy.com">vecteezy.com</a></li>
485
					<li><a href="https://github.com/jnicol/standalone-phpenkoder">PHPEnkoder</a> script encodes the email addresses.</li>
486
					<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>
487
					<li>Browser testing by <a href="https://www.browserstack.com">BrowserStack</a></li>
488
					<li><a href="https://easydigitaldownloads.com/downloads/software-licensing/">Easy Digital Downloads</a> makes auto-upgrades possible</li>
489
				</ul>
490
491
			</div>
492
493
		</div>
494
	<?php
495
	}
496
497
498
	/**
499
	 * Sends user to the Welcome page on first activation of GravityView as well as each
500
	 * time GravityView is upgraded to a new version
501
	 *
502
	 * @access public
503
	 * @since 1.0
504
	 * @return void
505
	 */
506
	public function welcome() {
507
		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...
508
509
		// Bail if we're just editing the plugin
510
		if( $plugin_page === 'plugin-editor.php' ) { return; }
0 ignored issues
show
introduced by
Found "=== '". Use Yoda Condition checks, you must
Loading history...
511
512
		// Bail if no activation redirect
513
		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
514
515
		// Delete the redirect transient
516
		delete_transient( '_gv_activation_redirect' );
517
518
		$upgrade = get_option( 'gv_version_upgraded_from' );
519
520
		// Don't do anything if they've already seen the new version info
521
		if( $upgrade === GravityView_Plugin::version ) {
522
			return;
523
		}
524
525
		// Add "Upgraded From" Option
526
		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
527
528
		// Bail if activating from network, or bulk
529
		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...
530
531
		// First time install
532
		if( ! $upgrade ) {
533
			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...
534
		}
535
		// Update
536
		else {
537
			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...
538
		}
539
	}
540
}
541
new GravityView_Welcome;
542