Completed
Push — develop ( c38b5d...31c9ca )
by Zack
18:12
created
includes/extensions/edit-entry/class-edit-entry.php 2 patches
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -23,90 +23,90 @@  discard block
 block discarded – undo
23 23
 
24 24
 class GravityView_Edit_Entry {
25 25
 
26
-    /**
27
-     * @var string
28
-     */
26
+	/**
27
+	 * @var string
28
+	 */
29 29
 	static $file;
30 30
 
31 31
 	static $instance;
32 32
 
33
-    /**
34
-     * Component instances.
35
-     * @var array
36
-     */
37
-    public $instances = array();
33
+	/**
34
+	 * Component instances.
35
+	 * @var array
36
+	 */
37
+	public $instances = array();
38 38
 
39 39
 
40 40
 	function __construct() {
41 41
 
42
-        self::$file = plugin_dir_path( __FILE__ );
42
+		self::$file = plugin_dir_path( __FILE__ );
43 43
 
44
-        if( is_admin() ) {
45
-            $this->load_components( 'admin' );
46
-        }
44
+		if( is_admin() ) {
45
+			$this->load_components( 'admin' );
46
+		}
47 47
 
48 48
 		$this->load_components( 'locking' );
49 49
 
50
-        $this->load_components( 'render' );
50
+		$this->load_components( 'render' );
51 51
 
52
-        // If GF User Registration Add-on exists
53
-        $this->load_components( 'user-registration' );
52
+		// If GF User Registration Add-on exists
53
+		$this->load_components( 'user-registration' );
54 54
 
55
-        $this->add_hooks();
55
+		$this->add_hooks();
56 56
 
57 57
 		// Process hooks for addons that may or may not be present
58 58
 		$this->addon_specific_hooks();
59 59
 	}
60 60
 
61 61
 
62
-    static function getInstance() {
62
+	static function getInstance() {
63 63
 
64
-        if( empty( self::$instance ) ) {
65
-            self::$instance = new GravityView_Edit_Entry;
66
-        }
64
+		if( empty( self::$instance ) ) {
65
+			self::$instance = new GravityView_Edit_Entry;
66
+		}
67 67
 
68
-        return self::$instance;
69
-    }
68
+		return self::$instance;
69
+	}
70 70
 
71 71
 
72
-    private function load_components( $component ) {
72
+	private function load_components( $component ) {
73 73
 
74
-        $dir = trailingslashit( self::$file );
74
+		$dir = trailingslashit( self::$file );
75 75
 
76
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
77
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
76
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
77
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
78 78
 
79
-        // Loads component and pass extension's instance so that component can
80
-        // talk each other.
81
-        require_once $filename;
82
-        $this->instances[ $component ] = new $classname( $this );
83
-        $this->instances[ $component ]->load();
79
+		// Loads component and pass extension's instance so that component can
80
+		// talk each other.
81
+		require_once $filename;
82
+		$this->instances[ $component ] = new $classname( $this );
83
+		$this->instances[ $component ]->load();
84 84
 
85
-    }
85
+	}
86 86
 
87
-    private function add_hooks() {
87
+	private function add_hooks() {
88 88
 
89
-        // Add front-end access to Gravity Forms delete file action
90
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
89
+		// Add front-end access to Gravity Forms delete file action
90
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
91 91
 
92
-        // Make sure this hook is run for non-admins
93
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
92
+		// Make sure this hook is run for non-admins
93
+		add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
94 94
 
95
-        add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
95
+		add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
96 96
 
97
-        // add template path to check for field
98
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
97
+		// add template path to check for field
98
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
99 99
 
100 100
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
101 101
 
102 102
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
103 103
 
104
-	    add_action( 'template_redirect', function() {
105
-		    if ( ! isset( $_GET['gv-iframe'] ) ) {
106
-			    return;
107
-		    }
104
+		add_action( 'template_redirect', function() {
105
+			if ( ! isset( $_GET['gv-iframe'] ) ) {
106
+				return;
107
+			}
108 108
 
109
-		    // If user doesn't have appropriate permissions, die.
109
+			// If user doesn't have appropriate permissions, die.
110 110
 			if ( ! GFCommon::current_user_can_any( array( 'gravityforms_edit_forms', 'gravityforms_create_form', 'gravityforms_preview_forms' ) ) ) {
111 111
 				die( esc_html__( "You don't have adequate permission to preview forms.", 'gravityforms' ) );
112 112
 			}
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 </body>
232 232
 </html>
233 233
 <?php
234
-		    exit();
235
-	    } );
236
-    }
234
+			exit();
235
+		} );
236
+	}
237 237
 
238 238
 	/**
239 239
 	 * Adds "edit" to the list of internal reserved query args
@@ -304,74 +304,74 @@  discard block
 block discarded – undo
304 304
 		return false;
305 305
 	}
306 306
 
307
-    /**
308
-     * Include this extension templates path
309
-     * @param array $file_paths List of template paths ordered
310
-     */
311
-    public function add_template_path( $file_paths ) {
312
-
313
-        // Index 100 is the default GravityView template path.
314
-        $file_paths[ 110 ] = self::$file;
315
-
316
-        return $file_paths;
317
-    }
318
-
319
-    /**
320
-     *
321
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
322
-     *
323
-     * @param $view_id int GravityView view id
324
-     * @param $form_id int Gravity Forms form id
325
-     * @param $entry_id int Gravity Forms entry id
326
-     * @return string
327
-     */
328
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
329
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
330
-    }
331
-
332
-
333
-    /**
334
-     * The edit entry link creates a secure link with a nonce
335
-     *
336
-     * It also mimics the URL structure Gravity Forms expects to have so that
337
-     * it formats the display of the edit form like it does in the backend, like
338
-     * "You can edit this post from the post page" fields, for example.
339
-     *
340
-     * @param $entry array Gravity Forms entry object
341
-     * @param $view_id int GravityView view id
342
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
343
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
344
-     * @return string
345
-     */
346
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
347
-
348
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
349
-
350
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
351
-
352
-        $url = add_query_arg( array(
353
-            'edit' => wp_create_nonce( $nonce_key )
354
-        ), $base );
355
-
356
-        if( $post_id ) {
357
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
358
-        }
359
-
360
-	    /**
361
-	     * Allow passing params to dynamically populate entry with values
362
-	     * @since 1.9.2
363
-	     */
364
-	    if( !empty( $field_values ) ) {
365
-
366
-		    if( is_array( $field_values ) ) {
367
-			    // If already an array, no parse_str() needed
368
-			    $params = $field_values;
369
-		    } else {
370
-			    parse_str( $field_values, $params );
371
-		    }
372
-
373
-		    $url = add_query_arg( $params, $url );
374
-	    }
307
+	/**
308
+	 * Include this extension templates path
309
+	 * @param array $file_paths List of template paths ordered
310
+	 */
311
+	public function add_template_path( $file_paths ) {
312
+
313
+		// Index 100 is the default GravityView template path.
314
+		$file_paths[ 110 ] = self::$file;
315
+
316
+		return $file_paths;
317
+	}
318
+
319
+	/**
320
+	 *
321
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
322
+	 *
323
+	 * @param $view_id int GravityView view id
324
+	 * @param $form_id int Gravity Forms form id
325
+	 * @param $entry_id int Gravity Forms entry id
326
+	 * @return string
327
+	 */
328
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
329
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
330
+	}
331
+
332
+
333
+	/**
334
+	 * The edit entry link creates a secure link with a nonce
335
+	 *
336
+	 * It also mimics the URL structure Gravity Forms expects to have so that
337
+	 * it formats the display of the edit form like it does in the backend, like
338
+	 * "You can edit this post from the post page" fields, for example.
339
+	 *
340
+	 * @param $entry array Gravity Forms entry object
341
+	 * @param $view_id int GravityView view id
342
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
343
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
344
+	 * @return string
345
+	 */
346
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
347
+
348
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
349
+
350
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
351
+
352
+		$url = add_query_arg( array(
353
+			'edit' => wp_create_nonce( $nonce_key )
354
+		), $base );
355
+
356
+		if( $post_id ) {
357
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
358
+		}
359
+
360
+		/**
361
+		 * Allow passing params to dynamically populate entry with values
362
+		 * @since 1.9.2
363
+		 */
364
+		if( !empty( $field_values ) ) {
365
+
366
+			if( is_array( $field_values ) ) {
367
+				// If already an array, no parse_str() needed
368
+				$params = $field_values;
369
+			} else {
370
+				parse_str( $field_values, $params );
371
+			}
372
+
373
+			$url = add_query_arg( $params, $url );
374
+		}
375 375
 
376 376
 		/**
377 377
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		 * @param \GV\View $view The View.
381 381
 		 */
