Completed
Push — develop ( 77088b...ed69dc )
by Zack
19:18
created
includes/class-gravityview-admin-duplicate-view.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@
 block discarded – undo
195 195
 	 *
196 196
 	 * @since 1.6
197 197
 	 *
198
-	 * @param int $new_view_id The ID of the newly created View
198
+	 * @param int $new_id The ID of the newly created View
199 199
 	 * @param WP_Post $post The View that was just cloned
200 200
 	 *
201 201
 	 * @return void
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 	function __construct() {
16 16
 
17 17
 		// Only run on Admin
18
-		if ( !is_admin() ) {
18
+		if ( ! is_admin() ) {
19 19
 			return;
20 20
 		}
21 21
 
22 22
 		// If the Duplicate Post plugin is active, don't run.
23
-		if( defined('DUPLICATE_POST_CURRENT_VERSION') ) {
23
+		if ( defined( 'DUPLICATE_POST_CURRENT_VERSION' ) ) {
24 24
 			return;
25 25
 		}
26 26
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 		global $post;
61 61
 
62 62
 		// We only want to add Clone links to the Edit View metabox
63
-		if( !$this->is_all_views_page() ) {
63
+		if ( ! $this->is_all_views_page() ) {
64 64
 
65
-			if( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) {
66
-				$links[] = '<span>' . $duplicate_links['edit_as_new_draft'] . '</span>';
65
+			if ( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) {
66
+				$links[ ] = '<span>' . $duplicate_links[ 'edit_as_new_draft' ] . '</span>';
67 67
 			}
68 68
 
69 69
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		 * @param string|null If string, the status to set for the new View. If empty, use existing View status.
124 124
 		 * @param WP_Post $post View being cloned
125 125
 		 */
126
-		$new_view_status = apply_filters('gravityview/duplicate-view/status', $status, $post );
126
+		$new_view_status = apply_filters( 'gravityview/duplicate-view/status', $status, $post );
127 127
 
128 128
 		$new_view = array(
129 129
 			'menu_order'     => $post->menu_order,
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 		 * @param boolean $copy_date Whether the copy the date from the existing View. Default: `false`
147 147
 		 * @param WP_Post $post View being cloned
148 148
 		 */
149
-		$copy_date = apply_filters('gravityview/duplicate-view/copy-date', false, $post );
149
+		$copy_date = apply_filters( 'gravityview/duplicate-view/copy-date', false, $post );
150 150
 
151 151
 		if ( $copy_date ) {
152
-			$new_view['post_date']     = $new_post_date = $post->post_date;
153
-			$new_view['post_date_gmt'] = get_gmt_from_date( $new_post_date );
152
+			$new_view[ 'post_date' ]     = $new_post_date = $post->post_date;
153
+			$new_view[ 'post_date_gmt' ] = get_gmt_from_date( $new_post_date );
154 154
 		}
155 155
 
156 156
 		/**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @param array $new_view Array of settings to be passed to wp_insert_post()
160 160
 		 * @param WP_Post $post View being cloned
161 161
 		 */
162
-		$new_view = apply_filters('gravityview/duplicate-view/new-view', $new_view, $post );
162
+		$new_view = apply_filters( 'gravityview/duplicate-view/new-view', $new_view, $post );
163 163
 
164 164
 		// Magic happens here.
165 165
 		$new_view_id = wp_insert_post( $new_view );
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 			$clone_text = __( 'Clone', 'gravityview' );
242 242
 			$clone_title = __( 'Clone this View', 'gravityview' );
243 243
 
244
-			$actions['clone'] = gravityview_get_link( $clone_link, $clone_text, 'title='.$clone_title );
244
+			$actions[ 'clone' ] = gravityview_get_link( $clone_link, $clone_text, 'title=' . $clone_title );
245 245
 
246 246
 			$clone_draft_link = $this->get_clone_view_link( $post->ID );
247 247
 			$clone_draft_text = $this->is_all_views_page() ? __( 'New Draft', 'gravityview' ) : __( 'Clone View', 'gravityview' );
248 248
 			$clone_draft_title = __( 'Copy as a new draft View', 'gravityview' );
249 249
 
250
-			$actions['edit_as_new_draft'] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title='.$clone_draft_title );
250
+			$actions[ 'edit_as_new_draft' ] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title=' . $clone_draft_title );
251 251
 		}
252 252
 
253 253
 		return $actions;
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		// Verify the View exists
274
-		if ( !$view = get_post( $id ) ) {
274
+		if ( ! $view = get_post( $id ) ) {
275 275
 			return '';
276 276
 		}
277 277
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		$post_type_object = get_post_type_object( $view->post_type );
287 287
 
288 288
 		/** If there's no gravityview post type for some reason, abort! */
289
-		if ( !$post_type_object ) {
289
+		if ( ! $post_type_object ) {
290 290
 			gravityview()->log->error( 'No gravityview post type exists when trying to clone the View.', array( 'data' => $view ) );
291 291
 			return '';
292 292
 		}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		 * @param int $view_id View ID
299 299
 		 * @param string $context How to display the link. If "display", the URL is run through esc_html(). Default: `display`
300 300
 		 */
301
-		$clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php". $action ), $view->ID, $context );
301
+		$clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php" . $action ), $view->ID, $context );
302 302
 
303 303
 		return $clone_view_link;
304 304
 	}
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public function save_as_new_view( $status = '' ) {
327 327
 
328
-		if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) ) ) {
328
+		if ( ! ( isset( $_GET[ 'post' ] ) || isset( $_POST[ 'post' ] ) ) ) {
329 329
 			wp_die( __( 'No post to duplicate has been supplied!', 'gravityview' ) );
330 330
 		}
331 331
 
332 332
 		// Get the original post
333
-		$id   = ( isset( $_GET['post'] ) ? $_GET['post'] : $_POST['post'] );
333
+		$id = ( isset( $_GET[ 'post' ] ) ? $_GET[ 'post' ] : $_POST[ 'post' ] );
334 334
 
335
-		if( ! $this->current_user_can_copy( $id ) ) {
335
+		if ( ! $this->current_user_can_copy( $id ) ) {
336 336
 			wp_die( __( 'You don\'t have permission to copy this View.', 'gravityview' ) );
337 337
 		}
338 338
 
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 
117 117
 	/**
118 118
 	 * @since 1.12
119
-	 * @return bool
119
+	 * @return boolean|null
120 120
 	 */
121 121
 	private function add_fallback_shortcode() {
122 122
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@
 block discarded – undo
240 240
 			self::$notices['wp_version'] = array(
241 241
 				'class' => 'error',
242 242
 				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ),
243
-			    'cap' => 'update_core',
243
+				'cap' => 'update_core',
244 244
 				'dismiss' => 'wp_version',
245 245
 			);
246 246
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return GravityView_Compatibility
77 77
 	 */
78 78
 	public static function getInstance() {
79
-		if( self::$instance ) {
79
+		if ( self::$instance ) {
80 80
 			return self::$instance;
81 81
 		}
82 82
 		return new self;
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
139 139
 		// show the notice, but not load any post types or process shortcodes.
140 140
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
141
-		if( ! self::is_valid() ) {
141
+		if ( ! self::is_valid() ) {
142 142
 
143 143
 			// If the plugin's not loaded, might as well hide the shortcode for people.
144
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
144
+			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) );
145 145
 
146 146
 		}
147 147
 	}
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
169 169
 
170
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
170
+		if ( ! GVCommon::has_cap( 'activate_plugins' ) ) {
171 171
 			return null;
172 172
 		}
173 173
 
174 174
 		$notices = self::get_notices();
175 175
 
176
-		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>';
177
-		foreach( (array)$notices as $notice ) {
178
-			$message .= wpautop( $notice['message'] );
176
+		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>';
177
+		foreach ( (array)$notices as $notice ) {
178
+			$message .= wpautop( $notice[ 'message' ] );
179 179
 		}
180 180
 		$message .= '</div>';
181 181
 
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 
196 196
 		if ( ! gravityview()->plugin->is_compatible_php() ) {
197 197
 
198
-			self::$notices['php_version'] = array(
198
+			self::$notices[ 'php_version' ] = array(
199 199
 				'class' => 'error',
200
-				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
200
+				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
201 201
 				'cap' => 'manage_options',
202 202
 				'dismiss' => 'php_version',
203 203
 			);
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 		if ( ! gravityview()->plugin->is_compatible_future_php() ) {
209 209
 
210 210
 			// Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking.
211
-			$key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
211
+			$key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
212 212
 
213 213
 			self::$notices[ $key ] = array(
214 214
 				'class' => 'error',
215
-				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
215
+				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
216 216
 				'cap' => 'manage_options',
217 217
 				'dismiss' => $key,
218 218
 			);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 		if ( ! gravityview()->plugin->is_compatible_wordpress() ) {
239 239
 
240
-			self::$notices['wp_version'] = array(
240
+			self::$notices[ 'wp_version' ] = array(
241 241
 				'class' => 'error',
242 242
 				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ),
243 243
 			    'cap' => 'update_core',
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 	public static function check_gravityforms() {
272 272
 
273 273
 		// Bypass other checks: if the class exists
274
-		if( class_exists( 'GFCommon' ) ) {
274
+		if ( class_exists( 'GFCommon' ) ) {
275 275
 
276 276
 			// Does the version meet future requirements?
277
-			if( true === gravityview()->plugin->is_compatible_future_gravityforms() ) {
277
+			if ( true === gravityview()->plugin->is_compatible_future_gravityforms() ) {
278 278
 				return true;
279 279
 			}
280 280
 
281 281
 			// Does it meet minimum requirements?
282 282
 			$meets_minimum = gravityview()->plugin->is_compatible_gravityforms();
283 283
 
284
-			if( $meets_minimum ) {
284
+			if ( $meets_minimum ) {
285 285
 				/* translators: first placeholder is the future required version of Gravity Forms. The second placeholder is the current version of Gravity Forms. */
286 286
 				$title = __( 'In the future, GravityView will require Gravity Forms Version %s or newer.', 'gravityview' );
287 287
 				$version = GV_FUTURE_MIN_GF_VERSION;
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
 			$message = '<h3>' . esc_html( sprintf( $title, $version ) ) . '</h3>';
297 297
 
298 298
 			/* translators: the placeholder is the current version of Gravity Forms. */
299
-			$message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>' ) . '</p>';
299
+			$message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>' ) . '</p>';
300 300
 
301 301
 			/* translators: In this context, "get" means purchase */
302 302
 			$message .= '<p><a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' . esc_html__( 'Get the Latest Gravity Forms', 'gravityview' ) . '</a></p>';
303 303
 
304 304
 
305 305
 			// Show the notice even if the future version requirements aren't met
306
-			self::$notices['gf_version'] = array(
306
+			self::$notices[ 'gf_version' ] = array(
307 307
 				'class' => $class,
308 308
 				'message' => $message,
309 309
 				'cap' => 'update_plugins',
@@ -321,42 +321,42 @@  discard block
 block discarded – undo
321 321
 		 * OR
322 322
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
323 323
 		 */
324
-		if( true === $gf_status || is_network_admin() ) {
324
+		if ( true === $gf_status || is_network_admin() ) {
325 325
 			return true;
326 326
 		}
327 327
 
328 328
 		// If GFCommon doesn't exist, assume GF not active
329 329
 		$return = false;
330 330
 
331
-		switch( $gf_status ) {
331
+		switch ( $gf_status ) {
332 332
 			case 'inactive':
333 333
 
334 334
 				// Required for multisite
335
-				if( ! function_exists('wp_create_nonce') ) {
335
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
336 336
 					require_once ABSPATH . WPINC . '/pluggable.php';
337 337
 				}
338 338
 
339 339
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
340
-				if( is_multisite() ) {
340
+				if ( is_multisite() ) {
341 341
 					wp_cookie_constants();
342 342
 				}
343 343
 
344 344
 				$return = false;
345 345
 
346
-				$button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">';
346
+				$button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">';
347 347
 
348
-				self::$notices['gf_inactive'] = array(
348
+				self::$notices[ 'gf_inactive' ] = array(
349 349
 					'class' => 'error',
350
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ),
350
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ),
351 351
 					'cap' => 'activate_plugins',
352 352
 					'dismiss' => 'gf_inactive',
353 353
 				);
354 354
 
355 355
 				break;
356 356
 			default:
357
-				self::$notices['gf_installed'] = array(
357
+				self::$notices[ 'gf_installed' ] = array(
358 358
 					'class' => 'error',
359
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
359
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
360 360
 					'cap' => 'install_plugins',
361 361
 					'dismiss' => 'gf_installed',
362 362
 				);
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	private static function check_gf_directory() {
375 375
 
376
-		if( class_exists( 'GFDirectory' ) ) {
377
-			self::$notices['gf_directory'] = array(
376
+		if ( class_exists( 'GFDirectory' ) ) {
377
+			self::$notices[ 'gf_directory' ] = array(
378 378
 				'class' => 'error is-dismissible',
379
-				'title' => __('Potential Conflict', 'gravityview' ),
379
+				'title' => __( 'Potential Conflict', 'gravityview' ),
380 380
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
381 381
 				'dismiss' => 'gf_directory',
382 382
 				'cap' => 'activate_plugins',
@@ -394,21 +394,21 @@  discard block
 block discarded – undo
394 394
 	 */
395 395
 	public static function get_plugin_status( $location = '' ) {
396 396
 
397
-		if( ! function_exists('is_plugin_active') ) {
397
+		if ( ! function_exists( 'is_plugin_active' ) ) {
398 398
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
399 399
 		}
400 400
 
401
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
401
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
402 402
 			return true;
403 403
 		}
404 404
 
405
-		if( ! is_network_admin() && is_plugin_active( $location ) ) {
405
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
406 406
 			return true;
407 407
 		}
408 408
 
409
-		if(
410
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
411
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
409
+		if (
410
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
411
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
412 412
 		) {
413 413
 			return false;
414 414
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-link-shortcode.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -221,7 +221,6 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.15
223 223
 	 *
224
-	 * @param string|null $content Content inside shortcode, if defined
225 224
 	 *
226 225
 	 * @return string|boolean If URL is fetched, the URL to the entry link. If not found, returns false.
227 226
 	 */
@@ -316,7 +315,7 @@  discard block
 block discarded – undo
316 315
 	 *
317 316
 	 * @since 1.15
318 317
 	 *
319
-	 * @param string $href URL
318
+	 * @param string|null $url
320 319
 	 */
321 320
 	private function maybe_add_field_values_query_args( $url ) {
322 321
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 		$atts = shortcode_atts( self::$defaults, $atts );
77 77
 
78
-		$atts['action'] = 'edit';
78
+		$atts[ 'action' ] = 'edit';
79 79
 
80 80
 		return $this->shortcode( $atts, $content, $context );
81 81
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$atts = shortcode_atts( self::$defaults, $atts );
93 93
 
94
-		$atts['action'] = 'delete';
94
+		$atts[ 'action' ] = 'delete';
95 95
 
96 96
 		return $this->shortcode( $atts, $content, $context );
97 97
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$this->settings = shortcode_atts( self::$defaults, $atts, $context );
133 133
 
134
-		$this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] );
134
+		$this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] );
135 135
 
136 136
 		if ( empty( $this->view_id ) ) {
137 137
 			gravityview()->log->error( 'A View ID was not defined and we are not inside a View' );
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 			return null;
140 140
 		}
141 141
 
142
-		$this->entry = $this->get_entry( $this->settings['entry_id'] );
142
+		$this->entry = $this->get_entry( $this->settings[ 'entry_id' ] );
143 143
 
144 144
 		if ( empty( $this->entry ) ) {
145
-			gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) );
145
+			gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) );
146 146
 
147 147
 			return null;
148 148
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) );
151 151
 
152 152
 		if ( ! $this->has_cap() ) {
153
-			gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) );
153
+			gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) );
154 154
 
155 155
 			return null;
156 156
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		}
165 165
 
166 166
 		// Get just the URL, not the tag
167
-		if ( 'url' === $this->settings['return'] ) {
167
+		if ( 'url' === $this->settings[ 'return' ] ) {
168 168
 			return $url;
169 169
 		}
170 170
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	private function get_link_atts() {
187 187
 
188
-		wp_parse_str( $this->settings['link_atts'], $link_atts );
188
+		wp_parse_str( $this->settings[ 'link_atts' ], $link_atts );
189 189
 
190
-		if ( 'delete' === $this->settings['action'] ) {
191
-			$link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog();
190
+		if ( 'delete' === $this->settings[ 'action' ] ) {
191
+			$link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog();
192 192
 		}
193 193
 
194
-		return (array) $link_atts;
194
+		return (array)$link_atts;
195 195
 	}
196 196
 
197 197
 	/**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			return do_shortcode( $content );
212 212
 		}
213 213
 
214
-		switch ( $this->settings['action'] ) {
214
+		switch ( $this->settings[ 'action' ] ) {
215 215
 			case 'edit':
216 216
 				$anchor_text = __( 'Edit Entry', 'gravityview' );
217 217
 				break;
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	private function get_url() {
240 240
 
241 241
 		// if post_id is not defined, default to view_id
242
-		$post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id'];
242
+		$post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ];
243 243
 
244
-		switch ( $this->settings['action'] ) {
244
+		switch ( $this->settings[ 'action' ] ) {
245 245
 			case 'edit':
246 246
 				$url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id );
247 247
 				break;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	private function has_cap() {
268 268
 
269
-		switch ( $this->settings['action'] ) {
269
+		switch ( $this->settings[ 'action' ] ) {
270 270
 			case 'edit':
271 271
 				$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id );
272 272
 				break;
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	private function maybe_add_field_values_query_args( $url ) {
333 333
 
334
-		if ( $url && ! empty( $this->settings['field_values'] ) ) {
334
+		if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) {
335 335
 
336
-			wp_parse_str( $this->settings['field_values'], $field_values );
336
+			wp_parse_str( $this->settings[ 'field_values' ], $field_values );
337 337
 
338 338
 			$url = add_query_arg( $field_values, $url );
339 339
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,6 @@
 block discarded – undo
67 67
 	 *
68 68
 	 * @since 1.15
69 69
 	 *
70
-	 * @param array   $allcaps An array of all the user's capabilities.
71 70
 	 * @param array   $caps    Actual capabilities for meta capability.
72 71
 	 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
73 72
 	 * @param WP_User|null $user    The user object, in WordPress 3.7.0 or higher
Please login to merge, or discard this patch.
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+		add_action( 'admin_init', array( $this, 'add_caps') );
60 60
 	}
61 61
 
62 62
 
@@ -360,7 +360,6 @@  discard block
 block discarded – undo
360 360
 	 * Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against.
361 361
 	 *
362 362
 	 * @since 1.15
363
-
364 363
 	 * @param array $caps_to_check
365 364
 	 *
366 365
 	 * @return array
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if ( ! self::$instance ) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+        add_action( 'admin_init', array( $this, 'add_caps' ) );
60 60
 	}
61 61
 
62 62
 
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if ( ! $usercaps || ! $caps ) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
91
+			foreach ( $all_gravityview_caps as $gv_cap ) {
92 92
 				$usercaps[ $gv_cap ] = true;
93 93
 			}
94 94
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		$all = $administrator;
307 307
 
308 308
 		// If role is set, return caps_to_check for just that role.
309
-		if( $single_role ) {
309
+		if ( $single_role ) {
310 310
 			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
311 311
 			return $flat_array ? $caps : array( $single_role => $caps );
312 312
 		}
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 
356 356
 		if ( true === $allow_logged_out ) {
357 357
 
358
-			$all_caps = self::all_caps('editor');
358
+			$all_caps = self::all_caps( 'editor' );
359 359
 
360
-			if( array_intersect( $all_caps, (array) $caps_to_check ) ) {
360
+			if ( array_intersect( $all_caps, (array)$caps_to_check ) ) {
361 361
 				return true;
362 362
 			}
363 363
 		}
@@ -378,13 +378,13 @@  discard block
 block discarded – undo
378 378
 		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
379 379
 
380 380
 		foreach ( $caps_to_check as $cap ) {
381
-			if( ! is_null( $object_id ) ) {
381
+			if ( ! is_null( $object_id ) ) {
382 382
 				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
383 383
 			} else {
384 384
 				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
385 385
 			}
386 386
 			// At the first successful response, stop checking
387
-			if( $has_cap ) {
387
+			if ( $has_cap ) {
388 388
 				break;
389 389
 			}
390 390
 		}
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		$all_gravityview_caps = self::all_caps();
409 409
 
410 410
 		// Are there any $caps_to_check that are from GravityView?
411
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
412
-			$caps_to_check[] = 'gravityview_full_access';
411
+		if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
412
+			$caps_to_check[ ] = 'gravityview_full_access';
413 413
 		}
414 414
 
415 415
 		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
416 416
 
417 417
 		// Are there any $caps_to_check that are from Gravity Forms?
418
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
419
-			$caps_to_check[] = 'gform_full_access';
418
+		if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
419
+			$caps_to_check[ ] = 'gform_full_access';
420 420
 		}
421 421
 
422 422
 		return array_unique( $caps_to_check );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			$capabilities = self::all_caps();
439 439
 
440 440
 			// Loop through each role and remove GV caps_to_check
441
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
441
+			foreach ( $wp_roles->get_names() as $role_slug => $role_name ) {
442 442
 				foreach ( $capabilities as $cap ) {
443 443
 					$wp_roles->remove_cap( $role_slug, $cap );
444 444
 				}
Please login to merge, or discard this patch.
includes/class-gravityview-template.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
 	public $active_areas;
38 38
 
39 39
 
40
+	/**
41
+	 * @param string $id
42
+	 */
40 43
 	function __construct( $id, $settings = array(), $field_options = array(), $areas = array() ) {
41 44
 
42 45
 		if ( empty( $id ) ) {
@@ -144,6 +147,9 @@  discard block
 block discarded – undo
144 147
 		return $areas;
145 148
 	}
146 149
 
150
+	/**
151
+	 * @param string $context
152
+	 */
147 153
 	public function get_active_areas( $context ) {
148 154
 		if ( isset( $this->active_areas[ $context ] ) ) {
149 155
 			return $this->active_areas[ $context ];
@@ -156,8 +162,8 @@  discard block
 block discarded – undo
156 162
 	/**
157 163
 	 * Assign template specific field options
158 164
 	 *
159
-	 * @param array $options (default: array())
160
-	 * @param string $template (default: '')
165
+	 * @param array $field_options (default: array())
166
+	 * @param string $template_id (default: '')
161 167
 	 * @param string $field_id key for the field
162 168
 	 * @param  string|array $context Context for the field; `directory` or `single` for example.
163 169
 	 *
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 * @return string                Path to XML file
194 194
 	 */
195 195
 	public function assign_form_xml( $xml = '', $template = '' ) {
196
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_form'] ) && $this->template_id === $template ) {
197
-			return $this->settings['preset_form'];
196
+		if ( $this->settings[ 'type' ] === 'preset' && ! empty( $this->settings[ 'preset_form' ] ) && $this->template_id === $template ) {
197
+			return $this->settings[ 'preset_form' ];
198 198
 		}
199 199
 
200 200
 		return $xml;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @return string                Path to XML file
208 208
 	 */
209 209
 	public function assign_fields_xml( $xml = '', $template = '' ) {
210
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_fields'] ) && $this->template_id === $template ) {
211
-			return $this->settings['preset_fields'];
210
+		if ( $this->settings[ 'type' ] === 'preset' && ! empty( $this->settings[ 'preset_fields' ] ) && $this->template_id === $template ) {
211
+			return $this->settings[ 'preset_fields' ];
212 212
 		}
213 213
 
214 214
 		return $xml;
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function assign_view_slug( $default, $context ) {
228 228
 
229
-		if ( ! empty( $this->settings['slug'] ) ) {
230
-			return $this->settings['slug'];
229
+		if ( ! empty( $this->settings[ 'slug' ] ) ) {
230
+			return $this->settings[ 'slug' ];
231 231
 		}
232 232
 		if ( ! empty( $default ) ) {
233 233
 			return $default;
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 * @return void
245 245
 	 */
246 246
 	public function register_styles() {
247
-		if ( ! empty( $this->settings['css_source'] ) ) {
248
-			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings['css_source'], array(), GravityView_Plugin::version, 'all' );
247
+		if ( ! empty( $this->settings[ 'css_source' ] ) ) {
248
+			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings[ 'css_source' ], array(), GravityView_Plugin::version, 'all' );
249 249
 		}
250 250
 	}
251 251
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-admin.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,6 @@
 block discarded – undo
69 69
      * Change wording for the Edit context to read Entry Creator
70 70
      *
71 71
      * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
72
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
73 72
      * @param  string      $template_id Table slug
74 73
      * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
75 74
      * @param  string      $context     What context are we in? Example: `single` or `directory`
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -10,42 +10,42 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if ( ! defined( 'WPINC' ) ) {
13
-    die;
13
+	die;
14 14
 }
15 15
 
16 16
 
17 17
 class GravityView_Edit_Entry_Admin {
18 18
 
19
-    protected $loader;
19
+	protected $loader;
20 20
 
21
-    function __construct( GravityView_Edit_Entry $loader ) {
22
-        $this->loader = $loader;
23
-    }
21
+	function __construct( GravityView_Edit_Entry $loader ) {
22
+		$this->loader = $loader;
23
+	}
24 24
 
25
-    function load() {
25
+	function load() {
26 26
 
27
-        if( !is_admin() ) {
28
-            return;
29
-        }
27
+		if( !is_admin() ) {
28
+			return;
29
+		}
30 30
 
31
-        // Add Edit Link as a default field, outside those set in the Gravity Form form
32
-        add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
31
+		// Add Edit Link as a default field, outside those set in the Gravity Form form
32
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
33 33
 
34
-        // For the Edit Entry Link, you don't want visible to all users.
35
-        add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
34
+		// For the Edit Entry Link, you don't want visible to all users.
35
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
36 36
 
37
-        // Modify the field options based on the name of the field type
38
-        add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
37
+		// Modify the field options based on the name of the field type
38
+		add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40
-        // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
40
+		// add tooltips
41
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
42 42
 
43
-        // custom fields' options for zone EDIT
44
-        add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
43
+		// custom fields' options for zone EDIT
44
+		add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
45 45
 
46
-        // Add Edit Entry settings to View Settings
47
-        add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
-    }
46
+		// Add Edit Entry settings to View Settings
47
+		add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
+	}
49 49
 
50 50
 	/**
51 51
 	 * Render Edit Entry View metabox settings
@@ -69,109 +69,109 @@  discard block
 block discarded – undo
69 69
 		GravityView_Render_Settings::render_setting_row( 'edit_redirect_url', $current_settings );
70 70
 	}
71 71
 
72
-    /**
73
-     * Add Edit Link as a default field, outside those set in the Gravity Form form
74
-     * @param array $entry_default_fields Existing fields
75
-     * @param  string|array $form form_ID or form object
76
-     * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
77
-     */
78
-    function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
79
-
80
-        if( $zone !== 'edit' ) {
81
-
82
-            $entry_default_fields['edit_link'] = array(
83
-                'label' => __('Link to Edit Entry', 'gravityview'),
84
-                'type' => 'edit_link',
85
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
86
-                'icon' => 'dashicons-welcome-write-blog',
87
-            );
88
-
89
-        }
90
-
91
-        return $entry_default_fields;
92
-    }
93
-
94
-    /**
95
-     * Change wording for the Edit context to read Entry Creator
96
-     *
97
-     * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
98
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
99
-     * @param  string      $template_id Table slug
100
-     * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
101
-     * @param  string      $context     What context are we in? Example: `single` or `directory`
102
-     * @param  string      $input_type  (textarea, list, select, etc.)
103
-     * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
104
-     */
105
-    function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
106
-
107
-        $caps = $visibility_caps;
108
-
109
-        // If we're configuring fields in the edit context, we want a limited selection
110
-        if( $context === 'edit' ) {
111
-
112
-            // Remove other built-in caps.
113
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
114
-
115
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
116
-        }
117
-
118
-        return $caps;
119
-    }
120
-
121
-    /**
122
-     * Add "Edit Link Text" setting to the edit_link field settings
123
-     *
124
-     * @param array  $field_options
125
-     * @param string $template_id
126
-     * @param string $field_id
127
-     * @param string $context
128
-     * @param string $input_type
129
-     *
130
-     * @return array $field_options, with "Edit Link Text" field option
131
-     */
132
-    function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
133
-
134
-        // Always a link, never a filter
135
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
136
-
137
-        // Edit Entry link should only appear to visitors capable of editing entries
138
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
139
-
140
-        $add_option['edit_link'] = array(
141
-            'type' => 'text',
142
-            'label' => __( 'Edit Link Text', 'gravityview' ),
143
-            'desc' => NULL,
144
-            'value' => __('Edit Entry', 'gravityview'),
145
-            'merge_tags' => true,
146
-        );
147
-
148
-	    $add_option['new_window'] = array(
149
-		    'type' => 'checkbox',
150
-		    'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
151
-		    'value' => false,
152
-		    'group' => 'display',
153
-		    'priority' => 1300,
154
-	    );
155
-
156
-        return array_merge( $add_option, $field_options );
157
-    }
158
-
159
-    /**
160
-     * Add tooltips
161
-     * @param  array $tooltips Existing tooltips
162
-     * @return array           Modified tooltips
163
-     */
164
-    function tooltips( $tooltips ) {
165
-
166
-        $return = $tooltips;
167
-
168
-        $return['allow_edit_cap'] = array(
169
-            'title' => __('Limiting Edit Access', 'gravityview'),
170
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
171
-        );
172
-
173
-        return $return;
174
-    }
72
+	/**
73
+	 * Add Edit Link as a default field, outside those set in the Gravity Form form
74
+	 * @param array $entry_default_fields Existing fields
75
+	 * @param  string|array $form form_ID or form object
76
+	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
77
+	 */
78
+	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
79
+
80
+		if( $zone !== 'edit' ) {
81
+
82
+			$entry_default_fields['edit_link'] = array(
83
+				'label' => __('Link to Edit Entry', 'gravityview'),
84
+				'type' => 'edit_link',
85
+				'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
86
+				'icon' => 'dashicons-welcome-write-blog',
87
+			);
88
+
89
+		}
90
+
91
+		return $entry_default_fields;
92
+	}
93
+
94
+	/**
95
+	 * Change wording for the Edit context to read Entry Creator
96
+	 *
97
+	 * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
98
+	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
99
+	 * @param  string      $template_id Table slug
100
+	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
101
+	 * @param  string      $context     What context are we in? Example: `single` or `directory`
102
+	 * @param  string      $input_type  (textarea, list, select, etc.)
103
+	 * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
104
+	 */
105
+	function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
106
+
107
+		$caps = $visibility_caps;
108
+
109
+		// If we're configuring fields in the edit context, we want a limited selection
110
+		if( $context === 'edit' ) {
111
+
112
+			// Remove other built-in caps.
113
+			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
114
+
115
+			$caps['read'] = _x('Entry Creator','User capability', 'gravityview');
116
+		}
117
+
118
+		return $caps;
119
+	}
120
+
121
+	/**
122
+	 * Add "Edit Link Text" setting to the edit_link field settings
123
+	 *
124
+	 * @param array  $field_options
125
+	 * @param string $template_id
126
+	 * @param string $field_id
127
+	 * @param string $context
128
+	 * @param string $input_type
129
+	 *
130
+	 * @return array $field_options, with "Edit Link Text" field option
131
+	 */
132
+	function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
133
+
134
+		// Always a link, never a filter
135
+		unset( $field_options['show_as_link'], $field_options['search_filter'] );
136
+
137
+		// Edit Entry link should only appear to visitors capable of editing entries
138
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
139
+
140
+		$add_option['edit_link'] = array(
141
+			'type' => 'text',
142
+			'label' => __( 'Edit Link Text', 'gravityview' ),
143
+			'desc' => NULL,
144
+			'value' => __('Edit Entry', 'gravityview'),
145
+			'merge_tags' => true,
146
+		);
147
+
148
+		$add_option['new_window'] = array(
149
+			'type' => 'checkbox',
150
+			'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
151
+			'value' => false,
152
+			'group' => 'display',
153
+			'priority' => 1300,
154
+		);
155
+
156
+		return array_merge( $add_option, $field_options );
157
+	}
158
+
159
+	/**
160
+	 * Add tooltips
161
+	 * @param  array $tooltips Existing tooltips
162
+	 * @return array           Modified tooltips
163
+	 */
164
+	function tooltips( $tooltips ) {
165
+
166
+		$return = $tooltips;
167
+
168
+		$return['allow_edit_cap'] = array(
169
+			'title' => __('Limiting Edit Access', 'gravityview'),
170
+			'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
171
+		);
172
+
173
+		return $return;
174
+	}
175 175
 
176 176
 	/**
177 177
 	 * Add "Edit Link Text" setting to the edit_link field settings
@@ -187,28 +187,28 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
189 189
 
190
-        // We only want to modify the settings for the edit context
191
-        if( 'edit' !== $context ) {
192
-            return $field_options;
193
-        }
194
-
195
-        //  Entry field is only for logged in users
196
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
197
-
198
-        $add_options = array(
199
-            'allow_edit_cap' => array(
200
-                'type' => 'select',
201
-                'label' => __( 'Make field editable to:', 'gravityview' ),
202
-                'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
203
-                'tooltip' => 'allow_edit_cap',
204
-                'class' => 'widefat',
205
-                'value' => 'read', // Default: entry creator
206
-                'group' => 'visibility',
207
-            ),
208
-        );
209
-
210
-        return array_merge( $field_options, $add_options );
211
-    }
190
+		// We only want to modify the settings for the edit context
191
+		if( 'edit' !== $context ) {
192
+			return $field_options;
193
+		}
194
+
195
+		//  Entry field is only for logged in users
196
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
197
+
198
+		$add_options = array(
199
+			'allow_edit_cap' => array(
200
+				'type' => 'select',
201
+				'label' => __( 'Make field editable to:', 'gravityview' ),
202
+				'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
203
+				'tooltip' => 'allow_edit_cap',
204
+				'class' => 'widefat',
205
+				'value' => 'read', // Default: entry creator
206
+				'group' => 'visibility',
207
+			),
208
+		);
209
+
210
+		return array_merge( $field_options, $add_options );
211
+	}
212 212
 
213 213
 
214 214
 } // end class
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     function load() {
26 26
 
27
-        if( !is_admin() ) {
27
+        if ( ! is_admin() ) {
28 28
             return;
29 29
         }
30 30
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40 40
         // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
41
+        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) );
42 42
 
43 43
         // custom fields' options for zone EDIT
44 44
         add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
      */
78 78
     function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
79 79
 
80
-        if( $zone !== 'edit' ) {
80
+        if ( $zone !== 'edit' ) {
81 81
 
82
-            $entry_default_fields['edit_link'] = array(
83
-                'label' => __('Link to Edit Entry', 'gravityview'),
82
+            $entry_default_fields[ 'edit_link' ] = array(
83
+                'label' => __( 'Link to Edit Entry', 'gravityview' ),
84 84
                 'type' => 'edit_link',
85
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
85
+                'desc'	=> __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ),
86 86
                 'icon' => 'dashicons-welcome-write-blog',
87 87
             );
88 88
 
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
         $caps = $visibility_caps;
108 108
 
109 109
         // If we're configuring fields in the edit context, we want a limited selection
110
-        if( $context === 'edit' ) {
110
+        if ( $context === 'edit' ) {
111 111
 
112 112
             // Remove other built-in caps.
113
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
113
+            unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
114 114
 
115
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
115
+            $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
116 116
         }
117 117
 
118 118
         return $caps;
@@ -132,20 +132,20 @@  discard block
 block discarded – undo
132 132
     function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
133 133
 
134 134
         // Always a link, never a filter
135
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
135
+        unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
136 136
 
137 137
         // Edit Entry link should only appear to visitors capable of editing entries
138
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
138
+        unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
139 139
 
140
-        $add_option['edit_link'] = array(
140
+        $add_option[ 'edit_link' ] = array(
141 141
             'type' => 'text',
142 142
             'label' => __( 'Edit Link Text', 'gravityview' ),
143 143
             'desc' => NULL,
144
-            'value' => __('Edit Entry', 'gravityview'),
144
+            'value' => __( 'Edit Entry', 'gravityview' ),
145 145
             'merge_tags' => true,
146 146
         );
147 147
 
148
-	    $add_option['new_window'] = array(
148
+	    $add_option[ 'new_window' ] = array(
149 149
 		    'type' => 'checkbox',
150 150
 		    'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
151 151
 		    'value' => false,
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 
166 166
         $return = $tooltips;
167 167
 
168
-        $return['allow_edit_cap'] = array(
169
-            'title' => __('Limiting Edit Access', 'gravityview'),
170
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
168
+        $return[ 'allow_edit_cap' ] = array(
169
+            'title' => __( 'Limiting Edit Access', 'gravityview' ),
170
+            'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ),
171 171
         );
172 172
 
173 173
         return $return;
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
189 189
 
190 190
         // We only want to modify the settings for the edit context
191
-        if( 'edit' !== $context ) {
191
+        if ( 'edit' !== $context ) {
192 192
             return $field_options;
193 193
         }
194 194
 
195 195
         //  Entry field is only for logged in users
196
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
196
+        unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
197 197
 
198 198
         $add_options = array(
199 199
             'allow_edit_cap' => array(
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-user-registration.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      * @since 1.11
58 58
      *
59 59
      * @param array $form Gravity Forms form array
60
-     * @param string $entry_id Gravity Forms entry ID
60
+     * @param integer $entry_id Gravity Forms entry ID
61 61
      * @return void
62 62
      */
63 63
     public function update_user( $form = array(), $entry_id = 0 ) {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	     * @since 1.11
53 53
 	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54 54
 	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
55
+	    if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56 56
 
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
57
+	    	add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 );
58 58
 
59 59
 		    // last resort in case the current user display name don't match any of the defaults
60 60
 		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function update_user( $form = array(), $entry_id = 0 ) {
74 74
 
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
75
+        if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76 76
 	        gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
77 77
 	        return;
78
-        } elseif( empty( $entry_id ) ) {
78
+        } elseif ( empty( $entry_id ) ) {
79 79
         	gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80 80
 	        return;
81 81
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	    // If an Update feed, make sure the conditions are met.
104 104
 	    if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
105
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
105
+	    	if ( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
106 106
 			    return;
107 107
 		    }
108 108
 	    }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         remove_filter( 'send_email_change_email', '__return_false', 3 );
119 119
 
120 120
         // Prevent double-triggering by removing the hook
121
-	    remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
121
+	    remove_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10 );
122 122
     }
123 123
 
124 124
 	/**
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	     */
152 152
 	    $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
153 153
 
154
-	    if( $preserve_role ) {
155
-		    $config['meta']['role'] = 'gfur_preserve_role';
154
+	    if ( $preserve_role ) {
155
+		    $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role';
156 156
 	    }
157 157
 
158
-	    $displayname = $this->match_current_display_name( $entry['created_by'] );
158
+	    $displayname = $this->match_current_display_name( $entry[ 'created_by' ] );
159 159
 
160 160
 	    /**
161 161
 	     * Make sure the current display name is not changed with the update user method.
162 162
 	     * @since 1.15
163 163
 	     */
164
-	    $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
164
+	    $config[ 'meta' ][ 'displayname' ] = $displayname ? $displayname : $config[ 'meta' ][ 'displayname' ];
165 165
 
166 166
 	    /**
167 167
 	     * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
         $user = get_userdata( $user_id );
190 190
 
191
-        if( ! $user ) {
191
+        if ( ! $user ) {
192 192
         	return false;
193 193
         }
194 194
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
          * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
201 201
          * @see restore_display_name
202 202
          */
203
-        if( false === $format ) {
203
+        if ( false === $format ) {
204 204
             $this->_user_before_update = $user;
205 205
         }
206 206
 
@@ -218,20 +218,20 @@  discard block
 block discarded – undo
218 218
     public function generate_display_names( $profileuser ) {
219 219
 
220 220
         $public_display = array();
221
-        $public_display['nickname']  = $profileuser->nickname;
222
-        $public_display['username']  = $profileuser->user_login;
221
+        $public_display[ 'nickname' ]  = $profileuser->nickname;
222
+        $public_display[ 'username' ]  = $profileuser->user_login;
223 223
 
224
-        if ( !empty($profileuser->first_name) ) {
225
-	        $public_display['firstname'] = $profileuser->first_name;
224
+        if ( ! empty( $profileuser->first_name ) ) {
225
+	        $public_display[ 'firstname' ] = $profileuser->first_name;
226 226
         }
227 227
 
228
-        if ( !empty($profileuser->last_name) ) {
229
-	        $public_display['lastname'] = $profileuser->last_name;
228
+        if ( ! empty( $profileuser->last_name ) ) {
229
+	        $public_display[ 'lastname' ] = $profileuser->last_name;
230 230
         }
231 231
 
232
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
233
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
232
+        if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {
233
+            $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
+            $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name;
235 235
         }
236 236
 
237 237
         $public_display = array_map( 'trim', $public_display );
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
          *   - or we don't need as we found the correct format before updating user.
271 271
          * @since 1.14.4
272 272
          */
273
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
273
+        if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
274 274
             return null;
275 275
         }
276 276
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
         $updated = wp_update_user( $restored_user );
304 304
 
305
-        if( is_wp_error( $updated ) ) {
305
+        if ( is_wp_error( $updated ) ) {
306 306
             gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
307 307
         } else {
308 308
             gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
Please login to merge, or discard this patch.
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'WPINC' ) ) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 /**
@@ -22,109 +22,109 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @var GravityView_Edit_Entry $loader
24 24
 	 */
25
-    protected $loader;
25
+	protected $loader;
26 26
 
27
-    /**
28
-     * @var WP_User|null Temporary storage used by restore_user_details()
29
-     */
30
-    private $_user_before_update = null;
27
+	/**
28
+	 * @var WP_User|null Temporary storage used by restore_user_details()
29
+	 */
30
+	private $_user_before_update = null;
31 31
 
32
-    function __construct( GravityView_Edit_Entry $loader ) {
33
-        $this->loader = $loader;
34
-    }
32
+	function __construct( GravityView_Edit_Entry $loader ) {
33
+		$this->loader = $loader;
34
+	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.11
38 38
 	 */
39 39
 	public function load() {
40 40
 		add_action( 'wp', array( $this, 'add_hooks' ), 10 );
41
-    }
41
+	}
42 42
 
43 43
 	/**
44 44
 	 * Add hooks to trigger updating the user
45 45
 	 *
46 46
 	 * @since 1.18
47 47
 	 */
48
-    public function add_hooks() {
49
-
50
-	    /**
51
-	     * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
-	     * @since 1.11
53
-	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
-	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
-
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
-
59
-		    // last resort in case the current user display name don't match any of the defaults
60
-		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
-	    }
62
-    }
63
-
64
-    /**
65
-     * Update the WordPress user profile based on the GF User Registration create feed
66
-     *
67
-     * @since 1.11
68
-     *
69
-     * @param array $form Gravity Forms form array
70
-     * @param string $entry_id Gravity Forms entry ID
71
-     * @return void
72
-     */
73
-    public function update_user( $form = array(), $entry_id = 0 ) {
74
-
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
-	        gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
77
-	        return;
78
-        } elseif( empty( $entry_id ) ) {
79
-        	gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80
-	        return;
81
-        }
82
-
83
-        $gf_user_registration = GF_User_Registration::get_instance();
84
-
85
-        $entry = GFAPI::get_entry( $entry_id );
86
-
87
-	    /**
88
-	     * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
89
-	     * @since 1.11
90
-	     * @param array $entry Gravity Forms entry
91
-	     * @param array $form Gravity Forms form
92
-	     */
93
-        $entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
94
-
95
-	    $config = $this->get_feed_configuration( $entry, $form );
96
-
97
-        // Make sure the feed is active
98
-	    if ( ! \GV\Utils::get( $config, 'is_active', false ) ) {
48
+	public function add_hooks() {
49
+
50
+		/**
51
+		 * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
+		 * @since 1.11
53
+		 * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
+		 */
55
+		if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
+
57
+			add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
+
59
+			// last resort in case the current user display name don't match any of the defaults
60
+			add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
+		}
62
+	}
63
+
64
+	/**
65
+	 * Update the WordPress user profile based on the GF User Registration create feed
66
+	 *
67
+	 * @since 1.11
68
+	 *
69
+	 * @param array $form Gravity Forms form array
70
+	 * @param string $entry_id Gravity Forms entry ID
71
+	 * @return void
72
+	 */
73
+	public function update_user( $form = array(), $entry_id = 0 ) {
74
+
75
+		if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
+			gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
99 77
 			return;
100
-	    }
78
+		} elseif( empty( $entry_id ) ) {
79
+			gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80
+			return;
81
+		}
82
+
83
+		$gf_user_registration = GF_User_Registration::get_instance();
84
+
85
+		$entry = GFAPI::get_entry( $entry_id );
101 86
 
102
-	    // If an Update feed, make sure the conditions are met.
103
-	    if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
104
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
105
-			    return;
106
-		    }
107
-	    }
87
+		/**
88
+		 * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
89
+		 * @since 1.11
90
+		 * @param array $entry Gravity Forms entry
91
+		 * @param array $form Gravity Forms form
92
+		 */
93
+		$entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
108 94
 
109
-	    // Do not update user if the user hasn't been registered (happens when manual activation is enabled in User Registration feed)
110
-	    $username = \GV\Utils::get( $config, 'meta/username', null );
111
-	    if ( ! isset( $entry[ $username ] ) || ! get_user_by( 'login', $entry[ $username ] ) ) {
112
-		    return;
113
-	    }
95
+		$config = $this->get_feed_configuration( $entry, $form );
96
+
97
+		// Make sure the feed is active
98
+		if ( ! \GV\Utils::get( $config, 'is_active', false ) ) {
99
+			return;
100
+		}
101
+
102
+		// If an Update feed, make sure the conditions are met.
103
+		if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
104
+			if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
105
+				return;
106
+			}
107
+		}
108
+
109
+		// Do not update user if the user hasn't been registered (happens when manual activation is enabled in User Registration feed)
110
+		$username = \GV\Utils::get( $config, 'meta/username', null );
111
+		if ( ! isset( $entry[ $username ] ) || ! get_user_by( 'login', $entry[ $username ] ) ) {
112
+			return;
113
+		}
114 114
 
115
-        // The priority is set to 3 so that default priority (10) will still override it
116
-        add_filter( 'send_password_change_email', '__return_false', 3 );
117
-        add_filter( 'send_email_change_email', '__return_false', 3 );
115
+		// The priority is set to 3 so that default priority (10) will still override it
116
+		add_filter( 'send_password_change_email', '__return_false', 3 );
117
+		add_filter( 'send_email_change_email', '__return_false', 3 );
118 118
 
119
-        // Trigger the User Registration update user method
120
-        $gf_user_registration->update_user( $entry, $form, $config );
119
+		// Trigger the User Registration update user method
120
+		$gf_user_registration->update_user( $entry, $form, $config );
121 121
 
122
-        remove_filter( 'send_password_change_email', '__return_false', 3 );
123
-        remove_filter( 'send_email_change_email', '__return_false', 3 );
122
+		remove_filter( 'send_password_change_email', '__return_false', 3 );
123
+		remove_filter( 'send_email_change_email', '__return_false', 3 );
124 124
 
125
-        // Prevent double-triggering by removing the hook
126
-	    remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
127
-    }
125
+		// Prevent double-triggering by removing the hook
126
+		remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
127
+	}
128 128
 
129 129
 	/**
130 130
 	 * Get the User Registration feed configuration for the entry & form
@@ -139,184 +139,184 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @return array
141 141
 	 */
142
-    public function get_feed_configuration( $entry, $form ) {
143
-
144
-	    $gf_user_registration = GF_User_Registration::get_instance();
145
-
146
-	    $config = $gf_user_registration->get_single_submission_feed( $entry, $form );
147
-
148
-	    /**
149
-	     * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
150
-	     * @since 1.15
151
-	     * @param[in,out] boolean $preserve_role Preserve current user role Default: true
152
-	     * @param[in] array $config Gravity Forms User Registration feed configuration for the form
153
-	     * @param[in] array $form Gravity Forms form array
154
-	     * @param[in] array $entry Gravity Forms entry being edited
155
-	     */
156
-	    $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
157
-
158
-	    if( $preserve_role ) {
159
-		    $config['meta']['role'] = 'gfur_preserve_role';
160
-	    }
161
-
162
-	    $displayname = $this->match_current_display_name( $entry['created_by'] );
163
-
164
-	    /**
165
-	     * Make sure the current display name is not changed with the update user method.
166
-	     * @since 1.15
167
-	     */
168
-	    $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
169
-
170
-	    /**
171
-	     * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
172
-	     * @since 1.14
173
-	     * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
174
-	     * @param[in] array $form Gravity Forms form array
175
-	     * @param[in] array $entry Gravity Forms entry being edited
176
-	     */
177
-	    $config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
178
-
179
-	    return $config;
180
-    }
181
-
182
-    /**
183
-     * Calculate the user display name format
184
-     *
185
-     * @since 1.15
186
-     * @since 1.20 Returns false if user not found at $user_id
187
-     *
188
-     * @param int $user_id WP User ID
189
-     * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
190
-     */
191
-    public function match_current_display_name( $user_id ) {
192
-
193
-        $user = get_userdata( $user_id );
194
-
195
-        if( ! $user ) {
196
-        	return false;
197
-        }
198
-
199
-        $names = $this->generate_display_names( $user );
200
-
201
-        $format = array_search( $user->display_name, $names, true );
202
-
203
-        /**
204
-         * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
205
-         * @see restore_display_name
206
-         */
207
-        if( false === $format ) {
208
-            $this->_user_before_update = $user;
209
-        }
210
-
211
-        return $format;
212
-    }
213
-
214
-    /**
215
-     * Generate an array of all the user display names possibilities
216
-     *
217
-     * @since 1.15
218
-     *
219
-     * @param object $profileuser WP_User object
220
-     * @return array List all the possible display names for a certain User object
221
-     */
222
-    public function generate_display_names( $profileuser ) {
223
-
224
-        $public_display = array();
225
-        $public_display['nickname']  = $profileuser->nickname;
226
-        $public_display['username']  = $profileuser->user_login;
227
-
228
-        if ( !empty($profileuser->first_name) ) {
229
-	        $public_display['firstname'] = $profileuser->first_name;
230
-        }
231
-
232
-        if ( !empty($profileuser->last_name) ) {
233
-	        $public_display['lastname'] = $profileuser->last_name;
234
-        }
235
-
236
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
237
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
238
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
239
-        }
240
-
241
-        $public_display = array_map( 'trim', $public_display );
242
-        $public_display = array_unique( $public_display );
243
-
244
-        return $public_display;
245
-    }
246
-
247
-
248
-    /**
249
-     * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
250
-     *
251
-     * @see GFUser::update_user()
252
-     * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
253
-     * @param array $config Gravity Forms User Registration Addon form feed configuration
254
-     * @param array $entry The Gravity Forms entry that was just updated
255
-     * @param string $password User password
256
-     * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
257
-     */
258
-    public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
259
-
260
-        /**
261
-         * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
262
-         * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
263
-         * @since 1.14.4
264
-         * @param boolean $restore_display_name Restore Display Name? Default: true
265
-         */
266
-        $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
267
-
268
-        $is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' );
269
-
270
-        /**
271
-         * Don't restore display name:
272
-         *   - either disabled,
273
-         *   - or it is an Update feed (we only care about Create feed)
274
-         *   - or we don't need as we found the correct format before updating user.
275
-         * @since 1.14.4
276
-         */
277
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
278
-            return null;
279
-        }
280
-
281
-        $user_after_update = get_userdata( $user_id );
282
-
283
-        // User not found
284
-	    if ( ! $user_after_update ) {
285
-	    	gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) );
286
-		    return false;
287
-	    }
288
-
289
-        $restored_user = $user_after_update;
290
-
291
-	    // Restore previous display_name
292
-        $restored_user->display_name = $this->_user_before_update->display_name;
293
-
294
-	    // Don't have WP update the password.
295
-	    unset( $restored_user->data->user_pass, $restored_user->user_pass );
296
-
297
-        /**
298
-         * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
299
-         * @since 1.14
300
-         * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
301
-         * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
302
-         * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
303
-         * @param array   $entry The Gravity Forms entry that was just updated
304
-         */
305
-        $restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
306
-
307
-        $updated = wp_update_user( $restored_user );
308
-
309
-        if( is_wp_error( $updated ) ) {
310
-            gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
311
-        } else {
312
-            gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
313
-        }
314
-
315
-        $this->_user_before_update = null;
316
-
317
-        unset( $restored_user, $user_after_update );
318
-
319
-        return $updated;
320
-    }
142
+	public function get_feed_configuration( $entry, $form ) {
143
+
144
+		$gf_user_registration = GF_User_Registration::get_instance();
145
+
146
+		$config = $gf_user_registration->get_single_submission_feed( $entry, $form );
147
+
148
+		/**
149
+		 * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
150
+		 * @since 1.15
151
+		 * @param[in,out] boolean $preserve_role Preserve current user role Default: true
152
+		 * @param[in] array $config Gravity Forms User Registration feed configuration for the form
153
+		 * @param[in] array $form Gravity Forms form array
154
+		 * @param[in] array $entry Gravity Forms entry being edited
155
+		 */
156
+		$preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
157
+
158
+		if( $preserve_role ) {
159
+			$config['meta']['role'] = 'gfur_preserve_role';
160
+		}
161
+
162
+		$displayname = $this->match_current_display_name( $entry['created_by'] );
163
+
164
+		/**
165
+		 * Make sure the current display name is not changed with the update user method.
166
+		 * @since 1.15
167
+		 */
168
+		$config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
169
+
170
+		/**
171
+		 * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
172
+		 * @since 1.14
173
+		 * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
174
+		 * @param[in] array $form Gravity Forms form array
175
+		 * @param[in] array $entry Gravity Forms entry being edited
176
+		 */
177
+		$config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
178
+
179
+		return $config;
180
+	}
181
+
182
+	/**
183
+	 * Calculate the user display name format
184
+	 *
185
+	 * @since 1.15
186
+	 * @since 1.20 Returns false if user not found at $user_id
187
+	 *
188
+	 * @param int $user_id WP User ID
189
+	 * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
190
+	 */
191
+	public function match_current_display_name( $user_id ) {
192
+
193
+		$user = get_userdata( $user_id );
194
+
195
+		if( ! $user ) {
196
+			return false;
197
+		}
198
+
199
+		$names = $this->generate_display_names( $user );
200
+
201
+		$format = array_search( $user->display_name, $names, true );
202
+
203
+		/**
204
+		 * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
205
+		 * @see restore_display_name
206
+		 */
207
+		if( false === $format ) {
208
+			$this->_user_before_update = $user;
209
+		}
210
+
211
+		return $format;
212
+	}
213
+
214
+	/**
215
+	 * Generate an array of all the user display names possibilities
216
+	 *
217
+	 * @since 1.15
218
+	 *
219
+	 * @param object $profileuser WP_User object
220
+	 * @return array List all the possible display names for a certain User object
221
+	 */
222
+	public function generate_display_names( $profileuser ) {
223
+
224
+		$public_display = array();
225
+		$public_display['nickname']  = $profileuser->nickname;
226
+		$public_display['username']  = $profileuser->user_login;
227
+
228
+		if ( !empty($profileuser->first_name) ) {
229
+			$public_display['firstname'] = $profileuser->first_name;
230
+		}
231
+
232
+		if ( !empty($profileuser->last_name) ) {
233
+			$public_display['lastname'] = $profileuser->last_name;
234
+		}
235
+
236
+		if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
237
+			$public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
238
+			$public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
239
+		}
240
+
241
+		$public_display = array_map( 'trim', $public_display );
242
+		$public_display = array_unique( $public_display );
243
+
244
+		return $public_display;
245
+	}
246
+
247
+
248
+	/**
249
+	 * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
250
+	 *
251
+	 * @see GFUser::update_user()
252
+	 * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
253
+	 * @param array $config Gravity Forms User Registration Addon form feed configuration
254
+	 * @param array $entry The Gravity Forms entry that was just updated
255
+	 * @param string $password User password
256
+	 * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
257
+	 */
258
+	public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
259
+
260
+		/**
261
+		 * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
262
+		 * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
263
+		 * @since 1.14.4
264
+		 * @param boolean $restore_display_name Restore Display Name? Default: true
265
+		 */
266
+		$restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
267
+
268
+		$is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' );
269
+
270
+		/**
271
+		 * Don't restore display name:
272
+		 *   - either disabled,
273
+		 *   - or it is an Update feed (we only care about Create feed)
274
+		 *   - or we don't need as we found the correct format before updating user.
275
+		 * @since 1.14.4
276
+		 */
277
+		if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
278
+			return null;
279
+		}
280
+
281
+		$user_after_update = get_userdata( $user_id );
282
+
283
+		// User not found
284
+		if ( ! $user_after_update ) {
285
+			gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) );
286
+			return false;
287
+		}
288
+
289
+		$restored_user = $user_after_update;
290
+
291
+		// Restore previous display_name
292
+		$restored_user->display_name = $this->_user_before_update->display_name;
293
+
294
+		// Don't have WP update the password.
295
+		unset( $restored_user->data->user_pass, $restored_user->user_pass );
296
+
297
+		/**
298
+		 * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
299
+		 * @since 1.14
300
+		 * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
301
+		 * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
302
+		 * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
303
+		 * @param array   $entry The Gravity Forms entry that was just updated
304
+		 */
305
+		$restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
306
+
307
+		$updated = wp_update_user( $restored_user );
308
+
309
+		if( is_wp_error( $updated ) ) {
310
+			gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
311
+		} else {
312
+			gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
313
+		}
314
+
315
+		$this->_user_before_update = null;
316
+
317
+		unset( $restored_user, $user_after_update );
318
+
319
+		return $updated;
320
+	}
321 321
 
322 322
 } //end class
Please login to merge, or discard this patch.
includes/admin/field-types/type_hidden.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 			return;
16 16
 		}
17 17
 
18
-        $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
18
+		$class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
19 19
 
20 20
 		?>
21 21
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" />
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 
11 11
 	function render_input( $override_input = null ) {
12 12
 
13
-		if( isset( $override_input ) ) {
13
+		if ( isset( $override_input ) ) {
14 14
 			echo $override_input;
15 15
 			return;
16 16
 		}
17 17
 
18
-        $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
18
+        $class = ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat';
19 19
 
20 20
 		?>
21 21
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" />
Please login to merge, or discard this patch.
includes/class-admin-welcome.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) exit;
15
+if ( ! defined( 'ABSPATH' ) ) {
16
+	exit;
17
+}
16 18
 
17 19
 /**
18 20
  * GravityView_Welcome Class
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	 * @since 1.0
34 34
 	 */
35 35
 	public function __construct() {
36
-		add_action( 'admin_menu', array( $this, 'admin_menus'), 200 );
36
+		add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 );
37 37
 		add_action( 'admin_head', array( $this, 'admin_head' ) );
38
-		add_action( 'admin_init', array( $this, 'welcome'    ) );
39
-		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 );
38
+		add_action( 'admin_init', array( $this, 'welcome' ) );
39
+		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 );
40 40
 	}
41 41
 
42 42
 	/**
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 		// Add help page to GravityView menu
52 52
 		add_submenu_page(
53 53
 			'edit.php?post_type=gravityview',
54
-			__('GravityView: Getting Started', 'gravityview'),
55
-			__('Getting Started', 'gravityview'),
54
+			__( 'GravityView: Getting Started', 'gravityview' ),
55
+			__( 'Getting Started', 'gravityview' ),
56 56
 			$this->minimum_capability,
57 57
 			'gv-getting-started',
58 58
 			array( $this, 'getting_started_screen' )
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return boolean  $is_page   True: yep; false: nope
87 87
 	 */
88
-	public function is_dashboard_page($is_page = false, $hook = NULL) {
88
+	public function is_dashboard_page( $is_page = false, $hook = NULL ) {
89 89
 		global $plugin_page;
90 90
 
91
-		if($is_page) { return $is_page; }
91
+		if ( $is_page ) { return $is_page; }
92 92
 
93 93
 		return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) );
94 94
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' );
106 106
 		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' );
107 107
 
108
-		if( !$this->is_dashboard_page() ) { return; }
108
+		if ( ! $this->is_dashboard_page() ) { return; }
109 109
 
110 110
 		?>
111 111
 		<style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html">
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		// Don't fetch -beta, etc.
129 129
 		list( $display_version ) = explode( '-', GravityView_Plugin::version );
130 130
 
131
-		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
131
+		$selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
132 132
 
133 133
 		echo gravityview_get_floaty( 132 );
134 134
 		?>
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
138 138
 
139 139
 		<h2 class="nav-tab-wrapper clear">
140
-			<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' ) ) ); ?>">
140
+			<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' ) ) ); ?>">
141 141
 				<?php _e( "Getting Started", 'gravityview' ); ?>
142 142
 			</a>
143
-			<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' ) ) ); ?>">
143
+			<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' ) ) ); ?>">
144 144
 				<?php _e( "List of Changes", 'gravityview' ); ?>
145 145
 			</a>
146
-			<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' ) ) ); ?>">
146
+			<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' ) ) ); ?>">
147 147
 				<?php _e( 'Credits', 'gravityview' ); ?>
148 148
 			</a>
149 149
 		</h2>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 					<h3>Create a View</h3>
178 178
 
179 179
 					<ol class="ol-decimal">
180
-						<li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views &gt; New View</a></li>
180
+						<li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views &gt; New View</a></li>
181 181
 						<li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li>
182 182
 						<li>If you want to <strong>use an existing form&rsquo;s entries</strong>, select from the dropdown.</li>
183 183
 						<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>.
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 					</ul>
632 632
 
633 633
 					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
634
-					<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/gravityview/GravityView">', '</a>' ); ?></p>
634
+					<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/gravityview/GravityView">', '</a>' ); ?></p>
635 635
 				</div>
636 636
 			</div>
637 637
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 		global $plugin_page;
674 674
 
675 675
 		// Bail if we're just editing the plugin
676
-		if( $plugin_page === 'plugin-editor.php' ) { return; }
676
+		if ( $plugin_page === 'plugin-editor.php' ) { return; }
677 677
 
678 678
 		// Bail if no activation redirect
679 679
 		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 		$upgrade = get_option( 'gv_version_upgraded_from' );
685 685
 
686 686
 		// Don't do anything if they've already seen the new version info
687
-		if( $upgrade === GravityView_Plugin::version ) {
687
+		if ( $upgrade === GravityView_Plugin::version ) {
688 688
 			return;
689 689
 		}
690 690
 
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
693 693
 
694 694
 		// Bail if activating from network, or bulk
695
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; }
695
+		if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; }
696 696
 
697 697
 		// First time install
698
-		if( ! $upgrade ) {
698
+		if ( ! $upgrade ) {
699 699
 			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit;
700 700
 		}
701 701
 		// Update
Please login to merge, or discard this patch.