382 382
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
383
-    }
383
+	}
384 384
 
385 385
 	/**
386 386
 	 * Edit mode doesn't allow certain field types.
@@ -435,19 +435,19 @@  discard block
 block discarded – undo
435 435
 	}
436 436
 
437 437
 
438
-    /**
439
-     * checks if user has permissions to edit a specific entry
440
-     *
441
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
442
-     *
443
-     * @param  array $entry Gravity Forms entry array
444
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
445
-     * @return bool
446
-     */
447
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
438
+	/**
439
+	 * checks if user has permissions to edit a specific entry
440
+	 *
441
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
442
+	 *
443
+	 * @param  array $entry Gravity Forms entry array
444
+	 * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
445
+	 * @return bool
446
+	 */
447
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
448 448
 
449
-        // No permission by default
450
-        $user_can_edit = false;
449
+		// No permission by default
450
+		$user_can_edit = false;
451 451
 
452 452
 		// get user_edit setting
453 453
 		if ( empty( $view ) ) {
@@ -465,60 +465,60 @@  discard block
 block discarded – undo
465 465
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
466 466
 		}
467 467
 
468
-        // If they can edit any entries (as defined in Gravity Forms)
469
-        // Or if they can edit other people's entries
470
-        // Then we're good.
471
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
468
+		// If they can edit any entries (as defined in Gravity Forms)
469
+		// Or if they can edit other people's entries
470
+		// Then we're good.
471
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
472 472
 
473
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
473
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
474 474
 
475
-            $user_can_edit = true;
475
+			$user_can_edit = true;
476 476
 
477
-        } else if( !isset( $entry['created_by'] ) ) {
477
+		} else if( !isset( $entry['created_by'] ) ) {
478 478
 
479
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
479
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
480 480
 
481
-            $user_can_edit = false;
481
+			$user_can_edit = false;
482 482
 
483
-        } else {
483
+		} else {
484 484
 
485
-            $current_user = wp_get_current_user();
485
+			$current_user = wp_get_current_user();
486 486
 
487
-            // User edit is disabled
488
-            if( empty( $user_edit ) ) {
487
+			// User edit is disabled
488
+			if( empty( $user_edit ) ) {
489 489
 
490
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
490
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
491 491
 
492
-                $user_can_edit = false;
493
-            }
492
+				$user_can_edit = false;
493
+			}
494 494
 
495
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
496
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
495
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
496
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
497 497
 
498
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
498
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
499 499
 
500
-                $user_can_edit = true;
500
+				$user_can_edit = true;
501 501
 
502
-            } else if( ! is_user_logged_in() ) {
502
+			} else if( ! is_user_logged_in() ) {
503 503
 
504
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
504
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
505 505
 
506
-	            $user_can_edit = false; // Here just for clarity
507
-            }
506
+				$user_can_edit = false; // Here just for clarity
507
+			}
508 508
 
509
-        }
509
+		}
510 510
 
511
-        /**
512
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
513
-         * @since 1.15 Added `$entry` and `$view_id` parameters
514
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
515
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
516
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
517
-         */
518
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
511
+		/**
512
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
513
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
514
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
515
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
516
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
517
+		 */
518
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
519 519
 
520
-        return (bool) $user_can_edit;
521
-    }
520
+		return (bool) $user_can_edit;
521
+	}
522 522
 
523 523
 
524 524
 
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 }
17 17
 
18 18
 // Needed to allow JS in the Close link because of esc_url()
19
-add_filter( 'kses_allowed_protocols', function($protocols) {
20
-	$protocols[] = 'javascript';
19
+add_filter( 'kses_allowed_protocols', function( $protocols ) {
20
+	$protocols[ ] = 'javascript';
21 21
 	return $protocols;
22 22
 });
23 23
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         self::$file = plugin_dir_path( __FILE__ );
43 43
 
44
-        if( is_admin() ) {
44
+        if ( is_admin() ) {
45 45
             $this->load_components( 'admin' );
46 46
         }
47 47
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     static function getInstance() {
63 63
 
64
-        if( empty( self::$instance ) ) {
64
+        if ( empty( self::$instance ) ) {
65 65
             self::$instance = new GravityView_Edit_Entry;
66 66
         }
67 67
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
     private function add_hooks() {
88 88
 
89 89
         // Add front-end access to Gravity Forms delete file action
90
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
90
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
91 91
 
92 92
         // Make sure this hook is run for non-admins
93
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
93
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
94 94
 
95 95
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
96 96
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
103 103
 
104 104
 	    add_action( 'template_redirect', function() {
105
-		    if ( ! isset( $_GET['gv-iframe'] ) ) {
105
+		    if ( ! isset( $_GET[ 'gv-iframe' ] ) ) {
106 106
 			    return;
107 107
 		    }
108 108
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 $form_id = absint( rgget( 'id' ) );
128 128
 
129 129
 // Get form object.
130
-$form = RGFormsModel::get_form_meta( $_GET['id'] );
130
+$form = RGFormsModel::get_form_meta( $_GET[ 'id' ] );
131 131
 
132 132
 ?>
133 133
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	return $original_url;
203 203
 }, 20, 3 );
204 204
 
205
-add_filter( 'gravityview/edit_entry/cancel_link', function ( $link ) {
205
+add_filter( 'gravityview/edit_entry/cancel_link', function( $link ) {
206 206
 	return '';
207 207
 } );
208 208
 
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 $gravityview_view->setCurrentEntry( $entry->as_entry() );
214 214
 $data = GravityView_View_Data::getInstance( $view );
215 215
 $loader = GravityView_Edit_Entry::getInstance();
216
-$render = $loader->instances['render'];
216
+$render = $loader->instances[ 'render' ];
217 217
 
218 218
 $render->init( $data, $entry, $view );
219 219
 
220
-remove_all_filters( 'clean_url');
220
+remove_all_filters( 'clean_url' );
221 221
 wp_print_footer_scripts();
222 222
 
223 223
 /**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function add_reserved_arg( $args ) {
248 248
 
249
-		$args[] = 'edit';
249
+		$args[ ] = 'edit';
250 250
 
251 251
 		return $args;
252 252
 	}
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	private function addon_specific_hooks() {
259 259
 
260
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
261
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
260
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
261
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
262 262
 		}
263 263
 
264 264
 	}
@@ -345,15 +345,15 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
347 347
 
348
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
348
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
349 349
 
350
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
350
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
351 351
 
352 352
         $url = add_query_arg( array(
353 353
             'edit' => wp_create_nonce( $nonce_key )
354 354
         ), $base );
355 355
 
356
-        if( $post_id ) {
356
+        if ( $post_id ) {
357 357
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
358 358
         }
359 359
 
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 	     * Allow passing params to dynamically populate entry with values
362 362
 	     * @since 1.9.2
363 363
 	     */
364
-	    if( !empty( $field_values ) ) {
364
+	    if ( ! empty( $field_values ) ) {
365 365
 
366
-		    if( is_array( $field_values ) ) {
366
+		    if ( is_array( $field_values ) ) {
367 367
 			    // If already an array, no parse_str() needed
368 368
 			    $params = $field_values;
369 369
 		    } else {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		 * @param array $entry The entry.
380 380
 		 * @param \GV\View $view The View.
381 381
 		 */
382
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
382
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
383 383
     }
384 384
 
385 385
 	/**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
392 392
 
393
-		if( empty( $context ) || $context !== 'edit' ) {
393
+		if ( empty( $context ) || $context !== 'edit' ) {
394 394
 			return $fields;
395 395
 		}
396 396
 
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
         // If they can edit any entries (as defined in Gravity Forms)
469 469
         // Or if they can edit other people's entries
470 470
         // Then we're good.
471
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
471
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
472 472
 
473 473
             gravityview()->log->debug( 'User has ability to edit all entries.' );
474 474
 
475 475
             $user_can_edit = true;
476 476
 
477
-        } else if( !isset( $entry['created_by'] ) ) {
477
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
478 478
 
479
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
479
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
480 480
 
481 481
             $user_can_edit = false;
482 482
 
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
             $current_user = wp_get_current_user();
486 486
 
487 487
             // User edit is disabled
488
-            if( empty( $user_edit ) ) {
488
+            if ( empty( $user_edit ) ) {
489 489
 
490 490
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
491 491
 
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
             }
494 494
 
495 495
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
496
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
496
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
497 497
 
498 498
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
499 499
 
500 500
                 $user_can_edit = true;
501 501
 
502
-            } else if( ! is_user_logged_in() ) {
502
+            } else if ( ! is_user_logged_in() ) {
503 503
 
504 504
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
505 505
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
          */
518 518
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
519 519
 
520
-        return (bool) $user_can_edit;
520
+        return (bool)$user_can_edit;
521 521
     }
522 522
 
523 523
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	function load() {
136 136
 
137 137
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
138
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
138
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
139 139
 
140 140
 		// Don't display an embedded form when editing an entry
141 141
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		add_action( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
146 146
 		add_action( 'admin_init', array( $this, 'prevent_maybe_process_form' ), 8 );
147 147
 
148
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
148
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
149 149
 
150 150
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 );
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
157 157
 
158 158
 		// Add fields expected by GFFormDisplay::validate()
159
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
159
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
160 160
 
161 161
 		// Fix multiselect value for GF 2.2
162 162
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function prevent_render_form() {
176
-		if( $this->is_edit_entry() ) {
177
-			if( 'wp_head' === current_filter() ) {
176
+		if ( $this->is_edit_entry() ) {
177
+			if ( 'wp_head' === current_filter() ) {
178 178
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
179 179
 			} else {
180 180
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prevent_maybe_process_form() {
191 191
 
192
-	    if( ! $this->is_edit_entry_submission() ) {
192
+	    if ( ! $this->is_edit_entry_submission() ) {
193 193
 			return;
194 194
 		}
195 195
 
196 196
 		gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' );
197 197
 
198
-		remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
199
-		remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
198
+		remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
199
+		remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
200 200
 
201
-		remove_action( 'admin_init',  array( 'GFForms', 'maybe_process_form'), 9 );
202
-		remove_action( 'admin_init',  array( 'RGForms', 'maybe_process_form'), 9 );
201
+		remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form' ), 9 );
202
+		remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form' ), 9 );
203 203
 	}
204 204
 
205 205
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$is_edit_entry =
212 212
 			( GravityView_frontend::is_single_entry() || gravityview()->request->is_entry() )
213
-			&& ( ! empty( $_GET['edit'] ) );
213
+			&& ( ! empty( $_GET[ 'edit' ] ) );
214 214
 
215 215
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
216 216
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return boolean
222 222
 	 */
223 223
 	public function is_edit_entry_submission() {
224
-		return !empty( $_POST[ self::$nonce_field ] );
224
+		return ! empty( $_POST[ self::$nonce_field ] );
225 225
 	}
226 226
 
227 227
 	/**
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
 		$entries = $gravityview_view->getEntries();
237
-	    self::$original_entry = $entries[0];
238
-	    $this->entry = $entries[0];
237
+	    self::$original_entry = $entries[ 0 ];
238
+	    $this->entry = $entries[ 0 ];
239 239
 
240
-		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
240
+		self::$original_form = GFAPI::get_form( $this->entry[ 'form_id' ] );
241 241
 		$this->form = $gravityview_view->getForm();
242
-		$this->form_id = $this->entry['form_id'];
242
+		$this->form_id = $this->entry[ 'form_id' ];
243 243
 		$this->view_id = $gravityview_view->getViewId();
244 244
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
245 245
 
246
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
246
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
247 247
 	}
248 248
 
249 249
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 		if ( $entry instanceof \GV\Entry ) {
272 272
 			$this->entry = $entry->as_entry();
273
-			$this->form_id = (int) $entry->as_entry()['form_id'];
273
+			$this->form_id = (int)$entry->as_entry()[ 'form_id' ];
274 274
 			$this->form = GFAPI::get_form( $this->form_id );
275 275
 		}
276 276
 
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 	private function print_scripts() {
309 309
 		$gravityview_view = GravityView_View::getInstance();
310 310
 
311
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
311
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
312 312
 
313
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
313
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
314 314
 
315 315
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
316 316
 
@@ -326,19 +326,19 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	private function process_save( $gv_data ) {
328 328
 
329
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
329
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
330 330
 			return;
331 331
 		}
332 332
 
333 333
 		// Make sure the entry, view, and form IDs are all correct
334 334
 		$valid = $this->verify_nonce();
335 335
 
336
-		if ( !$valid ) {
336
+		if ( ! $valid ) {
337 337
 			gravityview()->log->error( 'Nonce validation failed.' );
338 338
 			return;
339 339
 		}
340 340
 
341
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
341
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
342 342
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
343 343
 			return;
344 344
 		}
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
 		$this->validate();
351 351
 
352
-		if( $this->is_valid ) {
352
+		if ( $this->is_valid ) {
353 353
 
354 354
 			gravityview()->log->debug( 'Submission is valid.' );
355 355
 
@@ -361,15 +361,15 @@  discard block
 block discarded – undo
361 361
 			/**
362 362
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
363 363
 			 */
364
-			unset( $_GET['page'] );
364
+			unset( $_GET[ 'page' ] );
365 365
 
366
-			$date_created = $this->entry['date_created'];
366
+			$date_created = $this->entry[ 'date_created' ];
367 367
 
368 368
 			/**
369 369
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
370 370
 			 * @since 1.17.2
371 371
 			 */
372
-			unset( $this->entry['date_created'] );
372
+			unset( $this->entry[ 'date_created' ] );
373 373
 
374 374
 			/**
375 375
 			 * @action `gravityview/edit_entry/before_update` Perform an action before the entry has been updated using Edit Entry
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
 			 * @param GravityView_Edit_Entry_Render $this This object
380 380
 			 * @param GravityView_View_Data $gv_data The View data
381 381
 			 */
382
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
382
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
383 383
 
384 384
 			GFFormsModel::save_lead( $form, $this->entry );
385 385
 
386 386
 	        // Delete the values for hidden inputs
387 387
 	        $this->unset_hidden_field_values();
388 388
 
389
-			$this->entry['date_created'] = $date_created;
389
+			$this->entry[ 'date_created' ] = $date_created;
390 390
 
391 391
 			// Process calculation fields
392 392
 			$this->update_calculation_fields();
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			 * @param GravityView_Edit_Entry_Render $this This object
412 412
 			 * @param GravityView_View_Data $gv_data The View data
413 413
 			 */
414
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
414
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
415 415
 
416 416
 		} else {
417 417
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -447,10 +447,10 @@  discard block
 block discarded – undo
447 447
 
448 448
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
449 449
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
450
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
450
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
451 451
 		} else {
452 452
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
453
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
453
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
454 454
 		}
455 455
 
456 456
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 
469 469
 				$empty_value = $field->get_value_save_entry(
470 470
 					is_array( $field->get_entry_inputs() ) ? array() : '',
471
-					$this->form, '', $this->entry['id'], $this->entry
471
+					$this->form, '', $this->entry[ 'id' ], $this->entry
472 472
 				);
473 473
 
474 474
 				if ( $field->has_calculation() ) {
475
-					$this->unset_hidden_calculations[] = $field->id; // Unset
475
+					$this->unset_hidden_calculations[ ] = $field->id; // Unset
476 476
 					$empty_value = '';
477 477
 				}
478 478
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	private function preset_approval_fields() {
502 502
 		$has_approved_field = false;
503 503
 
504
-		foreach ( self::$original_form['fields'] as $field ) {
504
+		foreach ( self::$original_form[ 'fields' ] as $field ) {
505 505
 			if ( $field->gravityview_approved ) {
506 506
 				$has_approved_field = true;
507 507
 				break;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
 		$is_field_hidden = true;
516 516
 
517
-		foreach ( $this->form['fields'] as $field ) {
517
+		foreach ( $this->form[ 'fields' ] as $field ) {
518 518
 			if ( $field->gravityview_approved ) {
519 519
 				$is_field_hidden = false;
520 520
 				break;
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 		remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 );
541 541
 
542
-		if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) {
542
+		if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
543 543
 
544 544
 			$value = GravityView_Entry_Approval_Status::UNAPPROVED;
545 545
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		}
605 605
 
606 606
 		/** No file is being uploaded. */
607
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
607
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
608 608
 			/** So return the original upload, with $value as backup (it can be empty during edit form rendering) */
609 609
 			return rgar( $entry, $input_id, $value );
610 610
 		}
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
 	 * @return mixed
623 623
 	 */
624 624
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
625
-		if( ! $this->is_edit_entry() ) {
625
+		if ( ! $this->is_edit_entry() ) {
626 626
 			return $plupload_init;
627 627
 		}
628 628
 
629
-		$plupload_init['gf_vars']['max_files'] = 0;
629
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
630 630
 
631 631
 		return $plupload_init;
632 632
 	}
@@ -641,26 +641,26 @@  discard block
 block discarded – undo
641 641
 		$form = $this->filter_conditional_logic( $this->form );
642 642
 
643 643
 	    /** @type GF_Field $field */
644
-		foreach( $form['fields'] as $k => &$field ) {
644
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
645 645
 
646 646
 			/**
647 647
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
648 648
 			 * @since 1.16.3
649 649
 			 */
650
-			if( $field->has_calculation() ) {
651
-				unset( $form['fields'][ $k ] );
650
+			if ( $field->has_calculation() ) {
651
+				unset( $form[ 'fields' ][ $k ] );
652 652
 			}
653 653
 
654 654
 			$field->adminOnly = false;
655 655
 
656
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
657
-				foreach( $field->inputs as $key => $input ) {
658
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
656
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
657
+				foreach ( $field->inputs as $key => $input ) {
658
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
659 659
 				}
660 660
 			}
661 661
 		}
662 662
 
663
-		$form['fields'] = array_values( $form['fields'] );
663
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
664 664
 
665 665
 		return $form;
666 666
 	}
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
 		$update = false;
673 673
 
674 674
 		// get the most up to date entry values
675
-		$entry = GFAPI::get_entry( $this->entry['id'] );
675
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
676 676
 
677 677
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
678 678
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
679
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
679
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
680 680
 		} else {
681 681
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
682
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
682
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
683 683
 		}
684 684
 
685 685
 
@@ -696,24 +696,24 @@  discard block
 block discarded – undo
696 696
 				$inputs = $field->get_entry_inputs();
697 697
 				if ( is_array( $inputs ) ) {
698 698
 				    foreach ( $inputs as $input ) {
699
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
699
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
700 700
 
701 701
 						if ( 'product' === $field->type ) {
702
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
702
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
703 703
 
704 704
 							// Only allow quantity to be set if it's allowed to be edited
705 705
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
706 706
 							} else { // otherwise set to what it previously was
707
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
707
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
708 708
 							}
709 709
 						} else {
710 710
 							// Set to what it previously was if it's not editable
711 711
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
712
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
712
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
713 713
 							}
714 714
 						}
715 715
 
716
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
716
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
717 717
 				    }
718 718
 				} else {
719 719
 					// Set to what it previously was if it's not editable
@@ -753,19 +753,19 @@  discard block
 block discarded – undo
753 753
 
754 754
 		$input_name = 'input_' . $field_id;
755 755
 
756
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
756
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
757 757
 
758 758
 			// We have a new image
759 759
 
760
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
760
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
761 761
 
762 762
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
763 763
 	        $ary = stripslashes_deep( $ary );
764 764
 			$img_url = \GV\Utils::get( $ary, 0 );
765 765
 
766
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
767
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
768
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
766
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
767
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
768
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
769 769
 
770 770
 			$image_meta = array(
771 771
 				'post_excerpt' => $img_caption,
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
776 776
 			if ( ! empty( $img_title ) ) {
777
-				$image_meta['post_title'] = $img_title;
777
+				$image_meta[ 'post_title' ] = $img_title;
778 778
 			}
779 779
 
780 780
 			/**
@@ -832,15 +832,15 @@  discard block
 block discarded – undo
832 832
 	 */
833 833
 	private function maybe_update_post_fields( $form ) {
834 834
 
835
-		if( empty( $this->entry['post_id'] ) ) {
835
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
836 836
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
837 837
 			return;
838 838
 		}
839 839
 
840
-		$post_id = $this->entry['post_id'];
840
+		$post_id = $this->entry[ 'post_id' ];
841 841
 
842 842
 		// Security check
843
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
843
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
844 844
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
845 845
 			return;
846 846
 		}
@@ -853,25 +853,25 @@  discard block
 block discarded – undo
853 853
 
854 854
 			$field = RGFormsModel::get_field( $form, $field_id );
855 855
 
856
-			if( ! $field ) {
856
+			if ( ! $field ) {
857 857
 				continue;
858 858
 			}
859 859
 
860
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
860
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
861 861
 
862 862
 				// Get the value of the field, including $_POSTed value
863 863
 				$value = RGFormsModel::get_field_value( $field );
864 864
 
865 865
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
866 866
 				$entry_tmp = $this->entry;
867
-				$entry_tmp["{$field_id}"] = $value;
867
+				$entry_tmp[ "{$field_id}" ] = $value;
868 868
 
869
-				switch( $field->type ) {
869
+				switch ( $field->type ) {
870 870
 
871 871
 				    case 'post_title':
872 872
 				        $post_title = $value;
873 873
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
874
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
874
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
875 875
 				        }
876 876
 				        $updated_post->post_title = $post_title;
877 877
 				        $updated_post->post_name  = $post_title;
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 				    case 'post_content':
882 882
 				        $post_content = $value;
883 883
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
884
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
884
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
885 885
 				        }
886 886
 				        $updated_post->post_content = $post_content;
887 887
 				        unset( $post_content );
@@ -899,11 +899,11 @@  discard block
 block discarded – undo
899 899
 							$value = $value[ $field_id ];
900 900
 						}
901 901
 
902
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
902
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
903 903
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
904 904
 				        }
905 905
 
906
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
906
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
907 907
 
908 908
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
909 909
 				        break;
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 				}
916 916
 
917 917
 				// update entry after
918
-				$this->entry["{$field_id}"] = $value;
918
+				$this->entry[ "{$field_id}" ] = $value;
919 919
 
920 920
 				$update_entry = true;
921 921
 
@@ -924,11 +924,11 @@  discard block
 block discarded – undo
924 924
 
925 925
 		}
926 926
 
927
-		if( $update_entry ) {
927
+		if ( $update_entry ) {
928 928
 
929 929
 			$return_entry = GFAPI::update_entry( $this->entry );
930 930
 
931
-			if( is_wp_error( $return_entry ) ) {
931
+			if ( is_wp_error( $return_entry ) ) {
932 932
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
933 933
 			} else {
934 934
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 
939 939
 		$return_post = wp_update_post( $updated_post, true );
940 940
 
941
-		if( is_wp_error( $return_post ) ) {
941
+		if ( is_wp_error( $return_post ) ) {
942 942
 			$return_post->add_data( $updated_post, '$updated_post' );
943 943
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
944 944
 		} else {
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
973 973
 
974 974
 		// replace conditional shortcodes
975
-		if( $do_shortcode ) {
975
+		if ( $do_shortcode ) {
976 976
 			$output = do_shortcode( $output );
977 977
 		}
978 978
 
@@ -991,19 +991,19 @@  discard block
 block discarded – undo
991 991
 	 */
992 992
 	private function after_update() {
993 993
 
994
-		do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry );
995
-		do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry );
994
+		do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry );
995
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry );
996 996
 
997 997
 		// Re-define the entry now that we've updated it.
998
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
998
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
999 999
 
1000 1000
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
1001 1001
 
1002 1002
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
1003 1003
 			// We need to clear the cache because Gravity Forms caches the field values, which
1004 1004
 			// we have just updated.
1005
-			foreach ($this->form['fields'] as $key => $field) {
1006
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
1005
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
1006
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
1007 1007
 			}
1008 1008
 		}
1009 1009
 
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
 		 * @since develop
1014 1014
 		 */
1015 1015
 		if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) {
1016
-			$feeds = GFAPI::get_feeds( null, $entry['form_id'] );
1016
+			$feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] );
1017 1017
 			if ( ! is_wp_error( $feeds ) ) {
1018 1018
 				$registered_feeds = array();
1019 1019
 				foreach ( GFAddOn::get_registered_addons() as $registered_feed ) {
1020
-					if ( is_subclass_of( $registered_feed,  'GFFeedAddOn' ) ) {
1020
+					if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) {
1021 1021
 						if ( method_exists( $registered_feed, 'get_instance' ) ) {
1022 1022
 							$registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) );
1023 1023
 							$registered_feeds[ $registered_feed->get_slug() ] = $registered_feed;
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 					}
1026 1026
 				}
1027 1027
 				foreach ( $feeds as $feed ) {
1028
-					if ( in_array( $feed['id'], $allowed_feeds ) ) {
1029
-						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) {
1028
+					if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) {
1029
+						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) {
1030 1030
 							$returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form );
1031 1031
 							if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) {
1032 1032
 								$entry = $returned_entry;
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
 		$view = \GV\View::by_id( $this->view_id );
1056 1056
 
1057
-		if( $view->settings->get( 'edit_locking' ) ) {
1057
+		if ( $view->settings->get( 'edit_locking' ) ) {
1058 1058
 			$locking = new GravityView_Edit_Entry_Locking();
1059
-			$locking->maybe_lock_object( $this->entry['id'] );
1059
+			$locking->maybe_lock_object( $this->entry[ 'id' ] );
1060 1060
 		}
1061 1061
 
1062 1062
 		?>
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 		<div class="gv-edit-entry-wrapper"><?php
1071 1071
 
1072
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
1072
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
1073 1073
 
1074 1074
 			/**
1075 1075
 			 * Fixes weird wpautop() issue
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
1086 1086
 				     * @param GravityView_Edit_Entry_Render $this This object
1087 1087
 				     */
1088
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1088
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
1089 1089
 
1090 1090
 				    echo esc_attr( $edit_entry_title );
1091 1091
 			?></span>
@@ -1151,18 +1151,18 @@  discard block
 block discarded – undo
1151 1151
 				*/
1152 1152
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1153 1153
 
1154
-				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
1154
+				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ];
1155 1155
 			}
1156 1156
 
1157 1157
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1158 1158
 
1159
-			if( ! $this->is_valid ){
1159
+			if ( ! $this->is_valid ) {
1160 1160
 
1161 1161
 				// Keeping this compatible with Gravity Forms.
1162
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
1163
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1162
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
1163
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1164 1164
 
1165
-				echo GVCommon::generate_notice( $message , 'gv-error' );
1165
+				echo GVCommon::generate_notice( $message, 'gv-error' );
1166 1166
 
1167 1167
 			} elseif ( false === $this->is_paged_submitted ) {
1168 1168
 				// Paged form that hasn't been submitted on the last page yet
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 				 * @param int $view_id View ID
1176 1176
 				 * @param array $entry Gravity Forms entry array
1177 1177
 				 */
1178
-				$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry );
1178
+				$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry );
1179 1179
 
1180 1180
 				echo GVCommon::generate_notice( $message );
1181 1181
 			} else {
@@ -1187,23 +1187,23 @@  discard block
 block discarded – undo
1187 1187
 
1188 1188
                     case '0':
1189 1189
 	                    $redirect_url = $back_link;
1190
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1190
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1191 1191
                         break;
1192 1192
 
1193 1193
                     case '1':
1194 1194
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1195
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1195
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1196 1196
 	                    break;
1197 1197
 
1198 1198
                     case '2':
1199 1199
 	                    $redirect_url = $edit_redirect_url;
1200 1200
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1201
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1201
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1202 1202
                         break;
1203 1203
 
1204 1204
                     case '':
1205 1205
                     default:
1206
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1206
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1207 1207
                         break;
1208 1208
 				}
1209 1209
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 				 * @param array $entry Gravity Forms entry array
1220 1220
 				 * @param string $back_link URL to return to the original entry. @since 1.6
1221 1221
 				 */
1222
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1222
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1223 1223
 
1224 1224
 				echo GVCommon::generate_notice( $message );
1225 1225
 			}
@@ -1243,8 +1243,8 @@  discard block
 block discarded – undo
1243 1243
 		 */
1244 1244
 		do_action( 'gravityview/edit-entry/render/before', $this );
1245 1245
 
1246
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1247
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1246
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1247
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1248 1248
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1249 1249
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1250 1250
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1253,14 +1253,14 @@  discard block
 block discarded – undo
1253 1253
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1254 1254
 
1255 1255
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1256
-		unset( $_GET['page'] );
1256
+		unset( $_GET[ 'page' ] );
1257 1257
 
1258 1258
 		$this->show_next_button = false;
1259 1259
 		$this->show_previous_button = false;
1260 1260
 
1261 1261
 		// TODO: Verify multiple-page forms
1262 1262
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1263
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1263
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1264 1264
 
1265 1265
 				$labels = array(
1266 1266
 					'cancel'   => __( 'Cancel', 'gravityview' ),
@@ -1279,20 +1279,20 @@  discard block
 block discarded – undo
1279 1279
 				*/
1280 1280
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1281 1281
 
1282
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1283
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1282
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1283
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1284 1284
 
1285
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1285
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1286 1286
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1287 1287
 
1288 1288
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1289 1289
 					} // Advance to next visible page
1290
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1290
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1291 1291
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1292 1292
 					} // Advance to next visible page
1293 1293
 				}
1294 1294
 
1295
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1295
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1296 1296
 			}
1297 1297
 
1298 1298
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 
1319 1319
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1320 1320
 
1321
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1321
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1322 1322
 
1323 1323
 		ob_get_clean();
1324 1324
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 	 * @return string
1347 1347
 	 */
1348 1348
 	public function render_form_buttons() {
1349
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1349
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1350 1350
 	}
1351 1351
 
1352 1352
 
@@ -1365,15 +1365,15 @@  discard block
 block discarded – undo
1365 1365
 	 */
1366 1366
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1367 1367
 
1368
-		if( $form['id'] != $this->form_id ) {
1368
+		if ( $form[ 'id' ] != $this->form_id ) {
1369 1369
 			return $form;
1370 1370
 		}
1371 1371
 
1372 1372
 		// In case we have validated the form, use it to inject the validation results into the form render
1373
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1373
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1374 1374
 			$form = $this->form_after_validation;
1375 1375
 		} else {
1376
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1376
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1377 1377
 		}
1378 1378
 
1379 1379
 		$form = $this->filter_conditional_logic( $form );
@@ -1381,8 +1381,8 @@  discard block
 block discarded – undo
1381 1381
 		$form = $this->prefill_conditional_logic( $form );
1382 1382
 
1383 1383
 		// for now we don't support Save and Continue feature.
1384
-		if( ! self::$supports_save_and_continue ) {
1385
-	        unset( $form['save'] );
1384
+		if ( ! self::$supports_save_and_continue ) {
1385
+	        unset( $form[ 'save' ] );
1386 1386
 		}
1387 1387
 
1388 1388
 		$form = $this->unselect_default_values( $form );
@@ -1405,31 +1405,31 @@  discard block
 block discarded – undo
1405 1405
 	 */
1406 1406
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1407 1407
 
1408
-		if( ! GFCommon::is_post_field( $field ) ) {
1408
+		if ( ! GFCommon::is_post_field( $field ) ) {
1409 1409
 			return $field_content;
1410 1410
 		}
1411 1411
 
1412 1412
         $message = null;
1413 1413
 
1414 1414
         // First, make sure they have the capability to edit the post.
1415
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1415
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1416 1416
 
1417 1417
             /**
1418 1418
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1419 1419
              * @param string $message The existing "You don't have permission..." text
1420 1420
              */
1421
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1421
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1422 1422
 
1423
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1423
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1424 1424
             /**
1425 1425
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1426 1426
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1427 1427
              */
1428
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1428
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1429 1429
         }
1430 1430
 
1431
-        if( $message ) {
1432
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1431
+        if ( $message ) {
1432
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1433 1433
         }
1434 1434
 
1435 1435
         return $field_content;
@@ -1453,8 +1453,8 @@  discard block
 block discarded – undo
1453 1453
 
1454 1454
 		// If the form has been submitted, then we don't need to pre-fill the values,
1455 1455
 		// Except for fileupload type and when a field input is overridden- run always!!
1456
-		if(
1457
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1456
+		if (
1457
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1458 1458
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1459 1459
 			&& ! GFCommon::is_product_field( $field->type )
1460 1460
 			|| ! empty( $field_content )
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 	    $return = null;
1475 1475
 
1476 1476
 		/** @var GravityView_Field $gv_field */
1477
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1477
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1478 1478
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1479 1479
 		} else {
1480 1480
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 	    // If there was output, it's an error
1484 1484
 	    $warnings = ob_get_clean();
1485 1485
 
1486
-	    if( !empty( $warnings ) ) {
1486
+	    if ( ! empty( $warnings ) ) {
1487 1487
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1488 1488
 	    }
1489 1489
 
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1509 1509
 
1510 1510
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1511
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1511
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1512 1512
 
1513 1513
 			$field_value = array();
1514 1514
 
@@ -1517,10 +1517,10 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
 			foreach ( (array)$field->inputs as $input ) {
1519 1519
 
1520
-				$input_id = strval( $input['id'] );
1520
+				$input_id = strval( $input[ 'id' ] );
1521 1521
 
1522 1522
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1523
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1523
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1524 1524
 				    $allow_pre_populated = false;
1525 1525
 				}
1526 1526
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 
1529 1529
 			$pre_value = $field->get_value_submission( array(), false );
1530 1530
 
1531
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1531
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1532 1532
 
1533 1533
 		} else {
1534 1534
 
@@ -1539,13 +1539,13 @@  discard block
 block discarded – undo
1539 1539
 
1540 1540
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1541 1541
 			// or pre-populated value if not empty and set to override saved value
1542
-			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1542
+			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1543 1543
 
1544 1544
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1545
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1545
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1546 1546
 				$categories = array();
1547 1547
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1548
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1548
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1549 1549
 				}
1550 1550
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1551 1551
 			}
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
 	     * @param GF_Field $field Gravity Forms field object
1574 1574
 	     * @param GravityView_Edit_Entry_Render $this Current object
1575 1575
 	     */
1576
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1576
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1577 1577
 
1578 1578
 		return $field_value;
1579 1579
 	}
@@ -1590,12 +1590,12 @@  discard block
 block discarded – undo
1590 1590
 	 */
1591 1591
 	public function gform_pre_validation( $form ) {
1592 1592
 
1593
-		if( ! $this->verify_nonce() ) {
1593
+		if ( ! $this->verify_nonce() ) {
1594 1594
 			return $form;
1595 1595
 		}
1596 1596
 
1597 1597
 		// Fix PHP warning regarding undefined index.
1598
-		foreach ( $form['fields'] as &$field) {
1598
+		foreach ( $form[ 'fields' ] as &$field ) {
1599 1599
 
1600 1600
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1601 1601
 			// expects certain field array items to be set.
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1604 1604
 			}
1605 1605
 
1606
-			switch( RGFormsModel::get_input_type( $field ) ) {
1606
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1607 1607
 
1608 1608
 				/**
1609 1609
 				 * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.
@@ -1617,26 +1617,26 @@  discard block
 block discarded – undo
1617 1617
 				    // Set the previous value
1618 1618
 				    $entry = $this->get_entry();
1619 1619
 
1620
-				    $input_name = 'input_'.$field->id;
1621
-				    $form_id = $form['id'];
1620
+				    $input_name = 'input_' . $field->id;
1621
+				    $form_id = $form[ 'id' ];
1622 1622
 
1623 1623
 				    $value = NULL;
1624 1624
 
1625 1625
 				    // Use the previous entry value as the default.
1626
-				    if( isset( $entry[ $field->id ] ) ) {
1626
+				    if ( isset( $entry[ $field->id ] ) ) {
1627 1627
 				        $value = $entry[ $field->id ];
1628 1628
 				    }
1629 1629
 
1630 1630
 				    // If this is a single upload file
1631
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1632
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1633
-				        $value = $file_path['url'];
1631
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1632
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1633
+				        $value = $file_path[ 'url' ];
1634 1634
 
1635 1635
 				    } else {
1636 1636
 
1637 1637
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1638 1638
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1639
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1639
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1640 1640
 
1641 1641
 				    }
1642 1642
 
@@ -1644,10 +1644,10 @@  discard block
 block discarded – undo
1644 1644
 
1645 1645
 				        // If there are fresh uploads, process and merge them.
1646 1646
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1647
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1647
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1648 1648
 				            $value = empty( $value ) ? '[]' : $value;
1649 1649
 				            $value = stripslashes_deep( $value );
1650
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1650
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1651 1651
 				        }
1652 1652
 
1653 1653
 				    } else {
@@ -1665,8 +1665,8 @@  discard block
 block discarded – undo
1665 1665
 
1666 1666
 				case 'number':
1667 1667
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1668
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1669
-				        $_POST['input_'.$field->id ] = NULL;
1668
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1669
+				        $_POST[ 'input_' . $field->id ] = NULL;
1670 1670
 				    }
1671 1671
 				    break;
1672 1672
 			}
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		 * You can enter whatever you want!
1704 1704
 		 * We try validating, and customize the results using `self::custom_validation()`
1705 1705
 		 */
1706
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1706
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1707 1707
 
1708 1708
 		// Needed by the validate funtion
1709 1709
 		$failed_validation_page = NULL;
@@ -1711,14 +1711,14 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 		// Prevent entry limit from running when editing an entry, also
1713 1713
 		// prevent form scheduling from preventing editing
1714
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1714
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1715 1715
 
1716 1716
 		// Hide fields depending on Edit Entry settings
1717
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1717
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1718 1718
 
1719 1719
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1720 1720
 
1721
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1721
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1722 1722
 	}
1723 1723
 
1724 1724
 
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 
1747 1747
 		$gv_valid = true;
1748 1748
 
1749
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1749
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1750 1750
 
1751 1751
 			$value = RGFormsModel::get_field_value( $field );
1752 1752
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1759,22 +1759,22 @@  discard block
 block discarded – undo
1759 1759
 				case 'post_image':
1760 1760
 
1761 1761
 				    // in case nothing is uploaded but there are already files saved
1762
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1762
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1763 1763
 				        $field->failed_validation = false;
1764 1764
 				        unset( $field->validation_message );
1765 1765
 				    }
1766 1766
 
1767 1767
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1768
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1768
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1769 1769
 
1770 1770
 				        $input_name = 'input_' . $field->id;
1771 1771
 				        //uploaded
1772
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1772
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1773 1773
 
1774 1774
 				        //existent
1775 1775
 				        $entry = $this->get_entry();
1776 1776
 				        $value = NULL;
1777
-				        if( isset( $entry[ $field->id ] ) ) {
1777
+				        if ( isset( $entry[ $field->id ] ) ) {
1778 1778
 				            $value = json_decode( $entry[ $field->id ], true );
1779 1779
 				        }
1780 1780
 
@@ -1782,13 +1782,13 @@  discard block
 block discarded – undo
1782 1782
 				        $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1783 1783
 						               ( is_array( $value ) ? count( $value ) : 0 );
1784 1784
 
1785
-				        if( $count_files > $field->maxFiles ) {
1785
+				        if ( $count_files > $field->maxFiles ) {
1786 1786
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1787 1787
 				            $field->failed_validation = 1;
1788 1788
 				            $gv_valid = false;
1789 1789
 
1790 1790
 				            // in case of error make sure the newest upload files are removed from the upload input
1791
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1791
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1792 1792
 				        }
1793 1793
 
1794 1794
 				    }
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 			}
1800 1800
 
1801 1801
 			// This field has failed validation.
1802
-			if( !empty( $field->failed_validation ) ) {
1802
+			if ( ! empty( $field->failed_validation ) ) {
1803 1803
 
1804 1804
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1805 1805
 
@@ -1817,19 +1817,19 @@  discard block
 block discarded – undo
1817 1817
 				}
1818 1818
 
1819 1819
 				// You can't continue inside a switch, so we do it after.
1820
-				if( empty( $field->failed_validation ) ) {
1820
+				if ( empty( $field->failed_validation ) ) {
1821 1821
 				    continue;
1822 1822
 				}
1823 1823
 
1824 1824
 				// checks if the No Duplicates option is not validating entry against itself, since
1825 1825
 				// we're editing a stored entry, it would also assume it's a duplicate.
1826
-				if( !empty( $field->noDuplicates ) ) {
1826
+				if ( ! empty( $field->noDuplicates ) ) {
1827 1827
 
1828 1828
 				    $entry = $this->get_entry();
1829 1829
 
1830 1830
 				    // If the value of the entry is the same as the stored value
1831 1831
 				    // Then we can assume it's not a duplicate, it's the same.
1832
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1832
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1833 1833
 				        //if value submitted was not changed, then don't validate
1834 1834
 				        $field->failed_validation = false;
1835 1835
 
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
 				}
1843 1843
 
1844 1844
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1845
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1845
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1846 1846
 				    unset( $field->validation_message );
1847 1847
 					$field->failed_validation = false;
1848 1848
 				    continue;
@@ -1854,12 +1854,12 @@  discard block
 block discarded – undo
1854 1854
 
1855 1855
 		}
1856 1856
 
1857
-		$validation_results['is_valid'] = $gv_valid;
1857
+		$validation_results[ 'is_valid' ] = $gv_valid;
1858 1858
 
1859 1859
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1860 1860
 
1861 1861
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1862
-		$this->form_after_validation = $validation_results['form'];
1862
+		$this->form_after_validation = $validation_results[ 'form' ];
1863 1863
 
1864 1864
 		return $validation_results;
1865 1865
 	}
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
 	 */
1873 1873
 	public function get_entry() {
1874 1874
 
1875
-		if( empty( $this->entry ) ) {
1875
+		if ( empty( $this->entry ) ) {
1876 1876
 			// Get the database value of the entry that's being edited
1877 1877
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1878 1878
 		}
@@ -1904,10 +1904,10 @@  discard block
 block discarded – undo
1904 1904
 		}
1905 1905
 
1906 1906
 		// If edit tab not yet configured, show all fields
1907
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1907
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1908 1908
 
1909 1909
 		// Hide fields depending on admin settings
1910
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1910
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1911 1911
 
1912 1912
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1913 1913
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
 	 */
1941 1941
 	private function filter_fields( $fields, $configured_fields ) {
1942 1942
 
1943
-		if( empty( $fields ) || !is_array( $fields ) ) {
1943
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1944 1944
 			return $fields;
1945 1945
 		}
1946 1946
 
@@ -1957,12 +1957,12 @@  discard block
 block discarded – undo
1957 1957
 
1958 1958
 			// Remove the fields that have calculation properties and keep them to be used later
1959 1959
 			// @since 1.16.2
1960
-			if( $field->has_calculation() ) {
1961
-				$this->fields_with_calculation[] = $field;
1960
+			if ( $field->has_calculation() ) {
1961
+				$this->fields_with_calculation[ ] = $field;
1962 1962
 				// don't remove the calculation fields on form render.
1963 1963
 			}
1964 1964
 
1965
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1965
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1966 1966
 				unset( $fields[ $key ] );
1967 1967
 			}
1968 1968
 		}
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 					continue; // Never include when no fields are configured
1993 1993
 				}
1994 1994
 
1995
-				$out_fields[] = $field;
1995
+				$out_fields[ ] = $field;
1996 1996
 			}
1997 1997
 
1998 1998
 			return array_values( $out_fields );
@@ -2003,8 +2003,8 @@  discard block
 block discarded – undo
2003 2003
 
2004 2004
 	        /** @var GF_Field $field */
2005 2005
 	        foreach ( $fields as $field ) {
2006
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2007
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2006
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2007
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
2008 2008
 				    break;
2009 2009
 				}
2010 2010
 
@@ -2027,14 +2027,14 @@  discard block
 block discarded – undo
2027 2027
 
2028 2028
 		$return_field = $field;
2029 2029
 
2030
-		if( empty( $field_setting['show_label'] ) ) {
2030
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
2031 2031
 			$return_field->label = '';
2032
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
2033
-			$return_field->label = $field_setting['custom_label'];
2032
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
2033
+			$return_field->label = $field_setting[ 'custom_label' ];
2034 2034
 		}
2035 2035
 
2036
-		if( !empty( $field_setting['custom_class'] ) ) {
2037
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
2036
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
2037
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
2038 2038
 		}
2039 2039
 
2040 2040
 		/**
@@ -2072,16 +2072,16 @@  discard block
 block discarded – undo
2072 2072
 	     */
2073 2073
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2074 2074
 
2075
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2076
-			foreach( $fields as $k => $field ) {
2077
-				if( $field->adminOnly ) {
2075
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2076
+			foreach ( $fields as $k => $field ) {
2077
+				if ( $field->adminOnly ) {
2078 2078
 				    unset( $fields[ $k ] );
2079 2079
 				}
2080 2080
 			}
2081 2081
 			return array_values( $fields );
2082 2082
 		}
2083 2083
 
2084
-	    foreach( $fields as &$field ) {
2084
+	    foreach ( $fields as &$field ) {
2085 2085
 		    $field->adminOnly = false;
2086 2086
 		}
2087 2087
 
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 	 */
2103 2103
 	private function unselect_default_values( $form ) {
2104 2104
 
2105
-	    foreach ( $form['fields'] as &$field ) {
2105
+	    foreach ( $form[ 'fields' ] as &$field ) {
2106 2106
 
2107 2107
 			if ( empty( $field->choices ) ) {
2108 2108
                 continue;
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 
2111 2111
             foreach ( $field->choices as &$choice ) {
2112 2112
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2113
-					$choice['isSelected'] = false;
2113
+					$choice[ 'isSelected' ] = false;
2114 2114
 				}
2115 2115
 			}
2116 2116
 		}
@@ -2135,22 +2135,22 @@  discard block
 block discarded – undo
2135 2135
 	 */
2136 2136
 	function prefill_conditional_logic( $form ) {
2137 2137
 
2138
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2138
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2139 2139
 			return $form;
2140 2140
 		}
2141 2141
 
2142 2142
 		// Have Conditional Logic pre-fill fields as if the data were default values
2143 2143
 		/** @var GF_Field $field */
2144
-		foreach ( $form['fields'] as &$field ) {
2144
+		foreach ( $form[ 'fields' ] as &$field ) {
2145 2145
 
2146
-			if( 'checkbox' === $field->type ) {
2146
+			if ( 'checkbox' === $field->type ) {
2147 2147
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2148
-				    $input_id = $input['id'];
2148
+				    $input_id = $input[ 'id' ];
2149 2149
 				    $choice = $field->choices[ $key ];
2150 2150
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2151 2151
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2152
-				    if( $match ) {
2153
-				        $field->choices[ $key ]['isSelected'] = true;
2152
+				    if ( $match ) {
2153
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2154 2154
 				    }
2155 2155
 				}
2156 2156
 			} else {
@@ -2158,15 +2158,15 @@  discard block
 block discarded – undo
2158 2158
 				// We need to run through each field to set the default values
2159 2159
 				foreach ( $this->entry as $field_id => $field_value ) {
2160 2160
 
2161
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2161
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2162 2162
 
2163
-				        if( 'list' === $field->type ) {
2163
+				        if ( 'list' === $field->type ) {
2164 2164
 				            $list_rows = maybe_unserialize( $field_value );
2165 2165
 
2166 2166
 				            $list_field_value = array();
2167
-				            foreach ( (array) $list_rows as $row ) {
2168
-				                foreach ( (array) $row as $column ) {
2169
-				                    $list_field_value[] = $column;
2167
+				            foreach ( (array)$list_rows as $row ) {
2168
+				                foreach ( (array)$row as $column ) {
2169
+				                    $list_field_value[ ] = $column;
2170 2170
 				                }
2171 2171
 				            }
2172 2172
 
@@ -2199,32 +2199,32 @@  discard block
 block discarded – undo
2199 2199
 		 * @see https://github.com/gravityview/GravityView/issues/840
2200 2200
 		 * @since develop
2201 2201
 		 */
2202
-		$the_form = GFAPI::get_form( $form['id'] );
2202
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2203 2203
 		$editable_ids = array();
2204
-		foreach ( $form['fields'] as $field ) {
2205
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2204
+		foreach ( $form[ 'fields' ] as $field ) {
2205
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2206 2206
 		}
2207 2207
 		$remove_conditions_rule = array();
2208
-		foreach ( $the_form['fields'] as $field ) {
2209
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2210
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2211
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2208
+		foreach ( $the_form[ 'fields' ] as $field ) {
2209
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2210
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2211
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2212 2212
 						/**
2213 2213
 						 * This conditional field is not editable in this View.
2214 2214
 						 * We need to remove the rule, but only if it matches.
2215 2215
 						 */
2216
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2216
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2217 2217
 							$value = $_field->get_value_export( $this->entry );
2218
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2219
-							$value = $this->entry[ $rule['fieldId'] ];
2218
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2219
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2220 2220
 						} else {
2221
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2221
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2222 2222
 						}
2223 2223
 
2224
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2224
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2225 2225
 
2226 2226
 						if ( $match ) {
2227
-							$remove_conditions_rule[] = array( $field['id'], $i );
2227
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2228 2228
 						}
2229 2229
 					}
2230 2230
 				}
@@ -2232,21 +2232,21 @@  discard block
 block discarded – undo
2232 2232
 		}
2233 2233
 
2234 2234
 		if ( $remove_conditions_rule ) {
2235
-			foreach ( $form['fields'] as &$field ) {
2235
+			foreach ( $form[ 'fields' ] as &$field ) {
2236 2236
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2237 2237
 
2238 2238
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2239 2239
 
2240
-					if ( $field['id'] == $rule_field_id ) {
2241
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2242
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2240
+					if ( $field[ 'id' ] == $rule_field_id ) {
2241
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2242
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2243 2243
 					}
2244 2244
 				}
2245 2245
 			}
2246 2246
 		}
2247 2247
 
2248 2248
 		/** Normalize the indices... */
2249
-		$form['fields'] = array_values( $form['fields'] );
2249
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2250 2250
 
2251 2251
 		/**
2252 2252
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2256,16 +2256,16 @@  discard block
 block discarded – undo
2256 2256
 		 */
2257 2257
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2258 2258
 
2259
-		if( $use_conditional_logic ) {
2259
+		if ( $use_conditional_logic ) {
2260 2260
 			return $form;
2261 2261
 		}
2262 2262
 
2263
-		foreach( $form['fields'] as &$field ) {
2263
+		foreach ( $form[ 'fields' ] as &$field ) {
2264 2264
 			/* @var GF_Field $field */
2265 2265
 			$field->conditionalLogic = null;
2266 2266
 		}
2267 2267
 
2268
-		unset( $form['button']['conditionalLogic'] );
2268
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2269 2269
 
2270 2270
 		return $form;
2271 2271
 
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
 	 */
2283 2283
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2284 2284
 
2285
-		if( ! $this->is_edit_entry() ) {
2285
+		if ( ! $this->is_edit_entry() ) {
2286 2286
 			return $has_conditional_logic;
2287 2287
 		}
2288 2288
 
@@ -2314,44 +2314,44 @@  discard block
 block discarded – undo
2314 2314
 		 *  2. There are two entries embedded using oEmbed
2315 2315
 		 *  3. One of the entries has just been saved
2316 2316
 		 */
2317
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2317
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2318 2318
 
2319 2319
 			$error = true;
2320 2320
 
2321 2321
 		}
2322 2322
 
2323
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2323
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2324 2324
 
2325 2325
 			$error = true;
2326 2326
 
2327
-		} elseif( ! $this->verify_nonce() ) {
2327
+		} elseif ( ! $this->verify_nonce() ) {
2328 2328
 
2329 2329
 			/**
2330 2330
 			 * If the Entry is embedded, there may be two entries on the same page.
2331 2331
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2332 2332
 			 */
2333
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2333
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2334 2334
 				$error = true;
2335 2335
 			} else {
2336
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2336
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2337 2337
 			}
2338 2338
 
2339 2339
 		}
2340 2340
 
2341
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2342
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2341
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2342
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2343 2343
 		}
2344 2344
 
2345
-		if( $this->entry['status'] === 'trash' ) {
2346
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2345
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2346
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2347 2347
 		}
2348 2348
 
2349 2349
 		// No errors; everything's fine here!
2350
-		if( empty( $error ) ) {
2350
+		if ( empty( $error ) ) {
2351 2351
 			return true;
2352 2352
 		}
2353 2353
 
2354
-		if( $echo && $error !== true ) {
2354
+		if ( $echo && $error !== true ) {
2355 2355
 
2356 2356
 	        $error = esc_html( $error );
2357 2357
 
@@ -2359,10 +2359,10 @@  discard block
 block discarded – undo
2359 2359
 	         * @since 1.9
2360 2360
 	         */
2361 2361
 	        if ( ! empty( $this->entry ) ) {
2362
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
2362
+		        $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
2363 2363
 	        }
2364 2364
 
2365
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2365
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2366 2366
 		}
2367 2367
 
2368 2368
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2382,17 +2382,17 @@  discard block
 block discarded – undo
2382 2382
 
2383 2383
 		$error = NULL;
2384 2384
 
2385
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2386
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2385
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2386
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2387 2387
 		}
2388 2388
 
2389 2389
 		// No errors; everything's fine here!
2390
-		if( empty( $error ) ) {
2390
+		if ( empty( $error ) ) {
2391 2391
 			return true;
2392 2392
 		}
2393 2393
 
2394
-		if( $echo ) {
2395
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2394
+		if ( $echo ) {
2395
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2396 2396
 		}
2397 2397
 
2398 2398
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2413,14 +2413,14 @@  discard block
 block discarded – undo
2413 2413
 	private function check_user_cap_edit_field( $field ) {
2414 2414
 
2415 2415
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2416
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2416
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2417 2417
 			return true;
2418 2418
 		}
2419 2419
 
2420
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2420
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2421 2421
 
2422
-		if( $field_cap ) {
2423
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2422
+		if ( $field_cap ) {
2423
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2424 2424
 		}
2425 2425
 
2426 2426
 		return false;
@@ -2435,17 +2435,17 @@  discard block
 block discarded – undo
2435 2435
 return true;
2436 2436
 
2437 2437
 		// Verify form submitted for editing single
2438
-		if( $this->is_edit_entry_submission() ) {
2438
+		if ( $this->is_edit_entry_submission() ) {
2439 2439
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2440 2440
 		}
2441 2441
 
2442 2442
 		// Verify
2443
-		else if( ! $this->is_edit_entry() ) {
2443
+		else if ( ! $this->is_edit_entry() ) {
2444 2444
 			$valid = false;
2445 2445
 		}
2446 2446
 
2447 2447
 		else {
2448
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2448
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2449 2449
 		}
2450 2450
 
2451 2451
 		/**
Please login to merge, or discard this patch.
future/includes/class-gv-template-field.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	public function __destruct() {
95
-		remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );;
95
+		remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ;
96 96
 	}
97 97
 
98 98
 	/**
@@ -175,59 +175,59 @@  discard block
 block discarded – undo
175 175
 
176 176
 			if ( $is_view && $post ) {
177 177
 				if ( $field_type ) {
178
-					$specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name );
179
-					$inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name );
180
-					$specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type );
181
-					$inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType );
182
-					$specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name );
183
-					$inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name );
184
-					$specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type );
185
-					$inputType &&  $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType );
178
+					$specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name );
179
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name );
180
+					$specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type );
181
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType );
182
+					$specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name );
183
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name );
184
+					$specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type );
185
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType );
186 186
 				}
187 187
 
188
-				$specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name );
189
-				$specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id );
190
-				$specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name );
191
-				$specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID );
188
+				$specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name );
189
+				$specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id );
190
+				$specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name );
191
+				$specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID );
192 192
 			}
193 193
 
194 194
 			/** Field-specific */
195 195
 			if ( $field_id && $form_id ) {
196 196
 
197 197
 				if ( $field_id ) {
198
-					$specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name );
199
-					$specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id );
198
+					$specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name );
199
+					$specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id );
200 200
 
201 201
 					if ( $view_id ) {
202
-						$specifics []= sprintf( '%sview-%d-field-%d.php', $slug_dir, $view_id, $field_id );
202
+						$specifics [ ] = sprintf( '%sview-%d-field-%d.php', $slug_dir, $view_id, $field_id );
203 203
 					}
204 204
 				}
205 205
 
206 206
 				if ( $field_type ) {
207
-					$specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name );
208
-					$inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name );
209
-					$specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type );
210
-					$inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType );
211
-
212
-					$specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name );
213
-					$inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name );
214
-					$specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type );
215
-					$inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType );
216
-
217
-					$specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name );
218
-					$inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name );
219
-					$specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type );
220
-					$inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType );
207
+					$specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name );
208
+					$inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name );
209
+					$specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type );
210
+					$inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType );
211
+
212
+					$specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name );
213
+					$inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name );
214
+					$specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type );
215
+					$inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType );
216
+
217
+					$specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name );
218
+					$inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name );
219
+					$specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type );
220
+					$inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType );
221 221
 				}
222 222
 			}
223 223
 
224 224
 			if ( $form_id ) {
225 225
 				/** Generic field templates */
226
-				$specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name );
227
-				$specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name );
226
+				$specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name );
227
+				$specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name );
228 228
 
229
-				$specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id );
230
-				$specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id );
229
+				$specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id );
230
+				$specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id );
231 231
 			}
232 232
 
233 233
 			/**
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 			 * Ignore some types that conflict.
236 236
 			 */
237 237
 			if ( ! in_array( $field_type, array( 'notes' ) ) ) {
238
-				$specifics []= sprintf( '%s.php', $field_type );
239
-				$specifics []= sprintf( 'fields/%s.php', $field_type );
238
+				$specifics [ ] = sprintf( '%s.php', $field_type );
239
+				$specifics [ ] = sprintf( 'fields/%s.php', $field_type );
240 240
 			}
241 241
 
242
-			$specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name );
243
-			$specifics []= sprintf( '%sfield.php', $slug_dir );
242
+			$specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name );
243
+			$specifics [ ] = sprintf( '%sfield.php', $slug_dir );
244 244
 
245 245
 			return array_merge( $specifics, $templates );
246 246
 		};
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			/** Prevent any PHP warnings that may be generated. */
276 276
 			ob_start();
277 277
 
278
-			$display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry['currency'], false, 'html' );
278
+			$display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry[ 'currency' ], false, 'html' );
279 279
 
280 280
 			if ( $errors = ob_get_clean() ) {
281 281
 				gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) );
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			if ( ! empty( $field->show_as_link ) && ! \gv_empty( $output, false, false ) ) {
386 386
 				$link_atts = empty( $field->new_window ) ? array() : array( 'target' => '_blank' );
387 387
 
388
-				$link_atts['class'] = 'gravityview-fancybox';
388
+				$link_atts[ 'class' ] = 'gravityview-fancybox';
389 389
 
390 390
 				$fancybox_settings = array(
391 391
 					'type' => 'ajax',
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					),
395 395
 				);
396 396
 
397
-				$link_atts['data-options'] = json_encode( $fancybox_settings );
397
+				$link_atts[ 'data-options' ] = json_encode( $fancybox_settings );
398 398
 
399 399
 				$permalink = $context->entry->get_permalink( $context->view, $context->request );
400 400
 
Please login to merge, or discard this patch.